From ae99ffb9292fff135db2f8cfc5eb631c138f324a Mon Sep 17 00:00:00 2001 From: jenkins Date: Mon, 22 Dec 2025 14:58:04 +0000 Subject: [PATCH] Release v30.2.0 (from 889635ab5e3bd31aa685c07ac870cfe4d0f7caca) --- changelog.md | 60 +++- ...be9408.js => 1485.62487782be5544fea53d.js} | 2 +- .../bundles/2475.1ed8b62332af605c5bee.js | 31 -- ...7ad197.js => 5893.de851bcf23a70646c585.js} | 2 +- .../bundles/6094.a6a9dab4a3149840bbeb.css | 1 - .../bundles/6094.a6a9dab4a3149840bbeb.rtl.css | 1 - .../bundles/6094.bd5174488126d28070f4.css | 1 + .../bundles/6094.bd5174488126d28070f4.rtl.css | 1 + .../bundles/9026.75767d113c906e89c496.js | 31 ++ ...dd-compare-dialog.c700b910ca230864c99c.js} | 2 +- ...-actions-provider.c29faaaa30fce24293fa.js} | 2 +- ...floating-toolbars.b5394bfa95332ed5a617.js} | 32 +- ...bal-search-dialog.95f16ea4245f74436891.js} | 2 +- ...a5c.js => library.022b0cac58461bba6f17.js} | 287 +++++++++--------- ...e07.js => runtime.06e455b5bc27a2ed7f94.js} | 8 +- ...bol-search-dialog.54853b5c5b40e1f16d7e.js} | 2 +- charting_library/charting_library.cjs.js | 2 +- charting_library/charting_library.d.ts | 77 ++++- charting_library/charting_library.esm.js | 2 +- charting_library/charting_library.js | 2 +- .../charting_library.standalone.js | 2 +- charting_library/datafeed-api.d.ts | 41 ++- charting_library/package.json | 2 +- package.json | 2 +- 24 files changed, 371 insertions(+), 224 deletions(-) rename charting_library/bundles/{1485.d2c9ddbfe2c9c5be9408.js => 1485.62487782be5544fea53d.js} (98%) delete mode 100644 charting_library/bundles/2475.1ed8b62332af605c5bee.js rename charting_library/bundles/{5893.e5c9a9c5e41a157ad197.js => 5893.de851bcf23a70646c585.js} (99%) delete mode 100644 charting_library/bundles/6094.a6a9dab4a3149840bbeb.css delete mode 100644 charting_library/bundles/6094.a6a9dab4a3149840bbeb.rtl.css create mode 100644 charting_library/bundles/6094.bd5174488126d28070f4.css create mode 100644 charting_library/bundles/6094.bd5174488126d28070f4.rtl.css create mode 100644 charting_library/bundles/9026.75767d113c906e89c496.js rename charting_library/bundles/{add-compare-dialog.3cab117ede5b1696d880.js => add-compare-dialog.c700b910ca230864c99c.js} (99%) rename charting_library/bundles/{chart-actions-provider.5db78c705ae2a12ecca3.js => chart-actions-provider.c29faaaa30fce24293fa.js} (99%) rename charting_library/bundles/{floating-toolbars.e8ff289dd4e8225bc29e.js => floating-toolbars.b5394bfa95332ed5a617.js} (71%) rename charting_library/bundles/{global-search-dialog.f532e65043c071476f6b.js => global-search-dialog.95f16ea4245f74436891.js} (99%) rename charting_library/bundles/{library.668013b6b41ce2feaa5c.js => library.022b0cac58461bba6f17.js} (84%) rename charting_library/bundles/{runtime.ddf792da21403fea7e07.js => runtime.06e455b5bc27a2ed7f94.js} (78%) rename charting_library/bundles/{symbol-search-dialog.20a5ff1d11fd823861a0.js => symbol-search-dialog.54853b5c5b40e1f16d7e.js} (97%) diff --git a/changelog.md b/changelog.md index bfba61a2..e67b0e0f 100644 --- a/changelog.md +++ b/changelog.md @@ -5,6 +5,46 @@ +## Version 30.2.0 + +*Date: Mon Dec 22 2025* + +**New Features** + +- **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) + - [Memory leak investigation steps](https://www.tradingview.com/charting-library-docs/latest/troubleshooting/#memory-leaks) + - [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. diff --git a/charting_library/bundles/1485.d2c9ddbfe2c9c5be9408.js b/charting_library/bundles/1485.62487782be5544fea53d.js similarity index 98% rename from charting_library/bundles/1485.d2c9ddbfe2c9c5be9408.js rename to charting_library/bundles/1485.62487782be5544fea53d.js index 027b6a7c..f48ec412 100644 --- a/charting_library/bundles/1485.d2c9ddbfe2c9c5be9408.js +++ b/charting_library/bundles/1485.62487782be5544fea53d.js @@ -28,7 +28,7 @@ this._metaInfo.subscribe((()=>this._onFormatterPropsChanged())),this._showStudyA 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(){return this._properties}propertiesPatched(){return this._propertiesPatched}isDraggable(){return!this._metaInfo.value().linkedToSeries}logs(){return null}logLevelMask(){const e=this._properties.childs().inputs.childs().__log_level.value();if(!(0,_.isNumber)(e)||e<0||e>7)throw new Error(`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){const t=(Number(e.error)&&1)|(Number(e.warning)&&2)|(Number(e.info)&&4);this._properties.childs().inputs.childs().__log_level.setValue(t)}performance(){return new b.WatchedValue(null)}profilingEnabled(){return!!this._properties.childs().inputs.childs().__profile?.value()}enableProfiling(e){this._properties.childs().inputs.childs().__profile?.setValue(e)}onAboutToBeDestroyed(){return this._aboutToBeDestroyed}priceScale(e){return e?this._model.mainSeries().priceScale():super.priceScale()}lastValueData(e,t,s){const i={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())return i;const o=this._model.timeScale().visibleBarsStrictRange(),a=this.firstValue(!0,r);if(null===o||null===a)return i;if(!this._properties.childs().visible.value())return i;const l=this._properties.childs().styles,h=this._properties.childs().ohlcPlots;let c,u;if(l&&l.childs()[e]&&(c=l.childs()[e]),h&&h.childs()[e]&&(c=h.childs()[e]),!c||0===c.childs().display.value())return i;const d=this.metaInfo().plots;for(u=0;ue.id()));if(a.length&&(r.parentSources=a),e){let e=this.data();const t=this._model.timeScale(),s=this._seriesDataRangeToSave(e);null!==s&&(e=e.range(s.firstBar(),s.lastBar())),r.data=e.state(),r.data.symbols=this._resolvedSymbols,r.data.graphics=(0,R.saveStudyGraphics)(this.graphics(),t.visibleBarsStrictRange()),r.data.plotOffsets=this._serverPlotOffsets.value()}this.ownerSource()&&(r.ownerSource=this.ownerSource()?.id());for(let e=0;e=0?e:0}}if(r.state?.inputs){const e=r.metaInfo.inputs.find((e=>"ILScript"===e.name));e&&delete r.state.inputs[e.id],delete r.state.inputs.__log_level,delete r.state.inputs.__profile}const l=this.stateCustomFields();return l&&(r.customFields=l),r}stateCustomFields(){const e=this._compileErrorStatus.value();if(e)return{compileErrorDescription:e.errorDescription}}restoreStateCustomFields(e){const t=e.compileErrorDescription;t&&this.setErrorCompilation([(0,p.ensureDefined)(t.editorError)])}restoreData(e){this._invalidateLastNonEmptyPlotRowCache(),this.data().restoreState(e),this._resolvedSymbols=e.symbols??{},this._graphics=e.graphics?(0,R.loadStudyGraphics)(e.graphics):(0,R.emptyStudyGraphics)(),this._postProcessGraphics(),this._serverPlotOffsets.setValue(e.plotOffsets??{}),this._setStatus({type:xt.StudyStatusType.Completed},!0)}hasStateForAlert(){return!1}stateForAlert(){throw new Error("Not implemented")}async stateForAlertAsync(){throw new Error("Not implemented")}idForAlert(){return super.idForAlert()}hasBarColorer(){return this._metaInfo.value().plots.some(L.isBarColorerPlot)}barColorer(){const e=this._metaInfo.value().plots;let t=null;for(let s=e.length-1;s>=0;s--)if((0,L.isBarColorerPlot)(e[s])){const e=new Bt(this,s);null===t?t=e:t.pushBackBarColorer(e)}return t}isSavedInStudyTemplates(){return this._metaInfo.value().inputs.every((e=>"bar_time"!==e.type))}restart(e){this._restarting=!0,this.clearData(),(e||ee.enabled("stop_study_on_restart"))&&this.stop(),setTimeout(this.start.bind(this),0)}stop(e,t){if(!0===e&&this._children)for(const e of this._children)e.stop(!0);this._stopStudyOnServer(),this.clearData(),this._unsubscribeToSessionId(),this.recalculate()}disconnect(){this._isStarted=!1,this._model.isSnapshot()||(this._resolvedSymbols={},this._resolvedSymbolsByInput={})}sourceId(){return this._id.value()}parentSources(){return this._sources.value()} parentSourcesVW(){return this._sources}symbolSource(){return this._symbolSource.value()}symbolSourceWV(){return this._symbolSource.readonly()}valueAt(e,t){return this.symbolSource().valueAt(e,t)}barsProvider(){return this._firstSourceOrSeries().barsProvider()}ownerSource(){return this.isChildStudy()?this._sources.value()[0]:super.ownerSource()}isChildStudy(){return this._sources.value().length>0}hasChildren(){return this._children.length>0}isStarted(){return this._isStarted}isRestarting(){return this._restarting}isActualInterval(){return this._isActualInterval}onIsActualIntervalChange(){return this._onIsActualIntervalChange}isVisible(){const e=this._properties.childs();if(this._model.collapsed().value()||!e.visible.value()||!this.isActualInterval())return!1;const t=this.metaInfo();if(t.plots.length>0)for(let s=0;se.isHibernated())).map((e=>e.start())));const r=!(this.isHibernationAllowed()&&!this.isVisible())||!0===t;if(this._chartApi&&this._chartApi.isConnected().value()&&r)try{await this._allSymbolsAreResolved(),await this._startAfterSymbolsResolved(e,t)}catch(e){const t=`ERROR: ${this._debugId()} start failed, ${e}`;Gt.logError(t),this._restarting=!1,"TooManyStudies"===e?.cause&&(0,S.showTooManyStudiesNotice)(this._chartApi.getStudyCounter())}r||void 0!==this._inputs||(this._inputs=this._apiInputs())}replaceData(e,t,s){this._invalidateLastNonEmptyPlotRowCache(),this.data().remove(e+1),this.data().addTail(s,t)}inputs(e){const t=(0,n.default)((0,_.clone)(Jt),e||{});t.skipOptionalEmptySymbolInputs&&(t.keepOptionalSymbolsEmpty=!0);return this._buildInputs(t)}data(){return this._data}moveData(e){this._ongoingDataUpdate=this._ongoingDataUpdate.then((()=>{this._invalidateLastNonEmptyPlotRowCache(),this._moveData(e),this.data().isEmpty()||this._onIndexDiffsApplied(e)}))}plots(){return this.data()}metaInfo(){return this._metaInfo.value()}status(){return this._compileActiveStatus.value()??this._compileErrorStatus.value()??this._status.value()}name(e){return e?this.metaInfo().shortDescription||"Study":this.metaInfo().description||"Study"}title(e,t,s,i,r,n){i=void 0===i?!this._showStudyArgumentsProperty.value():i;const o=JSON.stringify([e,t,s,i,r,n]);if(this._titleStrCache[o])return this._titleStrCache[o];if(this._titleInPartsCache[o])return this._joinTitlesParts(this._titleInPartsCache[o]);const a=this._title(e,t,s,i,r,n) -;return this._titleStrCache[o]=a,a}titleInParts(e,t,s,i,r){i=void 0===i?!this._showStudyArgumentsProperty.value():i;const n=JSON.stringify([e,t,s,i,r]);if(this._titleInPartsCache[n])return this._titleInPartsCache[n];const o=this._titleInParts(e,t,s,i,r);return this._titleInPartsCache[n]=o,o}inputsInParts(e,t=!0,s,i,r){const n=!this._showStudyArgumentsProperty.value(),o=ee.enabled("always_show_study_symbol_input_values_in_legend"),a=n&&o;if(n&&!o&&e===Y.TitleDisplayTarget.StatusLine)return null;const l=JSON.stringify([e,t,s,i,r]);if(this._inputsInPartsCache[l])return this._inputsInPartsCache[l];const h=[],c=this.metaInfo(),u=this._titleInputs((0,zt.toInputDisplayFlags)(e),i,!0),d=c.inputs.filter((e=>u.hasOwnProperty(e.id)&&(!a||"symbol"===e.type))).map((e=>{let t=u[e.id];if("symbol"===e.type){const s=this._properties.childs().inputs.child(e.id)?.value();if(s){const e=this._resolvedSymbolsByInput[s];e&&(t=this._model.symbolAliasService()?.getAliasByProName(e.pro_name)?.aliasName??t)}}return{meta:e,value:t}})),f={};if(d.length>0){if(this.isChildStudy())for(let s=0;s=0){const s=this.parentSourceForInput(a);if(s instanceof us){const n=s.metaInfo(),o=s.title(e,t,{},!0,i,r);if(1===n.plots.length)f[a]=o;else{const e=a.split("$")[1],t=n.plots[parseInt(e)]?.id,s=n.styles&&n.styles[t],i=s&&s.title||t;f[a]=o+": "+i}}}}d.forEach((({meta:e,value:t})=>{let i;i="time"===e.type?new Date(t).toISOString():(0,_.isNumber)(t)?(0,Lt.getNumericFormatter)().format(t):f&&f[t.toString()]||t.toString(),s&&s[i.toString()]&&(i=s[i.toString()]),h.push({title:(0,Ut.getTranslatedInputTitle)(e.name),value:i})}))}return this._inputsInPartsCache[l]=h,h}invalidateTitleCache(e){if(this._titleStrCache={},this._titleInPartsCache={},this._inputsInPartsCache={},!0===e&&this._children)for(let t=0;tu.hasOwnProperty(e.id)&&(!a||"symbol"===e.type||e?.isAlwaysShownInLegend))).map((e=>{let t=u[e.id];if("symbol"===e.type){const s=this._properties.childs().inputs.child(e.id)?.value();if(s){const e=this._resolvedSymbolsByInput[s];e&&(t=this._model.symbolAliasService()?.getAliasByProName(e.pro_name)?.aliasName??t)}}return{meta:e,value:t}})),f={};if(d.length>0){if(this.isChildStudy())for(let s=0;s=0){const s=this.parentSourceForInput(a);if(s instanceof us){const n=s.metaInfo(),o=s.title(e,t,{},!0,i,r);if(1===n.plots.length)f[a]=o;else{const e=a.split("$")[1],t=n.plots[parseInt(e)]?.id,s=n.styles&&n.styles[t],i=s&&s.title||t;f[a]=o+": "+i}}}}d.forEach((({meta:e,value:t})=>{let i;i="time"===e.type?new Date(t).toISOString():(0,_.isNumber)(t)?(0,Lt.getNumericFormatter)().format(t):f&&f[t.toString()]||t.toString(),s&&s[i.toString()]&&(i=s[i.toString()]),h.push({title:(0,Ut.getTranslatedInputTitle)(e.name),value:i})}))}return this._inputsInPartsCache[l]=h,h}invalidateTitleCache(e){if(this._titleStrCache={},this._titleInPartsCache={},this._inputsInPartsCache={},!0===e&&this._children)for(let t=0;tt.update(e))),this._labelPaneViews.forEach((t=>t.update(e))), this._dataWindowView?.update(e),this._legendView?.update(e),this._statusView?.update(e),this._floatingTooltipView?.update(e),this._priceAxisViews.forEach((t=>t.update(e))),this._priceLinesAxisViews.forEach((t=>t.update(e))),this._inputsLinesPaneView?.update(e),this._inputsAnchorsPaneView?.update(e),this._inputsTimeAxisPaneViews.forEach((t=>t.update(e))),this._inputsPriceAxisPaneViews.forEach((t=>t.update(e)))),i||(this._forceOverlaysPaneViews.forEach((t=>t.update(e))),this._forceOverlayLabelPaneViews.forEach((t=>t.update(e))),this._forceOverlayPriceAxisViews.forEach((t=>t.update(e)))),"data-source-change"===e.type&&e.sourceId===this.id()&&e.clearData&&this._children.forEach((e=>e.updateAllViews({type:"data-source-change",sourceId:e.id(),clearData:!0})))}removeByRemoveAllStudies(){return!0}studyName(){return this._studyName}nearestIndex(e,t,s){return this.data().search(e,t,s)?.index}getMinFirstBarIndexForPlot(e){const t=this._properties.childs(),s=this._metaInfo,i=t.styles.childs()[e]?.child("showLast")?.value()??t.filledAreasStyle.childs()[e]?.child("showLast")?.value()??s.value().styles?.[e]?.showLast??t.ohlcPlots.childs()[e]?.child("showLast")?.value()??s.value().ohlcPlots?.[e]?.showLast??null;if(null===i)return-1/0;const r=this.data().lastIndex();return null===r?-1/0:r-i+1}guiPlotName(e,t){const s=this._metaInfo.value(),i=s.plots.find((e=>e.id===t));if(void 0!==i){return((0,L.isOhlcPlot)(i)?s.ohlcPlots?.[i.target]?.title:s.styles?.[t]?.title)??this.title(e)}return this.title(e)}childStudyByRebind(){return this._childStudyByRebind}isPine(){return void 0!==this._metaInfo.value().pine}isStandardPine(){return this.isPine()&&A.StudyMetaInfo.isStandardPine(this._metaInfo.value().id)}isLinkedToSeries(){return!0===this._metaInfo.value().linkedToSeries}preferredZOrder(){return!1===this._metaInfo.value().behind_chart?0:null}defaultPlotIdForAlert(){return this._metaInfo.value().plots?.[0]?.id??null}resolvedSymbolInfoBySymbol(e){return this._resolvedSymbols&&e&&this._resolvedSymbols[this._getSymbolForResolve(e)]||null}hasPendingUnresolvedSymbols(){return this._pendingResolveSymbols.size>0}hasSymbolInputs(){return this._metaInfo.value().inputs.some((e=>"symbol"===e.type))}currency(){if(null!==this._currencySourceSymbolInfo)return(0,Tt.symbolCurrency)(this._currencySourceSymbolInfo);const e=this.metaInfo();return Boolean(e)&&e.is_price_study?this._firstSourceOrSeries().currency():null}currencySourceSymbolInfo(){return this._currencySourceSymbolInfo??this.symbolSource()?.symbolInfo()??null}unit(){const e=this.metaInfo();return Boolean(e)&&e.is_price_study?this._firstSourceOrSeries().unit():null}canOverrideMinTick(){return!1}dataWindowView(){return this._dataWindowView}statusView(){return this._statusView}legendView(){return this._legendView}chartFloatingTooltipView(){return this._floatingTooltipView}pineSourceCodeModel(){return Promise.resolve(null)}alertSourceModel(){return this._alertSourceModel}inputsForAlertState(){return this.inputs()}sessionId(){return this._firstSourceOrSeries().sessionId()}sessionIdChanged(){ return this._firstSourceOrSeries().sessionIdChanged()}getSymbolString(e){return""===e?"":(0,U.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getSymbolObject(e))}onStatusChanged(){return this._statusChanged}onDataUpdated(){return this._dataUpdated}symbolsResolved(){return this._symbolsResolved}onHibernationStateChange(){return this._onHibernationStateChange}valuesProvider(){return this._valuesProvider}legendValuesProvider(){return new E(this,this.model())}tableViewValuesProvider(){return this._tableViewValuesProvider}statusProvider(e){return new $.StudyStatusProvider(this)}chartFloatingTooltipValuesProvider(){return new K(this,this.model())}correctScaleMargins(e){if("Volume"===this.metaInfo().shortId){const t=this.model().paneForSource(this);return null!==t&&t.isOverlay(this)&&t.containsMainSeries()?{top:.75,bottom:0}:{top:e.top,bottom:0}}return e}canBeHiddenByGlobalFlag(){return!0}isSourceHidden(){return!this.isVisible()||this.canBeHiddenByGlobalFlag()&&W.hideAllIndicators().value()}wasCompletedBefore(){return this._wasCompletedBefore}paneViews(e){const t=this._model.mainPane();if(this.isSourceHidden())return null;if(!e.hasPriceDataSource(this))return e!==t?null:this._forceOverlaysPaneViews;const s=[];return!this._startMovingPoint&&this._wasCompletedBefore&&s.push(...this._paneViews.filter((e=>!e.isForceOverlay?.()))),this._inputsLinesPaneView&&(this._startMovingPoint||this._model.selection().isSelected(this))&&s.push(this._inputsLinesPaneView),this._inputsAnchorsPaneView&&s.push(this._inputsAnchorsPaneView),e===t&&s.push(...this._forceOverlaysPaneViews),s}labelPaneViews(e){const t=this._model.mainPane();if(this.isSourceHidden()||!e.hasPriceDataSource(this))return this._metaInfo.value().hasForceOverlayPlots()?e!==t?null:this._forceOverlayLabelPaneViews:null;const s=[...this._labelPaneViews];return e===t&&s.push(...this._forceOverlayLabelPaneViews),s}timeAxisViews(){return this._model.selection().isSelected(this)?this._inputsTimeAxisPaneViews:null}priceAxisViews(e,t){if(t!==this.priceScale()&&t===this._model.mainSeries().priceScale()&&!e.hasDataSource(this))return this._forceOverlayPriceAxisViews;const s=this._properties.childs().oldShowLastValue;if(s&&!s.value())return null;let i=this._priceAxisViews.slice();return this._model.selection().isSelected(this)&&(i=i.concat(this._inputsPriceAxisPaneViews)),t===this._model.mainSeries().priceScale()&&(i=i.concat(this._forceOverlayPriceAxisViews)),e.findTargetPriceAxisViews(this,t,i,this._priceLinesAxisViews)}movable(){return null!==this._inputsAnchorsPaneView}startMoving(e,t,s,i){this._startMovingPoint=e}move(e,t,s,i){if(void 0!==e.logical&&null!==this._startMovingPoint){if(Array.isArray(t)){const s=t;this._updateInputValue(e.logical,s[0]),this._updateInputValue(e.logical,s[1])}else this._updateInputValue(e.logical,t);this.updateAllViews((0,N.sourceChangeEvent)(this.id()))}}endMoving(e,t){return this._startMovingPoint=null,{indexesChanged:!1,pricesChanged:!1}}clearData(){this._invalidateLastNonEmptyPlotRowCache(), diff --git a/charting_library/bundles/2475.1ed8b62332af605c5bee.js b/charting_library/bundles/2475.1ed8b62332af605c5bee.js deleted file mode 100644 index f4b1663f..00000000 --- a/charting_library/bundles/2475.1ed8b62332af605c5bee.js +++ /dev/null @@ -1,31 +0,0 @@ -(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[2475],{66783:e=>{"use strict";var t=Object.prototype.hasOwnProperty;function r(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}e.exports=function(e,n){if(r(e,n))return!0;if("object"!=typeof e||null===e||"object"!=typeof n||null===n)return!1;var o=Object.keys(e),a=Object.keys(n);if(o.length!==a.length)return!1;for(var l=0;l{e.exports={pair:"pair-ocURKVwI",xxceptionallysmalldonotusebrv1023:"xxceptionallysmalldonotusebrv1023-ocURKVwI",xxxxsmall:"xxxxsmall-ocURKVwI",xxxsmall:"xxxsmall-ocURKVwI",xxsmall:"xxsmall-ocURKVwI",xsmall:"xsmall-ocURKVwI",small:"small-ocURKVwI",medium:"medium-ocURKVwI",large:"large-ocURKVwI",xlarge:"xlarge-ocURKVwI",xxlarge:"xxlarge-ocURKVwI",xxxlarge:"xxxlarge-ocURKVwI",logo:"logo-ocURKVwI",skeleton:"skeleton-ocURKVwI",empty:"empty-ocURKVwI"}},6916:e=>{e.exports={xxxsmall:"xxxsmall-napy2vLF",xxsmall:"xxsmall-napy2vLF",xsmall:"xsmall-napy2vLF",small:"small-napy2vLF",medium:"medium-napy2vLF",large:"large-napy2vLF",xlarge:"xlarge-napy2vLF",counter:"counter-napy2vLF","color-danger":"color-danger-napy2vLF","color-accent":"color-accent-napy2vLF","color-accent-light":"color-accent-light-napy2vLF","color-neutral-bold":"color-neutral-bold-napy2vLF","color-neutral":"color-neutral-napy2vLF","borderColor-primary":"borderColor-primary-napy2vLF","borderColor-secondary":"borderColor-secondary-napy2vLF","borderColor-tertiary":"borderColor-tertiary-napy2vLF",disabled:"disabled-napy2vLF"}},19954:e=>{e.exports={hidden:"hidden-DgcIT6Uz",fadeInWrapper:"fadeInWrapper-DgcIT6Uz",isAnimated:"isAnimated-DgcIT6Uz"}},53895:e=>{e.exports={disableSelfPositioning:"disableSelfPositioning-dYiqkKAE"}},37370:e=>{e.exports={container:"container-M1mz4quA",pairContainer:"pairContainer-M1mz4quA",logo:"logo-M1mz4quA",hidden:"hidden-M1mz4quA"}},23296:e=>{e.exports={container:"container-qm7Rg5MB",mobile:"mobile-qm7Rg5MB",inputContainer:"inputContainer-qm7Rg5MB",withCancel:"withCancel-qm7Rg5MB",input:"input-qm7Rg5MB",icon:"icon-qm7Rg5MB",cancel:"cancel-qm7Rg5MB"}},33313:e=>{e.exports={actions:"actions-rarsm4ka",actionButton:"actionButton-rarsm4ka"}},88183:e=>{e.exports={logo:"logo-d0vVmGvT"}},20255:e=>{e.exports={"tablet-small-breakpoint":"(max-width: 440px)",itemRow:"itemRow-oRSs8UQo",multiLine:"multiLine-oRSs8UQo",cell:"cell-oRSs8UQo",itemInfoCell:"itemInfoCell-oRSs8UQo",description:"description-oRSs8UQo",symbolDescription:"symbolDescription-oRSs8UQo",flag:"flag-oRSs8UQo",exchangeDescription:"exchangeDescription-oRSs8UQo",marketType:"marketType-oRSs8UQo",exchangeName:"exchangeName-oRSs8UQo",actionHandleWrap:"actionHandleWrap-oRSs8UQo",source:"source-oRSs8UQo",hover:"hover-oRSs8UQo",selected:"selected-oRSs8UQo",active:"active-oRSs8UQo",highlighted:"highlighted-oRSs8UQo",light:"light-oRSs8UQo","highlight-animation-theme-light":"highlight-animation-theme-light-oRSs8UQo",dark:"dark-oRSs8UQo","highlight-animation-theme-dark":"highlight-animation-theme-dark-oRSs8UQo", -markedFlag:"markedFlag-oRSs8UQo",offset:"offset-oRSs8UQo",descriptionCell:"descriptionCell-oRSs8UQo",addition:"addition-oRSs8UQo",exchangeCell:"exchangeCell-oRSs8UQo",fixedWidth:"fixedWidth-oRSs8UQo",expandHandle:"expandHandle-oRSs8UQo",expanded:"expanded-oRSs8UQo",symbolTitle:"symbolTitle-oRSs8UQo",invalid:"invalid-oRSs8UQo",noDescription:"noDescription-oRSs8UQo",highlightedText:"highlightedText-oRSs8UQo",icon:"icon-oRSs8UQo",narrow:"narrow-oRSs8UQo",wide:"wide-oRSs8UQo",dataMode:"dataMode-oRSs8UQo",actionsCell:"actionsCell-oRSs8UQo",action:"action-oRSs8UQo",targetAction:"targetAction-oRSs8UQo",removeAction:"removeAction-oRSs8UQo",addAction:"addAction-oRSs8UQo",markedFlagWrap:"markedFlagWrap-oRSs8UQo",markedFlagMobile:"markedFlagMobile-oRSs8UQo",logo:"logo-oRSs8UQo",isExpandable:"isExpandable-oRSs8UQo",primaryIcon:"primaryIcon-oRSs8UQo",promoBadge:"promoBadge-oRSs8UQo",promoIcon:"promoIcon-oRSs8UQo"}},85448:e=>{e.exports={icon:"icon-OJpk_CAQ"}},5779:e=>{e.exports={wrap:"wrap-IxKZEhmO",libAllSelected:"libAllSelected-IxKZEhmO",container:"container-IxKZEhmO",iconWrap:"iconWrap-IxKZEhmO",icon:"icon-IxKZEhmO",title:"title-IxKZEhmO",highlighted:"highlighted-IxKZEhmO",description:"description-IxKZEhmO",mobile:"mobile-IxKZEhmO",allSelected:"allSelected-IxKZEhmO",desktop:"desktop-IxKZEhmO",allSelectedIcon:"allSelectedIcon-IxKZEhmO",selected:"selected-IxKZEhmO",focused:"focused-IxKZEhmO",titleWithoutDesc:"titleWithoutDesc-IxKZEhmO",textBlock:"textBlock-IxKZEhmO",bordered:"bordered-IxKZEhmO"}},93900:e=>{e.exports={container:"container-dfKL9A7t",contentList:"contentList-dfKL9A7t",contentListDesktop:"contentListDesktop-dfKL9A7t",searchSourceItemsContainer:"searchSourceItemsContainer-dfKL9A7t",oneColumn:"oneColumn-dfKL9A7t",searchSourceItemsContainerDesktop:"searchSourceItemsContainerDesktop-dfKL9A7t",groupTitleDesktop:"groupTitleDesktop-dfKL9A7t",column:"column-dfKL9A7t",emptyText:"emptyText-dfKL9A7t",emptyIcon:"emptyIcon-dfKL9A7t",noResultsDesktop:"noResultsDesktop-dfKL9A7t"}},99605:e=>{e.exports={wrap:"wrap-gjrLBBL3",item:"item-gjrLBBL3",small:"small-gjrLBBL3",newStyles:"newStyles-gjrLBBL3",mobile:"mobile-gjrLBBL3",text:"text-gjrLBBL3",exchange:"exchange-gjrLBBL3",filterItem:"filterItem-gjrLBBL3",brokerWrap:"brokerWrap-gjrLBBL3"}},80903:e=>{e.exports={wrap:"wrap-dlewR1s1",watchlist:"watchlist-dlewR1s1",noFeed:"noFeed-dlewR1s1",newStyles:"newStyles-dlewR1s1",scrollContainer:"scrollContainer-dlewR1s1",listContainer:"listContainer-dlewR1s1",multiLineItemsContainer:"multiLineItemsContainer-dlewR1s1",withSpinner:"withSpinner-dlewR1s1",spinnerContainer:"spinnerContainer-dlewR1s1",largeSpinner:"largeSpinner-dlewR1s1"}},27864:e=>{e.exports={search:"search-ZXzPWcCf",upperCase:"upperCase-ZXzPWcCf",bubblesContainer:"bubblesContainer-ZXzPWcCf",mobile:"mobile-ZXzPWcCf",bubbles:"bubbles-ZXzPWcCf",withFilters:"withFilters-ZXzPWcCf",spinnerWrap:"spinnerWrap-ZXzPWcCf",emptyText:"emptyText-ZXzPWcCf",emptyIcon:"emptyIcon-ZXzPWcCf",noResultsDesktop:"noResultsDesktop-ZXzPWcCf",brokerButtonWrap:"brokerButtonWrap-ZXzPWcCf"}},57184:e=>{e.exports={ -flagWrap:"flagWrap-QKnxaZOG",icon:"icon-QKnxaZOG",caret:"caret-QKnxaZOG",title:"title-QKnxaZOG",button:"button-QKnxaZOG",withFlag:"withFlag-QKnxaZOG",buttonContent:"buttonContent-QKnxaZOG"}},88716:e=>{e.exports={dialog:"dialog-u2dP3kv1",tabletDialog:"tabletDialog-u2dP3kv1",desktopDialog:"desktopDialog-u2dP3kv1",backButton:"backButton-u2dP3kv1"}},34007:e=>{e.exports={childrenWrapper:"childrenWrapper-_RhDhmVQ",container:"container-_RhDhmVQ"}},68222:e=>{e.exports={highlighted:"highlighted-cwp8YRo6"}},27692:e=>{e.exports={linkItem:"linkItem-zMVwkifW"}},55840:e=>{e.exports={roundTabButton:"roundTabButton-JbssaNvk",disableFocusOutline:"disableFocusOutline-JbssaNvk",enableCursorPointer:"enableCursorPointer-JbssaNvk",large:"large-JbssaNvk",withStartIcon:"withStartIcon-JbssaNvk",iconOnly:"iconOnly-JbssaNvk",withEndIcon:"withEndIcon-JbssaNvk",startIconWrap:"startIconWrap-JbssaNvk",endIconWrap:"endIconWrap-JbssaNvk",small:"small-JbssaNvk",xsmall:"xsmall-JbssaNvk",primary:"primary-JbssaNvk",disabled:"disabled-JbssaNvk",selected:"selected-JbssaNvk",disableActiveStateStyles:"disableActiveStateStyles-JbssaNvk",ghost:"ghost-JbssaNvk",fake:"fake-JbssaNvk",caret:"caret-JbssaNvk",visuallyHidden:"visuallyHidden-JbssaNvk",content:"content-JbssaNvk"}},70408:e=>{e.exports={scrollWrap:"scrollWrap-vgCB17hK",overflowScroll:"overflowScroll-vgCB17hK",roundTabs:"roundTabs-vgCB17hK",center:"center-vgCB17hK",overflowWrap:"overflowWrap-vgCB17hK",start:"start-vgCB17hK"}},86186:e=>{e.exports={icon:"icon-WB2y0EnP",dropped:"dropped-WB2y0EnP"}},18429:(e,t,r)=>{"use strict";r.d(t,{SEPARATOR_PREFIX:()=>n,isSeparatorItem:()=>o});const n="###";function o(e){return e.startsWith(n)}},48199:(e,t,r)=>{"use strict";r.d(t,{BackButton:()=>L});var n,o=r(50959),a=r(64388),l=r(95694),s=r.n(l),i=r(49498),c=r.n(i),u=r(60176),d=r.n(u),m=r(35369),h=r.n(m),p=r(58478),g=r.n(p),f=r(73063),v=r.n(f),b=r(14127),y=r.n(b),S=r(18073),x=r.n(S),w=r(99243),k=r.n(w),C=r(42576),E=r.n(C);function I(e="large",t="1.2"){switch(e){case"large":return"1.2"===t?s():v();case"medium":return"1.2"===t?c():y();case"small":return"1.2"===t?d():x();case"xsmall":return"1.2"===t?h():k();case"xxsmall":return"1.2"===t?g():E();default:return c()}}!function(e){e.Thin="1.2",e.Medium="1.5"}(n||(n={}));const L=o.forwardRef(((e,t)=>{const{"aria-label":r,flipIconOnRtl:n,...l}=e;return o.createElement(a.NavButton,{...l,"aria-label":r,ref:t,icon:I(e.size,e.iconStrokeWidth),flipIconOnRtl:n})}))},86866:(e,t,r)=>{"use strict";r.d(t,{useIsNonFirstRender:()=>o});var n=r(50959);function o(){return!function(){const[e,t]=(0,n.useState)(!0);return(0,n.useEffect)((()=>{t(!1)}),[]),e}()}},125:(e,t,r)=>{"use strict";r.d(t,{useForceUpdate:()=>o});var n=r(50959);const o=()=>{const[,e]=(0,n.useReducer)((e=>e+1),0);return e}},3685:(e,t,r)=>{"use strict";function n(){return window.configurationData?.exchanges?.map((e=>({...e,country:"",providerId:"",flag:""})))??[]}r.d(t,{getExchanges:()=>n})},36279:(e,t,r)=>{"use strict";var n;r.d(t,{LogoSize:()=>n,getLogoUrlResolver:()=>l}),function(e){e[e.Medium=0]="Medium", -e[e.Large=1]="Large"}(n||(n={}));class o{getSymbolLogoUrl(e){return e}collectSymbolLogoUrls(e,t){return[]}getCountryFlagUrl(){return""}getCryptoLogoUrl(e){return e}getProviderLogoUrl(e){return e}getSourceLogoUrl(e){return e}getBlockchainContractLogoUrl(e){return e}}let a;function l(){return a||(a=new o),a}},69654:(e,t,r)=>{"use strict";r.d(t,{DialogSearch:()=>d});var n=r(50959),o=r(97754),a=r.n(o),l=r(11542),s=r(9745),i=r(6347),c=r(54313),u=r(23296);function d(e){const{children:t,isMobile:o,renderInput:d,onCancel:h,containerClassName:p,inputContainerClassName:g,iconClassName:f,cancelTitle:v=l.t(null,void 0,r(4543)),...b}=e;return n.createElement("div",{className:a()(u.container,o&&u.mobile,p)},n.createElement("div",{className:a()(u.inputContainer,o&&u.mobile,g,h&&u.withCancel)},d||n.createElement(m,{isMobile:o,...b})),t,n.createElement(s.Icon,{className:a()(u.icon,o&&u.mobile,f),icon:o?c:i}),h&&(!o||""!==b.value)&&n.createElement("div",{className:a()(u.cancel,o&&u.mobile),onClick:h},v))}function m(e){const{className:t,reference:r,isMobile:o,value:l,onChange:s,onFocus:i,onBlur:c,onKeyDown:d,onSelect:m,placeholder:h,activeDescendant:p,...g}=e;return n.createElement("input",{...g,ref:r,type:"text",className:a()(t,u.input,o&&u.mobile),autoComplete:"off",role:"searchbox","data-role":"search",placeholder:h,value:l,onChange:s,onFocus:i,onBlur:c,onSelect:m,onKeyDown:d,"aria-activedescendant":p})}},96967:(e,t,r)=>{"use strict";r.d(t,{SymbolSearchDialogContentItem:()=>F});var n=r(50959),o=r(97754),a=r.n(o),l=(r(11542),r(50151)),s=r(9745),i=r(37103),c=r(24637),u=r(97006),d=r(84524),m=r(24633),h=r(77975),p=r(45345),g=r(32563),f=r(91682),v=r(618),b=r(36279),y=r(59695),S=r(58492),x=r(39330),w=r(64971),k=r(43010),C=r(37370);function E(e){const{className:t,placeholderLetter:r,url1:o,url2:l,size:s="xxxsmall"}=e,i=(0,n.useRef)(null),c=(0,n.useRef)(null),u=(0,n.useRef)(null),d=(0,n.useRef)(null),m=(0,n.useRef)(null),h=(0,n.useRef)(null);return(0,k.useIsomorphicLayoutEffect)((()=>{const e=void 0===o?[]:void 0===l?[o]:[o,l],t=h.current=(r=e,Promise.all(r.map((e=>(0,w.getImage)(`symbol_logo_${e}`,e,L).then((e=>e.cloneNode()))))));var r;t.catch((()=>[])).then((e=>{if(t===h.current)switch(e.length){case 0:u.current?.classList.add(C.hidden),c.current?.classList.add(y.hiddenCircleLogoClass),i.current?.classList.remove(y.hiddenCircleLogoClass);break;case 1:I(c.current,e[0]),u.current?.classList.add(C.hidden),c.current?.classList.remove(y.hiddenCircleLogoClass),i.current?.classList.add(y.hiddenCircleLogoClass);break;case 2:I(d.current,e[0]),I(m.current,e[1]),u.current?.classList.remove(C.hidden),c.current?.classList.add(y.hiddenCircleLogoClass),i.current?.classList.add(y.hiddenCircleLogoClass)}}))}),[o,l]),n.createElement("span",{className:a()(t,C.container)},n.createElement("span",{ref:u,className:a()(C.pairContainer,C.hidden)},n.createElement("span",{className:(0,x.getBlockStyleClasses)(s)},n.createElement("span",{ref:m,className:a()(C.logo,(0,x.getLogoStyleClasses)(s))}),n.createElement("span",{ref:d,className:a()(C.logo,(0, -x.getLogoStyleClasses)(s))}))),n.createElement("span",{ref:c,className:a()(C.logo,y.hiddenCircleLogoClass,(0,S.getStyleClasses)(s))}),n.createElement("span",{ref:i,className:a()(C.logo,(0,S.getStyleClasses)(s))},n.createElement(y.CircleLogo,{size:s,placeholderLetter:r})))}function I(e,t){e&&(e.innerHTML="",e.appendChild(t))}function L(e){e.crossOrigin="",e.decoding="async"}var R=r(88183);function T(e){const{logoId:t,baseCurrencyLogoId:r,currencyLogoId:o,placeholder:l,className:s,size:i="xsmall"}=e,c=(0,n.useMemo)((()=>{const e={logoid:t,"currency-logoid":o,"base-currency-logoid":r};return(0,v.removeUsdFromCryptoPairLogos)((0,v.resolveLogoUrls)(e,b.LogoSize.Medium))}),[t,o,r]);return n.createElement(E,{key:i,className:a()(R.logo,s),url1:c[0],url2:c[1],placeholderLetter:l,size:i})}var N=r(29562),B=r(69533),M=r(20255);function F(e){const{dangerousTitleHTML:t,title:r,dangerousDescriptionHTML:o,description:v,searchToken:b,exchangeName:y,marketType:S,onClick:x,isSelected:w,isEod:k=!1,isActive:C=!1,isOffset:E=!1,invalid:I=!1,isHighlighted:L=!1,hideExchange:R=!1,hideMarkedListFlag:F=!1,onExpandClick:_,isExpanded:A,hoverComponent:D,country:P,providerId:O,sourceLogoId:U,source:Q,source2:V,type:W,flag:K,itemRef:z,onMouseOut:H,onMouseOver:Z,className:q,actions:G,reference:$,fullSymbolName:j,logoId:J,currencyLogoId:X,baseCurrencyLogoId:Y,shortName:ee,hideLogo:te=!1,exchangeTooltip:re,hideMarketType:ne,isPrimary:oe,isPromo:ae}=e,{isSmallWidth:le,isMobile:se}=(0,l.ensureNotNull)((0,n.useContext)(d.SymbolSearchItemsDialogContext)),ie=Boolean(D),ce=!I&&!R&&(se||!ie),ue=(0,h.useWatchedValueReadonly)({watchedValue:p.watchedTheme})===m.StdTheme.Dark?M.dark:M.light,de=D,me=i.enabled("show_symbol_logos"),he=i.enabled("show_exchange_logos"),pe=me||!1,ge=V?.description??Q,fe=V?.name??Q;return n.createElement("div",{className:a()(M.itemRow,le&&M.multiLine,L&&M.highlighted,L&&ue,w&&M.selected,C&&M.active,I&&M.invalid,!se&&g.mobiletouch&&ie&&M.hover,q),onClick:function(e){if(!x||e.defaultPrevented)return;e.preventDefault(),x(e)},"data-role":e["data-role"]||"list-item","data-active":C,"data-type":S,"data-name":"symbol-search-dialog-content-item",onMouseOut:H,onMouseOver:Z,ref:$},n.createElement("div",{ref:z,className:a()(M.itemInfoCell,M.cell,E&&M.offset)},n.createElement("div",{className:a()(M.actionHandleWrap,!pe&&M.fixedWidth)},n.createElement(n.Fragment,null,!1,_&&n.createElement("div",{onClick:function(e){if(!_||e.defaultPrevented)return;e.preventDefault(),_(e)}},n.createElement(s.Icon,{className:a()(M.expandHandle,A&&M.expanded,w&&M.selected),icon:B})),pe&&!E&&n.createElement("div",{className:a()(M.logo,Boolean(_)&&M.isExpandable)},n.createElement(T,{key:j,logoId:J,currencyLogoId:X,baseCurrencyLogoId:Y,placeholder:ee?ee[0]:void 0})))),n.createElement("div",{className:a()(M.description,pe&&E&&M.offset)},r&&n.createElement("div",{className:a()(M.symbolTitle,C&&M.active,I&&M.invalid,!Boolean(o)&&M.noDescription,!g.mobiletouch&&"apply-overflow-tooltip"),"data-overflow-tooltip-text":r,"data-name":"list-item-title" -},"string"==typeof r&&b?n.createElement(c.HighlightedText,{className:M.highlightedText,text:r,queryString:b,rules:(0,u.createRegExpList)(b)}):r,k&&n.createElement("span",{className:M.dataMode},"E")),!r&&t&&n.createElement("div",{className:a()(M.symbolTitle,C&&M.active,I&&M.invalid,!g.mobiletouch&&"apply-overflow-tooltip"),"data-name":"list-item-title","data-overflow-tooltip-text":(0,f.removeTags)(t)},n.createElement("span",{dangerouslySetInnerHTML:{__html:t}}),k&&n.createElement("span",{className:M.dataMode},"E")),le&&ve())),!le&&n.createElement("div",{className:a()(M.cell,M.descriptionCell,Boolean(de)&&M.addition)},ve(),de?n.createElement(de,{...e,className:M.actions,onMouseOver:void 0,onMouseOut:void 0}):null),le&&de?n.createElement(de,{...e,className:M.cell,onMouseOver:void 0,onMouseOut:void 0}):null,ce&&n.createElement("div",{className:a()(M.exchangeCell,M.cell)},n.createElement("div",{className:a()(M.exchangeDescription)},!1,!ne&&n.createElement("div",{className:a()(M.marketType,C&&M.active)},S),n.createElement("div",{className:M.source},!1,!1,"economic"===W&&ge&&fe?n.createElement("div",{className:a()(M.exchangeName,C&&M.active,"apply-common-tooltip",M.narrow,ne&&M.wide),title:ge},fe):n.createElement("div",{className:a()(M.exchangeName,C&&M.active,re&&"apply-common-tooltip"),title:re},y))),he&&n.createElement("div",{className:M.flag},n.createElement(N.SymbolSearchFlag,{key:he?`${j}_exchange`:`${P}_${O}_${V?.id}_${W}_${K}`,className:M.icon,country:P,providerId:O,sourceLogoId:U??void 0}))),n.createElement("div",{className:a()(M.cell,Boolean(G)&&M.actionsCell)},G));function ve(){if(I)return null;const e=a()(M.symbolDescription,C&&M.active,!g.mobiletouch&&"apply-overflow-tooltip apply-overflow-tooltip--allow-text");return v?n.createElement("div",{className:e},b?n.createElement(c.HighlightedText,{className:M.highlightedText,text:v,queryString:b,rules:(0,u.createRegExpList)(b)}):v):o?n.createElement("div",{"data-overflow-tooltip-text":(0,f.removeTags)(o),className:e,dangerouslySetInnerHTML:{__html:o}}):null}}},29562:(e,t,r)=>{"use strict";r.d(t,{SymbolSearchFlag:()=>f});var n=r(50959),o=r(97754),a=r.n(o),l=r(24633),s=r(36279);const i=r.p+"mock-dark.16b5f3a431f502b03ae3.svg",c=r.p+"mock-light.d201313017eb2c1b989f.svg";function u(e){return e===l.StdTheme.Dark?i:c}var d=r(77975),m=r(45345),h=r(50151);const p=s.LogoSize.Medium;var g=r(85448);function f(e){const{country:t,tooltip:r,providerId:o,sourceId:l,sourceLogoId:i,className:c}=e,f=(0,d.useWatchedValueReadonly)({watchedValue:m.watchedTheme}),[v,b]=(0,n.useState)(function({country:e,providerId:t,sourceId:r,sourceLogoId:n}){const o=(0,s.getLogoUrlResolver)();return a=>{const l=e=>o.getProviderLogoUrl(e,p),s=[{value:n,resolve:e=>o.getSymbolLogoUrl(e,p)},{value:r,resolve:l},{value:e,resolve:e=>o.getCountryFlagUrl(e.toUpperCase(),p)},{value:t,resolve:l}].find((({value:e})=>void 0!==e&&e.length>0));return void 0!==s?s.resolve((0,h.ensureDefined)(s.value)):u(a)}}({country:t,providerId:o,sourceId:l,sourceLogoId:i})(f));return n.createElement("img",{ -className:a()(c,"apply-common-tooltip",g.icon),crossOrigin:"","data-tooltip":r,src:v,onError:function(){b(u(f))}})}},58442:(e,t,r)=>{"use strict";r.d(t,{QualifiedSources:()=>n,qualifyProName:()=>l});var n,o=r(50151),a=r(37103);r(81319);function l(e){return e}!function(e){function t(e){return e.pro_name}function r(e){{const t=a.enabled("pay_attention_to_ticker_not_symbol")?e.ticker:e.name;return(0,o.ensureDefined)(t)}}e.fromQuotesSnapshot=function(e){return"error"===e.status?e.symbolname:e.values.pro_name},e.fromQuotesResponse=function(e){const{values:r,symbolname:n,status:o}=e;return"error"===o&&n?n:t(r)},e.fromQuotes=t,e.fromSymbolSearchResult=function(e,t){{const{ticker:r,symbol:n}=t??e;return a.enabled("pay_attention_to_ticker_not_symbol")?(0,o.ensureDefined)(r??n):(0,o.ensureDefined)(n)}},e.fromSymbolInfo=r,e.fromSymbolMessage=function(e,t){return"symbol_resolved"===t.method?r(t.params[1]):e}}(n||(n={}))},20882:(e,t,r)=>{"use strict";r.d(t,{createSearchSources:()=>s,filterSearchSources:()=>a,isAllSearchSourcesSelected:()=>o,splitSearchSourcesByGroup:()=>l});const n=[];function o(e){return""===e.value()}function a(e,t){return e.filter((e=>e.includes(t)))}function l(e){const t=new Map;e.forEach((e=>{t.has(e.group())?t.get(e.group()).push(e):t.set(e.group(),[e])}));for(const e of t.values()){e[0].group()!==ExchangeGroup.NorthAmerica&&e.sort(((e,t)=>e.name().toLowerCase()>t.name().toLowerCase()?1:-1))}return new Map([...t.entries()].sort((([e],[t])=>n.indexOf(e)-n.indexOf(t))))}function s(e,t){return t.map((t=>new e(t)))}},70613:(e,t,r)=>{"use strict";r.d(t,{SymbolSearchDialogBodyContext:()=>n});const n=r(50959).createContext(null)},84524:(e,t,r)=>{"use strict";r.d(t,{SymbolSearchItemsDialogContext:()=>n});const n=r(50959).createContext(null)},40336:(e,t,r)=>{"use strict";r.d(t,{SymbolSearchItemsDialog:()=>jt});var n,o,a,l,s=r(50959),i=r(97754),c=r.n(i),u=r(11542),d=r(37103),m=r(44254),h=r(81319);function p(e){const t=function(e){let t,r=0,n=0;for(let o=0;o"symbol"===t.type&&m.symbolTokenEscapeRe.test(t.value)?e+`'${t.value}'`:e+t.value),"")}function f(e){const t=function(e){const t=(0,m.tokenize)(e),r=[];return t.forEach((e=>{if("symbol"!==e.type)return;const[t]=(0,m.parseToken)(e);t&&r.push(t)})),r}(e);if(1===t.length)return t[0]}function v(e,t,r){const n=e.value,[o,a]=b(e,r),l=(0,h.getSymbolFullName)(t),s=m.symbolTokenEscapeRe.test(l)?`'${l}'`:l;return[n.substring(0,a)+s+n.substring(a+o.length),a+s.length]}function b(e,t){const{value:r,selectionStart:n}=e,o=(0,m.tokenize)(t?r.toUpperCase():r),a=(0, -m.getTokenAtPos)(o,n||0);return[a?.value||"",a?a.offset:r.length,o]}!function(e){e.Init="init",e.Var="var",e.Operator="operator"}(n||(n={})),function(e){e[e.Init=0]="Init",e[e.Div=1]="Div",e[e.Expression=2]="Expression",e[e.BracedExpression=3]="BracedExpression"}(o||(o={})),function(e){e.Stocks="stocks",e.Futures="futures",e.Funds="funds",e.Forex="forex",e.Crypto="bitcoin,crypto",e.Index="index",e.Bond="bond",e.Economic="economic",e.Options="options"}(a||(a={})),function(e){e.EconomicCountrySelect="economic-country-select",e.EconomicSourceSelect="economic-source-select",e.EconomicCategorySelect="economic-category-select",e.StocksCountrySelect="stocks-country-select",e.StockTypeSelect="stock-type-select",e.StockSectorSelect="stock-sector-select",e.FuturesCountrySelect="futures-country-select",e.FuturesCategorySelect="futures-category-select",e.FundsCountrySelect="funds-country-select",e.FundsTypeSelect="funds-type-select",e.CryptoExchangeSelect="crypto-exchange-select",e.CryptoTypeSelect="crypto-type-select",e.CryptoExchangeTypeSelect="crypto-exchange-type-select",e.ForexExchangeSelect="forex-exchange-select",e.IndexExchangeSelect="index-exchange-select",e.BondCountrySelect="bond-country-select",e.BondTypeSelect="bond-type-select"}(l||(l={}));const y=["futures","forex","bond","economic","options"];var S=r(84877),x=r(73986),w=r(79418),k=r(9745),C=r(86240),E=r(86781),I=r(84524),L=r(69654),R=r(3343),T=r(22692);function N(e,t,r){return`source-item-${e}-${t}-${r}`}var B=r(20882),M=r(34007);function F(e){const{children:t,className:r}=e;return s.createElement("div",{className:c()(M.container,r)},s.createElement("div",{className:M.childrenWrapper},t))}var _=r(50151),A=r(78036),D=r(24637),P=r(97006),O=r(91540),U=r(5779);function Q(e){const{searchSource:t,onClick:r,queryString:n,isFocused:o,id:a}=e,{symbolSearchContent:l,isAllSearchSourcesSelected:i,allSearchSourcesTitle:u,isMobile:d}=(0,A.useEnsuredContext)(I.SymbolSearchItemsDialogContext),m=l.currentSelectedSearchSource,p=(0,_.ensureNotNull)(m).value(),g=i(t),f=t.value()===p,v=(0,s.useMemo)((()=>(0,P.createRegExpList)(n)),[n]),b=t.description(),y=b&&!g,S=h.isSeparateSymbolSearchTabs&&g&&u?u:t.name(),x=c()(U.container,d?U.mobile:U.desktop,f&&U.selected,o&&U.focused,g&&U.allSelected,g&&U.libAllSelected,!g&&d&&U.bordered);return s.createElement("div",{className:c()(!d&&U.wrap,g&&U.libAllSelected),onClick:r,id:a},s.createElement("div",{className:x},s.createElement("div",{className:U.iconWrap},!!g&&s.createElement(k.Icon,{className:c()(U.icon,U.allSelectedIcon),icon:O})),s.createElement("div",{className:U.textBlock},s.createElement("div",{className:c()(U.title,!y&&!d&&U.titleWithoutDesc)},s.createElement(D.HighlightedText,{className:c()(f&&U.highlighted),queryString:n,text:S,rules:v})),y&&s.createElement("div",{className:c()(U.description,"apply-overflow-tooltip")},s.createElement(D.HighlightedText,{className:U.highlighted,queryString:n,rules:v,text:b})))))}var V=r(77975),W=r(45345),K=r(24633),z=r(70613),H=r(66619),Z=r(67562),q=r(93900);const G={emptyTextClassName:q.emptyText} -;function $(e){const{searchSources:t}=e,{setSelectedIndex:n,setSelectedSearchSource:o,setMode:a,isMobile:l,emptyState:i,autofocus:d}=(0,A.useEnsuredContext)(I.SymbolSearchItemsDialogContext),m=(0,V.useWatchedValueReadonly)({watchedValue:W.watchedTheme})===K.StdTheme.Dark?H:Z,p=(0,E.useMatchMedia)(C["media-phone-vertical"]),[g,f]=(0,s.useState)(""),v=(0,s.useMemo)((()=>[{group:null,sources:(0,h.createGroupColumns)((0,B.filterSearchSources)(t,g),p?1:2)}]),[t,g,p]),b=((0,s.useMemo)((()=>({})),[]),(0,s.useRef)(null)),y=(0,s.useRef)(null),{focusedItem:S,activeDescendant:x,handleKeyDown:w,resetFocusedItem:M}=function(e,t,r){const[n,o]=(0,s.useState)(null),[a,l]=(0,s.useState)("");function i(t){const r=e[t.groupIndex].sources[t.col].length-1;if(t.row===r){const e=d(t.groupIndex+1);if(null===e)return;return t.col>0&&!u({...t,groupIndex:e,row:0})?void o({groupIndex:e,col:0,row:0}):void o({...t,groupIndex:e,row:0})}o({...t,row:t.row+1})}function c(t){if(0===t.row){const r=d(t.groupIndex-1,-1);if(null===r)return;const n=e[r].sources[t.col]?.length??0;return 0===n?void o({groupIndex:r,col:0,row:0}):void o({...t,groupIndex:r,row:n-1})}o({...t,row:t.row-1})}function u(t){return Boolean(e[t.groupIndex]?.sources[t.col]?.[t.row])}function d(t=0,r=1){const n=e.length;let o=(t+n)%n;for(;!u({groupIndex:o,col:0,row:0});)if(o=(o+r+n)%n,o===t)return null;return o}return(0,s.useEffect)((()=>{if(!r.current)return;if(!n)return void l("");const e=N(n.groupIndex,n.col,n.row),t=r.current.querySelector(`#${e}`);t?.scrollIntoView({block:"nearest"}),l(e)}),[n]),(0,s.useEffect)((()=>{o(null)}),[t]),{focusedItem:n,activeDescendant:a,handleKeyDown:function(a){if(!r.current)return;const l=(0,R.hashFromEvent)(a);if(32!==l&&13!==l)switch((0,T.mapKeyCodeToDirection)(l)){case"blockNext":if(a.preventDefault(),!n){const e=d();if(null===e)break;o({groupIndex:e,col:0,row:0});break}i(n);break;case"blockPrev":if(a.preventDefault(),!n)break;c(n);break;case"inlineNext":{if(!n||t)break;a.preventDefault();const r=e[n.groupIndex].sources.length;if(n.col===r-1||!u({...n,col:n.col+1})){i({...n,col:0});break}o({...n,col:n.col+1});break}case"inlinePrev":{if(!n||t)break;a.preventDefault();const r=e[n.groupIndex].sources.length;if(0===n.col){if(0!==n.row){c({...n,col:r-1});break}const t=d(n.groupIndex-1,-1);if(null===t)break;const a=e[t].sources.length,l=e[t].sources[0].length;if(!u({groupIndex:t,col:a-1,row:l-1})){c(n);break}o({groupIndex:t,col:a-1,row:l-1});break}o({...n,col:n.col-1});break}}else{if(!n)return;a.preventDefault();const e=r.current.querySelector(`#${N(n.groupIndex,n.col,n.row)}`);e instanceof HTMLElement&&e.click()}},resetFocusedItem:()=>o(null)}}(v,p,y);(0,s.useLayoutEffect)((()=>{d&&b?.current?.focus()}),[]);const _=i?s.createElement(i,null):s.createElement(F,{className:q.noResultsDesktop},s.createElement(k.Icon,{icon:m,className:q.emptyIcon}),s.createElement("div",{className:q.emptyText},u.t(null,void 0,r(53182)))),D=!(v.length&&v.every((e=>0===e.sources.length)));return s.createElement(z.SymbolSearchDialogBodyContext.Provider,{value:G -},s.createElement(L.DialogSearch,{placeholder:u.t(null,void 0,r(8573)),onChange:function(e){M(),f(e.target.value),y&&y.current&&(y.current.scrollTop=0)},reference:b,onKeyDown:w,onBlur:M,"aria-activedescendant":x}),D?s.createElement("div",{ref:y,className:c()(q.contentList,!l&&q.contentListDesktop),onTouchStart:function(){b.current?.blur()}},v.map(((e,t)=>{const{group:r,sources:n}=e;return 0===n.length?s.createElement(s.Fragment,{key:r}):s.createElement(s.Fragment,{key:r},!1,s.createElement("div",{className:c()(q.searchSourceItemsContainer,!l&&q.searchSourceItemsContainerDesktop,p&&q.oneColumn)},n.map(((e,r)=>s.createElement("div",{key:`${t}-${r}`,className:q.column},e.map(((e,n)=>s.createElement(Q,{id:N(t,r,n),isFocused:!!S&&(S.groupIndex===t&&S.col===r&&S.row===n),key:e.value(),searchSource:e,queryString:g,onClick:P.bind(null,e)}))))))))}))):_);function P(e){o(e),a("symbolSearch"),n(-1)}}var j,J,X,Y,ee=r(32227),te=r(95406),re=r(52959);r(32925);function ne(e){return e.hasOwnProperty("exchange")}async function oe(e){{const t=await async function(e){return new Promise((t=>{(0,re.getChartingLibraryGlobalContext)().ChartApiInstance.searchSymbols(e.text||"",e.exchange||"",e.type||"",(e=>{t(e)}),e.searchInitiationPoint??"symbolSearch")}))}(e);return{symbols:t,symbols_remaining:0}}}!function(e){e.SourceId="source_id",e.EconomicCategory="economic_category",e.SearchType="search_type",e.Sector="sector",e.Product="product",e.Centralization="centralization",e.OnlyHasOptions="only_has_options"}(j||(j={})),function(e){e.SymbolSearch="symbolSearch",e.Watchlist="watchlist",e.Compare="compare",e.IndicatorInputs="indicatorInputs"}(J||(J={})),function(e){e[e.Prod=0]="Prod",e[e.Local=1]="Local"}(X||(X={})),function(e){e[e.Paginated=0]="Paginated",e[e.NoLimit=1]="NoLimit"}(Y||(Y={}));new Map([].map((({value:e,search_type:t})=>[e,t])));var ae=r(78136),le=r(51768),se=r(68335),ie=r(46003),ce=r(486),ue=r(81574),de=r(35119),me=r(32617),he=r(69135),pe=r(63861),ge=r(33313);function fe(e){const{state:t,update:r}=e,{searchRef:n,forceUpdate:o,upperCaseEnabled:a}=(0,_.ensureNotNull)((0,s.useContext)(I.SymbolSearchItemsDialogContext)),l=(0,m.tokenize)(n.current?.value),i=function(e){const t={braceBalance:0,currentState:"var",warnings:[],errors:[]};if(!d.enabled("show_spread_operators"))return t;let r="init";const n=[];for(let o=0;o{!n.current||i.errors.length||i.warnings.length||(n.current.value=g(p(l)),o())}}])),s.createElement("div",{className:ge.actions},c.map((e=>s.createElement(ie.ToolWidgetButton,{className:ge.actionButton,icon:e.icon,key:e.name,isDisabled:ve(e,i),onClick:()=>function(e){if(!ve(e,i)){if(e.insert&&n.current){const l=n.current.value+e.insert;n.current.value=l,n.current.setSelectionRange(l.length,l.length);const[s,,i]=b(n.current,a);t.current&&(t.current.selectedIndexValue=-1,t.current.searchSpreadsValue=(0,m.isSpread)(i),t.current.searchTokenValue=s),o(),r()}e.callback&&e.callback(),n.current?.focus(),(0,le.trackEvent)("GUI","SS",e.name)}}(e)}))))}function ve(e,t){let r=!1;if(!t.errors.length)switch(e.type){case"binaryOp":r="var"===t.currentState;break;case"openBrace":r="var"!==t.currentState;break;case"closeBrace":r="var"===t.currentState&&t.braceBalance>0;break;case"complete":r=!t.errors.length&&!t.warnings.length}return!r}var be=r(63932),ye=r(84952),Se=r(29006),xe=r(14543),we=r(10381),ke=r(52019),Ce=r(57184);const Ee=(0,h.getDefaultSearchSource)();function Ie(e){const{mode:t,setMode:n,searchRef:o,cachedInputValue:a,setSelectedIndex:l,setSelectedSearchSource:i,isAllSearchSourcesSelected:d,allSearchSourcesTitle:m,upperCaseEnabled:p,symbolSearchContent:g}=(0,A.useEnsuredContext)(I.SymbolSearchItemsDialogContext),f=g.currentSelectedSearchSource,v=(0,_.ensureNotNull)(f),b="symbolSearch"===t,y=d(v),S=h.isSeparateSymbolSearchTabs&&y&&m?m:v.name(),x=(0,s.useCallback)((()=>{if(h.isSeparateSymbolSearchTabs&&!y&&Ee)return i(Ee),l(-1),void o.current?.focus();o.current&&(a.current=p?o.current.value.toUpperCase():o.current.value),n("exchange")}),[y,o,p,n,i]);return h.isSeparateSymbolSearchTabs?b?s.createElement(xe.LightButton,{onClick:x,isPills:!y,size:"xsmall",variant:y?"ghost":"quiet-primary",showCaret:y,endSlot:y?void 0:s.createElement(k.Icon,{icon:ke}),enableActiveStateStyles:!1,className:c()(Ce.button,!y&&Ce.withFlag),tabIndex:-1,"data-name":"sources-button" -},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,void 0,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}var Le=r(99605);function Re(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;return h.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)throw new Error("There must be default filter value in filter definition");const u=r.find((e=>e.value===o[m.currentSymbolType]?.[t]))||c;return s.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,void 0,r(74007)):u.t(null,void 0,r(95481)))),s.createElement("div",{className:Le.item},!n&&s.createElement("div",{className:Le.text},u.t(null,void 0,r(78734))),m.canChangeExchange&&s.createElement("div",{className:Le.exchange},s.createElement(Ie,null))))}var Te=r(24640),Ne=r(80903);function Be(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;return s.createElement("div",{style:r},l[t])}),[l]),x=(0,s.useCallback)((e=>(0,_.ensure)(l[e].key)),[l]),w="watchlist"===p&&null!==v;return s.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",{ -className:c()(Ne.listContainer,g&&Ne.multiLineItemsContainer)},!h.isSeparateSymbolSearchTabs&&s.createElement(Re,null),...l,!1))))}var Me=r(96967),Fe=r(47201),_e=r(35020);var Ae=r(95854),De=r(36966),Pe=r(7953),Oe=r(38528),Ue=r(66686);r(19954);const Qe=s.createContext({children:{},setIsReady:()=>{}});var Ve=r(86866),We=r(67842);var Ke,ze,He,Ze=r(6916),qe=r.n(Ze);function Ge(e){const{className:t,count:r,compact:n=!0,size:o="xlarge",color:a="danger",sign:l,borderColor:i="none","aria-label":u,"aria-hidden":d,disabled:m,...h}=e,p=h;let g;g=!("xxsmall"===o||"xxxsmall"===o)&&r?n&&r>=100?"99+":l&&r>0?`+${r}`:r:"";const f=c()(t,qe().counter,qe()[o],qe()[`color-${a}`],"none"!==i&&qe()[`borderColor-${i}`],m&&qe().disabled);return s.createElement("span",{...p,className:f,"aria-label":u,"aria-hidden":d},g)}function $e({count:e,color:t="danger",size:r="xsmall",disabled:n}){return s.createElement(Ge,{"aria-label":"Tab counter",count:e,size:r,color:t,borderColor:"primary",disabled:n})}function je(e,t,r){const{id:n,items:o,activationType:a,orientation:l="horizontal",disabled:i,onActivate:c,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){return e.map((e=>{const n=e.counter;return n?{...e,endUpperSlot:$e({count:n.count,color:n.color,size:r,disabled:t}),counter:void 0}:e}))}(o,i,f)),[o,i,f]),w=(0,_e.useMobileTouchState)(),k=function(e){const t=(0,E.useSafeMatchMedia)(C["media-mf-phone-landscape"],!0),r=(0,_e.useMobileTouchState)();return e??(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)(Qe),r=(0,s.useRef)((0,s.useId)());return t[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,Ae.useCollapsible)(x,L,u),P=function(e){const t=(0,s.useRef)(null);return(0,s.useEffect)((()=>{t.current=e}),[e]),t.current}(D.current?.containerWidth)??0,O=(0,Ve.useIsNonFirstRender)(),U=D.current?.containerWidth??0;let Q=!1;D.current&&O&&(Q=function(e,t,r,n,o){if("collapse"!==n)return!0;const a=function(e,t,r){const n=e.filter((e=>t.find((t=>t.id===e[0]))));return t.length>0?n[0][1]+r:0}(Array.from(e.widthsMap.entries()),t,o),l=e.moreButtonWidth??0;let s=function(e,t){return e.reduce(((e,r)=>e+(t.get(r.id)??0)),0)}(r,e.widthsMap);return s+=t.length>0?l:0,function(e,t,r,n){return 0!==e?t-rn:r{requestAnimationFrame((()=>{O&&Q&&e.contentRect.width===P&&T()}))})),W="collapse"===k?N:x,K=(0,s.useMemo)((()=>"collapse"===k?B:[]),[k,B]),z=(0, -s.useCallback)((e=>K.includes(e)),[K]),{isOpened:H,open:Z,close:q,onButtonClick:G}=(0,Pe.useDisclosure)({id:n,disabled:i}),{tabsBindings:$,tablistBinding:j,scrollWrapBinding:J,onActivate:X,onHighlight:Y,isHighlighted:ee}=(0,De.useTabs)({id:n,items:[...W,...K],activationType:a,orientation:l,disabled:i,tablistLabelId:h,tablistLabel:p,preventDefaultIfKeyboardActionHandled:g,scrollIntoViewOptions:r.scrollIntoViewOptions,onActivate:c,isActive:u,isCollapsed:z,isRtl:r.isRtl,isDisclosureOpened:H,isRadioGroup:r.isRadioGroup,stopPropagationIfKeyboardActionHandled:v,keyboardNavigationLoop:b,defaultKeyboardFocus:y,focusableItemAttributes:S}),te=K.find(ee),re=(0,s.useCallback)((()=>{const e=x.find(u);e&&Y(e)}),[Y,u,x]),ne=(0,s.useCallback)((()=>{q(),re(),I.current=!0}),[q,re]),oe=(0,s.useCallback)((()=>{te&&(X(te),Y(te,250))}),[X,Y,te]);J.ref=(0,Oe.useMergedRefs)([V,J.ref,M]),j.ref=(0,Oe.useMergedRefs)([j.ref,F]),j.onKeyDown=(0,Fe.createSafeMulticastEventHandler)((0,Ue.useKeyboardEventHandler)([(0,Ue.useKeyboardClose)(H,ne),(0,Ue.useKeyboardActionHandler)([13,32],oe,(0,s.useCallback)((()=>Boolean(te)),[te]))],g),j.onKeyDown);const ae=(0,s.useCallback)((e=>{I.current=!0,G(e)}),[I,G]),le=(0,s.useCallback)((e=>{e&&X(e)}),[X]);return(0,s.useEffect)((()=>{I.current?I.current=!1:te&&!H?Z():!te&&H&&q()}),[te,H,Z,q]),{enableActiveStateStyles:R,moreButtonRef:_,setItemRef:A,getBindings:e=>$.find((t=>t.id===e.id)),handleMoreButtonClick:ae,handleCollapsedItemClick:le,scrollWrapBinding:J,overflowBehaviour:k,tablistBinding:j,visibleTabs:W,hiddenTabs:K,handleActivate:X,isMobileTouch:w,getItemId:L,isDisclosureOpened:H,isHighlighted:ee,closeDisclosure:q}}!function(e){e.XXXSmall="xxxsmall",e.XXSmall="xxsmall",e.XSmall="xsmall",e.Small="small",e.Medium="medium",e.Large="large",e.XLarge="xlarge"}(Ke||(Ke={})),function(e){e.Danger="danger",e.Accent="accent",e.AccentLight="accent-light",e.NeutralBold="neutral-bold",e.Neutral="neutral"}(ze||(ze={})),function(e){e.Primary="primary",e.Secondary="secondary",e.Tertiary="tertiary",e.None="none"}(He||(He={}));var Je=r(8304),Xe=r(53017),Ye=r(17946),et=r(2948),tt=r(55840);const rt="xsmall",nt="primary";function ot(e){const t=(0,s.useContext)(Ye.CustomBehaviourContext),{size:r="xsmall",variant:n="primary",active:o,fake:a,startIcon:l,endIcon:c,showCaret:u,iconOnly:d,anchor:m,enableActiveStateStyles:h=t.enableActiveStateStyles,disableFocusOutline:p=!1,tooltip:g,disabled:f}=e;return i(tt.roundTabButton,tt[r],tt[n],l&&tt.withStartIcon,(c||u)&&tt.withEndIcon,d&&tt.iconOnly,o&&tt.selected,a&&tt.fake,m&&tt.enableCursorPointer,!h&&tt.disableActiveStateStyles,p&&tt.disableFocusOutline,g&&"apply-common-tooltip",f&&tt.disabled,"apply-overflow-tooltip apply-overflow-tooltip--check-children-recursively apply-overflow-tooltip--allow-text")}function at(e){const{startIcon:t,endIcon:r,showCaret:n,iconOnly:o,children:a}=e;return s.createElement(s.Fragment,null,t&&s.createElement(k.Icon,{icon:t,className:tt.startIconWrap,"aria-hidden":!0}),a&&s.createElement("span",{className:i(tt.content,o&&tt.visuallyHidden) -},a),(!o&&r||n)&&s.createElement(lt,{icon:r,showCaret:n}))}function lt(e){const{icon:t,showCaret:r}=e;return s.createElement(k.Icon,{className:i(tt.endIconWrap,r&&tt.caret),icon:r?et:t,"aria-hidden":!0})}var st=r(34094);const it=(0,s.forwardRef)(((e,t)=>{const{id:r,size:n,variant:o,active:a,fake:l,startIcon:i,endIcon:c,showCaret:u,iconOnly:d,children:m,enableActiveStateStyles:h,disableFocusOutline:p,tooltip:g,disabled:f,...v}=e;return s.createElement("button",{...v,id:r,ref:t,"data-tooltip":g,"data-overflow-tooltip-text":g??(0,st.getTextForTooltip)(m),className:ot({size:n,variant:o,active:a,fake:l,startIcon:i,endIcon:c,showCaret:u,iconOnly:d,enableActiveStateStyles:h,disableFocusOutline:p,tooltip:g,disabled:f})},s.createElement(at,{startIcon:i,endIcon:c,showCaret:u,iconOnly:d},m))}));it.displayName="RoundTabsBaseButton";const ct=(0,s.createContext)({size:"small",variant:"primary",isHighlighted:!1,isCollapsed:!1,disabled:!1});function ut(e){const{item:t,highlighted:r,handleItemRef:n,reference:o,onClick:a,...l}=e,i=(0,s.useCallback)((e=>{l.disabled&&e.preventDefault(),a&&a(t)}),[a,t,l.disabled]),c=(0,s.useCallback)((e=>{n&&n(t,e),(0,Xe.isomorphicRef)(o)(e)}),[t,n]),u={size:l.size??rt,variant:l.variant??nt,isHighlighted:Boolean(l.active),isCollapsed:!1,disabled:l.disabled??!1};return s.createElement(it,{...l,id:t.id,onClick:i,ref:c,startIcon:t.startIcon,endIcon:t.endIcon,tooltip:t.tooltip,"aria-label":"radio"===l.role?t.children:void 0},s.createElement(ct.Provider,{value:u},t.children))}var dt=r(16396),mt=r(4523),ht=r(43845),pt=r(89882),gt=r(2057),ft=r(27692);function vt(e){const{disabled:t,isOpened:r,enableActiveStateStyles:n,disableFocusOutline:o,fake:a,items:l,buttonText:i,buttonPreset:c="text",buttonRef:u,size:d,variant:m,isAnchorTabs:h,isHighlighted:p,onButtonClick:g,onItemClick:f,onClose:v}=e,b=(0,s.useRef)(null),y=(0,Oe.useMergedRefs)([u,b]),S="text"===c?void 0:"xsmall"===d?pt:gt;return s.createElement(mt.PopupMenuDisclosureView,{buttonRef:b,listboxTabIndex:-1,isOpened:r,onClose:v,listboxAria:{"aria-hidden":!0},button:s.createElement(it,{"aria-hidden":!0,disabled:t,active:r,onClick:g,ref:y,tabIndex:-1,size:d,variant:m,startIcon:S,showCaret:"text"===c,iconOnly:"meatballs"===c,enableActiveStateStyles:n,disableFocusOutline:o,fake:a},i),popupChildren:s.createElement(s.Fragment,null,"meatballs"===c&&s.createElement(ht.ToolWidgetMenuSummary,null,i),l.map((e=>s.createElement(dt.PopupMenuItem,{key:e.id,className:h?ft.linkItem:void 0,onClick:f,onClickArg:e,isActive:p(e),label:s.createElement(bt,{isHighlighted:p(e),size:d,variant:m,disabled:e.disabled},e.children),isDisabled:e.disabled,link:"href"in e?e.href:void 0,rel:"rel"in e?e.rel:void 0,target:"target"in e?e.target:void 0,icon:e.startIcon,toolbox:e.endIcon&&s.createElement(k.Icon,{icon:e.endIcon}),renderComponent:"renderComponent"in e?e.renderComponent:void 0,dontClosePopup:!0}))))})}function bt(e){const{isHighlighted:t,size:r,variant:n,children:o,disabled:a}=e,l={size:r??rt,variant:n??nt,isHighlighted:t,isCollapsed:!0,disabled:a??!1} -;return s.createElement(ct.Provider,{value:l},o)}var yt,St,xt,wt,kt=r(70408);function Ct(e){const{overflowBehaviour:t}=e;return i(kt.scrollWrap,"scroll"===t&&kt.overflowScroll,"wrap"===t&&kt.overflowWrap)}function Et(e){const{align:t="start"}=e;return i(kt.roundTabs,kt[t])}function It(e){const{children:t,disabled:n,moreButtonText:o=u.t(null,void 0,r(37117)),moreButtonPreset:a,className:l,size:c,variant:d,align:m,style:h={},"data-name":p,isRadioGroup:g,"aria-controls":f}=e,v=function(e="xsmall"){switch(e){case"small":return 8;case"xsmall":return 4;default:return 16}}(c),{enableActiveStateStyles:b,moreButtonRef:y,setItemRef:S,getBindings:x,handleMoreButtonClick:w,handleCollapsedItemClick:k,scrollWrapBinding:C,overflowBehaviour:E,tablistBinding:I,visibleTabs:L,hiddenTabs:R,handleActivate:T,isMobileTouch:N,getItemId:B,isDisclosureOpened:M,isHighlighted:F,closeDisclosure:_}=je(Je.TabNames.RoundButtonTabs,e,{isRtl:Te.isRtl,scrollIntoViewOptions:{additionalScroll:v},isRadioGroup:g,gap:v});return s.createElement("div",{...C,className:i(Ct({overflowBehaviour:E}),l),style:{...h,"--ui-lib-roundTabs-gap":`${v}px`},"data-name":p},s.createElement("div",{...I,className:Et({align:m,overflowBehaviour:E})},L.map((e=>s.createElement(ut,{...x(e),key:e.id,item:e,onClick:()=>T(e),variant:d,size:c,enableActiveStateStyles:b,disableFocusOutline:N,reference:S(B(e)),...e.dataId&&{"data-id":e.dataId},"aria-controls":f}))),R.map((e=>s.createElement(ut,{...x(e),key:e.id,item:e,variant:d,size:c,reference:S(B(e)),"aria-controls":f,fake:!0}))),s.createElement(vt,{disabled:n,isOpened:M,items:R,buttonText:o,buttonPreset:a,buttonRef:y,isHighlighted:F,onButtonClick:w,onItemClick:k,onClose:_,variant:d,size:c,enableActiveStateStyles:b,disableFocusOutline:N,fake:0===R.length}),t))}function Lt(e){const{"data-name":t="round-tabs-buttons",...r}=e;return s.createElement(It,{...r,"data-name":t})}!function(e){e.Primary="primary",e.Ghost="ghost"}(yt||(yt={})),function(e){e.XSmall="xsmall",e.Small="small",e.Large="large"}(St||(St={})),function(e){e.Start="start",e.Center="center"}(xt||(xt={})),function(e){e.Text="text",e.Meatballs="meatballs"}(wt||(wt={}));r(21593);var Rt=r(27864);const Tt=d.enabled("hide_image_invalid_symbol");function Nt(e){const{otherSymbolsCount:t,onChangeSymbolTypeFilter:r,onResetFilters:n,onListTouchMove:o,brokerTitle:a,brokerLogoInfo:l,isBrokerActive:c,onBrokerToggle:u,listRef:d,listWrapRef:m,onLoadMoreSymbols:p,canLoadMore:g}=e,{mode:f,isMobile:v,selectedSymbolType:b,symbolTypes:y,feedItems:S,contentItem:x,emptyState:w=Bt,symbolSearchContent:k,symbolSearchState:C}=(0,A.useEnsuredContext)(I.SymbolSearchItemsDialogContext),E=a?s.createElement(BrokerButton,{brokerTitle:a,isActive:c,onToggle:u,onKeyDown:e=>{const t=(0,R.hashFromEvent)(e);t!==9+R.Modifiers.Shift&&9!==t&&e.stopPropagation()},logoInfo:l}):null,L=y.map((e=>({id:e.value,children:e.name}))),T="symbolSearch"===f&&["good","loadingWithPaginated"].includes(C),N=x??Me.SymbolSearchDialogContentItem,B=(0,s.useMemo)((()=>S.map((e=>s.createElement(N,{...e,searchToken:k.token})))),[S]) -;return s.createElement(s.Fragment,null,"symbolSearch"===f&&s.createElement(s.Fragment,null,s.createElement("div",{className:i(Rt.bubblesContainer,!v&&E&&Rt.withButton,v&&Rt.mobile)},y.length>0&&s.createElement(Lt,{id:"symbol-search-tabs",isActive:e=>e.id===b,onActivate:r,overflowBehaviour:v?"scroll":"wrap",className:i(Rt.bubbles,v&&Rt.mobile,h.isSeparateSymbolSearchTabs&&(k.withFilters||E)&&!v&&Rt.withFilters),items:L},v?null:s.createElement("div",null,E)),!h.isSeparateSymbolSearchTabs&&v&&y.length>0&&a&&s.createElement("div",{className:Rt.brokerButtonWrap},E)),h.isSeparateSymbolSearchTabs&&s.createElement(Re,{brokerButton:v?E:void 0})),s.createElement(Be,{listRef:d,listWrapRef:m,onTouchMove:o,items:B,getItemSize:()=>Ft,onLoadMoreSymbols:p,canLoadMore:g,hideFeed:!T}),"loading"===C&&s.createElement("div",{className:Rt.spinnerWrap},s.createElement(be.Spinner,null)),"symbolSearch"===f&&s.createElement(s.Fragment,null,!1,"empty"===C&&s.createElement(w,null)))}function Bt(e){const t=(0,V.useWatchedValueReadonly)({watchedValue:W.watchedTheme})===K.StdTheme.Dark?H:Z;return s.createElement(F,{className:Rt.noResultsDesktop},!Tt&&s.createElement(k.Icon,{icon:t,className:Rt.emptyIcon}),s.createElement("div",{className:Rt.emptyText},u.t(null,void 0,r(76822))))}const Mt=(0,h.getDefaultSearchSource)(),Ft=52;function _t(e){const{mode:t,setMode:n,setSelectedIndex:o,isMobile:a,selectedSearchSource:l,setSelectedSearchSource:i,isAllSearchSourcesSelected:p,selectedSymbolType:g,setSelectedSymbolType:y,symbolSearchContent:S,setSymbolSearchContent:x,searchRef:w,setSearchSpreads:k,showSpreadActions:C,selectedItem:E,forceUpdate:R,placeholder:T,initialScreen:N,footer:B,searchInput:M,upperCaseEnabled:F,externalInput:_,handleKeyDown:D,customSearchSymbols:P,filterQueryParams:O,searchSources:U,symbolSearchState:Q,setSymbolSearchState:V,onEmptyResults:W,overrideQueryParams:K,getFiltersBySymbolType:H,showRecents:Z,searchInitiationPoint:q}=(0,A.useEnsuredContext)(I.SymbolSearchItemsDialogContext),G=P??oe,$=(0,s.useRef)(t);$.current=t;const j=(0,s.useRef)(new AbortController),[J,X]=(0,s.useState)(0),Y=(0,s.useRef)(0),[re,ie]=(0,s.useState)(S.token),ce=(0,s.useRef)(null),ue=(0,s.useRef)(null),de=(0,s.useRef)({selectedIndexValue:-1,searchTokenValue:"",searchSpreadsValue:!0}),me=(0,s.useRef)(null),he=(0,s.useRef)(null),pe=(0,s.useRef)(null),{broker:ge=null,brokerId:ve,brokerTitle:be,brokerLogoInfo:ye,isBrokerChecked:Se=!1,setIsBrokerChecked:xe=()=>{},unhideSymbolSearchGroups:we=""}={brokerId:void 0,brokerTitle:void 0,brokerLogoInfo:void 0};(0,s.useEffect)((()=>()=>{j.current.abort(),Pe(),Oe()}),[]),(0,s.useEffect)((()=>{w?.current&&ie(w.current.value)}),[]),(0,s.useEffect)((()=>{const e=w.current;if(e)return e.addEventListener("input",Te),e.addEventListener("focus",Ae),e.addEventListener("select",Re),e.addEventListener("click",Re),e.addEventListener("keyup",De),_&&D&&e.addEventListener("keydown",D),()=>{e&&(e.removeEventListener("input",Te),e.removeEventListener("focus",Ae),e.removeEventListener("select",Re),e.removeEventListener("click",Re), -e.removeEventListener("keyup",De),_&&D&&e.removeEventListener("keydown",D))}}),[D]),(0,s.useEffect)((()=>{Boolean(N)&&""===re.trim()?x((e=>{const t=Boolean(l&&U.length>1&&!(0,h.exchangeSelectDisabled)(g)),r=H(g);return{...e,tabSelectFilters:r,currentSymbolType:g,canChangeExchange:t,withFilters:Boolean(t||r?.length),token:re,currentTabAvailableSearchSources:U,currentSelectedSearchSource:l}})):(x((e=>({...e,symbolStartIndex:0}))),Be(re,g,l).then((()=>{ce.current&&(ce.current.scrollTop=0)})))}),[re,g,l,Se,N,O]),(0,s.useEffect)((()=>{if(!E||!w.current)return;if(!d.enabled("show_spread_operators"))return w.current.value=E.symbol,void R();const e=ne(E)?E.exchange:E.parent.exchange;let t;t="contracts"in E&&E.contracts?.length?E.contracts[0]:E;const r={name:t.symbol,exchange:e,prefix:t.prefix,fullName:t.full_name},[n,o]=v(w.current,r,F);w.current.value=n,w.current.setSelectionRange(o,o),R()}),[E]);const ke=N??"div",Ce=Boolean(N)&&"symbolSearch"!==t,Ee=M??L.DialogSearch,Ie=(0,s.useMemo)((()=>({listRef:ue,resetRecommends:_e,updateRecommends:Be,searchToken:re,emptyTextClassName:Rt.emptyText,isBrokerChecked:Se,symbolSearchState:Q,currentMode:$})),[ue,re,Se,Q,$,O]);return s.createElement(z.SymbolSearchDialogBodyContext.Provider,{value:Ie},!(_&&"symbolSearch"===t)&&s.createElement(Ee,{reference:w,className:c()(Rt.search,F&&Rt.upperCase),placeholder:T||u.t(null,void 0,r(8573))},C&&s.createElement(fe,{state:de,update:Ne})),Ce?s.createElement(ke,null):s.createElement(Nt,{otherSymbolsCount:J,onListTouchMove:function(){w.current?.blur()},onChangeSymbolTypeFilter:function(e){const{id:t}=e;y(t),o(-1)},onResetFilters:function(){h.isSeparateSymbolSearchTabs?"resetFilter"===Q?y((0,h.getAllSymbolTypesValue)()):Mt&&i(Mt):(y((0,h.getAllSymbolTypesValue)()),Mt&&i(Mt));xe(!1),a||w.current?.focus()},brokerTitle:be,brokerLogoInfo:ye,isBrokerActive:Se,onBrokerToggle:xe,listRef:ue,listWrapRef:ce,onLoadMoreSymbols:void 0,canLoadMore:void 0}),B);function Le(){if(!w.current)return;const[e,t,r]=b(w.current,F);Y.current=t,de.current={selectedIndexValue:-1,searchSpreadsValue:(0,m.isSpread)(r),searchTokenValue:e},me.current||(me.current=setTimeout(Ne,0))}function Re(){if(!w.current)return;const[,e]=b(w.current,F);e!==Y.current&&Le()}function Te(){d.enabled("show_spread_operators")?Le():w.current&&(de.current={selectedIndexValue:-1,searchSpreadsValue:!1,searchTokenValue:w.current.value},me.current||(me.current=setTimeout(Ne,0)))}function Ne(){const{selectedIndexValue:e,searchTokenValue:t,searchSpreadsValue:r}=de.current;me.current=null,(0,ee.unstable_batchedUpdates)((()=>{k(r),o(e),ie(F?t.toUpperCase():t)}))}async function Be(e,t,r,n){try{"noop"===Q?V("loading"):n?V("loadingWithPaginated"):(Pe(),Oe(),he.current=setTimeout((()=>{const r=Boolean(l&&U.length>1&&!(0,h.exchangeSelectDisabled)(t)),n=H(t);x({token:e,canChangeExchange:r,tabSelectFilters:n,withFilters:Boolean(r||n?.length),currentSymbolType:t,currentSelectedSearchSource:l,currentTabAvailableSearchSources:U,renderSymbolSearchList:[],symbolsRemaining:0,symbolStartIndex:0}),V("loading")}),500)),Ue() -;(0,h.getAllSymbolTypesValue)();const o=!1;let a;if(Se&&ge){a=(await(0,te.respectAbort)(j.current.signal,ge.accountMetainfo())).prefix}const s=d.enabled("show_spread_operators")?f(e)??a??r?.getRequestExchangeValue():l?.getRequestExchangeValue(),i=f(e)?void 0:(r||l)?.getRequestCountryValue(),[c,u]=await Promise.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=new Set(m.map((e=>`${e.exchange}_${e.symbol}`))),g=c.symbols.filter((e=>!p.has(`${e.exchange}_${e.symbol}`)));let v=function(e,t=window.ChartApiInstance.symbolsGrouping()){const r={},n=[];for(let o=0;o{const n=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"),void Me();Pe(),x((r=>{const n=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)}}function Me(){W&&(pe.current=setTimeout((()=>W()),1e3))}async function Fe(e,t,r,n,o,a,l){const s={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:void 0,brokerId:ve,onlyTradable:Boolean(ve)&&Se,unhideSymbolSearchGroups:we,signal:e,start:l,filterQueryParams:O,overrideQueryParams:K,searchInitiationPoint:q},i=(0,ae.getSearchRequestDelay)();return void 0!==i&&await(0,te.delay)(e,i),G(s)}function _e(){Ue(),V("empty"),ie(""),k(!1),x((e=>({...e,symbolStartIndex:0}))),Pe()}function Ae(){"watchlist"===$.current&&(n("symbolSearch"),(0,le.trackEvent)("Watchlist","Mobile SS","Go to SS page"))}function De(e){switch((0,se.hashFromEvent)(e)){case 37:case 39:Re()}}function Pe(){he.current&&clearTimeout(he.current)}function Oe(){pe.current&&clearTimeout(pe.current)}function Ue(){j.current.abort(),j.current=new AbortController}}var At=r(48199),Dt=r(97514),Pt=r(58442),Ot=r(1765);function Ut(e){const[t,r]=(0,s.useState)((()=>{const{defaultSearchSource:t,searchSources:r}=e,n=Ot.getValue("symboledit.exchangefilter","");return r.find((e=>e.value()===n))||t})) -;return[t,(0,s.useCallback)((e=>{var t;r(e),t=e,Ot.setValue("symboledit.exchangefilter",t.value())}),[])]}function Qt(e){const{selectedSymbolSettingsKey:t="symboledit.filter"}=e,[r,n]=(0,s.useState)((()=>{if(1===e.types.length)return e.types[0].value;const r=Ot.getValue(t,(0,h.getAllSymbolTypesValue)());return e.types.find((e=>e.value===r))?r:(0,h.getAllSymbolTypesValue)()}));return[r,(0,s.useCallback)((e=>{n(e),function(e,t="symboledit.filter"){Ot.setValue(t,e)}(e,t)}),[t])]}var Vt=r(46043),Wt=r(82708),Kt=r(88145),zt=r(76460),Ht=r(88716);const Zt=!1,qt=(0,h.getAvailableSearchSources)(),Gt=(0,h.getDefaultSearchSource)(),$t=d.enabled("uppercase_instrument_names");function jt(e){const{onClose:t,symbolTypeFilter:n,initialMode:o,defaultValue:a="",showSpreadActions:l,hideMarkedListFlag:i,selectSearchOnInit:c=!0,onSearchComplete:m,dialogTitle:p=u.t(null,void 0,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:K,showRecents:z=!0,searchInitiationPoint:H="symbolSearch",selectedSymbolSettingsKey:Z,filterValuesSettingsKey:q}=e,G=(0,s.useMemo)((()=>{if(D)return[];const t=e.symbolTypes??(0,h.getAvailableSymbolTypes)();return n?n(t):t}),[]),j=void 0!==e.input,J=D?[]:qt,[X,Y]=(0,s.useState)((()=>rr(a,V)?"options":o)),[ee,te]=(0,s.useState)((()=>rr(a,V))),[re,ae]=(0,s.useState)((()=>null)),le=(0,s.useRef)(function(e,t){const r=rr(e,t);return(0,h.isOptionDefaultValue)(e)?r??e.value:e}(a,V)),[ie,ce]=Ut({searchSources:J,defaultSearchSource:Gt}),[ue,de]=[],[me,he]=Qt({types:G,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]||Gt:ie,ke=(0,s.useMemo)((()=>{if(!h.isSeparateSymbolSearchTabs)return J;return J.filter((e=>{const t=TAB_SOURCE_FILTER_MAP[me];if(!t)return!1;if(!me)return!0;const r=e.group();return r===ExchangeGroup.AllExchanges||r&&t.value.includes(r)}))}),[J,me]),Ce=(0,s.useCallback)((e=>{const t=h.isSeparateSymbolSearchTabs?TAB_SELECT_FILTER_MAP:void 0;if(t)return K?.length?t[e]?.filter((e=>!K.includes(e.id))):t[e]}),[K]),[Ee,Ie]=(0,s.useState)((()=>{const e=Boolean(ie&&qt.length>1&&!(0,h.exchangeSelectDisabled)(me)),t=Ce(me);return{canChangeExchange:e,tabSelectFilters:t,withFilters:Boolean(e||t?.length),renderSymbolSearchList:[],token:le.current,symbolsRemaining:0,currentSymbolType:me,currentSelectedSearchSource:we,currentTabAvailableSearchSources:ke,symbolStartIndex:0}})),Le=(0,s.useCallback)((e=>{trackEvent("New SS",me,"Change sources"),de?.(me,e),Ie((t=>({...t,currentSelectedSearchSource:e})))}),[me,Ie]),Re=(0,s.useRef)(e.input??null),[Ne,Be]=(0,s.useState)(!1),Me=(0,Vt.useForceUpdate)(),[Fe,_e]=(0, -s.useState)(new Set),{broker:Ae=null,brokerId:De,unhideSymbolSearchGroups:Pe="",displayBrokerSymbol:Oe=!1}={brokerId:void 0};(0,s.useLayoutEffect)((()=>{!Re?.current||!j&&Boolean(Re.current?.value)||(j||"compare"===X||(Re.current.value=le.current),!N||j&&"symbolSearch"!==X||Re.current.focus())}),[X]),(0,s.useEffect)((()=>{Re?.current&&c&&N&&Re.current.select()}),[]);const Ue=(0,s.useMemo)((()=>Ee.renderSymbolSearchList.reduce(((e,t)=>{const r=Yt(t),n=Fe.has(r);return e.push(t),n&&t.contracts&&e.push(...t.contracts.map((e=>({...e,parent:t})))),e}),[])),[Ee.renderSymbolSearchList,Fe]),Qe=(0,s.useRef)(null);(0,s.useEffect)((()=>{-1!==be&&Qe.current?.scrollIntoView({block:"nearest"})}),[be,Qe]);const Ve=y.includes(me),We=(0,s.useMemo)((()=>Ue.map(((e,t)=>{if(ne(e)){const r=Yt(e),n=e.contracts?Fe.has(r):void 0,o=t===be,a=Ee.renderSymbolSearchList.findIndex((t=>t.symbol===e.symbol&&t.exchange===e.exchange))+1;return{key:t,numberInList:a,id:r,title:Xt(e,Oe),description:e.description,isOffset:!1,onClick:Je.bind(null,e,a),providerId:e.provider_id,source:e.source,source2:e.source2,country:e.country?.toLocaleLowerCase(),type:e.type,exchangeName:null===e.exchange?void 0:e.exchange,exchangeTooltip:"",prefix:e.prefix||void 0,marketType:(0,Dt.marketType)(e.type,e.typespecs,!1),hideMarketType:Ve,isEod:e.params?.includes("eod")&&"economic"!==e.type,isYield:(0,Kt.isYield)(e),isExpanded:n,onExpandClick:e.contracts?Xe.bind(null,r):void 0,fullSymbolName:e.contracts?Pt.QualifiedSources.fromSymbolSearchResult(e,e.contracts[0]):Pt.QualifiedSources.fromSymbolSearchResult(e),itemRef:o?Qe:void 0,isSelected:t===be,hideMarkedListFlag:i,item:e,logoId:e.logoid,currencyLogoId:e["currency-logoid"],baseCurrencyLogoId:e["base-currency-logoid"],sourceLogoId:e.source_logoid,shortName:(0,Wt.safeShortName)(Pt.QualifiedSources.fromSymbolSearchResult(e)),currencyCode:e.currency_code,isPrimary:e.is_primary_listing,isPromo:e.is_promo}}{const{parent:r}=e,n=Yt(r),o=t===be,a=Ee.renderSymbolSearchList.findIndex((e=>e.symbol===r.symbol&&e.exchange===r.exchange))+1;return{key:t,numberInList:a,id:n+e.symbol,dangerousTitleHTML:Xt(e,Oe),dangerousDescriptionHTML:`${r.description}`+(e.description?` (${e.description})`:""),isOffset:!0,isEod:e.params?.includes("eod"),isYield:(0,Kt.isYield)(e),onClick:Ye.bind(null,e.parent,e,a),providerId:r.provider_id,country:r.country?.toLowerCase(),sourceLogoId:r.source_logoid,type:r.type,exchangeName:null===r.exchange?void 0:r.exchange,exchangeTooltip:"",marketType:(0,Dt.marketType)(r.type,e.typespecs,!1),hideMarketType:Ve,fullSymbolName:Pt.QualifiedSources.fromSymbolSearchResult(e.parent,e),itemRef:o?Qe:void 0,isSelected:o,hideMarkedListFlag:i,item:e}}}))),[Ee.renderSymbolSearchList,Fe,X,be,F]),Ke=(0,s.useMemo)((()=>function(e,t,r){const n=new Map(t?.map((e=>[e.id,e.urlParam]))),o=r[e];let a;if(o){a={};for(const[e,t]of Object.entries(o)){const r=n.get(e);r&&(a[r]=t)}}return a}(me,Ce(me),pe)),[me,Ce,pe]),ze=(0, -s.useMemo)((()=>Ee.renderSymbolSearchList.slice(0,20).map((e=>e.contracts?Pt.QualifiedSources.fromSymbolSearchResult(e,e.contracts[0]):Pt.QualifiedSources.fromSymbolSearchResult(e)))),[Ee.renderSymbolSearchList]);(0,s.useEffect)((()=>{if(!U)return;const e=["resetFilter","resetTabFilter","empty"].includes(Se)?[]:ze,t={...Ke,result_list:e};if(t.search_type||(t.search_type="bitcoin,crypto"===me?"crypto":me),!h.isSeparateSymbolSearchTabs)return t.exchange=we?.getRequestCountryValue()??null,void U(t);if(me){const e=we?.getRequestCountryValue()??null;e&&(t.country=e);const r=we?.getRequestExchangeValue()??null;r&&(t.exchange=r)}U(t)}),[me,Ke,ze,we,Se]);const He=(0,s.useMemo)((()=>{if(A)return A}),[me,A,Ke,V]),Ze=k??tr,qe=Ze!==tr&&!j,Ge=(e,r)=>({mode:X,setMode:Y,selectedSearchSource:we,setSelectedSearchSource:h.isSeparateSymbolSearchTabs?Le:ce,isAllSearchSourcesSelected:B.isAllSearchSourcesSelected,allSearchSourcesTitle:h.isSeparateSymbolSearchTabs?TAB_SOURCE_FILTER_MAP[Ee.currentSymbolType]?.allSearchSourcesTitle:void 0,selectedSymbolType:me,setSelectedSymbolType:he,selectedIndex:be,setSelectedIndex:ye,onClose:t,setSymbolSearchContent:Ie,symbolSearchContent:Ee,searchRef:Re,cachedInputValue:le,searchSpreads:fe,setSearchSpreads:ve,handleListWidth:et,isSmallWidth:Ne,feedItems:We,isMobile:e,showSpreadActions:l,selectSearchOnInit:c,isTablet:r,selectedItem:Ue[be],forceUpdate:Me,placeholder:g,initialScreen:b,toggleExpand:Xe,openedItems:Fe,onSubmit:nt,onSearchComplete:m,footer:E,symbolTypes:G,contentItem:C,searchInput:L,emptyState:R,autofocus:N,upperCaseEnabled:$t,externalInput:j,handleKeyDown:qe?void 0:rt,customSearchSymbols:He,searchSources:ke,selectedFilterValues:pe,setSelectedFilterValues:ge,filterQueryParams:Ke,symbolSearchState:Se,setSymbolSearchState:xe,onEmptyResults:void 0,overrideQueryParams:W,getFiltersBySymbolType:Ce,showRecents:z,searchInitiationPoint:H}),$e=_??$,je=w??"div";return s.createElement(je,null,s.createElement(S.MatchMediaMap,{rules:x.DialogBreakpoints},(({TabletSmall:e,TabletNormal:n})=>s.createElement(I.SymbolSearchItemsDialogContext.Provider,{value:Ge(e,n)},s.createElement(Ze,{..."exchange"===X?{title:u.t(null,void 0,r(28628)),dataName:"exchanges-search",render:()=>s.createElement($e,{searchSources:Ee.currentTabAvailableSearchSources}),additionalHeaderElement:s.createElement(At.BackButton,{onClick:()=>Y("symbolSearch"),className:Ht.backButton,size:"medium","aria-label":u.t(null,{context:"input"},r(41256)),preservePaddings:!0,flipIconOnRtl:(0,Te.isRtl)()}),additionalElementPos:"before"}:{title:p,dataName:"symbol-search-items-dialog",render:()=>s.createElement(_t,null),additionalElementPos:"after"},shouldReturnFocus:O,fullScreen:f,onClose:t,onClickOutside:t,onKeyDown:qe?void 0:rt,isOpened:!0})))));function Je(e,t,r){if(e.contracts)return e.contracts.length?void Ye(e,e.contracts[0],t,r):void Xe(Yt(e));Ye(e,void 0,t,r)}function Xe(e){const t=new Set(Fe);t.has(e)?t.delete(e):t.add(e),_e(t)}function Ye(e,r,n,o){const a=r||e,{exchange:l}=e;if(d.enabled("show_spread_operators")){const e={name:a.symbol, -exchange:l,prefix:a.prefix,fullName:a.full_name};if(fe)return tt(e),void Me();if(Re.current&&Re.current.value.includes(","))return void tt(e)}ot([{resolved:!0,symbol:Pt.QualifiedSources.fromSymbolSearchResult(e,r),result:a}],n,o),t()}function et(e){Be("fixed"===M||e<=640)}function tt(e){if(!Re.current)return;const[t,r]=v(Re.current,e,$t);Re.current.value=t,Re.current.setSelectionRange(r,r),Re.current.focus()}function rt(e){if(e.target&&e.target!==Re.current)return;const r=(0,se.hashFromEvent)(e);switch(r){case 13:e.preventDefault(),nt(!0);break;case 27:if(e.preventDefault(),"exchange"===X)return void Y("symbolSearch");if("options"===X)return Y("symbolSearch"),te(null),void ae(null);t()}switch((0,T.mapKeyCodeToDirection)(r)){case"blockPrev":if(e.preventDefault(),0===be||"good"!==Se)return;if(-1===be)return void ye(0);ye(be-1);break;case"blockNext":if(e.preventDefault(),be===We.length-1||"good"!==Se)return;ye(be+1);break;case"inlinePrev":{if(-1===be)return;const t=We[be],{id:r,isOffset:n,onExpandClick:o}=t;if(!n&&r&&Fe.has(r)&&Boolean(o)&&!Boolean(F)&&(e.preventDefault(),Xe(r)),o)return void F?.(e,!0);break}case"inlineNext":{if(-1===be)return;const t=We[be],{id:r,isOffset:n,onExpandClick:o}=t;if(n||!r||Fe.has(r)||!Boolean(o)||Boolean(F)||(e.preventDefault(),Xe(r)),o)return void F?.(e,!0);break}}F?.(e)}function nt(e){if(!Re.current)return;let r=Re.current.value;if(d.enabled("show_spread_operators")&&fe&&r){const n=We[be];if(n&&void 0!==n.isExpanded&&(n.onClick(),r=Re.current.value),r.includes(",")){return ot(er(r).map(Jt),null),void(e&&t())}return ot([{symbol:$t?r.toUpperCase():r,resolved:!1}],null),void(e&&t())}if(r.includes(","))return ot(er(r).map(Jt),null),void(e&&t());if(-1!==be){We[be].onClick()}else if(d.enabled("allow_arbitrary_symbol_search_input")){const n=$t?r.toUpperCase():r;if(n&&""!==n.trim()){const e=er(n);if(Zt||void 0===De||-1!==n.indexOf(":")){ot(e.map(Jt),null)}else(function(e){let t=!1;return Promise.all(e.map((e=>-1!==e.indexOf(":")||t?Promise.resolve({symbol:e,resolved:!1}):(t=!0,async function(e){await(Ae?.accountMetainfo());const t=void 0,r=await oe({strictMatch:!0,serverHighlight:!1,text:e,lang:window.language||"",brokerId:De,onlyTradable:!0,unhideSymbolSearchGroups:Pe,exchange:t});if(0!==r.symbols.length){const e=r.symbols[0],{contracts:t}=e,n=t&&t.length>0?t[0]:void 0,o=e.prefix||e.exchange,a=n?n.symbol:e.symbol;if(o&&a)return{symbol:Pt.QualifiedSources.fromSymbolSearchResult(e,n),resolved:!0,result:e}}return{symbol:e,resolved:!1}}(e)))))})(e).then((e=>ot(e,null)))}e&&t()}else if("empty"!==Se&&We.length>0){We[0].onClick()}}async function ot(e,t,r){const[{result:n,symbol:o,resolved:a}]=e,l=Re.current?.value,s=!r||(0,zt.isKeyboardClick)(r);let i=fe;void 0!==n&&ne(n)&&(i="spread"===n.type),m(e,{symbolType:me,isKeyboardEvent:s,numberInList:t,inputValue:l,isSpread:i})}}function Jt(e){return{symbol:$t?e.toUpperCase():e,resolved:!1}}function Xt(e,t){const{broker_symbol:r,symbol:n,description:o}=e;return`${"spread"===e.type?o:n}${t&&r?` (${r})`:""}`}function Yt(e){ -return e.symbol+e.exchange+e.description}function er(e){return e.split(",").map((e=>e.trim())).filter((e=>""!==e))}function tr(e){const{isMobile:t,isTablet:r}=(0,A.useEnsuredContext)(I.SymbolSearchItemsDialogContext);return s.createElement(w.AdaptivePopupDialog,{...e,className:c()(Ht.dialog,!t&&(r?Ht.tabletDialog:Ht.desktopDialog)),backdrop:!0,draggable:!1})}function rr(e,t){return null}},81319:(e,t,r)=>{"use strict";r.d(t,{createGroupColumns:()=>h,exchangeSelectDisabled:()=>m,getAllSymbolTypesValue:()=>d,getAvailableSearchSources:()=>c,getAvailableSymbolTypes:()=>u,getDefaultSearchSource:()=>i,getSymbolFullName:()=>s,isOptionDefaultValue:()=>g,isSeparateSymbolSearchTabs:()=>p});var n=r(11542),o=r(20882);class a{constructor(e){this._exchange=e}value(){return this._exchange.value}name(){return(0,o.isAllSearchSourcesSelected)(this)?n.t(null,void 0,r(34040)):this._exchange.name}description(){return this._exchange.desc}country(){return this._exchange.country}providerId(){return this._exchange.providerId}group(){return this._exchange.group}includes(e){return function(e,t){const r=t.toLowerCase(),{name:n,desc:o,searchTerms:a}=e;return n.toLowerCase().includes(r)||o.toLowerCase().includes(r)||void 0!==a&&a.some((e=>e.toLowerCase().includes(r)))}(this._exchange,e)}getRequestExchangeValue(){return this._exchange.value}getRequestCountryValue(){}}var l=r(3685);function s(e){if(e.fullName)return e.fullName;let t;return t=e.prefix||e.exchange?(e.prefix||e.exchange)+":"+e.name:e.name,t.replace(/<\/?[^>]+(>|$)/g,"")}function i(){const e=c();return e.find(o.isAllSearchSourcesSelected)||e[0]||null}function c(){return(0,o.createSearchSources)(a,(0,l.getExchanges)())}function u(){return window.ChartApiInstance.supportedSymbolsTypes()}function d(){return""}function m(e){return!!p&&!TAB_SOURCE_FILTER_MAP[e]}function h(e,t=2){if(0===e.length)return[];if(1===t)return[e];const r=Math.floor(e.length/2)+e.length%2;return[e.slice(0,r),e.slice(r)].filter((e=>e.length>0))}const p=!1;function g(e){return"string"!=typeof e}},82708:(e,t,r)=>{"use strict";r.d(t,{safeShortName:()=>o});var n=r(59149);function o(e){try{return(0,n.shortName)(e)}catch(t){return e}}},44254:(e,t,r)=>{"use strict";r.d(t,{factorOutBraces:()=>h,getTokenAtPos:()=>m,isBinaryOperator:()=>u,isSpread:()=>d,parseToken:()=>g,shortName:()=>p,symbolTokenEscapeRe:()=>l,tokenize:()=>c});var n,o=r(18429);!function(e){e.Symbol="symbol",e.IncompleteSymbol="incompleteSymbol",e.Number="number",e.IncompleteNumber="incompleteNumber",e.SeparatorPrefix="separatorPrefix",e.OpenBrace="openBrace",e.CloseBrace="closeBrace",e.Plus="plus",e.Minus="minus",e.Multiply="multiply",e.Divide="divide",e.Power="power",e.Whitespace="whitespace",e.Unparsed="unparsed"}(n||(n={}));const a=/(?:[^-+\/*^\s]'|[a-zA-Z0-9_\u0370-\u1FFF_\u2E80-\uFFFF^])(?:[^-+\/*^\s]'|[a-zA-Z0-9_\u0020\u0370-\u1FFF_\u2E80-\uFFFF_!:.&])*|'.+?'/,l=/[+\-/*]/,s=(e=!1)=>({number:e?/\d+(?:\.\d*|(?![a-zA-Z0-9_!:.&]))(?:\s*(?=\s*$))?|\.\d+(?:\s*(?=\s*$))?/:/\d+(?:\.\d*|(?![a-zA-Z0-9_!:.&]))|\.\d+/,incompleteNumber:/\./,symbol:a, -incompleteSymbol:/'[^']*/,separatorPrefix:o.SEPARATOR_PREFIX,openBrace:"(",closeBrace:")",plus:"+",minus:"-",multiply:"*",divide:"/",power:"^",whitespace:/[\0-\x20\s]+/,unparsed:null}),i=(e=s())=>new RegExp(Object.values(e).map((e=>{return null===e?"":`(${"string"==typeof e?(t=e,t.replace(/[\^$()[\]{}*+?|\\]/g,"\\$&")):e.source})`;var t})).filter((e=>""!==e)).concat(".").join("|"),"g");function c(e,t=s()){if(!e)return[];const r=[],n=Object.keys(t);let o;const a=i(t);for(;o=a.exec(e);){let e=!1;for(let t=n.length;t--;)if(o[t+1]){n[t]&&r.push({value:o[t+1],type:n[t],precedence:0,offset:o.index}),e=!0;break}e||r.push({value:o[0],type:"unparsed",precedence:0,offset:o.index})}return r}function u(e){return"plus"===e||"minus"===e||"multiply"===e||"divide"===e||"power"===e}function d(e){return e.length>1&&e.some((e=>u(e.type)))}function m(e,t){for(let r=0;ra.precedence&&(r[r.length-1].minPrecedence=a.precedence);break;case"openBrace":n={minPrecedence:1/0,openBraceIndex:o},r.push(n);break;case"closeBrace":{if(n=r.pop(),!n)break;const a=e[n.openBraceIndex-1],l=e[o+1],s=a&&("plus"===a.type||"multiply"===a.type);(!u(l?.type)||l?.precedence<=n.minPrecedence)&&(!u(a?.type)||a?.precedencen.minPrecedence&&(r[r.length-1].minPrecedence=n.minPrecedence))}}}for(let r=t.length;r--;)e.splice(t[r],1);return e}function p(e){return h(c(e)).reduce(((e,t)=>{if("symbol"!==t.type)return e+t.value;const[,r]=g(t);return r?e+r:e}),"")}function g(e){const t=/^'?(?:([A-Z0-9_]+):)?(.*?)'?$/i.exec(e.value);return null===t?[void 0,void 0]:[t[1],t[2]]}},618:(e,t,r)=>{"use strict";r.d(t,{removeUsdFromCryptoPairLogos:()=>l,resolveLogoUrls:()=>a});var n=r(36279);const o=(0,n.getLogoUrlResolver)();function a(e,t=n.LogoSize.Medium){const r=e.logoid,a=e["base-currency-logoid"],l=e["currency-logoid"],s=r&&o.getSymbolLogoUrl(r,t);if(s)return[s];const i=a&&o.getSymbolLogoUrl(a,t),c=l&&o.getSymbolLogoUrl(l,t);return i&&c?[i,c]:i?[i]:c?[c]:[]}function l(e){return 2!==e.length?e:function(e){return e.some((e=>s(e)))}(e)&&!function(e){return e.some((e=>e.includes("country")&&!s(e)))}(e)?e.filter((e=>!s(e))):e}function s(e){return!1}},39330:(e,t,r)=>{"use strict";r.d(t,{getBlockStyleClasses:()=>i,getLogoStyleClasses:()=>c});var n=r(97754),o=r.n(n),a=r(52292),l=r(37643),s=r.n(l);function i(e,t){return o()(s().pair,s()[e],t)}function c(e,t=2,r=!0){return o()(s().logo,s()[e],s().skeleton,a.skeletonTheme.wrapper,!r&&s().empty,1===t&&o()(a.skeletonTheme.animated))}},58492:(e,t,r)=>{"use strict";r.d(t,{ -getStyleClasses:()=>n.getStyleClasses});var n=r(53885)},97006:(e,t,r)=>{"use strict";r.d(t,{createRegExpList:()=>s,getHighlightedChars:()=>i,rankedSearch:()=>l});var n=r(87465);function o(e){return e.replace(/[!-/[-^{-}?]/g,"\\$&")}var a;function l(e){const{data:t,rules:r,queryString:o,isPreventedFromFiltering:a,primaryKey:l,secondaryKey:s=l,optionalPrimaryKey:i,tertiaryKey:c}=e;return t.map((e=>{const t=i&&e[i]?e[i]:e[l],a=e[s],u=c&&e[c];let d,m=0;return r.forEach((e=>{const{re:r,fullMatch:l}=e;if(r.lastIndex=0,(0,n.isString)(t)&&t&&t.toLowerCase()===o.toLowerCase())return m=4,void(d=t.match(l)?.index);if((0,n.isString)(t)&&l.test(t))return m=3,void(d=t.match(l)?.index);if((0,n.isString)(a)&&l.test(a))return m=2,void(d=a.match(l)?.index);if((0,n.isString)(a)&&r.test(a))return m=2,void(d=a.match(r)?.index);if(Array.isArray(u))for(const e of u)if(l.test(e))return m=1,void(d=e.match(l)?.index)})),{matchPriority:m,matchIndex:d,item:e}})).filter((e=>a||e.matchPriority)).sort(((e,t)=>{if(e.matchPriorityt.matchPriority)return-1;if(e.matchPriority===t.matchPriority){if(void 0===e.matchIndex||void 0===t.matchIndex)return 0;if(e.matchIndex>t.matchIndex)return 1;if(e.matchIndexe))}function s(e,t){const r=[],n=e.toLowerCase(),a=e.split("").map(((e,t)=>`(${0!==t?`[/\\s-]${o(e)}`:o(e)})`)).join("(.*?)")+"(.*)";return r.push({fullMatch:new RegExp(`(${o(e)})`,"i"),re:new RegExp(`^${a}`,"i"),reserveRe:new RegExp(a,"i"),fuzzyHighlight:!0}),t&&t.hasOwnProperty(n)&&r.push({fullMatch:t[n],re:t[n],fuzzyHighlight:!1}),r}function i(e,t,r){const n=[];return e&&r?(r.forEach((e=>{const{fullMatch:r,re:o,reserveRe:a}=e;r.lastIndex=0,o.lastIndex=0;const l=r.exec(t),s=l||o.exec(t)||a&&a.exec(t);if(e.fuzzyHighlight=!l,s)if(e.fuzzyHighlight){let e=s.index;for(let t=1;t{"use strict";r.d(t,{HighlightedText:()=>s});var n=r(50959),o=r(97754),a=r(97006),l=r(68222);function s(e){const{queryString:t,rules:r,text:s,className:i}=e,c=(0,n.useMemo)((()=>(0,a.getHighlightedChars)(t,s,r)),[t,r,s]);return n.createElement(n.Fragment,null,c.length?s.split("").map(((e,t)=>n.createElement(n.Fragment,{key:t},c[t]?n.createElement("span",{className:o(l.highlighted,i)},e):n.createElement("span",null,e)))):s)}},78036:(e,t,r)=>{"use strict";r.d(t,{useEnsuredContext:()=>a});var n=r(50959),o=r(50151);function a(e){return(0,o.ensureNotNull)((0,n.useContext)(e))}},46043:(e,t,r)=>{"use strict";r.d(t,{useForceUpdate:()=>n.useForceUpdate});var n=r(125)},29006:(e,t,r)=>{"use strict";r.d(t,{useResizeObserver:()=>n.useResizeObserver});var n=r(67842)},77975:(e,t,r)=>{"use strict";r.d(t,{useWatchedValueReadonly:()=>o});var n=r(50959) -;const o=(e,t=!1,r=[])=>{const o="watchedValue"in e?e.watchedValue:void 0,a="defaultValue"in e?e.defaultValue:e.watchedValue.value(),[l,s]=(0,n.useState)(o?o.value():a);return(t?n.useLayoutEffect:n.useEffect)((()=>{if(o){s(o.value());const e=e=>s(e);return o.subscribe(e),()=>o.unsubscribe(e)}return()=>{}}),[o,...r]),l}},84877:(e,t,r)=>{"use strict";r.d(t,{MatchMediaMap:()=>l});var n=r(50959),o=r(66783),a=r.n(o);class l extends n.Component{constructor(e){super(e),this._handleMediaChange=()=>{const e=i(this.state.queries,((e,t)=>t.matches));let t=!1;for(const r in e)if(e.hasOwnProperty(r)&&this.state.matches[r]!==e[r]){t=!0;break}t&&this.setState({matches:e})};const{rules:t}=this.props;this.state=s(t)}shouldComponentUpdate(e,t){return!a()(e,this.props)||(!a()(t.rules,this.state.rules)||!a()(t.matches,this.state.matches))}componentDidMount(){this._migrate(null,this.state.queries)}componentDidUpdate(e,t){a()(e.rules,this.props.rules)||this._migrate(t.queries,this.state.queries)}componentWillUnmount(){this._migrate(this.state.queries,null)}render(){return this.props.children(this.state.matches)}static getDerivedStateFromProps(e,t){if(a()(e.rules,t.rules))return null;const{rules:r}=e;return s(r)}_migrate(e,t){null!==e&&i(e,((e,t)=>{t.removeEventListener("change",this._handleMediaChange)})),null!==t&&i(t,((e,t)=>{t.addEventListener("change",this._handleMediaChange)}))}}function s(e){const t=i(e,((e,t)=>window.matchMedia(t)));return{queries:t,matches:i(t,((e,t)=>t.matches)),rules:{...e}}}function i(e,t){const r={};for(const n in e)e.hasOwnProperty(n)&&(r[n]=t(n,e[n]));return r}},63932:(e,t,r)=>{"use strict";r.d(t,{Spinner:()=>c});var n=r(50959),o=r(97754),a=r.n(o),l=r(58096),s=(r(40987),r(53895)),i=r.n(s);function c(e){const{ariaLabel:t,ariaLabelledby:r,className:o,style:s,size:c,id:u,disableSelfPositioning:d}=e;return n.createElement("div",{className:a()(o,"tv-spinner","tv-spinner--shown",`tv-spinner--size_${l.spinnerSizeMap[c||l.DEFAULT_SIZE]}`,d&&i().disableSelfPositioning),style:s,role:"progressbar",id:u,"aria-label":t,"aria-labelledby":r})}},10381:(e,t,r)=>{"use strict";r.d(t,{ToolWidgetCaret:()=>i});var n=r(50959),o=r(97754),a=r(9745),l=r(86186),s=r(578);function i(e){const{dropped:t,className:r}=e;return n.createElement(a.Icon,{className:o(r,l.icon,{[l.dropped]:t}),icon:s})}},99343:e=>{e.exports={button:"button-GwQQdU8S",pressed:"pressed-GwQQdU8S",hover:"hover-GwQQdU8S",clicked:"clicked-GwQQdU8S",isInteractive:"isInteractive-GwQQdU8S",accessible:"accessible-GwQQdU8S",isGrouped:"isGrouped-GwQQdU8S",isActive:"isActive-GwQQdU8S",isOpened:"isOpened-GwQQdU8S",isDisabled:"isDisabled-GwQQdU8S",text:"text-GwQQdU8S",icon:"icon-GwQQdU8S",endIcon:"endIcon-GwQQdU8S"}},79619:e=>{e.exports={title:"title-u3QJgF_p"}},46003:(e,t,r)=>{"use strict";r.d(t,{DEFAULT_TOOL_WIDGET_BUTTON_THEME:()=>s,ToolWidgetButton:()=>i});var n=r(50959),o=r(97754),a=r(9745),l=r(99343);const s=l,i=n.forwardRef(((e,t)=>{ -const{tag:r="div",icon:s,endIcon:i,isActive:c,isOpened:u,isDisabled:d,isDisabledAppearance:m,isGrouped:h,isHovered:p,isClicked:g,onClick:f,text:v,textBeforeIcon:b,title:y,theme:S=l,className:x,forceInteractive:w,"data-name":k,"data-tooltip":C,tooltipPosition:E,children:I,isPressed:L,...R}=e,T=o(x,S.button,{"apply-common-tooltip":Boolean(y||C),"common-tooltip-vertical":Boolean(C)&&"vertical"===E,[S.isActive]:c,[S.isOpened]:u,[S.isInteractive]:(w||Boolean(f))&&!d&&!m,[S.isDisabled]:Boolean(d||m),[S.isGrouped]:h,[S.hover]:p,[S.clicked]:g,[S.pressed]:L}),N=s&&("string"==typeof s?n.createElement(a.Icon,{className:S.icon,icon:s}):n.cloneElement(s,{className:o(S.icon,s.props.className)}));return"button"===r?n.createElement("button",{...R,ref:t,type:"button",className:o(T,S.accessible),disabled:d&&!m,onClick:f,title:y,"data-name":k,"data-tooltip":C},b&&v&&n.createElement("div",{className:o("js-button-text",S.text)},v),N,!b&&v&&n.createElement("div",{className:o("js-button-text",S.text)},v),I):n.createElement("div",{...R,ref:t,"data-role":"button",className:T,onClick:d?void 0:f,title:y,"data-name":k,"data-tooltip":C},b&&v&&n.createElement("div",{className:o("js-button-text",S.text)},v),N,!b&&v&&n.createElement("div",{className:o("js-button-text",S.text)},v),i&&n.createElement(a.Icon,{icon:i,className:l.endIcon}),I)}))},43845:(e,t,r)=>{"use strict";r.d(t,{ToolWidgetMenuSummary:()=>l});var n=r(50959),o=r(97754),a=r(79619);function l(e){return n.createElement("div",{className:o(e.className,a.title)},e.children)}},97514:(e,t,r)=>{"use strict";r.d(t,{VISIBLE_TYPESPECS:()=>l,marketType:()=>s});var n=r(11542);const o=new Map([["cfd",()=>n.t(null,void 0,r(79599))],["dr",()=>n.t(null,void 0,r(47268))],["index",()=>n.t(null,void 0,r(87464))],["forex",()=>n.t(null,void 0,r(17770))],["right",()=>n.t(null,{context:"symbol_type"},r(53174))],["bond",()=>n.t(null,void 0,r(42358))],["bitcoin",()=>n.t(null,void 0,r(46128))],["crypto",()=>n.t(null,void 0,r(46128))],["economic",()=>n.t(null,void 0,r(54094))],["indices",()=>n.t(null,void 0,r(90250))],["futures",()=>n.t(null,void 0,r(4723))],["stock",()=>n.t(null,void 0,r(76752))],["commodity",()=>n.t(null,void 0,r(70932))]]);r(40167);const a=new Map,l=new Set(["cfd","spreadbet","defi","yield","government","corporate","mutual","money","etf","unit","trust","reit","etn","convertible","closedend","crypto","oracle","ndf"]);function s(e,t=[],r=!0){const n=t.filter((e=>l.has(e))),s=`${e}_${n.sort().join("_")}`,i=a.get(s);if(void 0!==i)return i;const c=r?function(e){return o.get(e)?.()||e}(e):e,u=Boolean(t.length)?[c,...n].join(" "):c;return a.set(s,u),u}},52019:e=>{e.exports=''},89882:e=>{ -e.exports=''},2057:e=>{e.exports=''},95694:e=>{e.exports=''},49498:e=>{e.exports=''},60176:e=>{e.exports=''},35369:e=>{e.exports=''},58478:e=>{e.exports=''},73063:e=>{e.exports=''},14127:e=>{e.exports=''},18073:e=>{e.exports=''},99243:e=>{e.exports=''},42576:e=>{e.exports=''},578:e=>{ -e.exports=''},91540:e=>{e.exports=''},66619:e=>{e.exports=''},67562:e=>{e.exports=''},69533:e=>{e.exports=''},486:e=>{e.exports=''},63861:e=>{e.exports=''},81574:e=>{e.exports=''},32617:e=>{e.exports=''}, -35119:e=>{e.exports=''},69135:e=>{e.exports=''},54313:e=>{e.exports=''},6347:e=>{e.exports=''}}]); \ No newline at end of file diff --git a/charting_library/bundles/5893.e5c9a9c5e41a157ad197.js b/charting_library/bundles/5893.de851bcf23a70646c585.js similarity index 99% rename from charting_library/bundles/5893.e5c9a9c5e41a157ad197.js rename to charting_library/bundles/5893.de851bcf23a70646c585.js index 5cc24102..10145a4b 100644 --- a/charting_library/bundles/5893.e5c9a9c5e41a157ad197.js +++ b/charting_library/bundles/5893.de851bcf23a70646c585.js @@ -10,7 +10,7 @@ className:_.controlWrapper},(e.defaultButtonsVisible||e.title)&&s.createElement( this._handleBlur=()=>{this.state.isFocusVisible&&this.setState({isFocusVisible:!1})},this.state={isFocusVisible:!1}}render(){const{name:e,checked:t,value:n,renderItemContent:r,className:a}=this.props,i=s(x.item,x.accessible,{[x.checked]:t,[x.focusVisible]:this.state.isFocusVisible},a);return o.createElement("div",{className:i},o.createElement("input",{type:"radio",className:x.radio,name:e,value:n,onChange:this._onChange,onFocus:this._handleFocus,onBlur:this._handleBlur,checked:t}),r(parseInt(n),t))}});function w(e){const{name:t,values:n,selectedValues:r,onChange:a,renderItemContent:i}=e,l=n.map(((e,t)=>o.createElement(_,{key:t,value:e.toString(),renderItemContent:i,className:s(n.length>3&&x.paddingCompact)}))),c=r.map((e=>e.toString()));return o.createElement("div",{className:x.wrap},o.createElement(C.SwitchGroup,{name:t,onChange:e=>{a(parseInt(e))},values:c},l))}var E=n(6708);const S=y.t(null,void 0,n(54971));function T(e){const{value:t,items:n,onChange:s}=e;return o.createElement("div",{className:E.thicknessContainer},o.createElement("div",{className:E.thicknessTitle},S),o.createElement(w,{name:"color_picker_thickness_select",onChange:s,values:n,selectedValues:"mixed"===t?[]:[t],renderItemContent:(e,t)=>o.createElement("div",{className:r()(E.bar,t&&E.checked),style:{borderTopWidth:e}})}))}var N=n(69558);function I(e,t,n,o,s,r){return{repeat:e,width:t,height:n,segmentsGap:o,marginTop:s,segmentsGaps:r}}const k={"style-SOLID_thickness-1":I(1,"30px","1px"),"style-DASHED_thickness-1":I(4,"5px","1px","3px"),"style-DOTTED_thickness-1":I(6,"2px","2px","3px"),"style-SOLID_thickness-2":I(1,"30px","2px"),"style-DASHED_thickness-2":I(4,"5px","2px","3px"),"style-DOTTED_thickness-2":I(5,"3px","3px","3px"),"style-SOLID_thickness-3":I(1,"30px","3px"),"style-DASHED_thickness-3":I(4,"5px","3px","3px"),"style-DOTTED_thickness-3":I(5,"4px","4px","2px"),"style-SOLID_thickness-4":I(1,"30px","4px"),"style-DASHED_thickness-4":I(4,"5px","4px","3px"),"style-DOTTED_thickness-4":I(4,"5px","5px","3px")},P={...k,"style-mixed_thickness-large":I(1,"30px","16px"),"style-mixed_thickness-1":[I(1,"27px","1px"),I(4,"4px","1px","4px","5px",{3:"3px"}),I(6,"2px","2px","3px","5px")],"style-mixed_thickness-2":[I(1,"27px","2px"),I(4,"4px","2px","4px","4px",{3:"3px"}),I(6,"2px","2px","3px","4px")],"style-mixed_thickness-3":[I(1,"27px","3px"),I(4,"4px","3px","4px","3px",{3:"3px"}),I(6,"2px","2px","3px","3px")],"style-mixed_thickness-4":[I(1,"27px","4px"),I(4,"4px","4px","4px","3px",{3:"3px"}),I(6,"2px","2px","3px","3px")],"style-SOLID_thickness-mixed":[I(1,"30px","3px",void 0,"4px"),I(1,"30px","2px",void 0,"4px"),I(1,"30px","1px",void 0,"4px")],"style-DASHED_thickness-mixed":[I(4,"5px","3px","3px"),I(4,"5px","2px","3px","4px"),I(4,"5px","1px","3px","4px")],"style-DOTTED_thickness-mixed":[I(5,"3px","3px","3px"),I(5,"3px","2px","3px","4px"),I(6,"2px","2px","3px","4px")],"style-mixed_thickness-mixed":[I(1,"30px","3px"),I(4,"6px","2px","2px","4px"),I(5,"2px","2px","5px","4px")]};function D(e,t){if(!t)return[];const n=e??N.LINESTYLE_SOLID ;if("mixed"!==t&&t>4)return P["style-mixed_thickness-large"]||[];const o="mixed"===n?"mixed":B(n);return P[`style-${o}_thickness-${"mixed"===t?"mixed":t}`]||[]}function B(e){switch(e){case N.LINESTYLE_SOLID:return"SOLID";case N.LINESTYLE_DOTTED:return"DOTTED";case N.LINESTYLE_DASHED:return"DASHED";default:return"UNKNOWN"}}var M=n(24640),O=n(11556);function R(e){const{value:t,items:s,onChange:a,className:i}=e;return o.createElement("div",{className:r()(O.container,i)},o.createElement("div",{className:O.title},y.t(null,void 0,n(28603))),o.createElement(w,{name:"color_picker_line_style_select",onChange:a,values:s,selectedValues:"mixed"===t?[]:[t],renderItemContent:L}))}function L(e,t){const n=function(e,t=1){const n=B(e);return k[`style-${n}_thickness-${t}`]||null}(e,1);return n?o.createElement("div",{className:O.lineContainer},Array.from({length:n.repeat}).map(((e,s)=>{const a=n?.segmentsGaps?.[s]||n?.segmentsGap;return o.createElement("div",{key:s,className:r()(O.lineSegment,t&&O.checked),style:{width:n.width,height:n.height,...0!==s&&{[(0,M.isRtl)()?"marginRight":"marginLeft"]:a}}})}))):null}var V=n(44885);function F(e){const{className:t,selectOpacity:n=void 0!==e.opacity,thickness:s,lineStyle:a,color:i,disabled:l,opacity:c=1,onColorChange:u,onOpacityChange:d,onThicknessChange:p,onLineStyleChange:h,thicknessItems:m,lineStyleItems:f,onPopupClose:b,"data-name":y,repositionOnScroll:C,closeOnScrollOutsideOffset:x}=e,[_,w,E]=(0,v.useCustomColors)(),S=s&&m&&m.length>0;return o.createElement(g,{className:t,disabled:l,color:"mixed"!==i?i:null,selectOpacity:n,opacity:c,selectCustom:!0,customColors:_,onColorChange:u,onOpacityChange:i?d:void 0,onAddColor:w,onRemoveCustomColor:E,button:function(e,t){const n=e||t,u=n?"primary":"default";return o.createElement("div",{className:r()(V.colorPickerWrap,V[`intent-${u}`],V["border-thin"],V["size-medium"],n&&V.highlight,n&&V.focused,l&&V.disabled),"data-role":"button","data-name":s?"color-with-thickness-select":"color-select"},o.createElement("div",{className:r()(V.colorPicker,l&&V.disabled)},i&&"mixed"!==i?function(){const e=W(i,c),t=c>=.95&&A(i);return o.createElement("div",{className:V.opacitySwatch},o.createElement("div",{style:{backgroundColor:e},className:r()(V.swatch,t&&V.white)}))}():o.createElement("div",{className:V.placeholderContainer},o.createElement("div",{className:"mixed"===i?V.mixedColor:V.placeholder})),(void 0!==a||s)&&function(){const e=i&&"mixed"!==i?W(i,c):void 0;if(void 0===a&&!s)return null;const t=D(a,s);if(!t||Array.isArray(t)&&!t.length)return null;if(Array.isArray(t))return o.createElement("div",{className:V.overflowContainer},o.createElement("div",{className:r()(V.linePropertyContainer,V.multiProperty,A(i)&&V.whiteContainer)},t.map(((t,n)=>o.createElement("div",{key:n,className:V.lineItem,style:{marginTop:A(i)&&t?.marginTop?`calc(${t.marginTop} - 2px)`:t?.marginTop}},N(t,e))))));return o.createElement("div",{className:V.overflowContainer},o.createElement("div",{className:r()(V.linePropertyContainer,A(i)&&V.whiteContainer)},N(t,e))) }()),n&&o.createElement("span",{className:V.shadow}))},onPopupClose:b,"data-name":y,repositionOnScroll:C,closeOnScrollOutsideOffset:x},S&&o.createElement(T,{value:s,items:m,onChange:function(e){p?.(e)}}),void 0!==a&&f&&f?.length>0&&o.createElement(R,{className:r()(S&&V.lineStyleSelect),value:a,items:f,onChange:function(e){h?.(e)}}));function N(e,t){return Array.from({length:e.repeat}).map(((n,s)=>{const a=e?.segmentsGaps?.[s]||e?.segmentsGap,l=A(i)&&a?`calc(${a} - 2px)`:a;return o.createElement("div",{key:s,className:r()(V.lineSegment,A(i)&&V.white),style:{width:e.width,height:e.height,backgroundColor:t,...0!==s&&{[(0,M.isRtl)()?"marginRight":"marginLeft"]:l}}})}))}}function W(e,t){return e?(0,f.generateColor)(e,(0,f.alphaToTransparency)(t),!0):"#000000"}function A(e){return!!e&&e.toLowerCase()===b.white}},6245:(e,t,n)=>{"use strict";n.d(t,{defaultLineStyleItems:()=>c,lineStyleItemValues:()=>l});var o=n(89880),s=n(69558),r=n(501),a=n(23851),i=n(57740);const l=[{type:s.LINESTYLE_SOLID,icon:r,label:o.t(null,void 0,n(3554))},{type:s.LINESTYLE_DASHED,icon:a,label:o.t(null,void 0,n(88123))},{type:s.LINESTYLE_DOTTED,icon:i,label:o.t(null,void 0,n(27390))}],c=l.map((e=>e.type))},48897:(e,t,n)=>{"use strict";n.d(t,{SymbolInputsButton:()=>E});var o=n(50959),s=n(97754),r=n.n(s),a=n(11542),i=n(50151),l=n(50655),c=n(95711),u=n(37103),d=n(44755),p=n(48961),h=n(1861),m=n(9745),g=n(10600),v=n(36408);function f(e){const{value:t,onClick:n,className:r,startSlot:a,disabled:i=!1}=e;return o.createElement("div",{className:s(v.wrap,i&&v.disabled,r),onClick:n,"data-name":"edit-button"},o.createElement("div",{className:s(v.text,"apply-overflow-tooltip")},void 0!==a&&a,o.createElement("span",null,t)),o.createElement(m.Icon,{icon:g,className:v.icon}))}var b=n(31356),y=n(78260),C=n(44254),x=n(82708),_=n(54209);function w(e){const{symbol:t,onSymbolChanged:s,disabled:i,className:d}=e,[m,g]=(0,o.useState)(t),v=(0,o.useContext)(l.SlotContext),b=(0,o.useContext)(c.PopupContext);let y;return u.enabled("symbol_search_option_chain_selector")&&({quotes:y}=useSymbolQuotes(matchesOptionPattern(m)?m:null)),o.createElement(f,{value:m,onClick:function(){const e=function(e){const t=(0,C.tokenize)(e);return(0,C.isSpread)(t)}(m)?m:(0,x.safeShortName)(m),t="option"===y?.type,o=y?.["underlying-symbol"],r=u.enabled("symbol_search_option_chain_selector")&&t&&o?{type:"option",value:m,underlying:o}:e,i=(0,p.getSymbolSearchCompleteOverrideFunction)();(0,h.showSymbolSearchItemsDialog)({onSearchComplete:e=>{i(e[0].symbol,e[0].result).then((e=>{s(e.symbol),g(e.name)}))},dialogTitle:a.t(null,void 0,n(63245)),defaultValue:r,manager:v,onClose:()=>{b&&b.focus()},searchInitiationPoint:"indicatorInputs",enableOptionsChain:u.enabled("symbol_search_option_chain_selector"),showSpreadActions:u.enabled("show_spread_operators")&&u.enabled("studies_symbol_search_spread_operators")})},disabled:i,className:r()(d,u.enabled("uppercase_instrument_names")&&_.uppercase)})}function E(e){if("definition"in 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)};return o.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=>{const n=(0,d.getInternalSymbolName)(e,t);l(n,s,a)};return o.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});var o=n(50959),s=n(50655),r=n(51826),a=n(40336),i=n(87896);function l(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;const q=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);function U(){H.unmount(),r.dialogsOpenerManager.setAsClosed("SymbolSearch"),C&&C()}return r.dialogsOpenerManager.setAsOpened("SymbolSearch"),x&&x(),{close:U}}},73146:(e,t,n)=>{"use strict";n.d(t,{createAdapter:()=>a,doesStudyLikeAffectSave:()=>i});var o=n(26610),s=n(13896),r=n(2088);function a(e){if((0,o.isLineTool)(e))return{isPine:()=>!1,isStandardPine:()=>!1,canOverrideMinTick:()=>!1,resolvedSymbolInfoBySymbol:()=>{throw new TypeError("Only study is supported.")},symbolsResolved:()=>{throw new TypeError("Only study is supported.")},parentSources:()=>{throw new TypeError("Only study is supported.")},getAllChildren:()=>[],sourceId:()=>{throw new TypeError("Only study is supported.")},inputs:()=>({}),parentSourceForInput:()=>{throw new TypeError("Only study is supported.")}};if((0,r.isStudy)(e))return e;if("isInputsStudy"in e)return e;throw new TypeError("Unsupported source type.")}function i(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)};return o.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=>{const n=(0,d.getInternalSymbolName)(e,t);l(n,s,a)};return o.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});var o=n(50959),s=n(50655),r=n(51826),a=n(59071),i=n(87896);function l(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;const q=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);function U(){H.unmount(),r.dialogsOpenerManager.setAsClosed("SymbolSearch"),C&&C()}return r.dialogsOpenerManager.setAsOpened("SymbolSearch"),x&&x(),{close:U}}},73146:(e,t,n)=>{"use strict";n.d(t,{createAdapter:()=>a,doesStudyLikeAffectSave:()=>i});var o=n(26610),s=n(13896),r=n(2088);function a(e){if((0,o.isLineTool)(e))return{isPine:()=>!1,isStandardPine:()=>!1,canOverrideMinTick:()=>!1,resolvedSymbolInfoBySymbol:()=>{throw new TypeError("Only study is supported.")},symbolsResolved:()=>{throw new TypeError("Only study is supported.")},parentSources:()=>{throw new TypeError("Only study is supported.")},getAllChildren:()=>[],sourceId:()=>{throw new TypeError("Only study is supported.")},inputs:()=>({}),parentSourceForInput:()=>{throw new TypeError("Only study is supported.")}};if((0,r.isStudy)(e))return e;if("isInputsStudy"in e)return e;throw new TypeError("Unsupported source type.")}function i(e){ return(0,r.isStudy)(e)||!s.lineToolsDoNotAffectChartInvalidation}},45560:(e,t,n)=>{"use strict";n.d(t,{useDefinitionProperty:()=>r});var o=n(50959),s=n(71953);const r=e=>{const t="property"in e?e.property:void 0,n="defaultValue"in e?e.defaultValue:e.property.value(),[r,a]=(0,o.useState)(t?t.value():n);(0,o.useEffect)((()=>{if(t){const n={};return a(t.value()),t.subscribe(n,(t=>{const n=t.value();e.handler&&e.handler(n),a(n)})),()=>{t.unsubscribeAll(n)}}return()=>{}}),[t]);return[r,e=>{if(void 0!==t){const n=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});var o=n(50959),s=n(97754),r=n.n(s),a=n(58123);function i(e){return o.createElement("div",{className:r()(a.wrap,e.className)},e.children)}},53424:(e,t,n)=>{"use strict";n.d(t,{CheckableTitle:()=>c});var o=n(50959),s=n(15294),r=n(45560);function a(e){const{property:t,...n}=e,[a,i]=(0,r.useDefinitionProperty)({property:t}),l="mixed"===a;return o.createElement(s.Checkbox,{...n,name:"toggle-enabled",checked:l||a,indeterminate:l,onChange:function(){i("mixed"===a||!a)}})}var i=n(78260),l=n(36730);function c(e){const{property:t,disabled:n,title:s,className:r,name:c}=e,u=o.createElement("span",{className:l.title},s);return o.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});var o=n(50959),s=(n(86240),n(33066)),r=n(53424);n(50921),n(42707),n(70724);function a(e){const{id:t,offset:n,disabled:a,checked:i,title:l,children:c,solutionId:u,infoTooltip:d,dialogContent:p}=e;return o.createElement(s.PropertyTable.Row,null,o.createElement(s.PropertyTable.Cell,{placement:"first",verticalAlign:"adaptive",offset:n,"data-section-name":t,colSpan:Boolean(c)?void 0: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});var o=n(50959),s=n(33066),r=n(53424),a=n(97754),i=n(65032);function l(e){return o.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});const o=(0,n(9343).getLogger)("Platform.GUI.PropertyDefinitionTrace")},16697:(e,t,n)=>{"use strict";n.d(t,{ColorPicker:()=>z});var o=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);const b=4;function y(e){const{color:t,selected:r,onSelect:i,onSwatchRemove:l}=e,[c,y]=(0,o.useState)(!1),[C,x]=(0, g.useRovingTabindexElement)(null),_=Boolean(l)&&!d.CheckMobile.any();return o.createElement(o.Fragment,null,o.createElement("button",{ref:C,style:t?{color:t}:void 0,className:s(f.swatch,c&&f.hover,r&&f.selected,!t&&f.empty,String(t).toLowerCase()===m.white&&f.white),onClick:function(){i(t)},onContextMenu:_?w:void 0,tabIndex:x,"data-role":"swatch"}),_&&o.createElement(p.PopupMenu,{isOpened:c,onClose:w,position:function(){const e=(0,u.ensureNotNull)(C.current).getBoundingClientRect();return{x:e.left,y:e.top+e.height+b}},onClickOutside:w},o.createElement(h.PopupMenuItem,{className:f.contextItem,label:a.t(null,void 0,n(89984)),icon:v,onClick:function(){w(),(0,u.ensureDefined)(l)()},dontClosePopup:!0})));function w(){y(!c)}}const C=10;function x(e){const{colors:t,color:n,children:s,onSelect:r,onRemoveCustomColor:a}=e;if(!t)return null;const i=n?(0,c.parseRgb)(String(n)):void 0,u=(0,l.default)(t,C);return o.createElement("div",{className:f.swatches},u.map(((e,t)=>o.createElement("div",{className:f.row,"data-role":"row",key:t},e.map(((e,n)=>o.createElement(y,{key:String(e)+n,color:e,selected:i&&(0,c.areEqualRgb)(i,(0,c.parseRgb)(String(e))),onSelect:d,onSwatchRemove:a?()=>function(e,t){const n=e*C+t;a?.(n)}(t,n):void 0})))))),s);function d(e){r&&r(e)}}var _=n(54368),w=n(97737);function E(e){const t=`Invalid RGB color: ${e}`;if(null===e)throw new Error(t);const n=e.match(/^#?([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i);if(null===n)throw new Error(t);const[,o,s,r]=n;if(!o||!s||!r)throw new Error(t);const a=parseInt(o,16)/255,i=parseInt(s,16)/255,l=parseInt(r,16)/255,c=Math.max(a,i,l),u=Math.min(a,i,l);let d;const p=c,h=c-u,m=0===c?0:h/c;if(c===u)d=0;else{switch(c){case a:d=(i-l)/h+(i{this._container=e},this._handlePosition=e=>{const{hsv:{h:t},onChange:n}=this.props;if(!n)return;const o=(0,u.ensureNotNull)(this._container).getBoundingClientRect(),s=e.clientX-o.left,r=e.clientY-o.top;n({h:t,s:(0,N.clamp)(s/o.width,0,1),v:(0,N.clamp)(1-r/o.height,0,1)})},this._handleKeyDown=e=>{const{hsv:{h:t,s:n,v:o},onChange:s}=this.props,r=(0,T.hashFromEvent)(e);if(!s||!k.includes(r))return;if(37===r||39===r){return void s({h:t,s:(0,N.clamp)(37===r?n-P:n+P,0,1),v:o})}s({h:t,s:n,v:(0,N.clamp)(40===r?o-P:o+P,0,1)})},this._mouseDown=e=>{window.addEventListener("mouseup",this._mouseUp),window.addEventListener("mousemove",this._mouseMove)},this._mouseUp=e=>{window.removeEventListener("mousemove",this._mouseMove),window.removeEventListener("mouseup",this._mouseUp),this._handlePosition(e)},this._mouseMove=(0,S.default)(this._handlePosition,100),this._handleTouch=e=>{this._handlePosition(e.nativeEvent.touches[0])}}render(){const{className:e,hsv:{h:t,s:n,v:s}}=this.props,a=`hsl(${360*t}, 100%, 50%)`;return o.createElement("div",{tabIndex:0,className:r()(I.accessible,e), onKeyDown:this._handleKeyDown},o.createElement("div",{className:I.saturation,style:{backgroundColor:a},ref:this._refContainer,onMouseDown:this._mouseDown,onTouchStart:this._handleTouch,onTouchMove:this._handleTouch},o.createElement("div",{className:I.pointer,style:{left:100*n+"%",top:100*(1-s)+"%"}})))}}var B=n(61483);class M extends o.PureComponent{constructor(){super(...arguments),this._container=null,this._refContainer=e=>{this._container=e},this._handlePosition=e=>{const{hsv:{s:t,v:n},onChange:o}=this.props;if(!o)return;const s=(0,u.ensureNotNull)(this._container).getBoundingClientRect(),r=e.clientY-s.top;o({h:(0,N.clamp)(r/s.height,0,1),s:t,v:n})},this._handleKeyDown=e=>{const{hsv:{h:t,s:n,v:o},onChange:s}=this.props,r=(0,T.hashFromEvent)(e);if(!s||38!==r&&40!==r)return;s({h:(0,N.clamp)(38===r?t-.01:t+.01,0,1),s:n,v:o})},this._mouseDown=e=>{window.addEventListener("mouseup",this._mouseUp),window.addEventListener("mousemove",this._mouseMove)},this._mouseUp=e=>{window.removeEventListener("mousemove",this._mouseMove),window.removeEventListener("mouseup",this._mouseUp),this._handlePosition(e)},this._mouseMove=(0,S.default)(this._handlePosition,100),this._handleTouch=e=>{this._handlePosition(e.nativeEvent.touches[0])}}render(){const{className:e,hsv:{h:t}}=this.props;return o.createElement("div",{className:r()(B.hue,B.accessible,e),tabIndex:0,onKeyDown:this._handleKeyDown},o.createElement("div",{className:B.pointerContainer,ref:this._refContainer,onMouseDown:this._mouseDown,onTouchStart:this._handleTouch,onTouchMove:this._handleTouch},o.createElement("div",{className:B.pointer,style:{top:100*t+"%"}})))}}var O=n(55778);const R="#000000",L=a.t(null,{context:"Color Picker"},n(55517));class V extends o.PureComponent{constructor(e){super(e),this._inputRef=o.createRef(),this._handleHSV=e=>{const t=function(e){const{h:t,s:n,v:o}=e;let s,r,a;const i=Math.floor(6*t),l=6*t-i,c=o*(1-n),u=o*(1-l*n),d=o*(1-(1-l)*n);switch(i%6){case 0:s=o,r=d,a=c;break;case 1:s=u,r=o,a=c;break;case 2:s=c,r=o,a=d;break;case 3:s=c,r=u,a=o;break;case 4:s=d,r=c,a=o;break;case 5:s=o,r=c,a=u;break;default:s=0,r=0,a=0}return"#"+[255*s,255*r,255*a].map((e=>("0"+Math.round(e).toString(16)).replace(/.+?([a-f0-9]{2})$/i,"$1"))).join("")}(e)||R;this.setState({color:t,inputColor:F(t),hsv:e}),this.props.onSelect(t)},this._handleInput=e=>{const t=F(e.currentTarget.value);try{const e=E(t),n=`#${t}`;this.setState({color:n,inputColor:t,hsv:e}),this.props.onSelect(n)}catch(e){this.setState({inputColor:t})}},this._handleAddColor=()=>this.props.onAdd(this.state.color);const t=e.color||R;this.state={color:t,inputColor:F(t),hsv:E(t)}}componentDidMount(){d.CheckMobile.any()||this._inputRef.current?.focus()}render(){const{color:e,hsv:t,inputColor:n}=this.state;return o.createElement("div",{className:O.container},o.createElement("div",{className:O.form},o.createElement("div",{className:r()(O.swatch,String(e).toLowerCase()===m.white&&O.white),style:{backgroundColor:e}}),o.createElement("div",{className:O.inputWrap},o.createElement("span",{className:O.inputHash diff --git a/charting_library/bundles/6094.a6a9dab4a3149840bbeb.css b/charting_library/bundles/6094.a6a9dab4a3149840bbeb.css deleted file mode 100644 index d6c83367..00000000 --- a/charting_library/bundles/6094.a6a9dab4a3149840bbeb.css +++ /dev/null @@ -1 +0,0 @@ -[data-theme=light]{--_0-ovCf:#fff}[data-theme=dark]{--_0-ovCf:var(--color-cold-gray-850)}.tooltip-eSLcXvvL{background:var(--_0-ovCf);border-radius:8px;cursor:default;filter:drop-shadow(0 1px 4px rgba(0,0,0,.2));position:absolute;visibility:hidden;z-index:7}.tooltip-eSLcXvvL.show-eSLcXvvL{visibility:unset}html.theme-dark .tooltip-eSLcXvvL{filter:drop-shadow(0 1px 4px rgba(0,0,0,.4))}.tooltip-eSLcXvvL:after,.tooltip-eSLcXvvL:before{border:10px solid #0000;content:" ";height:0;margin-top:-10px;pointer-events:none;position:absolute;top:50%;width:0}.tooltip-eSLcXvvL:not(.right-eSLcXvvL):after{border-color:#0000;border-left-color:var(--_0-ovCf);border-left-width:13px;left:100%}.tooltip-eSLcXvvL.right-eSLcXvvL:before{border-color:#0000;border-right-color:var(--_0-ovCf);border-right-width:13px;right:100%}[data-theme=light]{--_0-dKNk:var(--color-cold-gray-900)}[data-theme=dark]{--_0-dKNk:var(--color-cold-gray-200)}.text-hF57_4zZ{color:var(--_0-dKNk);font-family:-apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif;font-feature-settings:"tnum" on,"lnum" on;font-size:14px;line-height:18px;max-width:244px;min-width:25px;padding:12px} \ No newline at end of file diff --git a/charting_library/bundles/6094.a6a9dab4a3149840bbeb.rtl.css b/charting_library/bundles/6094.a6a9dab4a3149840bbeb.rtl.css deleted file mode 100644 index 86e3e0aa..00000000 --- a/charting_library/bundles/6094.a6a9dab4a3149840bbeb.rtl.css +++ /dev/null @@ -1 +0,0 @@ -[data-theme=light]{--_0-ovCf:#fff}[data-theme=dark]{--_0-ovCf:var(--color-cold-gray-850)}.tooltip-eSLcXvvL{background:var(--_0-ovCf);border-radius:8px;cursor:default;filter:drop-shadow(0 1px 4px rgba(0,0,0,.2));position:absolute;visibility:hidden;z-index:7}.tooltip-eSLcXvvL.show-eSLcXvvL{visibility:unset}html.theme-dark .tooltip-eSLcXvvL{filter:drop-shadow(0 1px 4px rgba(0,0,0,.4))}.tooltip-eSLcXvvL:after,.tooltip-eSLcXvvL:before{border:10px solid #0000;content:" ";height:0;margin-top:-10px;pointer-events:none;position:absolute;top:50%;width:0}.tooltip-eSLcXvvL:not(.right-eSLcXvvL):after{border-color:#0000;border-right-color:var(--_0-ovCf);border-right-width:13px;right:100%}.tooltip-eSLcXvvL.right-eSLcXvvL:before{border-color:#0000;border-left-color:var(--_0-ovCf);border-left-width:13px;left:100%}[data-theme=light]{--_0-dKNk:var(--color-cold-gray-900)}[data-theme=dark]{--_0-dKNk:var(--color-cold-gray-200)}.text-hF57_4zZ{color:var(--_0-dKNk);font-family:-apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif;font-feature-settings:"tnum" on,"lnum" on;font-size:14px;line-height:18px;max-width:244px;min-width:25px;padding:12px} \ No newline at end of file diff --git a/charting_library/bundles/6094.bd5174488126d28070f4.css b/charting_library/bundles/6094.bd5174488126d28070f4.css new file mode 100644 index 00000000..885abe2d --- /dev/null +++ b/charting_library/bundles/6094.bd5174488126d28070f4.css @@ -0,0 +1 @@ +[data-theme=light]{--_0-ovCf:#fff}[data-theme=dark]{--_0-ovCf:var(--color-cold-gray-850)}.tooltip-eSLcXvvL{background:var(--tv-color-bar-mark-background-color,var(--_0-ovCf));border-radius:8px;cursor:default;filter:drop-shadow(0 1px 4px rgba(0,0,0,.2));position:absolute;visibility:hidden;z-index:7}.tooltip-eSLcXvvL.show-eSLcXvvL{visibility:unset}html.theme-dark .tooltip-eSLcXvvL{filter:drop-shadow(0 1px 4px rgba(0,0,0,.4))}.tooltip-eSLcXvvL:after,.tooltip-eSLcXvvL:before{border:10px solid #0000;content:" ";height:0;margin-top:-10px;pointer-events:none;position:absolute;top:50%;width:0}.tooltip-eSLcXvvL:not(.right-eSLcXvvL):after{border-color:#0000;border-left-color:var(--tv-color-bar-mark-background-color,var(--_0-ovCf));border-left-width:13px;left:100%}.tooltip-eSLcXvvL.right-eSLcXvvL:before{border-color:#0000;border-right-color:var(--tv-color-bar-mark-background-color,var(--_0-ovCf));border-right-width:13px;right:100%}[data-theme=light]{--_0-dKNk:var(--color-cold-gray-900)}[data-theme=dark]{--_0-dKNk:var(--color-cold-gray-200)}.text-hF57_4zZ{color:var(--_0-dKNk);font-family:-apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif;font-feature-settings:"tnum" on,"lnum" on;font-size:14px;line-height:18px;max-width:244px;min-width:25px;padding:12px} \ No newline at end of file diff --git a/charting_library/bundles/6094.bd5174488126d28070f4.rtl.css b/charting_library/bundles/6094.bd5174488126d28070f4.rtl.css new file mode 100644 index 00000000..c5677216 --- /dev/null +++ b/charting_library/bundles/6094.bd5174488126d28070f4.rtl.css @@ -0,0 +1 @@ +[data-theme=light]{--_0-ovCf:#fff}[data-theme=dark]{--_0-ovCf:var(--color-cold-gray-850)}.tooltip-eSLcXvvL{background:var(--tv-color-bar-mark-background-color,var(--_0-ovCf));border-radius:8px;cursor:default;filter:drop-shadow(0 1px 4px rgba(0,0,0,.2));position:absolute;visibility:hidden;z-index:7}.tooltip-eSLcXvvL.show-eSLcXvvL{visibility:unset}html.theme-dark .tooltip-eSLcXvvL{filter:drop-shadow(0 1px 4px rgba(0,0,0,.4))}.tooltip-eSLcXvvL:after,.tooltip-eSLcXvvL:before{border:10px solid #0000;content:" ";height:0;margin-top:-10px;pointer-events:none;position:absolute;top:50%;width:0}.tooltip-eSLcXvvL:not(.right-eSLcXvvL):after{border-color:#0000;border-right-color:var(--tv-color-bar-mark-background-color,var(--_0-ovCf));border-right-width:13px;right:100%}.tooltip-eSLcXvvL.right-eSLcXvvL:before{border-color:#0000;border-left-color:var(--tv-color-bar-mark-background-color,var(--_0-ovCf));border-left-width:13px;left:100%}[data-theme=light]{--_0-dKNk:var(--color-cold-gray-900)}[data-theme=dark]{--_0-dKNk:var(--color-cold-gray-200)}.text-hF57_4zZ{color:var(--_0-dKNk);font-family:-apple-system,BlinkMacSystemFont,Trebuchet MS,Roboto,Ubuntu,sans-serif;font-feature-settings:"tnum" on,"lnum" on;font-size:14px;line-height:18px;max-width:244px;min-width:25px;padding:12px} \ No newline at end of file diff --git a/charting_library/bundles/9026.75767d113c906e89c496.js b/charting_library/bundles/9026.75767d113c906e89c496.js new file mode 100644 index 00000000..8de32c87 --- /dev/null +++ b/charting_library/bundles/9026.75767d113c906e89c496.js @@ -0,0 +1,31 @@ +(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[9026],{66783:e=>{"use strict";var t=Object.prototype.hasOwnProperty;function r(e,t){return e===t?0!==e||0!==t||1/e==1/t:e!=e&&t!=t}e.exports=function(e,n){if(r(e,n))return!0;if("object"!=typeof e||null===e||"object"!=typeof n||null===n)return!1;var o=Object.keys(e),a=Object.keys(n);if(o.length!==a.length)return!1;for(var l=0;l{e.exports={pair:"pair-ocURKVwI",xxceptionallysmalldonotusebrv1023:"xxceptionallysmalldonotusebrv1023-ocURKVwI",xxxxsmall:"xxxxsmall-ocURKVwI",xxxsmall:"xxxsmall-ocURKVwI",xxsmall:"xxsmall-ocURKVwI",xsmall:"xsmall-ocURKVwI",small:"small-ocURKVwI",medium:"medium-ocURKVwI",large:"large-ocURKVwI",xlarge:"xlarge-ocURKVwI",xxlarge:"xxlarge-ocURKVwI",xxxlarge:"xxxlarge-ocURKVwI",logo:"logo-ocURKVwI",skeleton:"skeleton-ocURKVwI",empty:"empty-ocURKVwI"}},6916:e=>{e.exports={xxxsmall:"xxxsmall-napy2vLF",xxsmall:"xxsmall-napy2vLF",xsmall:"xsmall-napy2vLF",small:"small-napy2vLF",medium:"medium-napy2vLF",large:"large-napy2vLF",xlarge:"xlarge-napy2vLF",counter:"counter-napy2vLF","color-danger":"color-danger-napy2vLF","color-accent":"color-accent-napy2vLF","color-accent-light":"color-accent-light-napy2vLF","color-neutral-bold":"color-neutral-bold-napy2vLF","color-neutral":"color-neutral-napy2vLF","borderColor-primary":"borderColor-primary-napy2vLF","borderColor-secondary":"borderColor-secondary-napy2vLF","borderColor-tertiary":"borderColor-tertiary-napy2vLF",disabled:"disabled-napy2vLF"}},19954:e=>{e.exports={hidden:"hidden-DgcIT6Uz",fadeInWrapper:"fadeInWrapper-DgcIT6Uz",isAnimated:"isAnimated-DgcIT6Uz"}},53895:e=>{e.exports={disableSelfPositioning:"disableSelfPositioning-dYiqkKAE"}},37370:e=>{e.exports={container:"container-M1mz4quA",pairContainer:"pairContainer-M1mz4quA",logo:"logo-M1mz4quA",hidden:"hidden-M1mz4quA"}},23296:e=>{e.exports={container:"container-qm7Rg5MB",mobile:"mobile-qm7Rg5MB",inputContainer:"inputContainer-qm7Rg5MB",withCancel:"withCancel-qm7Rg5MB",input:"input-qm7Rg5MB",icon:"icon-qm7Rg5MB",cancel:"cancel-qm7Rg5MB"}},33313:e=>{e.exports={actions:"actions-rarsm4ka",actionButton:"actionButton-rarsm4ka"}},88183:e=>{e.exports={logo:"logo-d0vVmGvT"}},20255:e=>{e.exports={"tablet-small-breakpoint":"(max-width: 440px)",itemRow:"itemRow-oRSs8UQo",multiLine:"multiLine-oRSs8UQo",cell:"cell-oRSs8UQo",itemInfoCell:"itemInfoCell-oRSs8UQo",description:"description-oRSs8UQo",symbolDescription:"symbolDescription-oRSs8UQo",flag:"flag-oRSs8UQo",exchangeDescription:"exchangeDescription-oRSs8UQo",marketType:"marketType-oRSs8UQo",exchangeName:"exchangeName-oRSs8UQo",actionHandleWrap:"actionHandleWrap-oRSs8UQo",source:"source-oRSs8UQo",hover:"hover-oRSs8UQo",selected:"selected-oRSs8UQo",active:"active-oRSs8UQo",highlighted:"highlighted-oRSs8UQo",light:"light-oRSs8UQo","highlight-animation-theme-light":"highlight-animation-theme-light-oRSs8UQo",dark:"dark-oRSs8UQo","highlight-animation-theme-dark":"highlight-animation-theme-dark-oRSs8UQo", +markedFlag:"markedFlag-oRSs8UQo",offset:"offset-oRSs8UQo",descriptionCell:"descriptionCell-oRSs8UQo",addition:"addition-oRSs8UQo",exchangeCell:"exchangeCell-oRSs8UQo",fixedWidth:"fixedWidth-oRSs8UQo",expandHandle:"expandHandle-oRSs8UQo",expanded:"expanded-oRSs8UQo",symbolTitle:"symbolTitle-oRSs8UQo",invalid:"invalid-oRSs8UQo",noDescription:"noDescription-oRSs8UQo",highlightedText:"highlightedText-oRSs8UQo",icon:"icon-oRSs8UQo",narrow:"narrow-oRSs8UQo",wide:"wide-oRSs8UQo",dataMode:"dataMode-oRSs8UQo",actionsCell:"actionsCell-oRSs8UQo",action:"action-oRSs8UQo",targetAction:"targetAction-oRSs8UQo",removeAction:"removeAction-oRSs8UQo",addAction:"addAction-oRSs8UQo",markedFlagWrap:"markedFlagWrap-oRSs8UQo",markedFlagMobile:"markedFlagMobile-oRSs8UQo",logo:"logo-oRSs8UQo",isExpandable:"isExpandable-oRSs8UQo",primaryIcon:"primaryIcon-oRSs8UQo",promoBadge:"promoBadge-oRSs8UQo",promoIcon:"promoIcon-oRSs8UQo"}},85448:e=>{e.exports={icon:"icon-OJpk_CAQ"}},5779:e=>{e.exports={wrap:"wrap-IxKZEhmO",libAllSelected:"libAllSelected-IxKZEhmO",container:"container-IxKZEhmO",iconWrap:"iconWrap-IxKZEhmO",icon:"icon-IxKZEhmO",title:"title-IxKZEhmO",highlighted:"highlighted-IxKZEhmO",description:"description-IxKZEhmO",mobile:"mobile-IxKZEhmO",allSelected:"allSelected-IxKZEhmO",desktop:"desktop-IxKZEhmO",allSelectedIcon:"allSelectedIcon-IxKZEhmO",selected:"selected-IxKZEhmO",focused:"focused-IxKZEhmO",titleWithoutDesc:"titleWithoutDesc-IxKZEhmO",textBlock:"textBlock-IxKZEhmO",bordered:"bordered-IxKZEhmO"}},93900:e=>{e.exports={container:"container-dfKL9A7t",contentList:"contentList-dfKL9A7t",contentListDesktop:"contentListDesktop-dfKL9A7t",searchSourceItemsContainer:"searchSourceItemsContainer-dfKL9A7t",oneColumn:"oneColumn-dfKL9A7t",searchSourceItemsContainerDesktop:"searchSourceItemsContainerDesktop-dfKL9A7t",groupTitleDesktop:"groupTitleDesktop-dfKL9A7t",column:"column-dfKL9A7t",emptyText:"emptyText-dfKL9A7t",emptyIcon:"emptyIcon-dfKL9A7t",noResultsDesktop:"noResultsDesktop-dfKL9A7t"}},99605:e=>{e.exports={wrap:"wrap-gjrLBBL3",item:"item-gjrLBBL3",small:"small-gjrLBBL3",newStyles:"newStyles-gjrLBBL3",mobile:"mobile-gjrLBBL3",text:"text-gjrLBBL3",exchange:"exchange-gjrLBBL3",filterItem:"filterItem-gjrLBBL3",brokerWrap:"brokerWrap-gjrLBBL3"}},80903:e=>{e.exports={wrap:"wrap-dlewR1s1",watchlist:"watchlist-dlewR1s1",noFeed:"noFeed-dlewR1s1",newStyles:"newStyles-dlewR1s1",scrollContainer:"scrollContainer-dlewR1s1",listContainer:"listContainer-dlewR1s1",multiLineItemsContainer:"multiLineItemsContainer-dlewR1s1",withSpinner:"withSpinner-dlewR1s1",spinnerContainer:"spinnerContainer-dlewR1s1",largeSpinner:"largeSpinner-dlewR1s1"}},27864:e=>{e.exports={search:"search-ZXzPWcCf",upperCase:"upperCase-ZXzPWcCf",bubblesContainer:"bubblesContainer-ZXzPWcCf",mobile:"mobile-ZXzPWcCf",bubbles:"bubbles-ZXzPWcCf",withFilters:"withFilters-ZXzPWcCf",spinnerWrap:"spinnerWrap-ZXzPWcCf",emptyText:"emptyText-ZXzPWcCf",emptyIcon:"emptyIcon-ZXzPWcCf",noResultsDesktop:"noResultsDesktop-ZXzPWcCf",brokerButtonWrap:"brokerButtonWrap-ZXzPWcCf"}},57184:e=>{e.exports={ +flagWrap:"flagWrap-QKnxaZOG",icon:"icon-QKnxaZOG",caret:"caret-QKnxaZOG",title:"title-QKnxaZOG",button:"button-QKnxaZOG",withFlag:"withFlag-QKnxaZOG",buttonContent:"buttonContent-QKnxaZOG"}},88716:e=>{e.exports={dialog:"dialog-u2dP3kv1",tabletDialog:"tabletDialog-u2dP3kv1",desktopDialog:"desktopDialog-u2dP3kv1",backButton:"backButton-u2dP3kv1"}},34007:e=>{e.exports={childrenWrapper:"childrenWrapper-_RhDhmVQ",container:"container-_RhDhmVQ"}},68222:e=>{e.exports={highlighted:"highlighted-cwp8YRo6"}},27692:e=>{e.exports={linkItem:"linkItem-zMVwkifW"}},55840:e=>{e.exports={roundTabButton:"roundTabButton-JbssaNvk",disableFocusOutline:"disableFocusOutline-JbssaNvk",enableCursorPointer:"enableCursorPointer-JbssaNvk",large:"large-JbssaNvk",withStartIcon:"withStartIcon-JbssaNvk",iconOnly:"iconOnly-JbssaNvk",withEndIcon:"withEndIcon-JbssaNvk",startIconWrap:"startIconWrap-JbssaNvk",endIconWrap:"endIconWrap-JbssaNvk",small:"small-JbssaNvk",xsmall:"xsmall-JbssaNvk",primary:"primary-JbssaNvk",disabled:"disabled-JbssaNvk",selected:"selected-JbssaNvk",disableActiveStateStyles:"disableActiveStateStyles-JbssaNvk",ghost:"ghost-JbssaNvk",fake:"fake-JbssaNvk",caret:"caret-JbssaNvk",visuallyHidden:"visuallyHidden-JbssaNvk",content:"content-JbssaNvk"}},70408:e=>{e.exports={scrollWrap:"scrollWrap-vgCB17hK",overflowScroll:"overflowScroll-vgCB17hK",roundTabs:"roundTabs-vgCB17hK",center:"center-vgCB17hK",overflowWrap:"overflowWrap-vgCB17hK",start:"start-vgCB17hK"}},86186:e=>{e.exports={icon:"icon-WB2y0EnP",dropped:"dropped-WB2y0EnP"}},18429:(e,t,r)=>{"use strict";r.d(t,{SEPARATOR_PREFIX:()=>n,isSeparatorItem:()=>o});const n="###";function o(e){return e.startsWith(n)}},48199:(e,t,r)=>{"use strict";r.d(t,{BackButton:()=>L});var n,o=r(50959),a=r(64388),l=r(95694),s=r.n(l),c=r(49498),i=r.n(c),u=r(60176),d=r.n(u),m=r(35369),h=r.n(m),p=r(58478),g=r.n(p),f=r(73063),v=r.n(f),b=r(14127),y=r.n(b),S=r(18073),x=r.n(S),w=r(99243),k=r.n(w),C=r(42576),E=r.n(C);function I(e="large",t="1.2"){switch(e){case"large":return"1.2"===t?s():v();case"medium":return"1.2"===t?i():y();case"small":return"1.2"===t?d():x();case"xsmall":return"1.2"===t?h():k();case"xxsmall":return"1.2"===t?g():E();default:return i()}}!function(e){e.Thin="1.2",e.Medium="1.5"}(n||(n={}));const L=o.forwardRef(((e,t)=>{const{"aria-label":r,flipIconOnRtl:n,...l}=e;return o.createElement(a.NavButton,{...l,"aria-label":r,ref:t,icon:I(e.size,e.iconStrokeWidth),flipIconOnRtl:n})}))},86866:(e,t,r)=>{"use strict";r.d(t,{useIsNonFirstRender:()=>o});var n=r(50959);function o(){return!function(){const[e,t]=(0,n.useState)(!0);return(0,n.useEffect)((()=>{t(!1)}),[]),e}()}},125:(e,t,r)=>{"use strict";r.d(t,{useForceUpdate:()=>o});var n=r(50959);const o=()=>{const[,e]=(0,n.useReducer)((e=>e+1),0);return e}},3685:(e,t,r)=>{"use strict";function n(){return window.configurationData?.exchanges?.map((e=>({...e,country:"",providerId:"",flag:""})))??[]}r.d(t,{getExchanges:()=>n})},36279:(e,t,r)=>{"use strict";var n;r.d(t,{LogoSize:()=>n,getLogoUrlResolver:()=>l}),function(e){e[e.Medium=0]="Medium", +e[e.Large=1]="Large"}(n||(n={}));class o{getSymbolLogoUrl(e){return e}collectSymbolLogoUrls(e,t){return[]}getCountryFlagUrl(){return""}getCryptoLogoUrl(e){return e}getProviderLogoUrl(e){return e}getSourceLogoUrl(e){return e}getBlockchainContractLogoUrl(e){return e}}let a;function l(){return a||(a=new o),a}},69654:(e,t,r)=>{"use strict";r.d(t,{DialogSearch:()=>d});var n=r(50959),o=r(97754),a=r.n(o),l=r(11542),s=r(9745),c=r(6347),i=r(54313),u=r(23296);function d(e){const{children:t,isMobile:o,renderInput:d,onCancel:h,containerClassName:p,inputContainerClassName:g,iconClassName:f,cancelTitle:v=l.t(null,void 0,r(4543)),...b}=e;return n.createElement("div",{className:a()(u.container,o&&u.mobile,p)},n.createElement("div",{className:a()(u.inputContainer,o&&u.mobile,g,h&&u.withCancel)},d||n.createElement(m,{isMobile:o,...b})),t,n.createElement(s.Icon,{className:a()(u.icon,o&&u.mobile,f),icon:o?i:c}),h&&(!o||""!==b.value)&&n.createElement("div",{className:a()(u.cancel,o&&u.mobile),onClick:h},v))}function m(e){const{className:t,reference:r,isMobile:o,value:l,onChange:s,onFocus:c,onBlur:i,onKeyDown:d,onSelect:m,placeholder:h,activeDescendant:p,...g}=e;return n.createElement("input",{...g,ref:r,type:"text",className:a()(t,u.input,o&&u.mobile),autoComplete:"off",role:"searchbox","data-role":"search",placeholder:h,value:l,onChange:s,onFocus:c,onBlur:i,onSelect:m,onKeyDown:d,"aria-activedescendant":p})}},96967:(e,t,r)=>{"use strict";r.d(t,{SymbolSearchDialogContentItem:()=>F});var n=r(50959),o=r(97754),a=r.n(o),l=(r(11542),r(50151)),s=r(9745),c=r(37103),i=r(24637),u=r(97006),d=r(84524),m=r(24633),h=r(77975),p=r(45345),g=r(32563),f=r(91682),v=r(618),b=r(36279),y=r(59695),S=r(58492),x=r(39330),w=r(64971),k=r(43010),C=r(37370);function E(e){const{className:t,placeholderLetter:r,url1:o,url2:l,size:s="xxxsmall"}=e,c=(0,n.useRef)(null),i=(0,n.useRef)(null),u=(0,n.useRef)(null),d=(0,n.useRef)(null),m=(0,n.useRef)(null),h=(0,n.useRef)(null);return(0,k.useIsomorphicLayoutEffect)((()=>{const e=void 0===o?[]:void 0===l?[o]:[o,l],t=h.current=(r=e,Promise.all(r.map((e=>(0,w.getImage)(`symbol_logo_${e}`,e,L).then((e=>e.cloneNode()))))));var r;t.catch((()=>[])).then((e=>{if(t===h.current)switch(e.length){case 0:u.current?.classList.add(C.hidden),i.current?.classList.add(y.hiddenCircleLogoClass),c.current?.classList.remove(y.hiddenCircleLogoClass);break;case 1:I(i.current,e[0]),u.current?.classList.add(C.hidden),i.current?.classList.remove(y.hiddenCircleLogoClass),c.current?.classList.add(y.hiddenCircleLogoClass);break;case 2:I(d.current,e[0]),I(m.current,e[1]),u.current?.classList.remove(C.hidden),i.current?.classList.add(y.hiddenCircleLogoClass),c.current?.classList.add(y.hiddenCircleLogoClass)}}))}),[o,l]),n.createElement("span",{className:a()(t,C.container)},n.createElement("span",{ref:u,className:a()(C.pairContainer,C.hidden)},n.createElement("span",{className:(0,x.getBlockStyleClasses)(s)},n.createElement("span",{ref:m,className:a()(C.logo,(0,x.getLogoStyleClasses)(s))}),n.createElement("span",{ref:d,className:a()(C.logo,(0, +x.getLogoStyleClasses)(s))}))),n.createElement("span",{ref:i,className:a()(C.logo,y.hiddenCircleLogoClass,(0,S.getStyleClasses)(s))}),n.createElement("span",{ref:c,className:a()(C.logo,(0,S.getStyleClasses)(s))},n.createElement(y.CircleLogo,{size:s,placeholderLetter:r})))}function I(e,t){e&&(e.innerHTML="",e.appendChild(t))}function L(e){e.crossOrigin="",e.decoding="async"}var R=r(88183);function T(e){const{logoId:t,baseCurrencyLogoId:r,currencyLogoId:o,placeholder:l,className:s,size:c="xsmall"}=e,i=(0,n.useMemo)((()=>{const e={logoid:t,"currency-logoid":o,"base-currency-logoid":r};return(0,v.removeUsdFromCryptoPairLogos)((0,v.resolveLogoUrls)(e,b.LogoSize.Medium))}),[t,o,r]);return n.createElement(E,{key:c,className:a()(R.logo,s),url1:i[0],url2:i[1],placeholderLetter:l,size:c})}var N=r(29562),B=r(69533),M=r(20255);function F(e){const{dangerousTitleHTML:t,title:r,dangerousDescriptionHTML:o,description:v,searchToken:b,exchangeName:y,marketType:S,onClick:x,isSelected:w,isEod:k=!1,isActive:C=!1,isOffset:E=!1,invalid:I=!1,isHighlighted:L=!1,hideExchange:R=!1,hideMarkedListFlag:F=!1,onExpandClick:_,isExpanded:A,hoverComponent:D,country:P,providerId:O,sourceLogoId:U,source:Q,source2:V,type:W,flag:z,itemRef:K,onMouseOut:H,onMouseOver:Z,className:q,actions:$,reference:G,fullSymbolName:j,logoId:J,currencyLogoId:X,baseCurrencyLogoId:Y,shortName:ee,hideLogo:te=!1,exchangeTooltip:re,hideMarketType:ne,isPrimary:oe,isPromo:ae}=e,{isSmallWidth:le,isMobile:se}=(0,l.ensureNotNull)((0,n.useContext)(d.SymbolSearchItemsDialogContext)),ce=Boolean(D),ie=!I&&!R&&(se||!ce),ue=(0,h.useWatchedValueReadonly)({watchedValue:p.watchedTheme})===m.StdTheme.Dark?M.dark:M.light,de=D,me=c.enabled("show_symbol_logos"),he=c.enabled("show_exchange_logos"),pe=me||!1,ge=V?.description??Q,fe=V?.name??Q;return n.createElement("div",{className:a()(M.itemRow,le&&M.multiLine,L&&M.highlighted,L&&ue,w&&M.selected,C&&M.active,I&&M.invalid,!se&&g.mobiletouch&&ce&&M.hover,q),onClick:function(e){if(!x||e.defaultPrevented)return;e.preventDefault(),x(e)},"data-role":e["data-role"]||"list-item","data-active":C,"data-type":S,"data-name":"symbol-search-dialog-content-item",onMouseOut:H,onMouseOver:Z,ref:G},n.createElement("div",{ref:K,className:a()(M.itemInfoCell,M.cell,E&&M.offset)},n.createElement("div",{className:a()(M.actionHandleWrap,!pe&&M.fixedWidth)},n.createElement(n.Fragment,null,!1,_&&n.createElement("div",{onClick:function(e){if(!_||e.defaultPrevented)return;e.preventDefault(),_(e)}},n.createElement(s.Icon,{className:a()(M.expandHandle,A&&M.expanded,w&&M.selected),icon:B})),pe&&!E&&n.createElement("div",{className:a()(M.logo,Boolean(_)&&M.isExpandable)},n.createElement(T,{key:j,logoId:J,currencyLogoId:X,baseCurrencyLogoId:Y,placeholder:ee?ee[0]:void 0})))),n.createElement("div",{className:a()(M.description,pe&&E&&M.offset)},r&&n.createElement("div",{className:a()(M.symbolTitle,C&&M.active,I&&M.invalid,!Boolean(o)&&M.noDescription,!g.mobiletouch&&"apply-overflow-tooltip"),"data-overflow-tooltip-text":r,"data-name":"list-item-title" +},"string"==typeof r&&b?n.createElement(i.HighlightedText,{className:M.highlightedText,text:r,queryString:b,rules:(0,u.createRegExpList)(b)}):r,k&&n.createElement("span",{className:M.dataMode},"E")),!r&&t&&n.createElement("div",{className:a()(M.symbolTitle,C&&M.active,I&&M.invalid,!g.mobiletouch&&"apply-overflow-tooltip"),"data-name":"list-item-title","data-overflow-tooltip-text":(0,f.removeTags)(t)},n.createElement("span",{dangerouslySetInnerHTML:{__html:t}}),k&&n.createElement("span",{className:M.dataMode},"E")),le&&ve())),!le&&n.createElement("div",{className:a()(M.cell,M.descriptionCell,Boolean(de)&&M.addition)},ve(),de?n.createElement(de,{...e,className:M.actions,onMouseOver:void 0,onMouseOut:void 0}):null),le&&de?n.createElement(de,{...e,className:M.cell,onMouseOver:void 0,onMouseOut:void 0}):null,ie&&n.createElement("div",{className:a()(M.exchangeCell,M.cell)},n.createElement("div",{className:a()(M.exchangeDescription)},!1,!ne&&n.createElement("div",{className:a()(M.marketType,C&&M.active)},S),n.createElement("div",{className:M.source},!1,!1,"economic"===W&&ge&&fe?n.createElement("div",{className:a()(M.exchangeName,C&&M.active,"apply-common-tooltip",M.narrow,ne&&M.wide),title:ge},fe):n.createElement("div",{className:a()(M.exchangeName,C&&M.active,re&&"apply-common-tooltip"),title:re},y))),he&&n.createElement("div",{className:M.flag},n.createElement(N.SymbolSearchFlag,{key:he?`${j}_exchange`:`${P}_${O}_${V?.id}_${W}_${z}`,className:M.icon,country:P,providerId:O,sourceLogoId:U??void 0}))),n.createElement("div",{className:a()(M.cell,Boolean($)&&M.actionsCell)},$));function ve(){if(I)return null;const e=a()(M.symbolDescription,C&&M.active,!g.mobiletouch&&"apply-overflow-tooltip apply-overflow-tooltip--allow-text");return v?n.createElement("div",{className:e},b?n.createElement(i.HighlightedText,{className:M.highlightedText,text:v,queryString:b,rules:(0,u.createRegExpList)(b)}):v):o?n.createElement("div",{"data-overflow-tooltip-text":(0,f.removeTags)(o),className:e,dangerouslySetInnerHTML:{__html:o}}):null}}},29562:(e,t,r)=>{"use strict";r.d(t,{SymbolSearchFlag:()=>f});var n=r(50959),o=r(97754),a=r.n(o),l=r(24633),s=r(36279);const c=r.p+"mock-dark.16b5f3a431f502b03ae3.svg",i=r.p+"mock-light.d201313017eb2c1b989f.svg";function u(e){return e===l.StdTheme.Dark?c:i}var d=r(77975),m=r(45345),h=r(50151);const p=s.LogoSize.Medium;var g=r(85448);function f(e){const{country:t,tooltip:r,providerId:o,sourceId:l,sourceLogoId:c,className:i}=e,f=(0,d.useWatchedValueReadonly)({watchedValue:m.watchedTheme}),[v,b]=(0,n.useState)(function({country:e,providerId:t,sourceId:r,sourceLogoId:n}){const o=(0,s.getLogoUrlResolver)();return a=>{const l=e=>o.getProviderLogoUrl(e,p),s=[{value:n,resolve:e=>o.getSymbolLogoUrl(e,p)},{value:r,resolve:l},{value:e,resolve:e=>o.getCountryFlagUrl(e.toUpperCase(),p)},{value:t,resolve:l}].find((({value:e})=>void 0!==e&&e.length>0));return void 0!==s?s.resolve((0,h.ensureDefined)(s.value)):u(a)}}({country:t,providerId:o,sourceId:l,sourceLogoId:c})(f));return n.createElement("img",{ +className:a()(i,"apply-common-tooltip",g.icon),crossOrigin:"","data-tooltip":r,src:v,onError:function(){b(u(f))}})}},58442:(e,t,r)=>{"use strict";r.d(t,{QualifiedSources:()=>n,qualifyProName:()=>l});var n,o=r(50151),a=r(37103);r(81319);function l(e){return e}!function(e){function t(e){return e.pro_name}function r(e){{const t=a.enabled("pay_attention_to_ticker_not_symbol")?e.ticker:e.name;return(0,o.ensureDefined)(t)}}e.fromQuotesSnapshot=function(e){return"error"===e.status?e.symbolname:e.values.pro_name},e.fromQuotesResponse=function(e){const{values:r,symbolname:n,status:o}=e;return"error"===o&&n?n:t(r)},e.fromQuotes=t,e.fromSymbolSearchResult=function(e,t){{const{ticker:r,symbol:n}=t??e;return a.enabled("pay_attention_to_ticker_not_symbol")?(0,o.ensureDefined)(r??n):(0,o.ensureDefined)(n)}},e.fromSymbolInfo=r,e.fromSymbolMessage=function(e,t){return"symbol_resolved"===t.method?r(t.params[1]):e}}(n||(n={}))},20882:(e,t,r)=>{"use strict";r.d(t,{createSearchSources:()=>s,filterSearchSources:()=>a,isAllSearchSourcesSelected:()=>o,splitSearchSourcesByGroup:()=>l});const n=[];function o(e){return""===e.value()}function a(e,t){return e.filter((e=>e.includes(t)))}function l(e){const t=new Map;e.forEach((e=>{t.has(e.group())?t.get(e.group()).push(e):t.set(e.group(),[e])}));for(const e of t.values()){e[0].group()!==ExchangeGroup.NorthAmerica&&e.sort(((e,t)=>e.name().toLowerCase()>t.name().toLowerCase()?1:-1))}return new Map([...t.entries()].sort((([e],[t])=>n.indexOf(e)-n.indexOf(t))))}function s(e,t){return t.map((t=>new e(t)))}},70613:(e,t,r)=>{"use strict";r.d(t,{SymbolSearchDialogBodyContext:()=>n});const n=r(50959).createContext(null)},84524:(e,t,r)=>{"use strict";r.d(t,{SymbolSearchItemsDialogContext:()=>n});const n=r(50959).createContext(null)},59071:(e,t,r)=>{"use strict";r.d(t,{SymbolSearchItemsDialog:()=>Xt});var n,o,a,l,s=r(50959),c=r(97754),i=r.n(c),u=r(11542),d=r(37103),m=r(44254),h=r(81319);function p(e){const t=function(e){let t,r=0,n=0;for(let o=0;o"symbol"===t.type&&m.symbolTokenEscapeRe.test(t.value)?e+`'${t.value}'`:e+t.value),"")}function f(e){const t=function(e){const t=(0,m.tokenize)(e),r=[];return t.forEach((e=>{if("symbol"!==e.type)return;const[t]=(0,m.parseToken)(e);t&&r.push(t)})),r}(e);if(1===t.length)return t[0]}function v(e,t,r){const n=e.value,[o,a]=b(e,r),l=(0,h.getSymbolFullName)(t),s=m.symbolTokenEscapeRe.test(l)?`'${l}'`:l;return[n.substring(0,a)+s+n.substring(a+o.length),a+s.length]}function b(e,t){const{value:r,selectionStart:n}=e,o=(0,m.tokenize)(t?r.toUpperCase():r),a=(0, +m.getTokenAtPos)(o,n||0);return[a?.value||"",a?a.offset:r.length,o]}!function(e){e.Init="init",e.Var="var",e.Operator="operator"}(n||(n={})),function(e){e[e.Init=0]="Init",e[e.Div=1]="Div",e[e.Expression=2]="Expression",e[e.BracedExpression=3]="BracedExpression"}(o||(o={})),function(e){e.Stocks="stocks",e.Futures="futures",e.Funds="funds",e.Forex="forex",e.Crypto="bitcoin,crypto",e.Index="index",e.Bond="bond",e.Economic="economic",e.Options="options"}(a||(a={})),function(e){e.EconomicCountrySelect="economic-country-select",e.EconomicSourceSelect="economic-source-select",e.EconomicCategorySelect="economic-category-select",e.StocksCountrySelect="stocks-country-select",e.StockTypeSelect="stock-type-select",e.StockSectorSelect="stock-sector-select",e.FuturesCountrySelect="futures-country-select",e.FuturesCategorySelect="futures-category-select",e.FundsCountrySelect="funds-country-select",e.FundsTypeSelect="funds-type-select",e.CryptoExchangeSelect="crypto-exchange-select",e.CryptoTypeSelect="crypto-type-select",e.CryptoExchangeTypeSelect="crypto-exchange-type-select",e.ForexExchangeSelect="forex-exchange-select",e.IndexExchangeSelect="index-exchange-select",e.BondCountrySelect="bond-country-select",e.BondTypeSelect="bond-type-select"}(l||(l={}));const y=["futures","forex","bond","economic","options"];var S=r(84877),x=r(73986),w=r(79418),k=r(9745),C=r(86240),E=r(86781),I=r(84524),L=r(69654),R=r(3343),T=r(22692);function N(e,t,r){return`source-item-${e}-${t}-${r}`}var B=r(20882),M=r(34007);function F(e){const{children:t,className:r}=e;return s.createElement("div",{className:i()(M.container,r)},s.createElement("div",{className:M.childrenWrapper},t))}var _=r(50151),A=r(78036),D=r(24637),P=r(97006),O=r(91540),U=r(5779);function Q(e){const{searchSource:t,onClick:r,queryString:n,isFocused:o,id:a}=e,{symbolSearchContent:l,isAllSearchSourcesSelected:c,allSearchSourcesTitle:u,isMobile:d}=(0,A.useEnsuredContext)(I.SymbolSearchItemsDialogContext),m=l.currentSelectedSearchSource,p=(0,_.ensureNotNull)(m).value(),g=c(t),f=t.value()===p,v=(0,s.useMemo)((()=>(0,P.createRegExpList)(n)),[n]),b=t.description(),y=b&&!g,S=h.isSeparateSymbolSearchTabs&&g&&u?u:t.name(),x=i()(U.container,d?U.mobile:U.desktop,f&&U.selected,o&&U.focused,g&&U.allSelected,g&&U.libAllSelected,!g&&d&&U.bordered);return s.createElement("div",{className:i()(!d&&U.wrap,g&&U.libAllSelected),onClick:r,id:a},s.createElement("div",{className:x},s.createElement("div",{className:U.iconWrap},!!g&&s.createElement(k.Icon,{className:i()(U.icon,U.allSelectedIcon),icon:O})),s.createElement("div",{className:U.textBlock},s.createElement("div",{className:i()(U.title,!y&&!d&&U.titleWithoutDesc)},s.createElement(D.HighlightedText,{className:i()(f&&U.highlighted),queryString:n,text:S,rules:v})),y&&s.createElement("div",{className:i()(U.description,"apply-overflow-tooltip")},s.createElement(D.HighlightedText,{className:U.highlighted,queryString:n,rules:v,text:b})))))}var V=r(77975),W=r(45345),z=r(24633),K=r(70613),H=r(66619),Z=r(67562),q=r(93900);const $={emptyTextClassName:q.emptyText} +;function G(e){const{searchSources:t}=e,{setSelectedIndex:n,setSelectedSearchSource:o,setMode:a,isMobile:l,emptyState:c,autofocus:d}=(0,A.useEnsuredContext)(I.SymbolSearchItemsDialogContext),m=(0,V.useWatchedValueReadonly)({watchedValue:W.watchedTheme})===z.StdTheme.Dark?H:Z,p=(0,E.useMatchMedia)(C["media-phone-vertical"]),[g,f]=(0,s.useState)(""),v=(0,s.useMemo)((()=>[{group:null,sources:(0,h.createGroupColumns)((0,B.filterSearchSources)(t,g),p?1:2)}]),[t,g,p]),b=((0,s.useMemo)((()=>({})),[]),(0,s.useRef)(null)),y=(0,s.useRef)(null),{focusedItem:S,activeDescendant:x,handleKeyDown:w,resetFocusedItem:M}=function(e,t,r){const[n,o]=(0,s.useState)(null),[a,l]=(0,s.useState)("");function c(t){const r=e[t.groupIndex].sources[t.col].length-1;if(t.row===r){const e=d(t.groupIndex+1);if(null===e)return;return t.col>0&&!u({...t,groupIndex:e,row:0})?void o({groupIndex:e,col:0,row:0}):void o({...t,groupIndex:e,row:0})}o({...t,row:t.row+1})}function i(t){if(0===t.row){const r=d(t.groupIndex-1,-1);if(null===r)return;const n=e[r].sources[t.col]?.length??0;return 0===n?void o({groupIndex:r,col:0,row:0}):void o({...t,groupIndex:r,row:n-1})}o({...t,row:t.row-1})}function u(t){return Boolean(e[t.groupIndex]?.sources[t.col]?.[t.row])}function d(t=0,r=1){const n=e.length;let o=(t+n)%n;for(;!u({groupIndex:o,col:0,row:0});)if(o=(o+r+n)%n,o===t)return null;return o}return(0,s.useEffect)((()=>{if(!r.current)return;if(!n)return void l("");const e=N(n.groupIndex,n.col,n.row),t=r.current.querySelector(`#${e}`);t?.scrollIntoView({block:"nearest"}),l(e)}),[n]),(0,s.useEffect)((()=>{o(null)}),[t]),{focusedItem:n,activeDescendant:a,handleKeyDown:function(a){if(!r.current)return;const l=(0,R.hashFromEvent)(a);if(32!==l&&13!==l)switch((0,T.mapKeyCodeToDirection)(l)){case"blockNext":if(a.preventDefault(),!n){const e=d();if(null===e)break;o({groupIndex:e,col:0,row:0});break}c(n);break;case"blockPrev":if(a.preventDefault(),!n)break;i(n);break;case"inlineNext":{if(!n||t)break;a.preventDefault();const r=e[n.groupIndex].sources.length;if(n.col===r-1||!u({...n,col:n.col+1})){c({...n,col:0});break}o({...n,col:n.col+1});break}case"inlinePrev":{if(!n||t)break;a.preventDefault();const r=e[n.groupIndex].sources.length;if(0===n.col){if(0!==n.row){i({...n,col:r-1});break}const t=d(n.groupIndex-1,-1);if(null===t)break;const a=e[t].sources.length,l=e[t].sources[0].length;if(!u({groupIndex:t,col:a-1,row:l-1})){i(n);break}o({groupIndex:t,col:a-1,row:l-1});break}o({...n,col:n.col-1});break}}else{if(!n)return;a.preventDefault();const e=r.current.querySelector(`#${N(n.groupIndex,n.col,n.row)}`);e instanceof HTMLElement&&e.click()}},resetFocusedItem:()=>o(null)}}(v,p,y);(0,s.useLayoutEffect)((()=>{d&&b?.current?.focus()}),[]);const _=c?s.createElement(c,null):s.createElement(F,{className:q.noResultsDesktop},s.createElement(k.Icon,{icon:m,className:q.emptyIcon}),s.createElement("div",{className:q.emptyText},u.t(null,void 0,r(53182)))),D=!(v.length&&v.every((e=>0===e.sources.length)));return s.createElement(K.SymbolSearchDialogBodyContext.Provider,{value:$ +},s.createElement(L.DialogSearch,{placeholder:u.t(null,void 0,r(8573)),onChange:function(e){M(),f(e.target.value),y&&y.current&&(y.current.scrollTop=0)},reference:b,onKeyDown:w,onBlur:M,"aria-activedescendant":x}),D?s.createElement("div",{ref:y,className:i()(q.contentList,!l&&q.contentListDesktop),onTouchStart:function(){b.current?.blur()}},v.map(((e,t)=>{const{group:r,sources:n}=e;return 0===n.length?s.createElement(s.Fragment,{key:r}):s.createElement(s.Fragment,{key:r},!1,s.createElement("div",{className:i()(q.searchSourceItemsContainer,!l&&q.searchSourceItemsContainerDesktop,p&&q.oneColumn)},n.map(((e,r)=>s.createElement("div",{key:`${t}-${r}`,className:q.column},e.map(((e,n)=>s.createElement(Q,{id:N(t,r,n),isFocused:!!S&&(S.groupIndex===t&&S.col===r&&S.row===n),key:e.value(),searchSource:e,queryString:g,onClick:P.bind(null,e)}))))))))}))):_);function P(e){o(e),a("symbolSearch"),n(-1)}}var j,J,X,Y,ee=r(32227),te=r(95406),re=r(52959);r(32925);function ne(e){return e.hasOwnProperty("exchange")}async function oe(e){return new Promise((t=>{(0,re.getChartingLibraryGlobalContext)().ChartApiInstance.searchSymbolsPaginated({userInput:e.text??"",exchange:e.exchange??"",symbolType:e.type??"",searchSource:e.searchInitiationPoint??"symbolSearch",start:e.start},((e,r)=>{t({symbols:e,symbols_remaining:r})}))}))}!function(e){e.SourceId="source_id",e.EconomicCategory="economic_category",e.SearchType="search_type",e.Sector="sector",e.Product="product",e.Centralization="centralization",e.OnlyHasOptions="only_has_options"}(j||(j={})),function(e){e.SymbolSearch="symbolSearch",e.Watchlist="watchlist",e.Compare="compare",e.IndicatorInputs="indicatorInputs"}(J||(J={})),function(e){e[e.Prod=0]="Prod",e[e.Local=1]="Local"}(X||(X={})),function(e){e[e.Paginated=0]="Paginated",e[e.NoLimit=1]="NoLimit"}(Y||(Y={}));new Map([].map((({value:e,search_type:t})=>[e,t])));var ae=r(78136),le=r(51768),se=r(68335),ce=r(46003),ie=r(486),ue=r(81574),de=r(35119),me=r(32617),he=r(69135),pe=r(63861),ge=r(33313);function fe(e){const{state:t,update:r}=e,{searchRef:n,forceUpdate:o,upperCaseEnabled:a}=(0,_.ensureNotNull)((0,s.useContext)(I.SymbolSearchItemsDialogContext)),l=(0,m.tokenize)(n.current?.value),c=function(e){const t={braceBalance:0,currentState:"var",warnings:[],errors:[]};if(!d.enabled("show_spread_operators"))return t;let r="init";const n=[];for(let o=0;o{!n.current||c.errors.length||c.warnings.length||(n.current.value=g(p(l)),o())}}])),s.createElement("div",{className:ge.actions},i.map((e=>s.createElement(ce.ToolWidgetButton,{className:ge.actionButton,icon:e.icon,key:e.name,isDisabled:ve(e,c),onClick:()=>function(e){if(!ve(e,c)){if(e.insert&&n.current){const l=n.current.value+e.insert;n.current.value=l,n.current.setSelectionRange(l.length,l.length);const[s,,c]=b(n.current,a);t.current&&(t.current.selectedIndexValue=-1,t.current.searchSpreadsValue=(0,m.isSpread)(c),t.current.searchTokenValue=s),o(),r()}e.callback&&e.callback(),n.current?.focus(),(0,le.trackEvent)("GUI","SS",e.name)}}(e)}))))}function ve(e,t){let r=!1;if(!t.errors.length)switch(e.type){case"binaryOp":r="var"===t.currentState;break;case"openBrace":r="var"!==t.currentState;break;case"closeBrace":r="var"===t.currentState&&t.braceBalance>0;break;case"complete":r=!t.errors.length&&!t.warnings.length}return!r}var be=r(63932),ye=r(84952),Se=r(29006),xe=r(14543),we=r(10381),ke=r(52019),Ce=r(57184);const Ee=(0,h.getDefaultSearchSource)();function Ie(e){const{mode:t,setMode:n,searchRef:o,cachedInputValue:a,setSelectedIndex:l,setSelectedSearchSource:c,isAllSearchSourcesSelected:d,allSearchSourcesTitle:m,upperCaseEnabled:p,symbolSearchContent:g}=(0,A.useEnsuredContext)(I.SymbolSearchItemsDialogContext),f=g.currentSelectedSearchSource,v=(0,_.ensureNotNull)(f),b="symbolSearch"===t,y=d(v),S=h.isSeparateSymbolSearchTabs&&y&&m?m:v.name(),x=(0,s.useCallback)((()=>{if(h.isSeparateSymbolSearchTabs&&!y&&Ee)return c(Ee),l(-1),void o.current?.focus();o.current&&(a.current=p?o.current.value.toUpperCase():o.current.value),n("exchange")}),[y,o,p,n,c]);return h.isSeparateSymbolSearchTabs?b?s.createElement(xe.LightButton,{onClick:x,isPills:!y,size:"xsmall",variant:y?"ghost":"quiet-primary",showCaret:y,endSlot:y?void 0:s.createElement(k.Icon,{icon:ke}),enableActiveStateStyles:!1,className:i()(Ce.button,!y&&Ce.withFlag), +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,void 0,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}var Le=r(99605);function Re(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;return h.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)throw new Error("There must be default filter value in filter definition");const u=r.find((e=>e.value===o[m.currentSymbolType]?.[t]))||i;return s.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,void 0,r(74007)):u.t(null,void 0,r(95481)))),s.createElement("div",{className:Le.item},!n&&s.createElement("div",{className:Le.text},u.t(null,void 0,r(78734))),m.canChangeExchange&&s.createElement("div",{className:Le.exchange},s.createElement(Ie,null))))}var Te=r(24640),Ne=r(50279),Be=r(39416);var Me=r(80903);function Fe(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;return s.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=[]){const n=(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);const i=(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=new IntersectionObserver(((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=>{const t=e.pop();void 0!==t&&t.isIntersecting&&m&&m()}),{threshold:0,rootMargin:"0px 0px 20px 0px",root:o});return s.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);var Pe=r(95854),Oe=r(36966),Ue=r(7953),Qe=r(38528),Ve=r(66686);r(19954);const We=s.createContext({children:{},setIsReady:()=>{}});var ze=r(86866),Ke=r(67842);var He,Ze,qe,$e=r(6916),Ge=r.n($e);function je(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;let g;g=!("xxsmall"===o||"xxxsmall"===o)&&r?n&&r>=100?"99+":l&&r>0?`+${r}`:r:"";const f=i()(t,Ge().counter,Ge()[o],Ge()[`color-${a}`],"none"!==c&&Ge()[`borderColor-${c}`],m&&Ge().disabled);return s.createElement("span",{...p,className:f,"aria-label":u,"aria-hidden":d},g)}function Je({count:e,color:t="danger",size:r="xsmall",disabled:n}){return s.createElement(je,{"aria-label":"Tab counter",count:e,size:r,color:t,borderColor:"primary",disabled:n})}function Xe(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){return e.map((e=>{const n=e.counter;return n?{...e,endUpperSlot:Je({count:n.count,color:n.color,size:r,disabled:t}),counter:void 0}:e}))}(o,c,f)),[o,c,f]),w=(0,De.useMobileTouchState)(),k=function(e){const t=(0,E.useSafeMatchMedia)(C["media-mf-phone-landscape"],!0),r=(0,De.useMobileTouchState)();return e??(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)());return t[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, +Pe.useCollapsible)(x,L,u),P=function(e){const t=(0,s.useRef)(null);return(0,s.useEffect)((()=>{t.current=e}),[e]),t.current}(D.current?.containerWidth)??0,O=(0,ze.useIsNonFirstRender)(),U=D.current?.containerWidth??0;let Q=!1;D.current&&O&&(Q=function(e,t,r,n,o){if("collapse"!==n)return!0;const a=function(e,t,r){const n=e.filter((e=>t.find((t=>t.id===e[0]))));return t.length>0?n[0][1]+r:0}(Array.from(e.widthsMap.entries()),t,o),l=e.moreButtonWidth??0;let s=function(e,t){return e.reduce(((e,r)=>e+(t.get(r.id)??0)),0)}(r,e.widthsMap);return s+=t.length>0?l:0,function(e,t,r,n){return 0!==e?t-rn:r{requestAnimationFrame((()=>{O&&Q&&e.contentRect.width===P&&T()}))})),W="collapse"===k?N:x,z=(0,s.useMemo)((()=>"collapse"===k?B:[]),[k,B]),K=(0,s.useCallback)((e=>z.includes(e)),[z]),{isOpened:H,open:Z,close:q,onButtonClick:$}=(0,Ue.useDisclosure)({id:n,disabled:c}),{tabsBindings:G,tablistBinding:j,scrollWrapBinding:J,onActivate:X,onHighlight:Y,isHighlighted:ee}=(0,Oe.useTabs)({id:n,items:[...W,...z],activationType:a,orientation:l,disabled:c,tablistLabelId:h,tablistLabel:p,preventDefaultIfKeyboardActionHandled:g,scrollIntoViewOptions:r.scrollIntoViewOptions,onActivate:i,isActive:u,isCollapsed:K,isRtl:r.isRtl,isDisclosureOpened:H,isRadioGroup:r.isRadioGroup,stopPropagationIfKeyboardActionHandled:v,keyboardNavigationLoop:b,defaultKeyboardFocus:y,focusableItemAttributes:S}),te=z.find(ee),re=(0,s.useCallback)((()=>{const e=x.find(u);e&&Y(e)}),[Y,u,x]),ne=(0,s.useCallback)((()=>{q(),re(),I.current=!0}),[q,re]),oe=(0,s.useCallback)((()=>{te&&(X(te),Y(te,250))}),[X,Y,te]);J.ref=(0,Qe.useMergedRefs)([V,J.ref,M]),j.ref=(0,Qe.useMergedRefs)([j.ref,F]),j.onKeyDown=(0,Ae.createSafeMulticastEventHandler)((0,Ve.useKeyboardEventHandler)([(0,Ve.useKeyboardClose)(H,ne),(0,Ve.useKeyboardActionHandler)([13,32],oe,(0,s.useCallback)((()=>Boolean(te)),[te]))],g),j.onKeyDown);const ae=(0,s.useCallback)((e=>{I.current=!0,$(e)}),[I,$]),le=(0,s.useCallback)((e=>{e&&X(e)}),[X]);return(0,s.useEffect)((()=>{I.current?I.current=!1:te&&!H?Z():!te&&H&&q()}),[te,H,Z,q]),{enableActiveStateStyles:R,moreButtonRef:_,setItemRef:A,getBindings:e=>G.find((t=>t.id===e.id)),handleMoreButtonClick:ae,handleCollapsedItemClick:le,scrollWrapBinding:J,overflowBehaviour:k,tablistBinding:j,visibleTabs:W,hiddenTabs:z,handleActivate:X,isMobileTouch:w,getItemId:L,isDisclosureOpened:H,isHighlighted:ee,closeDisclosure:q}}!function(e){e.XXXSmall="xxxsmall",e.XXSmall="xxsmall",e.XSmall="xsmall",e.Small="small",e.Medium="medium",e.Large="large",e.XLarge="xlarge"}(He||(He={})),function(e){e.Danger="danger",e.Accent="accent",e.AccentLight="accent-light",e.NeutralBold="neutral-bold",e.Neutral="neutral"}(Ze||(Ze={})),function(e){e.Primary="primary",e.Secondary="secondary",e.Tertiary="tertiary",e.None="none"}(qe||(qe={}));var Ye=r(8304),et=r(53017),tt=r(17946),rt=r(2948),nt=r(55840);const ot="xsmall",at="primary";function lt(e){const t=(0, +s.useContext)(tt.CustomBehaviourContext),{size:r="xsmall",variant:n="primary",active:o,fake:a,startIcon:l,endIcon:i,showCaret:u,iconOnly:d,anchor:m,enableActiveStateStyles:h=t.enableActiveStateStyles,disableFocusOutline:p=!1,tooltip:g,disabled:f}=e;return c(nt.roundTabButton,nt[r],nt[n],l&&nt.withStartIcon,(i||u)&&nt.withEndIcon,d&&nt.iconOnly,o&&nt.selected,a&&nt.fake,m&&nt.enableCursorPointer,!h&&nt.disableActiveStateStyles,p&&nt.disableFocusOutline,g&&"apply-common-tooltip",f&&nt.disabled,"apply-overflow-tooltip apply-overflow-tooltip--check-children-recursively apply-overflow-tooltip--allow-text")}function st(e){const{startIcon:t,endIcon:r,showCaret:n,iconOnly:o,children:a}=e;return s.createElement(s.Fragment,null,t&&s.createElement(k.Icon,{icon:t,className:nt.startIconWrap,"aria-hidden":!0}),a&&s.createElement("span",{className:c(nt.content,o&&nt.visuallyHidden)},a),(!o&&r||n)&&s.createElement(ct,{icon:r,showCaret:n}))}function ct(e){const{icon:t,showCaret:r}=e;return s.createElement(k.Icon,{className:c(nt.endIconWrap,r&&nt.caret),icon:r?rt:t,"aria-hidden":!0})}var it=r(34094);const ut=(0,s.forwardRef)(((e,t)=>{const{id:r,size:n,variant:o,active:a,fake:l,startIcon:c,endIcon:i,showCaret:u,iconOnly:d,children:m,enableActiveStateStyles:h,disableFocusOutline:p,tooltip:g,disabled:f,...v}=e;return s.createElement("button",{...v,id:r,ref:t,"data-tooltip":g,"data-overflow-tooltip-text":g??(0,it.getTextForTooltip)(m),className:lt({size:n,variant:o,active:a,fake:l,startIcon:c,endIcon:i,showCaret:u,iconOnly:d,enableActiveStateStyles:h,disableFocusOutline:p,tooltip:g,disabled:f})},s.createElement(st,{startIcon:c,endIcon:i,showCaret:u,iconOnly:d},m))}));ut.displayName="RoundTabsBaseButton";const dt=(0,s.createContext)({size:"small",variant:"primary",isHighlighted:!1,isCollapsed:!1,disabled:!1});function mt(e){const{item:t,highlighted:r,handleItemRef:n,reference:o,onClick:a,...l}=e,c=(0,s.useCallback)((e=>{l.disabled&&e.preventDefault(),a&&a(t)}),[a,t,l.disabled]),i=(0,s.useCallback)((e=>{n&&n(t,e),(0,et.isomorphicRef)(o)(e)}),[t,n]),u={size:l.size??ot,variant:l.variant??at,isHighlighted:Boolean(l.active),isCollapsed:!1,disabled:l.disabled??!1};return s.createElement(ut,{...l,id:t.id,onClick:c,ref:i,startIcon:t.startIcon,endIcon:t.endIcon,tooltip:t.tooltip,"aria-label":"radio"===l.role?t.children:void 0},s.createElement(dt.Provider,{value:u},t.children))}var ht=r(16396),pt=r(4523),gt=r(43845),ft=r(89882),vt=r(2057),bt=r(27692);function yt(e){const{disabled:t,isOpened:r,enableActiveStateStyles:n,disableFocusOutline:o,fake:a,items:l,buttonText:c,buttonPreset:i="text",buttonRef:u,size:d,variant:m,isAnchorTabs:h,isHighlighted:p,onButtonClick:g,onItemClick:f,onClose:v}=e,b=(0,s.useRef)(null),y=(0,Qe.useMergedRefs)([u,b]),S="text"===i?void 0:"xsmall"===d?ft:vt;return s.createElement(pt.PopupMenuDisclosureView,{buttonRef:b,listboxTabIndex:-1,isOpened:r,onClose:v,listboxAria:{"aria-hidden":!0},button:s.createElement(ut,{"aria-hidden":!0,disabled:t,active:r,onClick:g,ref:y,tabIndex:-1,size:d,variant:m,startIcon:S,showCaret:"text"===i, +iconOnly:"meatballs"===i,enableActiveStateStyles:n,disableFocusOutline:o,fake:a},c),popupChildren:s.createElement(s.Fragment,null,"meatballs"===i&&s.createElement(gt.ToolWidgetMenuSummary,null,c),l.map((e=>s.createElement(ht.PopupMenuItem,{key:e.id,className:h?bt.linkItem:void 0,onClick:f,onClickArg:e,isActive:p(e),label:s.createElement(St,{isHighlighted:p(e),size:d,variant:m,disabled:e.disabled},e.children),isDisabled:e.disabled,link:"href"in e?e.href:void 0,rel:"rel"in e?e.rel:void 0,target:"target"in e?e.target:void 0,icon:e.startIcon,toolbox:e.endIcon&&s.createElement(k.Icon,{icon:e.endIcon}),renderComponent:"renderComponent"in e?e.renderComponent:void 0,dontClosePopup:!0}))))})}function St(e){const{isHighlighted:t,size:r,variant:n,children:o,disabled:a}=e,l={size:r??ot,variant:n??at,isHighlighted:t,isCollapsed:!0,disabled:a??!1};return s.createElement(dt.Provider,{value:l},o)}var xt,wt,kt,Ct,Et=r(70408);function It(e){const{overflowBehaviour:t}=e;return c(Et.scrollWrap,"scroll"===t&&Et.overflowScroll,"wrap"===t&&Et.overflowWrap)}function Lt(e){const{align:t="start"}=e;return c(Et.roundTabs,Et[t])}function Rt(e){const{children:t,disabled:n,moreButtonText:o=u.t(null,void 0,r(37117)),moreButtonPreset:a,className:l,size:i,variant:d,align:m,style:h={},"data-name":p,isRadioGroup:g,"aria-controls":f}=e,v=function(e="xsmall"){switch(e){case"small":return 8;case"xsmall":return 4;default:return 16}}(i),{enableActiveStateStyles:b,moreButtonRef:y,setItemRef:S,getBindings:x,handleMoreButtonClick:w,handleCollapsedItemClick:k,scrollWrapBinding:C,overflowBehaviour:E,tablistBinding:I,visibleTabs:L,hiddenTabs:R,handleActivate:T,isMobileTouch:N,getItemId:B,isDisclosureOpened:M,isHighlighted:F,closeDisclosure:_}=Xe(Ye.TabNames.RoundButtonTabs,e,{isRtl:Te.isRtl,scrollIntoViewOptions:{additionalScroll:v},isRadioGroup:g,gap:v});return s.createElement("div",{...C,className:c(It({overflowBehaviour:E}),l),style:{...h,"--ui-lib-roundTabs-gap":`${v}px`},"data-name":p},s.createElement("div",{...I,className:Lt({align:m,overflowBehaviour:E})},L.map((e=>s.createElement(mt,{...x(e),key:e.id,item:e,onClick:()=>T(e),variant:d,size:i,enableActiveStateStyles:b,disableFocusOutline:N,reference:S(B(e)),...e.dataId&&{"data-id":e.dataId},"aria-controls":f}))),R.map((e=>s.createElement(mt,{...x(e),key:e.id,item:e,variant:d,size:i,reference:S(B(e)),"aria-controls":f,fake:!0}))),s.createElement(yt,{disabled:n,isOpened:M,items:R,buttonText:o,buttonPreset:a,buttonRef:y,isHighlighted:F,onButtonClick:w,onItemClick:k,onClose:_,variant:d,size:i,enableActiveStateStyles:b,disableFocusOutline:N,fake:0===R.length}),t))}function Tt(e){const{"data-name":t="round-tabs-buttons",...r}=e;return s.createElement(Rt,{...r,"data-name":t})}!function(e){e.Primary="primary",e.Ghost="ghost"}(xt||(xt={})),function(e){e.XSmall="xsmall",e.Small="small",e.Large="large"}(wt||(wt={})),function(e){e.Start="start",e.Center="center"}(kt||(kt={})),function(e){e.Text="text",e.Meatballs="meatballs"}(Ct||(Ct={}));r(21593);var Nt=r(27864);const Bt=d.enabled("hide_image_invalid_symbol") +;function Mt(e){const{otherSymbolsCount:t,onChangeSymbolTypeFilter:r,onResetFilters:n,onListTouchMove:o,brokerTitle:a,brokerLogoInfo:l,isBrokerActive:i,onBrokerToggle:u,listRef:d,listWrapRef:m,onLoadMoreSymbols:p,canLoadMore:g}=e,{mode:f,isMobile:v,selectedSymbolType:b,symbolTypes:y,feedItems:S,contentItem:x,emptyState:w=Ft,symbolSearchContent:k,symbolSearchState:C}=(0,A.useEnsuredContext)(I.SymbolSearchItemsDialogContext),E=a?s.createElement(BrokerButton,{brokerTitle:a,isActive:i,onToggle:u,onKeyDown:e=>{const t=(0,R.hashFromEvent)(e);t!==9+R.Modifiers.Shift&&9!==t&&e.stopPropagation()},logoInfo:l}):null,L=y.map((e=>({id:e.value,children:e.name}))),T="symbolSearch"===f&&["good","loadingWithPaginated"].includes(C),N=x??_e.SymbolSearchDialogContentItem,B=(0,s.useMemo)((()=>S.map((e=>s.createElement(N,{...e,searchToken:k.token})))),[S]);return s.createElement(s.Fragment,null,"symbolSearch"===f&&s.createElement(s.Fragment,null,s.createElement("div",{className:c(Nt.bubblesContainer,!v&&E&&Nt.withButton,v&&Nt.mobile)},y.length>0&&s.createElement(Tt,{id:"symbol-search-tabs",isActive:e=>e.id===b,onActivate:r,overflowBehaviour:v?"scroll":"wrap",className:c(Nt.bubbles,v&&Nt.mobile,h.isSeparateSymbolSearchTabs&&(k.withFilters||E)&&!v&&Nt.withFilters),items:L},v?null:s.createElement("div",null,E)),!h.isSeparateSymbolSearchTabs&&v&&y.length>0&&a&&s.createElement("div",{className:Nt.brokerButtonWrap},E)),h.isSeparateSymbolSearchTabs&&s.createElement(Re,{brokerButton:v?E:void 0})),s.createElement(Fe,{listRef:d,listWrapRef:m,onTouchMove:o,items:B,getItemSize:()=>At,onLoadMoreSymbols:p,canLoadMore:g,hideFeed:!T}),"loading"===C&&s.createElement("div",{className:Nt.spinnerWrap},s.createElement(be.Spinner,null)),"symbolSearch"===f&&s.createElement(s.Fragment,null,!1,"empty"===C&&s.createElement(w,null)))}function Ft(e){const t=(0,V.useWatchedValueReadonly)({watchedValue:W.watchedTheme})===z.StdTheme.Dark?H:Z;return s.createElement(F,{className:Nt.noResultsDesktop},!Bt&&s.createElement(k.Icon,{icon:t,className:Nt.emptyIcon}),s.createElement("div",{className:Nt.emptyText},u.t(null,void 0,r(76822))))}const _t=(0,h.getDefaultSearchSource)(),At=52;function Dt(e){const{mode:t,setMode:n,setSelectedIndex:o,isMobile:a,selectedSearchSource:l,setSelectedSearchSource:c,isAllSearchSourcesSelected:p,selectedSymbolType:g,setSelectedSymbolType:y,symbolSearchContent:S,setSymbolSearchContent:x,searchRef:w,setSearchSpreads:k,showSpreadActions:C,selectedItem:E,forceUpdate:R,placeholder:T,initialScreen:N,footer:B,searchInput:M,upperCaseEnabled:F,externalInput:_,handleKeyDown:D,customSearchSymbols:P,filterQueryParams:O,searchSources:U,symbolSearchState:Q,setSymbolSearchState:V,onEmptyResults:W,overrideQueryParams:z,getFiltersBySymbolType:H,showRecents:Z,searchInitiationPoint:q}=(0,A.useEnsuredContext)(I.SymbolSearchItemsDialogContext),$=P??oe,G=(0,s.useRef)(t);G.current=t;const j=(0,s.useRef)(new AbortController),[J,X]=(0,s.useState)(0),Y=(0,s.useRef)(0),[re,ce]=(0,s.useState)(S.token),ie=(0,s.useRef)(null),ue=(0,s.useRef)(null),de=(0,s.useRef)({ +selectedIndexValue:-1,searchTokenValue:"",searchSpreadsValue:!0}),me=(0,s.useRef)(null),he=(0,s.useRef)(null),pe=(0,s.useRef)(null),{broker:ge=null,brokerId:ve,brokerTitle:be,brokerLogoInfo:ye,isBrokerChecked:Se=!1,setIsBrokerChecked:xe=()=>{},unhideSymbolSearchGroups:we=""}={brokerId:void 0,brokerTitle:void 0,brokerLogoInfo:void 0};(0,s.useEffect)((()=>()=>{j.current.abort(),Pe(),Oe()}),[]),(0,s.useEffect)((()=>{w?.current&&ce(w.current.value)}),[]),(0,s.useEffect)((()=>{const e=w.current;if(e)return e.addEventListener("input",Te),e.addEventListener("focus",Ae),e.addEventListener("select",Re),e.addEventListener("click",Re),e.addEventListener("keyup",De),_&&D&&e.addEventListener("keydown",D),()=>{e&&(e.removeEventListener("input",Te),e.removeEventListener("focus",Ae),e.removeEventListener("select",Re),e.removeEventListener("click",Re),e.removeEventListener("keyup",De),_&&D&&e.removeEventListener("keydown",D))}}),[D]),(0,s.useEffect)((()=>{Boolean(N)&&""===re.trim()?x((e=>{const t=Boolean(l&&U.length>1&&!(0,h.exchangeSelectDisabled)(g)),r=H(g);return{...e,tabSelectFilters:r,currentSymbolType:g,canChangeExchange:t,withFilters:Boolean(t||r?.length),token:re,currentTabAvailableSearchSources:U,currentSelectedSearchSource:l}})):(x((e=>({...e,symbolStartIndex:0}))),Be(re,g,l).then((()=>{ie.current&&(ie.current.scrollTop=0)})))}),[re,g,l,Se,N,O]),(0,s.useEffect)((()=>{if(!E||!w.current)return;if(!d.enabled("show_spread_operators"))return w.current.value=E.symbol,void R();const e=ne(E)?E.exchange:E.parent.exchange;let t;t="contracts"in E&&E.contracts?.length?E.contracts[0]:E;const r={name:t.symbol,exchange:e,prefix:t.prefix,fullName:t.full_name},[n,o]=v(w.current,r,F);w.current.value=n,w.current.setSelectionRange(o,o),R()}),[E]);const ke=N??"div",Ce=Boolean(N)&&"symbolSearch"!==t,Ee=M??L.DialogSearch,Ie=(0,s.useMemo)((()=>({listRef:ue,resetRecommends:_e,updateRecommends:Be,searchToken:re,emptyTextClassName:Nt.emptyText,isBrokerChecked:Se,symbolSearchState:Q,currentMode:G})),[ue,re,Se,Q,G,O]);return s.createElement(K.SymbolSearchDialogBodyContext.Provider,{value:Ie},!(_&&"symbolSearch"===t)&&s.createElement(Ee,{reference:w,className:i()(Nt.search,F&&Nt.upperCase),placeholder:T||u.t(null,void 0,r(8573))},C&&s.createElement(fe,{state:de,update:Ne})),Ce?s.createElement(ke,null):s.createElement(Mt,{otherSymbolsCount:J,onListTouchMove:function(){w.current?.blur()},onChangeSymbolTypeFilter:function(e){const{id:t}=e;y(t),o(-1)},onResetFilters:function(){h.isSeparateSymbolSearchTabs?"resetFilter"===Q?y((0,h.getAllSymbolTypesValue)()):_t&&c(_t):(y((0,h.getAllSymbolTypesValue)()),_t&&c(_t));xe(!1),a||w.current?.focus()},brokerTitle:be,brokerLogoInfo:ye,isBrokerActive:Se,onBrokerToggle:xe,listRef:ue,listWrapRef:ie,onLoadMoreSymbols:function(){"loadingWithPaginated"!==Q&&Be(re,S.currentSymbolType,l,S.symbolStartIndex)},canLoadMore:0!==S.symbolsRemaining}),B);function Le(){if(!w.current)return;const[e,t,r]=b(w.current,F);Y.current=t,de.current={selectedIndexValue:-1,searchSpreadsValue:(0,m.isSpread)(r),searchTokenValue:e}, +me.current||(me.current=setTimeout(Ne,0))}function Re(){if(!w.current)return;const[,e]=b(w.current,F);e!==Y.current&&Le()}function Te(){d.enabled("show_spread_operators")?Le():w.current&&(de.current={selectedIndexValue:-1,searchSpreadsValue:!1,searchTokenValue:w.current.value},me.current||(me.current=setTimeout(Ne,0)))}function Ne(){const{selectedIndexValue:e,searchTokenValue:t,searchSpreadsValue:r}=de.current;me.current=null,(0,ee.unstable_batchedUpdates)((()=>{k(r),o(e),ce(F?t.toUpperCase():t)}))}async function Be(e,t,r,n){try{"noop"===Q?V("loading"):n?V("loadingWithPaginated"):(Pe(),Oe(),he.current=setTimeout((()=>{const r=Boolean(l&&U.length>1&&!(0,h.exchangeSelectDisabled)(t)),n=H(t);x({token:e,canChangeExchange:r,tabSelectFilters:n,withFilters:Boolean(r||n?.length),currentSymbolType:t,currentSelectedSearchSource:l,currentTabAvailableSearchSources:U,renderSymbolSearchList:[],symbolsRemaining:0,symbolStartIndex:0}),V("loading")}),500)),Ue();(0,h.getAllSymbolTypesValue)();const o=!1;let a;if(Se&&ge){a=(await(0,te.respectAbort)(j.current.signal,ge.accountMetainfo())).prefix}const s=d.enabled("show_spread_operators")?f(e)??a??r?.getRequestExchangeValue():l?.getRequestExchangeValue(),c=f(e)?void 0:(r||l)?.getRequestCountryValue(),[i,u]=await Promise.all([Fe(j.current.signal,e,t,r,s,c,n),o&&!n?getRecent():Promise.resolve([])]),m=u.filter((e=>s?e.exchange?.toLowerCase()===s.toLowerCase():!c||e.country?.toLowerCase()===c.toLowerCase())),p=new Set(m.map((e=>`${e.exchange}_${e.symbol}`))),g=i.symbols.filter((e=>!p.has(`${e.exchange}_${e.symbol}`)));let v=function(e,t=window.ChartApiInstance.symbolsGrouping()){const r={},n=[];for(let o=0;o{const n=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"),void Me();Pe(),x((r=>{const n=Boolean(l&&U.length>1&&!(0,h.exchangeSelectDisabled)(t)),o=H(t);return{...r,canChangeExchange:n,tabSelectFilters:o,renderSymbolSearchList:v,token:e,symbolsRemaining:i.symbols_remaining,withFilters:Boolean(n||o?.length),currentSymbolType:t,currentSelectedSearchSource:l,currentTabAvailableSearchSources:U,symbolStartIndex:r.symbolStartIndex+i.symbols.length}})),V("good")}catch(e){(0,te.skipAbortError)(e)}}function Me(){W&&(pe.current=setTimeout((()=>W()),1e3))}async function Fe(e,t,r,n,o,a,l){const s={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:void 0,brokerId:ve,onlyTradable:Boolean(ve)&&Se,unhideSymbolSearchGroups:we,signal:e,start:l,filterQueryParams:O,overrideQueryParams:z,searchInitiationPoint:q},c=(0,ae.getSearchRequestDelay)();return void 0!==c&&await(0,te.delay)(e,c),$(s)}function _e(){Ue(),V("empty"),ce(""),k(!1),x((e=>({...e,symbolStartIndex:0}))),Pe()}function Ae(){"watchlist"===G.current&&(n("symbolSearch"),(0,le.trackEvent)("Watchlist","Mobile SS","Go to SS page"))}function De(e){switch((0,se.hashFromEvent)(e)){case 37:case 39:Re()}}function Pe(){he.current&&clearTimeout(he.current)}function Oe(){pe.current&&clearTimeout(pe.current)}function Ue(){j.current.abort(),j.current=new AbortController}}var Pt=r(48199),Ot=r(97514),Ut=r(58442),Qt=r(1765);function Vt(e){const[t,r]=(0,s.useState)((()=>{const{defaultSearchSource:t,searchSources:r}=e,n=Qt.getValue("symboledit.exchangefilter","");return r.find((e=>e.value()===n))||t}));return[t,(0,s.useCallback)((e=>{var t;r(e),t=e,Qt.setValue("symboledit.exchangefilter",t.value())}),[])]}function Wt(e){const{selectedSymbolSettingsKey:t="symboledit.filter"}=e,[r,n]=(0,s.useState)((()=>{if(1===e.types.length)return e.types[0].value;const r=Qt.getValue(t,(0,h.getAllSymbolTypesValue)());return e.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])]}var zt=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");function Xt(e){const{onClose:t,symbolTypeFilter:n,initialMode:o,defaultValue:a="",showSpreadActions:l,hideMarkedListFlag:c,selectSearchOnInit:i=!0,onSearchComplete:m,dialogTitle:p=u.t(null,void 0,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[];const t=e.symbolTypes??(0,h.getAvailableSymbolTypes)();return n?n(t):t}),[]),j=void 0!==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){const r=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)return J;return J.filter((e=>{const t=TAB_SOURCE_FILTER_MAP[me] +;if(!t)return!1;if(!me)return!0;const r=e.group();return r===ExchangeGroup.AllExchanges||r&&t.value.includes(r)}))}),[J,me]),Ce=(0,s.useCallback)((e=>{const t=h.isSeparateSymbolSearchTabs?TAB_SELECT_FILTER_MAP:void 0;if(t)return z?.length?t[e]?.filter((e=>!z.includes(e.id))):t[e]}),[z]),[Ee,Ie]=(0,s.useState)((()=>{const e=Boolean(ce&&Gt.length>1&&!(0,h.exchangeSelectDisabled)(me)),t=Ce(me);return{canChangeExchange:e,tabSelectFilters:t,withFilters:Boolean(e||t?.length),renderSymbolSearchList:[],token:le.current,symbolsRemaining:0,currentSymbolType:me,currentSelectedSearchSource:we,currentTabAvailableSearchSources:ke,symbolStartIndex:0}})),Le=(0,s.useCallback)((e=>{trackEvent("New SS",me,"Change sources"),de?.(me,e),Ie((t=>({...t,currentSelectedSearchSource:e})))}),[me,Ie]),Re=(0,s.useRef)(e.input??null),[Ne,Be]=(0,s.useState)(!1),Me=(0,zt.useForceUpdate)(),[Fe,_e]=(0,s.useState)(new Set),{broker:Ae=null,brokerId:De,unhideSymbolSearchGroups:Pe="",displayBrokerSymbol:Oe=!1}={brokerId:void 0};(0,s.useLayoutEffect)((()=>{!Re?.current||!j&&Boolean(Re.current?.value)||(j||"compare"===X||(Re.current.value=le.current),!N||j&&"symbolSearch"!==X||Re.current.focus())}),[X]),(0,s.useEffect)((()=>{Re?.current&&i&&N&&Re.current.select()}),[]);const Ue=(0,s.useMemo)((()=>Ee.renderSymbolSearchList.reduce(((e,t)=>{const r=tr(t),n=Fe.has(r);return e.push(t),n&&t.contracts&&e.push(...t.contracts.map((e=>({...e,parent:t})))),e}),[])),[Ee.renderSymbolSearchList,Fe]),Qe=(0,s.useRef)(null);(0,s.useEffect)((()=>{-1!==be&&Qe.current?.scrollIntoView({block:"nearest"})}),[be,Qe]);const Ve=y.includes(me),We=(0,s.useMemo)((()=>Ue.map(((e,t)=>{if(ne(e)){const r=tr(e),n=e.contracts?Fe.has(r):void 0,o=t===be,a=Ee.renderSymbolSearchList.findIndex((t=>t.symbol===e.symbol&&t.exchange===e.exchange))+1;return{key:t,numberInList:a,id:r,title:er(e,Oe),description:e.description,isOffset:!1,onClick:Je.bind(null,e,a),providerId:e.provider_id,source:e.source,source2:e.source2,country:e.country?.toLocaleLowerCase(),type:e.type,exchangeName:null===e.exchange?void 0:e.exchange,exchangeTooltip:"",prefix:e.prefix||void 0,marketType:(0,Ot.marketType)(e.type,e.typespecs,!1),hideMarketType:Ve,isEod:e.params?.includes("eod")&&"economic"!==e.type,isYield:(0,Ht.isYield)(e),isExpanded:n,onExpandClick:e.contracts?Xe.bind(null,r):void 0,fullSymbolName:e.contracts?Ut.QualifiedSources.fromSymbolSearchResult(e,e.contracts[0]):Ut.QualifiedSources.fromSymbolSearchResult(e),itemRef:o?Qe:void 0,isSelected:t===be,hideMarkedListFlag:c,item:e,logoId:e.logoid,currencyLogoId:e["currency-logoid"],baseCurrencyLogoId:e["base-currency-logoid"],sourceLogoId:e.source_logoid,shortName:(0,Kt.safeShortName)(Ut.QualifiedSources.fromSymbolSearchResult(e)),currencyCode:e.currency_code,isPrimary:e.is_primary_listing,isPromo:e.is_promo}}{const{parent:r}=e,n=tr(r),o=t===be,a=Ee.renderSymbolSearchList.findIndex((e=>e.symbol===r.symbol&&e.exchange===r.exchange))+1;return{key:t,numberInList:a,id:n+e.symbol,dangerousTitleHTML:er(e,Oe), +dangerousDescriptionHTML:`${r.description}`+(e.description?` (${e.description})`:""),isOffset:!0,isEod:e.params?.includes("eod"),isYield:(0,Ht.isYield)(e),onClick:Ye.bind(null,e.parent,e,a),providerId:r.provider_id,country:r.country?.toLowerCase(),sourceLogoId:r.source_logoid,type:r.type,exchangeName:null===r.exchange?void 0:r.exchange,exchangeTooltip:"",marketType:(0,Ot.marketType)(r.type,e.typespecs,!1),hideMarketType:Ve,fullSymbolName:Ut.QualifiedSources.fromSymbolSearchResult(e.parent,e),itemRef:o?Qe:void 0,isSelected:o,hideMarkedListFlag:c,item:e}}}))),[Ee.renderSymbolSearchList,Fe,X,be,F]),ze=(0,s.useMemo)((()=>function(e,t,r){const n=new Map(t?.map((e=>[e.id,e.urlParam]))),o=r[e];let a;if(o){a={};for(const[e,t]of Object.entries(o)){const r=n.get(e);r&&(a[r]=t)}}return a}(me,Ce(me),pe)),[me,Ce,pe]),Ke=(0,s.useMemo)((()=>Ee.renderSymbolSearchList.slice(0,20).map((e=>e.contracts?Ut.QualifiedSources.fromSymbolSearchResult(e,e.contracts[0]):Ut.QualifiedSources.fromSymbolSearchResult(e)))),[Ee.renderSymbolSearchList]);(0,s.useEffect)((()=>{if(!U)return;const e=["resetFilter","resetTabFilter","empty"].includes(Se)?[]:Ke,t={...ze,result_list:e};if(t.search_type||(t.search_type="bitcoin,crypto"===me?"crypto":me),!h.isSeparateSymbolSearchTabs)return t.exchange=we?.getRequestCountryValue()??null,void U(t);if(me){const e=we?.getRequestCountryValue()??null;e&&(t.country=e);const r=we?.getRequestExchangeValue()??null;r&&(t.exchange=r)}U(t)}),[me,ze,Ke,we,Se]);const He=(0,s.useMemo)((()=>{if(A)return A}),[me,A,ze,V]),Ze=k??nr,qe=Ze!==nr&&!j,$e=(e,r)=>({mode:X,setMode:Y,selectedSearchSource:we,setSelectedSearchSource:h.isSeparateSymbolSearchTabs?Le:ie,isAllSearchSourcesSelected:B.isAllSearchSourcesSelected,allSearchSourcesTitle:h.isSeparateSymbolSearchTabs?TAB_SOURCE_FILTER_MAP[Ee.currentSymbolType]?.allSearchSourcesTitle:void 0,selectedSymbolType:me,setSelectedSymbolType:he,selectedIndex:be,setSelectedIndex:ye,onClose:t,setSymbolSearchContent:Ie,symbolSearchContent:Ee,searchRef:Re,cachedInputValue:le,searchSpreads:fe,setSearchSpreads:ve,handleListWidth:et,isSmallWidth:Ne,feedItems:We,isMobile:e,showSpreadActions:l,selectSearchOnInit:i,isTablet:r,selectedItem:Ue[be],forceUpdate:Me,placeholder:g,initialScreen:b,toggleExpand:Xe,openedItems:Fe,onSubmit:nt,onSearchComplete:m,footer:E,symbolTypes:$,contentItem:C,searchInput:L,emptyState:R,autofocus:N,upperCaseEnabled:Jt,externalInput:j,handleKeyDown:qe?void 0:rt,customSearchSymbols:He,searchSources:ke,selectedFilterValues:pe,setSelectedFilterValues:ge,filterQueryParams:ze,symbolSearchState:Se,setSymbolSearchState:xe,onEmptyResults:void 0,overrideQueryParams:W,getFiltersBySymbolType:Ce,showRecents:K,searchInitiationPoint:H}),Ge=_??G,je=w??"div";return s.createElement(je,null,s.createElement(S.MatchMediaMap,{rules:x.DialogBreakpoints},(({TabletSmall:e,TabletNormal:n})=>s.createElement(I.SymbolSearchItemsDialogContext.Provider,{value:$e(e,n)},s.createElement(Ze,{..."exchange"===X?{title:u.t(null,void 0,r(28628)),dataName:"exchanges-search",render:()=>s.createElement(Ge,{ +searchSources:Ee.currentTabAvailableSearchSources}),additionalHeaderElement:s.createElement(Pt.BackButton,{onClick:()=>Y("symbolSearch"),className:qt.backButton,size:"medium","aria-label":u.t(null,{context:"input"},r(41256)),preservePaddings:!0,flipIconOnRtl:(0,Te.isRtl)()}),additionalElementPos:"before"}:{title:p,dataName:"symbol-search-items-dialog",render:()=>s.createElement(Dt,null),additionalElementPos:"after"},shouldReturnFocus:O,fullScreen:f,onClose:t,onClickOutside:t,onKeyDown:qe?void 0:rt,isOpened:!0})))));function Je(e,t,r){if(e.contracts)return e.contracts.length?void Ye(e,e.contracts[0],t,r):void Xe(tr(e));Ye(e,void 0,t,r)}function Xe(e){const t=new Set(Fe);t.has(e)?t.delete(e):t.add(e),_e(t)}function Ye(e,r,n,o){const a=r||e,{exchange:l}=e;if(d.enabled("show_spread_operators")){const e={name:a.symbol,exchange:l,prefix:a.prefix,fullName:a.full_name};if(fe)return tt(e),void Me();if(Re.current&&Re.current.value.includes(","))return void tt(e)}ot([{resolved:!0,symbol:Ut.QualifiedSources.fromSymbolSearchResult(e,r),result:a}],n,o),t()}function et(e){Be("fixed"===M||e<=640)}function tt(e){if(!Re.current)return;const[t,r]=v(Re.current,e,Jt);Re.current.value=t,Re.current.setSelectionRange(r,r),Re.current.focus()}function rt(e){if(e.target&&e.target!==Re.current)return;const r=(0,se.hashFromEvent)(e);switch(r){case 13:e.preventDefault(),nt(!0);break;case 27:if(e.preventDefault(),"exchange"===X)return void Y("symbolSearch");if("options"===X)return Y("symbolSearch"),te(null),void ae(null);t()}switch((0,T.mapKeyCodeToDirection)(r)){case"blockPrev":if(e.preventDefault(),0===be||"good"!==Se)return;if(-1===be)return void ye(0);ye(be-1);break;case"blockNext":if(e.preventDefault(),be===We.length-1||"good"!==Se)return;ye(be+1);break;case"inlinePrev":{if(-1===be)return;const t=We[be],{id:r,isOffset:n,onExpandClick:o}=t;if(!n&&r&&Fe.has(r)&&Boolean(o)&&!Boolean(F)&&(e.preventDefault(),Xe(r)),o)return void F?.(e,!0);break}case"inlineNext":{if(-1===be)return;const t=We[be],{id:r,isOffset:n,onExpandClick:o}=t;if(n||!r||Fe.has(r)||!Boolean(o)||Boolean(F)||(e.preventDefault(),Xe(r)),o)return void F?.(e,!0);break}}F?.(e)}function nt(e){if(!Re.current)return;let r=Re.current.value;if(d.enabled("show_spread_operators")&&fe&&r){const n=We[be];if(n&&void 0!==n.isExpanded&&(n.onClick(),r=Re.current.value),r.includes(",")){return ot(rr(r).map(Yt),null),void(e&&t())}return ot([{symbol:Jt?r.toUpperCase():r,resolved:!1}],null),void(e&&t())}if(r.includes(","))return ot(rr(r).map(Yt),null),void(e&&t());if(-1!==be){We[be].onClick()}else if(d.enabled("allow_arbitrary_symbol_search_input")){const n=Jt?r.toUpperCase():r;if(n&&""!==n.trim()){const e=rr(n);if($t||void 0===De||-1!==n.indexOf(":")){ot(e.map(Yt),null)}else(function(e){let t=!1;return Promise.all(e.map((e=>-1!==e.indexOf(":")||t?Promise.resolve({symbol:e,resolved:!1}):(t=!0,async function(e){await(Ae?.accountMetainfo());const t=void 0,r=await oe({strictMatch:!0,serverHighlight:!1,text:e,lang:window.language||"",brokerId:De,onlyTradable:!0,unhideSymbolSearchGroups:Pe,exchange:t}) +;if(0!==r.symbols.length){const e=r.symbols[0],{contracts:t}=e,n=t&&t.length>0?t[0]:void 0,o=e.prefix||e.exchange,a=n?n.symbol:e.symbol;if(o&&a)return{symbol:Ut.QualifiedSources.fromSymbolSearchResult(e,n),resolved:!0,result:e}}return{symbol:e,resolved:!1}}(e)))))})(e).then((e=>ot(e,null)))}e&&t()}else if("empty"!==Se&&We.length>0){We[0].onClick()}}async function ot(e,t,r){const[{result:n,symbol:o,resolved:a}]=e,l=Re.current?.value,s=!r||(0,Zt.isKeyboardClick)(r);let c=fe;void 0!==n&&ne(n)&&(c="spread"===n.type),m(e,{symbolType:me,isKeyboardEvent:s,numberInList:t,inputValue:l,isSpread:c})}}function Yt(e){return{symbol:Jt?e.toUpperCase():e,resolved:!1}}function er(e,t){const{broker_symbol:r,symbol:n,description:o}=e;return`${"spread"===e.type?o:n}${t&&r?` (${r})`:""}`}function tr(e){return e.symbol+e.exchange+e.description}function rr(e){return e.split(",").map((e=>e.trim())).filter((e=>""!==e))}function nr(e){const{isMobile:t,isTablet:r}=(0,A.useEnsuredContext)(I.SymbolSearchItemsDialogContext);return s.createElement(w.AdaptivePopupDialog,{...e,className:i()(qt.dialog,!t&&(r?qt.tabletDialog:qt.desktopDialog)),backdrop:!0,draggable:!1})}function or(e,t){return null}},81319:(e,t,r)=>{"use strict";r.d(t,{createGroupColumns:()=>h,exchangeSelectDisabled:()=>m,getAllSymbolTypesValue:()=>d,getAvailableSearchSources:()=>i,getAvailableSymbolTypes:()=>u,getDefaultSearchSource:()=>c,getSymbolFullName:()=>s,isOptionDefaultValue:()=>g,isSeparateSymbolSearchTabs:()=>p});var n=r(11542),o=r(20882);class a{constructor(e){this._exchange=e}value(){return this._exchange.value}name(){return(0,o.isAllSearchSourcesSelected)(this)?n.t(null,void 0,r(34040)):this._exchange.name}description(){return this._exchange.desc}country(){return this._exchange.country}providerId(){return this._exchange.providerId}group(){return this._exchange.group}includes(e){return function(e,t){const r=t.toLowerCase(),{name:n,desc:o,searchTerms:a}=e;return n.toLowerCase().includes(r)||o.toLowerCase().includes(r)||void 0!==a&&a.some((e=>e.toLowerCase().includes(r)))}(this._exchange,e)}getRequestExchangeValue(){return this._exchange.value}getRequestCountryValue(){}}var l=r(3685);function s(e){if(e.fullName)return e.fullName;let t;return t=e.prefix||e.exchange?(e.prefix||e.exchange)+":"+e.name:e.name,t.replace(/<\/?[^>]+(>|$)/g,"")}function c(){const e=i();return e.find(o.isAllSearchSourcesSelected)||e[0]||null}function i(){return(0,o.createSearchSources)(a,(0,l.getExchanges)())}function u(){return window.ChartApiInstance.supportedSymbolsTypes()}function d(){return""}function m(e){return!!p&&!TAB_SOURCE_FILTER_MAP[e]}function h(e,t=2){if(0===e.length)return[];if(1===t)return[e];const r=Math.floor(e.length/2)+e.length%2;return[e.slice(0,r),e.slice(r)].filter((e=>e.length>0))}const p=!1;function g(e){return"string"!=typeof e}},82708:(e,t,r)=>{"use strict";r.d(t,{safeShortName:()=>o});var n=r(59149);function o(e){try{return(0,n.shortName)(e)}catch(t){return e}}},44254:(e,t,r)=>{"use strict";r.d(t,{factorOutBraces:()=>h,getTokenAtPos:()=>m,isBinaryOperator:()=>u, +isSpread:()=>d,parseToken:()=>g,shortName:()=>p,symbolTokenEscapeRe:()=>l,tokenize:()=>i});var n,o=r(18429);!function(e){e.Symbol="symbol",e.IncompleteSymbol="incompleteSymbol",e.Number="number",e.IncompleteNumber="incompleteNumber",e.SeparatorPrefix="separatorPrefix",e.OpenBrace="openBrace",e.CloseBrace="closeBrace",e.Plus="plus",e.Minus="minus",e.Multiply="multiply",e.Divide="divide",e.Power="power",e.Whitespace="whitespace",e.Unparsed="unparsed"}(n||(n={}));const a=/(?:[^-+\/*^\s]'|[a-zA-Z0-9_\u0370-\u1FFF_\u2E80-\uFFFF^])(?:[^-+\/*^\s]'|[a-zA-Z0-9_\u0020\u0370-\u1FFF_\u2E80-\uFFFF_!:.&])*|'.+?'/,l=/[+\-/*]/,s=(e=!1)=>({number:e?/\d+(?:\.\d*|(?![a-zA-Z0-9_!:.&]))(?:\s*(?=\s*$))?|\.\d+(?:\s*(?=\s*$))?/:/\d+(?:\.\d*|(?![a-zA-Z0-9_!:.&]))|\.\d+/,incompleteNumber:/\./,symbol:a,incompleteSymbol:/'[^']*/,separatorPrefix:o.SEPARATOR_PREFIX,openBrace:"(",closeBrace:")",plus:"+",minus:"-",multiply:"*",divide:"/",power:"^",whitespace:/[\0-\x20\s]+/,unparsed:null}),c=(e=s())=>new RegExp(Object.values(e).map((e=>{return null===e?"":`(${"string"==typeof e?(t=e,t.replace(/[\^$()[\]{}*+?|\\]/g,"\\$&")):e.source})`;var t})).filter((e=>""!==e)).concat(".").join("|"),"g");function i(e,t=s()){if(!e)return[];const r=[],n=Object.keys(t);let o;const a=c(t);for(;o=a.exec(e);){let e=!1;for(let t=n.length;t--;)if(o[t+1]){n[t]&&r.push({value:o[t+1],type:n[t],precedence:0,offset:o.index}),e=!0;break}e||r.push({value:o[0],type:"unparsed",precedence:0,offset:o.index})}return r}function u(e){return"plus"===e||"minus"===e||"multiply"===e||"divide"===e||"power"===e}function d(e){return e.length>1&&e.some((e=>u(e.type)))}function m(e,t){for(let r=0;ra.precedence&&(r[r.length-1].minPrecedence=a.precedence);break;case"openBrace":n={minPrecedence:1/0,openBraceIndex:o},r.push(n);break;case"closeBrace":{if(n=r.pop(),!n)break;const a=e[n.openBraceIndex-1],l=e[o+1],s=a&&("plus"===a.type||"multiply"===a.type);(!u(l?.type)||l?.precedence<=n.minPrecedence)&&(!u(a?.type)||a?.precedencen.minPrecedence&&(r[r.length-1].minPrecedence=n.minPrecedence))}}}for(let r=t.length;r--;)e.splice(t[r],1);return e}function p(e){return h(i(e)).reduce(((e,t)=>{if("symbol"!==t.type)return e+t.value;const[,r]=g(t);return r?e+r:e}),"")}function g(e){const t=/^'?(?:([A-Z0-9_]+):)?(.*?)'?$/i.exec(e.value);return null===t?[void 0,void 0]:[t[1],t[2]]}},618:(e,t,r)=>{"use strict";r.d(t,{removeUsdFromCryptoPairLogos:()=>l,resolveLogoUrls:()=>a});var n=r(36279);const o=(0,n.getLogoUrlResolver)() +;function a(e,t=n.LogoSize.Medium){const r=e.logoid,a=e["base-currency-logoid"],l=e["currency-logoid"],s=r&&o.getSymbolLogoUrl(r,t);if(s)return[s];const c=a&&o.getSymbolLogoUrl(a,t),i=l&&o.getSymbolLogoUrl(l,t);return c&&i?[c,i]:c?[c]:i?[i]:[]}function l(e){return 2!==e.length?e:function(e){return e.some((e=>s(e)))}(e)&&!function(e){return e.some((e=>e.includes("country")&&!s(e)))}(e)?e.filter((e=>!s(e))):e}function s(e){return!1}},39330:(e,t,r)=>{"use strict";r.d(t,{getBlockStyleClasses:()=>c,getLogoStyleClasses:()=>i});var n=r(97754),o=r.n(n),a=r(52292),l=r(37643),s=r.n(l);function c(e,t){return o()(s().pair,s()[e],t)}function i(e,t=2,r=!0){return o()(s().logo,s()[e],s().skeleton,a.skeletonTheme.wrapper,!r&&s().empty,1===t&&o()(a.skeletonTheme.animated))}},58492:(e,t,r)=>{"use strict";r.d(t,{getStyleClasses:()=>n.getStyleClasses});var n=r(53885)},97006:(e,t,r)=>{"use strict";r.d(t,{createRegExpList:()=>s,getHighlightedChars:()=>c,rankedSearch:()=>l});var n=r(87465);function o(e){return e.replace(/[!-/[-^{-}?]/g,"\\$&")}var a;function l(e){const{data:t,rules:r,queryString:o,isPreventedFromFiltering:a,primaryKey:l,secondaryKey:s=l,optionalPrimaryKey:c,tertiaryKey:i}=e;return t.map((e=>{const t=c&&e[c]?e[c]:e[l],a=e[s],u=i&&e[i];let d,m=0;return r.forEach((e=>{const{re:r,fullMatch:l}=e;if(r.lastIndex=0,(0,n.isString)(t)&&t&&t.toLowerCase()===o.toLowerCase())return m=4,void(d=t.match(l)?.index);if((0,n.isString)(t)&&l.test(t))return m=3,void(d=t.match(l)?.index);if((0,n.isString)(a)&&l.test(a))return m=2,void(d=a.match(l)?.index);if((0,n.isString)(a)&&r.test(a))return m=2,void(d=a.match(r)?.index);if(Array.isArray(u))for(const e of u)if(l.test(e))return m=1,void(d=e.match(l)?.index)})),{matchPriority:m,matchIndex:d,item:e}})).filter((e=>a||e.matchPriority)).sort(((e,t)=>{if(e.matchPriorityt.matchPriority)return-1;if(e.matchPriority===t.matchPriority){if(void 0===e.matchIndex||void 0===t.matchIndex)return 0;if(e.matchIndex>t.matchIndex)return 1;if(e.matchIndexe))}function s(e,t){const r=[],n=e.toLowerCase(),a=e.split("").map(((e,t)=>`(${0!==t?`[/\\s-]${o(e)}`:o(e)})`)).join("(.*?)")+"(.*)";return r.push({fullMatch:new RegExp(`(${o(e)})`,"i"),re:new RegExp(`^${a}`,"i"),reserveRe:new RegExp(a,"i"),fuzzyHighlight:!0}),t&&t.hasOwnProperty(n)&&r.push({fullMatch:t[n],re:t[n],fuzzyHighlight:!1}),r}function c(e,t,r){const n=[];return e&&r?(r.forEach((e=>{const{fullMatch:r,re:o,reserveRe:a}=e;r.lastIndex=0,o.lastIndex=0;const l=r.exec(t),s=l||o.exec(t)||a&&a.exec(t);if(e.fuzzyHighlight=!l,s)if(e.fuzzyHighlight){let e=s.index;for(let t=1;t{"use strict";r.d(t,{HighlightedText:()=>s}) +;var n=r(50959),o=r(97754),a=r(97006),l=r(68222);function s(e){const{queryString:t,rules:r,text:s,className:c}=e,i=(0,n.useMemo)((()=>(0,a.getHighlightedChars)(t,s,r)),[t,r,s]);return n.createElement(n.Fragment,null,i.length?s.split("").map(((e,t)=>n.createElement(n.Fragment,{key:t},i[t]?n.createElement("span",{className:o(l.highlighted,c)},e):n.createElement("span",null,e)))):s)}},78036:(e,t,r)=>{"use strict";r.d(t,{useEnsuredContext:()=>a});var n=r(50959),o=r(50151);function a(e){return(0,o.ensureNotNull)((0,n.useContext)(e))}},46043:(e,t,r)=>{"use strict";r.d(t,{useForceUpdate:()=>n.useForceUpdate});var n=r(125)},29006:(e,t,r)=>{"use strict";r.d(t,{useResizeObserver:()=>n.useResizeObserver});var n=r(67842)},77975:(e,t,r)=>{"use strict";r.d(t,{useWatchedValueReadonly:()=>o});var n=r(50959);const o=(e,t=!1,r=[])=>{const o="watchedValue"in e?e.watchedValue:void 0,a="defaultValue"in e?e.defaultValue:e.watchedValue.value(),[l,s]=(0,n.useState)(o?o.value():a);return(t?n.useLayoutEffect:n.useEffect)((()=>{if(o){s(o.value());const e=e=>s(e);return o.subscribe(e),()=>o.unsubscribe(e)}return()=>{}}),[o,...r]),l}},84877:(e,t,r)=>{"use strict";r.d(t,{MatchMediaMap:()=>l});var n=r(50959),o=r(66783),a=r.n(o);class l extends n.Component{constructor(e){super(e),this._handleMediaChange=()=>{const e=c(this.state.queries,((e,t)=>t.matches));let t=!1;for(const r in e)if(e.hasOwnProperty(r)&&this.state.matches[r]!==e[r]){t=!0;break}t&&this.setState({matches:e})};const{rules:t}=this.props;this.state=s(t)}shouldComponentUpdate(e,t){return!a()(e,this.props)||(!a()(t.rules,this.state.rules)||!a()(t.matches,this.state.matches))}componentDidMount(){this._migrate(null,this.state.queries)}componentDidUpdate(e,t){a()(e.rules,this.props.rules)||this._migrate(t.queries,this.state.queries)}componentWillUnmount(){this._migrate(this.state.queries,null)}render(){return this.props.children(this.state.matches)}static getDerivedStateFromProps(e,t){if(a()(e.rules,t.rules))return null;const{rules:r}=e;return s(r)}_migrate(e,t){null!==e&&c(e,((e,t)=>{t.removeEventListener("change",this._handleMediaChange)})),null!==t&&c(t,((e,t)=>{t.addEventListener("change",this._handleMediaChange)}))}}function s(e){const t=c(e,((e,t)=>window.matchMedia(t)));return{queries:t,matches:c(t,((e,t)=>t.matches)),rules:{...e}}}function c(e,t){const r={};for(const n in e)e.hasOwnProperty(n)&&(r[n]=t(n,e[n]));return r}},63932:(e,t,r)=>{"use strict";r.d(t,{Spinner:()=>i});var n=r(50959),o=r(97754),a=r.n(o),l=r(58096),s=(r(40987),r(53895)),c=r.n(s);function i(e){const{ariaLabel:t,ariaLabelledby:r,className:o,style:s,size:i,id:u,disableSelfPositioning:d}=e;return n.createElement("div",{className:a()(o,"tv-spinner","tv-spinner--shown",`tv-spinner--size_${l.spinnerSizeMap[i||l.DEFAULT_SIZE]}`,d&&c().disableSelfPositioning),style:s,role:"progressbar",id:u,"aria-label":t,"aria-labelledby":r})}},10381:(e,t,r)=>{"use strict";r.d(t,{ToolWidgetCaret:()=>c});var n=r(50959),o=r(97754),a=r(9745),l=r(86186),s=r(578);function c(e){const{dropped:t,className:r}=e;return n.createElement(a.Icon,{ +className:o(r,l.icon,{[l.dropped]:t}),icon:s})}},99343:e=>{e.exports={button:"button-GwQQdU8S",pressed:"pressed-GwQQdU8S",hover:"hover-GwQQdU8S",clicked:"clicked-GwQQdU8S",isInteractive:"isInteractive-GwQQdU8S",accessible:"accessible-GwQQdU8S",isGrouped:"isGrouped-GwQQdU8S",isActive:"isActive-GwQQdU8S",isOpened:"isOpened-GwQQdU8S",isDisabled:"isDisabled-GwQQdU8S",text:"text-GwQQdU8S",icon:"icon-GwQQdU8S",endIcon:"endIcon-GwQQdU8S"}},79619:e=>{e.exports={title:"title-u3QJgF_p"}},46003:(e,t,r)=>{"use strict";r.d(t,{DEFAULT_TOOL_WIDGET_BUTTON_THEME:()=>s,ToolWidgetButton:()=>c});var n=r(50959),o=r(97754),a=r(9745),l=r(99343);const s=l,c=n.forwardRef(((e,t)=>{const{tag:r="div",icon:s,endIcon:c,isActive:i,isOpened:u,isDisabled:d,isDisabledAppearance:m,isGrouped:h,isHovered:p,isClicked:g,onClick:f,text:v,textBeforeIcon:b,title:y,theme:S=l,className:x,forceInteractive:w,"data-name":k,"data-tooltip":C,tooltipPosition:E,children:I,isPressed:L,...R}=e,T=o(x,S.button,{"apply-common-tooltip":Boolean(y||C),"common-tooltip-vertical":Boolean(C)&&"vertical"===E,[S.isActive]:i,[S.isOpened]:u,[S.isInteractive]:(w||Boolean(f))&&!d&&!m,[S.isDisabled]:Boolean(d||m),[S.isGrouped]:h,[S.hover]:p,[S.clicked]:g,[S.pressed]:L}),N=s&&("string"==typeof s?n.createElement(a.Icon,{className:S.icon,icon:s}):n.cloneElement(s,{className:o(S.icon,s.props.className)}));return"button"===r?n.createElement("button",{...R,ref:t,type:"button",className:o(T,S.accessible),disabled:d&&!m,onClick:f,title:y,"data-name":k,"data-tooltip":C},b&&v&&n.createElement("div",{className:o("js-button-text",S.text)},v),N,!b&&v&&n.createElement("div",{className:o("js-button-text",S.text)},v),I):n.createElement("div",{...R,ref:t,"data-role":"button",className:T,onClick:d?void 0:f,title:y,"data-name":k,"data-tooltip":C},b&&v&&n.createElement("div",{className:o("js-button-text",S.text)},v),N,!b&&v&&n.createElement("div",{className:o("js-button-text",S.text)},v),c&&n.createElement(a.Icon,{icon:c,className:l.endIcon}),I)}))},43845:(e,t,r)=>{"use strict";r.d(t,{ToolWidgetMenuSummary:()=>l});var n=r(50959),o=r(97754),a=r(79619);function l(e){return n.createElement("div",{className:o(e.className,a.title)},e.children)}},97514:(e,t,r)=>{"use strict";r.d(t,{VISIBLE_TYPESPECS:()=>l,marketType:()=>s});var n=r(11542);const o=new Map([["cfd",()=>n.t(null,void 0,r(79599))],["dr",()=>n.t(null,void 0,r(47268))],["index",()=>n.t(null,void 0,r(87464))],["forex",()=>n.t(null,void 0,r(17770))],["right",()=>n.t(null,{context:"symbol_type"},r(53174))],["bond",()=>n.t(null,void 0,r(42358))],["bitcoin",()=>n.t(null,void 0,r(46128))],["crypto",()=>n.t(null,void 0,r(46128))],["economic",()=>n.t(null,void 0,r(54094))],["indices",()=>n.t(null,void 0,r(90250))],["futures",()=>n.t(null,void 0,r(4723))],["stock",()=>n.t(null,void 0,r(76752))],["commodity",()=>n.t(null,void 0,r(70932))]]);r(40167);const a=new Map,l=new Set(["cfd","spreadbet","defi","yield","government","corporate","mutual","money","etf","unit","trust","reit","etn","convertible","closedend","crypto","oracle","ndf"]);function s(e,t=[],r=!0){ +const n=t.filter((e=>l.has(e))),s=`${e}_${n.sort().join("_")}`,c=a.get(s);if(void 0!==c)return c;const i=r?function(e){return o.get(e)?.()||e}(e):e,u=Boolean(t.length)?[i,...n].join(" "):i;return a.set(s,u),u}},52019:e=>{e.exports=''},89882:e=>{e.exports=''},2057:e=>{e.exports=''},95694:e=>{e.exports=''},49498:e=>{e.exports=''},60176:e=>{e.exports=''},35369:e=>{e.exports=''},58478:e=>{e.exports=''},73063:e=>{e.exports=''},14127:e=>{e.exports=''},18073:e=>{e.exports=''},99243:e=>{ +e.exports=''},42576:e=>{e.exports=''},578:e=>{e.exports=''},91540:e=>{e.exports=''},66619:e=>{e.exports=''},67562:e=>{e.exports=''},69533:e=>{e.exports=''},486:e=>{e.exports=''},63861:e=>{ +e.exports=''},81574:e=>{e.exports=''},32617:e=>{e.exports=''},35119:e=>{e.exports=''},69135:e=>{e.exports=''},54313:e=>{e.exports=''},6347:e=>{e.exports=''}}]); \ No newline at end of file diff --git a/charting_library/bundles/add-compare-dialog.3cab117ede5b1696d880.js b/charting_library/bundles/add-compare-dialog.c700b910ca230864c99c.js similarity index 99% rename from charting_library/bundles/add-compare-dialog.3cab117ede5b1696d880.js rename to charting_library/bundles/add-compare-dialog.c700b910ca230864c99c.js index b9e895b9..d5d0415f 100644 --- a/charting_library/bundles/add-compare-dialog.3cab117ede5b1696d880.js +++ b/charting_library/bundles/add-compare-dialog.c700b910ca230864c99c.js @@ -3,7 +3,7 @@ disabled:"disabled-ywH2tsV_","intent-danger":"intent-danger-ywH2tsV_",checked:"c ;var n=o(50959),a=o(11542),r=o(32563),l=o(37103),i=o(48961),s=o(97754),c=o.n(s),d=o(50151),u=o(9745),m=o(86656),p=o(77975),h=o(63932),v=o(24633),f=o(45345),g=o(45601),b=o(84524),S=o(96967);const y=n.createContext(null);var x=o(70412),w=o(78036);const I=n.createContext(null);var C=o(16396),E=o(41590),k=o(37558),D=o(12556);function M(e){const{theme:t=D,children:o,onClick:a,isSelected:r,areBordersVisible:l,isItemSelected:i,className:s,value:d,name:u}=e;return n.createElement("button",{type:"button",className:c()(s,t.button,r&&t.selected,l&&!r&&!i&&t.bordersVisible),name:u,value:d,onClick:a},o)}function N(e){const{value:t,onClick:o,...a}=e,r=(0,n.useCallback)((e=>o(t,e)),[t,o]);return n.createElement(M,{...a,value:String(t),onClick:r})}var _=o(46148);function B(e){const{compareModel:t,selectedCompareOptionIndex:r}=(0,w.useEnsuredContext)(y),l=t.comparableOnSameScale({isYield:e}),i=(0,n.useMemo)((()=>function(e){return[{label:e?a.t(null,void 0,o(38137)):a.t(null,void 0,o(56136)),compareOption:e?_.CompareOption.SameScale:_.CompareOption.SamePctScale},{label:a.t(null,void 0,o(60126)),compareOption:_.CompareOption.NewPriceScale},{label:a.t(null,void 0,o(63456)),compareOption:_.CompareOption.NewPane}]}(l)),[l]);return[(0,n.useMemo)((()=>i[r]?.compareOption??i[0].compareOption),[i,r]),i]}var L=o(84211);function O(e){const{fullSymbolName:t,isSelected:r,className:l,isYield:s}=e,{isMobile:d,searchRef:u,setMode:m}=(0,w.useEnsuredContext)(b.SymbolSearchItemsDialogContext),{compareModel:p,setHoveredItemId:h,clearInput:v,allowExtendTimeScale:f}=(0,w.useEnsuredContext)(y),{callback:g}=(0,w.useEnsuredContext)(I),[S,x]=B(s);return d?n.createElement(k.DrawerManager,null,n.createElement(E.Drawer,{position:"Bottom",onClose:D.bind(null,!1)},n.createElement("div",{className:L.header},a.t(null,void 0,o(60085))),x.map((({label:e,compareOption:t})=>n.createElement(C.PopupMenuItem,{key:t,className:L.item,onClick:M,onClickArg:t,label:e}))))):n.createElement("div",{className:c()(L.wrap,l),"data-name":"compare-buttons-group"},x.map((({label:e,compareOption:t})=>n.createElement(N,{key:t,onClick:M,value:t,isItemSelected:Boolean(r),isSelected:r&&S===t},e))));function D(e){d&&g&&g(),v&&e&&v(u,m)}function M(e,o){if(o.preventDefault(),p&&t&&void 0!==e){(0,i.getSymbolSearchCompleteOverrideFunction)()(t).then((t=>{p.applyStudy(t.symbol,e,f),h(""),D(!0)}))}}}function T(e){const{isSelected:t,fullSymbolName:o,onExpandClick:a,actions:l,id:s,isOffset:c,isYield:d}=e,{isMobile:u,toggleExpand:m,searchSpreads:p,searchRef:h,setMode:v,mode:f}=(0,w.useEnsuredContext)(b.SymbolSearchItemsDialogContext),{compareModel:g,hoveredItemId:C,setHoveredItemId:E,clearInput:k,allowExtendTimeScale:D}=(0,w.useEnsuredContext)(y),[M,N]=(0,n.useState)(!1),B=(0,n.useRef)(null),L=(0,x.useAccurateHover)(B),T=(0,n.useMemo)((()=>({callback:z})),[z]),A=!Boolean(a)&&!Boolean(l),R=s===C;return n.createElement(I.Provider,{value:T},n.createElement(S.SymbolSearchDialogContentItem,{hideMarkedListFlag:"compare"===f,...e,reference:B,onClick:function(t){ if(Boolean(a)&&s&&!c)return t?.preventDefault(),void m(s);if(!M&&u)return void N(!0);if(p&&e.onClick)return void e.onClick(t);if((r.mobiletouch?R:!M)&&o){(0,i.getSymbolSearchCompleteOverrideFunction)()(o).then((e=>{const t=g.comparableOnSameScale({isYield:d})?_.CompareOption.SameScale:_.CompareOption.SamePctScale;g.applyStudy(e.symbol,t,D)})),E(""),k&&k(h,v)}r.mobiletouch&&!u&&!R&&s&&E(s)},hoverComponent:function(){if(!A)return!1;if(u)return M;if(r.mobiletouch)return R;return Boolean(L||t)}()?O:void 0}));function z(){N(!1)}}var A=o(15550),R=o(93986),z=o(39750),H=o(80010);function V(e){const{handleListWidth:t}=(0,d.ensureNotNull)((0,n.useContext)(b.SymbolSearchItemsDialogContext)),{compareModel:r,selectedCompareIndex:l,selectedItemRef:i}=(0,d.ensureNotNull)((0,n.useContext)(y)),s=(0,p.useWatchedValueReadonly)({watchedValue:r.isDataReady()}),x=(0,p.useWatchedValueReadonly)({watchedValue:r.studies()}),w=(0,p.useWatchedValueReadonly)({watchedValue:r.highlightedSymbol()}),I=(0,n.useMemo)((()=>x.filter((e=>e.checked))),[x]),C=(0,n.useMemo)((()=>x.filter((e=>!e.checked))),[x]);return(0,n.useEffect)((()=>(r.chartModel().dataSourceCollectionChanged().subscribe(r,r.handleSourcesChange),()=>r.chartModel().dataSourceCollectionChanged().unsubscribe(r,r.handleSourcesChange))),[r]),n.createElement(g.Measure,{onResize:function([e]){t(e.contentRect.width)}},(e=>n.createElement(m.TouchScrollContainer,{className:H.scrollable,ref:e},function(){if(!s)return n.createElement("div",{className:H.spinnerWrap},n.createElement(h.Spinner,null));if(!Boolean(I.length)&&!Boolean(C.length)){const e=f.watchedTheme.value()===v.StdTheme.Dark?R:A;return n.createElement("div",{className:H.emptyState},n.createElement(u.Icon,{className:H.image,icon:e}),n.createElement("div",{className:H.text},a.t(null,void 0,o(37094))))}return n.createElement(n.Fragment,null,Boolean(I.length)&&n.createElement(n.Fragment,null,n.createElement("div",{className:H.heading},a.t(null,void 0,o(46622))),I.map(((e,t)=>n.createElement(S.SymbolSearchDialogContentItem,{"data-role":"added-symbol-item",className:H.item,key:e.id,id:e.id,shortName:e.title,title:e.title,logoId:e.logoId,currencyLogoId:e.currencyLogoId,baseCurrencyLogoId:e.baseCurrencyLogoId,dangerousDescriptionHTML:e.description,exchangeName:e.exchangeName,marketType:e.marketType,country:e.country,providerId:e.providerId,onClick:E.bind(null,e),isHighlighted:e.id===w,isSelected:k(e),itemRef:k(e)?i:void 0,isYield:e.isYield,actions:n.createElement("div",{className:H.checkboxWrap},n.createElement(M,{className:H.checkbox,onClick:E.bind(null,e),isSelected:k(e)},n.createElement(u.Icon,{icon:z})))})))),Boolean(C.length)&&n.createElement(n.Fragment,null,n.createElement("div",{className:H.heading},a.t(null,void 0,o(8926))),C.map((e=>n.createElement(T,{"data-role":"recent-symbol-item",className:c()(H.item,e.id===w&&H.highlighted),key:e.id,id:e.id,shortName:e.title,logoId:e.logoId,currencyLogoId:e.currencyLogoId,baseCurrencyLogoId:e.baseCurrencyLogoId,title:e.title,dangerousDescriptionHTML:e.description,exchangeName:e.exchangeName, marketType:e.marketType,country:e.country,providerId:e.providerId,fullSymbolName:e.symbol,isSelected:k(e),itemRef:k(e)?i:void 0,isYield:e.isYield})))))}())));function E(e,t){t?.preventDefault(),r.removeStudy(e)}function k(e){return x.indexOf(e)===l}}var P=o(1765);class F extends n.PureComponent{constructor(e){super(e),this._selectedItemRef=n.createRef(),this._getContextValue=()=>{const{compareModel:e}=this.props,{selectedCompareOptionIndex:t,selectedCompareIndex:o,hoveredItemId:n,allowExtendTimeScale:a}=this.state;return{compareModel:e,selectedCompareOptionIndex:t,setSelectedCompareOptionIndex:this._setSelectedCompareOptionIndex,hoveredItemId:n,setHoveredItemId:this._setHoveredItemId,selectedCompareIndex:o,setSelectedCompareIndex:this._setSelectedCompareIndex,selectedItemRef:this._selectedItemRef,clearInput:this._clearInput,allowExtendTimeScale:a,toggleAllowExtendTimeScale:this._toggleAllowExtendTimeScale}},this._clearInput=(e,t)=>{e&&e.current&&(e.current.value="",t("compare"))},this._setSelectedCompareOptionIndex=e=>{this.setState({selectedCompareOptionIndex:e})},this._setHoveredItemId=e=>{this.setState({hoveredItemId:e})},this._setSelectedCompareIndex=(e,t)=>{this.setState({selectedCompareIndex:e},t)},this._toggleAllowExtendTimeScale=()=>{const e=!this.state.allowExtendTimeScale;P.setValue("showAddSymbolDialog.extendCheckboxState",e),this.setState({allowExtendTimeScale:e})},this.state={selectedCompareOptionIndex:0,selectedCompareIndex:-1,hoveredItemId:void 0,allowExtendTimeScale:Boolean(P.getBool("showAddSymbolDialog.extendCheckboxState"))}}render(){const{children:e}=this.props;return n.createElement(y.Provider,{value:this._getContextValue()},e)}}var K=o(68335),W=o(79418),j=o(22692),X=o(38082);function Y(e){const{openedItems:t,searchRef:o,feedItems:a,selectedIndex:r,toggleExpand:i,onSearchComplete:c,mode:d,setMode:u,setSelectedIndex:m,isMobile:h,isTablet:v,onClose:f,upperCaseEnabled:g,symbolSearchState:S,searchSpreads:x}=(0,w.useEnsuredContext)(b.SymbolSearchItemsDialogContext),{compareModel:I,hoveredItemId:C,setHoveredItemId:E,selectedCompareOptionIndex:k,setSelectedCompareOptionIndex:D,selectedCompareIndex:M,setSelectedCompareIndex:N,selectedItemRef:_,clearInput:L,allowExtendTimeScale:O}=(0,w.useEnsuredContext)(y),T=(0,p.useWatchedValueReadonly)({watchedValue:I.studies()}),A=a[r],R="compare"===d,z="exchange"===d,H=R?M:r,V=R?T:a,P=V[H],[F,Y]=B(P?.isYield);return(0,n.useEffect)((()=>{C&&E(""),M&&N(-1)}),[d]),n.createElement(W.AdaptivePopupDialog,{...e,className:s(X.dialog,!h&&(v?X.tabletDialog:X.desktopDialog)),onKeyDown:function(e){if(e.target&&e.target!==o.current)return;const n=(0,K.hashFromEvent)(e);switch(n){case 13:{if(R)return void function(){if(-1===M)return;const e=T[M];e.checked?I.removeStudy(e):I.applyStudy(e.symbol,F,O);N(-1)}();const t=Z();if(t)return e.preventDefault(),void i(t);e.preventDefault();const n=function(){if(l.enabled("compare_symbol_search_spread_operators")&&l.enabled("show_spread_operators")&&x)return o?.current?.value.trim() -;const e=e=>"string"==typeof e?.fullSymbolName?e.fullSymbolName:e?.symbol,t=-1!==r;if(t)return e(P);const n=l.enabled("allow_arbitrary_symbol_search_input"),a="empty"!==S;if(n)return a&&V.length?e(V[0]):o?.current?.value.trim();if(!a&&!t&&!n)return;if(V.length)return e(V[0])}();return void(n&&(c([{symbol:g?n.toString().toUpperCase():n.toString(),resolved:!1,compareOption:F,allowExtendTimeScale:O}]),L&&L(o,u)))}case 27:return e.preventDefault(),z?void u("symbolSearch"):void f()}if(!R&&"good"!==S)return;switch((0,j.mapKeyCodeToDirection)(n)){case"blockPrev":if(e.preventDefault(),0===H)return;if(-1===H)return void G(0);G(H-1);break;case"blockNext":if(e.preventDefault(),H===V.length-1)return;G(H+1);break;case"inlinePrev":{const o=Z();if(o&&t.has(o))return e.preventDefault(),void i(o);if(!k||o)return;e.preventDefault(),D(k-1);break}case"inlineNext":{const o=Z();if(o&&!t.has(o))return e.preventDefault(),void i(o);if(k===Y.length-1||o)return;e.preventDefault(),D(k+1);break}}},dataName:"compare-dialog",draggable:!0});function G(e){R?N(e,U):m(e)}function U(){_.current?.scrollIntoView({block:"nearest"})}function Z(){if(!A)return;const{id:e,isOffset:t,onExpandClick:o}=A;return!t&&Boolean(o)&&e?e:void 0}}var G=o(40336),U=o(38414),Z=o(87896);class q extends U.DialogRenderer{constructor(e){super(),this._props=e}show(e){if(this.visible().value())return;const t=n.createElement(G.SymbolSearchItemsDialog,{...this._props,shouldReturnFocus:e?.shouldReturnFocus,initialMode:this._props.initialMode||"symbolSearch",onClose:()=>this.hide()});this._rootInstance=(0,Z.createReactRoot)(t,this._container),this._setVisibility(!0)}hide(){this._rootInstance?.unmount(),this._visibility.setValue(!1),this._props.onClose?.()}}var Q=o(81319),$=o(69654),J=o(70613);function ee(e){const{searchRef:t,setMode:o}=(0,w.useEnsuredContext)(b.SymbolSearchItemsDialogContext),{currentMode:a}=(0,w.useEnsuredContext)(J.SymbolSearchDialogBodyContext);return(0,n.useEffect)((()=>{const e=t.current;if(e)return e.addEventListener("input",r),()=>{e&&e.removeEventListener("input",r)}}),[]),n.createElement($.DialogSearch,{...e});function r(){t.current&&a&&("compare"!==a.current||""===t?.current?.value?.trim()?"symbolSearch"===a.current&&""===t?.current?.value?.trim()&&o("compare"):o("symbolSearch"))}}var te=o(70673),oe=o(39362),ne=o(18519);function ae(e){const{allowExtendTimeScale:t,toggleAllowExtendTimeScale:r}=(0,d.ensureNotNull)((0,n.useContext)(y));return n.createElement(oe.SymbolSearchDialogFooter,null,n.createElement("label",{"data-name":"allow-extend-time-scale-checkbox"},n.createElement(te.CheckboxInput,{checked:t,value:t?"on":"off",onChange:r}),n.createElement("span",{className:ne.label},a.t(null,void 0,o(1048)))))}const re=l.enabled("secondary_series_extend_time_scale");function le(e){return new q({wrapper:(t=e,e=>n.createElement(F,{...e,compareModel:t})),dialog:Y,contentItem:T,initialScreen:V,searchInput:ee,footer:re?n.createElement(ae):void 0,initialMode:"compare",searchInitiationPoint:"compare",dialogTitle:a.t(null,void 0,o(93193)),autofocus:!r.mobiletouch, +;const e=e=>"string"==typeof e?.fullSymbolName?e.fullSymbolName:e?.symbol,t=-1!==r;if(t)return e(P);const n=l.enabled("allow_arbitrary_symbol_search_input"),a="empty"!==S;if(n)return a&&V.length?e(V[0]):o?.current?.value.trim();if(!a&&!t&&!n)return;if(V.length)return e(V[0])}();return void(n&&(c([{symbol:g?n.toString().toUpperCase():n.toString(),resolved:!1,compareOption:F,allowExtendTimeScale:O}]),L&&L(o,u)))}case 27:return e.preventDefault(),z?void u("symbolSearch"):void f()}if(!R&&"good"!==S)return;switch((0,j.mapKeyCodeToDirection)(n)){case"blockPrev":if(e.preventDefault(),0===H)return;if(-1===H)return void G(0);G(H-1);break;case"blockNext":if(e.preventDefault(),H===V.length-1)return;G(H+1);break;case"inlinePrev":{const o=Z();if(o&&t.has(o))return e.preventDefault(),void i(o);if(!k||o)return;e.preventDefault(),D(k-1);break}case"inlineNext":{const o=Z();if(o&&!t.has(o))return e.preventDefault(),void i(o);if(k===Y.length-1||o)return;e.preventDefault(),D(k+1);break}}},dataName:"compare-dialog",draggable:!0});function G(e){R?N(e,U):m(e)}function U(){_.current?.scrollIntoView({block:"nearest"})}function Z(){if(!A)return;const{id:e,isOffset:t,onExpandClick:o}=A;return!t&&Boolean(o)&&e?e:void 0}}var G=o(59071),U=o(38414),Z=o(87896);class q extends U.DialogRenderer{constructor(e){super(),this._props=e}show(e){if(this.visible().value())return;const t=n.createElement(G.SymbolSearchItemsDialog,{...this._props,shouldReturnFocus:e?.shouldReturnFocus,initialMode:this._props.initialMode||"symbolSearch",onClose:()=>this.hide()});this._rootInstance=(0,Z.createReactRoot)(t,this._container),this._setVisibility(!0)}hide(){this._rootInstance?.unmount(),this._visibility.setValue(!1),this._props.onClose?.()}}var Q=o(81319),$=o(69654),J=o(70613);function ee(e){const{searchRef:t,setMode:o}=(0,w.useEnsuredContext)(b.SymbolSearchItemsDialogContext),{currentMode:a}=(0,w.useEnsuredContext)(J.SymbolSearchDialogBodyContext);return(0,n.useEffect)((()=>{const e=t.current;if(e)return e.addEventListener("input",r),()=>{e&&e.removeEventListener("input",r)}}),[]),n.createElement($.DialogSearch,{...e});function r(){t.current&&a&&("compare"!==a.current||""===t?.current?.value?.trim()?"symbolSearch"===a.current&&""===t?.current?.value?.trim()&&o("compare"):o("symbolSearch"))}}var te=o(70673),oe=o(39362),ne=o(18519);function ae(e){const{allowExtendTimeScale:t,toggleAllowExtendTimeScale:r}=(0,d.ensureNotNull)((0,n.useContext)(y));return n.createElement(oe.SymbolSearchDialogFooter,null,n.createElement("label",{"data-name":"allow-extend-time-scale-checkbox"},n.createElement(te.CheckboxInput,{checked:t,value:t?"on":"off",onChange:r}),n.createElement("span",{className:ne.label},a.t(null,void 0,o(1048)))))}const re=l.enabled("secondary_series_extend_time_scale");function le(e){return new q({wrapper:(t=e,e=>n.createElement(F,{...e,compareModel:t})),dialog:Y,contentItem:T,initialScreen:V,searchInput:ee,footer:re?n.createElement(ae):void 0,initialMode:"compare",searchInitiationPoint:"compare",dialogTitle:a.t(null,void 0,o(93193)),autofocus:!r.mobiletouch, dialogWidth:"fixed",onSearchComplete:t=>{const{compareOption:o,allowExtendTimeScale:n}=t[0];if(void 0!==o){(0,i.getSymbolSearchCompleteOverrideFunction)()(t[0].symbol,t[0].result).then((t=>{e.applyStudy(t.symbol,o,n)}))}},symbolTypes:(0,Q.getAvailableSymbolTypes)(),showSpreadActions:l.enabled("show_spread_operators")&&l.enabled("compare_symbol_search_spread_operators")});var t}},46148:(e,t,o)=>{"use strict";var n;o.d(t,{CompareOption:()=>n}),function(e){e[e.SamePctScale=0]="SamePctScale",e[e.NewPriceScale=1]="NewPriceScale",e[e.NewPane=2]="NewPane",e[e.SameScale=3]="SameScale"}(n||(n={}))},37558:(e,t,o)=>{"use strict";o.d(t,{DrawerContext:()=>l,DrawerManager:()=>r});var n=o(50959),a=o(99054);class r extends n.PureComponent{constructor(e){super(e),this._isBodyFixed=!1,this._addDrawer=e=>{this.setState((t=>({stack:[...t.stack,e]})))},this._removeDrawer=e=>{this.setState((t=>({stack:t.stack.filter((t=>t!==e))})))},this.state={stack:[]}}componentDidUpdate(e,t){!t.stack.length&&this.state.stack.length&&((0,a.setFixedBodyState)(!0),this._isBodyFixed=!0),t.stack.length&&!this.state.stack.length&&this._isBodyFixed&&((0,a.setFixedBodyState)(!1),this._isBodyFixed=!1)}componentWillUnmount(){this.state.stack.length&&this._isBodyFixed&&(0,a.setFixedBodyState)(!1)}render(){return n.createElement(l.Provider,{value:{addDrawer:this._addDrawer,removeDrawer:this._removeDrawer,currentDrawer:this.state.stack.length?this.state.stack[this.state.stack.length-1]:null}},this.props.children)}}const l=n.createContext(null)},41590:(e,t,o)=>{"use strict";o.d(t,{Drawer:()=>p});var n=o(50959),a=o(50151),r=o(97754),l=o(4226),i=o(65718),s=o(37558),c=o(29197),d=o(86656),u=o(76773);var m;function p(e){const{position:t="Bottom",onClose:o,children:d,reference:m,className:p,theme:v=u}=e,f=(0,a.ensureNotNull)((0,n.useContext)(s.DrawerContext)),[g]=(0,n.useState)((()=>(0,l.randomHash)())),b=(0,n.useRef)(null),S=(0,n.useContext)(c.CloseDelegateContext);return(0,n.useLayoutEffect)((()=>((0,a.ensureNotNull)(b.current).focus({preventScroll:!0}),S.subscribe(f,o),f.addDrawer(g),()=>{f.removeDrawer(g),S.unsubscribe(f,o)})),[]),n.createElement(i.Portal,null,n.createElement("div",{ref:m,className:r(u.wrap,u[`position${t}`])},g===f.currentDrawer&&n.createElement("div",{className:u.backdrop,onClick:o}),n.createElement(h,{className:r(v.drawer,u[`position${t}`],p),ref:b,"data-name":e["data-name"],"data-qa-id":e["data-qa-id"]},d)))}!function(e){e.Left="Left",e.Bottom="Bottom"}(m||(m={}));const h=(0,n.forwardRef)(((e,t)=>{const{className:o,...a}=e;return n.createElement(d.TouchScrollContainer,{className:r(u.drawer,o),tabIndex:-1,ref:t,...a})}))},70412:(e,t,o)=>{"use strict";o.d(t,{hoverMouseEventFilter:()=>l,useAccurateHover:()=>i,useHover:()=>a,useHoverDeprecated:()=>r});var n=o(50959);function a(){const[e,t]=(0,n.useState)(!1);return[e,{onMouseEnter:function(e){t(!0)},onMouseLeave:function(e){t(!1)}}]}function r(){const[e,t]=(0,n.useState)(!1);return[e,{onMouseOver:function(e){l(e)&&t(!0)},onMouseOut:function(e){l(e)&&t(!1)}}]}function l(e){ return!e.currentTarget.contains(e.relatedTarget)}function i(e){const[t,o]=(0,n.useState)(!1);return(0,n.useEffect)((()=>{const t=t=>{if(null===e.current)return;const n=e.current.contains(t.target);o(n)};return document.addEventListener("mouseover",t),()=>document.removeEventListener("mouseover",t)}),[]),t}},86656:(e,t,o)=>{"use strict";o.d(t,{TouchScrollContainer:()=>c});var n=o(50959),a=o(59142),r=o(50151),l=o(49483);const i=CSS.supports("overscroll-behavior","none");let s=0;const c=(0,n.forwardRef)(((e,t)=>{const{children:o,...r}=e,c=(0,n.useRef)(null);return(0,n.useImperativeHandle)(t,(()=>c.current)),(0,n.useLayoutEffect)((()=>{if(l.CheckMobile.iOS())return s++,null!==c.current&&(i?1===s&&(document.body.style.overscrollBehavior="none"):(0,a.disableBodyScroll)(c.current,{allowTouchMove:d(c)})),()=>{s--,null!==c.current&&(i?0===s&&(document.body.style.overscrollBehavior=""):(0,a.enableBodyScroll)(c.current))}}),[]),n.createElement("div",{ref:c,...r},o)}));function d(e){return t=>{const o=(0,r.ensureNotNull)(e.current),n=document.activeElement;return!o.contains(t)||null!==n&&o.contains(n)&&n.contains(t)}}},65890:e=>{e.exports=''},39750:e=>{e.exports=''},93986:e=>{ e.exports=''},15550:e=>{ diff --git a/charting_library/bundles/chart-actions-provider.5db78c705ae2a12ecca3.js b/charting_library/bundles/chart-actions-provider.c29faaaa30fce24293fa.js similarity index 99% rename from charting_library/bundles/chart-actions-provider.5db78c705ae2a12ecca3.js rename to charting_library/bundles/chart-actions-provider.c29faaaa30fce24293fa.js index 1adb1345..78c8b9fb 100644 --- a/charting_library/bundles/chart-actions-provider.5db78c705ae2a12ecca3.js +++ b/charting_library/bundles/chart-actions-provider.c29faaaa30fce24293fa.js @@ -2,7 +2,7 @@ new w.TranslatedString("lock objects",r.t(null,void 0,o(18942)))),H=new w.TranslatedString("unlock objects",r.t(null,void 0,o(51198))),V=new w.TranslatedString("anchor objects",r.t(null,void 0,o(63869))),B=new w.TranslatedString("unanchor objects",r.t(null,void 0,o(99234))),z=new w.TranslatedString("change visibility at current interval and above",r.t(null,void 0,o(45800))),q=new w.TranslatedString("change visibility at current interval and below",r.t(null,void 0,o(75645))),G=new w.TranslatedString("change visibility at current interval",r.t(null,void 0,o(84331))),$=new w.TranslatedString("change visibility at all intervals",r.t(null,void 0,o(57916))),Y=(r.t(null,void 0,o(66823)),(0,_.appendEllipsis)(r.t(null,void 0,o(264))),r.t(null,void 0,o(98334))),Z=r.t(null,void 0,o(27298)),J=r.t(null,void 0,o(3564)),K=r.t(null,void 0,o(94559)),Q=r.t(null,void 0,o(2165)),X=r.t(null,void 0,o(16986)),ee=r.t(null,void 0,o(12645)),te=r.t(null,void 0,o(44579)),oe=r.t(null,void 0,o(29436)),ne=r.t(null,void 0,o(81054)),ie=r.t(null,void 0,o(32538)),ae=r.t(null,void 0,o(72046)),re=r.t(null,void 0,o(90095)),le=r.t(null,void 0,o(14115)),se=r.t(null,void 0,o(33110)),ce=r.t(null,void 0,o(28280)),de=r.t(null,void 0,o(76150)),ue=r.t(null,void 0,o(94210)),he=r.t(null,void 0,o(60035)),pe=r.t(null,void 0,o(10761)),ge=r.t(null,void 0,o(11254)),Se=r.t(null,void 0,o(35049)),me=r.t(null,void 0,o(19271)),be=r.t(null,void 0,o(15512)),ve=r.t(null,void 0,o(46545)),_e=r.t(null,void 0,o(52160)),we=r.t(null,void 0,o(17293)),fe=r.t(null,void 0,o(21973)),Ie=r.t(null,void 0,o(55481)),Ae=r.t(null,void 0,o(71179)),Te=r.t(null,void 0,o(4077)),ye=r.t(null,void 0,o(54853)),Ce=r.t(null,void 0,o(20177)),We=r.t(null,void 0,o(494)),Ne=r.t(null,void 0,o(60668)),Pe=r.t(null,void 0,o(58026)),Fe=r.t(null,void 0,o(56982)),Ee=((0,_.appendEllipsis)(r.t(null,void 0,o(35088))),(0,_.appendEllipsis)(r.t(null,void 0,o(2439))),(0,_.appendEllipsis)(r.t(null,void 0,o(32514)))),xe=(r.t(null,void 0,o(78358)),(0,_.appendEllipsis)(r.t(null,void 0,o(76266))),r.t(null,void 0,o(49680))),Le=r.t(null,void 0,o(12537)),Me=(r.t(null,void 0,o(93553)),r.t(null,void 0,o(74975))),ke=r.t(null,void 0,o(99894)),De=r.t(null,void 0,o(5837)),Oe=r.t(null,void 0,o(24185)),Ue=(r.t(null,void 0,o(37113)),r.t(null,void 0,o(29449)),r.t(null,void 0,o(50849)),r.t(null,void 0,o(33158)),r.t(null,void 0,o(81465)),r.t(null,void 0,o(62986)),r.t(null,void 0,o(55418))),je=r.t(null,void 0,o(10261)),Re=r.t(null,void 0,o(44020)),He=((0,_.appendEllipsis)(r.t(null,void 0,o(32514))),r.t(null,void 0,o(97878)),r.t(null,void 0,o(39010))),Ve=r.t(null,void 0,o(26090)),Be=(r.t(null,void 0,o(95754)),r.t(null,void 0,o(35679)),r.t(null,void 0,o(9140)),r.t(null,void 0,o(46607)),r.t(null,void 0,o(39079)),(0,_.appendEllipsis)(r.t(null,void 0,o(75594)))),ze=(0,_.appendEllipsis)(r.t(null,void 0,o(88853))),qe=r.t(null,void 0,o(35140)),Ge=r.t(null,void 0,o(68422)),$e=r.t(null,void 0,o(92957)),Ye=r.t(null,void 0,o(58764));r.t(null,void 0,o(10996)),r.t(null,void 0,o(3061));async function Ze(e,t,o){return null}function Je(e){ throw new Error("not supported")}function Ke(e,t){return!t.isEmpty()&&l.enabled("datasource_copypaste")?new N.ActionWithStandardIcon({actionId:"Chart.Clipboard.PasteSource",options:{label:qe.trim(),shortcutHint:(0,p.humanReadableHash)(p.Modifiers.Mod+86),statName:"Paste",onExecute:()=>e.chartWidgetCollection().clipboard.uiRequestPaste(t)}}):null}function Qe(e,t){const o=e.model(),n=o.availableZOrderOperations(t),i=[new N.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder.BringToFront",options:{label:we,statName:"BringToFront",disabled:!n.bringToFrontEnabled,onExecute:()=>o.bringToFront(t)}}),new N.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder.SendToBack",options:{label:fe,statName:"SendToBack",disabled:!n.sendToBackEnabled,onExecute:()=>o.sendToBack(t)}}),new N.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder.BringForward",options:{label:Ie,statName:"BringForward",disabled:!n.bringForwardEnabled,onExecute:()=>o.bringForward(t)}}),new N.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder.SendBackward",options:{label:Ae,statName:"SendBackward",disabled:!n.sendBackwardEnabled,onExecute:()=>o.sendBackward(t)}})];return new N.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder",options:{label:Te,iconId:"Chart.VisualOrder",statName:"VisualOrder",subItems:i}})}function Xe(e,t){const o=e.model(),n=(e,n)=>{const i=f.Interval.parse(o.mainSeries().interval()),a=(0,A.getIntervalsVisibilitiesForMode)(i,e),r=[],l=[];t.forEach((e=>{const t=e.properties().intervalsVisibilities.childs();r.push(t.ticks),l.push(a.ticks),r.push(t.seconds),l.push(a.seconds),r.push(t.secondsFrom),l.push(a.secondsFrom),r.push(t.secondsTo),l.push(a.secondsTo),r.push(t.minutes),l.push(a.minutes),r.push(t.minutesFrom),l.push(a.minutesFrom),r.push(t.minutesTo),l.push(a.minutesTo),r.push(t.hours),l.push(a.hours),r.push(t.hoursFrom),l.push(a.hoursFrom),r.push(t.hoursTo),l.push(a.hoursTo),r.push(t.days),l.push(a.days),r.push(t.daysFrom),l.push(a.daysFrom),r.push(t.daysTo),l.push(a.daysTo),r.push(t.weeks),l.push(a.weeks),r.push(t.weeksFrom),l.push(a.weeksFrom),r.push(t.weeksTo),l.push(a.weeksTo),r.push(t.months),l.push(a.months),r.push(t.monthsFrom),l.push(a.monthsFrom),r.push(t.monthsTo),l.push(a.monthsTo),r.push(t.ranges),l.push(a.ranges)})),o.setProperties(r,l,n,(0,W.sourcesAffectState)(t))},i=[new N.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility.CurrentAndAbove",options:{label:Ce,statName:"currentAndAboveIntervals",onExecute:()=>n(3,z)}}),new N.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility.CurrentAndBelow",options:{label:We,statName:"currentAndBelowIntervals",onExecute:()=>n(2,q)}}),new N.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility.Current",options:{label:Ne,statName:"currentInterval",onExecute:()=>n(1,G)}}),new N.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility.All",options:{label:Pe,statName:"allIntervals",onExecute:()=>n(0,$)}})];return new N.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility",options:{label:ye, statName:"IntervalsVisibility",subItems:i}})}function et(e,t){const o=e.defaultPriceScale(),n=void 0!==t?o.coordinateToPrice(t,e.mainDataSource()?.firstValue()??0):e.model().mainSeries().lastValueData(4,!0,!0).price,i=e.mainDataSource()?.formatter();if(void 0===n||!i)return null;const a=i.format(n),r=i.format(n,{ignoreLocaleNumberFormat:!0,noExponentialForm:!0});return new N.ActionWithStandardIcon({actionId:"Chart.Clipboard.CopyPrice",options:{label:`${Ge} ${a}`,statName:"CopyPrice",onExecute:()=>(0,T.getClipboard)().writeText(r)}})}function tt(e){const t=e.actions(),o=[t.showPriceLine];return o.push(t.showHighLowPriceLines),l.enabled("show_average_close_price_line_and_label")&&o.push(t.showAverageClosePriceLine),new N.ActionWithStandardIcon({actionId:"Chart.Lines",options:{label:Fe,statName:"Lines",subItems:o}})}function ot(e,t){return[]}function nt(e,t){const o=t[0].properties().visible.value(),n=o?Z:Y,i=o?"Chart.Hide":"Chart.ShowObject",a=o?"Chart.SelectedObject.Hide":"Chart.SelectedObject.Show";return new N.ActionWithStandardIcon({actionId:a,options:{checkable:!0,statName:"ToggleVisibilitySelectedObject",label:n,iconId:i,onExecute:()=>{const n=e.model();n.withMacro(E,(()=>{t.forEach((e=>{n.setProperty(e.properties().visible,!o,E,I.lineToolsDoNotAffectChartInvalidation&&(0,b.isLineTool)(e))}))}))}}})}function it(e,t,i){let a;if(i)a=i.price;else{const o=e.crosshairSource();a=e.model().magnet().align(o.price,o.index,t)}const l=(0,n.ensureNotNull)(t.mainDataSource()).formatter().format(a);return new N.ActionWithStandardIcon({actionId:"Chart.Crosshair.PlusButton.DrawHorizontalLine",options:{label:r.t(null,{replace:{price:l}},o(56916)),statName:"DrawHorizontalLineAtPrice",iconId:"Chart.AddHorzLine",shortcutHint:(0,p.humanReadableHash)(p.Modifiers.Alt+72),onExecute:async()=>{await(0,P.ensureLineToolLoaded)("LineToolHorzLine"),e.drawRightThere("LineToolHorzLine",t,i,"ContextMenu")}}})}class at{constructor(e,t){this._chartWidget=e,this._options=(0,a.merge)((0,a.clone)(F.defaultChartWidgetActionsOptions),t||{})}async contextMenuActionsForSources(e,t,o,i,a){const r=e[0],l=this._options,c=[];if(r===this._chartWidget.model().mainSeries()&&l.mainSeries)c.push(...await this._contextMenuActionsForSeries(r,o));else if((0,u.isStudy)(r)&&l.studies)c.push(...await this._contextMenuActionsForStudy(r,(0,n.ensureDefined)(t),o));else if((0,b.isLineTool)(r)&&l.lineTools){const t=e.filter(b.isLineTool);c.push(...await this._contextMenuActionsForLineTool(t))}else 0;return c.length&&a?.length&&c.push(new s.Separator),c.push(...a??[]),c}async actionForLineTools(e,t){switch(t){case"Chart.SelectedObject.ToggleAnchored":return this._createActionToggleAnchorLineTools(e);case"Chart.SelectedObject.InsertRowTable":{if(1!==e.length)return null;const t=e[0];return((await(t.additionalActions?.(this._chartWidget.model())))?.actions??[]).filter((e=>"action"===e.type&&"Chart.SelectedObject.InsertRowTable"===e.getState().actionId))[0]??null}case"Chart.SelectedObject.InsertColumnTable":{if(1!==e.length)return null;const t=e[0] -;return((await(t.additionalActions?.(this._chartWidget.model())))?.actions??[]).filter((e=>"action"===e.type&&"Chart.SelectedObject.InsertColumnTable"===e.getState().actionId))[0]??null}}throw new Error(`Unsupported actionId: ${t}`)}_isReadOnly(){return this._chartWidget.readOnly()}_createActionScale(e){const t=(0,n.ensureNotNull)(e.priceScale()),o=this._chartWidget.model().model(),i=(0,n.ensureNotNull)(o.paneForSource(e)),a=i.priceScalePosition(t),r=("left"===a?i.leftPriceScales():i.rightPriceScales()).indexOf(t),l=o.priceScaleSlotsCount().totallySlots<2?"dontneedname":"needname",s="overlay"===a?"":(0,c.getPriceAxisNameInfo)(a,r).label,d=de.format({label:s}),u={"left-needname":d,"left-dontneedname":he,"right-needname":d,"right-dontneedname":pe,"overlay-needname":ue,"overlay-dontneedname":ue}[a+"-"+l];return new N.ActionWithStandardIcon({actionId:"Chart.Source.ChangePriceScale",options:{label:u,iconId:"Chart.PriceScale",subItems:this._createActionScaleItems(e)}})}_createActionResetInputPoints(e){const t=e.metaInfo(),n=t.inputs.filter(y.isTimeOrPriceNotHiddenInput);return 0===n.length?null:new N.ActionWithStandardIcon({actionId:"Chart.Source.ResetInputPoints",options:{label:ze,onExecute:async()=>{let i;try{const a=e.properties().childs().inputs.state();for(const e of Object.keys(a))n.find((t=>t.id===e))||delete a[e];const r=new C.Property({inputs:a}),l=await Promise.all([o.e(5234),o.e(8185),o.e(1681),o.e(5371),o.e(2202),o.e(5563),o.e(2647),o.e(3439),o.e(1171),o.e(8933),o.e(3672),o.e(2537),o.e(3359),o.e(8894),o.e(5743),o.e(3425),o.e(1697),o.e(4587),o.e(7833),o.e(8752),o.e(9487),o.e(445),o.e(846),o.e(8220),o.e(3329),o.e(9970),o.e(6052),o.e(9590),o.e(4678),o.e(9965),o.e(9742),o.e(4248),o.e(2227),o.e(4931),o.e(9418),o.e(4426),o.e(2475),o.e(9928),o.e(8604),o.e(5893),o.e(3030)]).then(o.bind(o,73339));i=(await l.selectInputValuesOnChart(this._chartWidget,n,r,t.shortDescription,t.inputs)).customSourceId,e.properties().mergeAndFire(r.state())}finally{void 0!==i&&this._chartWidget.model().model().removeCustomSource(i)}}}})}_createActionLayoutChartsSync(){return new LayoutChartsSyncContextMenuAction(this._chartWidget.linkingGroupIndex().readonly(),(e=>this._chartWidget.model().setLinkingGroupIndex(e)))}_createActionScaleDetach(e,t,o,i){const a=this._chartWidget.model().model(),r=(0,n.ensureNotNull)(a.paneForSource(e));if(!r.canCreateNewPriceScale())return null;const l=(0,n.ensureNotNull)(e.priceScale()),s=l.canDetachSource(e),d=r.priceScalePosition(l),u=s||d!==t;if(!u)return null;const h=a.priceScaleSlotsCount(),p={left:{labelled:oe,sided:se},right:{labelled:oe,sided:ce}},g="left"===t?r.leftPriceScales().length:r.rightPriceScales().length,S=h[t]>g?"labelled":"sided",m=(0,c.getPriceAxisNameInfo)(t,g).label,b=p[t][S].format({label:m});return new N.ActionWithStandardIcon({actionId:"Chart.Source.ChangePriceScale",options:{checkable:!1,disabled:!u,label:b,statName:i,payload:e,onExecute:o}})}_onDetachLeft(e){const t=e.getPayload(),o=this._chartWidget.model().model(),i=(0,n.ensureNotNull)(o.paneForSource(t)) +;return((await(t.additionalActions?.(this._chartWidget.model())))?.actions??[]).filter((e=>"action"===e.type&&"Chart.SelectedObject.InsertColumnTable"===e.getState().actionId))[0]??null}}throw new Error(`Unsupported actionId: ${t}`)}_isReadOnly(){return this._chartWidget.readOnly()}_createActionScale(e){const t=(0,n.ensureNotNull)(e.priceScale()),o=this._chartWidget.model().model(),i=(0,n.ensureNotNull)(o.paneForSource(e)),a=i.priceScalePosition(t),r=("left"===a?i.leftPriceScales():i.rightPriceScales()).indexOf(t),l=o.priceScaleSlotsCount().totallySlots<2?"dontneedname":"needname",s="overlay"===a?"":(0,c.getPriceAxisNameInfo)(a,r).label,d=de.format({label:s}),u={"left-needname":d,"left-dontneedname":he,"right-needname":d,"right-dontneedname":pe,"overlay-needname":ue,"overlay-dontneedname":ue}[a+"-"+l];return new N.ActionWithStandardIcon({actionId:"Chart.Source.ChangePriceScale",options:{label:u,iconId:"Chart.PriceScale",subItems:this._createActionScaleItems(e)}})}_createActionResetInputPoints(e){const t=e.metaInfo(),n=t.inputs.filter(y.isTimeOrPriceNotHiddenInput);return 0===n.length?null:new N.ActionWithStandardIcon({actionId:"Chart.Source.ResetInputPoints",options:{label:ze,onExecute:async()=>{let i;try{const a=e.properties().childs().inputs.state();for(const e of Object.keys(a))n.find((t=>t.id===e))||delete a[e];const r=new C.Property({inputs:a}),l=await Promise.all([o.e(5234),o.e(8185),o.e(1681),o.e(5371),o.e(2202),o.e(5563),o.e(2647),o.e(3439),o.e(1171),o.e(8933),o.e(3672),o.e(2537),o.e(3359),o.e(8894),o.e(5743),o.e(3425),o.e(1697),o.e(4587),o.e(7833),o.e(8752),o.e(9487),o.e(445),o.e(846),o.e(8220),o.e(3329),o.e(9970),o.e(6052),o.e(9590),o.e(4678),o.e(9965),o.e(9742),o.e(4248),o.e(2227),o.e(4931),o.e(9418),o.e(4426),o.e(9026),o.e(9928),o.e(8604),o.e(5893),o.e(3030)]).then(o.bind(o,73339));i=(await l.selectInputValuesOnChart(this._chartWidget,n,r,t.shortDescription,t.inputs)).customSourceId,e.properties().mergeAndFire(r.state())}finally{void 0!==i&&this._chartWidget.model().model().removeCustomSource(i)}}}})}_createActionLayoutChartsSync(){return new LayoutChartsSyncContextMenuAction(this._chartWidget.linkingGroupIndex().readonly(),(e=>this._chartWidget.model().setLinkingGroupIndex(e)))}_createActionScaleDetach(e,t,o,i){const a=this._chartWidget.model().model(),r=(0,n.ensureNotNull)(a.paneForSource(e));if(!r.canCreateNewPriceScale())return null;const l=(0,n.ensureNotNull)(e.priceScale()),s=l.canDetachSource(e),d=r.priceScalePosition(l),u=s||d!==t;if(!u)return null;const h=a.priceScaleSlotsCount(),p={left:{labelled:oe,sided:se},right:{labelled:oe,sided:ce}},g="left"===t?r.leftPriceScales().length:r.rightPriceScales().length,S=h[t]>g?"labelled":"sided",m=(0,c.getPriceAxisNameInfo)(t,g).label,b=p[t][S].format({label:m});return new N.ActionWithStandardIcon({actionId:"Chart.Source.ChangePriceScale",options:{checkable:!1,disabled:!u,label:b,statName:i,payload:e,onExecute:o}})}_onDetachLeft(e){const t=e.getPayload(),o=this._chartWidget.model().model(),i=(0,n.ensureNotNull)(o.paneForSource(t)) ;this._chartWidget.model().detachToLeft(t,i)}_onDetachRight(e){const t=e.getPayload(),o=this._chartWidget.model().model(),i=(0,n.ensureNotNull)(o.paneForSource(t));this._chartWidget.model().detachToRight(t,i)}_createActionScaleDetachLeft(e){return this._createActionScaleDetach(e,"left",this._onDetachLeft.bind(this),"ToggleScaleLeft")}_createActionScaleDetachRight(e){return this._createActionScaleDetach(e,"right",this._onDetachRight.bind(this),"ToggleScaleRight")}_onMoveToScale(e){const t=e.getPayload();if(t.datasource.priceScale()===t.priceScale)return;const o=this._chartWidget.model().model(),i=(0,n.ensureNotNull)(o.paneForSource(t.datasource));this._chartWidget.model().moveToScale(t.datasource,i,t.priceScale,t.undoText)}_createMoveToScaleAction(e,t,o,n){const i=e.priceScale()===t;return new N.ActionWithStandardIcon({actionId:"Chart.Source.MoveToOtherScale",options:{checkable:!0,checked:i,label:o,statName:"ToggleScale",payload:{datasource:e,priceScale:t,undoText:n},onExecute:this._onMoveToScale.bind(this)}})}_onNoScale(e){const t=e.getPayload().datasource,o=this._chartWidget.model().model(),i=(0,n.ensureNotNull)(o.paneForSource(t));i.isOverlay(t)||this._chartWidget.model().detachNoScale(t,i)}_createActionNoScale(e){const t=this._chartWidget.model().model(),o=(0,n.ensureNotNull)(t.paneForSource(e)),i=o.actionNoScaleIsEnabled(e);return new N.ActionWithStandardIcon({actionId:"Chart.Source.MoveToNoScale",options:{checkable:!0,checked:o.isOverlay(e),label:ge,disabled:!i,statName:"ToggleNoScale",payload:{datasource:e},onExecute:this._onNoScale.bind(this)}})}_createActionScaleItems(e){const t=[],o=this._chartWidget.model().model(),i=(0,n.ensureNotNull)(o.paneForSource(e)),a=o.priceScaleSlotsCount().totallySlots>1,r=i.rightPriceScales(),l=i.leftPriceScales(),d=this._createActionScaleDetachRight(e),u=this._createActionScaleDetachLeft(e),h=r.length+l.length+(null===d?0:1)+(null===u?0:1)>2,p={right:{hidden:{checked:{labelled:J,sided:K},unchecked:{labelled:Q,sided:X}},visible:{checked:{labelled:ee,sided:te},unchecked:{labelled:oe,sided:ne}}},left:{hidden:{checked:{labelled:J,sided:ie},unchecked:{labelled:Q,sided:ae}},visible:{checked:{labelled:ee,sided:re},unchecked:{labelled:oe,sided:le}}}},g={right:L,left:M},S={left:i.visibleLeftPriceScales(),right:i.visibleRightPriceScales()},m=(t,o)=>{const n=("right"===o?r:l)[t],i=S[o].includes(n)?"visible":"hidden",s=e.priceScale()===n?"checked":"unchecked",d=a?"labelled":"sided",u=p[o],h=(0,c.getPriceAxisNameInfo)(o,t).label;return{actionText:u[i][s][d].format({label:h}),undoText:a?x.format({label:h}):g[o]}};t.push(...r.map(((t,o)=>{const n=m(o,"right");return this._createMoveToScaleAction(e,t,n.actionText,n.undoText)}))),null!==d&&t.push(d);h&&(r.length>0||null!==d)&&t.push(new s.Separator);t.push(...l.map(((t,o)=>{const n=m(o,"left");return this._createMoveToScaleAction(e,t,n.actionText,n.undoText)}))),null!==u&&t.push(u);h&&(l.length>0||null!==u)&&t.push(new s.Separator);return t.push(this._createActionNoScale(e)),t}_createActionMergeUp(e){const t=this._chartWidget.model() ;return t.model().isMergeUpAvailableForSource(e)?new N.ActionWithStandardIcon({actionId:"Chart.Source.MergeUp",options:{label:me,statName:"MergeUp",onExecute:()=>t.mergeSourceUp(e)}}):null}_createActionUnmergeUp(e){const t=this._chartWidget.model();return t.model().isUnmergeAvailableForSource(e)?new N.ActionWithStandardIcon({actionId:"Chart.Source.UnmergeUp",options:{label:be,statName:"UnmergeUp",onExecute:()=>t.unmergeSourceUp(e)}}):null}_createActionMergeDown(e){const t=this._chartWidget.model();return t.model().isMergeDownAvailableForSource(e)?new N.ActionWithStandardIcon({actionId:"Chart.Source.MergeDown",options:{label:ve,statName:"MergeDown",onExecute:()=>t.mergeSourceDown(e)}}):null}_createActionUnmergeDown(e){const t=this._chartWidget.model();return t.model().isUnmergeAvailableForSource(e)?new N.ActionWithStandardIcon({actionId:"Chart.Source.UnmergeDown",options:{label:_e,statName:"UnmergeDown",onExecute:()=>t.unmergeSourceDown(e)}}):null}_mergeContentMenuItems(e){return[this._createActionMergeUp(e),this._createActionUnmergeUp(e),this._createActionMergeDown(e),this._createActionUnmergeDown(e)].filter(a.notNull)}_createActionMove(e){const t=this._mergeContentMenuItems(e);return t.length>0?new N.ActionWithStandardIcon({actionId:"Chart.Source.MoveToPane",options:{label:Se,iconId:"Chart.Move",subItems:t}}):null}async _createDetailsMetricsAction(e){return null}async _contextMenuActionsForSeries(e,t){const o=[],i=this._chartWidget.model().model(),a=(0,n.ensureNotNull)(i.paneForSource(e)),r=this._chartWidget.actions(),c=t&&"localY"in t?t.localY:void 0;if(this._isReadOnly())o.push(nt(this._chartWidget,[e])),o.push(new s.Separator),o.push(this._createActionScale(e));else{0,o.length>0&&!(o[o.length-1]instanceof s.Separator)&&o.push(new s.Separator),l.enabled("symbol_info")&&o.push(r.showSymbolInfoDialog);const t=await this._createDetailsMetricsAction(e);if(t&&o.push(t),o.length>0&&!(o[o.length-1]instanceof s.Separator)&&o.push(new s.Separator),!a.isEmpty()&&l.enabled("datasource_copypaste")){const e=et(a,c),t=Ke(this._chartWidget,a);(e||t)&&(e&&o.push(e),t&&o.push(t),o.push(new s.Separator))}o.push(Qe(this._chartWidget,[e]));const n=this._createActionMove(e);null!==n&&o.push(n),o.push(this._createActionScale(e)),o.push(nt(this._chartWidget,[e])),o.push(new s.Separator),r.addToWatchlist&&(r.addToWatchlist.prepare(),o.push(r.addToWatchlist)),l.enabled("text_notes")&&o.push(r.addToTextNotes),o[o.length-1]instanceof s.Separator||o.push(new s.Separator),l.enabled("show_chart_property_page")&&!this._chartWidget.onWidget()&&o.push(r.mainSeriesPropertiesAction),o[o.length-1]instanceof s.Separator&&o.pop()}return o}_createActionAddChildStudy(e){throw new Error("unsupported")}_createActionAddFundamentals(e){return null}_createActionShowSymbolInfoDialog(e,t){const o=this._chartWidget.model().model();return new N.ActionWithStandardIcon({actionId:"Chart.Dialogs.ShowSymbolInfo",options:{label:Be,iconId:"Chart.SymbolInfo",checkable:!1,statName:"SymbolInfo",onExecute:()=>{const n={symbolInfo:e.symbolInfo(), unitDescription:e=>e?t.description(e):"",dateFormatter:o.dateFormatter()};(0,S.showSymbolInfoDialog)(n)}}})}_createActionShowProperties(e){return new N.ActionWithStandardIcon({actionId:"Chart.Indicator.ShowSettingsDialog",options:{label:Ee,iconId:"Settings",statName:"EditSelectedObject",onExecute:()=>this._chartWidget.showSourceProperties(e)}})}async _contextMenuActionsForStudy(e,t,o){const n=t!==this._chartWidget.model().paneForSource(e),i=this._chartWidget.actions(),a=(o&&"localY"in o&&o.localY,[]);if(!e.userEditEnabled())return a;if(this._chartWidget.readOnly())a.push(nt(this._chartWidget,[e])),a.push(new s.Separator),e.isLinkedToSeries()||a.push(this._createActionScale(e));else{0,l.enabled("study_on_study")&&e.canHaveChildren()&&a.push(this._createActionAddChildStudy(e));const t=this._createApplyToEntireLayoutCommand(e);null!==t&&a.push(t);const o=this._createAddIndicatorToFavoritesCommand(e);if(o&&a.push(o),a.length>0&&!(a[a.length-1]instanceof s.Separator)&&a.push(new s.Separator),l.enabled("symbol_info")&&(0,u.isCompareOrOverlayStudy)(e)&&null!==e.symbolInfo()&&(a.push(this._createActionShowSymbolInfoDialog(e,this._chartWidget.model().model().availableUnits())),a.push(new s.Separator)),n||a.push(Qe(this._chartWidget,[e])),a.push(Xe(this._chartWidget,[e])),!e.isLinkedToSeries()&&!n){const t=this._createActionMove(e);null!==t&&a.push(t),a.push(this._createActionScale(e))}a.push(new s.Separator);const r=e.metaInfo();if(e.copiable()){const t=new N.ActionWithStandardIcon({actionId:"Chart.Clipboard.CopySource",options:{label:xe,shortcutHint:(0,p.humanReadableHash)(p.Modifiers.Mod+67),statName:"Copy",onExecute:()=>{this._chartWidget.chartWidgetCollection().clipboard.uiRequestCopy([e])}}});a.push(t)}a.push(nt(this._chartWidget,[e])),a.push(i.studyRemove);this._options.objectTree&&i.paneObjectTree&&a.push(new s.Separator,i.paneObjectTree),l.enabled("property_pages")&&new h.MetaInfoHelper(r).hasUserEditableOptions()&&a.push(new s.Separator,this._createActionShowProperties(e)),a[a.length-1]instanceof s.Separator&&a.pop()}return a}_createLineToolTemplateAction(e){return e.length,null}_createActionToggleLockLineTools(e){const t=e[0].properties().frozen.value(),o=t?ke:De;return new N.ActionWithStandardIcon({actionId:"Chart.SelectedObject.ToggleLocked",options:{label:o,statName:"ToggleLockSelectedObject",checkable:!0,iconId:t?"Chart.UnlockObject":"Chart.LockObject",onExecute:()=>{if(1===e.length)this._chartWidget.toggleLockSelectedObject();else{const o=t?H:R,n=this._chartWidget.model();n.withMacro(o,(()=>{e.forEach((e=>{n.setProperty(e.properties().frozen,!t,o,I.lineToolsDoNotAffectChartInvalidation)}))}))}}}})}_createActionToggleAnchorLineTools(e){const t=e.filter((e=>e.anchorable()));if(0===t.length)return null;const o=t[0].properties().anchored.value();return new N.ActionWithStandardIcon({actionId:"Chart.SelectedObject.ToggleAnchored",options:{label:Oe,statName:"ToggleAnchoredSelectedObject",checkable:!0,checked:o,onExecute:()=>{const e=o?B:V,n=this._chartWidget.model();n.withMacro(e,(()=>{t.forEach((t=>{ diff --git a/charting_library/bundles/floating-toolbars.e8ff289dd4e8225bc29e.js b/charting_library/bundles/floating-toolbars.b5394bfa95332ed5a617.js similarity index 71% rename from charting_library/bundles/floating-toolbars.e8ff289dd4e8225bc29e.js rename to charting_library/bundles/floating-toolbars.b5394bfa95332ed5a617.js index 6ebc8cf1..66cede87 100644 --- a/charting_library/bundles/floating-toolbars.e8ff289dd4e8225bc29e.js +++ b/charting_library/bundles/floating-toolbars.b5394bfa95332ed5a617.js @@ -3,8 +3,8 @@ container:"container-iiEYaqPD",form:"form-iiEYaqPD",swatch:"swatch-iiEYaqPD",whi ;return r()(u,l().button,l()[e],l()[w],l()[o],n&&l().stretch,a&&l().withStartIcon,h&&l().withEndIcon,b&&l().iconOnly,y,p&&l().grouped,p&&!g&&l().adjustPosition,p&&m.isTop&&l().firstRow,p&&m.isLeft&&l().firstCol,v&&_&&l().multilineContent,f&&l().link,c)}function d(t){const{startSlot:e,iconOnly:o,children:n,endSlot:s,primaryText:a,secondaryText:h}=t;if(e&&s&&o)return i.createElement("span",{className:r()(l().slot,l().startSlotWrap)},e);const d=o&&(e??s),u=!e&&!s&&!o&&!n&&a&&h;return i.createElement(i.Fragment,null,e&&i.createElement("span",{className:r()(l().slot,l().startSlotWrap)},e),n&&!d&&i.createElement("span",{className:l().content},n),s&&i.createElement("span",{className:r()(l().slot,l().endSlotWrap)},s),u&&!d&&function(t){return t.primaryText&&t.secondaryText&&i.createElement("div",{className:r()(l().textWrap,c)},i.createElement("span",{className:l().primaryText}," ",t.primaryText," "),"string"==typeof t.secondaryText?i.createElement("span",{className:l().secondaryText}," ",t.secondaryText," "):i.createElement("span",{className:l().secondaryText},i.createElement("span",null,t.secondaryText.firstLine),i.createElement("span",null,t.secondaryText.secondLine)))}(t))}var u=o(34094),p=o(86332),m=o(90186);function g(t,e){return o=>{if(e)return o.preventDefault(),void o.stopPropagation();t?.(o)}}function v(t){const{className:e,color:o,variant:i,size:n,stretch:r,iconOnly:s,startSlot:a,endSlot:l,primaryText:c,secondaryText:h,...d}=t;return{...d,...(0,m.filterDataProps)(t),...(0,m.filterAriaProps)(t)}}function _(t){const{reference:e,tooltipText:o,disabled:n,onClick:r,onMouseOver:s,onMouseOut:a,onMouseDown:l,onMouseEnter:c,"aria-disabled":m,..._}=t,{isGrouped:f,cellState:w,disablePositionAdjustment:y}=(0,i.useContext)(p.ControlGroupContext),b=h({..._,isGrouped:f,cellState:w,disablePositionAdjustment:y}),C=o??(t.primaryText?[t.primaryText,t.secondaryText].join(" "):(0,u.getTextForTooltip)(t.children));return i.createElement("button",{...v(_),"aria-disabled":n||m,tabIndex:t.tabIndex??(n?-1:0),className:b,ref:e,onClick:g(r,n),onMouseDown:g(l,n),onMouseOver:g(s,n),onMouseOut:g(a,n),onMouseEnter:g(c,n),"data-overflow-tooltip-text":C},i.createElement(d,{..._}))}o(49406)},49406:(t,e,o)=>{"use strict";var i,n,r,s;!function(t){t.Primary="primary",t.QuietPrimary="quiet-primary",t.Secondary="secondary",t.Ghost="ghost"}(i||(i={})),function(t){t.XXSmall="xxsmall",t.XSmall="xsmall",t.Small="small",t.Medium="medium",t.Large="large",t.XLarge="xlarge",t.XXLarge="xxlarge"}(n||(n={})),function(t){t.Brand="brand",t.Blue="blue",t.Gray="gray",t.LightGray="light-gray",t.Green="green",t.Red="red",t.Black="black",t.Gradient="gradient",t.BlackFriday="black-friday",t.CyberMonday="cyber-monday",t.Coupon="coupon",t.Offer="offer",t.Space="space"}(r||(r={})),function(t){t.Semibold18px="semibold18px",t.Semibold16px="semibold16px",t.Semibold14px="semibold14px",t.Medium16px="medium16px",t.Regular16px="regular16px",t.Regular14px="regular14px",t.Regular12px="regular12px"}(s||(s={}))},86332:(t,e,o)=>{"use strict";o.d(e,{ControlGroupContext:()=>i}) ;const i=o(50959).createContext({isGrouped:!1,cellState:{isTop:!0,isRight:!0,isBottom:!0,isLeft:!0}})},95604:(t,e,o)=>{"use strict";function i(t){let e=0;return t.isTop&&t.isLeft||(e+=1),t.isTop&&t.isRight||(e+=2),t.isBottom&&t.isLeft||(e+=8),t.isBottom&&t.isRight||(e+=4),e}o.d(e,{getGroupCellRemoveRoundBorders:()=>i})},56073:(t,e,o)=>{"use strict";function i(t,e=!1){const o=getComputedStyle(t),i=[o.height];return"border-box"!==o.boxSizing&&i.push(o.paddingTop,o.paddingBottom,o.borderTopWidth,o.borderBottomWidth),e&&i.push(o.marginTop,o.marginBottom),i.reduce(((t,e)=>t+(parseFloat(e)||0)),0)}function n(t,e=!1){const o=getComputedStyle(t),i=[o.width];return"border-box"!==o.boxSizing&&i.push(o.paddingLeft,o.paddingRight,o.borderLeftWidth,o.borderRightWidth),e&&i.push(o.marginLeft,o.marginRight),i.reduce(((t,e)=>t+(parseFloat(e)||0)),0)}o.d(e,{outerHeight:()=>i,outerWidth:()=>n})},34094:(t,e,o)=>{"use strict";o.d(e,{getTextForTooltip:()=>s});var i=o(50959);const n=t=>(0,i.isValidElement)(t)&&Boolean(t.props.children),r=(t,e=!0)=>null==t||"boolean"==typeof t||"{}"===JSON.stringify(t)?"":t.toString()+(e?" ":""),s=t=>Array.isArray(t)||(0,i.isValidElement)(t)?i.Children.toArray(t).reduce(((t,e)=>{let o="";return o=(0,i.isValidElement)(e)&&n(e)?s(e.props.children):(0,i.isValidElement)(e)&&!n(e)?"":r(e),t.concat(o)}),"").trim():r(t,!1)},52778:(t,e,o)=>{"use strict";o.d(e,{OutsideEvent:()=>n});var i=o(36383);function n(t){const{children:e,...o}=t;return e((0,i.useOutsideEvent)(o))}},73986:(t,e,o)=>{"use strict";o.d(e,{DialogBreakpoints:()=>n});var i=o(51284);const n={SmallHeight:i["small-height-breakpoint"],TabletSmall:i["tablet-small-breakpoint"],TabletNormal:i["tablet-normal-breakpoint"]}},43576:(t,e,o)=>{"use strict";o.d(e,{usePromise:()=>r});var i=o(50959),n=o(95406);function r(t,e,o){const[r,s]=(0,i.useState)(null);return(0,i.useEffect)((()=>{const o=new AbortController;let i=null;return(0,n.respectAbort)(o.signal,t()).then((t=>s(i=t))).catch(n.skipAbortError),()=>{o.abort(),i&&e&&e(i)}}),o?[...o]:void 0),r}},43982:(t,e,o)=>{"use strict";o.d(e,{useProperty:()=>n});var i=o(50959);const n=t=>{const[e,o]=(0,i.useState)(t.value());return(0,i.useEffect)((()=>{const e=t=>{o(t.value())};e(t);const i={};return t.subscribe(i,e),()=>t.unsubscribe(i,e)}),[t]),e}},59369:(t,e,o)=>{"use strict";o.d(e,{useRowsNavigation:()=>d});var i=o(50959),n=o(50151),r=o(22692),s=o(68335),a=o(33647),l=o(15754),c=o(43010);const h=[37,39,38,40];function d(t){const e=(0,i.useRef)(null);return(0,c.useIsomorphicLayoutEffect)((()=>{const t=(0,n.ensureNotNull)(e.current),o=()=>{const o=(0,r.queryTabbableElements)(t).sort(r.navigationOrderComparator);if(0===o.length||o[0].parentElement&&!m(o[0].parentElement,(0,n.ensureNotNull)(e.current))){const i=function(t){const o=p(t).sort(r.navigationOrderComparator),i=o.find((t=>m(t,(0,n.ensureNotNull)(e.current))));if(!i)return null;const s=Array.from(i.children);if(!s.length)return null;return s[0]}(t);if(null===i)return;if((0,a.becomeMainElement)(i),o.length>0)for(const t of o)(0,a.becomeSecondaryElement)(t)}} ;return window.addEventListener("keyboard-navigation-activation",o),o(),()=>window.removeEventListener("keyboard-navigation-activation",o)}),[]),[e,function(e){if(e.defaultPrevented)return;const o=(0,s.hashFromEvent)(e);if(!h.includes(o))return;const i=document.activeElement;if(!(i instanceof HTMLElement))return;const n=e.currentTarget;let a,c;if(t){const t=i.parentElement;a=t?Array.from(t.children):[],c=a.indexOf(i)}else a=(d=n,Array.from(d.querySelectorAll("button:not([disabled]):not([aria-disabled])")).filter((0,l.createScopedVisibleElementFilter)(d))).sort(r.navigationOrderComparator),c=a.indexOf(i);var d;if(0===a.length||-1===c)return;const m=(0,r.mapKeyCodeToDirection)(o);switch(m){case"inlinePrev":if(e.preventDefault(),!t&&0===c)break;g(u(a,c,-1));break;case"inlineNext":if(e.preventDefault(),!t&&c===a.length-1)break;g(u(a,c,1));break;case"blockPrev":case"blockNext":(o=>{if(!document.activeElement)return;const i=p(n),r=document.activeElement.parentElement;if(!r)return;const s=Array.from(r.children).indexOf(document.activeElement);if(-1===s)return;const a=i["blockNext"===o?i.indexOf(r)+1:i.indexOf(r)-1];if(!a)return;e.preventDefault();const l=Array.from(a.children);l.length&&(!t&&s<=l.length-1?g(l[s]):g(l[0]))})(m)}}]}function u(t,e,o){return t[(e+t.length+o)%t.length]}function p(t){return Array.from(t.querySelectorAll('[data-role="row"]')).filter((0,l.createScopedVisibleElementFilter)(t))}function m(t,e){const o=(0,n.ensureNotNull)(t.parentElement).offsetTop,i=o+(0,n.ensureNotNull)(t.parentElement).clientHeight,r=e.scrollTop,s=r+e.clientHeight;return o>=r&&i<=s}function g(t){document.activeElement&&(0,a.becomeSecondaryElement)(document.activeElement),(0,a.becomeMainElement)(t),t.focus()}},16697:(t,e,o)=>{"use strict";o.d(e,{ColorPicker:()=>H});var i=o(50959),n=o(97754),r=o.n(n),s=o(11542),a=o(59369),l=o(82665),c=o(24377),h=o(50151),d=o(49483),u=o(20520),p=o(16396),m=o(6914),g=o(50238),v=o(93544),_=o(69825);const f=4;function w(t){const{color:e,selected:r,onSelect:a,onSwatchRemove:l}=t,[c,w]=(0,i.useState)(!1),[y,b]=(0,g.useRovingTabindexElement)(null),C=Boolean(l)&&!d.CheckMobile.any();return i.createElement(i.Fragment,null,i.createElement("button",{ref:y,style:e?{color:e}:void 0,className:n(_.swatch,c&&_.hover,r&&_.selected,!e&&_.empty,String(e).toLowerCase()===m.white&&_.white),onClick:function(){a(e)},onContextMenu:C?T:void 0,tabIndex:b,"data-role":"swatch"}),C&&i.createElement(u.PopupMenu,{isOpened:c,onClose:T,position:function(){const t=(0,h.ensureNotNull)(y.current).getBoundingClientRect();return{x:t.left,y:t.top+t.height+f}},onClickOutside:T},i.createElement(p.PopupMenuItem,{className:_.contextItem,label:s.t(null,void 0,o(89984)),icon:v,onClick:function(){T(),(0,h.ensureDefined)(l)()},dontClosePopup:!0})));function T(){w(!c)}}const y=10;function b(t){const{colors:e,color:o,children:n,onSelect:r,onRemoveCustomColor:s}=t;if(!e)return null;const a=o?(0,c.parseRgb)(String(o)):void 0,h=(0,l.default)(e,y);return i.createElement("div",{className:_.swatches},h.map(((t,e)=>i.createElement("div",{className:_.row, -"data-role":"row",key:e},t.map(((t,o)=>i.createElement(w,{key:String(t)+o,color:t,selected:a&&(0,c.areEqualRgb)(a,(0,c.parseRgb)(String(t))),onSelect:d,onSwatchRemove:s?()=>function(t,e){const o=t*y+e;s?.(o)}(e,o):void 0})))))),n);function d(t){r&&r(t)}}var C=o(54368),T=o(97737);function x(t){const e=`Invalid RGB color: ${t}`;if(null===t)throw new Error(e);const o=t.match(/^#?([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i);if(null===o)throw new Error(e);const[,i,n,r]=o;if(!i||!n||!r)throw new Error(e);const s=parseInt(i,16)/255,a=parseInt(n,16)/255,l=parseInt(r,16)/255,c=Math.max(s,a,l),h=Math.min(s,a,l);let d;const u=c,p=c-h,m=0===c?0:p/c;if(c===h)d=0;else{switch(c){case s:d=(a-l)/p+(a{this._container=t},this._handlePosition=t=>{const{hsv:{h:e},onChange:o}=this.props;if(!o)return;const i=(0,h.ensureNotNull)(this._container).getBoundingClientRect(),n=t.clientX-i.left,r=t.clientY-i.top;o({h:e,s:(0,P.clamp)(n/i.width,0,1),v:(0,P.clamp)(1-r/i.height,0,1)})},this._handleKeyDown=t=>{const{hsv:{h:e,s:o,v:i},onChange:n}=this.props,r=(0,L.hashFromEvent)(t);if(!n||!B.includes(r))return;if(37===r||39===r){return void n({h:e,s:(0,P.clamp)(37===r?o-D:o+D,0,1),v:i})}n({h:e,s:o,v:(0,P.clamp)(40===r?i-D:i+D,0,1)})},this._mouseDown=t=>{window.addEventListener("mouseup",this._mouseUp),window.addEventListener("mousemove",this._mouseMove)},this._mouseUp=t=>{window.removeEventListener("mousemove",this._mouseMove),window.removeEventListener("mouseup",this._mouseUp),this._handlePosition(t)},this._mouseMove=(0,S.default)(this._handlePosition,100),this._handleTouch=t=>{this._handlePosition(t.nativeEvent.touches[0])}}render(){const{className:t,hsv:{h:e,s:o,v:n}}=this.props,s=`hsl(${360*e}, 100%, 50%)`;return i.createElement("div",{tabIndex:0,className:r()(E.accessible,t),onKeyDown:this._handleKeyDown},i.createElement("div",{className:E.saturation,style:{backgroundColor:s},ref:this._refContainer,onMouseDown:this._mouseDown,onTouchStart:this._handleTouch,onTouchMove:this._handleTouch},i.createElement("div",{className:E.pointer,style:{left:100*o+"%",top:100*(1-n)+"%"}})))}}var A=o(61483);class W extends i.PureComponent{constructor(){super(...arguments),this._container=null,this._refContainer=t=>{this._container=t},this._handlePosition=t=>{const{hsv:{s:e,v:o},onChange:i}=this.props;if(!i)return;const n=(0,h.ensureNotNull)(this._container).getBoundingClientRect(),r=t.clientY-n.top;i({h:(0,P.clamp)(r/n.height,0,1),s:e,v:o})},this._handleKeyDown=t=>{const{hsv:{h:e,s:o,v:i},onChange:n}=this.props,r=(0,L.hashFromEvent)(t);if(!n||38!==r&&40!==r)return;n({h:(0,P.clamp)(38===r?e-.01:e+.01,0,1),s:o,v:i})},this._mouseDown=t=>{window.addEventListener("mouseup",this._mouseUp),window.addEventListener("mousemove",this._mouseMove)},this._mouseUp=t=>{ -window.removeEventListener("mousemove",this._mouseMove),window.removeEventListener("mouseup",this._mouseUp),this._handlePosition(t)},this._mouseMove=(0,S.default)(this._handlePosition,100),this._handleTouch=t=>{this._handlePosition(t.nativeEvent.touches[0])}}render(){const{className:t,hsv:{h:e}}=this.props;return i.createElement("div",{className:r()(A.hue,A.accessible,t),tabIndex:0,onKeyDown:this._handleKeyDown},i.createElement("div",{className:A.pointerContainer,ref:this._refContainer,onMouseDown:this._mouseDown,onTouchStart:this._handleTouch,onTouchMove:this._handleTouch},i.createElement("div",{className:A.pointer,style:{top:100*e+"%"}})))}}var k=o(55778);const z="#000000",N=s.t(null,{context:"Color Picker"},o(55517));class I extends i.PureComponent{constructor(t){super(t),this._inputRef=i.createRef(),this._handleHSV=t=>{const e=function(t){const{h:e,s:o,v:i}=t;let n,r,s;const a=Math.floor(6*e),l=6*e-a,c=i*(1-o),h=i*(1-l*o),d=i*(1-(1-l)*o);switch(a%6){case 0:n=i,r=d,s=c;break;case 1:n=h,r=i,s=c;break;case 2:n=c,r=i,s=d;break;case 3:n=c,r=h,s=i;break;case 4:n=d,r=c,s=i;break;case 5:n=i,r=c,s=h;break;default:n=0,r=0,s=0}return"#"+[255*n,255*r,255*s].map((t=>("0"+Math.round(t).toString(16)).replace(/.+?([a-f0-9]{2})$/i,"$1"))).join("")}(t)||z;this.setState({color:e,inputColor:R(e),hsv:t}),this.props.onSelect(e)},this._handleInput=t=>{const e=R(t.currentTarget.value);try{const t=x(e),o=`#${e}`;this.setState({color:o,inputColor:e,hsv:t}),this.props.onSelect(o)}catch(t){this.setState({inputColor:e})}},this._handleAddColor=()=>this.props.onAdd(this.state.color);const e=t.color||z;this.state={color:e,inputColor:R(e),hsv:x(e)}}componentDidMount(){d.CheckMobile.any()||this._inputRef.current?.focus()}render(){const{color:t,hsv:e,inputColor:o}=this.state;return i.createElement("div",{className:k.container},i.createElement("div",{className:k.form},i.createElement("div",{className:r()(k.swatch,String(t).toLowerCase()===m.white&&k.white),style:{backgroundColor:t}}),i.createElement("div",{className:k.inputWrap},i.createElement("span",{className:k.inputHash},"#"),i.createElement("input",{ref:this._inputRef,type:"text",className:k.input,value:o,onChange:this._handleInput})),i.createElement("div",{className:k.buttonWrap},i.createElement(T.Button,{size:"s",onClick:this._handleAddColor},N))),i.createElement("div",{className:k.hueSaturationWrap},i.createElement(M,{className:k.saturation,hsv:e,onChange:this._handleHSV}),i.createElement(W,{className:k.hue,hsv:e,onChange:this._handleHSV})))}}function R(t){return t.replace(/^#/,"")}var F=o(30329);const V=s.t(null,{context:"Color Picker"},o(29619)),O=s.t(null,{context:"Color Picker"},o(80936));function H(t){const{color:e,opacity:o,selectCustom:n,selectOpacity:s,customColors:l,onRemoveCustomColor:c,onToggleCustom:h,onOpacityChange:d,menu:u}=t,[p,g]=(0,i.useState)(!1),v="number"==typeof o?o:1,[_,f]=(0,a.useRowsNavigation)();return(0,i.useLayoutEffect)((()=>{u&&u.update()}),[s,u]),p?i.createElement(I,{color:e,onSelect:w,onAdd:function(e){g(!1),h?.(!1);const{onAddColor:o}=t;o&&o(e)} +"data-role":"row",key:e},t.map(((t,o)=>i.createElement(w,{key:String(t)+o,color:t,selected:a&&(0,c.areEqualRgb)(a,(0,c.parseRgb)(String(t))),onSelect:d,onSwatchRemove:s?()=>function(t,e){const o=t*y+e;s?.(o)}(e,o):void 0})))))),n);function d(t){r&&r(t)}}var C=o(54368),T=o(97737);function x(t){const e=`Invalid RGB color: ${t}`;if(null===t)throw new Error(e);const o=t.match(/^#?([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})$/i);if(null===o)throw new Error(e);const[,i,n,r]=o;if(!i||!n||!r)throw new Error(e);const s=parseInt(i,16)/255,a=parseInt(n,16)/255,l=parseInt(r,16)/255,c=Math.max(s,a,l),h=Math.min(s,a,l);let d;const u=c,p=c-h,m=0===c?0:p/c;if(c===h)d=0;else{switch(c){case s:d=(a-l)/p+(a{this._container=t},this._handlePosition=t=>{const{hsv:{h:e},onChange:o}=this.props;if(!o)return;const i=(0,h.ensureNotNull)(this._container).getBoundingClientRect(),n=t.clientX-i.left,r=t.clientY-i.top;o({h:e,s:(0,P.clamp)(n/i.width,0,1),v:(0,P.clamp)(1-r/i.height,0,1)})},this._handleKeyDown=t=>{const{hsv:{h:e,s:o,v:i},onChange:n}=this.props,r=(0,L.hashFromEvent)(t);if(!n||!B.includes(r))return;if(37===r||39===r){return void n({h:e,s:(0,P.clamp)(37===r?o-D:o+D,0,1),v:i})}n({h:e,s:o,v:(0,P.clamp)(40===r?i-D:i+D,0,1)})},this._mouseDown=t=>{window.addEventListener("mouseup",this._mouseUp),window.addEventListener("mousemove",this._mouseMove)},this._mouseUp=t=>{window.removeEventListener("mousemove",this._mouseMove),window.removeEventListener("mouseup",this._mouseUp),this._handlePosition(t)},this._mouseMove=(0,S.default)(this._handlePosition,100),this._handleTouch=t=>{this._handlePosition(t.nativeEvent.touches[0])}}render(){const{className:t,hsv:{h:e,s:o,v:n}}=this.props,s=`hsl(${360*e}, 100%, 50%)`;return i.createElement("div",{tabIndex:0,className:r()(E.accessible,t),onKeyDown:this._handleKeyDown},i.createElement("div",{className:E.saturation,style:{backgroundColor:s},ref:this._refContainer,onMouseDown:this._mouseDown,onTouchStart:this._handleTouch,onTouchMove:this._handleTouch},i.createElement("div",{className:E.pointer,style:{left:100*o+"%",top:100*(1-n)+"%"}})))}}var M=o(61483);class W extends i.PureComponent{constructor(){super(...arguments),this._container=null,this._refContainer=t=>{this._container=t},this._handlePosition=t=>{const{hsv:{s:e,v:o},onChange:i}=this.props;if(!i)return;const n=(0,h.ensureNotNull)(this._container).getBoundingClientRect(),r=t.clientY-n.top;i({h:(0,P.clamp)(r/n.height,0,1),s:e,v:o})},this._handleKeyDown=t=>{const{hsv:{h:e,s:o,v:i},onChange:n}=this.props,r=(0,L.hashFromEvent)(t);if(!n||38!==r&&40!==r)return;n({h:(0,P.clamp)(38===r?e-.01:e+.01,0,1),s:o,v:i})},this._mouseDown=t=>{window.addEventListener("mouseup",this._mouseUp),window.addEventListener("mousemove",this._mouseMove)},this._mouseUp=t=>{ +window.removeEventListener("mousemove",this._mouseMove),window.removeEventListener("mouseup",this._mouseUp),this._handlePosition(t)},this._mouseMove=(0,S.default)(this._handlePosition,100),this._handleTouch=t=>{this._handlePosition(t.nativeEvent.touches[0])}}render(){const{className:t,hsv:{h:e}}=this.props;return i.createElement("div",{className:r()(M.hue,M.accessible,t),tabIndex:0,onKeyDown:this._handleKeyDown},i.createElement("div",{className:M.pointerContainer,ref:this._refContainer,onMouseDown:this._mouseDown,onTouchStart:this._handleTouch,onTouchMove:this._handleTouch},i.createElement("div",{className:M.pointer,style:{top:100*e+"%"}})))}}var k=o(55778);const z="#000000",N=s.t(null,{context:"Color Picker"},o(55517));class I extends i.PureComponent{constructor(t){super(t),this._inputRef=i.createRef(),this._handleHSV=t=>{const e=function(t){const{h:e,s:o,v:i}=t;let n,r,s;const a=Math.floor(6*e),l=6*e-a,c=i*(1-o),h=i*(1-l*o),d=i*(1-(1-l)*o);switch(a%6){case 0:n=i,r=d,s=c;break;case 1:n=h,r=i,s=c;break;case 2:n=c,r=i,s=d;break;case 3:n=c,r=h,s=i;break;case 4:n=d,r=c,s=i;break;case 5:n=i,r=c,s=h;break;default:n=0,r=0,s=0}return"#"+[255*n,255*r,255*s].map((t=>("0"+Math.round(t).toString(16)).replace(/.+?([a-f0-9]{2})$/i,"$1"))).join("")}(t)||z;this.setState({color:e,inputColor:R(e),hsv:t}),this.props.onSelect(e)},this._handleInput=t=>{const e=R(t.currentTarget.value);try{const t=x(e),o=`#${e}`;this.setState({color:o,inputColor:e,hsv:t}),this.props.onSelect(o)}catch(t){this.setState({inputColor:e})}},this._handleAddColor=()=>this.props.onAdd(this.state.color);const e=t.color||z;this.state={color:e,inputColor:R(e),hsv:x(e)}}componentDidMount(){d.CheckMobile.any()||this._inputRef.current?.focus()}render(){const{color:t,hsv:e,inputColor:o}=this.state;return i.createElement("div",{className:k.container},i.createElement("div",{className:k.form},i.createElement("div",{className:r()(k.swatch,String(t).toLowerCase()===m.white&&k.white),style:{backgroundColor:t}}),i.createElement("div",{className:k.inputWrap},i.createElement("span",{className:k.inputHash},"#"),i.createElement("input",{ref:this._inputRef,type:"text",className:k.input,value:o,onChange:this._handleInput})),i.createElement("div",{className:k.buttonWrap},i.createElement(T.Button,{size:"s",onClick:this._handleAddColor},N))),i.createElement("div",{className:k.hueSaturationWrap},i.createElement(A,{className:k.saturation,hsv:e,onChange:this._handleHSV}),i.createElement(W,{className:k.hue,hsv:e,onChange:this._handleHSV})))}}function R(t){return t.replace(/^#/,"")}var F=o(30329);const V=s.t(null,{context:"Color Picker"},o(29619)),O=s.t(null,{context:"Color Picker"},o(80936));function H(t){const{color:e,opacity:o,selectCustom:n,selectOpacity:s,customColors:l,onRemoveCustomColor:c,onToggleCustom:h,onOpacityChange:d,menu:u}=t,[p,g]=(0,i.useState)(!1),v="number"==typeof o?o:1,[_,f]=(0,a.useRowsNavigation)();return(0,i.useLayoutEffect)((()=>{u&&u.update()}),[s,u]),p?i.createElement(I,{color:e,onSelect:w,onAdd:function(e){g(!1),h?.(!1);const{onAddColor:o}=t;o&&o(e)} }):i.createElement("div",{className:F.container},i.createElement("div",{ref:_,onKeyDown:f},i.createElement(b,{colors:m.basic,color:e,onSelect:w}),i.createElement(b,{colors:m.extended,color:e,onSelect:w}),i.createElement("div",{className:F.separator}),i.createElement(b,{colors:l,color:e,onSelect:w,onRemoveCustomColor:c},n&&i.createElement(i.Fragment,null,l?.length?i.createElement("button",{title:V,onClick:y,className:r()(F.customButton,F.accessible,"apply-common-tooltip"),tabIndex:-1}):i.createElement("div",{"data-role":"row"},i.createElement("button",{title:V,onClick:y,className:r()(F.customButton,F.accessible,"apply-common-tooltip"),tabIndex:-1}))))),s&&i.createElement(i.Fragment,null,i.createElement("div",{className:F.sectionTitle},O),i.createElement(C.Opacity,{color:e,opacity:v,onChange:function(t){d&&d(t)}})));function w(e){const{onColorChange:o}=t;o&&o(e,p)}function y(t){g(!0),h?.(!0)}}},54368:(t,e,o)=>{"use strict";o.d(e,{Opacity:()=>c});var i=o(50959),n=o(97754),r=o(50151),s=o(77914),a=o(68335),l=o(98182);class c extends i.PureComponent{constructor(t){super(t),this._container=null,this._pointer=null,this._raf=null,this._refContainer=t=>{this._container=t},this._refPointer=t=>{this._pointer=t},this._handlePosition=t=>{null===this._raf&&(this._raf=requestAnimationFrame((()=>{const e=(0,r.ensureNotNull)(this._container),o=(0,r.ensureNotNull)(this._pointer),i=e.getBoundingClientRect(),n=o.offsetWidth,a=t.clientX-n/2-i.left,l=(0,s.clamp)(a/(i.width-n),0,1);this.setState({inputOpacity:Math.round(100*l).toString()}),this.props.onChange(l),this._raf=null})))},this._onSliderClick=t=>{this._handlePosition(t.nativeEvent),this._dragSubscribe()},this._mouseUp=t=>{this.setState({isPointerDragged:!1}),this._dragUnsubscribe(),this._handlePosition(t)},this._mouseMove=t=>{this.setState({isPointerDragged:!0}),this._handlePosition(t)},this._onTouchStart=t=>{this._handlePosition(t.nativeEvent.touches[0])},this._handleTouch=t=>{this.setState({isPointerDragged:!0}),this._handlePosition(t.nativeEvent.touches[0])},this._handleTouchEnd=()=>{this.setState({isPointerDragged:!1})},this._handleInput=t=>{const e=t.currentTarget.value,o=Number(e)/100;this.setState({inputOpacity:e}),Number.isNaN(o)||o>1||this.props.onChange(o)},this._handleKeyDown=t=>{const e=(0,a.hashFromEvent)(t);if(37!==e&&39!==e)return;t.preventDefault();const o=Number(this.state.inputOpacity);37===e&&0!==o&&this._changeOpacity(o-1),39===e&&100!==o&&this._changeOpacity(o+1)},this.state={inputOpacity:Math.round(100*t.opacity).toString(),isPointerDragged:!1}}componentWillUnmount(){null!==this._raf&&(cancelAnimationFrame(this._raf),this._raf=null),this._dragUnsubscribe()}render(){const{color:t,opacity:e,hideInput:o,disabled:r}=this.props,{inputOpacity:s,isPointerDragged:a}=this.state,c={color:t||void 0};return i.createElement("div",{className:l.opacity},i.createElement("div",{className:n(l.opacitySlider,l.accessible),style:c,tabIndex:r?-1:0,ref:this._refContainer,onMouseDown:this._onSliderClick,onTouchStart:this._onTouchStart,onTouchMove:this._handleTouch, onTouchEnd:this._handleTouchEnd,onKeyDown:this._handleKeyDown,"aria-disabled":r},i.createElement("div",{className:l.opacitySliderGradient,style:{backgroundImage:`linear-gradient(90deg, transparent, ${t})`}}),i.createElement("div",{className:l.opacityPointerWrap},i.createElement("div",{className:n(l.pointer,a&&l.dragged),style:{left:100*e+"%"},ref:this._refPointer}))),!o&&i.createElement("div",{className:l.opacityInputWrap},i.createElement("input",{type:"text",className:l.opacityInput,value:s,onChange:this._handleInput}),i.createElement("span",{className:l.opacityInputPercent},"%")))}_dragSubscribe(){const t=(0,r.ensureNotNull)(this._container).ownerDocument;t&&(t.addEventListener("mouseup",this._mouseUp),t.addEventListener("mousemove",this._mouseMove))}_dragUnsubscribe(){const t=(0,r.ensureNotNull)(this._container).ownerDocument;t&&(t.removeEventListener("mousemove",this._mouseMove),t.removeEventListener("mouseup",this._mouseUp))}_changeOpacity(t){this.setState({inputOpacity:t.toString()}),this.props.onChange(t/100)}}},6914:(t,e,o)=>{"use strict";o.d(e,{basic:()=>a,extended:()=>c,white:()=>n});var i=o(58978);const n=i.colorsPalette["color-white"],r=["ripe-red","tan-orange","banana-yellow","iguana-green","minty-green","sky-blue","tv-blue","deep-blue","grapes-purple","berry-pink"],s=[200,300,400,500,600,700,800,900].map((t=>`color-cold-gray-${t}`));s.unshift("color-white"),s.push("color-black"),r.forEach((t=>{s.push(`color-${t}-500`)}));const a=s.map((t=>i.colorsPalette[t])),l=[];[100,200,300,400,700,900].forEach((t=>{r.forEach((e=>{l.push(`color-${e}-${t}`)}))}));const c=l.map((t=>i.colorsPalette[t]))},56512:(t,e,o)=>{"use strict";o.d(e,{useCustomColors:()=>c});var i=o(50959),n=o(1765),r=o(76422);function s(t,e){(0,i.useEffect)((()=>(r.subscribe(t,e,null),()=>{r.unsubscribe(t,e,null)})),[t,e])}var a,l=o(24377);function c(){const[t,e]=(0,i.useState)((0,n.getJSON)("pickerCustomColors",[]));s("add_new_custom_color",(o=>e(h(o,t)))),s("remove_custom_color",(o=>e(d(o,t))));const o=(0,i.useCallback)((e=>{const o=e?(0,l.parseRgb)(e):null;t.some((t=>null!==t&&null!==o&&(0,l.areEqualRgb)((0,l.parseRgb)(t),o)))||(r.emit("add_new_custom_color",e),(0,n.setJSON)("pickerCustomColors",h(e,t)))}),[t]),a=(0,i.useCallback)((e=>{(e>=0||e29&&o.shift(),o}function d(t,e){return e.filter(((e,o)=>t!==o))}!function(t){t.SettingsKey="pickerCustomColors",t.GlobalAddEventName="add_new_custom_color",t.GlobalRemoveEventName="remove_custom_color",t[t.MaxColors=29]="MaxColors"}(a||(a={}))},77975:(t,e,o)=>{"use strict";o.d(e,{useWatchedValueReadonly:()=>n});var i=o(50959);const n=(t,e=!1,o=[])=>{const n="watchedValue"in t?t.watchedValue:void 0,r="defaultValue"in t?t.defaultValue:t.watchedValue.value(),[s,a]=(0,i.useState)(n?n.value():r);return(e?i.useLayoutEffect:i.useEffect)((()=>{if(n){a(n.value());const t=t=>a(t);return n.subscribe(t),()=>n.unsubscribe(t)}return()=>{}}),[n,...o]),s }},84877:(t,e,o)=>{"use strict";o.d(e,{MatchMediaMap:()=>s});var i=o(50959),n=o(66783),r=o.n(n);class s extends i.Component{constructor(t){super(t),this._handleMediaChange=()=>{const t=l(this.state.queries,((t,e)=>e.matches));let e=!1;for(const o in t)if(t.hasOwnProperty(o)&&this.state.matches[o]!==t[o]){e=!0;break}e&&this.setState({matches:t})};const{rules:e}=this.props;this.state=a(e)}shouldComponentUpdate(t,e){return!r()(t,this.props)||(!r()(e.rules,this.state.rules)||!r()(e.matches,this.state.matches))}componentDidMount(){this._migrate(null,this.state.queries)}componentDidUpdate(t,e){r()(t.rules,this.props.rules)||this._migrate(e.queries,this.state.queries)}componentWillUnmount(){this._migrate(this.state.queries,null)}render(){return this.props.children(this.state.matches)}static getDerivedStateFromProps(t,e){if(r()(t.rules,e.rules))return null;const{rules:o}=t;return a(o)}_migrate(t,e){null!==t&&l(t,((t,e)=>{e.removeEventListener("change",this._handleMediaChange)})),null!==e&&l(e,((t,e)=>{e.addEventListener("change",this._handleMediaChange)}))}}function a(t){const e=l(t,((t,e)=>window.matchMedia(e)));return{queries:e,matches:l(e,((t,e)=>e.matches)),rules:{...t}}}function l(t,e){const o={};for(const i in t)t.hasOwnProperty(i)&&(o[i]=e(i,t[i]));return o}},86431:(t,e,o)=>{"use strict";o.d(e,{makeOverlapable:()=>r});var i=o(50959),n=o(65718);function r(t,e){return class extends i.PureComponent{render(){const{isOpened:o,root:r}=this.props;if(!o)return null;const s=i.createElement(t,{...this.props,ref:this.props.componentRef,zIndex:150});return"parent"===r?s:i.createElement(n.Portal,{shouldTrapFocus:e},s)}}}},40173:(t,e,o)=>{"use strict";function i(t,e,o={}){return Object.assign({},t,function(t,e,o={}){const i=Object.assign({},e);for(const n of Object.keys(e)){const r=o[n]||n;r in t&&(i[n]=[t[r],e[n]].join(" "))}return i}(t,e,o))}o.d(e,{mergeThemes:()=>i})},19836:t=>{t.exports={button:"button-KTgbfaP5"}},74163:t=>{t.exports={dots:"dots-meVFo3Y9"}},30476:t=>{t.exports={mobile:"(max-width: 567px)"}},32473:(t,e,o)=>{"use strict";o.d(e,{ToolButton:()=>c});var i=o(50959),n=o(97754),r=o.n(n),s=o(46003);const a=i.forwardRef(((t,e)=>{const{className:o,...n}=t;return i.createElement(s.ToolWidgetButton,{ref:e,className:o,"aria-pressed":n.isActive,isPressed:n.isActive,...n})}));var l=o(19836);const c=(0,i.forwardRef)(((t,e)=>{const{id:o,className:n,icon:c,isActive:h,isGrayed:d,isTransparent:u,onClick:p,buttonHotKey:m,tooltipPosition:g="vertical",tag:v,tabIndex:_,tooltip:f,...w}=t,y="button"===v,b=u?s.ToolWidgetButton:a;return i.createElement(b,{"aria-label":y?f:void 0,...w,id:o,ref:e,className:r()(l.button,n),tag:v,isActive:h,isDisabledAppearance:d,icon:c,onClick:p,forceInteractive:!0,tabIndex:_,"data-tooltip":f,tooltipPosition:g,"data-tooltip-hotkey":m})}))},70173:(t,e,o)=>{"use strict";o.d(e,{drawingToolsIcons:()=>i});const i={SyncDrawing:o(99088),arrow:o(63743),cursor:o(18953),dot:o(72196),demonstration:o(54780),performance:"",drawginmode:o(52459),drawginmodeActive:o(63975),eraser:o(27999),group:o(34059), @@ -16,21 +16,21 @@ d.tool.subscribe(this._onSelectedLinetoolChanged.bind(this))}_createHideToolbarA this._initBackends()}destroy(){this._cleanup();for(const t of this._backends)t.destroy()}updateOptions(t){(0,f.default)(this._options,t)}updateList(){this._cleanup(),this._initBackends()}_initBackends(){for(const t of this._backends)t.destroy();const t=[];this._getAllItems().forEach(((e,o)=>{t.push(new g({handle:e,onDragStart:()=>this._handleDragStart(o),onDragMove:this._handleDragMove,onDragStop:this._handleDragStop,distance:5,rootElement:window.document.documentElement}))})),this._backends=t}_cleanup(){this._getAllItems().forEach((t=>{t.style.transform=""})),this._helper=null,this._items=[]}_getAllItems(){return this._items?.length||(this._items=Array.from(this._options.source.children)),this._items}_updateIdleItemsStateAndPosition(){if(null===this._helper)return;const{axis:t}=this._options,{draggableIndex:e}=this._helper,o=this._getAllItems(),i=o[e].getBoundingClientRect(),n=i.top+i.height/2,r=i.left+i.width/2,s="x"===t?r:n,a=new Set;o.forEach(((o,n)=>{if(e===n)return;const r=o.getBoundingClientRect(),l=r.left+r.width/2,c=r.top+r.height/2,h="x"===t?l:c,d=e>n,u=(0,_.isRtl)();let p;if(p=d?u&&s>=h||!u&&s<=h:u&&s<=h||!u&&s>=h,p){a.add(n);const e=d?u?-1:1:u?1:-1;switch(t){case"x":o.style.transform=`translateX(${e*i.width}px)`;break;case"y":o.style.transform=`translateY(${e*i.height}px)`}}else o.style.transform="",a.delete(n)})),this._helper.movedIndexes=a}_applyNewItemsOrder(){if(null===this._helper)return null;const{draggableIndex:t,movedIndexes:e}=this._helper,o=this._getAllItems(),i=o[t];let n=null;const r=[];o.forEach(((o,i)=>{if(i===t)return;const n=t>i;if(!e.has(i))return void(r[i]=o);r[n?i+1:i-1]=o}));for(let t=0;t{this._options.source.appendChild(t)})),n}}function y(t,e){return parseInt(function(t,e){return getComputedStyle(t,null).getPropertyValue(e)}(t,e))}var b=o(50470),C=o(25388);o(413);const T="floating-toolbar-react-widgets",x=`
${C}
`;class S{constructor(t){this._widget=document.createElement("div"),this._isVertical=!1,this._hiddingTimeoutId=null,this._visibility=new l.WatchedValue(!1),this._windowResizeListener=this._onWindowResize.bind(this),this._reorderedDelegate=new a.Delegate,this._startSortableDelegate=new a.Delegate,this._responsiveResizeFunction=null,this._showTimeStamp=null,this._draggable=null,this._sortable=null,this._preventClickUntilAnimation=t=>{null!==this._showTimeStamp&&performance.now()-this._showTimeStamp{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;const e=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{const t=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={}){const o=this.widgetsCount();if(void 0===e.index&&(e.index=o),e.index<0||e.index>o)throw new Error(`Index must be in [0, ${o}]`);const i=document.createElement("div");i.className="tv-floating-toolbar__widget js-widget",i.appendChild(t);const n=e.index===o?null:this._content.childNodes.item(e.index);this._content.insertBefore(i,n),this._onWindowResize(),this._sortable?.updateList()}getReactWidgetContainer(){return this._reactWidgetsContainer}onWidgetsReordered(){return this._reorderedDelegate}onSortableStart(){return this._startSortableDelegate}removeWidget(t){const e=this._findWrapperForWidget(t);e&&(this._content.removeChild(e),this._onWindowResize(),this._sortable?.updateList())}widgetsCount(){return this._content.childNodes.length}showWidget(t){const e=this._findWrapperForWidget(t);e&&e.classList.remove("i-hidden")}hideWidget(t){const e=this._findWrapperForWidget(t);e&&e.classList.add("i-hidden")}removeWidgets(){ for(;this._content.firstChild;)this._content.removeChild(this._content.firstChild);this._onWindowResize()}onContextMenu(t){if(n.mobiletouch){(new h).load().then((e=>{const o=new e(this._widget);o.get("press").set({time:500}),o.on("press",(e=>{this._preventWidgetTouchEndEvent(),t(e.srcEvent)}))}))}else this._widget.addEventListener("contextmenu",t)}checkPosition(){const t=this._getCorrectedWidgetRect(),e={left:t.left,top:t.top};this._correctPosition(e),t.left===e.left&&t.top===e.top||(this._widget.style.left=e.left+"px",this._widget.style.top=e.top+"px")}_determineCurrentLayoutVertical(t){const e=this._isVertical?t.height:t.width;return window.innerWidtht.left&&(t.left=Math.min(t.left+i,o.left)),n<0?t.top=Math.max(0,window.innerHeight-e.height):o&&o.top>t.top&&(t.top=Math.min(t.top+n,o.top))}_getCorrectedWidgetRect(){const t=this._widget.getBoundingClientRect();if(this._widget.classList.contains("i-closed")){const e=1/.925-1,o=t.width*e,i=t.height*e;return{bottom:t.bottom+i/2,height:t.height+i,left:t.left-o/2,right:t.right+o/2,top:t.top-i/2,width:t.width+o}}return t}_getSavedPosition(){let t;if("device"===this._options.positionStorageType){const e=d.TVLocalStorage.getItem(this._options.positionSettingsKey);t=null!==e?JSON.parse(e):null}else t=(0,s.getJSON)(this._options.positionSettingsKey)??null;return null!==t&&"top"in t&&"left"in t?t:null}_setHiddingTimeout(t){null!==this._hiddingTimeoutId&&clearTimeout(this._hiddingTimeoutId),this._hiddingTimeoutId=t}_preventWidgetTouchEndEvent(){const t=e=>{e.preventDefault(),this._widget.removeEventListener("touchend",t)};this._widget.addEventListener("touchend",t)}_updateLayoutType(){this._widget.classList.toggle("i-vertical",this._isVertical)}_updateAxisOption(){this._sortable&&this._sortable.updateOptions({axis:this._isVertical?"y":"x"})}_onWindowResize(){if("auto"===(this._options.layout||"auto")){const t=this._isVertical,e=this._getCorrectedWidgetRect();this._isVertical=this._determineCurrentLayoutVertical(e),this._updateLayoutType(),t!==this._isVertical&&(this._onVerticalChanged(this._isVertical,t),this._updateAxisOption())}this.checkPosition(),this._resizeResponsive()}_resizeResponsive(){if(null===this._responsiveResizeFunction)return;let t=this._options.layout||"auto";"auto"===t&&(t=this._isVertical?"vertical":"horizontal");const e="vertical"===t?this._widget.clientHeight:this._widget.clientWidth,o=("vertical"===t?window.innerHeight:window.innerWidth)-e;this._responsiveResizeFunction(e,o,t)}_setZIndex(t){this._widget.style.zIndex=String(t)}_zIndex(){return Number(this._widget.style.zIndex)}_loadPosition(){ -const t=this._getSavedPosition()??this._options.defaultPosition;this._widget.style.left=Math.round(t.left)+"px",this._widget.style.top=Math.round(t.top)+"px",this._onWindowResize()}_savePosition(){const t=this._widget.getBoundingClientRect();if("device"===this._options.positionStorageType)try{d.TVLocalStorage.setItem(this._options.positionSettingsKey,JSON.stringify({left:t.left,top:t.top}))}catch{}else(0,s.setJSON)(this._options.positionSettingsKey,{left:t.left,top:t.top})}_init(){this._loadPosition(),this._draggable=new m({source:this._widget,containment:"window",handle:".js-drag",start:i.globalCloseMenu,stop:this._savePosition.bind(this)}),this._initSortable(),this._widget.addEventListener("pointerdown",this.raise.bind(this))}_initSortable(){if(!this._options.allowSortable)return;let t=-1;this._sortable=new w({source:this._content,axis:this._isVertical?"y":"x",start:e=>{(0,i.globalCloseMenu)(),t=e,this._startSortableDelegate.fire(t)},stop:e=>{this._reorderedDelegate.fire(t,e)}})}static _updateAllZIndexes(){S._toolbars.forEach(((t,e)=>{t._setZIndex(S._startZIndex+e)}))}}S._startZIndex=20,S._toolbars=[]},36699:(t,e,o)=>{"use strict";o.r(e),o.d(e,{LineToolPropertiesWidget:()=>Se});var i=o(50959),n=o(32227),r=o(11542),s=o(95804),a=o(37103),l=o(48943),c=o(87465),h=o(78861),d=o(66567),u=o(65045),p=o(97754),m=o.n(p),g=o(50151),v=o(9745),_=o(54374),f=o(43982),w=o(16396),y=o(40173),b=o(78014),C=o(22978),T=o(14631),x=o(6096),S=o(6483),L=o(66611),P=o(79951);const E=(0,y.mergeThemes)(w.DEFAULT_POPUP_MENU_ITEM_THEME,P),B=[{value:1,icon:C},{value:2,icon:T},{value:3,icon:x},{value:4,icon:S}];function D(t){const{multipleProperty:e,title:o,undoText:n,propertyApplier:r,isToolbarFixed:s,className:a,isSmallScreen:l}=t,c=(0,f.useProperty)((0,g.ensureDefined)(e)),h="mixed"===c||!c,d=function(t){const e=B.find((e=>e.value===t));if(!e)return L;return e.icon}(c);return i.createElement(_.ToolWidgetMenu,{className:a,arrow:!1,title:o,"data-name":t["data-name"],menuDataName:`${t["data-name"]}-menu`,verticalDropDirection:s?b.VerticalDropDirection.FromBottomToTop:void 0,horizontalDropDirection:s?b.HorizontalDropDirection.FromRightToLeft:void 0,horizontalAttachEdge:s?b.HorizontalAttachEdge.Right:void 0,verticalAttachEdge:s?b.VerticalAttachEdge.Top:void 0,content:i.createElement("div",null,h?i.createElement("div",{className:P.multiWidth},i.createElement(v.Icon,{icon:L})):i.createElement("div",{className:P.buttonWrap},!l&&i.createElement(v.Icon,{icon:d}),i.createElement("div",{className:p(!l&&P.buttonLabel)},`${c}px`)))},B.map((({value:t,icon:e})=>i.createElement(w.PopupMenuItem,{key:t,theme:E,label:`${t}px`,icon:e,isActive:t===c,onClick:u,onClickArg:t}))));function u(t){t&&e&&(r.beginUndoMacro(n),e.setValue(t,void 0,{applyValue:(t,e)=>{r.setProperty(t,e,n)}}),r.endUndoMacro())}}var M=o(24377),A=o(52859),W=o(56512),k=o(16697),z=o(6914),N=o(37408);function I(t){const{property:e,icon:o,propertyApplier:n,title:r,undoText:s,isToolbarFixed:a,className:l}=t,c=(0,f.useProperty)(e),h=(0,i.useRef)(null),d=c?(0, -M.parseRgba)(c)[3]:void 0,u=""===c,p=String(T()).toLowerCase()===z.white,[w,y,C]=(0,W.useCustomColors)();return i.createElement(_.ToolWidgetMenu,{className:l,verticalDropDirection:a?b.VerticalDropDirection.FromBottomToTop:void 0,horizontalDropDirection:a?b.HorizontalDropDirection.FromLeftToRight:void 0,horizontalAttachEdge:a?b.HorizontalAttachEdge.Left:void 0,verticalAttachEdge:a?b.VerticalAttachEdge.Top:void 0,content:i.createElement("div",{className:N.wrap},i.createElement(v.Icon,{className:N.icon,icon:o}),i.createElement("div",{className:N.colorBg},i.createElement("div",{className:m()(N.color,u&&N.multicolor,p&&N.white),style:u?void 0:{backgroundColor:c}}))),arrow:!1,title:r,ref:h,"data-name":t["data-name"],menuDataName:`${t["data-name"]}-menu`},i.createElement(k.ColorPicker,{color:T(),opacity:d,onColorChange:function(t,e){const o=c?(0,A.alphaToTransparency)((0,M.parseRgba)(c)[3]):0;x((0,A.generateColor)(String(t),o,true)),e||(0,g.ensureNotNull)(h.current).close()},onOpacityChange:function(t){x((0,A.generateColor)(c,(0,A.alphaToTransparency)(t),!0))},selectOpacity:void 0!==d,selectCustom:!0,customColors:w,onAddColor:function(t){y(t),(0,g.ensureNotNull)(h.current).close()},onRemoveCustomColor:C}));function T(){return c?(0,M.rgbToHexString)((0,M.parseRgb)(c)):null}function x(t){n.setProperty(e,t,s)}}var R=o(43337);class F extends R.Property{constructor(t,e,o){super(),this._listenersMappers=[],this._isProcess=!1,this._baseProperty=t,this._propertyApplier=e,this._undoText=o}destroy(){this._baseProperty.destroy(),super.destroy()}value(){return this._baseProperty.value()}setValue(t){this._isProcess=!0,this._baseProperty.setValue(t,void 0,{applyValue:(t,e)=>this._propertyApplier.setProperty(t,e,this._undoText)}),this._isProcess=!1,this._listenersMappers.forEach((t=>{t.method.call(t.obj,this,"")}))}subscribe(t,e){const o=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){const o=(0,g.ensureDefined)(this._listenersMappers.find((o=>o.obj===t&&o.method===e))?.callback);this._baseProperty.unsubscribe(t,o)}unsubscribeAll(t){this._baseProperty.unsubscribeAll(t)}}var V=o(44005),O=o(84877),H=o(35162),Z=o(73986);const K=H.FLOATING_TOOLBAR_REACT_WIDGETS_CLASS+"__button";function U(t){const{templateButton:e,cancelButton:o,propertyButtons:n,commonButtons:r,actionButtons:s,isDrawingFinished:a,isToolbarFixed:l,buttonClassName:c,activeChartWidget:h}=t,d=h.hasModel()&&h.model().selection().dataSources();return d&&d.length?i.createElement(O.MatchMediaMap,{rules:{isSmallWidth:Z.DialogBreakpoints.TabletSmall,isSmallHeight:"(max-height: 440px)"}},(({isSmallWidth:t,isSmallHeight:e})=>i.createElement(i.Fragment,null,u(),a&&i.createElement(i.Fragment,null,Boolean(s.length)&&s.map(((t,e)=>i.createElement(t.component,{...t.props,key:`${t.props.title}_${e}`,className:m()(K,c)}))),Boolean(n.length)&&n.map(((o,n)=>i.createElement(o.component,{...o.props,key:`${o.props.title}_${n}`,className:m()(K,c),isSmallScreen:t||e,isToolbarFixed:l +const t=this._getSavedPosition()??this._options.defaultPosition;this._widget.style.left=Math.round(t.left)+"px",this._widget.style.top=Math.round(t.top)+"px",this._onWindowResize()}_savePosition(){const t=this._widget.getBoundingClientRect();if("device"===this._options.positionStorageType)try{d.TVLocalStorage.setItem(this._options.positionSettingsKey,JSON.stringify({left:t.left,top:t.top}))}catch{}else(0,s.setJSON)(this._options.positionSettingsKey,{left:t.left,top:t.top})}_init(){this._loadPosition(),this._draggable=new m({source:this._widget,containment:"window",handle:".js-drag",start:i.globalCloseMenu,stop:this._savePosition.bind(this)}),this._initSortable(),this._widget.addEventListener("pointerdown",this.raise.bind(this))}_initSortable(){if(!this._options.allowSortable)return;let t=-1;this._sortable=new w({source:this._content,axis:this._isVertical?"y":"x",start:e=>{(0,i.globalCloseMenu)(),t=e,this._startSortableDelegate.fire(t)},stop:e=>{this._reorderedDelegate.fire(t,e)}})}static _updateAllZIndexes(){S._toolbars.forEach(((t,e)=>{t._setZIndex(S._startZIndex+e)}))}}S._startZIndex=20,S._toolbars=[]},36699:(t,e,o)=>{"use strict";o.r(e),o.d(e,{LineToolPropertiesWidget:()=>Le});var i=o(50959),n=o(32227),r=o(11542),s=o(95804),a=o(37103),l=o(48943),c=o(87465),h=o(78861),d=o(66567),u=o(65045),p=o(97754),m=o.n(p),g=o(50151),v=o(9745),_=o(54374),f=o(43982),w=o(16396),y=o(40173),b=o(78014),C=o(22978),T=o(14631),x=o(6096),S=o(6483),L=o(66611),P=o(79951);const E=(0,y.mergeThemes)(w.DEFAULT_POPUP_MENU_ITEM_THEME,P),B=[{value:1,icon:C},{value:2,icon:T},{value:3,icon:x},{value:4,icon:S}];function D(t){const{multipleProperty:e,title:o,undoText:n,propertyApplier:r,isToolbarFixed:s,className:a,isSmallScreen:l}=t,c=(0,f.useProperty)((0,g.ensureDefined)(e)),h="mixed"===c||!c,d=function(t){const e=B.find((e=>e.value===t));if(!e)return L;return e.icon}(c);return i.createElement(_.ToolWidgetMenu,{className:a,arrow:!1,title:o,"data-name":t["data-name"],menuDataName:`${t["data-name"]}-menu`,verticalDropDirection:s?b.VerticalDropDirection.FromBottomToTop:void 0,horizontalDropDirection:s?b.HorizontalDropDirection.FromRightToLeft:void 0,horizontalAttachEdge:s?b.HorizontalAttachEdge.Right:void 0,verticalAttachEdge:s?b.VerticalAttachEdge.Top:void 0,content:i.createElement("div",null,h?i.createElement("div",{className:P.multiWidth},i.createElement(v.Icon,{icon:L})):i.createElement("div",{className:P.buttonWrap},!l&&i.createElement(v.Icon,{icon:d}),i.createElement("div",{className:p(!l&&P.buttonLabel)},`${c}px`)))},B.map((({value:t,icon:e})=>i.createElement(w.PopupMenuItem,{key:t,theme:E,label:`${t}px`,icon:e,isActive:t===c,onClick:u,onClickArg:t}))));function u(t){t&&e&&(r.beginUndoMacro(n),e.setValue(t,void 0,{applyValue:(t,e)=>{r.setProperty(t,e,n)}}),r.endUndoMacro())}}var A=o(24377),M=o(52859),W=o(56512),k=o(16697),z=o(6914),N=o(37408);function I(t){const{property:e,icon:o,propertyApplier:n,title:r,undoText:s,isToolbarFixed:a,className:l}=t,c=(0,f.useProperty)(e),h=(0,i.useRef)(null),d=c?(0, +A.parseRgba)(c)[3]:void 0,u=""===c,p=String(T()).toLowerCase()===z.white,[w,y,C]=(0,W.useCustomColors)();return i.createElement(_.ToolWidgetMenu,{className:l,verticalDropDirection:a?b.VerticalDropDirection.FromBottomToTop:void 0,horizontalDropDirection:a?b.HorizontalDropDirection.FromLeftToRight:void 0,horizontalAttachEdge:a?b.HorizontalAttachEdge.Left:void 0,verticalAttachEdge:a?b.VerticalAttachEdge.Top:void 0,content:i.createElement("div",{className:N.wrap},i.createElement(v.Icon,{className:N.icon,icon:o}),i.createElement("div",{className:N.colorBg},i.createElement("div",{className:m()(N.color,u&&N.multicolor,p&&N.white),style:u?void 0:{backgroundColor:c}}))),arrow:!1,title:r,ref:h,"data-name":t["data-name"],menuDataName:`${t["data-name"]}-menu`},i.createElement(k.ColorPicker,{color:T(),opacity:d,onColorChange:function(t,e){const o=c?(0,M.alphaToTransparency)((0,A.parseRgba)(c)[3]):0;x((0,M.generateColor)(String(t),o,true)),e||(0,g.ensureNotNull)(h.current).close()},onOpacityChange:function(t){x((0,M.generateColor)(c,(0,M.alphaToTransparency)(t),!0))},selectOpacity:void 0!==d,selectCustom:!0,customColors:w,onAddColor:function(t){y(t),(0,g.ensureNotNull)(h.current).close()},onRemoveCustomColor:C}));function T(){return c?(0,A.rgbToHexString)((0,A.parseRgb)(c)):null}function x(t){n.setProperty(e,t,s)}}var R=o(43337);class F extends R.Property{constructor(t,e,o){super(),this._listenersMappers=[],this._isProcess=!1,this._baseProperty=t,this._propertyApplier=e,this._undoText=o}destroy(){this._baseProperty.destroy(),super.destroy()}value(){return this._baseProperty.value()}setValue(t){this._isProcess=!0,this._baseProperty.setValue(t,void 0,{applyValue:(t,e)=>this._propertyApplier.setProperty(t,e,this._undoText)}),this._isProcess=!1,this._listenersMappers.forEach((t=>{t.method.call(t.obj,this,"")}))}subscribe(t,e){const o=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){const o=(0,g.ensureDefined)(this._listenersMappers.find((o=>o.obj===t&&o.method===e))?.callback);this._baseProperty.unsubscribe(t,o)}unsubscribeAll(t){this._baseProperty.unsubscribeAll(t)}}var V=o(44005),O=o(84877),H=o(35162),Z=o(73986);const K=H.FLOATING_TOOLBAR_REACT_WIDGETS_CLASS+"__button";function U(t){const{templateButton:e,cancelButton:o,propertyButtons:n,commonButtons:r,actionButtons:s,isDrawingFinished:a,isToolbarFixed:l,buttonClassName:c,activeChartWidget:h}=t,d=h.hasModel()&&h.model().selection().dataSources();return d&&d.length?i.createElement(O.MatchMediaMap,{rules:{isSmallWidth:Z.DialogBreakpoints.TabletSmall,isSmallHeight:"(max-height: 440px)"}},(({isSmallWidth:t,isSmallHeight:e})=>i.createElement(i.Fragment,null,u(),a&&i.createElement(i.Fragment,null,Boolean(s.length)&&s.map(((t,e)=>i.createElement(t.component,{...t.props,key:`${t.props.title}_${e}`,className:m()(K,c)}))),Boolean(n.length)&&n.map(((o,n)=>i.createElement(o.component,{...o.props,key:`${o.props.title}_${n}`,className:m()(K,c),isSmallScreen:t||e,isToolbarFixed:l }))),Boolean(r.length)&&r.map(((o,n)=>{const r=t||e;return r?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();function u(){return null===e?null:i.createElement(e.component,{...e.props,isToolbarFixed:l,isDrawingFinished:a,className:m()(K,c)})}}var j=o(51768),$=o(21618),G=o(34369);function q(t){const{title:e,activeChartWidget:o,className:n}=t;return i.createElement($.ToolWidgetIconButton,{className:n,icon:G,title:e,onClick:async function(){(0,j.trackEvent)("GUI","Context action on drawings","Settings");const t=o.model().selection().lineDataSources(),e=t.length;1===e?await o.showChartPropertiesForSource(t[0],void 0,{onWidget:o.onWidget()}):e>1&&await o.showChartPropertiesForSources({sources:t})},"data-name":"settings"})}var X=o(32473),Y=o(16465);function J(t){const{className:e,...o}=t;return i.createElement(X.ToolButton,{className:p(e,Y.button),tooltipPosition:"horizontal",...o})}var Q=o(65186),tt=o(91244);function et(t){const{activeChartWidget:e,className:n}=t,s=e.model().selection().lineDataSources();if(0===s.length)return null;const a=s[0].properties().frozen,l=(0,f.useProperty)(a),c=l?{tooltip:r.t(null,void 0,o(99894)),icon:Q}:{tooltip:r.t(null,void 0,o(5837)),icon:tt};return i.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})}var ot=o(43576),it=o(31932),nt=o(84696);function rt(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??new R.Property(!1)),c=(0,ot.usePromise)((async()=>{const{ActionsProvider:t}=await(0,it.actionsProviderModule)();return new t(e).actionForLineTools(s,"Chart.SelectedObject.ToggleAnchored")}),(t=>t?.destroy()),[e,l]);return c?i.createElement(J,{className:n,isActive:Boolean(l),tooltip:r.t(null,void 0,o(74089)),icon:nt.icons.get("Chart.AnchorLineTool"),onClick:()=>c.execute(),"data-name":"toggle-anchor"}):null}var st=o(93544);function at(t){const{title:e,activeChartWidget:o,className:n}=t;return i.createElement($.ToolWidgetIconButton,{className:n,icon:st,title:e,"data-name":"remove",onClick:function(){(0,j.trackEvent)("GUI","Context action on drawings","Remove"),o.removeSelectedSources()}})}var lt=o(49483),ct=o(53054);const ht=lt.CheckMobile.any();function dt(t){if(!ht)return null;const{activeChartWidget:e,className:n}=t,s=e.model().selection().lineDataSources();if(0===s.length)return null;const a=s[0];if(!a.snapTo45DegreesAvailable())return null;const l=(0,f.useProperty)((0,h.alignTo45Degrees)()),c=l?{tooltip:r.t(null,void 0,o(31145)),icon:ct}:{tooltip:r.t(null,void 0,o(83187)),icon:ct};return i.createElement(J,{className:n, -isActive:Boolean(l),onClick:function(){(0,j.trackEvent)("GUI","Context action on drawings","Align to 45 degrees");const t=(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})}var ut=o(98486);function pt(t){const{title:e,activeChartWidget:o,className:n}=t;return i.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()}})}var mt=o(75774),gt=o(32563),vt=o(69451),_t=o(31269),ft=o(68335),wt=o(26709),yt=o(41706);async function bt(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){const i=[],n=ft.isMacKeyboard?" +":"",s=e.filter((t=>t.cloneable()));s.length>0&&i.push(new yt.Action({actionId:"Chart.LineTool.Clone",options:{name:"clone",icon:o(36296),shortcutHint:ft.humanReadableModifiers(wt.Modifiers.Mod)+n+" Drag",label:r.t(null,void 0,o(12537)),onExecute:()=>{t.model().cloneLineTools(s,!1),(0,j.trackEvent)("GUI","Context action on drawings","Clone")}}}));const a=e.filter((t=>t.copiable()));if(a.length>0){const e={name:"copy",label:r.t(null,void 0,o(49680)),shortcutHint:ft.humanReadableModifiers(wt.Modifiers.Mod)+n+" C",onExecute:()=>{t.chartWidgetCollection().clipboard.uiRequestCopy(a)}};i.push(new yt.Action({actionId:"Chart.Clipboard.CopyLineTools",options:e,id:"Copy"}))}return i}(t,e);if(c.length&&l.push(new yt.Separator,...c),e.some((t=>t.isSynchronizable()))){const o=a(t,e);o.length&&l.push(new yt.Separator,...o)}if(1===e.length&&e[0].additionalActions){const o=await e[0].additionalActions(t.model(),"FloatingToolbarButton");o.actions.length&&(l.push(new yt.Separator),l.push(...o.actions))}return l.push(new yt.Separator,s(t,e)),l}var Ct=o(44996);function Tt(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=new t(o),i=a[0],n=s.paneForSource(i);return n?e.contextMenuActionsForSources(a,n):[]}),void 0,[o,a]),u=(0,i.useCallback)((async()=>{if(n)return;const t=await bt(o,a);c(xt(t))}),[n,o,a]),p=(0,i.useCallback)((t=>{if(!n||null===d)return;const e=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", -noMomentumBasedScroll:!0,closeOnEsc:!0},i.createElement(vt.ActionsTable,{parentIsOpened:!0,items:l}))}function xt(t){if(gt.touch&&!window.matchMedia("(pointer:fine)").matches){const e=t.filter((t=>"Copy"!==t.id));if(e.length===t.length)return e;const o=[];return e.forEach((t=>{("separator"!==t.type||o.length>0&&"separator"!==o[o.length-1].type)&&o.push(t)})),o}return t}var St=o(18330),Lt=o(501),Pt=o(23851),Et=o(57740),Bt=o(80427);function Dt(t){const{property:e,propertyApplier:n,title:s,undoText:a,isToolbarFixed:l,className:c}=t,h=(0,f.useProperty)(e),d=(0,i.useMemo)((()=>[new yt.Action({actionId:"Chart.LineTool.Toolbar.ChangeLineStyleToSolid",options:{icon:Lt,label:r.t(null,void 0,o(3554)),active:St.LineStyle.Solid===h,onExecute:()=>n.setProperty(e,St.LineStyle.Solid,a)}}),new yt.Action({actionId:"Chart.LineTool.Toolbar.ChangeLineStyleToDashed",options:{icon:Pt,label:r.t(null,void 0,o(88123)),active:St.LineStyle.Dashed===h,onExecute:()=>n.setProperty(e,St.LineStyle.Dashed,a)}}),new yt.Action({actionId:"Chart.LineTool.Toolbar.ChangeLineStyleToDotted",options:{icon:Et,label:r.t(null,void 0,o(27390)),active:St.LineStyle.Dotted===h,onExecute:()=>n.setProperty(e,St.LineStyle.Dotted,a)}})]),[n,e,h]);return i.createElement(_.ToolWidgetMenu,{className:c,arrow:!1,content:i.createElement(v.Icon,{icon:Mt(h)}),title:s,"data-name":t["data-name"],menuDataName:`${t["data-name"]}-menu`,verticalDropDirection:l?b.VerticalDropDirection.FromBottomToTop:void 0,horizontalDropDirection:l?b.HorizontalDropDirection.FromRightToLeft:void 0,horizontalAttachEdge:l?b.HorizontalAttachEdge.Right:void 0,verticalAttachEdge:l?b.VerticalAttachEdge.Top:void 0},i.createElement(vt.ActionsTable,{items:d}))}function Mt(t){switch(t){case St.LineStyle.Solid:return Lt;case St.LineStyle.Dashed:return Pt;case St.LineStyle.Dotted:return Et;case"mixed":return Bt;default:return""}}const At=[8,10,11,12,14,16,18,20,22,24,28,32,40];function Wt(t){const{property:e,propertyApplier:o,title:n,undoText:r,isToolbarFixed:s,className:a}=t,l=(0,f.useProperty)(e),c=At.map((t=>new yt.Action({actionId:"Chart.LineTool.Toolbar.ChangeFontSizeProperty",options:{label:t.toString(),onExecute:()=>o.setProperty(e,t,r),active:t===l}})));return i.createElement(_.ToolWidgetMenu,{arrow:!1,content:l,className:a,title:n,verticalDropDirection:s?b.VerticalDropDirection.FromBottomToTop:void 0,horizontalDropDirection:s?b.HorizontalDropDirection.FromRightToLeft:void 0,horizontalAttachEdge:s?b.HorizontalAttachEdge.Right:void 0,verticalAttachEdge:s?b.VerticalAttachEdge.Top:void 0,"data-name":t["data-name"],menuDataName:`${t["data-name"]}-menu`},i.createElement(vt.ActionsTable,{items:c}))}var kt=o(9753),zt=o(26610),Nt=o(58570),It=o(11946),Rt=(o(7543),o(81634)),Ft=o(28245),Vt=o(46189);const Ot=(0,y.mergeThemes)(w.DEFAULT_POPUP_MENU_ITEM_THEME,Vt),Ht=[8,12,20,32,48,64,80,96];function Zt(t){const{multipleProperty:e,title:o,undoText:n,propertyApplier:r,isToolbarFixed:s,className:a,isSmallScreen:l}=t,c=(0,f.useProperty)((0,g.ensureDefined)(e));return i.createElement(_.ToolWidgetMenu,{className:a,arrow:!1, -title:o,"data-name":t["data-name"],menuDataName:`${t["data-name"]}-menu`,verticalDropDirection:s?b.VerticalDropDirection.FromBottomToTop:void 0,horizontalDropDirection:s?b.HorizontalDropDirection.FromRightToLeft:void 0,horizontalAttachEdge:s?b.HorizontalAttachEdge.Right:void 0,verticalAttachEdge:s?b.VerticalAttachEdge.Top:void 0,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}))));function h(t){t&&e&&(r.beginUndoMacro(n),e.setValue(t,void 0,{applyValue:(t,e)=>{r.setProperty(t,e,n)}}),r.endUndoMacro())}}function Kt(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)();return new t(e).actionForLineTools(e.model().selection().lineDataSources(),n)}),(t=>t?.destroy()),[e,r]);if(!s)return null;const{label:a,icon:l}=s.options();return i.createElement(J,{className:o,tooltip:a,icon:l,onClick:()=>s.execute(),"data-name":`toggle-insert-cells-button-${n}`})}var Ut=o(5880),jt=o.n(Ut),$t=o(21065),Gt=o.n($t),qt=o(48984),Xt=o.n(qt);const Yt=new s.TranslatedString("change line tool(s) font size",r.t(null,void 0,o(37453))),Jt=new s.TranslatedString("change line tool(s) line style",r.t(null,void 0,o(13423))),Qt=new s.TranslatedString("change line tool(s) line width",r.t(null,void 0,o(81303))),te=new s.TranslatedString("change line tool(s) color",r.t(null,void 0,o(78655))),ee=new s.TranslatedString("change line tool(s) background color",r.t(null,void 0,o(50522))),oe=new s.TranslatedString("change line tool(s) text color",r.t(null,void 0,o(96142))),ie=new s.TranslatedString("line tool(s) line style",r.t(null,{context:"line tool property name"},o(64974))),ne=r.t(null,void 0,o(32514)),re=r.t(null,void 0,o(99919)),se=r.t(null,void 0,o(67410)),ae=r.t(null,void 0,o(4543)),le=r.t(null,void 0,o(37117)),ce=r.t(null,void 0,o(92516)),he=r.t(null,void 0,o(2573)),de=r.t(null,void 0,o(53002)),ue=r.t(null,void 0,o(75056)),pe=r.t(null,void 0,o(11989)),me=r.t(null,void 0,o(14097)),ge=r.t(null,void 0,o(81956)),ve=r.t(null,void 0,o(47370)),_e=r.t(null,void 0,o(77753)),fe=r.t(null,void 0,o(69715)),we=r.t(null,void 0,o(28736)),ye=r.t(null,void 0,o(65086)),be=r.t(null,void 0,o(46193)),Ce=r.t(null,void 0,o(7977)),Te=r.t(null,void 0,o(8111)),xe=lt.CheckMobile.any()||lt.CheckMobile.isIPad();class Se{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,this._floatingToolbar=new H.FloatingToolbar({defaultPosition:{top:kt.HEADER_TOOLBAR_HEIGHT_EXPANDED+15,left:window.innerWidth/2},positionSettingsKey:"properties_toolbar.position",positionStorageType:"device",layout:"horizontal","data-name":"drawing-toolbar"}),this._floatingContainer=this._floatingToolbar.getReactWidgetContainer(),this._selectedLineTool=(0,l.combine)(((...t)=>{this._onToolChanged(h.tool.value())}),h.tool.weakReference(),h.iconTool.weakReference(),h.emojiTool.weakReference()),this._selectedLineDataSourcesSourcesSpawn=(0,l.combine)((t=>t.filter(zt.isLineTool)),this._chartWidgetCollection.selectedSources.weakReference()),this._isToolMovingOrEditingNow=(0,l.combine)(((t,e)=>{this._handleSourceEdit(t||e)}),h.isToolMovingNow.weakReference(),h.isToolEditingNow.weakReference()),this._selectedLineDataSourcesSourcesSpawn.subscribe(this._onSourceChanged.bind(this)),this._chartWidgetCollection.onAboutToBeDestroyed.subscribe(this,this.destroy,!0)}destroy(){this._selectedLineTool.destroy(),this._isToolMovingOrEditingNow.destroy(),this._selectedLineDataSourcesSourcesSpawn.destroy()}async refresh(){await this._onSourceChanged()}hide(){this._propertiesVisible=!1,this._toolbarVisible=!1,this._updateVisibility()}_createWidthsButton(t,e){if(this._lineWidthsProperty&&(this._lineWidthsProperty.destroy(),this._lineWidthsProperty=null),this._lineWidthsProperty=this._createProperty(t,e,"linesWidths",Qt),!this._lineWidthsProperty)return!0;let o=de;if(e){1!==this._selectedLineDataSources().filter((t=>t.properties().linesWidths)).length&&(o=ue)}return this._addPropertyButton({component:D,props:{title:o,property:this._lineWidthsProperty,multipleProperty:this._lineWidthsProperty,propertyApplier:this._propertyApplierImpl(),"data-name":"line-tool-width",undoText:Qt}}),!0}_createColorsButton(t,e){return this._lineColorsProperty&&(this._lineColorsProperty.destroy(),this._lineColorsProperty=null),this._lineColorsProperty=this._createProperty(t,e,"linesColors",te),!this._lineColorsProperty||(this._addPropertyButton({component:I,props:{icon:jt(),title:pe,property:this._lineColorsProperty,propertyApplier:this._propertyApplierImpl(),"data-name":"line-tool-color",undoText:te}}),!0)}_createBackgroundsButton(t,e){return this._backgroundsProperty&&(this._backgroundsProperty.destroy(),this._backgroundsProperty=null),this._backgroundsProperty=this._createProperty(t,e,"backgroundsColors",ee),!this._backgroundsProperty||(this._addPropertyButton({component:I,props:{icon:Gt(),title:me,property:this._backgroundsProperty,propertyApplier:this._propertyApplierImpl(),"data-name":"background-color",undoText:ee}}),!0)}_createTextColorsButton(t,e){return this._textColorsProperty&&(this._textColorsProperty.destroy(),this._textColorsProperty=null),this._textColorsProperty=this._createProperty(t,e,"textsColors",oe),!this._textColorsProperty||(this._addPropertyButton({component:I,props:{icon:Xt(),title:ge,property:this._textColorsProperty, -propertyApplier:this._propertyApplierImpl(),"data-name":"text-color",undoText:oe}}),!0)}_createLineStyleButton(t,e){const o=this._selectedLineDataSources();if(!o.length)return!1;let i,n=this._propertyApplierImpl();if(1===o.length){if(i=o[0].properties().linesStyles||t,!i)return!1}else{const t=o.map((t=>t.properties().linestyle||t.properties().lineStyle||t.properties().linesStyles)).filter(c.notUndefined);if(!t.length)return!1;i=new d.CollectiblePropertyUndoWrapper(new u.LineToolCollectedProperty(t),ie,this._propertyApplierImpl()),n={...n,setProperty:(t,e)=>t.setValue(e)}}return this._addPropertyButton({component:Dt,props:{property:i,title:ce,propertyApplier:n,"data-name":"style",undoText:Jt}}),!0}_createHighlighterWidthsButton(t,e){if(this._highlighterWidthsProperty&&(this._highlighterWidthsProperty.destroy(),this._highlighterWidthsProperty=null),this._highlighterWidthsProperty=this._createProperty(t,e,"widths",Qt)||null,!this._highlighterWidthsProperty)return!0;const o=e&&1!==this._selectedLineDataSources().filter((t=>t.properties().widths)).length?ue:de;return this._addPropertyButton({component:Zt,props:{title:o,multipleProperty:this._highlighterWidthsProperty,propertyApplier:this._propertyApplierImpl(),"data-name":"highlighter-width",undoText:Qt}}),!0}_createFontSizeButton(t,e){const[o]=this._selectedLineDataSources();if(!o)return!1;const i={component:Wt,props:{property:o.properties().fontsize||t,title:he,propertyApplier:this._propertyApplierImpl(),"data-name":"font-size",undoText:Yt}};return this._addPropertyButton(i),!0}async _onToolChanged(t,e){if(this._currentTool=t,await(0,Nt.ensureLineToolLoaded)(t),this._currentTool!==t)return;if(this._isDrawingToolExcludingCustomUrlEventTool(t))return this._isDrawingFinished=!1,this._createCancelButton(),void this._updateVisibility();const o=this._selectedLineDataSources();o.length?(o.length>1&&(this._isDrawingFinished=!0),await this._onSourceChanged(o)):this.hide()}async _onSourceChanged(t=this._selectedLineDataSources()){try{if(!t.length)return this._propertiesVisible=!1,this._toolbarVisible=!1,void this._clearProperties();const e=t.reduce(((t,e)=>t.add(e.toolname)),new Set);if(await Promise.all([...e].map((async t=>(0,Nt.ensureLineToolLoaded)(t)))),t!==this._selectedLineDataSources())return;if(this._createActionCommonButtons(),this._createCommonButtons(),this._createCancelButton(),1===e.size?this._showTemplatesOf({sources:t}):this._templatesButton&&this._clearTemplatesButton(),1===t.length){const[e]=t;e.isAvailableInFloatingWidget()&&this._activeChartWidget().model().model().dataSourceForId(e.id())&&(!e.userEditEnabled()||!(0,It.isLineDrawnWithPressedButton)(e.toolname)&&this._activeChartWidget().model().lineBeingCreated()||(this._isDrawingFinished=!0),this._showPropertiesOf(e.toolname,e.properties(),!0),this._toolbarVisible=!0)}else this._clearProperties(),this._createWidthsButton(void 0,!0),this._createHighlighterWidthsButton(void 0,!0),this._createLineStyleButton(void 0,!0),this._createColorsButton(void 0,!0),this._createBackgroundsButton(void 0,!0), -this._createTextColorsButton(void 0,!0),this._propertiesVisible=!0}finally{this._updateVisibility()}}_propertyApplierImpl(){return this._propertyApplier||(this._propertyApplier=new Rt.PropertyApplierWithoutSavingChart((()=>this._activeChartWidget().model()))),this._propertyApplier}_clearProperties(){this._clearPropertyButtons(),this._lineWidthsProperty&&(this._lineWidthsProperty.destroy(),this._lineWidthsProperty=null),this._lineColorsProperty&&(this._lineColorsProperty.destroy(),this._lineColorsProperty=null),this._textColorsProperty&&(this._textColorsProperty.destroy(),this._textColorsProperty=null),this._backgroundsProperty&&(this._backgroundsProperty.destroy(),this._backgroundsProperty=null),this._highlighterWidthsProperty&&(this._highlighterWidthsProperty.destroy(),this._highlighterWidthsProperty=null)}_addPropertyButton(t){this._propertyButtons.push(t),this._renderFloatingToolbar()}_addCommonButton(t){this._commonButtons.push(t),this._renderFloatingToolbar()}_addActionCommonButton(t){this._actionCommonButtons.push(t),this._renderFloatingToolbar()}_addCancelButton(t){this._cancelButton=t,this._renderFloatingToolbar()}_addTemplatesButton(t){this._templatesButton=t}_renderFloatingToolbar(){null!==this._floatingContainer&&this._activeChartWidget()&&this._activeChartWidget().hasModel()&&(n.render(i.createElement(U,{templateButton:this._templatesButton,cancelButton:this._cancelButton,propertyButtons:this._propertyButtons,commonButtons:this._commonButtons,actionButtons:this._actionCommonButtons,isDrawingFinished:this._isDrawingFinished,activeChartWidget:this._activeChartWidget()}),this._floatingContainer),this._floatingToolbarRendered=!0)}_unmountFloatingToolbar(){null!==this._floatingContainer&&(n.unmountComponentAtNode(this._floatingContainer),this._floatingToolbarRendered=!1)}_clearTemplatesButton(){this._templatesButton=null}_clearPropertyButtons(){this._propertyButtons=[]}_clearCommonButtons(){this._commonButtons=[]}_clearActionCommonButtons(){this._actionCommonButtons=[]}_clearCancelButtons(){this._cancelButton=null}_isToolbarRendered(){return this._floatingToolbarRendered}_createSettingsButton(){const t={component:q,props:{title:ne,activeChartWidget:this._activeChartWidget()}};this._addCommonButton(t)}_createLockButton(){const t={component:et,props:{title:"Lock",activeChartWidget:this._activeChartWidget()}};this._addCommonButton(t)}_createAnchorButton(){const t={component:rt,props:{title:r.t(null,void 0,o(24185)),activeChartWidget:this._activeChartWidget()}};this._addCommonButton(t)}_createAlignTo45DegreesButton(){const t={component:dt,props:{title:re,activeChartWidget:this._activeChartWidget()},showForSmallScreen:!0};this._addCommonButton(t)}_createRemoveButton(){if(xe&&null!==this._currentTool&&(0,It.isLineDrawnWithPressedButton)(this._currentTool))return;const t={component:at,props:{title:se,activeChartWidget:this._activeChartWidget()},showForSmallScreen:!0};this._addCommonButton(t)}_createCancelButton(){if(null!==this._cancelButton&&this._clearCancelButtons(),!xe||null===this._currentTool)return;if(!(0, -It.isLineDrawnWithPressedButton)(this._currentTool))return;const t={component:pt,props:{title:ae,activeChartWidget:this._activeChartWidget()},showForSmallScreen:!0};this._addCancelButton(t)}_createDotsButton(){this._addCommonButton({component:Tt,props:{title:le,activeChartWidget:this._activeChartWidget()},showForSmallScreen:!0})}_createAlertButton(){}_createSourceActions(){this._createLockButton(),this._createAnchorButton()}_createActionCommonButtons(){this._actionCommonButtons.length&&this._clearActionCommonButtons();const t={component:Kt,props:{actionId:"Chart.SelectedObject.InsertColumnTable",activeChartWidget:this._activeChartWidget()}};this._addActionCommonButton(t);const e={component:Kt,props:{actionId:"Chart.SelectedObject.InsertRowTable",activeChartWidget:this._activeChartWidget()}};this._addActionCommonButton(e)}_createCommonButtons(){this._commonButtons.length&&this._clearCommonButtons(),a.enabled("property_pages")&&this._createSettingsButton(),this._createSourceActions(),this._createAlignTo45DegreesButton(),this._createRemoveButton(),this._createDotsButton()}_prepareProperties(t){const e=this._selectedLineDataSources().filter((e=>e.properties()[t]));if(!(e.filter((e=>e.properties()[t].visible())).length<1))return e.map((e=>e.properties()[t])).filter(c.notNull)}_createProperty(t,e,o,i){if(e){const t=this._prepareProperties(o);return t?this._isWidthProperty(t[0])?new F(new u.MultipleLineWidthsProperty(t),this._propertyApplierImpl(),i):new V.CollectibleColorPropertyUndoWrapper(new u.MultipleLineColorsProperty(t),this._propertyApplierImpl(),i):null}return t&&t.visible()?this._isWidthProperty(t)?new u.MultipleLineWidthsProperty([t]):new V.CollectibleColorPropertyDirectWrapper(new u.MultipleLineColorsProperty([t])):null}_shouldShowBackgroundProperty(t){return!t||!t.fillBackground||!!t.fillBackground.value()}_isDrawingToolExcludingCustomUrlEventTool(t){return Boolean(t?.toLowerCase().includes("linetool"))&&"LineToolTweet"!==t&&"LineToolIdea"!==t&&"LineToolImage"!==t}_updateVisibility(){this._isDrawingFinished&&(this._toolbarVisible||this._propertiesVisible)?this._show():this._hide()}_show(){this._updateVisibilityTimeout&&clearTimeout(this._updateVisibilityTimeout),this._updateVisibilityTimeout=setTimeout((()=>{this._renderFloatingToolbar(),this._floatingToolbar.show(),this._floatingToolbar.checkPosition()}),0)}_hide(){this._updateVisibilityTimeout&&clearTimeout(this._updateVisibilityTimeout),this._updateVisibilityTimeout=setTimeout((()=>{(0,zt.unsetNewToolProperties)(!0),this._floatingToolbar.hide(!0),this._isToolbarRendered()&&this._unmountFloatingToolbar(),this._clearProperties(),this._clearCommonButtons(),this._clearActionCommonButtons(),this._clearCancelButtons(),this._clearTemplatesButton(),this._templatesList=void 0}),0),delete this._propertyApplier}_activeChartWidget(){return this._chartWidgetCollection.activeChartWidget.value()}_selectedLineDataSources(){return this._selectedLineDataSourcesSourcesSpawn.value()}_showTemplatesOf(t){}_showPropertiesOf(t,e,o){ -this._toolExceptionCases||(this._toolExceptionCases=this._createToolExceptionCases());const i=this._toolExceptionCases[t]||this._getPossibleProperty(e);if(this._clearProperties(),this._propertiesVisible=!1,i.length)for(let t=0;tt&&t.childs().showImage.value()},{name:"fontSize",factory:this._createFontSizeButton}],LineToolHighlighter:this._highlighterPropertiesExceptionCase()}}_brushPropertiesExceptionCase(){return[this._defaultLinesColorProperty(),{name:"backgroundsColors",factory:this._createBackgroundsButton},{name:"linesWidths",factory:this._createWidthsButton}]}_bezierPropertiesExceptionCases(){ -return[this._defaultLinesColorProperty(),{name:"backgroundsColors",factory:this._createBackgroundsButton,showIf:this._shouldShowBackgroundProperty},{name:"linesWidths",factory:this._createWidthsButton},{name:"linesStyles",factory:this._createLineStyleButton}]}_textPropertiesExceptionCases(){return[{name:"color",title:_e,icon:Xt(),"data-name":"text-color",undoText:oe},{name:"backgroundColor",title:fe,icon:Gt(),"data-name":"background-color",undoText:ee,showIf:this._shouldShowBackgroundProperty},{name:"fontsize",factory:this._createFontSizeButton}]}_rangeExceptionCases(){return[{name:"linecolor",icon:jt(),title:ve,"data-name":"line-tool-color",undoText:te},{name:"backgroundColor",icon:Gt(),title:fe,"data-name":"background-color",undoText:ee,showIf:this._shouldShowBackgroundProperty},{name:"textsColors",factory:this._createTextColorsButton},{name:"linesWidths",factory:this._createWidthsButton}]}_notePropertiesExceptionCases(){return[{name:"markerColor",title:be,icon:jt(),"data-name":"line-tool-color",undoText:te},{name:"textColor",title:_e,icon:Xt(),"data-name":"text-color",undoText:oe},{name:"fontSize",factory:this._createFontSizeButton}]}_riskPropertiesExceptionCases(){return[{name:"textcolor",title:_e,icon:Xt(),"data-name":"text-color",undoText:oe},{name:"profitBackground",title:we,icon:Gt(),"data-name":"background-color",undoText:ee},{name:"stopBackground",title:ye,icon:Gt(),"data-name":"background-color",undoText:ee}]}_pathExceptionCases(){return[this._defaultLinesColorProperty(),{name:"linesWidths",factory:this._createWidthsButton},{name:"lineStyle",factory:this._createLineStyleButton}]}_regressionToolExceptionCases(){return[{name:"linesWidths",factory:this._createWidthsButton}]}_highlighterPropertiesExceptionCase(){return[this._defaultLinesColorProperty(),{name:"widths",factory:this._createHighlighterWidthsButton}]}_isWidthProperty(t){return t instanceof u.LineToolWidthsProperty}_handleSourceEdit(t){h.isDirectionalMovementActive.value()||(t?this._floatingToolbar.hide(!0):this._floatingToolbarRendered&&this._floatingToolbar.show())}}},18117:(t,e,o)=>{"use strict";o.d(e,{lineToolsInfo:()=>w});var i=o(50151),n=o(11542),r=o(61814),s=(o(40167),o(44341)),a=o(70173);const l={SyncDrawing:n.t(null,void 0,o(59377)),arrow:n.t(null,void 0,o(11858)),cursor:n.t(null,void 0,o(6969)),demonstration:n.t(null,void 0,o(14939)),dot:n.t(null,void 0,o(57157)),performance:n.t(null,void 0,o(35553)),drawginmode:n.t(null,void 0,o(99901)),eraser:n.t(null,void 0,o(8727)),group:n.t(null,void 0,o(3154)),hideAllDrawings:n.t(null,void 0,o(52563)),lockAllDrawings:n.t(null,void 0,o(79451)),magnet:n.t(null,void 0,o(81396)),measure:n.t(null,void 0,o(91563)),removeAllDrawingTools:n.t(null,void 0,o(57118)),showObjectsTree:n.t(null,void 0,o(85786)),zoom:n.t(null,void 0,o(55774)),"zoom-out":n.t(null,void 0,o(37310))};var c=o(56876),h=o(68335),d=o(81360);const u=(0,h.humanReadableModifiers)(h.Modifiers.Shift,!1).trim(),p=(0,h.humanReadableModifiers)(h.Modifiers.Alt,!1).trim(),m=(0,h.humanReadableModifiers)(h.Modifiers.Mod,!1).trim(),g={keys:[u], -text:n.t(null,void 0,o(23369))},v={keys:[u],text:n.t(null,void 0,o(13798))},_={keys:[u],text:n.t(null,void 0,o(10539))},f={LineTool5PointsPattern:{},LineToolABCD:{},LineToolArc:{},LineToolArrow:{},LineToolArrowMarkDown:{},LineToolArrowMarkLeft:{},LineToolArrowMarkRight:{},LineToolArrowMarkUp:{},LineToolComment:{},LineToolBarsPattern:{},LineToolBezierCubic:{},LineToolBezierQuadro:{},LineToolBrush:{},LineToolCallout:{},LineToolCircleLines:{},LineToolCypherPattern:{},LineToolDateAndPriceRange:{},LineToolDateRange:{},LineToolDisjointAngle:{hotKey:(0,r.hotKeySerialize)(g)},LineToolElliottCorrection:{},LineToolElliottDoubleCombo:{},LineToolElliottImpulse:{},LineToolElliottTriangle:{},LineToolElliottTripleCombo:{},LineToolEllipse:{hotKey:(0,r.hotKeySerialize)(v)},LineToolExtended:{},LineToolFibChannel:{},LineToolFibCircles:{hotKey:(0,r.hotKeySerialize)(v)},LineToolFibRetracement:{},LineToolFibSpeedResistanceArcs:{},LineToolFibSpeedResistanceFan:{hotKey:(0,r.hotKeySerialize)(_)},LineToolFibSpiral:{},LineToolFibTimeZone:{},LineToolFibWedge:{},LineToolFlagMark:{},LineToolFlatBottom:{hotKey:(0,r.hotKeySerialize)(g)},LineToolAnchoredVWAP:{},LineToolGannComplex:{},LineToolGannFixed:{},LineToolGannFan:{},LineToolGannSquare:{hotKey:(0,r.hotKeySerialize)({keys:[u],text:n.t(null,void 0,o(83042))})},LineToolHeadAndShoulders:{},LineToolHorzLine:{hotKey:(0,r.hotKeySerialize)({keys:[p,"H"],text:"{0} + {1}"})},LineToolHorzRay:{},LineToolIcon:{},LineToolImage:{},LineToolEmoji:{},LineToolSticker:{},LineToolInsidePitchfork:{},LineToolNote:{},LineToolSignpost:{},LineToolParallelChannel:{hotKey:(0,r.hotKeySerialize)(g)},LineToolPitchfan:{},LineToolPitchfork:{},LineToolPolyline:{},LineToolPath:{},LineToolPrediction:{},LineToolPriceLabel:{},LineToolPriceNote:{hotKey:(0,r.hotKeySerialize)(g)},LineToolTextNote:{},LineToolArrowMarker:{},LineToolPriceRange:{},LineToolProjection:{},LineToolRay:{},LineToolRectangle:{hotKey:(0,r.hotKeySerialize)({keys:[u],text:n.t(null,void 0,o(10539))})},LineToolCircle:{},LineToolRegressionTrend:{},LineToolRiskRewardLong:{},LineToolRiskRewardShort:{},LineToolFixedRangeVolumeProfile:{},LineToolRotatedRectangle:{hotKey:(0,r.hotKeySerialize)(g)},LineToolSchiffPitchfork:{},LineToolSchiffPitchfork2:{},LineToolSineLine:{},LineToolText:{},LineToolTextAbsolute:{},LineToolThreeDrivers:{},LineToolTimeCycles:{},LineToolTrendAngle:{hotKey:(0,r.hotKeySerialize)(g)},LineToolTrendBasedFibExtension:{},LineToolTrendBasedFibTime:{},LineToolTrendLine:{hotKey:(0,r.hotKeySerialize)(g)},LineToolInfoLine:{},LineToolTriangle:{},LineToolTrianglePattern:{},LineToolVertLine:{hotKey:(0,r.hotKeySerialize)({keys:[p,"V"],text:"{0} + {1}"})},LineToolCrossLine:{},LineToolHighlighter:{},LineToolGhostFeed:{},LineToolTable:{},SyncDrawing:{iconActive:a.drawingToolsIcons.SyncDrawingActive},arrow:{},cursor:{},dot:{},demonstration:{hotKey:(0,r.hotKeySerialize)({keys:[p],text:n.t(null,void 0,o(42633))})},drawginmode:{iconActive:a.drawingToolsIcons.drawginmodeActive},eraser:{},group:{},hideAllDrawings:{iconActive:a.drawingToolsIcons.hideAllDrawingsActive, -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,void 0,o(92949))})},removeAllDrawingTools:{},showObjectsTree:{},zoom:{},"zoom-out":{}};const w={};Object.entries(f).map((([t,e])=>{const o=s.lineToolsIcons[t]??a.drawingToolsIcons[t];(0,i.assert)(!!o,`Icon is not defined for drawing "${t}"`);const n=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});var i=o(50151),n=o(43337);class r extends n.Property{constructor(t){super(),this._listenersMappers=[],this._isProcess=!1,this._baseProperty=t}destroy(){this._baseProperty.destroy(),super.destroy()}value(){const t=this._baseProperty.value();return"mixed"===t?"":t}visible(){return this._baseProperty.visible()}setValue(t){this._isProcess=!0,this._baseProperty.setValue(""===t?"mixed":t,void 0,{applyValue:this._applyValue.bind(this)}),this._isProcess=!1,this._listenersMappers.forEach((t=>{t.method.call(t.obj,this,"")}))}subscribe(t,e){const o=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){const o=(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)}}class s extends r{constructor(t,e,o){super(t),this._propertyApplier=e,this._undoText=o}_applyValue(t,e){this._propertyApplier.setProperty(t,e,this._undoText)}}class a extends r{_applyValue(t,e){t.setValue(e)}}},66567:(t,e,o)=>{"use strict";o.d(e,{CollectiblePropertyUndoWrapper:()=>l});var i=o(50151),n=o(11542),r=o(95804),s=o(43337);const a=new r.TranslatedString("change {propertyName} property",n.t(null,void 0,o(25167)));class l extends s.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(){return this._baseProperty.value()}setValue(t,e){this._propertyApplier.beginUndoMacro(a.format({propertyName:this._propertyName})),this._isProcess=!0,this._baseProperty.setValue(t,void 0,this._valueApplier),this._isProcess=!1,this._propertyApplier.endUndoMacro(),this._listenersMappers.forEach((t=>{t.method.call(t.obj,this,"")}))}subscribe(t,e){const o=()=>{this._isProcess||e.call(t,this,"")};this._listenersMappers.push({obj:t,method:e,callback:o}),this._baseProperty.subscribe(t,o)}unsubscribe(t,e){const o=(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)}}},6519:(t,e,o)=>{"use strict";o.d(e,{LinetoolsFavoritesStore:()=>c});var i=o(48096),n=o(87465),r=o(1765);const s=["LineToolBalloon","LineToolNoteAbsolute",null,null].filter(n.isExistent),a=!1;var l,c;!function(t){function e(){t.favorites=[];let e=!1;const i=Boolean(void 0===(0,r.getValue)("chart.favoriteDrawings")),l=(0,r.getJSON)("chart.favoriteDrawings",[]);if(0===l.length&&i&&"undefined"!=typeof window){const t=JSON.parse(window.urlParams?.favorites??"{}").drawingTools;t&&Array.isArray(t)&&l.push(...t)}l.forEach(((i,n)=>{const r=i.tool||i;o(r)?s.includes(r)?e=!0:t.favorites.push(r):a&&a.includes(r)&&t.hiddenToolsPositions.set(r,n)})),e&&n(),t.favoritesSynced.fire()}function o(t){return"string"==typeof t&&""!==t&&!(a&&a.includes(t))}function n(e){const o=t.favorites.slice();t.hiddenToolsPositions.forEach(((t,e)=>{o.splice(t,0,e)})),(0,r.setJSON)("chart.favoriteDrawings",o,e)}t.favorites=[],t.favoritesSynced=new i.Delegate,t.hiddenToolsPositions=new Map,t.favoriteIndex=function(e){return t.favorites.indexOf(e)},t.isValidLineToolName=o,t.saveFavorites=n,e(),r.onSync.subscribe(null,e)}(l||(l={})),function(t){function e(t){return l.isValidLineToolName(t)}function o(){return l.favorites.length}function n(t){return-1!==l.favoriteIndex(t)}t.favoriteAdded=new i.Delegate,t.favoriteRemoved=new i.Delegate,t.favoriteMoved=new i.Delegate,t.favoritesSynced=l.favoritesSynced,t.favorites=function(){return l.favorites.slice()},t.isValidLineToolName=e,t.favoritesCount=o,t.favorite=function(t){return t<0||t>=o()?"":l.favorites[t]},t.addFavorite=function(o,i){return!(n(o)||!e(o)||"performance"===o)&&(l.favorites.push(o),l.saveFavorites(i),t.favoriteAdded.fire(o),!0)},t.removeFavorite=function(e,o){const i=l.favoriteIndex(e);if(-1===i)return!1;l.favorites.splice(i,1);const n=l.hiddenToolsPositions;return n.forEach(((t,e)=>{t>i&&n.set(e,t-1)})),l.saveFavorites(o),t.favoriteRemoved.fire(e),!0},t.isFavorite=n,t.moveFavorite=function(i,n,r){if(n<0||n>=o()||!e(i))return!1;const s=l.favoriteIndex(i);if(-1===s||n===s)return!1;const a=l.hiddenToolsPositions;return a.forEach(((t,e)=>{st?t--:nt&&t++,a.set(e,t)})),l.favorites.splice(s,1),l.favorites.splice(n,0,i),l.saveFavorites(r),t.favoriteMoved.fire(i,s,n),!0}}(c||(c={}))},81634:(t,e,o)=>{"use strict";o.d(e,{PropertyApplierWithoutSavingChart:()=>n});var i=o(13896);class n{constructor(t){this._undoModelSupplier=t}setProperty(t,e,o){this._undoModelSupplier().setProperty(t,e,o,i.lineToolsDoNotAffectChartInvalidation)}beginUndoMacro(t){return this._undoModelSupplier().beginUndoMacro(t)}endUndoMacro(){this._undoModelSupplier().endUndoMacro()}setWatchedValue(t,e,o){this._undoModelSupplier().undoHistory().setWatchedValue(t,e,o,i.lineToolsDoNotAffectChartInvalidation)}}},5880:t=>{ +isActive:Boolean(l),onClick:function(){(0,j.trackEvent)("GUI","Context action on drawings","Align to 45 degrees");const t=(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})}var ut=o(98486);function pt(t){const{title:e,activeChartWidget:o,className:n}=t;return i.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()}})}var mt=o(75774),gt=o(32563),vt=o(69451),_t=o(31269),ft=o(68335),wt=o(26709),yt=o(41706);async function bt(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){const i=[],n=ft.isMacKeyboard?" +":"",s=e.filter((t=>t.cloneable()));s.length>0&&i.push(new yt.Action({actionId:"Chart.LineTool.Clone",options:{name:"clone",icon:o(36296),shortcutHint:ft.humanReadableModifiers(wt.Modifiers.Mod)+n+" Drag",label:r.t(null,void 0,o(12537)),onExecute:()=>{t.model().cloneLineTools(s,!1),(0,j.trackEvent)("GUI","Context action on drawings","Clone")}}}));const a=e.filter((t=>t.copiable()));if(a.length>0){const e={name:"copy",label:r.t(null,void 0,o(49680)),shortcutHint:ft.humanReadableModifiers(wt.Modifiers.Mod)+n+" C",onExecute:()=>{t.chartWidgetCollection().clipboard.uiRequestCopy(a)}};i.push(new yt.Action({actionId:"Chart.Clipboard.CopyLineTools",options:e,id:"Copy"}))}return i}(t,e);if(c.length&&l.push(new yt.Separator,...c),e.some((t=>t.isSynchronizable()))){const o=a(t,e);o.length&&l.push(new yt.Separator,...o)}if(1===e.length&&e[0].additionalActions){const o=await e[0].additionalActions(t.model(),"FloatingToolbarButton");o.actions.length&&(l.push(new yt.Separator),l.push(...o.actions))}return l.push(new yt.Separator,s(t,e)),l}var Ct=o(44996);function Tt(t){return i.createElement(xt,{...t})}function xt(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=new t(o),i=a[0],n=s.paneForSource(i);return n?e.contextMenuActionsForSources(a,n):[]}),void 0,[o,a]):null,c=mt.isAnyMobile?null:(0,ot.usePromise)((()=>bt(o,a)),void 0,[o,a]),h=(0,i.useCallback)((t=>{const e=mt.isAnyMobile?l:c;if(null===e)return;const o=St(e);_t.ContextMenuManager.showMenu(o,t,{mode:mt.isAnyMobile?"drawer":"menu","data-name":"more-menu"},{menuName:"LineToolFloatingToolbarMoreMenu"})}),[n,l,c]);return i.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:[]}))}function St(t){ +if(gt.touch&&!window.matchMedia("(pointer:fine)").matches){const e=t.filter((t=>"Copy"!==t.id));if(e.length===t.length)return e;const o=[];return e.forEach((t=>{("separator"!==t.type||o.length>0&&"separator"!==o[o.length-1].type)&&o.push(t)})),o}return t}var Lt=o(18330),Pt=o(501),Et=o(23851),Bt=o(57740),Dt=o(80427);function At(t){const{property:e,propertyApplier:n,title:s,undoText:a,isToolbarFixed:l,className:c}=t,h=(0,f.useProperty)(e),d=(0,i.useMemo)((()=>[new yt.Action({actionId:"Chart.LineTool.Toolbar.ChangeLineStyleToSolid",options:{icon:Pt,label:r.t(null,void 0,o(3554)),active:Lt.LineStyle.Solid===h,onExecute:()=>n.setProperty(e,Lt.LineStyle.Solid,a)}}),new yt.Action({actionId:"Chart.LineTool.Toolbar.ChangeLineStyleToDashed",options:{icon:Et,label:r.t(null,void 0,o(88123)),active:Lt.LineStyle.Dashed===h,onExecute:()=>n.setProperty(e,Lt.LineStyle.Dashed,a)}}),new yt.Action({actionId:"Chart.LineTool.Toolbar.ChangeLineStyleToDotted",options:{icon:Bt,label:r.t(null,void 0,o(27390)),active:Lt.LineStyle.Dotted===h,onExecute:()=>n.setProperty(e,Lt.LineStyle.Dotted,a)}})]),[n,e,h]);return i.createElement(_.ToolWidgetMenu,{className:c,arrow:!1,content:i.createElement(v.Icon,{icon:Mt(h)}),title:s,"data-name":t["data-name"],menuDataName:`${t["data-name"]}-menu`,verticalDropDirection:l?b.VerticalDropDirection.FromBottomToTop:void 0,horizontalDropDirection:l?b.HorizontalDropDirection.FromRightToLeft:void 0,horizontalAttachEdge:l?b.HorizontalAttachEdge.Right:void 0,verticalAttachEdge:l?b.VerticalAttachEdge.Top:void 0},i.createElement(vt.ActionsTable,{items:d}))}function Mt(t){switch(t){case Lt.LineStyle.Solid:return Pt;case Lt.LineStyle.Dashed:return Et;case Lt.LineStyle.Dotted:return Bt;case"mixed":return Dt;default:return""}}const Wt=[8,10,11,12,14,16,18,20,22,24,28,32,40];function kt(t){const{property:e,propertyApplier:o,title:n,undoText:r,isToolbarFixed:s,className:a}=t,l=(0,f.useProperty)(e),c=Wt.map((t=>new yt.Action({actionId:"Chart.LineTool.Toolbar.ChangeFontSizeProperty",options:{label:t.toString(),onExecute:()=>o.setProperty(e,t,r),active:t===l}})));return i.createElement(_.ToolWidgetMenu,{arrow:!1,content:l,className:a,title:n,verticalDropDirection:s?b.VerticalDropDirection.FromBottomToTop:void 0,horizontalDropDirection:s?b.HorizontalDropDirection.FromRightToLeft:void 0,horizontalAttachEdge:s?b.HorizontalAttachEdge.Right:void 0,verticalAttachEdge:s?b.VerticalAttachEdge.Top:void 0,"data-name":t["data-name"],menuDataName:`${t["data-name"]}-menu`},i.createElement(vt.ActionsTable,{items:c}))}var zt=o(9753),Nt=o(26610),It=o(58570),Rt=o(11946),Ft=(o(7543),o(81634)),Vt=o(28245),Ot=o(46189);const Ht=(0,y.mergeThemes)(w.DEFAULT_POPUP_MENU_ITEM_THEME,Ot),Zt=[8,12,20,32,48,64,80,96];function Kt(t){const{multipleProperty:e,title:o,undoText:n,propertyApplier:r,isToolbarFixed:s,className:a,isSmallScreen:l}=t,c=(0,f.useProperty)((0,g.ensureDefined)(e));return i.createElement(_.ToolWidgetMenu,{className:a,arrow:!1,title:o,"data-name":t["data-name"],menuDataName:`${t["data-name"]}-menu`, +verticalDropDirection:s?b.VerticalDropDirection.FromBottomToTop:void 0,horizontalDropDirection:s?b.HorizontalDropDirection.FromRightToLeft:void 0,horizontalAttachEdge:s?b.HorizontalAttachEdge.Right:void 0,verticalAttachEdge:s?b.VerticalAttachEdge.Top:void 0,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}))));function h(t){t&&e&&(r.beginUndoMacro(n),e.setValue(t,void 0,{applyValue:(t,e)=>{r.setProperty(t,e,n)}}),r.endUndoMacro())}}function Ut(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)();return new t(e).actionForLineTools(e.model().selection().lineDataSources(),n)}),(t=>t?.destroy()),[e,r]);if(!s)return null;const{label:a,icon:l}=s.options();return i.createElement(J,{className:o,tooltip:a,icon:l,onClick:()=>s.execute(),"data-name":`toggle-insert-cells-button-${n}`})}var jt=o(5880),$t=o.n(jt),Gt=o(21065),qt=o.n(Gt),Xt=o(48984),Yt=o.n(Xt);const Jt=new s.TranslatedString("change line tool(s) font size",r.t(null,void 0,o(37453))),Qt=new s.TranslatedString("change line tool(s) line style",r.t(null,void 0,o(13423))),te=new s.TranslatedString("change line tool(s) line width",r.t(null,void 0,o(81303))),ee=new s.TranslatedString("change line tool(s) color",r.t(null,void 0,o(78655))),oe=new s.TranslatedString("change line tool(s) background color",r.t(null,void 0,o(50522))),ie=new s.TranslatedString("change line tool(s) text color",r.t(null,void 0,o(96142))),ne=new s.TranslatedString("line tool(s) line style",r.t(null,{context:"line tool property name"},o(64974))),re=r.t(null,void 0,o(32514)),se=r.t(null,void 0,o(99919)),ae=r.t(null,void 0,o(67410)),le=r.t(null,void 0,o(4543)),ce=r.t(null,void 0,o(37117)),he=r.t(null,void 0,o(92516)),de=r.t(null,void 0,o(2573)),ue=r.t(null,void 0,o(53002)),pe=r.t(null,void 0,o(75056)),me=r.t(null,void 0,o(11989)),ge=r.t(null,void 0,o(14097)),ve=r.t(null,void 0,o(81956)),_e=r.t(null,void 0,o(47370)),fe=r.t(null,void 0,o(77753)),we=r.t(null,void 0,o(69715)),ye=r.t(null,void 0,o(28736)),be=r.t(null,void 0,o(65086)),Ce=r.t(null,void 0,o(46193)),Te=r.t(null,void 0,o(7977)),xe=r.t(null,void 0,o(8111)),Se=lt.CheckMobile.any()||lt.CheckMobile.isIPad();class Le{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, +this._floatingToolbar=new H.FloatingToolbar({defaultPosition:{top:zt.HEADER_TOOLBAR_HEIGHT_EXPANDED+15,left:window.innerWidth/2},positionSettingsKey:"properties_toolbar.position",positionStorageType:"device",layout:"horizontal","data-name":"drawing-toolbar"}),this._floatingContainer=this._floatingToolbar.getReactWidgetContainer(),this._selectedLineTool=(0,l.combine)(((...t)=>{this._onToolChanged(h.tool.value())}),h.tool.weakReference(),h.iconTool.weakReference(),h.emojiTool.weakReference()),this._selectedLineDataSourcesSourcesSpawn=(0,l.combine)((t=>t.filter(Nt.isLineTool)),this._chartWidgetCollection.selectedSources.weakReference()),this._isToolMovingOrEditingNow=(0,l.combine)(((t,e)=>{this._handleSourceEdit(t||e)}),h.isToolMovingNow.weakReference(),h.isToolEditingNow.weakReference()),this._selectedLineDataSourcesSourcesSpawn.subscribe(this._onSourceChanged.bind(this)),this._chartWidgetCollection.onAboutToBeDestroyed.subscribe(this,this.destroy,!0)}destroy(){this._selectedLineTool.destroy(),this._isToolMovingOrEditingNow.destroy(),this._selectedLineDataSourcesSourcesSpawn.destroy()}async refresh(){await this._onSourceChanged()}hide(){this._propertiesVisible=!1,this._toolbarVisible=!1,this._updateVisibility()}_createWidthsButton(t,e){if(this._lineWidthsProperty&&(this._lineWidthsProperty.destroy(),this._lineWidthsProperty=null),this._lineWidthsProperty=this._createProperty(t,e,"linesWidths",te),!this._lineWidthsProperty)return!0;let o=ue;if(e){1!==this._selectedLineDataSources().filter((t=>t.properties().linesWidths)).length&&(o=pe)}return this._addPropertyButton({component:D,props:{title:o,property:this._lineWidthsProperty,multipleProperty:this._lineWidthsProperty,propertyApplier:this._propertyApplierImpl(),"data-name":"line-tool-width",undoText:te}}),!0}_createColorsButton(t,e){return this._lineColorsProperty&&(this._lineColorsProperty.destroy(),this._lineColorsProperty=null),this._lineColorsProperty=this._createProperty(t,e,"linesColors",ee),!this._lineColorsProperty||(this._addPropertyButton({component:I,props:{icon:$t(),title:me,property:this._lineColorsProperty,propertyApplier:this._propertyApplierImpl(),"data-name":"line-tool-color",undoText:ee}}),!0)}_createBackgroundsButton(t,e){return this._backgroundsProperty&&(this._backgroundsProperty.destroy(),this._backgroundsProperty=null),this._backgroundsProperty=this._createProperty(t,e,"backgroundsColors",oe),!this._backgroundsProperty||(this._addPropertyButton({component:I,props:{icon:qt(),title:ge,property:this._backgroundsProperty,propertyApplier:this._propertyApplierImpl(),"data-name":"background-color",undoText:oe}}),!0)}_createTextColorsButton(t,e){return this._textColorsProperty&&(this._textColorsProperty.destroy(),this._textColorsProperty=null),this._textColorsProperty=this._createProperty(t,e,"textsColors",ie),!this._textColorsProperty||(this._addPropertyButton({component:I,props:{icon:Yt(),title:ve,property:this._textColorsProperty,propertyApplier:this._propertyApplierImpl(),"data-name":"text-color",undoText:ie}}),!0)}_createLineStyleButton(t,e){ +const o=this._selectedLineDataSources();if(!o.length)return!1;let i,n=this._propertyApplierImpl();if(1===o.length){if(i=o[0].properties().linesStyles||t,!i)return!1}else{const t=o.map((t=>t.properties().linestyle||t.properties().lineStyle||t.properties().linesStyles)).filter(c.notUndefined);if(!t.length)return!1;i=new d.CollectiblePropertyUndoWrapper(new u.LineToolCollectedProperty(t),ne,this._propertyApplierImpl()),n={...n,setProperty:(t,e)=>t.setValue(e)}}return this._addPropertyButton({component:At,props:{property:i,title:he,propertyApplier:n,"data-name":"style",undoText:Qt}}),!0}_createHighlighterWidthsButton(t,e){if(this._highlighterWidthsProperty&&(this._highlighterWidthsProperty.destroy(),this._highlighterWidthsProperty=null),this._highlighterWidthsProperty=this._createProperty(t,e,"widths",te)||null,!this._highlighterWidthsProperty)return!0;const o=e&&1!==this._selectedLineDataSources().filter((t=>t.properties().widths)).length?pe:ue;return this._addPropertyButton({component:Kt,props:{title:o,multipleProperty:this._highlighterWidthsProperty,propertyApplier:this._propertyApplierImpl(),"data-name":"highlighter-width",undoText:te}}),!0}_createFontSizeButton(t,e){const[o]=this._selectedLineDataSources();if(!o)return!1;const i={component:kt,props:{property:o.properties().fontsize||t,title:de,propertyApplier:this._propertyApplierImpl(),"data-name":"font-size",undoText:Jt}};return this._addPropertyButton(i),!0}async _onToolChanged(t,e){if(this._currentTool=t,await(0,It.ensureLineToolLoaded)(t),this._currentTool!==t)return;if(this._isDrawingToolExcludingCustomUrlEventTool(t))return this._isDrawingFinished=!1,this._createCancelButton(),void this._updateVisibility();const o=this._selectedLineDataSources();o.length?(o.length>1&&(this._isDrawingFinished=!0),await this._onSourceChanged(o)):this.hide()}async _onSourceChanged(t=this._selectedLineDataSources()){try{if(!t.length)return this._propertiesVisible=!1,this._toolbarVisible=!1,void this._clearProperties();const e=t.reduce(((t,e)=>t.add(e.toolname)),new Set);if(await Promise.all([...e].map((async t=>(0,It.ensureLineToolLoaded)(t)))),t!==this._selectedLineDataSources())return;if(this._createActionCommonButtons(),this._createCommonButtons(),this._createCancelButton(),1===e.size?this._showTemplatesOf({sources:t}):this._templatesButton&&this._clearTemplatesButton(),1===t.length){const[e]=t;e.isAvailableInFloatingWidget()&&this._activeChartWidget().model().model().dataSourceForId(e.id())&&(!e.userEditEnabled()||!(0,Rt.isLineDrawnWithPressedButton)(e.toolname)&&this._activeChartWidget().model().lineBeingCreated()||(this._isDrawingFinished=!0),this._showPropertiesOf(e.toolname,e.properties(),!0),this._toolbarVisible=!0)}else this._clearProperties(),this._createWidthsButton(void 0,!0),this._createHighlighterWidthsButton(void 0,!0),this._createLineStyleButton(void 0,!0),this._createColorsButton(void 0,!0),this._createBackgroundsButton(void 0,!0),this._createTextColorsButton(void 0,!0),this._propertiesVisible=!0}finally{this._updateVisibility()}}_propertyApplierImpl(){ +return this._propertyApplier||(this._propertyApplier=new Ft.PropertyApplierWithoutSavingChart((()=>this._activeChartWidget().model()))),this._propertyApplier}_clearProperties(){this._clearPropertyButtons(),this._lineWidthsProperty&&(this._lineWidthsProperty.destroy(),this._lineWidthsProperty=null),this._lineColorsProperty&&(this._lineColorsProperty.destroy(),this._lineColorsProperty=null),this._textColorsProperty&&(this._textColorsProperty.destroy(),this._textColorsProperty=null),this._backgroundsProperty&&(this._backgroundsProperty.destroy(),this._backgroundsProperty=null),this._highlighterWidthsProperty&&(this._highlighterWidthsProperty.destroy(),this._highlighterWidthsProperty=null)}_addPropertyButton(t){this._propertyButtons.push(t),this._renderFloatingToolbar()}_addCommonButton(t){this._commonButtons.push(t),this._renderFloatingToolbar()}_addActionCommonButton(t){this._actionCommonButtons.push(t),this._renderFloatingToolbar()}_addCancelButton(t){this._cancelButton=t,this._renderFloatingToolbar()}_addTemplatesButton(t){this._templatesButton=t}_renderFloatingToolbar(){null!==this._floatingContainer&&this._activeChartWidget()&&this._activeChartWidget().hasModel()&&(n.render(i.createElement(U,{templateButton:this._templatesButton,cancelButton:this._cancelButton,propertyButtons:this._propertyButtons,commonButtons:this._commonButtons,actionButtons:this._actionCommonButtons,isDrawingFinished:this._isDrawingFinished,activeChartWidget:this._activeChartWidget()}),this._floatingContainer),this._floatingToolbarRendered=!0)}_unmountFloatingToolbar(){null!==this._floatingContainer&&(n.unmountComponentAtNode(this._floatingContainer),this._floatingToolbarRendered=!1)}_clearTemplatesButton(){this._templatesButton=null}_clearPropertyButtons(){this._propertyButtons=[]}_clearCommonButtons(){this._commonButtons=[]}_clearActionCommonButtons(){this._actionCommonButtons=[]}_clearCancelButtons(){this._cancelButton=null}_isToolbarRendered(){return this._floatingToolbarRendered}_createSettingsButton(){const t={component:q,props:{title:re,activeChartWidget:this._activeChartWidget()}};this._addCommonButton(t)}_createLockButton(){const t={component:et,props:{title:"Lock",activeChartWidget:this._activeChartWidget()}};this._addCommonButton(t)}_createAnchorButton(){const t={component:rt,props:{title:r.t(null,void 0,o(24185)),activeChartWidget:this._activeChartWidget()}};this._addCommonButton(t)}_createAlignTo45DegreesButton(){const t={component:dt,props:{title:se,activeChartWidget:this._activeChartWidget()},showForSmallScreen:!0};this._addCommonButton(t)}_createRemoveButton(){if(Se&&null!==this._currentTool&&(0,Rt.isLineDrawnWithPressedButton)(this._currentTool))return;const t={component:at,props:{title:ae,activeChartWidget:this._activeChartWidget()},showForSmallScreen:!0};this._addCommonButton(t)}_createCancelButton(){if(null!==this._cancelButton&&this._clearCancelButtons(),!Se||null===this._currentTool)return;if(!(0,Rt.isLineDrawnWithPressedButton)(this._currentTool))return;const t={component:pt,props:{title:le, +activeChartWidget:this._activeChartWidget()},showForSmallScreen:!0};this._addCancelButton(t)}_createDotsButton(){this._addCommonButton({component:Tt,props:{title:ce,activeChartWidget:this._activeChartWidget()},showForSmallScreen:!0})}_createAlertButton(){}_createSourceActions(){this._createLockButton(),this._createAnchorButton()}_createActionCommonButtons(){this._actionCommonButtons.length&&this._clearActionCommonButtons();const t={component:Ut,props:{actionId:"Chart.SelectedObject.InsertColumnTable",activeChartWidget:this._activeChartWidget()}};this._addActionCommonButton(t);const e={component:Ut,props:{actionId:"Chart.SelectedObject.InsertRowTable",activeChartWidget:this._activeChartWidget()}};this._addActionCommonButton(e)}_createCommonButtons(){this._commonButtons.length&&this._clearCommonButtons(),a.enabled("property_pages")&&this._createSettingsButton(),this._createSourceActions(),this._createAlignTo45DegreesButton(),this._createRemoveButton(),this._createDotsButton()}_prepareProperties(t){const e=this._selectedLineDataSources().filter((e=>e.properties()[t]));if(!(e.filter((e=>e.properties()[t].visible())).length<1))return e.map((e=>e.properties()[t])).filter(c.notNull)}_createProperty(t,e,o,i){if(e){const t=this._prepareProperties(o);return t?this._isWidthProperty(t[0])?new F(new u.MultipleLineWidthsProperty(t),this._propertyApplierImpl(),i):new V.CollectibleColorPropertyUndoWrapper(new u.MultipleLineColorsProperty(t),this._propertyApplierImpl(),i):null}return t&&t.visible()?this._isWidthProperty(t)?new u.MultipleLineWidthsProperty([t]):new V.CollectibleColorPropertyDirectWrapper(new u.MultipleLineColorsProperty([t])):null}_shouldShowBackgroundProperty(t){return!t||!t.fillBackground||!!t.fillBackground.value()}_isDrawingToolExcludingCustomUrlEventTool(t){return Boolean(t?.toLowerCase().includes("linetool"))&&"LineToolTweet"!==t&&"LineToolIdea"!==t&&"LineToolImage"!==t}_updateVisibility(){this._isDrawingFinished&&(this._toolbarVisible||this._propertiesVisible)?this._show():this._hide()}_show(){this._updateVisibilityTimeout&&clearTimeout(this._updateVisibilityTimeout),this._updateVisibilityTimeout=setTimeout((()=>{this._renderFloatingToolbar(),this._floatingToolbar.show(),this._floatingToolbar.checkPosition()}),0)}_hide(){this._updateVisibilityTimeout&&clearTimeout(this._updateVisibilityTimeout),this._updateVisibilityTimeout=setTimeout((()=>{(0,Nt.unsetNewToolProperties)(!0),this._floatingToolbar.hide(!0),this._isToolbarRendered()&&this._unmountFloatingToolbar(),this._clearProperties(),this._clearCommonButtons(),this._clearActionCommonButtons(),this._clearCancelButtons(),this._clearTemplatesButton(),this._templatesList=void 0}),0),delete this._propertyApplier}_activeChartWidget(){return this._chartWidgetCollection.activeChartWidget.value()}_selectedLineDataSources(){return this._selectedLineDataSourcesSourcesSpawn.value()}_showTemplatesOf(t){}_showPropertiesOf(t,e,o){this._toolExceptionCases||(this._toolExceptionCases=this._createToolExceptionCases()) +;const i=this._toolExceptionCases[t]||this._getPossibleProperty(e);if(this._clearProperties(),this._propertiesVisible=!1,i.length)for(let t=0;tt&&t.childs().showImage.value()},{name:"fontSize",factory:this._createFontSizeButton}],LineToolHighlighter:this._highlighterPropertiesExceptionCase()}}_brushPropertiesExceptionCase(){return[this._defaultLinesColorProperty(),{name:"backgroundsColors",factory:this._createBackgroundsButton},{name:"linesWidths",factory:this._createWidthsButton}]}_bezierPropertiesExceptionCases(){return[this._defaultLinesColorProperty(),{name:"backgroundsColors",factory:this._createBackgroundsButton, +showIf:this._shouldShowBackgroundProperty},{name:"linesWidths",factory:this._createWidthsButton},{name:"linesStyles",factory:this._createLineStyleButton}]}_textPropertiesExceptionCases(){return[{name:"color",title:fe,icon:Yt(),"data-name":"text-color",undoText:ie},{name:"backgroundColor",title:we,icon:qt(),"data-name":"background-color",undoText:oe,showIf:this._shouldShowBackgroundProperty},{name:"fontsize",factory:this._createFontSizeButton}]}_rangeExceptionCases(){return[{name:"linecolor",icon:$t(),title:_e,"data-name":"line-tool-color",undoText:ee},{name:"backgroundColor",icon:qt(),title:we,"data-name":"background-color",undoText:oe,showIf:this._shouldShowBackgroundProperty},{name:"textsColors",factory:this._createTextColorsButton},{name:"linesWidths",factory:this._createWidthsButton}]}_notePropertiesExceptionCases(){return[{name:"markerColor",title:Ce,icon:$t(),"data-name":"line-tool-color",undoText:ee},{name:"textColor",title:fe,icon:Yt(),"data-name":"text-color",undoText:ie},{name:"fontSize",factory:this._createFontSizeButton}]}_riskPropertiesExceptionCases(){return[{name:"textcolor",title:fe,icon:Yt(),"data-name":"text-color",undoText:ie},{name:"profitBackground",title:ye,icon:qt(),"data-name":"background-color",undoText:oe},{name:"stopBackground",title:be,icon:qt(),"data-name":"background-color",undoText:oe}]}_pathExceptionCases(){return[this._defaultLinesColorProperty(),{name:"linesWidths",factory:this._createWidthsButton},{name:"lineStyle",factory:this._createLineStyleButton}]}_regressionToolExceptionCases(){return[{name:"linesWidths",factory:this._createWidthsButton}]}_highlighterPropertiesExceptionCase(){return[this._defaultLinesColorProperty(),{name:"widths",factory:this._createHighlighterWidthsButton}]}_isWidthProperty(t){return t instanceof u.LineToolWidthsProperty}_handleSourceEdit(t){h.isDirectionalMovementActive.value()||(t?this._floatingToolbar.hide(!0):this._floatingToolbarRendered&&this._floatingToolbar.show())}}},18117:(t,e,o)=>{"use strict";o.d(e,{lineToolsInfo:()=>w});var i=o(50151),n=o(11542),r=o(61814),s=(o(40167),o(44341)),a=o(70173);const l={SyncDrawing:n.t(null,void 0,o(59377)),arrow:n.t(null,void 0,o(11858)),cursor:n.t(null,void 0,o(6969)),demonstration:n.t(null,void 0,o(14939)),dot:n.t(null,void 0,o(57157)),performance:n.t(null,void 0,o(35553)),drawginmode:n.t(null,void 0,o(99901)),eraser:n.t(null,void 0,o(8727)),group:n.t(null,void 0,o(3154)),hideAllDrawings:n.t(null,void 0,o(52563)),lockAllDrawings:n.t(null,void 0,o(79451)),magnet:n.t(null,void 0,o(81396)),measure:n.t(null,void 0,o(91563)),removeAllDrawingTools:n.t(null,void 0,o(57118)),showObjectsTree:n.t(null,void 0,o(85786)),zoom:n.t(null,void 0,o(55774)),"zoom-out":n.t(null,void 0,o(37310))};var c=o(56876),h=o(68335),d=o(81360);const u=(0,h.humanReadableModifiers)(h.Modifiers.Shift,!1).trim(),p=(0,h.humanReadableModifiers)(h.Modifiers.Alt,!1).trim(),m=(0,h.humanReadableModifiers)(h.Modifiers.Mod,!1).trim(),g={keys:[u],text:n.t(null,void 0,o(23369))},v={keys:[u],text:n.t(null,void 0,o(13798))},_={keys:[u], +text:n.t(null,void 0,o(10539))},f={LineTool5PointsPattern:{},LineToolABCD:{},LineToolArc:{},LineToolArrow:{},LineToolArrowMarkDown:{},LineToolArrowMarkLeft:{},LineToolArrowMarkRight:{},LineToolArrowMarkUp:{},LineToolComment:{},LineToolBarsPattern:{},LineToolBezierCubic:{},LineToolBezierQuadro:{},LineToolBrush:{},LineToolCallout:{},LineToolCircleLines:{},LineToolCypherPattern:{},LineToolDateAndPriceRange:{},LineToolDateRange:{},LineToolDisjointAngle:{hotKey:(0,r.hotKeySerialize)(g)},LineToolElliottCorrection:{},LineToolElliottDoubleCombo:{},LineToolElliottImpulse:{},LineToolElliottTriangle:{},LineToolElliottTripleCombo:{},LineToolEllipse:{hotKey:(0,r.hotKeySerialize)(v)},LineToolExtended:{},LineToolFibChannel:{},LineToolFibCircles:{hotKey:(0,r.hotKeySerialize)(v)},LineToolFibRetracement:{},LineToolFibSpeedResistanceArcs:{},LineToolFibSpeedResistanceFan:{hotKey:(0,r.hotKeySerialize)(_)},LineToolFibSpiral:{},LineToolFibTimeZone:{},LineToolFibWedge:{},LineToolFlagMark:{},LineToolFlatBottom:{hotKey:(0,r.hotKeySerialize)(g)},LineToolAnchoredVWAP:{},LineToolGannComplex:{},LineToolGannFixed:{},LineToolGannFan:{},LineToolGannSquare:{hotKey:(0,r.hotKeySerialize)({keys:[u],text:n.t(null,void 0,o(83042))})},LineToolHeadAndShoulders:{},LineToolHorzLine:{hotKey:(0,r.hotKeySerialize)({keys:[p,"H"],text:"{0} + {1}"})},LineToolHorzRay:{},LineToolIcon:{},LineToolImage:{},LineToolEmoji:{},LineToolSticker:{},LineToolInsidePitchfork:{},LineToolNote:{},LineToolSignpost:{},LineToolParallelChannel:{hotKey:(0,r.hotKeySerialize)(g)},LineToolPitchfan:{},LineToolPitchfork:{},LineToolPolyline:{},LineToolPath:{},LineToolPrediction:{},LineToolPriceLabel:{},LineToolPriceNote:{hotKey:(0,r.hotKeySerialize)(g)},LineToolTextNote:{},LineToolArrowMarker:{},LineToolPriceRange:{},LineToolProjection:{},LineToolRay:{},LineToolRectangle:{hotKey:(0,r.hotKeySerialize)({keys:[u],text:n.t(null,void 0,o(10539))})},LineToolCircle:{},LineToolRegressionTrend:{},LineToolRiskRewardLong:{},LineToolRiskRewardShort:{},LineToolFixedRangeVolumeProfile:{},LineToolRotatedRectangle:{hotKey:(0,r.hotKeySerialize)(g)},LineToolSchiffPitchfork:{},LineToolSchiffPitchfork2:{},LineToolSineLine:{},LineToolText:{},LineToolTextAbsolute:{},LineToolThreeDrivers:{},LineToolTimeCycles:{},LineToolTrendAngle:{hotKey:(0,r.hotKeySerialize)(g)},LineToolTrendBasedFibExtension:{},LineToolTrendBasedFibTime:{},LineToolTrendLine:{hotKey:(0,r.hotKeySerialize)(g)},LineToolInfoLine:{},LineToolTriangle:{},LineToolTrianglePattern:{},LineToolVertLine:{hotKey:(0,r.hotKeySerialize)({keys:[p,"V"],text:"{0} + {1}"})},LineToolCrossLine:{},LineToolHighlighter:{},LineToolGhostFeed:{},LineToolTable:{},SyncDrawing:{iconActive:a.drawingToolsIcons.SyncDrawingActive},arrow:{},cursor:{},dot:{},demonstration:{hotKey:(0,r.hotKeySerialize)({keys:[p],text:n.t(null,void 0,o(42633))})},drawginmode:{iconActive:a.drawingToolsIcons.drawginmodeActive},eraser:{},group:{},hideAllDrawings:{iconActive:a.drawingToolsIcons.hideAllDrawingsActive,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,void 0,o(92949))})},removeAllDrawingTools:{},showObjectsTree:{},zoom:{},"zoom-out":{}};const w={};Object.entries(f).map((([t,e])=>{const o=s.lineToolsIcons[t]??a.drawingToolsIcons[t];(0,i.assert)(!!o,`Icon is not defined for drawing "${t}"`);const n=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});var i=o(50151),n=o(43337);class r extends n.Property{constructor(t){super(),this._listenersMappers=[],this._isProcess=!1,this._baseProperty=t}destroy(){this._baseProperty.destroy(),super.destroy()}value(){const t=this._baseProperty.value();return"mixed"===t?"":t}visible(){return this._baseProperty.visible()}setValue(t){this._isProcess=!0,this._baseProperty.setValue(""===t?"mixed":t,void 0,{applyValue:this._applyValue.bind(this)}),this._isProcess=!1,this._listenersMappers.forEach((t=>{t.method.call(t.obj,this,"")}))}subscribe(t,e){const o=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){const o=(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)}}class s extends r{constructor(t,e,o){super(t),this._propertyApplier=e,this._undoText=o}_applyValue(t,e){this._propertyApplier.setProperty(t,e,this._undoText)}}class a extends r{_applyValue(t,e){t.setValue(e)}}},66567:(t,e,o)=>{"use strict";o.d(e,{CollectiblePropertyUndoWrapper:()=>l});var i=o(50151),n=o(11542),r=o(95804),s=o(43337);const a=new r.TranslatedString("change {propertyName} property",n.t(null,void 0,o(25167)));class l extends s.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(){return this._baseProperty.value()}setValue(t,e){this._propertyApplier.beginUndoMacro(a.format({propertyName:this._propertyName})),this._isProcess=!0,this._baseProperty.setValue(t,void 0,this._valueApplier),this._isProcess=!1,this._propertyApplier.endUndoMacro(),this._listenersMappers.forEach((t=>{t.method.call(t.obj,this,"")}))}subscribe(t,e){const o=()=>{this._isProcess||e.call(t,this,"")};this._listenersMappers.push({obj:t,method:e,callback:o}),this._baseProperty.subscribe(t,o)}unsubscribe(t,e){const o=(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)}}},6519:(t,e,o)=>{"use strict";o.d(e,{LinetoolsFavoritesStore:()=>c});var i=o(48096),n=o(87465),r=o(1765);const s=["LineToolBalloon","LineToolNoteAbsolute",null,null].filter(n.isExistent),a=!1;var l,c;!function(t){function e(){t.favorites=[];let e=!1;const i=Boolean(void 0===(0,r.getValue)("chart.favoriteDrawings")),l=(0,r.getJSON)("chart.favoriteDrawings",[]);if(0===l.length&&i&&"undefined"!=typeof window){const t=JSON.parse(window.urlParams?.favorites??"{}").drawingTools;t&&Array.isArray(t)&&l.push(...t)}l.forEach(((i,n)=>{const r=i.tool||i;o(r)?s.includes(r)?e=!0:t.favorites.push(r):a&&a.includes(r)&&t.hiddenToolsPositions.set(r,n)})),e&&n(),t.favoritesSynced.fire()}function o(t){return"string"==typeof t&&""!==t&&!(a&&a.includes(t))}function n(e){const o=t.favorites.slice();t.hiddenToolsPositions.forEach(((t,e)=>{o.splice(t,0,e)})),(0,r.setJSON)("chart.favoriteDrawings",o,e)}t.favorites=[],t.favoritesSynced=new i.Delegate,t.hiddenToolsPositions=new Map,t.favoriteIndex=function(e){return t.favorites.indexOf(e)},t.isValidLineToolName=o,t.saveFavorites=n,e(),r.onSync.subscribe(null,e)}(l||(l={})),function(t){function e(t){return l.isValidLineToolName(t)}function o(){return l.favorites.length}function n(t){return-1!==l.favoriteIndex(t)}t.favoriteAdded=new i.Delegate,t.favoriteRemoved=new i.Delegate,t.favoriteMoved=new i.Delegate,t.favoritesSynced=l.favoritesSynced,t.favorites=function(){return l.favorites.slice()},t.isValidLineToolName=e,t.favoritesCount=o,t.favorite=function(t){return t<0||t>=o()?"":l.favorites[t]},t.addFavorite=function(o,i){return!(n(o)||!e(o)||"performance"===o)&&(l.favorites.push(o),l.saveFavorites(i),t.favoriteAdded.fire(o),!0)},t.removeFavorite=function(e,o){const i=l.favoriteIndex(e);if(-1===i)return!1;l.favorites.splice(i,1);const n=l.hiddenToolsPositions;return n.forEach(((t,e)=>{t>i&&n.set(e,t-1)})),l.saveFavorites(o),t.favoriteRemoved.fire(e),!0},t.isFavorite=n,t.moveFavorite=function(i,n,r){if(n<0||n>=o()||!e(i))return!1;const s=l.favoriteIndex(i);if(-1===s||n===s)return!1;const a=l.hiddenToolsPositions;return a.forEach(((t,e)=>{st?t--:nt&&t++,a.set(e,t)})),l.favorites.splice(s,1),l.favorites.splice(n,0,i),l.saveFavorites(r),t.favoriteMoved.fire(i,s,n),!0}}(c||(c={}))},81634:(t,e,o)=>{"use strict";o.d(e,{PropertyApplierWithoutSavingChart:()=>n});var i=o(13896);class n{constructor(t){this._undoModelSupplier=t}setProperty(t,e,o){this._undoModelSupplier().setProperty(t,e,o,i.lineToolsDoNotAffectChartInvalidation)}beginUndoMacro(t){return this._undoModelSupplier().beginUndoMacro(t)}endUndoMacro(){this._undoModelSupplier().endUndoMacro()}setWatchedValue(t,e,o){this._undoModelSupplier().undoHistory().setWatchedValue(t,e,o,i.lineToolsDoNotAffectChartInvalidation)}}},5880:t=>{ t.exports=''},53054:t=>{t.exports=''},98486:t=>{t.exports=''},54780:t=>{t.exports=''},52459:t=>{t.exports=''},63975:t=>{t.exports=''},44996:t=>{ t.exports=''},34059:t=>{t.exports=''},63743:t=>{t.exports=''},18953:t=>{t.exports=''},72196:t=>{t.exports=''},27999:t=>{t.exports=''},10862:t=>{t.exports=''},68385:t=>{t.exports=''},88518:t=>{ t.exports=''},36515:t=>{t.exports=''},7636:t=>{t.exports=''},62567:t=>{t.exports=''},46049:t=>{t.exports=''},99088:t=>{t.exports=''},42650:t=>{ diff --git a/charting_library/bundles/global-search-dialog.f532e65043c071476f6b.js b/charting_library/bundles/global-search-dialog.95f16ea4245f74436891.js similarity index 99% rename from charting_library/bundles/global-search-dialog.f532e65043c071476f6b.js rename to charting_library/bundles/global-search-dialog.95f16ea4245f74436891.js index b92d818a..c884dc62 100644 --- a/charting_library/bundles/global-search-dialog.f532e65043c071476f6b.js +++ b/charting_library/bundles/global-search-dialog.95f16ea4245f74436891.js @@ -3,7 +3,7 @@ disabled:"disabled-ywH2tsV_","intent-danger":"intent-danger-ywH2tsV_",checked:"c "use strict";n.d(t,{CheckboxInput:()=>h});var o=n(50959),s=n(97754),i=n.n(s),l=n(90186),a=n(5811),r=n(62093),c=n.n(r);function h(e){const t=i()(c().wrapper,e.className);return o.createElement("span",{className:t,title:e.title,style:e.style},o.createElement("input",{id:e.id,tabIndex:e.tabIndex,className:i()(e.intent&&c()[e.intent],c().input),type:"checkbox",name:e.name,checked:e.checked,disabled:e.disabled,value:e.value,autoFocus:e.autoFocus,role:e.role,onChange:function(){e.onChange?.(e.value)},ref:e.reference,"aria-required":e["aria-required"],"aria-describedby":e["aria-describedby"],"aria-invalid":e["aria-invalid"],"data-qa-id":e.dataQaId,...(0,l.filterDataProps)(e)}),o.createElement(a.CheckboxView,{className:c().view,indeterminate:e.indeterminate,checked:e.checked,disabled:e.disabled,intent:e.intent,tabIndex:e.tabIndex}))}},5811:(e,t,n)=>{"use strict";n.d(t,{CheckboxView:()=>d});var o=n(50959),s=n(97754),i=n.n(s),l=n(9745),a=n(65890),r=n.n(a),c=n(3260),h=n.n(c);function d(e){const{indeterminate:t,checked:n,tabIndex:s,className:a,disabled:c,disableActiveStyles:d,intent:u,hideIcon:v,...m}=e,p=t||!n||v?"":r(),g=i()(h().box,h()[`intent-${u}`],!t&&h().check,!!t&&h().dot,-1===s&&h().noOutline,a,n&&h().checked,c&&h().disabled,d&&h().disableActiveStyles);return o.createElement("span",{className:g,...m},o.createElement(l.Icon,{icon:p,className:h().icon}))}},43010:(e,t,n)=>{"use strict";n.d(t,{useIsomorphicLayoutEffect:()=>s});var o=n(50959);function s(e,t){("undefined"==typeof window?o.useEffect:o.useLayoutEffect)(e,t)}},27267:(e,t,n)=>{"use strict";function o(e,t,n,o,s){function i(s){if(e>s.timeStamp)return;const i=s.target;void 0!==n&&null!==t&&null!==i&&i.ownerDocument===o&&(t.contains(i)||n(s))}return s.click&&o.addEventListener("click",i,!1),s.mouseDown&&o.addEventListener("mousedown",i,!1),s.touchEnd&&o.addEventListener("touchend",i,!1),s.touchStart&&o.addEventListener("touchstart",i,!1),()=>{o.removeEventListener("click",i,!1),o.removeEventListener("mousedown",i,!1),o.removeEventListener("touchend",i,!1),o.removeEventListener("touchstart",i,!1)}}n.d(t,{addOutsideEventListener:()=>o})},36383:(e,t,n)=>{"use strict";n.d(t,{useOutsideEvent:()=>l});var o=n(50959),s=n(43010),i=n(27267);function l(e){const{click:t,mouseDown:n,touchEnd:l,touchStart:a,handler:r,reference:c}=e,h=(0,o.useRef)(null),d=(0,o.useRef)("undefined"==typeof window?0:new window.CustomEvent("timestamp").timeStamp);return(0,s.useIsomorphicLayoutEffect)((()=>{const e={click:t,mouseDown:n,touchEnd:l,touchStart:a},o=c?c.current:h.current;return(0,i.addOutsideEventListener)(d.current,o,r,document,e)}),[t,n,l,a,r]),c||h}},9745:(e,t,n)=>{"use strict";n.d(t,{Icon:()=>s});var o=n(50959);const s=o.forwardRef(((e,t)=>{const{icon:n="",title:s,ariaLabel:i,ariaLabelledby:l,ariaHidden:a,...r}=e,c=!!(s||i||l);return o.createElement("span",{role:"img",...r,ref:t,"aria-label":i,"aria-labelledby":l,"aria-hidden":a||!c,title:s,dangerouslySetInnerHTML:{__html:n}})}))},26996:(e,t,n)=>{"use strict";n.d(t,{Loader:()=>c});var o,s=n(50959),i=n(97754),l=n.n(i),a=n(49107),r=n.n(a) ;function c(e){const{className:t,size:n="medium",staticPosition:o,color:i="black"}=e,a=l()(r().item,r()[i],r()[n]);return s.createElement("span",{className:l()(r().loader,o&&r().static,t)},s.createElement("span",{className:a}),s.createElement("span",{className:a}),s.createElement("span",{className:a}))}!function(e){e.Medium="medium",e.Small="small"}(o||(o={}))},83021:(e,t,n)=>{"use strict";n.d(t,{SubmenuContext:()=>s,SubmenuHandler:()=>i});var o=n(50959);const s=o.createContext(null);function i(e){const[t,n]=(0,o.useState)(null),i=(0,o.useRef)(null),l=(0,o.useRef)(new Map);return(0,o.useEffect)((()=>()=>{null!==i.current&&clearTimeout(i.current)}),[]),o.createElement(s.Provider,{value:{current:t,setCurrent:function(e){null!==i.current&&(clearTimeout(i.current),i.current=null);null===t?n(e):i.current=setTimeout((()=>{i.current=null,n(e)}),100)},registerSubmenu:function(e,t){return l.current.set(e,t),()=>{l.current.delete(e)}},isSubmenuNode:function(e){return Array.from(l.current.values()).some((t=>t(e)))}}},e.children)}},19250:(e,t,n)=>{"use strict";n.d(t,{Portal:()=>c,PortalContext:()=>h});var o=n(50959),s=n(32227),i=n(25931),l=n(67961),a=n(34811),r=n(99663);class c extends o.PureComponent{constructor(){super(...arguments),this._uuid=(0,i.nanoid)()}componentWillUnmount(){this._manager().removeWindow(this._uuid)}render(){const e=this._manager().ensureWindow(this._uuid,this.props.layerOptions);e.style.top=this.props.top||"",e.style.bottom=this.props.bottom||"",e.style.left=this.props.left||"",e.style.right=this.props.right||"",e.style.pointerEvents=this.props.pointerEvents||"";const t=this.props.className;return t&&("string"==typeof t?e.classList.add(t):e.classList.add(...t)),this.props.shouldTrapFocus&&!e.hasAttribute(a.FOCUS_TRAP_DATA_ATTRIBUTE)&&e.setAttribute(a.FOCUS_TRAP_DATA_ATTRIBUTE,"true"),this.props["aria-hidden"]&&e.setAttribute("aria-hidden","true"),s.createPortal(o.createElement(h.Provider,{value:this},this.props.children),e)}moveToTop(){this._manager().moveToTop(this._uuid)}_manager(){return null===this.context?(0,l.getRootOverlapManager)():this.context}}c.contextType=r.SlotContext;const h=o.createContext(null)},99663:(e,t,n)=>{"use strict";n.d(t,{Slot:()=>s,SlotContext:()=>i});var o=n(50959);class s extends o.Component{shouldComponentUpdate(){return!1}render(){return o.createElement("div",{style:{position:"fixed",zIndex:150,left:0,top:0},ref:this.props.reference})}}const i=o.createContext(null)},67961:(e,t,n)=>{"use strict";n.d(t,{OverlapManager:()=>l,getRootOverlapManager:()=>r});var o=n(50151),s=n(34811);class i{constructor(){this._storage=[]}add(e){this._storage.push(e)}remove(e){this._storage=this._storage.filter((t=>e!==t))}has(e){return this._storage.includes(e)}getItems(){return this._storage}}class l{constructor(e=document){this._storage=new i,this._windows=new Map,this._index=0,this._document=e,this._container=e.createDocumentFragment()}setContainer(e){const t=this._container,n=null===e?this._document.createDocumentFragment():e;!function(e,t){Array.from(e.childNodes).forEach((e=>{ e.nodeType===Node.ELEMENT_NODE&&t.appendChild(e)}))}(t,n),this._container=n}registerWindow(e){this._storage.has(e)||this._storage.add(e)}ensureWindow(e,t={position:"fixed",direction:"normal"}){const n=this._windows.get(e);if(void 0!==n)return n;this.registerWindow(e);const o=this._document.createElement("div");if(o.style.position=t.position,o.style.zIndex=this._index.toString(),o.dataset.id=e,void 0!==t.index){const e=this._container.childNodes.length;if(t.index>=e)this._container.appendChild(o);else if(t.index<=0)this._container.insertBefore(o,this._container.firstChild);else{const e=this._container.childNodes[t.index];this._container.insertBefore(o,e)}}else"reverse"===t.direction?this._container.insertBefore(o,this._container.firstChild):this._container.appendChild(o);return this._windows.set(e,o),++this._index,o}unregisterWindow(e){this._storage.remove(e);const t=this._windows.get(e);void 0!==t&&(null!==t.parentElement&&t.parentElement.removeChild(t),this._windows.delete(e))}getZindex(e){const t=this.ensureWindow(e);return parseInt(t.style.zIndex||"0")}moveLastWindowToTop(){const e=this._storage.getItems(),t=e[e.length-1];t&&this.moveToTop(t)}moveToTop(e){if(this.getZindex(e)!==this._index){const t=this.ensureWindow(e);this._windows.forEach(((e,n)=>{e.hasAttribute(s.FOCUS_TRAP_DATA_ATTRIBUTE)&&e.setAttribute(s.FOCUS_TRAP_DATA_ATTRIBUTE,e===t?"true":"false")})),t.style.zIndex=(++this._index).toString()}}removeWindow(e){this.unregisterWindow(e)}}const a=new WeakMap;function r(e=document){const t=e.getElementById("overlap-manager-root");if(null!==t)return(0,o.ensureDefined)(a.get(t));{const t=new l(e),n=function(e){const t=e.createElement("div");return t.style.position="absolute",t.style.zIndex=150..toString(),t.style.top="0px",t.style.left="0px",t.id="overlap-manager-root",t.dataset.qaId="overlap-manager-root",t}(e);return a.set(n,t),t.setContainer(n),e.body.appendChild(n),t}}var c;!function(e){e[e.BaseZindex=150]="BaseZindex"}(c||(c={}))},99054:(e,t,n)=>{"use strict";n.d(t,{setFixedBodyState:()=>c});const o=(()=>{let e;return()=>{if(void 0===e){const t=document.createElement("div"),n=t.style;n.visibility="hidden",n.width="100px",n.msOverflowStyle="scrollbar",document.body.appendChild(t);const o=t.offsetWidth;t.style.overflow="scroll";const s=document.createElement("div");s.style.width="100%",t.appendChild(s);const i=s.offsetWidth;t.parentNode?.removeChild(t),e=o-i}return e}})();function s(e,t,n){null!==e&&e.style.setProperty(t,n)}function i(e,t){return getComputedStyle(e,null).getPropertyValue(t)}function l(e,t){return parseInt(i(e,t))}let a=0,r=!1;function c(e){const{body:t}=document,n=t.querySelector(".widgetbar-wrap");if(e&&1==++a){const e=i(t,"overflow"),a=l(t,"padding-right");"hidden"!==e.toLowerCase()&&t.scrollHeight>t.offsetHeight&&(s(n,"right",`${o()}px`),t.style.paddingRight=`${a+o()}px`,r=!0),t.classList.add("i-no-scroll")}else if(!e&&a>0&&0==--a&&(t.classList.remove("i-no-scroll"),r)){s(n,"right","0px");let e=0;0,t.scrollHeight<=t.clientHeight&&(e-=o()),t.style.paddingRight=(e<0?0:e)+"px",r=!1}}}, -89324:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Components:()=>h,showDefaultSearchDialog:()=>c,showSymbolSearchItemsDialog:()=>l.showSymbolSearchItemsDialog});var o=n(29803),s=(n(32563),n(4745)),i=n(48961),l=n(1861),a=n(22613),r=n(84015);n(37103),n(49483);!(0,r.isOnMobileAppPage)("any")&&window.matchMedia("(min-width: 602px) and (min-height: 445px)").matches;function c(e){new a.WatchedValue({});const t=(0,i.getSymbolSearchCompleteOverrideFunction)(),{defaultValue:n,showSpreadActions:r,source:c,onSearchComplete:h,trackResultsOptions:d,...u}=e,v={...u,showSpreadActions:r??(0,s.canShowSpreadActions)(),onSymbolFiltersParamsChange:void 0,onSearchComplete:(e,n)=>{t(e[0].symbol,e[0].result).then((e=>{o.linking.setSymbolAndLogInitiator(e.symbol,"symbol search"),h?.(e.symbol)}))},onEmptyResults:void 0};(0,l.showSymbolSearchItemsDialog)({...v,defaultValue:n})}const h={SymbolSearchWatchlistDialogContentItem:null,SymbolSearchWatchlistDialog:null}},1861:(e,t,n)=>{"use strict";n.d(t,{showSymbolSearchItemsDialog:()=>r});var o=n(50959),s=n(50655),i=n(51826),l=n(40336),a=n(87896);function r(e){const{symbolTypeFilter:t,initialMode:n="symbolSearch",autofocus:r=!0,defaultValue:c,showSpreadActions:h,selectSearchOnInit:d,onSearchComplete:u,dialogTitle:v,placeholder:m,fullscreen:p,initialScreen:g,wrapper:b,dialog:f,contentItem:w,onClose:y,onOpen:S,footer:x,symbolTypes:_,searchInput:E,emptyState:C,hideMarkedListFlag:M,dialogWidth:k="auto",manager:I,shouldReturnFocus:T,onSymbolFiltersParamsChange:A,onEmptyResults:D,customSearchSymbols:L,enableOptionsChain:H,disableRecents:R,overrideQueryParams:N,hiddenFilterIds:P,showRecents:O,searchInitiationPoint:z,selectedSymbolSettingsKey:F,filterValuesSettingsKey:B}=e;if(i.dialogsOpenerManager.isOpened("SymbolSearch")||i.dialogsOpenerManager.isOpened("ChangeIntervalDialog"))return;const W=document.createElement("div"),V=o.createElement(s.SlotContext.Provider,{value:I??null},o.createElement(l.SymbolSearchItemsDialog,{symbolTypeFilter:t,onClose:U,initialMode:n,defaultValue:c,showSpreadActions:h,hideMarkedListFlag:M,selectSearchOnInit:d,onSearchComplete:u,dialogTitle:v,placeholder:m,fullscreen:p,initialScreen:g,wrapper:b,dialog:f,contentItem:w,footer:x,symbolTypes:_,searchInput:E,emptyState:C,autofocus:r,dialogWidth:k,shouldReturnFocus:T,onSymbolFiltersParamsChange:A,onEmptyResults:D,customSearchSymbols:L,enableOptionsChain:H,disableRecents:R,overrideQueryParams:N,hiddenFilterIds:P,showRecents:O,searchInitiationPoint:z,selectedSymbolSettingsKey:F,filterValuesSettingsKey:B})),Z=(0,a.createReactRoot)(V,W);function U(){Z.unmount(),i.dialogsOpenerManager.setAsClosed("SymbolSearch"),y&&y()}return i.dialogsOpenerManager.setAsOpened("SymbolSearch"),S&&S(),{close:U}}},11065:(e,t,n)=>{"use strict";n.r(t),n.d(t,{GlobalSearchDialogRenderer:()=>je});var o=n(50959),s=n(60709),i=n(38414),l=n(90484),a=n(11542),r=n(1765),c=n(10087),h=n(87465),d=n(69654),u=n(97754),v=n.n(u),m=n(9745),p=n(24633),g=n(45345),b=n(67562),f=n(66619),w=n(31841);function y(e){ +89324:(e,t,n)=>{"use strict";n.r(t),n.d(t,{Components:()=>h,showDefaultSearchDialog:()=>c,showSymbolSearchItemsDialog:()=>l.showSymbolSearchItemsDialog});var o=n(29803),s=(n(32563),n(4745)),i=n(48961),l=n(1861),a=n(22613),r=n(84015);n(37103),n(49483);!(0,r.isOnMobileAppPage)("any")&&window.matchMedia("(min-width: 602px) and (min-height: 445px)").matches;function c(e){new a.WatchedValue({});const t=(0,i.getSymbolSearchCompleteOverrideFunction)(),{defaultValue:n,showSpreadActions:r,source:c,onSearchComplete:h,trackResultsOptions:d,...u}=e,v={...u,showSpreadActions:r??(0,s.canShowSpreadActions)(),onSymbolFiltersParamsChange:void 0,onSearchComplete:(e,n)=>{t(e[0].symbol,e[0].result).then((e=>{o.linking.setSymbolAndLogInitiator(e.symbol,"symbol search"),h?.(e.symbol)}))},onEmptyResults:void 0};(0,l.showSymbolSearchItemsDialog)({...v,defaultValue:n})}const h={SymbolSearchWatchlistDialogContentItem:null,SymbolSearchWatchlistDialog:null}},1861:(e,t,n)=>{"use strict";n.d(t,{showSymbolSearchItemsDialog:()=>r});var o=n(50959),s=n(50655),i=n(51826),l=n(59071),a=n(87896);function r(e){const{symbolTypeFilter:t,initialMode:n="symbolSearch",autofocus:r=!0,defaultValue:c,showSpreadActions:h,selectSearchOnInit:d,onSearchComplete:u,dialogTitle:v,placeholder:m,fullscreen:p,initialScreen:g,wrapper:b,dialog:f,contentItem:w,onClose:y,onOpen:S,footer:x,symbolTypes:_,searchInput:E,emptyState:C,hideMarkedListFlag:M,dialogWidth:k="auto",manager:I,shouldReturnFocus:T,onSymbolFiltersParamsChange:A,onEmptyResults:D,customSearchSymbols:L,enableOptionsChain:H,disableRecents:R,overrideQueryParams:N,hiddenFilterIds:P,showRecents:O,searchInitiationPoint:z,selectedSymbolSettingsKey:F,filterValuesSettingsKey:B}=e;if(i.dialogsOpenerManager.isOpened("SymbolSearch")||i.dialogsOpenerManager.isOpened("ChangeIntervalDialog"))return;const W=document.createElement("div"),V=o.createElement(s.SlotContext.Provider,{value:I??null},o.createElement(l.SymbolSearchItemsDialog,{symbolTypeFilter:t,onClose:U,initialMode:n,defaultValue:c,showSpreadActions:h,hideMarkedListFlag:M,selectSearchOnInit:d,onSearchComplete:u,dialogTitle:v,placeholder:m,fullscreen:p,initialScreen:g,wrapper:b,dialog:f,contentItem:w,footer:x,symbolTypes:_,searchInput:E,emptyState:C,autofocus:r,dialogWidth:k,shouldReturnFocus:T,onSymbolFiltersParamsChange:A,onEmptyResults:D,customSearchSymbols:L,enableOptionsChain:H,disableRecents:R,overrideQueryParams:N,hiddenFilterIds:P,showRecents:O,searchInitiationPoint:z,selectedSymbolSettingsKey:F,filterValuesSettingsKey:B})),Z=(0,a.createReactRoot)(V,W);function U(){Z.unmount(),i.dialogsOpenerManager.setAsClosed("SymbolSearch"),y&&y()}return i.dialogsOpenerManager.setAsOpened("SymbolSearch"),S&&S(),{close:U}}},11065:(e,t,n)=>{"use strict";n.r(t),n.d(t,{GlobalSearchDialogRenderer:()=>je});var o=n(50959),s=n(60709),i=n(38414),l=n(90484),a=n(11542),r=n(1765),c=n(10087),h=n(87465),d=n(69654),u=n(97754),v=n.n(u),m=n(9745),p=n(24633),g=n(45345),b=n(67562),f=n(66619),w=n(31841);function y(e){ const{text:t,showIcon:n=!0,className:s}=e,i=g.watchedTheme.value()===p.StdTheme.Dark?f:b;return o.createElement("div",{className:u(w.wrap,s)},n&&o.createElement(m.Icon,{icon:i,className:w.image}),o.createElement("span",{className:w.text},t))}var S=n(79418),x=n(55883),_=n(40173),E=n(5304),C=n(10772),M=n(74670),k=n(80329);const I=(0,_.mergeThemes)(E.DEFAUL_CONTEXT_MENU_ITEM_THEME,k);function T(e){const{action:t,onExecute:n}=e,[s,i]=(0,M.useActiveDescendant)(null);return o.createElement(C.ContextMenuAction,{theme:I,onShowSubMenu:x.default,isSubMenuOpened:!1,checkboxInput:!0,reference:s,selected:i,action:t,onExecute:()=>n(t),className:v()("apply-overflow-tooltip","apply-overflow-tooltip-focus","apply-overflow-tooltip--direction_y","apply-overflow-tooltip--check-children-recursively"),"data-overflow-tooltip-text":t.getLabel()})}var A=n(74765);function D(e){const{heading:t,items:n,onExecute:s,getActionIndex:i}=e;return o.createElement("table",{className:A.section},o.createElement("tbody",null,o.createElement("tr",null,o.createElement("td",{className:A.heading},t)),n.map((e=>o.createElement(T,{key:e.id,action:e,onExecute:s,index:i(e)})))))}var L=n(56096);const H=[{name:"drawingsActions",label:a.t(null,void 0,n(74385))},{name:"functionActions",label:a.t(null,void 0,n(83576))},{name:"settingsActions",label:a.t(null,void 0,n(32514))}];function R(e){const{dialogId:t,items:s,onClose:i,shouldReturnFocus:u}=e,[v,m]=(0,o.useState)(""),[p,g]=(0,o.useState)([]),b=(0,o.useRef)(null),f=(0,o.useRef)(null),w=(0,o.useRef)(null);(0,o.useEffect)((()=>{b.current?.focus()}),[]),(0,o.useEffect)((()=>{const e=b.current;if(e)return e.addEventListener("input",N),N(),()=>{e&&e.removeEventListener("input",N)}}),[]);const x=(0,o.useCallback)((0,l.default)((e=>{}),1e3),[]),_=(0,o.useCallback)((0,l.default)(i,200),[]);(0,o.useEffect)((()=>()=>{x.flush(),_.cancel()}),[]);const E=(0,o.useMemo)((()=>{const e=new Set(r.getJSON("GlobalSearchDialog.recent",[])),t=[];for(const n of e){const e=s.find((e=>e.getState().id===n));e&&t.push(e)}return t.reverse(),t}),[]),C=(0,o.useMemo)((()=>H.reduce(((e,t)=>(e.set(t.name,p.filter((e=>e.getState().category===t.name))),e)),new Map)),[p]),{handleKeyDown:M,handleForceFocus:k,handleSearchRefBlur:I,onDialogClick:T,resetFocusState:A}=(0,c.useSearchDialogKeyboardNavigation)({dialogRef:f,searchInputRef:b,contentContainerRef:w,getNextFocusedItemIndex:function(e,t){const n=null===e?1===t?-1:0:e;for(let e=1;e<=p.length;e++){const o=(p.length+e*t+n)%p.length;if(!p[o].isDisabled())return o}return null},isNavigationDisabled:!p.length,scrollToFocusedItem:function(e){e?.scrollIntoView({block:"nearest"})},onEscapeClick:i,getElementIdByIndex:function(e,t){let n=p[e].id;null!=t&&(n+="-favorite");return CSS.escape(n)}});return o.createElement(S.AdaptivePopupDialog,{ref:f,dataName:t,title:a.t(null,void 0,n(79354)),onClose:i,onClickOutside:i,shouldReturnFocus:u,render:()=>o.createElement(o.Fragment,null,o.createElement(d.DialogSearch,{reference:b,onBlur:I}),o.createElement("div",{className:L.wrap,ref:w },v?o.createElement(o.Fragment,null,p.length?H.map((e=>{const t=C.get(e.name);return t&&t.length?o.createElement(D,{key:e.name,heading:e.label,items:t,onExecute:R,getActionIndex:O}):null})):o.createElement(y,{text:a.t(null,void 0,n(47202)),className:L.emptyState})):o.createElement(o.Fragment,null,Boolean(p.length)?o.createElement(D,{heading:a.t(null,void 0,n(76753)),items:p,onExecute:R,getActionIndex:O}):o.createElement(y,{text:a.t(null,void 0,n(27463)),showIcon:!1,className:L.emptyState})))),onKeyDown:M,className:L.dialog,onForceFocus:k,onClick:T,isOpened:!0});function R(e){const t=new Set(r.getJSON("GlobalSearchDialog.recent",[])),n=e.getState().id;t.has(n)&&t.delete(n),t.add(n),r.setJSON("GlobalSearchDialog.recent",Array.from(t).slice(-10)),e.getState().checkable?_():i()}function N(){A();const e=b.current?b.current.value.toLocaleLowerCase().trim():"";if(m(e),e){const t=s.filter((t=>P(t).includes(e)||function(e,t){const{aliases:n}=t.getState();if(n)return n.some((t=>t.toLowerCase().includes(e)));return!1}(e,t))).sort((t=>P(t)===e?-1:0));g(t),t.length||x(e)}else g(E)}function P(e){const{label:t}=e.getState();return(0,h.isString)(t)?t.toLocaleLowerCase():""}function O(e){return p.findIndex((t=>t.id===e.id))}}var N,P=n(68335),O=n(29803),z=n(59613),F=n(29242),B=n(37103),W=n(41706);!function(e){e.Drawings="drawingsActions",e.Function="functionActions",e.Settings="settingsActions"}(N||(N={}));class V extends W.Action{constructor({id:e,category:t,favourite:n,onFavouriteClick:o,hotkeyGroup:s,hotkeyHash:i,aliases:l,optionsLoader:a,onStartListening:r,...c}){super({actionId:"UnknownAction",options:{...c,doNotCloseOnClick:!0},id:e,optionsLoader:a,onStartListening:r}),this.execute=()=>{super.execute()},this.getState=()=>({...super.getState(),id:this._searchOptions.id,category:this._searchOptions.category,favourite:this._searchOptions.favourite,onFavouriteClick:this._onFavouriteClick,aliases:this._searchOptions.aliases}),this.update=e=>{this._searchOptions=Object.assign(this._searchOptions,e),super.update(e)},this._onFavouriteClick=e=>{this._searchOptions.onFavouriteClick&&(this.update({favourite:!this._searchOptions.favourite}),this._searchOptions.onFavouriteClick(e))},this._searchOptions={id:e,category:t,favourite:n,onFavouriteClick:o,aliases:l}}}var Z,U=n(95804),G=n(49483),K=n(33718);!function(e){e.None="all",e.Following="following",e.Private="private"}(Z||(Z={}));var q=n(67455),X=n(54370),J=n(99678),j=n(22489),Q=n(81662),$=n(3615),Y=n(71843);function ee(e){const t=e.match(/^(\d+).(\d+).(\d+)/);if(!t)return null;const[,n,o,s]=t;return[parseInt(n),parseInt(o),parseInt(s)]}function te(e){const t=(0,G.desktopAppVersion)();return!!t&&function(e,t){const n=ee(e),o=ee(t);if(!n||!o)return!1;const[s,i,l]=n,[a,r,c]=o;return s!==a?s{const t=t=>{const o=[];if(t&&t.length&&window.is_authenticated&&t.forEach((t=>{o.push(new V({id:t,category:"settingsActions",label:`${a.t(null,void 0,n(53438))} ${j.translateStdThemeName(t)}`,onExecute:()=>{(0,Y.loadTheme)(e.chartWidgetCollection(),{themeName:t, standardTheme:!1}).then((()=>{e.readOnly()||window.saver.saveChartSilently()}))}}))})),!(0,G.isDesktopApp)()||te("1.0.10")){const[,t]=j.getStdThemeNames();o.push(new V({id:"DarkColorTheme",category:"settingsActions",label:a.t(null,void 0,n(25848)),checkable:!0,checked:j.getCurrentTheme().name===t,onExecute:()=>{!function(e){const t=(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{const e=a.t(null,void 0,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())}}))}return o};return window.is_authenticated?j.getThemeNames().then(t):Promise.resolve(t())};var oe=n(78861),se=n(94322);n(78176);var ie=n(7024),le=n(70173),ae=n(90995);const{DrawingSyncMode:re}=oe,ce={drawings:"ToggleHideAllDrawingTools",indicators:"ToggleHideAllIndicators",positions:"ToggleHideAllPositions",all:"ToggleHideAll"},he=new U.TranslatedString("stay in drawing mode",a.t(null,void 0,n(4114))),de=new U.TranslatedString("sync drawings",a.t(null,void 0,n(94521))),ue=a.t(null,void 0,n(99901)),ve=a.t(null,void 0,n(23391)),me=(a.t(null,void 0,n(93027)),a.t(null,void 0,n(3521)),a.t(null,void 0,n(79451))),pe=a.t(null,void 0,n(3519)),ge=a.t(null,void 0,n(94593));var be=n(84526),fe=n(92572),we=n(89324);class ye extends V{constructor(e){super({label:a.t(null,void 0,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(){return this._model.mainSeries().priceScale().isInverted()}}class Se extends V{constructor(e){super({label:a.t(null,void 0,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(){return this._model.mainSeries().priceScale().isPercentage()}}class xe extends V{constructor(e){super({label:a.t(null,void 0,n(16170)),id:"ToggleLogScale", diff --git a/charting_library/bundles/library.668013b6b41ce2feaa5c.js b/charting_library/bundles/library.022b0cac58461bba6f17.js similarity index 84% rename from charting_library/bundles/library.668013b6b41ce2feaa5c.js rename to charting_library/bundles/library.022b0cac58461bba6f17.js index e30db0ce..153fc40e 100644 --- a/charting_library/bundles/library.668013b6b41ce2feaa5c.js +++ b/charting_library/bundles/library.022b0cac58461bba6f17.js @@ -116,29 +116,29 @@ const i=e.get(o),n=h.abs(i-t);s+=n*n}return s/i},h.percentrank=(e,t)=>{if(h.na(e ;const s=i.new_var(h.high(i)),o=i.new_var(h.low(i));s.get(2*t+1),o.get(2*t+1),this._pivotHigh=new p(t,t,_,s,i),this._pivotLow=new p(t,t,u,o,i),this._lastVal=i.new_var(NaN),this._lastIndex=i.new_var(-1),this._lastType=i.new_var(),this._index=h.n(i),this._isBarClosed=i.symbol.isBarClosed;const n=this._lastIndex.get(1),r=this._lastVal.get(1),a=this._lastType.get(1);this._index>1&&this.addPivot(n,r,a),this.processPivot(this._pivotHigh),this.processPivot(this._pivotLow)}addPivot(e,t,i){this._lastIndex.set(e),this._lastVal.set(t),this._lastType.set(i)}updatePivot(e,t){this._lastIndex.set(e),this._lastVal.set(t)}lastPrice(){return this._lastVal.get()}lastIndex(){return this._lastIndex.get()}addPoint(e,t,i){if(isNaN(this._lastVal.get()))return void this.addPivot(e,t,i);const s=this._lastVal.get();if(this._lastType.get()===i){return void((i===_?t>s:tthis._deviation&&this.addPivot(e,t,i)}processPivot(e){e.update(),this._isBarClosed&&e.isPivotFound()&&this.addPoint(e.pivotIndex(),e.currentValue(),e.pivotType())}}h.vwap=(e,t,i)=>{const s=i.new_var(),o=i.new_var();return t&&(s.reset_hist(),o.reset_hist()),s.set(h.nz(s.get(1))+e.get(0)*h.volume(i)),o.set(h.nz(o.get(1))+h.volume(i)),s.get(0)/o.get(0)},h.vwapBands=(e,t,i,s)=>{const o=s.new_var(),n=s.new_var();t&&(o.reset_hist(),n.reset_hist());const r=e.get(0);let a=h.volume(s),l=r*a;l+=h.nz(o.get(1)),a+=h.nz(n.get(1)),o.set(l),n.set(a);const c=l/a,d=s.new_var();t&&d.reset_hist();let u=h.volume(s)*h.pow(r,2);u+=h.nz(d.get(1)),d.set(u);const _=h.max(u/a-h.pow(c,2),0),p=Math.sqrt(_);return[c,c+p*i,c-p*i]}},34378:(e,t,i)=>{"use strict";i.d(t,{anchoredVWAPStudyItem:()=>r});const s={_metainfoVersion:51,description:"Anchored VWAP",shortDescription:"Anchored VWAP",format:{type:"inherit"},id:"AnchoredVWAP@tv-basicstudies-1",is_hidden_study:!0,is_price_study:!0,defaults:{areaBackground:{backgroundColor:"#4caf50",fillBackground:!0,transparency:95},filledAreasStyle:{Background_1:{fillType:void 0,color:"#4caf50",transparency:95,visible:!0}},inputs:{start_time:0,"Bands Calculation Mode":"Standard Deviation",bands_multiplier:1,bands_multiplier_2:2,bands_multiplier_3:3,calculate_stDev:!0,calculate_stDev_2:!1,calculate_stDev_3:!1,source:"hlc3"},styles:{VWAP:{color:"#1e88e5",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,display:15},LowerBand:{display:15,color:"#4caf50",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0},LowerBand_2:{display:15,color:"#808000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0},LowerBand_3:{display:15,color:"#00897b",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0},UpperBand:{display:15,color:"#4caf50",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0},UpperBand_2:{display:15,color:"#808000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0},UpperBand_3:{display:15,color:"#00897b",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0}}},inputs:[{defval:0,id:"start_time",isHidden:!0,max:Number.MAX_SAFE_INTEGER, 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}]};var o=i(50151),n=i(19979);const r={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(void 0===i)return[NaN];(0,o.assert)(e.symbol.time===i.time);const s=i.time;if(s&&s{"use strict" ;i.d(t,{inactivityGapsStudyItem:()=>d});var s=i(47312),o=i(51101),n=i(51829),r=i(99955),a=i(37236),l=i(50151),c=i(19979);const h={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};const d={name:"InactivityGaps",metainfo:h,constructor:class{constructor(){this._lastRange=null,this._range={from:null,to:null}}init(e,t){const i=t(0);"string"!=typeof i&&c.Std.error(`Unexpected non-string value for ${h.inputs[0].name}`),this._displaySession=i,this._range={from:null,to:null},this._lastRange=null;const n=e.symbol.info;if(void 0===n)return;const r="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){const i=e.symbol,s=c.Std.time(e);if("number"==typeof s&&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};const t=(0,r.extrapolateBarsFrontToTime)(this._extrapolationBarBuilder,this._range.from,this._range.to,1/0,!0).times;for(let s=0;s{"use strict";i.d(t,{overlayStudyItem:()=>n});var s=i(19979),o=i(37103);const n={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;const i=!this._extendTimeScaleFeatureEnabled||!0!==t(1),o=this._context.new_unlimited_var(this._context.symbol.time);this._context.select_sym(1);const n=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));return i?(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});var s,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={}));class d{constructor(){this.p=NaN,this.r1=NaN,this.s1=NaN,this.r2=NaN,this.s2=NaN,this.r3=NaN,this.s3=NaN,this.r4=NaN,this.s4=NaN,this.r5=NaN,this.s5=NaN,this.startIndex__t=NaN,this.endIndex__t=NaN}}class u{constructor(){this.pivots=[]}}function _(e,t){let i;switch(t){case"Auto":i=function(e){const t=l.Interval.parse(e.interval+e.resolution);switch(t.kind()){case l.ResolutionKind.Weeks:case l.ResolutionKind.Months:return"12M";case l.ResolutionKind.Days:return"1M";case l.ResolutionKind.Minutes:return t.multiplier()>=1&&t.multiplier()<=15?"1D":"1W";case l.ResolutionKind.Seconds:case l.ResolutionKind.Ticks:return"1D"}throw new Error("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:throw new Error("No such pivTimeFrame: "+t)}const s="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}const p={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;const i=t(0),s=t(1),o=t(2),a=t(3);this._data=new u,this._firstMainSeriesBarTime=NaN,this._kindPP=function(e){switch(e){case"Traditional":return 0;case"Fibonacci":return 1;case"Woodie":return 2;case"Classic":return 3;case"DeMark":return 4;case"Camarilla":return 5;case"Floor":return 6;default:throw new Error("Unknown kind "+e)}}(i),this._showHistoricalPivots=s,this._historicalPivotsToKeep=a,this._pivTimeFrame=o;const l=t(4);let c;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)return null;if(e.is_main_symbol(i))return isNaN(this._firstMainSeriesBarTime)&&(this._firstMainSeriesBarTime=e.symbol.time,this._removeUnusedPivots()),e.symbol.isLastBar&&e.symbol.isNewBar?this._createResponse():null;e.select_sym(1);const s=e.new_var(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)return e.select_sym(0),null;this._barBuilder.moveTo(e.symbol.time);const f=function(e,t,i,s,o,n,r,a){const l=new d;let c=NaN;const u=i-s;switch(a){case 0: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;case 1: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;case 2: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;case 3: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;case 4:let n=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;case 5: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;case 6: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:throw new Error("Unknown kind")}return l.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);return e.select_sym(0),this._showHistoricalPivots||(l.pivots=[]),l.pivots.push(f),l.pivots.length>this._historicalPivotsToKeep&&l.pivots.shift(),g?this._createResponse():null}_createResponse(){return 0===this._data.pivots.length?null:{ -nonseries:!0,type:"non_series_data",data:{data:this._data}}}_removeUnusedPivots(){const e=Math.max(this._data.pivots.findIndex((e=>e.startIndex__t>this._firstMainSeriesBarTime))-1,0);e>0&&this._data.pivots.splice(0,e)}}}},52691:(e,t,i)=>{"use strict";i.d(t,{ratioStudyItem:()=>n});var s=i(70680);class o extends s.SpreadRatioBase{_doCalculation(e,t,i,s){return e*t/(i*s)}}const n={name:"Ratio",metainfo:{_metainfoVersion:15,defaults:s.spreadRatioDefaults,plots:s.spreadRatioPlots,styles:s.spreadRatioStyles,description:"Ratio",shortDescription:"Ratio",is_price_study:!1,inputs:s.spreadRatioInputs,id:"Ratio@tv-basicstudies-1",format:{type:"price",precision:2}},constructor:o}},57622:(e,t,i)=>{"use strict";i.d(t,{regressionTrendStudyItem:()=>n});var s=i(19979);function o(e,t,i){const o={slope:NaN,average:NaN,intercept:NaN,stdDev:NaN,upDev:NaN,downDev:NaN,pearsons:NaN};return 0===e.length||(function(e,t){let i=0,s=0,o=0,n=0;for(let t=0;tn&&(n=u),u=d-i[s],u>r&&(r=u),u=e[s];const p=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}const n={name:"Regression Trend",metainfo:{_metainfoVersion:51,description:"Regression Trend",format:{type:"inherit"},id:"RegressionTrend@tv-basicstudies-144",is_hidden_study:!0,is_price_study:!0,shortDescription:"Reg Trend",defaults:{inputs:{"first bar time":0,"last bar time":0,"lower diviation":-2,source:"close","upper diviation":2,"use lower diviation":!0,"use upper diviation":!0},styles:{}},inputs:[{defval:2,id:"upper diviation",max:500,min:-500,name:"Upper Deviation",type:"float"},{defval:-2,id:"lower diviation",max:500,min:-500,name:"Lower Deviation",type:"float"},{defval:!0,id:"use upper diviation",name:"Use Upper Deviation",type:"bool"},{defval:!0,id:"use lower diviation",name:"Use Lower Deviation",type:"bool"},{defval:0,id:"first bar time",isHidden:!0,max:253370764800,min:-253370764800,name:"First bar time",type:"time"},{defval:0,id:"last bar time",isHidden:!0,max:253370764800,min:-253370764800,name:"Last bar time",type:"time"},{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"source"}],plots:[]},constructor:class{constructor(){this._resultSent=!1}init(e,t){this._resultSent=!1,this._data={baseLine:{startPrice:NaN,endPrice:NaN},upLine:{startPrice:NaN,endPrice:NaN},downLine:{startPrice:NaN,endPrice:NaN},pearsons:NaN,startIndex__t:NaN,endIndex__t:NaN}}main(e,t){const i=t(6),n=e.new_unlimited_var(s.Std.time(e)),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)return null;if(this._resultSent)return null -;const c=t(0),h=t(1),d=t(2),u=t(3),_=t(4),p=t(5),m=n.indexOf(_),g=n.indexOf(p),f=[],y=[],v=[],S=[];for(let e=m;e>=g;--e)f.push(n.get(e)),y.push(r.get(e)),v.push(a.get(e)),S.push(l.get(e));return this._updateData(f,d,c,u,h,_,p,o(S,y,v)),this._resultSent=!0,{type:"non_series_data",nonseries:!0,data:{data:this._data}}}_updateData(e,t,i,s,o,n,r,a){const l=e.length-1;this._data.baseLine.startPrice=a.intercept,this._data.baseLine.endPrice=a.intercept+a.slope*l;const c=a.intercept+(t?a.stdDev*i:a.upDev);this._data.upLine.startPrice=c,this._data.upLine.endPrice=c+a.slope*l;const h=a.intercept+(s?a.stdDev*o:-a.downDev);this._data.downLine.startPrice=h,this._data.downLine.endPrice=h+a.slope*l,this._data.pearsons=a.pearsons,this._data.startIndex__t=n,this._data.endIndex__t=r}}}},70680:(e,t,i)=>{"use strict";i.d(t,{SpreadRatioBase:()=>l,spreadRatioDefaults:()=>c,spreadRatioFilledAreas:()=>p,spreadRatioInputs:()=>h,spreadRatioPalettes:()=>_,spreadRatioPlots:()=>d,spreadRatioStyles:()=>u});var s=i(58978),o=i(4359),n=i(19979),r=i(52859);const a="rgba(0, 0, 0, 0)";class l{init(e,t){e.new_sym(t(1),n.Std.period(e)),this._source=t(0),this._scaleFactor1=1,this._scaleFactor2=1}main(e,t){const i=n.Std[this._source](e),s=e.new_unlimited_var(e.symbol.time);e.select_sym(1);const o=e.new_unlimited_var(e.symbol.time),r=e.new_unlimited_var(n.Std[this._source](e));e.select_sym(0);const a=r.adopt(o,s,1),l=this._doCalculation(this._scaleFactor1,i,this._scaleFactor2,a);return isNaN(l)?null:[l,0,n.Std.ge(l,0),n.Std.lt(l,0)]}}const c={styles:{plot1:{linestyle:0,linewidth:2,plottype:o.LineStudyPlotStyle.Line,trackPrice:!1,transparency:35,color:"#800080",display:15},plotBaseline:{linestyle:0,linewidth:2,plottype:o.LineStudyPlotStyle.Line,trackPrice:!1,transparency:0,color:a,display:0}},palettes:{negativePalette:{colors:[{color:(0,r.applyAlpha)((0,s.getHexColorByName)("color-ripe-red-500"),.5),style:0,width:0},{color:a,style:0,width:0}]},positivePalette:{colors:[{color:(0,r.applyAlpha)((0,s.getHexColorByName)("color-minty-green-500"),.5),style:0,width:0},{color:a,style:0,width:0}]}},filledAreasStyle:{negativeFill:{color:"",transparency:0,visible:!0,fillType:void 0},positiveFill:{color:"",transparency:0,visible:!0,fillType:void 0}},precision:2,inputs:{source:"close",symbol2:""}},h=[{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"text"},{id:"symbol2",name:"Symbol",type:"symbol",confirm:!0}],d=[{id:"plot1",type:"line"},{id:"plotBaseline",type:"line"},{id:"plotNegativeFill",type:"colorer",target:"negativeFill",palette:"negativePalette"},{id:"plotPositiveFill",type:"colorer",target:"positiveFill",palette:"positivePalette"}],u={plot1:{title:"Plot",histogramBase:0},plotBaseline:{title:"Baseline",isHidden:!0}},_={negativePalette:{valToIndex:{0:0,1:1},colors:[{name:"Color"}]},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});var s=i(70680);class o extends s.SpreadRatioBase{_doCalculation(e,t,i,s){return e*t-i*s}}const n={name:"Spread",metainfo:{_metainfoVersion:15,defaults:s.spreadRatioDefaults,plots:s.spreadRatioPlots,styles:s.spreadRatioStyles,palettes:s.spreadRatioPalettes,filledAreas:s.spreadRatioFilledAreas,description:"Spread",shortDescription:"Spread",is_price_study:!1,inputs:s.spreadRatioInputs,id:"Spread@tv-basicstudies-1",format:{type:"price",precision:2}},constructor:o}},60755:(e,t,i)=>{"use strict";i.d(t,{VbPCheckHaveVolumeExpr:()=>o});var s=i(19979);class o{constructor(e){this._haveAnyVolume=!1,this._isDisabled=!1,this._seriesGetter=e}update(e,t){if(this._haveAnyVolume||this._isDisabled)return;const i=this._seriesGetter.volume().get(e);0!==i&&Number.isFinite(i)&&(this._haveAnyVolume=!0),t&&(this._haveAnyVolume||s.Std.error("The data vendor doesn't provide volume data for this symbol."),this._isDisabled=!0)}}},96777:(e,t,i)=>{"use strict";i.d(t,{VolumeByPriceExpr:()=>g});var s=i(50151),o=i(77914),n=i(46082),r=i(86811);class a extends r.GraphicsObj{constructor(e,t,i,o,n,r){super(e),(0,s.assert)(t({index:e.index,offset:e.offset,level:e.level})))}}}class p extends r.GraphicsObj{constructor(e,t,i,s,o=!1,n=!1){super(e),this._endIndex=this._mixinJSONObject.createTimeField(i,"endIndex"),this._extendLeft=this._mixinJSONObject.createField(o,"extendLeft"),this._extendRight=this._mixinJSONObject.createField(n,"extendRight"),this._level=this._mixinJSONObject.createDoubleField(s,"level"),this._startIndex=this._mixinJSONObject.createTimeField(t,"startIndex")}isNaN(){return super.isNaN()||Number.isNaN(this._level.get())||this._startIndex.get()<0||this._endIndex.get()<0||this._startIndex.get()===this._endIndex.get()&&!this._extendLeft.get()&&!this._extendRight.get()}jsonName(){return"horizlines"}primitiveData(){return{id:this.id(),startIndex:this._startIndex.get(),endIndex:this._endIndex.get(),extendLeft:this._extendLeft.get(),extendRight:this._extendRight.get(),level:this._level.get()}}startIndex(){return this._startIndex.get()}setStartIndex(e){this._startIndex.set(e)&&this._processObjUpdate()}endIndex(){return this._endIndex.get()}setEndIndex(e){this._endIndex.set(e)&&this._processObjUpdate()}level(){return this._level.get()}setLevel(e){this._level.set(e)&&this._processObjUpdate()}isExtendLeft(){return this._extendLeft.get()}setExtendLeft(e){this._extendLeft.set(e)&&this._processObjUpdate()}extendLeft(){return this.isExtendLeft()}isExtendRight(){return this._extendRight.get()}setExtendRight(e){this._extendRight.set(e)&&this._processObjUpdate()}extendRight(){return this.isExtendRight()}}!function(e){e[e.AssertAccuracy=.05]="AssertAccuracy"}(l||(l={})),function(e){e[e.START=0]="START",e[e.END=1]="END"}(c||(c={}));class m{constructor(){this._map=new Map}get(e){const t=this._innerMap(e.start);return t&&t.get(e.end)}set(e,t){this._innerMap(e.start,!0).set(e.end,t)}clear(){this._map.clear()}size(){let e=0;return this._map.forEach((t=>e+=t.size)),e}_innerMap(e,t){let i=this._map.get(e);return void 0===i&&t&&(i=new Map,this._map.set(e,i)),i}}class g{constructor(e,t,i,o,n,r,a,l,c,d,u,_,p,g,f){this._freezedBoxes=new h.GraphicsList,this._freezedHists=new h.GraphicsList,this._freezedPocs=new h.GraphicsList,this._freezedVAHists=new h.GraphicsList,this._currentHistsGr=new h.GraphicsList,this._currentVAHistsGr=new h.GraphicsList, -this._currentHists=[],this._currentHistsMap=new m,this._currentBox=null,this._currentPoc=null,this._historyBarSet=[],this._prevRtBar=null,this._minPrice=Number.POSITIVE_INFINITY,this._maxPrice=Number.NEGATIVE_INFINITY,this._leftBoxTime=null,this._rightBoxTime=null,this._actualRightBoxTime=null,this._needRecalc=!1,this._largestHistItem=null,this._rowsLayout=null,this._currentVAStart=0,this._currentVAEnd=0,this._previousVAStart=0,this._previousVAEnd=0,this._idsGenerator=null,(0,s.assert)(1===e||2===e),this._numOfSubHists=e,this._outHists=o,this._outBoxLines=n,this._outPocLines=r,this._extendPocLeftRight=a,this._outVAHists=l,this._vaVolumePercent=c,this._rowsLayoutSupplier=d,this._outHists.addStable(this._freezedHists),this._outVAHists.addStable(this._freezedVAHists),this._maxHHistItems=u,this._layoutIsAutoselected=g,this._leftBoxTimeMutable=_,this._rightBoxTimeMutable=p,this._actualRightBoxTime=f??p,this._ctx=t,this._seriesGetter=i}update(e){this._supplyRowsLayout(this._ctx),null===this._currentBox&&this._initCurrentBox(),null===this._currentPoc&&this._initCurrentPoc();const t=this._timeScale().get(e);this._leftBoxTime=this._leftBoxTimeMutable,this._rightBoxTime=this._rightBoxTimeMutable,this._ctx.symbol.isLastBar&&!Number.isNaN(this._rightBoxTime)&&(this._rightBoxTime=Math.min(t+n.Interval.parse(this._ctx.symbol.interval+this._ctx.symbol.resolution).inMilliseconds(t)-1,this._rightBoxTime));const i=d.Std.greaterOrEqual(this._seriesClose().get(e),this._seriesOpen().get(e)),s={high:this._seriesHigh().get(e),low:this._seriesLow().get(e),volume:this._seriesVol().get(e),isUp:i,time:t};this._updateCurrentHistogram(s),this._currentHists.length>0&&(this._largestHistItem=this._getLargestHistItem(),this._updateCurrentPoc(),this._seriesGetter.developingPoc().set(this._currentPoc.level()),this._updateValueArea(),this._vaVolumePercent>0&&(this._seriesGetter.developingVAHigh().set(this._currentHists[this._currentVAEnd].priceHigh()),this._seriesGetter.developingVALow().set(this._currentHists[this._currentVAStart].priceLow()))),this._updateCurrentBox(),this._rebuildOutData()}setIdsGeneratorProxy(e){this._idsGenerator=e}nextGraphicsObjId(){return(0,s.ensureNotNull)(this._idsGenerator).nextGraphicsObjId()}pushEraseObjCmd(e,t){(0,s.ensureNotNull)(this._idsGenerator).pushEraseObjCmd(e,t)}popEraseCmds(){return(0,s.ensureNotNull)(this._idsGenerator).popEraseCmds()}_timeScale(){return this._seriesGetter.time()}_seriesLow(){return this._seriesGetter.low()}_seriesHigh(){return this._seriesGetter.high()}_seriesVol(){return this._seriesGetter.volume()}_seriesOpen(){return this._seriesGetter.open()}_seriesClose(){return this._seriesGetter.close()}_freezeCurrentHistogramAndCleanup(){null!==this._currentBox&&this._freezedBoxes.add(this._currentBox),d.Std.greater(this._getVolume(this._currentHists),0)&&(this._freezedHists.addAll(this._currentHistsGr),this._freezedVAHists.addAll(this._currentVAHistsGr),null!==this._currentPoc&&this._freezedPocs.add(this._currentPoc)),this._currentHists=[],this._currentHistsGr.clear(),this._currentHistsMap.clear(), -this._initCurrentBox(),this._initCurrentPoc(),this._currentVAHistsGr.clear(),this._historyBarSet=[],this._minPrice=Number.POSITIVE_INFINITY,this._maxPrice=Number.NEGATIVE_INFINITY,this._prevRtBar=null,this._leftBoxTime=null,this._rightBoxTime=null}_supplyRowsLayout(e){null===this._rowsLayout&&e.symbol.isFirstBar&&e.symbol.isNewBar&&(this._rowsLayout=this._rowsLayoutSupplier())}_updateCurrentHistogram(e){if(this._needRecalc=!1,d.Std.greater(this._minPrice,e.low)&&(this._minPrice=e.low,this._needRecalc=!0),d.Std.less(this._maxPrice,e.high)&&(this._maxPrice=e.high,this._needRecalc=!0),this._ctx.symbol.isBarClosed&&this._historyBarSet.length>0){const t=this._historyBarSet[this._historyBarSet.length-1];t.time===e.time&&(this._prevRtBar=t,this._historyBarSet.pop())}this._needRecalc&&0===(0,s.ensureNotNull)(this._rowsLayout).type()?(this._recalculateCurrentResultsOnHistoryBarSet(),this._applyUpdateToCurrentResults(e,!1)):this._applyUpdateToCurrentResults(e,!0),this._ctx.symbol.isBarClosed?((0,s.assert)(null===this._prevRtBar||e.time===this._prevRtBar.time),this._historyBarSet.push(e),this._prevRtBar=null):this._prevRtBar=e}_getMidLevel(e){return(e.priceHigh()+e.priceLow())/2}_getMidLevelFromList(e){return e.length%2==0?e[e.length/2].priceLow():this._getMidLevel(e[Math.floor(e.length/2)])}_getLargestHistItem(){let e=[],t=this._currentHists[0];for(const i of this._currentHists)d.Std.greater(i.ratesSum(),t.ratesSum())?(t=i,e=[t]):d.Std.equal(i.ratesSum(),t.ratesSum())&&e.push(i);if(e.length>1){const i=this._getMidLevelFromList(this._currentHists);t=e[e.length-1];for(let s=e.length-2;s>=0;s--){const o=e[s];d.Std.lessOrEqual(Math.abs(this._getMidLevel(o)-i),Math.abs(this._getMidLevel(t)-i))&&(t=o)}}return t}_initCurrentPoc(){this._currentPoc=new p(this,0,0,0)}_updateCurrentPoc(){const e=(0,s.ensureNotNull)(this._currentPoc);e.setStartIndex((0,s.ensureNotNull)(this._leftBoxTime)),e.setEndIndex((0,s.ensureNotNull)(this._actualRightBoxTime)),e.setExtendLeft(this._extendPocLeftRight),e.setExtendRight(this._extendPocLeftRight);const t=this._getMidLevel((0,s.ensureNotNull)(this._largestHistItem));e.setLevel(t)}_getVolume(e){let t=0;for(const i of e)t+=i.ratesSum();return t}_getPocHistItemIndex(){for(let e=0;e=0,`ERROR - PocHistItemIndex == ${e}`),this._currentVAStart=e-1,this._currentVAEnd=e+1;const t=this._getVolume(this._currentHists)*this._vaVolumePercent*.01;let i=this._currentHists[e].ratesSum(),o=0,n=null;for(;d.Std.lessOrEqual(i+o,t)&&(i+=o,0===n?--this._currentVAStart:1===n&&++this._currentVAEnd,-1!==this._currentVAStart||this._currentVAEnd!==this._currentHists.length);){let t,i;if(this._currentVAStart>-1)if(t=this._currentHists[this._currentVAStart].ratesSum(),this._currentVAEndthis._getMidLevel(this._currentHists[this._currentVAStart])&&e.priceLow()0&&(e=this._currentHists[0].priceLow(),t=this._currentHists[this._currentHists.length-1].priceHigh());const i=[],o=(0,s.ensureNotNull)(this._leftBoxTime),n=(0,s.ensureNotNull)(this._actualRightBoxTime);i.push(new u(o,e)),i.push(new u(o,t)),i.push(new u(n,t)),i.push(new u(n,e)),(0,s.ensureNotNull)(this._currentBox).setPoints(i)}_recalculateCurrentResultsOnHistoryBarSet(){for(let e=0;e0&&(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");const r=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);const u=h.rowWidth();if(!d.Std.greater(u,0))return;h.calculate() -;const _=h.getIndexLowVbP(),p=h.getIndexHighVbP(),m=h.getStartPrice();if(_===p){const e=_*u+m,t=(_+1)*u+m;this._updateResult({start:e,end:t},n*l,c,i,o)}else{let e=0;for(let t=_;t<=p;t++){const s=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){const r=this._createRates(i,t);(0,s.assert)(null!==this._leftBoxTime,"leftBoxTime is not set (equals null)"),(0,s.assert)(null!==this._rightBoxTime,"rightBoxTime is not set (equals null)");const l=(0,s.ensureNotNull)(this._leftBoxTime),c=(0,s.ensureNotNull)(this._actualRightBoxTime);let h=n.get(e);if(void 0===h)h=new a(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)=>{let i=d.Std.compare(e.firstBarTime(),t.firstBarTime());return 0!==i?i:(i=d.Std.compare(e.priceLow(),t.priceLow()),0!==i?i:d.Std.compare(e.priceHigh(),t.priceHigh()))}));else{const e=[];for(let t=0;t0?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:()=>_});var s,o=i(37103),n=i(46082);!function(e){e[e.NumberOfRows=0]="NumberOfRows",e[e.TicksPerRow=1]="TicksPerRow"}(s||(s={}));class r{ -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(){return this._startPrice}setStartPrice(e){this._startPrice=e}getIndexLowVbP(){return this._indexLowVbP}setIndexLowVbP(e){this._indexLowVbP=e}getIndexHighVbP(){return this._indexHighVbP}setIndexHighVbP(e){this._indexHighVbP=e}type(){return this._type}}class a extends r{constructor(e){super(e,0)}calculate(){this.setStartPrice(this._minPrice);const e=this.rowWidth();let t=Math.floor((this._low-this._minPrice)/e),i=Math.ceil((this._high-this._minPrice)/e)-1;t=Math.max(t,0),i=Math.max(i,0),i=Math.min(i,this._rowSize-1),t=Math.min(t,i),this.setIndexLowVbP(t),this.setIndexHighVbP(i)}rowWidth(){return Math.max((this._maxPrice-this._minPrice)/this._rowSize,this._minTick)}}class l extends r{constructor(e){super(e,1)}calculate(){this.setStartPrice(0);const e=this.rowWidth();let t=Math.floor(this._low/e);const i=Math.ceil(this._high/e)-1;t=Math.min(t,i),this.setIndexLowVbP(t),this.setIndexHighVbP(i)}rowWidth(){return this._minTick*this._rowSize}}var c,h=i(19979),d=i(47132);function u(){return 6e3}function _(e){switch(e){case"Delta":case"Up/Down":return 2;case"Total":return 1;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={}));class p{findBasicResolutionForFromTo(e,t,i,s){const r=(0,d.getVolumeProfileResolutionForPeriod)(e.value(),t,i,s),a=n.Interval.parse(r);return o.enabled("charting_library_debug_mode")&&console.log(`${(new Date).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?new a(t):new l(t)}}},74109:(e,t,i)=>{"use strict";i.d(t,{volumeProfileFixedRangeBSStudyItem:()=>w,volumeProfileFixedRangeVbPStudyItem:()=>b});var s=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);class g extends m.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){const t=this._timeScale().get(e);return this._firstBarTime<=t&&t=this._firstBarTime){const e=this._developingPocSeries.getLeftOrEqual(n),t=this._developingVAHighSeries.getLeftOrEqual(n),i=this._developingVALowSeries.getLeftOrEqual(n);o.data.push([e,t,i])}else o.data.push([NaN,NaN,NaN])}return o}time(){return this._timeSeries}open(){return this._openSeries}high(){return this._highSeries}low(){return this._lowSeries}close(){return this._closeSeries}volume(){return this._volumeSeries}developingPoc(){return this._developingPocSeries}developingVAHigh(){return this._developingVAHighSeries}developingVALow(){return this._developingVALowSeries}}function S(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}}}const b=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});var s=i(50151),o=i(12217);class n{constructor(){this._histPos=-1,this._hist=new Float64Array(2e3),this._times=new Float64Array(2e3)}addHist(e){if(this._histPos>=0){const t=this._times[this._histPos];(0,s.assert)(t<=e,"History order violation"),this._histPos+=t===e?0:1}else this._histPos+=1;if(this._histPos===this._hist.length){const e=new Float64Array(2*this._hist.length);e.set(this._hist),this._hist=e;const t=new Float64Array(this._hist.length);t.set(this._times),this._times=t}this._hist[this._histPos]=NaN,this._times[this._histPos]=e}removeLastIfNaN(){Number.isNaN(this.get(0))&&(this._histPos-=1)}get(e){(0,s.assert)(0===e);const t=this._histPos-e;return this._hist[t]}getLeftOrEqual(e){const t=(0,o.upperbound)(this._times,e,((e,t)=>e{"use strict";i.d(t,{volumeProfileVisibleRangeStudyItem:()=>y});var s=i(50151),o=i(13823),n=i(99481),r=i(46082),a=i(3186),l=i(96777),c=i(30376);class h extends l.VolumeByPriceExpr{constructor(e,t,i,s,o,n,r,a,l,h,d){super(e,t,i,n,new c.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){const t=this._timeScale().get(e);return this._firstBarTime<=t&&t=this._firstBarTime){ -const e=this._developingPocSeries.getLeftOrEqual(n),t=this._developingVAHighSeries.getLeftOrEqual(n),i=this._developingVALowSeries.getLeftOrEqual(n);o.data.push([e,t,i])}else o.data.push([NaN,NaN,NaN])}return o}time(){return this._timeSeries}open(){return this._openSeries}high(){return this._highSeries}low(){return this._lowSeries}close(){return this._closeSeries}volume(){return this._volumeSeries}developingPoc(){return this._developingPocSeries}developingVAHigh(){return this._developingVAHighSeries}developingVALow(){return this._developingVALowSeries}}const y={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});class s extends Error{constructor(e,t){super(e),this.studyError=!0,this.title=t}}}, -75719:(e,t,i)=>{"use strict";var s;i.d(t,{EraseAll:()=>n,EraseObj:()=>o,GraphicsCmds:()=>r}),function(e){e.One="one",e.All="all"}(s||(s={}));class o{constructor(e,t){this.id=e,this.type=t}primitiveData(){return{action:"one",id:this.id,type:this.type}}}class n{primitiveData(){return{action:"all"}}}class r{constructor(){this.erase=[],this.create=null,this._modified=!1}primitiveData(e){if(this.isNaN())return null;const t={},i=this.create&&this.create.primitiveData(e);return null!==i&&(t.create=i),null!==this.erase&&this.erase.length>0&&(t.erase=this.erase.map((e=>e.primitiveData()))),void 0===t.create&&void 0===t.erase?null:t}setCreate(e){this.create=e,this.create.forEachList((e=>e.setOwner(this)))}isNaN(){return(null===this.erase||0===this.erase.length)&&null===this.create}isModified(){return this._modified}setModified(e){this._modified=e}dirty(){this._modified=!0}setOwner(e){throw new Error("Unsupported")}}},3186:(e,t,i)=>{"use strict";i.d(t,{GraphicsListColl:()=>s});class s{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){const t=[];return this._forEach((i=>t.push(...i.primitivesData(e)))),t}deleteErasedItems(){this._forEach((e=>e.deleteErasedItems()))}markPostedItems(){this._forEach((e=>e.markPostedItems()))}isNaN(){return this._all((e=>e.isNaN()))}dirty(){null!==this._owner&&this._owner.dirty()}setOwner(e){this._owner=e}_forEach(e){for(const t of this._stable)e(t);null!==this._variable&&e(this._variable)}_all(e){for(const t of this._stable)if(!e(t))return!1;return null===this._variable||e(this._variable)}}},30376:(e,t,i)=>{"use strict";i.d(t,{GraphicsList:()=>n});var s=i(86811),o=i(31645);class n{constructor(){this._items=[],this._owner=null}primitivesData(e){const t=[];for(const i of this._items)e.isIgnoredObj(i)||t.push(i.primitiveData());return t}get(e){return this._items[e]}set(e,t){return this.dirty(),t.setOwner(this),this._items[e]=t,t}addAtIndex(e,t){this.dirty(),t.setOwner(this),this._items[e]=t}clear(){this._unsetOwner(this._items),this._items=[],this.dirty()}addAllFromNumber(e,t){this.setOwner(t),this._items.splice(e,0,...t._items);const i=!0;return this._setCachedDataValid(!1),i}addAll(e){this.setOwner(e),this._items.push(...e._items);const t=!0;return this._setCachedDataValid(!1),t}remove(e){const t=this._items[e];return this._items.splice(e,1),t.unsetOwner(this),this.dirty(),t}getItems(){return this._items}size(){return this._items.length}add(e){e.setOwner(this),this._items.push(e);const t=!0;return this._setCachedDataValid(!1),t}deleteErasedItems(){this._items=this._items.filter((e=>!e.isErased()))}markPostedItems(){for(const e of this._items)e.markAsPosted()}isNaN(){if(0===this._items.length)return!0;for(const e of this._items){if(!(0,o.isNaNable)(e))return!1;if(!e.isNaN())return!1}return!0}setOwner(e){this._owner=e}dirty(){null!==this._owner&&this._owner.dirty()}_unsetOwner(e){ -for(const t of e)t instanceof s.GraphicsObj&&t.unsetOwner(this)}_setCachedDataValid(e){e||this.dirty()}}},86811:(e,t,i)=>{"use strict";i.d(t,{GraphicsObj:()=>l});var s=i(19979);class o{constructor(e,t,i,s){this._value=e,this._name=t,this._owner=i,this._comparer=void 0!==s?s:(e,t)=>null==e?null!=t:e===t}getName(){return this._name}set(e){const t=this._comparer(this._value,e);return t&&this._owner.dirty(),this._value=e,t}get(){return this._value}}class n{constructor(e,t,i){this._owner=null,this._value=e,this._name=t,this._owner=i}getName(){return this._name}set(e){return this._value!==e&&(this._value=e,null!==this._owner&&this._owner.dirty(),!0)}get(){return this._value}}class r extends o{constructor(e,t,i,s){super(e,t,i,s)}}class a{constructor(e){this._owner=e}createField(e,t){return new o(e,t,this)}createDoubleField(e,t){return new o(e,t,this,((e,t)=>!s.Std.equal(e,t)))}createDoubleArrayField(e,t){return new r(e,t,this,((e,t)=>{if(e===t)return!1;const i=e.length;if(t.length!==i)return!0;for(let o=0;o{"use strict";function s(e){return Boolean(e.isNaN)}i.d(t,{isNaNable:()=>s})},13421:(e,t,i)=>{"use strict";i.d(t,{JStudyDataUpdate:()=>p});var s=i(75719);class o{constructor(){this.isUpdate=!1,this.graphicsCmds=new s.GraphicsCmds,this._offsetsChanged=!1,this._disableGraphicsAndData=!1}isNaN(){return this.graphicsCmds.isNaN()}primitiveData(e){const t={};if(!this._disableGraphicsAndData){const i=this.graphicsCmds.primitiveData(e);null!==i&&(t.graphicsCmds=i)}return this.isUpdate&&(t.isUpdate=!0),void 0===t.graphicsCmds?void 0:t}disable(){this._disableGraphicsAndData=!0}checkForChangeAndResetChangedState(e){const t=this._offsetsChanged,i=this.graphicsCmds.isModified();this.graphicsCmds.setModified(!1),this._offsetsChanged=!1;return i||t||0!==e.length}}class n{constructor(e){this._dataObj=new o,this._isDirty=!1,this._eraseCmds=[],this._enableCmdDataStudy=e}init(e){this._dataObj.graphicsCmds.setCreate(e),this.update(!0)}dataObj(){return this._dataObj}setEraseCmds(e){this._eraseCmds=e}resetDirtyState(){this._isDirty=!1}disable(){ -this._dataObj.disable()}}var r,a=i(87465),l=i(31645);function c(e){return Boolean(e.isPosted)}!function(e){e[e.New=0]="New",e[e.Posted=1]="Posted",e[e.Erased=2]="Erased"}(r||(r={}));class h{isIgnoredObj(e,t){return h.isIgnoredObjDefault(e,t)}static isIgnoredObjDefault(e,t){if(void 0===t)return h.isIgnoredObjNaNable(e);const i=e[t];return h.isIgnoredByGeneralRules(e,t)||h.isIgnoredObjNaNable(i)||h.isIgnoredObjListOfNaNables(i)}static isIgnoredObjNaNable(e){return(0,l.isNaNable)(e)&&e.isNaN()}static isIgnoredObjListOfNaNables(e){if(!(0,a.isArray)(e))return!1;let t=!0;for(const i of e)if(!(0,l.isNaNable)(i)||!i.isNaN()){t=!1;break}return t}static isIgnoredObjPosted(e){return c(e)&&e.isPosted()}static isIgnoredObjErased(e){return c(e)&&e.isErased()}static isIgnoredByGeneralRules(e,t){const i=e[t];return(0,a.isArray)(i)&&0===i.length}}class d{isIgnoredObj(e,t){if(void 0===t)return h.isIgnoredObjDefault(e)||h.isIgnoredObjErased(e);const i=e[t];return h.isIgnoredObjDefault(e,t)||h.isIgnoredObjErased(i)}}class u extends n{constructor(e){super(e),this._snapshotPredicate=new d,this._dataSnapShot={}}getData(){return this._dataSnapShot}getUpdate(){return this._isDirty?this._dataSnapShot:{}}update(e){(this._dataObj.checkForChangeAndResetChangedState(this._eraseCmds)||e)&&(null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.create.deleteErasedObjs(),this._dataObj.graphicsCmds.erase=[new s.EraseAll]),this._makeSnapshot(),this._isDirty=!0)}_makeSnapshot(){this._json=this._dataObj.primitiveData(this._snapshotPredicate),this._dataSnapShot={json:this._json}}}class _{isIgnoredObj(e,t){if(void 0===t)return h.isIgnoredObjDefault(e)||h.isIgnoredObjErased(e)||h.isIgnoredObjPosted(e);const i=e[t];return h.isIgnoredObjDefault(e,t)||h.isIgnoredObjErased(i)||h.isIgnoredObjPosted(i)}}class p extends u{constructor(e){super(e),this._updatePredicate=new _,this._sendShapshotOnly=!0,this._isFirstNotForcedUpdate=!0}update(e){(this._dataObj.checkForChangeAndResetChangedState(this._eraseCmds)||e)&&(null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.erase=[new s.EraseAll]),this._dataObj.isUpdate=!0,this._makeSnapshot(),null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.erase=this._eraseCmds),this._dataObj.isUpdate=!0,this._jsonUpdate=this._dataObj.primitiveData(this._updatePredicate),null!==this._dataObj.graphicsCmds.create&&this._dataObj.graphicsCmds.create.deleteErasedAndMarkPostedObjs(),this._sendShapshotOnly=e||this._isFirstNotForcedUpdate,this._isFirstNotForcedUpdate=Boolean(e),this._isDirty=!0)}getUpdate(){return this._isDirty?this._enableCmdDataStudy?{json:this._sendShapshotOnly?this._json:void 0,jsonUpdate:this._sendShapshotOnly?void 0:this._jsonUpdate}:{json:this._json,jsonUpdate:this._sendShapshotOnly?void 0:this._jsonUpdate}:{}}}},45591:(e,t,i)=>{"use strict";i.d(t,{Container:()=>n,StudyGraphicsData:()=>o});var s=i(50151);class o{constructor(){this._horizlines=[],this._hhists=[],this._polygons=[],this._vertlines=[],this._containersCache=[],this._containerNamesCache=[], -this._containersMapCache=new Map,this._addToCache("horizlines",this._horizlines),this._addToCache("hhists",this._hhists),this._addToCache("polygons",this._polygons),this._addToCache("vertlines",this._vertlines)}primitiveData(e){const t={};let i=!1;for(const s of this._containerNamesCache){const o=[],n=this.getObjsContainer(s);for(const t of n){if(t.isNaN())continue;const i=t.primitiveData(e);i.data.length>0&&o.push(i)}o.length>0&&(t[s]=o,i=!0)}return i?t:null}deleteErasedAndMarkPostedObjs(){this.forEachList((e=>{e.deleteErasedItems(),e.markPostedItems()}))}deleteErasedObjs(){this.forEachList((e=>e.deleteErasedItems()))}getObjsContainer(e){return(0,s.ensureDefined)(this._containersMapCache.get(e))}forEachList(e){for(const t of this._containersCache)for(const i of t)e(i.data)}_addToCache(e,t){this._containersCache.push(t),this._containerNamesCache.push(e),this._containersMapCache.set(e,t)}}class n{constructor(e,t){this.styleId=e,this.data=t}isNaN(){return this.data.isNaN()}primitiveData(e){return{styleId:this.styleId,data:this.data.primitivesData(e)}}}},4783:(e,t,i)=>{"use strict";const s=i(58978).getHexColorByName,o=i(19979).Std,n=s("color-ripe-red-100"),r=s("color-ripe-red-200"),a=s("color-ripe-red-500"),l=s("color-ripe-red-900"),c=s("color-ripe-red-a200"),h=s("color-minty-green-100"),d=s("color-minty-green-400"),u=s("color-minty-green-500");JSServer.studyLibrary=[{name:"Accumulation/Distribution",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Accumulation/Distribution",shortDescription:"Accum/Dist",is_price_study:!1,inputs:[],id:"Accumulation/Distribution@tv-basicstudies-1",scriptIdPart:"",name:"Accumulation/Distribution",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i,s){return o.or(o.and(o.eq(e,t),o.eq(e,i)),o.eq(t,i))?0:(2*e-i-t)/(t-i)*s},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0(o.close(this._context),o.high(this._context),o.low(this._context),o.volume(this._context));return[o.cum(i,this._context)]}}},{name:"Accumulative Swing Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"ASI",histogramBase:0,joinPoints:!1}},description:"Accumulative Swing Index",shortDescription:"ASI",is_price_study:!1,inputs:[{id:"in_0",name:"Limit Move Value",defval:10,type:"float",min:.1,max:1e5}],id:"Accumulative Swing Index@tv-basicstudies-1",scriptIdPart:"",name:"Accumulative Swing Index",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t){ -var i=t.new_var(o.open(t)),s=t.new_var(o.high(t)),n=t.new_var(o.low(t)),r=t.new_var(o.close(t)),a=o.abs(s-r.get(1)),l=o.abs(n-r.get(1)),c=o.abs(s-n),h=o.abs(r.get(1)-i.get(1)),d=o.max(a,l),u=o.iff(a>=o.max(l,c),a-.5*l+.25*h,o.iff(l>=o.max(a,c),l-.5*a+.25*h,c+.25*h));return o.iff(0===u,0,(r-r.get(1)+.5*(r-i)+.25*(r.get(1)-i.get(1)))/u*d/e*50)},this.f_1=function(e,t){var i=this.f_0(e,t);return o.cum(i,t)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);return[this.f_1(i,this._context)]}}},{name:"Advance/Decline",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Advance/Decline",shortDescription:"AD",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:2e3}],id:"Advance/Decline@tv-basicstudies-1",scriptIdPart:"",name:"Advance/Decline",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t){return o.gt(e,t)},this.f_1=function(e,t){return o.lt(e,t)},this.f_2=function(e,t){return 0===t?e:e/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(o.close(this._context),o.open(this._context)),n=this._context.new_var(s),r=o.sum(n,i,this._context),a=this.f_1(o.close(this._context),o.open(this._context)),l=this._context.new_var(a),c=o.sum(l,i,this._context);return[this.f_2(r,c)]}}},{name:"Arnaud Legoux Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:.85,in_2:6}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Arnaud Legoux Moving Average",shortDescription:"ALMA",is_price_study:!0,inputs:[{id:"in_0",name:"Window Size",defval:9,type:"integer",min:0,max:5e3},{id:"in_1",name:"Offset",defval:.85,type:"float",min:-1e12,max:1e12},{id:"in_2",name:"Sigma",defval:6,type:"float",min:-1e12,max:1e12}],id:"Arnaud Legoux Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Arnaud Legoux Moving Average",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=o.close(this._context),s=this._input(0),n=this._input(1),r=this._input(2),a=this._context.new_var(i);return[o.alma(a,s,n,r)]}}},{name:"Aroon",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FB8C00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Upper",histogramBase:0,joinPoints:!1},plot_1:{title:"Lower", -histogramBase:0,joinPoints:!1}},description:"Aroon",shortDescription:"Aroon",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Aroon@tv-basicstudies-1",scriptIdPart:"",name:"Aroon",format:{precision:2,type:"percent"}},constructor:function(){this.f_0=function(e,t){return 100*(e+t)/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=o.high(this._context),n=i+1,r=this._context.new_var(s),a=o.highestbars(r,n,this._context),l=this.f_0(a,i),c=o.low(this._context),h=this._context.new_var(c),d=o.lowestbars(h,n,this._context);return[l,this.f_0(d,i)]}}},{name:"Average Price",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"AveragePrice@tv-basicstudies-1",scriptIdPart:"",name:"Average Price",description:"Average Price",shortDescription:"Average Price",is_price_study:!0,plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{symbol:""}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"symbol",name:"Other Symbol",defval:"",type:"symbol",optional:!0,isHidden:!1}],format:{type:"inherit"}},constructor:function(){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){if(this._context=e,this._input=t,""===this._input(0))return[o.ohlc4(this._context)];this._context.select_sym(0);const i=this._context.new_var(this._context.symbol.time);this._context.select_sym(1);const s=this._context.new_var(o.ohlc4(this._context)).adopt(this._context.new_var(this._context.symbol.time),i,1);return this._context.select_sym(0),[s]}}},{name:"Average Directional Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:c}},inputs:{in_0:14,in_1:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"ADX",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Average Directional Index",shortDescription:"ADX",is_price_study:!1,inputs:[{id:"in_0",name:"ADX Smoothing",defval:14,type:"integer",min:-1e12,max:1e12},{id:"in_1",name:"DI Length",defval:14,type:"integer",min:-1e12,max:1e12}],id:"average_directional_Index@tv-basicstudies-1",scriptIdPart:"",name:"Average Directional Index",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e){var t=this._context.new_var(o.high(this._context)),i=o.change(t),s=this._context.new_var(o.low(this._context)),n=-o.change(s),r=this._context.new_var(o.tr(void 0,this._context)),a=o.rma(r,e,this._context),l=this._context.new_var(o.and(o.gt(i,n),o.gt(i,0))?i:0),c=o.fixnan(100*o.rma(l,e,this._context)/a,this._context),h=this._context.new_var(o.and(o.gt(n,i),o.gt(n,0))?n:0);return[c,o.fixnan(100*o.rma(h,e,this._context)/a,this._context)]},this.f_1=function(e,t){var i=this.f_0(e),s=i[0],n=i[1],r=s+n,a=this._context.new_var(o.abs(s-n)/(o.eq(r,0)?1:r));return[100*o.rma(a,t,this._context)]}, -this.main=function(e,t){return this._context=e,this._input=t,this._context.setMinimumAdditionalDepth(this._input(0)+this._input(1)),this.f_1(this._input(1),this._input(0))}}},{name:"Average True Range",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:l}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Average True Range",shortDescription:"ATR",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Average True Range@tv-basicstudies-1",scriptIdPart:"",name:"Average True Range",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){var i=t(0);return[o.atr(i,e)]}}},{name:"Awesome Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:0,visible:!0,color:"#000080"}},palettes:{palette_0:{colors:{0:{color:a,width:1,style:0},1:{color:u,width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Awesome Oscillator",shortDescription:"AO",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}}}},inputs:[],id:"Awesome Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Awesome Oscillator",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e){return o.le(e,0)?0:1},this.main=function(e,t){this._context=e,this._input=t;var i=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=l,h=this._context.new_var(l),d=o.change(h);return[c,this.f_1(d)]}}},{name:"Accelerator Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:0,visible:!0,color:"#000080"}},palettes:{palette_0:{colors:{0:{color:a,width:1,style:0},1:{color:u,width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Accelerator Oscillator",shortDescription:"AO",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}}}},inputs:[],id:"Accelerator Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Accelerator Oscillator",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e){return o.le(e,0)?0:1},this.main=function(e,t){this._context=e,this._input=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;const i=!this._extendTimeScaleFeatureEnabled||!0!==t(1),o=this._context.new_unlimited_var(this._context.symbol.time);this._context.select_sym(1);const n=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);const t=n.adopt(n,o,1);if(s.Std.na(t))return[NaN,NaN,NaN,NaN];const i=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);return n.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});var s,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={}));class d{constructor(){this.p=NaN,this.r1=NaN,this.s1=NaN,this.r2=NaN,this.s2=NaN,this.r3=NaN,this.s3=NaN,this.r4=NaN,this.s4=NaN,this.r5=NaN,this.s5=NaN,this.startIndex__t=NaN,this.endIndex__t=NaN}}class u{constructor(){this.pivots=[]}}function _(e,t){let i;switch(t){case"Auto":i=function(e){const t=l.Interval.parse(e.interval+e.resolution);switch(t.kind()){case l.ResolutionKind.Weeks:case l.ResolutionKind.Months:return"12M";case l.ResolutionKind.Days:return"1M";case l.ResolutionKind.Minutes:return t.multiplier()>=1&&t.multiplier()<=15?"1D":"1W";case l.ResolutionKind.Seconds:case l.ResolutionKind.Ticks:return"1D"}throw new Error("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:throw new Error("No such pivTimeFrame: "+t)}const s="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}const p={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;const i=t(0),s=t(1),o=t(2),a=t(3);this._data=new u,this._firstMainSeriesBarTime=NaN,this._kindPP=function(e){switch(e){case"Traditional":return 0;case"Fibonacci":return 1;case"Woodie":return 2;case"Classic":return 3;case"DeMark":return 4;case"Camarilla":return 5;case"Floor":return 6;default:throw new Error("Unknown kind "+e)}}(i),this._showHistoricalPivots=s,this._historicalPivotsToKeep=a,this._pivTimeFrame=o;const l=t(4);let c;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)return null;if(e.is_main_symbol(i))return isNaN(this._firstMainSeriesBarTime)&&(this._firstMainSeriesBarTime=e.symbol.time,this._removeUnusedPivots()),e.symbol.isLastBar&&e.symbol.isNewBar?this._createResponse():null;e.select_sym(1);const s=e.new_var(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)return e.select_sym(0),null;this._barBuilder.moveTo(e.symbol.time);const f=function(e,t,i,s,o,n,r,a){const l=new d;let c=NaN;const u=i-s;switch(a){case 0: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;case 1: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;case 2: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;case 3: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;case 4:let n=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;case 5: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;case 6: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:throw new Error("Unknown kind")}return l.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);return e.select_sym(0), +this._showHistoricalPivots||(l.pivots=[]),l.pivots.push(f),l.pivots.length>this._historicalPivotsToKeep&&l.pivots.shift(),g?this._createResponse():null}_createResponse(){return 0===this._data.pivots.length?null:{nonseries:!0,type:"non_series_data",data:{data:this._data}}}_removeUnusedPivots(){const e=Math.max(this._data.pivots.findIndex((e=>e.startIndex__t>this._firstMainSeriesBarTime))-1,0);e>0&&this._data.pivots.splice(0,e)}}}},52691:(e,t,i)=>{"use strict";i.d(t,{ratioStudyItem:()=>n});var s=i(70680);class o extends s.SpreadRatioBase{_doCalculation(e,t,i,s){return e*t/(i*s)}}const n={name:"Ratio",metainfo:{_metainfoVersion:15,defaults:s.spreadRatioDefaults,plots:s.spreadRatioPlots,styles:s.spreadRatioStyles,description:"Ratio",shortDescription:"Ratio",is_price_study:!1,inputs:s.spreadRatioInputs,id:"Ratio@tv-basicstudies-1",format:{type:"price",precision:2}},constructor:o}},57622:(e,t,i)=>{"use strict";i.d(t,{regressionTrendStudyItem:()=>n});var s=i(19979);function o(e,t,i){const o={slope:NaN,average:NaN,intercept:NaN,stdDev:NaN,upDev:NaN,downDev:NaN,pearsons:NaN};return 0===e.length||(function(e,t){let i=0,s=0,o=0,n=0;for(let t=0;tn&&(n=u),u=d-i[s],u>r&&(r=u),u=e[s];const p=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}const n={name:"Regression Trend",metainfo:{_metainfoVersion:51,description:"Regression Trend",format:{type:"inherit"},id:"RegressionTrend@tv-basicstudies-144",is_hidden_study:!0,is_price_study:!0,shortDescription:"Reg Trend",defaults:{inputs:{"first bar time":0,"last bar time":0,"lower diviation":-2,source:"close","upper diviation":2,"use lower diviation":!0,"use upper diviation":!0},styles:{}},inputs:[{defval:2,id:"upper diviation",max:500,min:-500,name:"Upper Deviation",type:"float"},{defval:-2,id:"lower diviation",max:500,min:-500,name:"Lower Deviation",type:"float"},{defval:!0,id:"use upper diviation",name:"Use Upper Deviation",type:"bool"},{defval:!0,id:"use lower diviation",name:"Use Lower Deviation",type:"bool"},{defval:0,id:"first bar time",isHidden:!0,max:253370764800,min:-253370764800,name:"First bar time",type:"time"},{defval:0,id:"last bar time",isHidden:!0,max:253370764800,min:-253370764800,name:"Last bar time",type:"time"},{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"source"}],plots:[]},constructor:class{constructor(){this._resultSent=!1}init(e,t){this._resultSent=!1,this._data={baseLine:{startPrice:NaN,endPrice:NaN},upLine:{startPrice:NaN,endPrice:NaN},downLine:{startPrice:NaN,endPrice:NaN},pearsons:NaN,startIndex__t:NaN,endIndex__t:NaN}}main(e,t){ +const i=t(6),n=e.new_unlimited_var(s.Std.time(e)),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)return null;if(this._resultSent)return null;const c=t(0),h=t(1),d=t(2),u=t(3),_=t(4),p=t(5),m=n.indexOf(_),g=n.indexOf(p),f=[],y=[],v=[],S=[];for(let e=m;e>=g;--e)f.push(n.get(e)),y.push(r.get(e)),v.push(a.get(e)),S.push(l.get(e));return this._updateData(f,d,c,u,h,_,p,o(S,y,v)),this._resultSent=!0,{type:"non_series_data",nonseries:!0,data:{data:this._data}}}_updateData(e,t,i,s,o,n,r,a){const l=e.length-1;this._data.baseLine.startPrice=a.intercept,this._data.baseLine.endPrice=a.intercept+a.slope*l;const c=a.intercept+(t?a.stdDev*i:a.upDev);this._data.upLine.startPrice=c,this._data.upLine.endPrice=c+a.slope*l;const h=a.intercept+(s?a.stdDev*o:-a.downDev);this._data.downLine.startPrice=h,this._data.downLine.endPrice=h+a.slope*l,this._data.pearsons=a.pearsons,this._data.startIndex__t=n,this._data.endIndex__t=r}}}},70680:(e,t,i)=>{"use strict";i.d(t,{SpreadRatioBase:()=>l,spreadRatioDefaults:()=>c,spreadRatioFilledAreas:()=>p,spreadRatioInputs:()=>h,spreadRatioPalettes:()=>_,spreadRatioPlots:()=>d,spreadRatioStyles:()=>u});var s=i(58978),o=i(4359),n=i(19979),r=i(52859);const a="rgba(0, 0, 0, 0)";class l{init(e,t){e.new_sym(t(1),n.Std.period(e)),this._source=t(0),this._scaleFactor1=1,this._scaleFactor2=1}main(e,t){const i=n.Std[this._source](e),s=e.new_unlimited_var(e.symbol.time);e.select_sym(1);const o=e.new_unlimited_var(e.symbol.time),r=e.new_unlimited_var(n.Std[this._source](e));e.select_sym(0);const a=r.adopt(o,s,1),l=this._doCalculation(this._scaleFactor1,i,this._scaleFactor2,a);return isNaN(l)?null:[l,0,n.Std.ge(l,0),n.Std.lt(l,0)]}}const c={styles:{plot1:{linestyle:0,linewidth:2,plottype:o.LineStudyPlotStyle.Line,trackPrice:!1,transparency:35,color:"#800080",display:15},plotBaseline:{linestyle:0,linewidth:2,plottype:o.LineStudyPlotStyle.Line,trackPrice:!1,transparency:0,color:a,display:0}},palettes:{negativePalette:{colors:[{color:(0,r.applyAlpha)((0,s.getHexColorByName)("color-ripe-red-500"),.5),style:0,width:0},{color:a,style:0,width:0}]},positivePalette:{colors:[{color:(0,r.applyAlpha)((0,s.getHexColorByName)("color-minty-green-500"),.5),style:0,width:0},{color:a,style:0,width:0}]}},filledAreasStyle:{negativeFill:{color:"",transparency:0,visible:!0,fillType:void 0},positiveFill:{color:"",transparency:0,visible:!0,fillType:void 0}},precision:2,inputs:{source:"close",symbol2:""}},h=[{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"text"},{id:"symbol2",name:"Symbol",type:"symbol",confirm:!0}],d=[{id:"plot1",type:"line"},{id:"plotBaseline",type:"line"},{id:"plotNegativeFill",type:"colorer",target:"negativeFill",palette:"negativePalette"},{id:"plotPositiveFill",type:"colorer",target:"positiveFill",palette:"positivePalette"}],u={plot1:{title:"Plot",histogramBase:0},plotBaseline:{title:"Baseline",isHidden:!0}},_={negativePalette:{valToIndex:{0:0,1:1},colors:[{name:"Color"}]}, +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});var s=i(70680);class o extends s.SpreadRatioBase{_doCalculation(e,t,i,s){return e*t-i*s}}const n={name:"Spread",metainfo:{_metainfoVersion:15,defaults:s.spreadRatioDefaults,plots:s.spreadRatioPlots,styles:s.spreadRatioStyles,palettes:s.spreadRatioPalettes,filledAreas:s.spreadRatioFilledAreas,description:"Spread",shortDescription:"Spread",is_price_study:!1,inputs:s.spreadRatioInputs,id:"Spread@tv-basicstudies-1",format:{type:"price",precision:2}},constructor:o}},60755:(e,t,i)=>{"use strict";i.d(t,{VbPCheckHaveVolumeExpr:()=>o});var s=i(19979);class o{constructor(e){this._haveAnyVolume=!1,this._isDisabled=!1,this._seriesGetter=e}update(e,t){if(this._haveAnyVolume||this._isDisabled)return;const i=this._seriesGetter.volume().get(e);0!==i&&Number.isFinite(i)&&(this._haveAnyVolume=!0),t&&(this._haveAnyVolume||s.Std.error("The data vendor doesn't provide volume data for this symbol."),this._isDisabled=!0)}}},96777:(e,t,i)=>{"use strict";i.d(t,{VolumeByPriceExpr:()=>g});var s=i(50151),o=i(77914),n=i(46082),r=i(86811);class a extends r.GraphicsObj{constructor(e,t,i,o,n,r){super(e),(0,s.assert)(t({index:e.index,offset:e.offset,level:e.level})))}}}class p extends r.GraphicsObj{constructor(e,t,i,s,o=!1,n=!1){super(e),this._endIndex=this._mixinJSONObject.createTimeField(i,"endIndex"),this._extendLeft=this._mixinJSONObject.createField(o,"extendLeft"),this._extendRight=this._mixinJSONObject.createField(n,"extendRight"),this._level=this._mixinJSONObject.createDoubleField(s,"level"),this._startIndex=this._mixinJSONObject.createTimeField(t,"startIndex")}isNaN(){return super.isNaN()||Number.isNaN(this._level.get())||this._startIndex.get()<0||this._endIndex.get()<0||this._startIndex.get()===this._endIndex.get()&&!this._extendLeft.get()&&!this._extendRight.get()}jsonName(){return"horizlines"}primitiveData(){return{id:this.id(),startIndex:this._startIndex.get(),endIndex:this._endIndex.get(),extendLeft:this._extendLeft.get(),extendRight:this._extendRight.get(),level:this._level.get()}}startIndex(){return this._startIndex.get()}setStartIndex(e){this._startIndex.set(e)&&this._processObjUpdate()}endIndex(){return this._endIndex.get()}setEndIndex(e){this._endIndex.set(e)&&this._processObjUpdate()}level(){return this._level.get()}setLevel(e){this._level.set(e)&&this._processObjUpdate()}isExtendLeft(){return this._extendLeft.get()}setExtendLeft(e){this._extendLeft.set(e)&&this._processObjUpdate()}extendLeft(){return this.isExtendLeft()}isExtendRight(){return this._extendRight.get()}setExtendRight(e){this._extendRight.set(e)&&this._processObjUpdate()}extendRight(){return this.isExtendRight()}}!function(e){e[e.AssertAccuracy=.05]="AssertAccuracy"}(l||(l={})),function(e){e[e.START=0]="START",e[e.END=1]="END"}(c||(c={}));class m{constructor(){this._map=new Map}get(e){const t=this._innerMap(e.start);return t&&t.get(e.end)}set(e,t){this._innerMap(e.start,!0).set(e.end,t)}clear(){this._map.clear()}size(){let e=0;return this._map.forEach((t=>e+=t.size)),e}_innerMap(e,t){let i=this._map.get(e);return void 0===i&&t&&(i=new Map,this._map.set(e,i)),i}}class g{constructor(e,t,i,o,n,r,a,l,c,d,u,_,p,g,f){ +this._freezedBoxes=new h.GraphicsList,this._freezedHists=new h.GraphicsList,this._freezedPocs=new h.GraphicsList,this._freezedVAHists=new h.GraphicsList,this._currentHistsGr=new h.GraphicsList,this._currentVAHistsGr=new h.GraphicsList,this._currentHists=[],this._currentHistsMap=new m,this._currentBox=null,this._currentPoc=null,this._historyBarSet=[],this._prevRtBar=null,this._minPrice=Number.POSITIVE_INFINITY,this._maxPrice=Number.NEGATIVE_INFINITY,this._leftBoxTime=null,this._rightBoxTime=null,this._actualRightBoxTime=null,this._needRecalc=!1,this._largestHistItem=null,this._rowsLayout=null,this._currentVAStart=0,this._currentVAEnd=0,this._previousVAStart=0,this._previousVAEnd=0,this._idsGenerator=null,(0,s.assert)(1===e||2===e),this._numOfSubHists=e,this._outHists=o,this._outBoxLines=n,this._outPocLines=r,this._extendPocLeftRight=a,this._outVAHists=l,this._vaVolumePercent=c,this._rowsLayoutSupplier=d,this._outHists.addStable(this._freezedHists),this._outVAHists.addStable(this._freezedVAHists),this._maxHHistItems=u,this._layoutIsAutoselected=g,this._leftBoxTimeMutable=_,this._rightBoxTimeMutable=p,this._actualRightBoxTime=f??p,this._ctx=t,this._seriesGetter=i}update(e){this._supplyRowsLayout(this._ctx),null===this._currentBox&&this._initCurrentBox(),null===this._currentPoc&&this._initCurrentPoc();const t=this._timeScale().get(e);this._leftBoxTime=this._leftBoxTimeMutable,this._rightBoxTime=this._rightBoxTimeMutable,this._ctx.symbol.isLastBar&&!Number.isNaN(this._rightBoxTime)&&(this._rightBoxTime=Math.min(t+n.Interval.parse(this._ctx.symbol.interval+this._ctx.symbol.resolution).inMilliseconds(t)-1,this._rightBoxTime));const i=d.Std.greaterOrEqual(this._seriesClose().get(e),this._seriesOpen().get(e)),s={high:this._seriesHigh().get(e),low:this._seriesLow().get(e),volume:this._seriesVol().get(e),isUp:i,time:t};this._updateCurrentHistogram(s),this._currentHists.length>0&&(this._largestHistItem=this._getLargestHistItem(),this._updateCurrentPoc(),this._seriesGetter.developingPoc().set(this._currentPoc.level()),this._updateValueArea(),this._vaVolumePercent>0&&(this._seriesGetter.developingVAHigh().set(this._currentHists[this._currentVAEnd].priceHigh()),this._seriesGetter.developingVALow().set(this._currentHists[this._currentVAStart].priceLow()))),this._updateCurrentBox(),this._rebuildOutData()}setIdsGeneratorProxy(e){this._idsGenerator=e}nextGraphicsObjId(){return(0,s.ensureNotNull)(this._idsGenerator).nextGraphicsObjId()}pushEraseObjCmd(e,t){(0,s.ensureNotNull)(this._idsGenerator).pushEraseObjCmd(e,t)}popEraseCmds(){return(0,s.ensureNotNull)(this._idsGenerator).popEraseCmds()}_timeScale(){return this._seriesGetter.time()}_seriesLow(){return this._seriesGetter.low()}_seriesHigh(){return this._seriesGetter.high()}_seriesVol(){return this._seriesGetter.volume()}_seriesOpen(){return this._seriesGetter.open()}_seriesClose(){return this._seriesGetter.close()}_freezeCurrentHistogramAndCleanup(){null!==this._currentBox&&this._freezedBoxes.add(this._currentBox), +d.Std.greater(this._getVolume(this._currentHists),0)&&(this._freezedHists.addAll(this._currentHistsGr),this._freezedVAHists.addAll(this._currentVAHistsGr),null!==this._currentPoc&&this._freezedPocs.add(this._currentPoc)),this._currentHists=[],this._currentHistsGr.clear(),this._currentHistsMap.clear(),this._initCurrentBox(),this._initCurrentPoc(),this._currentVAHistsGr.clear(),this._historyBarSet=[],this._minPrice=Number.POSITIVE_INFINITY,this._maxPrice=Number.NEGATIVE_INFINITY,this._prevRtBar=null,this._leftBoxTime=null,this._rightBoxTime=null}_supplyRowsLayout(e){null===this._rowsLayout&&e.symbol.isFirstBar&&e.symbol.isNewBar&&(this._rowsLayout=this._rowsLayoutSupplier())}_updateCurrentHistogram(e){if(this._needRecalc=!1,d.Std.greater(this._minPrice,e.low)&&(this._minPrice=e.low,this._needRecalc=!0),d.Std.less(this._maxPrice,e.high)&&(this._maxPrice=e.high,this._needRecalc=!0),this._ctx.symbol.isBarClosed&&this._historyBarSet.length>0){const t=this._historyBarSet[this._historyBarSet.length-1];t.time===e.time&&(this._prevRtBar=t,this._historyBarSet.pop())}this._needRecalc&&0===(0,s.ensureNotNull)(this._rowsLayout).type()?(this._recalculateCurrentResultsOnHistoryBarSet(),this._applyUpdateToCurrentResults(e,!1)):this._applyUpdateToCurrentResults(e,!0),this._ctx.symbol.isBarClosed?((0,s.assert)(null===this._prevRtBar||e.time===this._prevRtBar.time),this._historyBarSet.push(e),this._prevRtBar=null):this._prevRtBar=e}_getMidLevel(e){return(e.priceHigh()+e.priceLow())/2}_getMidLevelFromList(e){return e.length%2==0?e[e.length/2].priceLow():this._getMidLevel(e[Math.floor(e.length/2)])}_getLargestHistItem(){let e=[],t=this._currentHists[0];for(const i of this._currentHists)d.Std.greater(i.ratesSum(),t.ratesSum())?(t=i,e=[t]):d.Std.equal(i.ratesSum(),t.ratesSum())&&e.push(i);if(e.length>1){const i=this._getMidLevelFromList(this._currentHists);t=e[e.length-1];for(let s=e.length-2;s>=0;s--){const o=e[s];d.Std.lessOrEqual(Math.abs(this._getMidLevel(o)-i),Math.abs(this._getMidLevel(t)-i))&&(t=o)}}return t}_initCurrentPoc(){this._currentPoc=new p(this,0,0,0)}_updateCurrentPoc(){const e=(0,s.ensureNotNull)(this._currentPoc);e.setStartIndex((0,s.ensureNotNull)(this._leftBoxTime)),e.setEndIndex((0,s.ensureNotNull)(this._actualRightBoxTime)),e.setExtendLeft(this._extendPocLeftRight),e.setExtendRight(this._extendPocLeftRight);const t=this._getMidLevel((0,s.ensureNotNull)(this._largestHistItem));e.setLevel(t)}_getVolume(e){let t=0;for(const i of e)t+=i.ratesSum();return t}_getPocHistItemIndex(){for(let e=0;e=0,`ERROR - PocHistItemIndex == ${e}`),this._currentVAStart=e-1,this._currentVAEnd=e+1;const t=this._getVolume(this._currentHists)*this._vaVolumePercent*.01;let i=this._currentHists[e].ratesSum(),o=0,n=null;for(;d.Std.lessOrEqual(i+o,t)&&(i+=o,0===n?--this._currentVAStart:1===n&&++this._currentVAEnd, +-1!==this._currentVAStart||this._currentVAEnd!==this._currentHists.length);){let t,i;if(this._currentVAStart>-1)if(t=this._currentHists[this._currentVAStart].ratesSum(),this._currentVAEndthis._getMidLevel(this._currentHists[this._currentVAStart])&&e.priceLow()0&&(e=this._currentHists[0].priceLow(),t=this._currentHists[this._currentHists.length-1].priceHigh());const i=[],o=(0,s.ensureNotNull)(this._leftBoxTime),n=(0,s.ensureNotNull)(this._actualRightBoxTime);i.push(new u(o,e)),i.push(new u(o,t)),i.push(new u(n,t)),i.push(new u(n,e)),(0,s.ensureNotNull)(this._currentBox).setPoints(i)}_recalculateCurrentResultsOnHistoryBarSet(){for(let e=0;e0&&(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");const r=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);const u=h.rowWidth();if(!d.Std.greater(u,0))return;h.calculate();const _=h.getIndexLowVbP(),p=h.getIndexHighVbP(),m=h.getStartPrice();if(_===p){const e=_*u+m,t=(_+1)*u+m;this._updateResult({start:e,end:t},n*l,c,i,o)}else{let e=0;for(let t=_;t<=p;t++){const s=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){const r=this._createRates(i,t);(0,s.assert)(null!==this._leftBoxTime,"leftBoxTime is not set (equals null)"),(0,s.assert)(null!==this._rightBoxTime,"rightBoxTime is not set (equals null)");const l=(0,s.ensureNotNull)(this._leftBoxTime),c=(0,s.ensureNotNull)(this._actualRightBoxTime);let h=n.get(e);if(void 0===h)h=new a(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)=>{let i=d.Std.compare(e.firstBarTime(),t.firstBarTime());return 0!==i?i:(i=d.Std.compare(e.priceLow(),t.priceLow()),0!==i?i:d.Std.compare(e.priceHigh(),t.priceHigh()))}));else{const e=[];for(let t=0;t0?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:()=>_});var s,o=i(37103),n=i(46082);!function(e){e[e.NumberOfRows=0]="NumberOfRows",e[e.TicksPerRow=1]="TicksPerRow"}(s||(s={}));class r{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(){return this._startPrice}setStartPrice(e){this._startPrice=e}getIndexLowVbP(){return this._indexLowVbP}setIndexLowVbP(e){this._indexLowVbP=e}getIndexHighVbP(){return this._indexHighVbP}setIndexHighVbP(e){this._indexHighVbP=e}type(){return this._type}}class a extends r{constructor(e){super(e,0)}calculate(){this.setStartPrice(this._minPrice);const e=this.rowWidth();let t=Math.floor((this._low-this._minPrice)/e),i=Math.ceil((this._high-this._minPrice)/e)-1;t=Math.max(t,0),i=Math.max(i,0),i=Math.min(i,this._rowSize-1),t=Math.min(t,i),this.setIndexLowVbP(t),this.setIndexHighVbP(i)}rowWidth(){return Math.max((this._maxPrice-this._minPrice)/this._rowSize,this._minTick)}}class l extends r{constructor(e){super(e,1)}calculate(){this.setStartPrice(0);const e=this.rowWidth();let t=Math.floor(this._low/e);const i=Math.ceil(this._high/e)-1;t=Math.min(t,i),this.setIndexLowVbP(t),this.setIndexHighVbP(i)}rowWidth(){return this._minTick*this._rowSize}}var c,h=i(19979),d=i(47132);function u(){return 6e3}function _(e){switch(e){case"Delta":case"Up/Down":return 2;case"Total":return 1;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={}));class p{findBasicResolutionForFromTo(e,t,i,s){const r=(0,d.getVolumeProfileResolutionForPeriod)(e.value(),t,i,s),a=n.Interval.parse(r);return o.enabled("charting_library_debug_mode")&&console.log(`${(new Date).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?new a(t):new l(t)}}},74109:(e,t,i)=>{"use strict";i.d(t,{volumeProfileFixedRangeBSStudyItem:()=>w,volumeProfileFixedRangeVbPStudyItem:()=>b});var s=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);class g extends m.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){const t=this._timeScale().get(e);return this._firstBarTime<=t&&t=this._firstBarTime){const e=this._developingPocSeries.getLeftOrEqual(n),t=this._developingVAHighSeries.getLeftOrEqual(n),i=this._developingVALowSeries.getLeftOrEqual(n);o.data.push([e,t,i])}else o.data.push([NaN,NaN,NaN])}return o}time(){return this._timeSeries}open(){return this._openSeries}high(){return this._highSeries}low(){return this._lowSeries}close(){return this._closeSeries}volume(){return this._volumeSeries}developingPoc(){return this._developingPocSeries}developingVAHigh(){return this._developingVAHighSeries}developingVALow(){return this._developingVALowSeries}}function S(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}}}const b=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});var s=i(50151),o=i(12217);class n{constructor(){this._histPos=-1,this._hist=new Float64Array(2e3),this._times=new Float64Array(2e3)}addHist(e){if(this._histPos>=0){const t=this._times[this._histPos];(0,s.assert)(t<=e,"History order violation"),this._histPos+=t===e?0:1}else this._histPos+=1;if(this._histPos===this._hist.length){const e=new Float64Array(2*this._hist.length);e.set(this._hist),this._hist=e;const t=new Float64Array(this._hist.length);t.set(this._times),this._times=t}this._hist[this._histPos]=NaN,this._times[this._histPos]=e}removeLastIfNaN(){Number.isNaN(this.get(0))&&(this._histPos-=1)}get(e){(0,s.assert)(0===e);const t=this._histPos-e;return this._hist[t]}getLeftOrEqual(e){const t=(0,o.upperbound)(this._times,e,((e,t)=>e{"use strict";i.d(t,{volumeProfileVisibleRangeStudyItem:()=>y});var s=i(50151),o=i(13823),n=i(99481),r=i(46082),a=i(3186),l=i(96777),c=i(30376);class h extends l.VolumeByPriceExpr{constructor(e,t,i,s,o,n,r,a,l,h,d){super(e,t,i,n,new c.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){const t=this._timeScale().get(e);return this._firstBarTime<=t&&t=this._firstBarTime){const e=this._developingPocSeries.getLeftOrEqual(n),t=this._developingVAHighSeries.getLeftOrEqual(n),i=this._developingVALowSeries.getLeftOrEqual(n);o.data.push([e,t,i])}else o.data.push([NaN,NaN,NaN])}return o}time(){return this._timeSeries}open(){return this._openSeries}high(){return this._highSeries}low(){return this._lowSeries}close(){return this._closeSeries}volume(){return this._volumeSeries}developingPoc(){return this._developingPocSeries}developingVAHigh(){return this._developingVAHighSeries}developingVALow(){return this._developingVALowSeries}}const y={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});class s extends Error{constructor(e,t){super(e),this.studyError=!0,this.title=t}}},75719:(e,t,i)=>{"use strict";var s;i.d(t,{EraseAll:()=>n,EraseObj:()=>o,GraphicsCmds:()=>r}),function(e){e.One="one",e.All="all"}(s||(s={}));class o{constructor(e,t){this.id=e,this.type=t}primitiveData(){return{action:"one",id:this.id,type:this.type}}}class n{primitiveData(){return{action:"all"}}}class r{constructor(){this.erase=[],this.create=null,this._modified=!1}primitiveData(e){if(this.isNaN())return null;const t={},i=this.create&&this.create.primitiveData(e);return null!==i&&(t.create=i),null!==this.erase&&this.erase.length>0&&(t.erase=this.erase.map((e=>e.primitiveData()))),void 0===t.create&&void 0===t.erase?null:t}setCreate(e){this.create=e,this.create.forEachList((e=>e.setOwner(this)))}isNaN(){return(null===this.erase||0===this.erase.length)&&null===this.create}isModified(){return this._modified}setModified(e){this._modified=e}dirty(){this._modified=!0}setOwner(e){throw new Error("Unsupported")}}},3186:(e,t,i)=>{"use strict";i.d(t,{GraphicsListColl:()=>s});class s{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){const t=[];return this._forEach((i=>t.push(...i.primitivesData(e)))),t}deleteErasedItems(){this._forEach((e=>e.deleteErasedItems()))}markPostedItems(){this._forEach((e=>e.markPostedItems()))}isNaN(){return this._all((e=>e.isNaN()))}dirty(){null!==this._owner&&this._owner.dirty()}setOwner(e){this._owner=e}_forEach(e){for(const t of this._stable)e(t);null!==this._variable&&e(this._variable)}_all(e){for(const t of this._stable)if(!e(t))return!1;return null===this._variable||e(this._variable)}}},30376:(e,t,i)=>{"use strict";i.d(t,{GraphicsList:()=>n});var s=i(86811),o=i(31645);class n{constructor(){this._items=[],this._owner=null}primitivesData(e){const t=[];for(const i of this._items)e.isIgnoredObj(i)||t.push(i.primitiveData());return t}get(e){return this._items[e]}set(e,t){return this.dirty(),t.setOwner(this),this._items[e]=t,t}addAtIndex(e,t){this.dirty(),t.setOwner(this),this._items[e]=t}clear(){this._unsetOwner(this._items),this._items=[],this.dirty()}addAllFromNumber(e,t){this.setOwner(t),this._items.splice(e,0,...t._items);const i=!0;return this._setCachedDataValid(!1),i}addAll(e){this.setOwner(e),this._items.push(...e._items);const t=!0;return this._setCachedDataValid(!1),t}remove(e){const t=this._items[e];return this._items.splice(e,1),t.unsetOwner(this),this.dirty(),t}getItems(){return this._items}size(){return this._items.length}add(e){e.setOwner(this),this._items.push(e);const t=!0;return this._setCachedDataValid(!1),t}deleteErasedItems(){this._items=this._items.filter((e=>!e.isErased()))}markPostedItems(){for(const e of this._items)e.markAsPosted()}isNaN(){ +if(0===this._items.length)return!0;for(const e of this._items){if(!(0,o.isNaNable)(e))return!1;if(!e.isNaN())return!1}return!0}setOwner(e){this._owner=e}dirty(){null!==this._owner&&this._owner.dirty()}_unsetOwner(e){for(const t of e)t instanceof s.GraphicsObj&&t.unsetOwner(this)}_setCachedDataValid(e){e||this.dirty()}}},86811:(e,t,i)=>{"use strict";i.d(t,{GraphicsObj:()=>l});var s=i(19979);class o{constructor(e,t,i,s){this._value=e,this._name=t,this._owner=i,this._comparer=void 0!==s?s:(e,t)=>null==e?null!=t:e===t}getName(){return this._name}set(e){const t=this._comparer(this._value,e);return t&&this._owner.dirty(),this._value=e,t}get(){return this._value}}class n{constructor(e,t,i){this._owner=null,this._value=e,this._name=t,this._owner=i}getName(){return this._name}set(e){return this._value!==e&&(this._value=e,null!==this._owner&&this._owner.dirty(),!0)}get(){return this._value}}class r extends o{constructor(e,t,i,s){super(e,t,i,s)}}class a{constructor(e){this._owner=e}createField(e,t){return new o(e,t,this)}createDoubleField(e,t){return new o(e,t,this,((e,t)=>!s.Std.equal(e,t)))}createDoubleArrayField(e,t){return new r(e,t,this,((e,t)=>{if(e===t)return!1;const i=e.length;if(t.length!==i)return!0;for(let o=0;o{"use strict";function s(e){return Boolean(e.isNaN)}i.d(t,{isNaNable:()=>s})},13421:(e,t,i)=>{"use strict";i.d(t,{JStudyDataUpdate:()=>p});var s=i(75719);class o{constructor(){this.isUpdate=!1,this.graphicsCmds=new s.GraphicsCmds,this._offsetsChanged=!1,this._disableGraphicsAndData=!1}isNaN(){return this.graphicsCmds.isNaN()}primitiveData(e){const t={};if(!this._disableGraphicsAndData){const i=this.graphicsCmds.primitiveData(e);null!==i&&(t.graphicsCmds=i)}return this.isUpdate&&(t.isUpdate=!0),void 0===t.graphicsCmds?void 0:t}disable(){this._disableGraphicsAndData=!0}checkForChangeAndResetChangedState(e){const t=this._offsetsChanged,i=this.graphicsCmds.isModified();this.graphicsCmds.setModified(!1),this._offsetsChanged=!1;return i||t||0!==e.length}}class n{constructor(e){this._dataObj=new o,this._isDirty=!1,this._eraseCmds=[], +this._enableCmdDataStudy=e}init(e){this._dataObj.graphicsCmds.setCreate(e),this.update(!0)}dataObj(){return this._dataObj}setEraseCmds(e){this._eraseCmds=e}resetDirtyState(){this._isDirty=!1}disable(){this._dataObj.disable()}}var r,a=i(87465),l=i(31645);function c(e){return Boolean(e.isPosted)}!function(e){e[e.New=0]="New",e[e.Posted=1]="Posted",e[e.Erased=2]="Erased"}(r||(r={}));class h{isIgnoredObj(e,t){return h.isIgnoredObjDefault(e,t)}static isIgnoredObjDefault(e,t){if(void 0===t)return h.isIgnoredObjNaNable(e);const i=e[t];return h.isIgnoredByGeneralRules(e,t)||h.isIgnoredObjNaNable(i)||h.isIgnoredObjListOfNaNables(i)}static isIgnoredObjNaNable(e){return(0,l.isNaNable)(e)&&e.isNaN()}static isIgnoredObjListOfNaNables(e){if(!(0,a.isArray)(e))return!1;let t=!0;for(const i of e)if(!(0,l.isNaNable)(i)||!i.isNaN()){t=!1;break}return t}static isIgnoredObjPosted(e){return c(e)&&e.isPosted()}static isIgnoredObjErased(e){return c(e)&&e.isErased()}static isIgnoredByGeneralRules(e,t){const i=e[t];return(0,a.isArray)(i)&&0===i.length}}class d{isIgnoredObj(e,t){if(void 0===t)return h.isIgnoredObjDefault(e)||h.isIgnoredObjErased(e);const i=e[t];return h.isIgnoredObjDefault(e,t)||h.isIgnoredObjErased(i)}}class u extends n{constructor(e){super(e),this._snapshotPredicate=new d,this._dataSnapShot={}}getData(){return this._dataSnapShot}getUpdate(){return this._isDirty?this._dataSnapShot:{}}update(e){(this._dataObj.checkForChangeAndResetChangedState(this._eraseCmds)||e)&&(null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.create.deleteErasedObjs(),this._dataObj.graphicsCmds.erase=[new s.EraseAll]),this._makeSnapshot(),this._isDirty=!0)}_makeSnapshot(){this._json=this._dataObj.primitiveData(this._snapshotPredicate),this._dataSnapShot={json:this._json}}}class _{isIgnoredObj(e,t){if(void 0===t)return h.isIgnoredObjDefault(e)||h.isIgnoredObjErased(e)||h.isIgnoredObjPosted(e);const i=e[t];return h.isIgnoredObjDefault(e,t)||h.isIgnoredObjErased(i)||h.isIgnoredObjPosted(i)}}class p extends u{constructor(e){super(e),this._updatePredicate=new _,this._sendShapshotOnly=!0,this._isFirstNotForcedUpdate=!0}update(e){(this._dataObj.checkForChangeAndResetChangedState(this._eraseCmds)||e)&&(null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.erase=[new s.EraseAll]),this._dataObj.isUpdate=!0,this._makeSnapshot(),null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.erase=this._eraseCmds),this._dataObj.isUpdate=!0,this._jsonUpdate=this._dataObj.primitiveData(this._updatePredicate),null!==this._dataObj.graphicsCmds.create&&this._dataObj.graphicsCmds.create.deleteErasedAndMarkPostedObjs(),this._sendShapshotOnly=e||this._isFirstNotForcedUpdate,this._isFirstNotForcedUpdate=Boolean(e),this._isDirty=!0)}getUpdate(){return this._isDirty?this._enableCmdDataStudy?{json:this._sendShapshotOnly?this._json:void 0,jsonUpdate:this._sendShapshotOnly?void 0:this._jsonUpdate}:{json:this._json,jsonUpdate:this._sendShapshotOnly?void 0:this._jsonUpdate}:{}}}},45591:(e,t,i)=>{"use strict";i.d(t,{Container:()=>n, +StudyGraphicsData:()=>o});var s=i(50151);class o{constructor(){this._horizlines=[],this._hhists=[],this._polygons=[],this._vertlines=[],this._containersCache=[],this._containerNamesCache=[],this._containersMapCache=new Map,this._addToCache("horizlines",this._horizlines),this._addToCache("hhists",this._hhists),this._addToCache("polygons",this._polygons),this._addToCache("vertlines",this._vertlines)}primitiveData(e){const t={};let i=!1;for(const s of this._containerNamesCache){const o=[],n=this.getObjsContainer(s);for(const t of n){if(t.isNaN())continue;const i=t.primitiveData(e);i.data.length>0&&o.push(i)}o.length>0&&(t[s]=o,i=!0)}return i?t:null}deleteErasedAndMarkPostedObjs(){this.forEachList((e=>{e.deleteErasedItems(),e.markPostedItems()}))}deleteErasedObjs(){this.forEachList((e=>e.deleteErasedItems()))}getObjsContainer(e){return(0,s.ensureDefined)(this._containersMapCache.get(e))}forEachList(e){for(const t of this._containersCache)for(const i of t)e(i.data)}_addToCache(e,t){this._containersCache.push(t),this._containerNamesCache.push(e),this._containersMapCache.set(e,t)}}class n{constructor(e,t){this.styleId=e,this.data=t}isNaN(){return this.data.isNaN()}primitiveData(e){return{styleId:this.styleId,data:this.data.primitivesData(e)}}}},4783:(e,t,i)=>{"use strict";const s=i(58978).getHexColorByName,o=i(19979).Std,n=s("color-ripe-red-100"),r=s("color-ripe-red-200"),a=s("color-ripe-red-500"),l=s("color-ripe-red-900"),c=s("color-ripe-red-a200"),h=s("color-minty-green-100"),d=s("color-minty-green-400"),u=s("color-minty-green-500");JSServer.studyLibrary=[{name:"Accumulation/Distribution",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Accumulation/Distribution",shortDescription:"Accum/Dist",is_price_study:!1,inputs:[],id:"Accumulation/Distribution@tv-basicstudies-1",scriptIdPart:"",name:"Accumulation/Distribution",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i,s){return o.or(o.and(o.eq(e,t),o.eq(e,i)),o.eq(t,i))?0:(2*e-i-t)/(t-i)*s},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0(o.close(this._context),o.high(this._context),o.low(this._context),o.volume(this._context));return[o.cum(i,this._context)]}}},{name:"Accumulative Swing Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"ASI",histogramBase:0,joinPoints:!1}},description:"Accumulative Swing Index",shortDescription:"ASI",is_price_study:!1,inputs:[{id:"in_0",name:"Limit Move Value",defval:10,type:"float",min:.1,max:1e5}],id:"Accumulative Swing Index@tv-basicstudies-1",scriptIdPart:"",name:"Accumulative Swing Index",format:{ +type:"volume"}},constructor:function(){this.f_0=function(e,t){var i=t.new_var(o.open(t)),s=t.new_var(o.high(t)),n=t.new_var(o.low(t)),r=t.new_var(o.close(t)),a=o.abs(s-r.get(1)),l=o.abs(n-r.get(1)),c=o.abs(s-n),h=o.abs(r.get(1)-i.get(1)),d=o.max(a,l),u=o.iff(a>=o.max(l,c),a-.5*l+.25*h,o.iff(l>=o.max(a,c),l-.5*a+.25*h,c+.25*h));return o.iff(0===u,0,(r-r.get(1)+.5*(r-i)+.25*(r.get(1)-i.get(1)))/u*d/e*50)},this.f_1=function(e,t){var i=this.f_0(e,t);return o.cum(i,t)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);return[this.f_1(i,this._context)]}}},{name:"Advance/Decline",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Advance/Decline",shortDescription:"AD",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:2e3}],id:"Advance/Decline@tv-basicstudies-1",scriptIdPart:"",name:"Advance/Decline",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t){return o.gt(e,t)},this.f_1=function(e,t){return o.lt(e,t)},this.f_2=function(e,t){return 0===t?e:e/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(o.close(this._context),o.open(this._context)),n=this._context.new_var(s),r=o.sum(n,i,this._context),a=this.f_1(o.close(this._context),o.open(this._context)),l=this._context.new_var(a),c=o.sum(l,i,this._context);return[this.f_2(r,c)]}}},{name:"Arnaud Legoux Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:.85,in_2:6}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Arnaud Legoux Moving Average",shortDescription:"ALMA",is_price_study:!0,inputs:[{id:"in_0",name:"Window Size",defval:9,type:"integer",min:0,max:5e3},{id:"in_1",name:"Offset",defval:.85,type:"float",min:-1e12,max:1e12},{id:"in_2",name:"Sigma",defval:6,type:"float",min:-1e12,max:1e12}],id:"Arnaud Legoux Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Arnaud Legoux Moving Average",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=o.close(this._context),s=this._input(0),n=this._input(1),r=this._input(2),a=this._context.new_var(i);return[o.alma(a,s,n,r)]}}},{name:"Aroon",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FB8C00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Upper", +histogramBase:0,joinPoints:!1},plot_1:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Aroon",shortDescription:"Aroon",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Aroon@tv-basicstudies-1",scriptIdPart:"",name:"Aroon",format:{precision:2,type:"percent"}},constructor:function(){this.f_0=function(e,t){return 100*(e+t)/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=o.high(this._context),n=i+1,r=this._context.new_var(s),a=o.highestbars(r,n,this._context),l=this.f_0(a,i),c=o.low(this._context),h=this._context.new_var(c),d=o.lowestbars(h,n,this._context);return[l,this.f_0(d,i)]}}},{name:"Average Price",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"AveragePrice@tv-basicstudies-1",scriptIdPart:"",name:"Average Price",description:"Average Price",shortDescription:"Average Price",is_price_study:!0,plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{symbol:""}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"symbol",name:"Other Symbol",defval:"",type:"symbol",optional:!0,isHidden:!1}],format:{type:"inherit"}},constructor:function(){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){if(this._context=e,this._input=t,""===this._input(0))return[o.ohlc4(this._context)];this._context.select_sym(0);const i=this._context.new_var(this._context.symbol.time);this._context.select_sym(1);const s=this._context.new_var(o.ohlc4(this._context)).adopt(this._context.new_var(this._context.symbol.time),i,1);return this._context.select_sym(0),[s]}}},{name:"Average Directional Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:c}},inputs:{in_0:14,in_1:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"ADX",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Average Directional Index",shortDescription:"ADX",is_price_study:!1,inputs:[{id:"in_0",name:"ADX Smoothing",defval:14,type:"integer",min:-1e12,max:1e12},{id:"in_1",name:"DI Length",defval:14,type:"integer",min:-1e12,max:1e12}],id:"average_directional_Index@tv-basicstudies-1",scriptIdPart:"",name:"Average Directional Index",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e){var t=this._context.new_var(o.high(this._context)),i=o.change(t),s=this._context.new_var(o.low(this._context)),n=-o.change(s),r=this._context.new_var(o.tr(void 0,this._context)),a=o.rma(r,e,this._context),l=this._context.new_var(o.and(o.gt(i,n),o.gt(i,0))?i:0),c=o.fixnan(100*o.rma(l,e,this._context)/a,this._context),h=this._context.new_var(o.and(o.gt(n,i),o.gt(n,0))?n:0);return[c,o.fixnan(100*o.rma(h,e,this._context)/a,this._context)]},this.f_1=function(e,t){ +var i=this.f_0(e),s=i[0],n=i[1],r=s+n,a=this._context.new_var(o.abs(s-n)/(o.eq(r,0)?1:r));return[100*o.rma(a,t,this._context)]},this.main=function(e,t){return this._context=e,this._input=t,this._context.setMinimumAdditionalDepth(this._input(0)+this._input(1)),this.f_1(this._input(1),this._input(0))}}},{name:"Average True Range",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:l}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Average True Range",shortDescription:"ATR",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Average True Range@tv-basicstudies-1",scriptIdPart:"",name:"Average True Range",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){var i=t(0);return[o.atr(i,e)]}}},{name:"Awesome Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:0,visible:!0,color:"#000080"}},palettes:{palette_0:{colors:{0:{color:a,width:1,style:0},1:{color:u,width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Awesome Oscillator",shortDescription:"AO",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}}}},inputs:[],id:"Awesome Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Awesome Oscillator",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e){return o.le(e,0)?0:1},this.main=function(e,t){this._context=e,this._input=t;var i=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=l,h=this._context.new_var(l),d=o.change(h);return[c,this.f_1(d)]}}},{name:"Accelerator Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:0,visible:!0,color:"#000080"}},palettes:{palette_0:{colors:{0:{color:a,width:1,style:0},1:{color:u,width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Accelerator Oscillator",shortDescription:"AO",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}}}},inputs:[],id:"Accelerator Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Accelerator Oscillator",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e){return o.le(e,0)?0:1},this.main=function(e,t){this._context=e,this._input=t ;var i=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){return this._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){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-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;var i=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) ;if(""!==n){this._context.select_sym(1);var h=this._context.new_var(o.time(this._context));s=this._context.new_var(o.close(this._context)).adopt(h,i,1),this._context.select_sym(0)}var d,u=this._context.new_var(s);"EMA"===c?d=o.ema(u,r,this._context):"WMA"===c?d=o.wma(u,r,this._context):"SMA"===c&&(d=o.sma(u,r,this._context));var _=this._context.new_var(s),p=o.stdev(_,r,this._context),m=this.f_0(a,p);return[{value:d,offset:l},{value:this.f_1(d,m),offset:l},{value:this.f_2(d,m),offset:l}]}}},{name:"Bollinger Bands %B",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:d}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:1},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],filledAreasStyle:{fill_0:{color:"#26A69A",transparency:90,visible:!0}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Bollinger Bands %B",shortDescription:"BB %B",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50}],id:"Bollinger Bands %B@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands %B",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-t},this.f_3=function(e,t,i){return(e-t)/(i-t)},this.main=function(e,t){this._context=e,this._input=t;var i=o.close(this._context),s=this._input(0),n=this._input(1),r=this._context.new_var(i),a=o.sma(r,s,this._context),l=this._context.new_var(i),c=o.stdev(l,s,this._context),h=this.f_0(n,c),d=this.f_1(a,h),u=this.f_2(a,h);return[this.f_3(i,u,d)]}}},{name:"Bollinger Bands Width",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Bollinger Bands Width",shortDescription:"BBW",is_price_study:!1,inputs:[{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:"Bollinger Bands Width@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands Width",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-t},this.f_3=function(e,t,i){return(e-t)/i},this.main=function(e,t){this._context=e,this._input=t ;var i=o.close(this._context),s=this._input(0),n=this._input(1),r=this._context.new_var(i),a=o.sma(r,s,this._context),l=this._context.new_var(i),c=o.stdev(l,s,this._context),h=this.f_0(n,c),d=this.f_1(a,h),u=this.f_2(a,h);return[this.f_3(d,u,a)]}}},{name:"Chaikin Money Flow",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Chaikin Money Flow",shortDescription:"CMF",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:2e3}],id:"Chaikin Money Flow@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Money Flow",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i,s){return o.or(o.and(o.eq(e,t),o.eq(e,i)),o.eq(t,i))?0:(2*e-i-t)/(t-i)*s},this.f_1=function(e,t){return e/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(o.close(this._context),o.high(this._context),o.low(this._context),o.volume(this._context)),n=this._context.new_var(s),r=o.sum(n,i,this._context),a=o.volume(this._context),l=this._context.new_var(a),c=o.sum(l,i,this._context);return[this.f_1(r,c)]}}},{name:"Chaikin 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:"#EC407A"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:3,in_1:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Chaikin Oscillator",shortDescription:"Chaikin Osc",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"short",defval:3,type:"integer",min:1,max:2e3},{id:"in_1",name:"long",defval:10,type:"integer",min:1,max:2e3}],id:"Chaikin Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Oscillator",format:{type:"volume"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return e-t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=o.accdist(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:"Chaikin Volatility",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Chaikin Volatility@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Volatility",description:"Chaikin Volatility",shortDescription:"Chaikin Volatility",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#AB47BC"}},bands:[{color:"#787B86", @@ -153,7 +153,7 @@ this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=thi 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}},inputs:{in_0:20,in_1:10,in_2:10,in_3:"Simple",in_4:"close"}},plots:[{id:"plot_1",type:"line"},{id:"plot_0",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Average",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Envelopes",shortDescription:"Envelopes",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"Length",defval:20,type:"integer",min:1,max:2e3},{id:"in_1",name:"Upper Percentage",defval:2,type:"float",min:0},{id:"in_2",name:"Lower Percentage",defval:2,type:"float",min:0},{id:"in_3",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]},{id:"in_4",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]}],id:"Envelope@tv-basicstudies-1",scriptIdPart:"",name:"Envelopes",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e*(1+t)},this.f_1=function(e,t){return e*(1-t)},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(o[this._input(4)](this._context)),s=o.sma(i,this._input(0),this._context);return"Exponential"===this._input(3)?s=o.ema(i,this._input(0),this._context):"Weighted"===this._input(3)&&(s=o.wma(i,this._input(0),this._context)),[this.f_0(s,this._input(1)/100),s,this.f_1(s,this._input(2)/100)]}}},{name:"Standard Error",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Standard Error@tv-basicstudies-1",scriptIdPart:"",name:"Standard Error",description:"Standard Error",shortDescription:"Standard Error",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"}},inputs:{length:14}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"length",type:"integer",name:"Length",min:3}],format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0)},this.main=function(e,t){this._context=e,this._input=t;for(var i,s,n=this._context.new_var(o.close(this._context)),r=0,a=0,l=0;l0&&(l=.12*this.square(e.get()-s.get(1))/this.marketClosedPercentage+.88*l/(1-this.marketClosedPercentage)),l/=a,l*=this.secondsPerYear;var c=this._context.new_var(l);return 100*Math.sqrt(o.sum(c,this.period,this._context)/this.period)},this.main=function(e,t){return this._context=e,this._input=t,[this.volatilityOHLC()]}}},{name:"Volatility Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Volatility Index@tv-basicstudies-1",scriptIdPart:"",name:"Volatility Index",description:"Volatility Index",shortDescription:"Volatility Index",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,atrMult:3,method:"Wilder Smoothing"}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"periods",name:"Periods",type:"integer"},{id:"atrMult",name:"ATR Mult",type:"float"},{id:"method",name:"Method",type:"text",defval:"Exponential",options:["Exponential","Wilder Smoothing"]}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.atrMult=this._input(1),this.maMethod=this._input(2),this.nextsar=null,this.position=null,this.sic=null,this.bars=[],this.count=0,this.lastSar=null,this._context.setMinimumAdditionalDepth("Exponential"===this.maMethod?2*this.period+2:this.period)},this.computeATR=function(){var e=o.high(this._context)-o.low(this._context),t=o.high(this._context)-this.bars[this.bars.length-2],i=this.bars[this.bars.length-2]-o.low(this._context);return this.tr=Math.max(e,t,i),"Exponential"===this.maMethod?this.atr=o.ema(this._context.new_var(this.tr),this.period,this._context):this.atr=this.tr/this.period+(1-1/this.period)*this.atr,this.atr*this.atrMult},this.calculateVolatility=function(){if(o.close(this._context)===this.bars[this.bars.length-1])return this.lastSar;if(this.bars.push(o.close(this._context)),1===this.count)this.atr=o.high(this._context)-o.low(this._context),this.sic=o.close(this._context);else if(this.countthis.sic&&(this.sic=o.close(this._context))}else if(this.count===this.period){e=o.high(this._context)-o.low(this._context),t=o.high(this._context)-this.bars[this.bars.length-2],i=this.bars[this.bars.length-2]-o.low(this._context);this.atr+=Math.max(e,t,i),this.atr*=1/this.period, -o.close(this._context)>this.sic&&(this.sic=o.close(this._context)),this.position="LONG",this.nextsar=this.sic-this.atr*this.atrMult}else{var s=this.nextsar;"LONG"===this.position?o.close(this._context)s?(this.position="LONG",this.sic=o.close(this._context),this.nextsar=this.sic-this.computeATR()):(this.position="SHORT",this.sic=Math.min(o.close(this._context),this.sic),this.nextsar=this.sic+this.computeATR())),this.lastSar=s}return this.count++,s},this.main=function(e,t){return this._context=e,this._input=t,this._context.select_sym(0),[this.calculateVolatility()]}}},{name:"VWAP",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{inputs:{in_0:"hlc3",in_anchor:"Session"},styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:0,transparency:0,visible:!0,color:"#2196F3"}}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"VWAP",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"VWAP",shortDescription:"VWAP",is_price_study:!0,inputs:[{id:"in_0",name:"Source",defval:"hlc3",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_anchor",name:"Anchor Period",defval:"Session",type:"text",options:["Session","Week","Month","Quarter","Year","Decade","Century"]}],id:"VWAP@tv-basicstudies-1",scriptIdPart:"",name:"VWAP",format:{type:"inherit"}},constructor:function(){this.f_1=function(e){e.reset_hist()},this.createAnchorChecker=function(e,t){switch(t){case"Week":return function(t,i){return o.weekofyear(e,t)!==o.weekofyear(e,i)||o.year(e,t)!==o.year(e,i)};case"Month":return function(t,i){return o.month(e,t)!==o.month(e,i)||o.year(e,t)!==o.year(e,i)};case"Quarter":return function(t,i){return Math.floor(o.month(e,t)/3)!==Math.floor(o.month(e,i)/3)||o.year(e,t)!==o.year(e,i)};case"Year":return function(t,i){return o.year(e,t)!==o.year(e,i)};case"Decade":return function(t,i){return Math.floor(o.year(e,t)/10)!==Math.floor(o.year(e,i)/10)};case"Century":return function(t,i){return Math.floor(o.year(e,t)/100)!==Math.floor(o.year(e,i)/100)};default:return e=>this._isFirstBarInSession(e)}},this.init=function(e,t){this._input=t,this._isFirstBarInSession=null;const i=this._input(1)||"Session";this._anchorChecker=this.createAnchorChecker(e,i)},this.main=function(e,t){this._context=e,this._input=t;const i=this._input(0);var s=e.new_var(),n=e.new_var(),r=e.new_var();const a=o.time(this._context),l=this._context.new_unlimited_var(a).get(1);if(a){if(null===this._isFirstBarInSession){const t=o.createNthBarInSessionCheck(e);this._isFirstBarInSession=e=>t(e,0)}this._anchorChecker(a,l)&&(this.f_1(s),this.f_1(n),r.set(a))}return s.set(o.nz(s.get(1))+o[i](this._context)*o.volume(this._context)),n.set(o.nz(n.get(1))+o.volume(this._context)), -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;var i=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){return 100*(e-t)/t},this.main=function(e,t){this._context=e,this._input=t;var i=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(){ -var e=this._input(0),t=this._context.new_var(o.low(this._context)),i=this._context.new_var(o.abs(o.high(this._context)-t.get(1))),s=o.sum(i,e,this._context),n=this._context.new_var(o.high(this._context)),r=this._context.new_var(o.abs(o.low(this._context)-n.get(1))),a=o.sum(r,e,this._context),l=this._context.new_var(o.atr(1,this._context)),c=o.sum(l,e,this._context);return[s/c,a/c]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Willams %R",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#7E57C2"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-20},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-80}],filledAreasStyle:{fill_0:{color:"#7E57C2",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Williams %R",shortDescription:"%R",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Willams %R@tv-basicstudies-1",scriptIdPart:"",name:"Willams %R",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i){return 100*(e-t)/(t-i)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=o.high(this._context),n=this._context.new_var(s),r=o.highest(n,i,this._context),a=o.low(this._context),l=this._context.new_var(a),c=o.lowest(l,i,this._context);return[this.f_0(o.close(this._context),r,c)]}}},{name:"Williams Alligator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#E91E63"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#66BB6A"}},inputs:{in_0:21,in_1:13,in_2:8,in_3:8,in_4:5,in_5:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Jaw",histogramBase:0,joinPoints:!1},plot_1:{title:"Teeth",histogramBase:0,joinPoints:!1},plot_2:{title:"Lips",histogramBase:0,joinPoints:!1}},description:"Williams Alligator",shortDescription:"Alligator",is_price_study:!0,inputs:[{id:"in_0",name:"Jaw Length",defval:21,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0"]},{id:"in_1",name:"Teeth Length",defval:13,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1"]},{id:"in_2",name:"Lips Length",defval:8,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_2"]},{id:"in_3",name:"Jaw Offset",defval:8,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0"]},{id:"in_4", -name:"Teeth Offset",defval:5,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1"]},{id:"in_5",name:"Lips Offset",defval:3,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_2"]}],id:"Williams Alligator@tv-basicstudies-1",scriptIdPart:"",name:"Williams Alligator",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2),r=this._input(3),a=this._input(4),l=this._input(5),c=o.hl2(this._context);return[{value:o.smma(c,i,this._context),offset:r},{value:o.smma(c,s,this._context),offset:a},{value:o.smma(c,n,this._context),offset:l}]}}},{name:"Williams Fractals",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{plottype:"shape_triangle_down",visible:!0,location:"BelowBar",transparency:0,color:a},plot_1:{plottype:"shape_triangle_up",visible:!0,location:"AboveBar",transparency:0,color:u}},inputs:{in_0:2}},plots:[{id:"plot_0",type:"shapes"},{id:"plot_1",type:"shapes"}],styles:{plot_0:{title:"Down fractals",isHidden:!1},plot_1:{title:"Up fractals",isHidden:!1}},description:"Williams Fractal",shortDescription:"Fractals",is_price_study:!0,is_hidden_study:!1,id:"Williams Fractals@tv-basicstudies-1",inputs:[{id:"in_0",name:"Periods",defval:2,type:"integer",min:2,max:1e12}],scriptIdPart:"",name:"Williams Fractals",isCustomIndicator:!0,format:{type:"inherit"}},constructor:function(){this.f_0=function(){for(var e=this._input(0),t=this._context.new_var(o.high(this._context)),i=!0,s=!0,n=!0,r=!0,a=!0,l=!0,c=1;c<=e;c++)i=o.and(i,o.lt(t.get(e-c),t.get(e))),s=o.and(s,o.lt(t.get(e+c),t.get(e))),n=o.and(n,o.and(o.le(t.get(e+1),t.get(e)),o.lt(t.get(e+c+1),t.get(e)))),r=o.and(r,o.and(o.le(t.get(e+1),t.get(e)),o.and(o.le(t.get(e+2),t.get(e)),o.lt(t.get(e+c+2),t.get(e))))),a=o.and(a,o.and(o.le(t.get(e+1),t.get(e)),o.and(o.le(t.get(e+2),t.get(e)),o.and(o.le(t.get(e+3),t.get(e)),o.lt(t.get(e+c+3),t.get(e)))))),l=o.and(l,o.and(o.le(t.get(e+1),t.get(e)),o.and(o.le(t.get(e+2),t.get(e)),o.and(o.le(t.get(e+3),t.get(e)),o.and(o.le(t.get(e+4),t.get(e)),o.lt(t.get(e+c+4),t.get(e)))))));var h=o.or(s,o.or(n,o.or(r,o.or(a,l)))),d=o.and(i,h),u=this._context.new_var(o.low(this._context)),_=1,p=1,m=1,g=1,f=1,y=1;for(c=1;c<=e;c++)_=o.and(_,o.gt(u.get(e-c),u.get(e))),p=o.and(p,o.gt(u.get(e+c),u.get(e))),m=o.and(m,o.and(o.ge(u.get(e+1),u.get(e)),o.gt(u.get(e+c+1),u.get(e)))),g=o.and(g,o.and(o.ge(u.get(e+1),u.get(e)),o.and(o.ge(u.get(e+2),u.get(e)),o.gt(u.get(e+c+2),u.get(e))))),f=o.and(f,o.and(o.ge(u.get(e+1),u.get(e)),o.and(o.ge(u.get(e+2),u.get(e)),o.and(o.ge(u.get(e+3),u.get(e)),o.gt(u.get(e+c+3),u.get(e)))))),y=o.and(y,o.and(o.ge(u.get(e+1),u.get(e)),o.and(o.ge(u.get(e+2),u.get(e)),o.and(o.ge(u.get(e+3),u.get(e)),o.and(o.ge(u.get(e+4),u.get(e)),o.gt(u.get(e+c+4),u.get(e)))))));var v=o.or(p,o.or(m,o.or(g,o.or(f,y))));return[o.and(_,v),d]},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0();return[{value:i[0],offset:-this._input(0)},{value:i[1],offset:-this._input(0)}]}}},{ -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;var i=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);const i=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)return null;const c=o.add_years_considering_dst(this._context.symbol.info.timezone,new Date(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";var s;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});const s=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});var s=i(13607);const o={};function n(e="full"){return o[e]||function(e="full",t){o[e]=t}(e,new s(e)),o[e]}function r(){for(const e in o)if(o.hasOwnProperty(e)){const t=o[e];void 0!==t&&t.destroy(),delete o[e]}}},13607:(e,t,i)=>{"use strict";e=i.nmd(e);var s=i(20057).default,o=i(90484).default,n=i(67563).PriceFormatter;const{uniq:r}=i(53470);var a=i(4168);const{normalizeUpdateMode:l}=i(52706);var c=i(39527).deepExtend;const{QUOTE_FIELDS_CACHE:h,QUOTE_FIELDS:d}=i(30947);var u=i(48096).Delegate;const{getNewPeveCloseMode:_}=i(98422),{QuoteSession:p}=i(76220);function m(e,t){this.options=Object.assign({throttleTimeout:125},t),this._connected=!1,this._symbol_data={},this._subscriptions={},this.onConnect=new u,this.onDisconnect=new u,this._quoteApi=new p(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={},m.prototype.typeFields.simple=["base-currency-logoid","ch","chp","currency-logoid","currency_code","currency_id","base_currency_id","current_session","description","exchange","format","fractional","is_tradable","language","local_description","listed_exchange","logoid","lp","lp_time","minmov","minmove2","original_name","pricescale","pro_name","short_name","type","typespecs","update_mode","volume","variable_tick_size","value_unit_id","unit_id","measure"],m.prototype.typeFields.simpleDetailed=[].concat(m.prototype.typeFields.simple,["ask","bid","fundamentals","high_price","is_tradable","low_price","open_price","prev_close_price","rch","rchp","rtc","rtc_time","status","basic_eps_net_income","beta_1_year","earnings_per_share_basic_ttm","industry","market_cap_basic","price_earnings_ttm","sector","volume","dividends_yield","timezone"]),m.prototype.typeFields.full=[],m.prototype.typeFields.watchlist=[].concat(m.prototype.typeFields.simple,["rchp","rtc","country_code","provider_id","dividends_availability","financials_availability","earnings_availability"]),m.prototype.typeFields.portfolio=["pro_name","short_name","exchange","listed_exchange","description","local_description","language","sector","type","typespecs","industry","currency_code","currency_id","ch","chp","logoid","currency-logoid","base-currency-logoid","earnings_per_share_forecast_next_fq","earnings_release_next_date","earnings_release_date","earnings_per_share_fq","lp","fractional","minmov","minmove2","pricescale","volume","average_volume","market_cap_calc","market_cap_basic","total_revenue","earnings_per_share_basic_ttm","price_earnings_ttm","beta_1_year","dps_common_stock_prim_issue_fy","dividends_yield","fundamental_currency_code","rates_mc","rates_fy","rates_ttm","format","value_unit_id","unit_id","measure"],m.prototype.typeFields.notes=["short_name","pro_name","logoid","currency-logoid","base-currency-logoid","symbol-primaryname","type","typespecs"],m.prototype.typeFields.estimates=["fundamental_data","type","typespecs","earnings_per_share_forecast_next_symbol_currency_fq","earnings_release_next_aligned_date","earnings_release_next_calendar_date","earnings_release_next_date"],m.prototype.typeFields.economic=["reference-last-period","lp","currency_code","value_unit_id","unit_id","measure"],m.prototype.typeFields.options=["ask","bid","lp","volume"],m.prototype.connect=function(e){this._quoteApi.connect(this.quoteHandler.bind(this))},m.prototype.quoteHandler=function(e){var t=e.method,i=e.params;switch(t){case"connected":this._connected||(this._connected=!0,this.onConnected());break;case"quote_list_fields":break;case"quote_symbol_data":this._connected&&this.onSymbolData(i[0]);break;case"quote_completed":this._connected&&this.onSymbolData({symbolname:i[0],complete:performance.now(),values:{}});break -;case"disconnected":this._connected&&(this._connected=!1,this.onDisconnect.fire())}},m.prototype.onConnected=function(){this.setFields();var e=Object.keys(this._symbol_data);e.length&&(this._quoteApi.quoteAddSymbols(e),this._delayUpdateFastSymbols()),this.onConnect.fire()},m.prototype.setFields=function(){var e=m.prototype.typeFields[this._type];e&&e.length&&this._quoteApi.quoteSetFields(e)},m.prototype.onSymbolData=function(e){try{e.status&&h.update(e,d,!1)}catch(e){}var t=e.symbolname,i=this._throttledSymbolData[t];_()&&(delete e.values.prev_close_price,void 0!==e.values.regular_close&&(e.values.prev_close_price=e.values.regular_close)),i||(i=this._throttledSymbolData[t]={fnDispatch:s(this.dipatchSymbolData.bind(this),this.options.throttleTimeout)}),i.cache?c(i.cache,e):i.cache=e,i.fnDispatch(t)},m.prototype._parseUpdateMode=function(e){l(e)},m.prototype.dipatchSymbolData=function(e){var t=this._symbol_data[e],i=this._throttledSymbolData[e].cache;if(delete this._throttledSymbolData[e].cache,this._symbol_data[e])for(var s in c(t,i),t.values&&this._parseUpdateMode(t.values),this._subscriptions){var o=this._subscriptions[s];o.has(e)&&[...o.get(e)].forEach((function(e){e(t,i)}))}},m.prototype.subscribe=function(e,t,i){this._subscriptions[e]=this._subscriptions[e]||new Map;var s=this._subscriptions[e];t=[].concat(t);var o=[];t.forEach((function(e){this._symbol_data[e]?s&&s.has(e)||this._symbol_data[e].subscribers_count++:(this._symbol_data[e]={subscribers_count:1},o.push(e)),s.has(e)||s.set(e,[]),s.get(e).push(i),s.get(e).fast=!0,this._symbol_data[e]&&this._symbol_data[e].values&&i(this._symbol_data[e],this._symbol_data[e])}),this),o.length&&this._connected&&(this._quoteApi.quoteAddSymbols(o),this._delayUpdateFastSymbols())},m.prototype.unsubscribe=function(e,t,i){t=[].concat(t);for(var s=this._subscriptions[e],o=[],n=0;n{"use strict";i.d(t,{getServerInterval:()=>o});var s=i(46082);function o(e){return s.Interval.isRange(e)?"1":e}},45720:(e,t,i)=>{"use strict";function s(e,t,i){const s=e.get(t);return void 0!==s?s:(e.set(t,i),i)}function o(e,t,i){const s=e.get(t);if(void 0!==s)return s;const o=i();return e.set(t,o),o}function n(e,t,i,n){return o(s(e,t,new Map),i,n)}function r(e,t,i,o,n){const r=s(e,t,new Map),a=s(r,i,new Map);return s(a,o,n)}i.d(t,{AbstractMapContainer:()=>a,getDefault2Lazy:()=>n,getDefault3:()=>r});class a{constructor(){this._map=new Map,this._size=0}size(){return this._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});var s=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});const s=0,o=1,n=2,r=3,a=4,l=5},16659:(e,t,i)=>{"use strict";i.d(t,{CircularCacheBuffer:()=>r});var s,o=i(50151);function n(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={}));class r{constructor(e=0,t=1.3){this._cache=new Map, -this._lastItem=null,this._firstItem=null,this._size=e,this._sizeLimited=e>0,this._capacityFactor=t}set(e,t){const i={key:e,value:t,prevItem:this._lastItem,nextItem:null};null!==this._lastItem&&(this._lastItem.nextItem=i);const s=this._cache.get(e);return void 0!==s&&(n(s),s===this._firstItem&&(this._firstItem=s.nextItem)),this._cache.set(e,i),this._lastItem=i,null===this._firstItem&&(this._firstItem=i),this._sizeLimited&&this._cache.size>this._size*this._capacityFactor&&this._removeExtraItems(),this}has(e){return this._cache.has(e)}get(e){const t=this._cache.get(e);if(void 0===t)return t;if(t===this._firstItem&&(this._firstItem=t.nextItem??t),t!==this._lastItem){n(t);const e=(0,o.ensureNotNull)(this._lastItem);e.nextItem=t,t.prevItem=e,t.nextItem=null,this._lastItem=t}return t.value}clear(){this._cache.clear(),this._firstItem=null,this._lastItem=null}delete(e){const t=this._cache.get(e);return void 0!==t&&(n(t),t===this._lastItem&&(this._lastItem=t.prevItem),t===this._firstItem&&(this._firstItem=t.nextItem)),this._cache.delete(e)}*entries(){if(null!==this._firstItem)for(let e=this._firstItem;null!==e;e=e.nextItem)yield[e.key,e.value]}state(){const e=[];for(const[t,i]of this.entries())e.push([t,i]);return e}restoreState(e){for(const t of e)this.set(t[0],t[1])}_removeExtraItems(){const e=this._cache.size-this._size;let t=(0,o.ensureNotNull)(this._firstItem);for(let i=0;i{"use strict";i.d(t,{accumulate:()=>a,combine:()=>r,combineWithFilteredUpdate:()=>n});var s=i(22613);function o(e,t,...i){let o=null;const n=(...t)=>e(...t.map((e=>e.value())),o?.value()),r=o=new s.WatchedValue(n(...i)),a=()=>{const e=i.map(((e,t)=>e.value()));t(...e)&&r.setValue(n(...i))},l=i.map((e=>e.spawn()));for(const e of l)e.subscribe(a);return r.readonly().spawn((()=>{l.forEach((e=>e.destroy())),i.forEach((e=>e.release()))}))}function n(e,t,...i){return o(e,t,...i)}function r(e,...t){return o(e,(()=>!0),...t)}function a(e,t,...i){let o=null;const n=r(((...e)=>(e.splice(-1),e)),...i),a=t.spawn(),l=(t,...i)=>{const s=t.map((e=>e.value()));return e(s,...i,o?.value())},c=o=new s.WatchedValue(l(a.value(),...n.value()));let h=[];const d=()=>{c.setValue(l(h,...n.value()))},u=e=>{h.forEach((e=>e.destroy())),h=e.map((e=>e.spawn())),h.forEach((e=>e.subscribe(d))),d()};u(a.value()),a.subscribe(u),n.subscribe(d);return c.readonly().spawn((()=>{h.forEach((e=>e.destroy())),a.destroy(),n.destroy(),t.release()}))}},10845:(e,t,i)=>{"use strict";i.d(t,{availableTimezones:()=>l,timezoneIsAvailable:()=>u,timezoneIsSupported:()=>_,timezoneTitle:()=>p,updateAvailableTimezones:()=>d});var s=i(95523),o=i(11542);const n=[{id:"Etc/UTC",get title(){return o.t(null,void 0,i(1833))}},{id:"exchange",get title(){return o.t(null,void 0,i(86905))}}],r=[{id:"Africa/Cairo",get title(){return o.t(null,void 0,i(65736))},offset:0},{id:"Africa/Casablanca",get title(){return o.t(null,void 0,i(70409))},offset:0},{id:"Africa/Johannesburg",get title(){ -return o.t(null,void 0,i(39585))},offset:0},{id:"Africa/Lagos",get title(){return o.t(null,void 0,i(19931))},offset:0},{id:"Africa/Nairobi",get title(){return o.t(null,void 0,i(40977))},offset:0},{id:"Africa/Tunis",get title(){return o.t(null,void 0,i(21007))},offset:0},{id:"America/Anchorage",get title(){return o.t(null,void 0,i(42630))},offset:0},{id:"America/Argentina/Buenos_Aires",get title(){return o.t(null,void 0,i(25282))},offset:0},{id:"America/Bogota",get title(){return o.t(null,void 0,i(73905))},offset:0},{id:"America/Caracas",get title(){return o.t(null,void 0,i(30948))},offset:0},{id:"America/Chicago",get title(){return o.t(null,void 0,i(72452))},offset:0},{id:"America/El_Salvador",get title(){return o.t(null,void 0,i(55502))},offset:0},{id:"America/Juneau",get title(){return o.t(null,void 0,i(67560))},offset:0},{id:"America/Lima",get title(){return o.t(null,void 0,i(59444))},offset:0},{id:"America/Los_Angeles",get title(){return o.t(null,void 0,i(28733))},offset:0},{id:"America/Mexico_City",get title(){return o.t(null,void 0,i(73332))},offset:0},{id:"America/New_York",get title(){return o.t(null,void 0,i(40544))},offset:0},{id:"America/Phoenix",get title(){return o.t(null,void 0,i(14055))},offset:0},{id:"America/Santiago",get title(){return o.t(null,void 0,i(30231))},offset:0},{id:"America/Sao_Paulo",get title(){return o.t(null,void 0,i(91912))},offset:0},{id:"America/Toronto",get title(){return o.t(null,void 0,i(10095))},offset:0},{id:"America/Vancouver",get title(){return o.t(null,void 0,i(32838))},offset:0},{id:"US/Mountain",get title(){return o.t(null,void 0,i(27358))},offset:0},{id:"Asia/Almaty",get title(){return o.t(null,void 0,i(98128))},offset:0},{id:"Asia/Ashkhabad",get title(){return o.t(null,void 0,i(63627))},offset:0},{id:"Asia/Bahrain",get title(){return o.t(null,void 0,i(90594))},offset:0},{id:"Asia/Bangkok",get title(){return o.t(null,void 0,i(47045))},offset:0},{id:"Asia/Chongqing",get title(){return o.t(null,void 0,i(50349))},offset:0},{id:"Asia/Colombo",get title(){return o.t(null,void 0,i(10871))},offset:0},{id:"Asia/Dhaka",get title(){return o.t(null,void 0,i(24959))},offset:0},{id:"Asia/Dubai",get title(){return o.t(null,void 0,i(23650))},offset:0},{id:"Asia/Ho_Chi_Minh",get title(){return o.t(null,void 0,i(34491))},offset:0},{id:"Asia/Hong_Kong",get title(){return o.t(null,void 0,i(48861))},offset:0},{id:"Asia/Jakarta",get title(){return o.t(null,void 0,i(14995))},offset:0},{id:"Asia/Jerusalem",get title(){return o.t(null,void 0,i(36057))},offset:0},{id:"Asia/Karachi",get title(){return o.t(null,void 0,i(70913))},offset:0},{id:"Asia/Kabul",get title(){return o.t(null,void 0,i(99563))},offset:0},{id:"Asia/Kathmandu",get title(){return o.t(null,void 0,i(54533))},offset:0},{id:"Asia/Kolkata",get title(){return o.t(null,void 0,i(31561))},offset:0},{id:"Asia/Kuala_Lumpur",get title(){return o.t(null,void 0,i(38561))},offset:0},{id:"Asia/Kuwait",get title(){return o.t(null,void 0,i(76614))},offset:0},{id:"Asia/Manila",get title(){return o.t(null,void 0,i(48991))},offset:0},{ -id:"Asia/Muscat",get title(){return o.t(null,void 0,i(9865))},offset:0},{id:"Asia/Nicosia",get title(){return o.t(null,void 0,i(94600))},offset:0},{id:"Asia/Qatar",get title(){return o.t(null,void 0,i(28756))},offset:0},{id:"Asia/Riyadh",get title(){return o.t(null,void 0,i(37974))},offset:0},{id:"Asia/Seoul",get title(){return o.t(null,void 0,i(26820))},offset:0},{id:"Asia/Shanghai",get title(){return o.t(null,void 0,i(1852))},offset:0},{id:"Asia/Singapore",get title(){return o.t(null,void 0,i(77377))},offset:0},{id:"Asia/Taipei",get title(){return o.t(null,void 0,i(11034))},offset:0},{id:"Asia/Tehran",get title(){return o.t(null,void 0,i(6686))},offset:0},{id:"Asia/Tokyo",get title(){return o.t(null,void 0,i(69122))},offset:0},{id:"Asia/Yangon",get title(){return o.t(null,void 0,i(53168))},offset:0},{id:"Atlantic/Azores",get title(){return o.t(null,void 0,i(87580))},offset:0},{id:"Atlantic/Reykjavik",get title(){return o.t(null,void 0,i(13386))},offset:0},{id:"Australia/Adelaide",get title(){return o.t(null,void 0,i(37265))},offset:0},{id:"Australia/Brisbane",get title(){return o.t(null,void 0,i(79336))},offset:0},{id:"Australia/Perth",get title(){return o.t(null,void 0,i(24436))},offset:0},{id:"Australia/Sydney",get title(){return o.t(null,void 0,i(31622))},offset:0},{id:"Europe/Amsterdam",get title(){return o.t(null,void 0,i(36485))},offset:0},{id:"Europe/Athens",get title(){return o.t(null,void 0,i(73702))},offset:0},{id:"Europe/Belgrade",get title(){return o.t(null,void 0,i(71797))},offset:0},{id:"Europe/Berlin",get title(){return o.t(null,void 0,i(64313))},offset:0},{id:"Europe/Bratislava",get title(){return o.t(null,void 0,i(70876))},offset:0},{id:"Europe/Brussels",get title(){return o.t(null,void 0,i(91499))},offset:0},{id:"Europe/Bucharest",get title(){return o.t(null,void 0,i(33672))},offset:0},{id:"Europe/Budapest",get title(){return o.t(null,void 0,i(20313))},offset:0},{id:"Europe/Copenhagen",get title(){return o.t(null,void 0,i(38917))},offset:0},{id:"Europe/Dublin",get title(){return o.t(null,void 0,i(79716))},offset:0},{id:"Europe/Helsinki",get title(){return o.t(null,void 0,i(48203))},offset:0},{id:"Europe/Istanbul",get title(){return o.t(null,void 0,i(78326))},offset:0},{id:"Europe/Lisbon",get title(){return o.t(null,void 0,i(53375))},offset:0},{id:"Europe/London",get title(){return o.t(null,void 0,i(19439))},offset:0},{id:"Europe/Luxembourg",get title(){return o.t(null,void 0,i(81038))},offset:0},{id:"Europe/Madrid",get title(){return o.t(null,void 0,i(52066))},offset:0},{id:"Europe/Malta",get title(){return o.t(null,void 0,i(38365))},offset:0},{id:"Europe/Moscow",get title(){return o.t(null,void 0,i(64039))},offset:0},{id:"Europe/Oslo",get title(){return o.t(null,void 0,i(75722))},offset:0},{id:"Europe/Paris",get title(){return o.t(null,void 0,i(61879))},offset:0},{id:"Europe/Prague",get title(){return o.t(null,void 0,i(81248))},offset:0},{id:"Europe/Riga",get title(){return o.t(null,void 0,i(94022))},offset:0},{id:"Europe/Rome",get title(){return o.t(null,void 0,i(52961))},offset:0},{ -id:"Europe/Stockholm",get title(){return o.t(null,void 0,i(86716))},offset:0},{id:"Europe/Tallinn",get title(){return o.t(null,void 0,i(79995))},offset:0},{id:"Europe/Vienna",get title(){return o.t(null,void 0,i(23160))},offset:0},{id:"Europe/Vilnius",get title(){return o.t(null,void 0,i(60534))},offset:0},{id:"Europe/Warsaw",get title(){return o.t(null,void 0,i(5959))},offset:0},{id:"Europe/Zurich",get title(){return o.t(null,void 0,i(62859))},offset:0},{id:"Pacific/Auckland",get title(){return o.t(null,void 0,i(66103))},offset:0},{id:"Pacific/Chatham",get title(){return o.t(null,void 0,i(36549))},offset:0},{id:"Pacific/Fakaofo",get title(){return o.t(null,void 0,i(98549))},offset:0},{id:"Pacific/Honolulu",get title(){return o.t(null,void 0,i(79668))},offset:0},{id:"Pacific/Norfolk",get title(){return o.t(null,void 0,i(67891))},offset:0}];function a(e,t,i){const o=function(e){return e.map((e=>{const{id:t}=e,{string:i,offset:o}=(0,s.parseTzOffset)(t);return{id:t,offset:o,get title(){return`(${i}) ${e.title}`}}}))}(e),n=i.filter((({alias:e})=>Boolean(e))).map((e=>{const{alias:t,id:i}=e,{string:o,offset:n}=(0,s.parseTzOffset)(t);return{id:i,offset:n,get title(){return`(${o}) ${e.title}`},alias:t}})),r=function(e){return e.sort(((e,t)=>{const i=e.offset-t.offset;return 0!==i?i:e.title.localeCompare(t.title)}))}(o.concat(n));return t.concat(r)}const l=a(r,n,[]),c=new Map;l.forEach((e=>{c.set(e.id,!0)}));const h=new Map;n.concat(r).forEach((e=>{h.set(e.id,!0)}));const d=e=>{l.splice(0,l.length,...a(r,n,e)),l.forEach((e=>{c.set(e.id,!0)}))};function u(e){return c.has(e)}function _(e){return h.get(e)||!1}function p(e){for(const{id:t,title:i}of r)if(t===e){return`${i} (${(0,s.parseTzOffset)(e).string})`}for(const{id:t,title:i}of l)if(t===e)return`${i}`;return e}},48096:(e,t,i)=>{"use strict";i.d(t,{Delegate:()=>n});const s=(0,i(9343).getLogger)("Common.Delegate");function o(e){return!e.singleShot}class n{constructor(){this.fire=this._fireImpl.bind(this),this._listeners=[]}subscribe(e,t,i){this._listeners.push({object:e,member:t,singleShot:!!i,skip:!1})}unsubscribe(e,t){for(let i=0;i=0;--t){const i=this._listeners[t];i.object===e&&(i.skip=!0,this._listeners.splice(t,1))}}destroy(){this._listeners=[]}_fireImpl(...e){const t=this._listeners;this._listeners=this._listeners.filter(o);const i=t.length;for(let o=0;o{"use strict";var s,o;i.d(t,{HorizontalAlign:()=>s,VerticalAlign:()=>o}),function(e){e.Left="left",e.Right="right",e.Center="center"}(s||(s={})),function(e){e.Top="top",e.Bottom="bottom",e.Middle="middle"}(o||(o={}))},55014:(e,t,i)=>{"use strict";i.d(t,{formatStudyError:()=>n,triesTranslateError:()=>o});var s=i(11542);function o(e){return r.get(e)||e}function n(e){return e.format({ -boldHighlightStart:"",boldHighlightEnd:""})}const r=new Map([["You cannot see this pivot timeframe on this resolution",s.t(null,void 0,i(25059))],["The data vendor doesn't provide volume data for this symbol.",s.t(null,void 0,i(81657))],['Histogram is too large, please increase "Row Size" input.',s.t(null,void 0,i(72819))],["Histogram is too large, please reduce 'Row Size' input.",s.t(null,void 0,i(66751))],['Histogram is too large, please increase "Ticks Per Row" input.',s.t(null,void 0,i(94966))],["This script is invite-only. To request access, please contact its author.",s.t(null,void 0,i(76989))],["Volume Profile indicator available only on our upgraded plans.",s.t(null,void 0,i(39903))],["VOLUME_BIST_MIXED",s.t(null,void 0,i(69156))],["Runtime error",s.t(null,void 0,i(60630))],["Access error",s.t(null,void 0,i(77401))],["User-defined error",s.t(null,void 0,i(8580))],["Compilation error",s.t(null,void 0,i(12086))],["Metric error",s.t(null,void 0,i(83111))],["There's no data for your selected period and chart timeframe.",s.t(null,void 0,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,void 0,i(99274))],["Unexpected error in Deep Backtesting mode. Contact support for more information.",s.t(null,void 0,i(56815))],["check study unexpected error",s.t(null,void 0,i(83524))],["To calculate the VWAP indicator, more data is needed. Zoom out or scroll left to load more historical data.",s.t(null,void 0,i(41446))],["VWAP is waiting for more data",s.t(null,void 0,i(81030))],["The Bar Magnifier feature is only available to Premium users",s.t(null,void 0,i(45328))],["The bar magnifier is only available to the Premium plan or higher.",s.t(null,void 0,i(35601))]])},64971:(e,t,i)=>{"use strict";i.d(t,{getImage:()=>n});const s=new Map;function o(e){e.crossOrigin="anonymous"}function n(e,t,i=o){let n=s.get(e);return void 0===n&&(n=new Promise(((e,s)=>{const o=new Image;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";function s(e){const t=Object.create(e);return t.release=()=>{},t.ownership=()=>t,t}function o(e){const t=e;return t.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});var s=i(37236);function o(e,t=Date.now()){const i=(0,s.get_timezone)(e).offset_utc(t);let o="";const n=i/1e3/60/60;n%1&&(o=":"+Math.round(Math.abs(n%1*60)).toString().padStart(2,"0"));let r="";return r=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});var s=i(87465)},59149:e=>{"use strict";var t=[{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(){var e=[{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}];function i(e,t){var i=function(){};return i.prototype=t.prototype,e.prototype=new i,e}function s(){}function o(e){this.value=e}function n(){}function r(){}function a(){}function l(){}function c(){}function h(){}function d(){}function u(){}s.prototype.toString=function(){return this.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=/[+\-/*]/;function m(e){this.value=e}function g(e){this.value=e}function f(e){this.value=e}function y(){m.apply(this,arguments)}function v(){g.apply(this,arguments)}i(m,s),m.prototype.toString=function(){if(this.hasOwnProperty("_ticker")){var e=p.test(this._ticker)?"'":"";return e+(this._exchange?this._exchange+":":"")+this._ticker+e}return this.value},m.prototype.parse=function(){var e=_.exec(this.value);e[1]&&(this._exchange=e[1]),this._ticker=e[2]},m.prototype.parseAsFutures=function(){this.hasOwnProperty("_ticker")||this.parse();for(var e=function(e){return t.some((function(t){return t.t===e}))},i=2;i>=1;--i){var s=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))return this._exchange;null==e?delete this._exchange:this._exchange=e+""},m.prototype.ticker=function(e){if(this.hasOwnProperty("_ticker")||this.parse(),!(arguments.length>0))return this._ticker;null==e?delete this._ticker:this._ticker=e+"",delete this._root,delete this._contract},m.prototype.root=function(e){if(this.hasOwnProperty("_root")||this.parseAsFutures(),!(arguments.length>0))return this._root;null==e?delete this._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))return this._root;null==e?delete this._contract:(this._contract=e+"",this._root&&(this._ticker=this._root+this._contract))},i(g,s),g.prototype.toString=function(){ -return this.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(){return this.value},i(y,m),y.prototype.isIncomplete=!0,y.prototype.incompleteSuggest=function(){if("'"!==this.value)return String("'")},i(v,g),v.prototype.isIncomplete=!0;var S=new RegExp(e.map((function(e){return"("+("string"==typeof e.pattern?e.pattern.replace(/[\^$()[\]{}*+?|\\]/g,"\\$&"):e.pattern.source)+")"})).concat(".").join("|"),"g");function b(t,i){var s,n=[];e:for(;s=S.exec(t);){for(var r=e.length;r--;)if(s[r+1]){if(e[r].ctor){var a=new e[r].ctor(s[r+1]);a._offset=s.index,n.push(a)}continue e}var l=new f(s[0]);l._offset=s.index,n.push(l)}if(i&&i.recover){var c;for(r=n.length;r--;){var h=n[r];if(h instanceof g||h instanceof m){if(void 0!==c){var d=new m(""),u=n.splice(r,c-r+1,d);d.value=u.map((function(e){return e.value})).join("")}c=r}else h instanceof o||(c=void 0)}}return n}function w(e){for(var t=[],i=0;il.precedence&&(s[s.length-1].minPrecedence=l.precedence);else if(l instanceof n)s.push(t={minPrecedence:1/0,openBraceIndex:o});else if(l instanceof r){var c=e[(t=s.pop()).openBraceIndex-1],h=e[o+1];h instanceof a&&!(h.precedence<=t.minPrecedence)||!(!(c instanceof a)||c.precedencet.minPrecedence&&(s[s.length-1].minPrecedence=t.minPrecedence))}}for(o=i.length;o--;)e.splice(i[o],1);return e}function T(e){if("string"!=typeof e)throw new TypeError("expression must be a string");return(e=b(e)).filter((function(e){return e instanceof m})).map((function(e){return e.exchange()})).filter((function(e){return e}))}function P(e){return 1!==(e=T(e)).length?null:e[0]}function x(e,t){return(e=T(e)).some((function(e){return t.includes((e||"").toUpperCase())}))}function M(e){return e.join("")}return{tokenize:b,validate:function(e){return{currentState:"var"}},factorOutBraces:C,normalizeTokens:function(e){for(var t=0;t{"use strict";i.d(t,{TranslatedString:()=>s});class s{constructor(e,t){this._originalText=e,this._translatedText=t}originalText(){return this._originalText}translatedText(){return this._translatedText}format(e){const t={},i={};for(const o of Object.keys(e)){const n=e[o];n instanceof s?(t[o]=n.originalText(),i[o]=n.translatedText()):(t[o]=n.toString(),i[o]=n.toString())}const o=this._originalText.format(t),n=this._translatedText.format(i);return new s(o,n)}}},9787:(e,t,i)=>{"use strict";i.d(t,{Version:()=>o});var s=i(50151);class o{constructor(e,t){this._major=e,this._minor=t}major(){return this._major}minor(){return this._minor}isZero(){return 0===this._major&&0===this._minor}toString(){return this._major+"."+this._minor}compareTo(e){return this._majore._major?1:this._minore._minor?1:0}isLess(e){return this.compareTo(e)<0}isLessOrEqual(e){return this.compareTo(e)<=0}isEqual(e){return 0===this.compareTo(e)}isGreater(e){return this.compareTo(e)>0}isGreaterOrEqual(e){return this.compareTo(e)>=0}static parse(e){if(e instanceof o)return new o(e.major(),e.minor());if("number"==typeof e)return(0,s.assert)(Math.floor(e)===e,"Version should not be a float number"),new o(e,0);if("string"==typeof e){const t=e.split(".");if(1===t.length){const i=parseInt(t[0],10);return(0,s.assert)(!isNaN(i),"Bad version string: "+e),new o(i,0)}if(2===t.length){const i=parseInt(t[0],10);(0,s.assert)(!isNaN(i),"Bad version string: "+e);const n=parseInt(t[1],10);return(0,s.assert)(!isNaN(n),"Bad version string: "+e),new o(i,n)}throw new Error("Bad version string (one dot expected): "+e)}throw new Error("Bad version: "+e)}}o.ZERO=new o(0,0)},22613:(e,t,i)=>{"use strict";i.d(t,{WatchedValue:()=>s.WatchedValue});var s=i(52499)},62773:(e,t,i)=>{"use strict";i.d(t,{WatchedObject:()=>s.WatchedObject});var s=i(52499)},99247:(e,t,i)=>{"use strict";i.d(t,{MouseClickAutoBlurHandler:()=>r,initMouseClickAutoBlurHandler:()=>a});var s=i(81251),o=i(76460);const n="data-mouse-click-auto-blur";class r{constructor(){this._handler=e=>{document.activeElement instanceof HTMLElement&&((0,o.isKeyboardClick)(e)||e.target instanceof Element&&"INPUT"!==document.activeElement.tagName&&null!==document.activeElement.closest(`[${n}]`)&&document.activeElement.blur())},window.addEventListener("click",this._handler,!0)} -static attributes(e=!0){return e?{[n]:!0}:{}}}const a=(0,s.default)((()=>new r))},22692:(e,t,i)=>{"use strict";i.d(t,{mapKeyCodeToDirection:()=>h,navigationOrderComparator:()=>r,queryFocusableElements:()=>l,queryTabbableElements:()=>a,updateTabIndexes:()=>c});var s,o=i(24640),n=i(15754);function r(e,t){return e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function a(e){return Array.from(e.querySelectorAll('button:not([disabled]):not([aria-disabled]):not([tabindex="-1"]), [tabindex]:not([disabled]):not([aria-disabled]):not([tabindex="-1"])')).filter((0,n.createScopedVisibleElementFilter)(e))}function l(e){return Array.from(e.querySelectorAll('button:not([disabled]):not([aria-disabled="true"]):not([aria-disabled=""]), [tabindex]:not([disabled]):not([aria-disabled="true"]):not([aria-disabled=""])')).filter((0,n.createScopedVisibleElementFilter)(e))}function c(){window.dispatchEvent(new CustomEvent("keyboard-navigation-activation",{bubbles:!0}))}function h(e){const t=(0,o.isRtl)();switch(e){case 38:return"blockPrev";case 40:return"blockNext";case 37:return t?"inlineNext":"inlinePrev";case 39:return t?"inlinePrev":"inlineNext";default:return null}}!function(e){e.BlockPrev="blockPrev",e.BlockNext="blockNext",e.InlinePrev="inlinePrev",e.InlineNext="inlineNext"}(s||(s={}))},66593:(e,t,i)=>{"use strict";i.d(t,{TOOLBAR_WIDTH_COLLAPSED:()=>o,TOOLBAR_WIDTH_EXPANDED:()=>s});const s=52,o=5},55308:(e,t,i)=>{"use strict";i.d(t,{isDrawingToolbarVisible:()=>l});var s=i(1765),o=i(37103),n=i(22613);const r=!o.enabled("hide_left_toolbar_by_default"),a=s.getBool("ChartDrawingToolbarWidget.visible",r),l=new n.WatchedValue(a)},9753:(e,t,i)=>{"use strict";i.d(t,{HEADER_TOOLBAR_HEIGHT_COLLAPSED:()=>n,HEADER_TOOLBAR_HEIGHT_EXPANDED:()=>o});var s=i(41183);const o=parseInt(s["css-value-header-toolbar-height"]),n=3},23745:(e,t,i)=>{"use strict";i.d(t,{shouldShowQuickSearchOnLib:()=>r});var s=i(49483),o=i(84015),n=i(37103);function r(){return!s.CheckMobile.any()&&!(0,o.isOnMobileAppPage)("any")&&!n.enabled("widget")&&n.enabled("header_quick_search")}},14429:(e,t,i)=>{"use strict";i.d(t,{ActionWithStandardIcon:()=>n});var s=i(41706),o=i(84696);class n extends s.Action{constructor(e){const{options:t,customActionOptions:i}=e;t.iconId&&(t.icon=t.icon??o.icons.get(t.iconId)),i&&i.iconId&&(i.icon=i.icon??o.icons.get(i.iconId)),super(e)}}},41706:(e,t,i)=>{"use strict";i.d(t,{Action:()=>c,Separator:()=>h});var s,o=i(50151),n=i(68335),r=i(4226),a=i(48096);class l extends a.Delegate{constructor(e){super(),this._onStartListening=null,this._onStopListening=null,this._onStartListening=e||null}subscribe(e,t,i){const s=0===this._listeners.length;super.subscribe(e,t,i),s&&this._listeners.length>0&&this._onStartListening&&(this._onStopListening=this._onStartListening())}unsubscribe(e,t){const i=0===this._listeners.length;super.unsubscribe(e,t),!i&&0===this._listeners.length&&this._onStopListening&&(this._onStopListening(),this._onStopListening=null)}unsubscribeAll(e){const t=0===this._listeners.length;super.unsubscribeAll(e), -!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={}));class c{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)(void 0!==t,"actionId must be defined"),this.id=h,this._onUpdate=new l(d),this._options={actionId:t,...i},this.update(i),this._loadOptionsGetter=s??null,this._loadOptionsGetter&&(this._options.loading=!0),n&&(this._customAction=new c({actionId:t,options:n,optionsLoader:a,id:h}))}custom(){return this._customAction}execute(){this._options.checkable&&this.update({checked:!this._options.checked}),this._options.onExecute&&this._options.onExecute(this)}getLabel(){return this._options.label||""}getSubItems(){return this._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(){return this._loadOptionsPromise?this._loadOptionsPromise:this._loadOptionsGetter?(this._loadOptionsPromise=this._loadOptionsGetter().then((e=>this.update({...e,loading:!1}))),this._loadOptionsPromise):null}getSize(){return this._options.size??"normal"}getPayload(){return this._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(){return this._onUpdate}getState(){return this.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"in this._options?this._options.jsxLabel:void 0,isRepeatAccepted:this._options.isRepeatAccepted}}destroy(){this._destroyed=!0,this._onUpdate.destroy(),this._unbindShortcut(),this._options.onDestroy?.(),this._customAction?.destroy()}options(){return this._options}_bindShortcut(){if(!this._options.hotkeyGroup||!this._options.hotkeyHash)return;const e="string"==typeof this._options.label?this._options.label:this._options.name -;this._hotkeyAction=this._options.hotkeyGroup.add({hotkey:this._options.hotkeyHash,isRepeatAccepted:this._options.isRepeatAccepted,desc:e,handler:()=>this.execute(),isDisabled:()=>this.isDisabled()})}_unbindShortcut(){this._hotkeyAction&&(this._hotkeyAction.destroy(),delete this._hotkeyAction)}}class h{constructor(e){this.type="separator",this.id=r.guid(),this._hint=e}getHint(){return this._hint}}},84696:(e,t,i)=>{"use strict";i.d(t,{icons:()=>w});var s,o=i(53573),n=i(34369),r=i(39267),a=i(93544),l=i(84959),c=i(34487),h=i(11890),d=i(16911),u=i(25191),_=i(54190),p=i(6862),m=i(97874),g=i(2872),f=i(29453),y=i(94839),v=i(5845),S=i(1457),b=i(93379);!function(e){e.ChartShowDataWindow="Chart.ShowDataWindow",e.ChartReset="Chart.Reset",e.ChartRemoveSelectedObject="Chart.RemoveSelectedObject",e.Settings="Settings",e.ChartHide="Chart.Hide",e.ChartSymbolInfo="Chart.SymbolInfo",e.ChartFinancials="Chart.Financials",e.ChartTechnicals="Chart.Technicals",e.ChartDetailsMetrics="Chart.DetailsMetrics",e.ChartSeasonals="Chart.Seasonals",e.ChartAnalysis="Chart.Analysis",e.ChartStockBonds="Chart.StockBonds",e.ChartForecast="Chart.Forecast",e.ChartOptions="Chart.Options",e.ChartEconomyIdicators="Chart.EconomyIndicators",e.AlertAdd="Alert.Add",e.AlertEdit="Alert.Edit",e.AlertRestart="Alert.Restart",e.AlertStop="Alert.Stop",e.AlertFiresDownload="Alert.FiresDownload",e.ClearAll="Alert.Clear",e.ChartVisualOrder="Chart.VisualOrder",e.ChartShowObject="Chart.ShowObject",e.ChartPriceScale="Chart.PriceScale",e.ChartMove="Chart.Move",e.ChartApplyIndicator="Chart.ApplyIndicator",e.ChartUnlockObject="Chart.UnlockObject",e.ChartLockObject="Chart.LockObject",e.ChartAnchorLineTool="Chart.AnchorLineTool",e.ChartInsertRowTable="Chart.InsertRowTable",e.ChartInsertColumnTable="Chart.InsertColumnTable",e.ChartRemoveRowTable="Chart.RemoveRowTable",e.ChartRemoveColumnTable="Chart.RemoveColumnTable",e.ChartClone="Chart.Clone",e.ChartAddHorzLine="Chart.AddHorzLine",e.WatchlistAddSymbol="Watchlist.AddSymbol",e.WatchlistCreateNew="Watchlist.CreateNew",e.TextNoteAdd="TextNote.Add",e.TradingSell="Trading.Sell",e.TradingBuy="Trading.Buy",e.TradingAddOrder="Trading.AddOrder",e.ObjectsTreeCreateGroup="ObjectsTree.CreateGroup",e.ObjectsTreeRenameItem="ObjectsTree.RenameItem",e.IndicatorAddToFavorites="Indicator.AddToFavorites"}(s||(s={}));const w=new Map([["Chart.Reset",r],["Chart.RemoveSelectedObject",a],["Settings",n],["Chart.Hide",l],["Chart.SymbolInfo",c],["Chart.VisualOrder",h],["Chart.ShowObject",d],["Chart.PriceScale",u],["Chart.Move",_],["Chart.ApplyIndicator",p],["Chart.UnlockObject",m],["Chart.LockObject",g],["Chart.AnchorLineTool",f],["Chart.InsertRowTable",y],["Chart.InsertColumnTable",v],["Chart.RemoveRowTable",a],["Chart.RemoveColumnTable",a],["Chart.Clone",S],["Chart.AddHorzLine",b],["Indicator.AddToFavorites",o]])},31932:(e,t,i)=>{"use strict";function s(){return Promise.all([i.e(3462),i.e(6025),i.e(9378),i.e(1485),i.e(5456),i.e(6602)]).then(i.bind(i,95616))}i.d(t,{actionsProviderModule:()=>s})},72104:(e,t,i)=>{"use strict";i.d(t,{ -defaultChartWidgetActionsOptions:()=>s});const s={general:!0,mainSeries:!0,mainSeriesTrade:!1,esdStudies:!0,studies:!0,fundamentals:!0,lineTools:!0,publishedCharts:!0,ordersAndPositions:!0,alerts:!0,chartEvents:!0,objectTree:!0,gotoLineTool:!1};var o;!function(e){e.Copy="Copy"}(o||(o={}))},92848:(e,t,i)=>{"use strict";i.d(t,{clipboardDataForSources:()=>l,isLineToolClipboardData:()=>a});var s=i(50151),o=i(36313),n=i(2088),r=i(26610);function a(e){return"drawing"===e.type}function l(e,t){if(1===t.length&&(0,n.isStudy)(t[0])){const e=t[0];return{title:e.title(o.TitleDisplayTarget.StatusLine),sources:[{source:(0,s.ensureNotNull)(e.state()),type:"study"}]}}const i={sources:[],title:""};return i.sources=t.filter((e=>e.copiable()&&(0,r.isLineTool)(e))).map((t=>{const i={type:"drawing",geometry:t.geometry(),source:{...t.state(!1),points:t.normalizedPoints()},modelId:e};return delete i.source.alertId,i})),i.sources.length>0?(1===i.sources.length?i.title=t[0].title(o.TitleDisplayTarget.StatusLine):i.title="Drawings",i):null}},33350:(e,t,i)=>{"use strict";i.d(t,{addExclusionArea:()=>T,addExclusionAreaByScope:()=>C,calcTextHorizontalShift:()=>b,clearRect:()=>p,createBoundCanvas:()=>v,createDisconnectedCanvas:()=>g,createDisconnectedCanvasByRenderingInfo:()=>f,disableSelection:()=>w,drawScaled:()=>m,drawWithExclusionAreaByScope:()=>P,fillRect:()=>_,getBindingRenderingInfo:()=>h,getContext2D:()=>d,getPrescaledContext2D:()=>u,measureText:()=>M,tryApplySuggestedCanvasBitmapSize:()=>S});var s=i(27714),o=i(50151),n=i(59239),r=i(57658),a=i(24640),l=i(49483);function c(e){return{horizontalPixelRatio:Math.max(1,e.bitmapSize.width/e.canvasElementClientSize.width),verticalPixelRatio:Math.max(1,e.bitmapSize.height/e.canvasElementClientSize.height)}}function h(e){return{...c(e),bitmapSize:e.bitmapSize,mediaSize:e.canvasElementClientSize}}function d(e){const t=(0,o.ensureNotNull)(e.getContext("2d"));return t.setTransform(1,0,0,1,0,0),t}function u(e){const t=(0,o.ensureNotNull)(e.getContext("2d")),i=(0,n.getCanvasDevicePixelRatio)(e);return t.setTransform(i,0,0,i,0,0),t}function _(e,t,i,s,o,n){e.save(),e.fillStyle=n,e.fillRect(t,i,s,o),e.restore()}function p(e,t,i,s,o,n){e.save(),e.globalCompositeOperation="copy",e.fillStyle=n,e.fillRect(t,i,s,o),e.restore()}function m(e,t,i,s){e.save(),e.scale(t,i),s(),e.restore()}function g(e,t,i){const s=y(e);return void 0===i&&(i=(0,n.getCanvasDevicePixelRatio)(s)),s.width=t.width*i,s.height=t.height*i,s}function f(e,t){const{bitmapSize:i,mediaSize:s}=t,o=y(e);return o.style.width=`${s.width}px`,o.style.height=`${s.height}px`,o.width=i.width,o.height=i.height,o}function y(e){const t=e.createElement("canvas");return w(t),t}function v(e,t){const i=y((0,o.ensureNotNull)(e.ownerDocument));e.appendChild(i);const n=(0,s.bindCanvasElementBitmapSizeTo)(i,{type:"device-pixel-content-box",transform:(e,t)=>0===e.width||0===e.height?e:{width:Math.max(e.width,t.width),height:Math.max(e.height,t.height)}});return n.resizeCanvasElement(t),n}function S(e){const t=e.suggestedBitmapSize -;return null!==t&&t.width>0&&t.height>0&&(e.applySuggestedBitmapSize(),!0)}function b(e,t){return"center"===e.textAlign?0:(0,a.isRtl)()?"start"===e.textAlign||"right"===e.textAlign?t:0:"start"===e.textAlign||"left"===e.textAlign?0:t}function w(e){e.style.userSelect="none",e.style.webkitUserSelect="none",e.style.msUserSelect="none",e.style.MozUserSelect="none",e.style.webkitTapHighlightColor="transparent"}function C(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:o,bitmapSize:n}=e;i.beginPath(),i.rect(0,0,n.width,n.height);for(let e=0;e{"use strict";i.d(t,{ChartChangesWatcher:()=>a,changedAll:()=>r});var s,o=i(67455),n=i(48096);!function(e){e[e.NothingChanged=0]="NothingChanged",e[e.ContentChanged=1]="ContentChanged",e[e.LineToolsChanged=2]="LineToolsChanged"}(s||(s={}));const r=3;class a{constructor(e,t,i){this._undoHistoryHasChanges=!1,this._changesMask=0,this._handleLayoutNameChanged=()=>{this._changesMask=1|this._changesMask},this._recalculateHaveChanges=()=>{const e=this._changesMask,t=this._undoHistoryHasChanges?1:0,i=this._lineToolsHaveChanges.value()?2:0;this._changesMask=t|i,e!==this._changesMask&&this._onValueChanged.fire(0!==this._changesMask)},this._chartWidgetCollection=e,this._undoHistory=e.undoHistory,this._lineToolsHaveChanges=e.lineToolsSynchronizerHasChanges,this._chartSaver=t,this._globalEvents=i,this._onValueChanged=new n.Delegate,this._hasChangesWV=(0,o.createWVFromGetterAndSubscription)((()=>this.hasChanges()),this.getOnChange()),this._subscribe()}destroy(){this._unsubscribe(),this._onValueChanged.destroy(),this._hasChangesWV.destroy()}changes(){return this._changesMask}hasChanges(){return this._changesMask>0}hasChangesWV(){return this._hasChangesWV}getOnChange(){return this._onValueChanged}_subscribe(){this._globalEvents.subscribe("chart_loaded",this._handleChartLoaded,this),this._globalEvents.subscribe("layout_loaded",this._handleLayoutLoaded,this),this._globalEvents.subscribe("chart_migrated",this._handleChartMigrated,this),this._globalEvents.subscribe("lineToolsResavedFromContent",this._handleChartMigrated,this),this._undoHistory.undoStack().onChange().subscribe(this,this._handleUndoHistoryChange),this._chartSaver?.chartSaved().subscribe(this,this._handleChartSaved),this._lineToolsHaveChanges.subscribe(this._recalculateHaveChanges);this._chartWidgetCollection.metaInfo.name.subscribe(this._handleLayoutNameChanged)}_unsubscribe(){this._globalEvents.unsubscribe("chart_loaded",this._handleChartLoaded,this), -this._globalEvents.unsubscribe("layout_loaded",this._handleLayoutLoaded,this),this._globalEvents.unsubscribe("chart_migrated",this._handleChartMigrated,this),this._globalEvents.unsubscribe("lineToolsResavedFromContent",this._handleChartMigrated,this),this._undoHistory.undoStack().onChange().unsubscribe(this,this._handleUndoHistoryChange),this._chartSaver?.chartSaved().unsubscribe(this,this._handleChartSaved),this._lineToolsHaveChanges.unsubscribe(this._recalculateHaveChanges);this._chartWidgetCollection.metaInfo.name.unsubscribe(this._handleLayoutNameChanged)}_setUndoHistoryHasChanges(e){this._undoHistoryHasChanges=e,this._recalculateHaveChanges()}_handleChartLoaded(){this._setUndoHistoryHasChanges(!1)}_handleLayoutLoaded(){this._setUndoHistoryHasChanges(!1)}_handleUndoHistoryChange(e){e?.affectsState()&&this._setUndoHistoryHasChanges(!0)}_handleChartMigrated(){this._setUndoHistoryHasChanges(!0)}_handleChartSaved(e){e&&this._setUndoHistoryHasChanges(!1)}}},57340:(e,t,i)=>{"use strict";i.d(t,{chartFloatingTooltipEnabledWV:()=>a});var s=i(1765),o=i(22613);const n="chart_floating_tooltip_enabled";function r(){return s.getJSON(n,true)}const a=new o.WatchedValue(r());a.subscribe((()=>s.setValue(n,a.value()))),s.onSync.subscribe(null,(()=>a.setValue(r())))},75579:(e,t,i)=>{"use strict";i.d(t,{ChartHotkeysListener:()=>g,globalEnvironmentState:()=>m,modifierPressed:()=>p,shiftPressed:()=>_});var s=i(26709),o=i(68335),n=i(35749),r=i(26610);var a=i(22613),l=i(93946);const c=new a.WatchedValue(Boolean((s.pressedKeys.value()??0)&o.Modifiers.Shift)),h=new a.WatchedValue(Boolean((s.pressedKeys.value()??0)&o.Modifiers.Mod)),d=new a.WatchedValue(Boolean((s.pressedKeys.value()??0)&o.Modifiers.Alt)),u=[o.Modifiers.None,o.Modifiers.Alt,o.Modifiers.Mod,o.Modifiers.Alt+o.Modifiers.Shift];function _(){return c}function p(){return h}function m(){return new l.EnvironmentState({altKey:d.value(),ctrlKey:p().value(),metaKey:p().value(),shiftKey:_().value()})}s.pressedKeys.subscribe(((e=0)=>{c.setValue(Boolean(e&o.Modifiers.Shift)),h.setValue(Boolean(e&o.Modifiers.Mod)),d.setValue(Boolean(e&o.Modifiers.Alt))}));class g{constructor(e,t){this._pressedKeyCode=null,this._boundKeydownHandler=null,this._boundKeyupHandler=null,this._chartWidget=e,this._parent=t,this._boundKeydownHandler=this._keydownHandler.bind(this),this._boundKeyupHandler=this._keyupHandler.bind(this),this._parent.ownerDocument.addEventListener("keydown",this._boundKeydownHandler),this._parent.ownerDocument.addEventListener("keyup",this._boundKeyupHandler)}destroy(){null!==this._boundKeydownHandler&&(this._parent.ownerDocument.removeEventListener("keydown",this._boundKeydownHandler),this._boundKeydownHandler=null),null!==this._boundKeyupHandler&&(this._parent.ownerDocument.removeEventListener("keyup",this._boundKeyupHandler),this._boundKeyupHandler=null)}_keydownHandler(e){ +o.close(this._context)>this.sic&&(this.sic=o.close(this._context)),this.position="LONG",this.nextsar=this.sic-this.atr*this.atrMult}else{var s=this.nextsar;"LONG"===this.position?o.close(this._context)s?(this.position="LONG",this.sic=o.close(this._context),this.nextsar=this.sic-this.computeATR()):(this.position="SHORT",this.sic=Math.min(o.close(this._context),this.sic),this.nextsar=this.sic+this.computeATR())),this.lastSar=s}return this.count++,s},this.main=function(e,t){return this._context=e,this._input=t,this._context.select_sym(0),[this.calculateVolatility()]}}},{name:"VWAP",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{inputs:{in_0:"hlc3",in_anchor:"Session"},styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:0,transparency:0,visible:!0,color:"#2196F3"}}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"VWAP",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"VWAP",shortDescription:"VWAP",is_price_study:!0,inputs:[{id:"in_0",name:"Source",defval:"hlc3",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_anchor",name:"Anchor Period",defval:"Session",type:"text",options:["Session","Week","Month","Quarter","Year","Decade","Century"]}],id:"VWAP@tv-basicstudies-1",scriptIdPart:"",name:"VWAP",format:{type:"inherit"}},constructor:function(){this.f_1=function(e){e.reset_hist()},this.createAnchorChecker=function(e,t){switch(t){case"Week":return function(t,i){return o.weekofyear(e,t)!==o.weekofyear(e,i)||o.year(e,t)!==o.year(e,i)};case"Month":return function(t,i){return o.month(e,t)!==o.month(e,i)||o.year(e,t)!==o.year(e,i)};case"Quarter":return function(t,i){return Math.floor(o.month(e,t)/3)!==Math.floor(o.month(e,i)/3)||o.year(e,t)!==o.year(e,i)};case"Year":return function(t,i){return o.year(e,t)!==o.year(e,i)};case"Decade":return function(t,i){return Math.floor(o.year(e,t)/10)!==Math.floor(o.year(e,i)/10)};case"Century":return function(t,i){return Math.floor(o.year(e,t)/100)!==Math.floor(o.year(e,i)/100)};default:return e=>this._isFirstBarInSession(e)}},this.init=function(e,t){this._input=t,this._isFirstBarInSession=null;const i=this._input(1)||"Session";this._anchorChecker=this.createAnchorChecker(e,i),e.setTargetAnchor(i)},this.main=function(e,t){this._context=e,this._input=t;const i=this._input(0);var s=e.new_var(),n=e.new_var(),r=e.new_var();const a=o.time(this._context),l=this._context.new_unlimited_var(a).get(1);if(a){if(null===this._isFirstBarInSession){const t=o.createNthBarInSessionCheck(e);this._isFirstBarInSession=e=>t(e,0)}this._anchorChecker(a,l)&&(this.f_1(s),this.f_1(n),r.set(a))}return s.set(o.nz(s.get(1))+o[i](this._context)*o.volume(this._context)),n.set(o.nz(n.get(1))+o.volume(this._context)),[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;var i=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){return 100*(e-t)/t},this.main=function(e,t){this._context=e,this._input=t;var i=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(){var e=this._input(0),t=this._context.new_var(o.low(this._context)),i=this._context.new_var(o.abs(o.high(this._context)-t.get(1))),s=o.sum(i,e,this._context),n=this._context.new_var(o.high(this._context)),r=this._context.new_var(o.abs(o.low(this._context)-n.get(1))),a=o.sum(r,e,this._context),l=this._context.new_var(o.atr(1,this._context)),c=o.sum(l,e,this._context) +;return[s/c,a/c]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Willams %R",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#7E57C2"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-20},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-80}],filledAreasStyle:{fill_0:{color:"#7E57C2",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Williams %R",shortDescription:"%R",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Willams %R@tv-basicstudies-1",scriptIdPart:"",name:"Willams %R",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i){return 100*(e-t)/(t-i)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=o.high(this._context),n=this._context.new_var(s),r=o.highest(n,i,this._context),a=o.low(this._context),l=this._context.new_var(a),c=o.lowest(l,i,this._context);return[this.f_0(o.close(this._context),r,c)]}}},{name:"Williams Alligator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#E91E63"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#66BB6A"}},inputs:{in_0:21,in_1:13,in_2:8,in_3:8,in_4:5,in_5:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Jaw",histogramBase:0,joinPoints:!1},plot_1:{title:"Teeth",histogramBase:0,joinPoints:!1},plot_2:{title:"Lips",histogramBase:0,joinPoints:!1}},description:"Williams Alligator",shortDescription:"Alligator",is_price_study:!0,inputs:[{id:"in_0",name:"Jaw Length",defval:21,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0"]},{id:"in_1",name:"Teeth Length",defval:13,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1"]},{id:"in_2",name:"Lips Length",defval:8,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_2"]},{id:"in_3",name:"Jaw Offset",defval:8,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0"]},{id:"in_4",name:"Teeth Offset",defval:5,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1"]},{id:"in_5",name:"Lips Offset",defval:3,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_2"]}],id:"Williams Alligator@tv-basicstudies-1",scriptIdPart:"",name:"Williams Alligator",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e, +this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2),r=this._input(3),a=this._input(4),l=this._input(5),c=o.hl2(this._context);return[{value:o.smma(c,i,this._context),offset:r},{value:o.smma(c,s,this._context),offset:a},{value:o.smma(c,n,this._context),offset:l}]}}},{name:"Williams Fractals",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{plottype:"shape_triangle_down",visible:!0,location:"BelowBar",transparency:0,color:a},plot_1:{plottype:"shape_triangle_up",visible:!0,location:"AboveBar",transparency:0,color:u}},inputs:{in_0:2}},plots:[{id:"plot_0",type:"shapes"},{id:"plot_1",type:"shapes"}],styles:{plot_0:{title:"Down fractals",isHidden:!1},plot_1:{title:"Up fractals",isHidden:!1}},description:"Williams Fractal",shortDescription:"Fractals",is_price_study:!0,is_hidden_study:!1,id:"Williams Fractals@tv-basicstudies-1",inputs:[{id:"in_0",name:"Periods",defval:2,type:"integer",min:2,max:1e12}],scriptIdPart:"",name:"Williams Fractals",isCustomIndicator:!0,format:{type:"inherit"}},constructor:function(){this.f_0=function(){for(var e=this._input(0),t=this._context.new_var(o.high(this._context)),i=!0,s=!0,n=!0,r=!0,a=!0,l=!0,c=1;c<=e;c++)i=o.and(i,o.lt(t.get(e-c),t.get(e))),s=o.and(s,o.lt(t.get(e+c),t.get(e))),n=o.and(n,o.and(o.le(t.get(e+1),t.get(e)),o.lt(t.get(e+c+1),t.get(e)))),r=o.and(r,o.and(o.le(t.get(e+1),t.get(e)),o.and(o.le(t.get(e+2),t.get(e)),o.lt(t.get(e+c+2),t.get(e))))),a=o.and(a,o.and(o.le(t.get(e+1),t.get(e)),o.and(o.le(t.get(e+2),t.get(e)),o.and(o.le(t.get(e+3),t.get(e)),o.lt(t.get(e+c+3),t.get(e)))))),l=o.and(l,o.and(o.le(t.get(e+1),t.get(e)),o.and(o.le(t.get(e+2),t.get(e)),o.and(o.le(t.get(e+3),t.get(e)),o.and(o.le(t.get(e+4),t.get(e)),o.lt(t.get(e+c+4),t.get(e)))))));var h=o.or(s,o.or(n,o.or(r,o.or(a,l)))),d=o.and(i,h),u=this._context.new_var(o.low(this._context)),_=1,p=1,m=1,g=1,f=1,y=1;for(c=1;c<=e;c++)_=o.and(_,o.gt(u.get(e-c),u.get(e))),p=o.and(p,o.gt(u.get(e+c),u.get(e))),m=o.and(m,o.and(o.ge(u.get(e+1),u.get(e)),o.gt(u.get(e+c+1),u.get(e)))),g=o.and(g,o.and(o.ge(u.get(e+1),u.get(e)),o.and(o.ge(u.get(e+2),u.get(e)),o.gt(u.get(e+c+2),u.get(e))))),f=o.and(f,o.and(o.ge(u.get(e+1),u.get(e)),o.and(o.ge(u.get(e+2),u.get(e)),o.and(o.ge(u.get(e+3),u.get(e)),o.gt(u.get(e+c+3),u.get(e)))))),y=o.and(y,o.and(o.ge(u.get(e+1),u.get(e)),o.and(o.ge(u.get(e+2),u.get(e)),o.and(o.ge(u.get(e+3),u.get(e)),o.and(o.ge(u.get(e+4),u.get(e)),o.gt(u.get(e+c+4),u.get(e)))))));var v=o.or(p,o.or(m,o.or(g,o.or(f,y))));return[o.and(_,v),d]},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0();return[{value:i[0],offset:-this._input(0)},{value:i[1],offset:-this._input(0)}]}}},{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;var i=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);const i=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)return null;const c=o.add_years_considering_dst(this._context.symbol.info.timezone,new Date(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";var s;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});const s=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});var s=i(13607);const o={};function n(e="full"){return o[e]||function(e="full",t){o[e]=t}(e,new s(e)),o[e]}function r(){for(const e in o)if(o.hasOwnProperty(e)){const t=o[e];void 0!==t&&t.destroy(),delete o[e]}}},13607:(e,t,i)=>{"use strict";e=i.nmd(e);var s=i(20057).default,o=i(90484).default,n=i(67563).PriceFormatter;const{uniq:r}=i(53470);var a=i(4168);const{normalizeUpdateMode:l}=i(52706);var c=i(39527).deepExtend;const{QUOTE_FIELDS_CACHE:h,QUOTE_FIELDS:d}=i(30947);var u=i(48096).Delegate;const{getNewPeveCloseMode:_}=i(98422),{QuoteSession:p}=i(76220);function m(e,t){this.options=Object.assign({throttleTimeout:125},t),this._connected=!1,this._symbol_data={},this._subscriptions={},this.onConnect=new u,this.onDisconnect=new u,this._quoteApi=new p(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={}, +m.prototype.typeFields.simple=["base-currency-logoid","ch","chp","currency-logoid","currency_code","currency_id","base_currency_id","current_session","description","exchange","format","fractional","is_tradable","language","local_description","listed_exchange","logoid","lp","lp_time","minmov","minmove2","original_name","pricescale","pro_name","short_name","type","typespecs","update_mode","volume","variable_tick_size","value_unit_id","unit_id","measure"],m.prototype.typeFields.simpleDetailed=[].concat(m.prototype.typeFields.simple,["ask","bid","fundamentals","high_price","is_tradable","low_price","open_price","prev_close_price","rch","rchp","rtc","rtc_time","status","basic_eps_net_income","beta_1_year","earnings_per_share_basic_ttm","industry","market_cap_basic","price_earnings_ttm","sector","volume","dividends_yield","timezone"]),m.prototype.typeFields.full=[],m.prototype.typeFields.watchlist=[].concat(m.prototype.typeFields.simple,["rchp","rtc","country_code","provider_id","dividends_availability","financials_availability","earnings_availability"]),m.prototype.typeFields.portfolio=["pro_name","short_name","exchange","listed_exchange","description","local_description","language","sector","type","typespecs","industry","currency_code","currency_id","ch","chp","logoid","currency-logoid","base-currency-logoid","earnings_per_share_forecast_next_fq","earnings_release_next_date","earnings_release_date","earnings_per_share_fq","lp","fractional","minmov","minmove2","pricescale","volume","average_volume","market_cap_calc","market_cap_basic","total_revenue","earnings_per_share_basic_ttm","price_earnings_ttm","beta_1_year","dps_common_stock_prim_issue_fy","dividends_yield","fundamental_currency_code","rates_mc","rates_fy","rates_ttm","format","value_unit_id","unit_id","measure"],m.prototype.typeFields.notes=["short_name","pro_name","logoid","currency-logoid","base-currency-logoid","symbol-primaryname","type","typespecs"],m.prototype.typeFields.estimates=["fundamental_data","type","typespecs","earnings_per_share_forecast_next_symbol_currency_fq","earnings_release_next_aligned_date","earnings_release_next_calendar_date","earnings_release_next_date"],m.prototype.typeFields.economic=["reference-last-period","lp","currency_code","value_unit_id","unit_id","measure"],m.prototype.typeFields.options=["ask","bid","lp","volume"],m.prototype.connect=function(e){this._quoteApi.connect(this.quoteHandler.bind(this))},m.prototype.quoteHandler=function(e){var t=e.method,i=e.params;switch(t){case"connected":this._connected||(this._connected=!0,this.onConnected());break;case"quote_list_fields":break;case"quote_symbol_data":this._connected&&this.onSymbolData(i[0]);break;case"quote_completed":this._connected&&this.onSymbolData({symbolname:i[0],complete:performance.now(),values:{}});break;case"disconnected":this._connected&&(this._connected=!1,this.onDisconnect.fire())}},m.prototype.onConnected=function(){this.setFields();var e=Object.keys(this._symbol_data);e.length&&(this._quoteApi.quoteAddSymbols(e),this._delayUpdateFastSymbols()), +this.onConnect.fire()},m.prototype.setFields=function(){var e=m.prototype.typeFields[this._type];e&&e.length&&this._quoteApi.quoteSetFields(e)},m.prototype.onSymbolData=function(e){try{e.status&&h.update(e,d,!1)}catch(e){}var t=e.symbolname,i=this._throttledSymbolData[t];_()&&(delete e.values.prev_close_price,void 0!==e.values.regular_close&&(e.values.prev_close_price=e.values.regular_close)),i||(i=this._throttledSymbolData[t]={fnDispatch:s(this.dipatchSymbolData.bind(this),this.options.throttleTimeout)}),i.cache?c(i.cache,e):i.cache=e,i.fnDispatch(t)},m.prototype._parseUpdateMode=function(e){l(e)},m.prototype.dipatchSymbolData=function(e){var t=this._symbol_data[e],i=this._throttledSymbolData[e].cache;if(delete this._throttledSymbolData[e].cache,this._symbol_data[e])for(var s in c(t,i),t.values&&this._parseUpdateMode(t.values),this._subscriptions){var o=this._subscriptions[s];o.has(e)&&[...o.get(e)].forEach((function(e){e(t,i)}))}},m.prototype.subscribe=function(e,t,i){this._subscriptions[e]=this._subscriptions[e]||new Map;var s=this._subscriptions[e];t=[].concat(t);var o=[];t.forEach((function(e){this._symbol_data[e]?s&&s.has(e)||this._symbol_data[e].subscribers_count++:(this._symbol_data[e]={subscribers_count:1},o.push(e)),s.has(e)||s.set(e,[]),s.get(e).push(i),s.get(e).fast=!0,this._symbol_data[e]&&this._symbol_data[e].values&&i(this._symbol_data[e],this._symbol_data[e])}),this),o.length&&this._connected&&(this._quoteApi.quoteAddSymbols(o),this._delayUpdateFastSymbols())},m.prototype.unsubscribe=function(e,t,i){t=[].concat(t);for(var s=this._subscriptions[e],o=[],n=0;n{"use strict";i.d(t,{getServerInterval:()=>o});var s=i(46082);function o(e){return s.Interval.isRange(e)?"1":e}},45720:(e,t,i)=>{"use strict";function s(e,t,i){const s=e.get(t);return void 0!==s?s:(e.set(t,i),i)}function o(e,t,i){const s=e.get(t);if(void 0!==s)return s;const o=i();return e.set(t,o),o}function n(e,t,i,n){return o(s(e,t,new Map),i,n)}function r(e,t,i,o,n){const r=s(e,t,new Map),a=s(r,i,new Map);return s(a,o,n)}i.d(t,{AbstractMapContainer:()=>a,getDefault2Lazy:()=>n,getDefault3:()=>r});class a{constructor(){this._map=new Map,this._size=0}size(){return this._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});var s=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});const s=0,o=1,n=2,r=3,a=4,l=5},16659:(e,t,i)=>{"use strict";i.d(t,{CircularCacheBuffer:()=>r});var s,o=i(50151);function n(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={}));class r{constructor(e=0,t=1.3){this._cache=new Map,this._lastItem=null,this._firstItem=null,this._size=e,this._sizeLimited=e>0,this._capacityFactor=t}set(e,t){const i={key:e,value:t,prevItem:this._lastItem,nextItem:null};null!==this._lastItem&&(this._lastItem.nextItem=i);const s=this._cache.get(e) +;return void 0!==s&&(n(s),s===this._firstItem&&(this._firstItem=s.nextItem)),this._cache.set(e,i),this._lastItem=i,null===this._firstItem&&(this._firstItem=i),this._sizeLimited&&this._cache.size>this._size*this._capacityFactor&&this._removeExtraItems(),this}has(e){return this._cache.has(e)}get(e){const t=this._cache.get(e);if(void 0===t)return t;if(t===this._firstItem&&(this._firstItem=t.nextItem??t),t!==this._lastItem){n(t);const e=(0,o.ensureNotNull)(this._lastItem);e.nextItem=t,t.prevItem=e,t.nextItem=null,this._lastItem=t}return t.value}clear(){this._cache.clear(),this._firstItem=null,this._lastItem=null}delete(e){const t=this._cache.get(e);return void 0!==t&&(n(t),t===this._lastItem&&(this._lastItem=t.prevItem),t===this._firstItem&&(this._firstItem=t.nextItem)),this._cache.delete(e)}*entries(){if(null!==this._firstItem)for(let e=this._firstItem;null!==e;e=e.nextItem)yield[e.key,e.value]}state(){const e=[];for(const[t,i]of this.entries())e.push([t,i]);return e}restoreState(e){for(const t of e)this.set(t[0],t[1])}_removeExtraItems(){const e=this._cache.size-this._size;let t=(0,o.ensureNotNull)(this._firstItem);for(let i=0;i{"use strict";i.d(t,{accumulate:()=>a,combine:()=>r,combineWithFilteredUpdate:()=>n});var s=i(22613);function o(e,t,...i){let o=null;const n=(...t)=>e(...t.map((e=>e.value())),o?.value()),r=o=new s.WatchedValue(n(...i)),a=()=>{const e=i.map(((e,t)=>e.value()));t(...e)&&r.setValue(n(...i))},l=i.map((e=>e.spawn()));for(const e of l)e.subscribe(a);return r.readonly().spawn((()=>{l.forEach((e=>e.destroy())),i.forEach((e=>e.release()))}))}function n(e,t,...i){return o(e,t,...i)}function r(e,...t){return o(e,(()=>!0),...t)}function a(e,t,...i){let o=null;const n=r(((...e)=>(e.splice(-1),e)),...i),a=t.spawn(),l=(t,...i)=>{const s=t.map((e=>e.value()));return e(s,...i,o?.value())},c=o=new s.WatchedValue(l(a.value(),...n.value()));let h=[];const d=()=>{c.setValue(l(h,...n.value()))},u=e=>{h.forEach((e=>e.destroy())),h=e.map((e=>e.spawn())),h.forEach((e=>e.subscribe(d))),d()};u(a.value()),a.subscribe(u),n.subscribe(d);return c.readonly().spawn((()=>{h.forEach((e=>e.destroy())),a.destroy(),n.destroy(),t.release()}))}},10845:(e,t,i)=>{"use strict";i.d(t,{availableTimezones:()=>l,timezoneIsAvailable:()=>u,timezoneIsSupported:()=>_,timezoneTitle:()=>p,updateAvailableTimezones:()=>d});var s=i(95523),o=i(11542);const n=[{id:"Etc/UTC",get title(){return o.t(null,void 0,i(1833))}},{id:"exchange",get title(){return o.t(null,void 0,i(86905))}}],r=[{id:"Africa/Cairo",get title(){return o.t(null,void 0,i(65736))},offset:0},{id:"Africa/Casablanca",get title(){return o.t(null,void 0,i(70409))},offset:0},{id:"Africa/Johannesburg",get title(){return o.t(null,void 0,i(39585))},offset:0},{id:"Africa/Lagos",get title(){return o.t(null,void 0,i(19931))},offset:0},{id:"Africa/Nairobi",get title(){return o.t(null,void 0,i(40977))},offset:0},{id:"Africa/Tunis",get title(){return o.t(null,void 0,i(21007))}, +offset:0},{id:"America/Anchorage",get title(){return o.t(null,void 0,i(42630))},offset:0},{id:"America/Argentina/Buenos_Aires",get title(){return o.t(null,void 0,i(25282))},offset:0},{id:"America/Bogota",get title(){return o.t(null,void 0,i(73905))},offset:0},{id:"America/Caracas",get title(){return o.t(null,void 0,i(30948))},offset:0},{id:"America/Chicago",get title(){return o.t(null,void 0,i(72452))},offset:0},{id:"America/El_Salvador",get title(){return o.t(null,void 0,i(55502))},offset:0},{id:"America/Juneau",get title(){return o.t(null,void 0,i(67560))},offset:0},{id:"America/Lima",get title(){return o.t(null,void 0,i(59444))},offset:0},{id:"America/Los_Angeles",get title(){return o.t(null,void 0,i(28733))},offset:0},{id:"America/Mexico_City",get title(){return o.t(null,void 0,i(73332))},offset:0},{id:"America/New_York",get title(){return o.t(null,void 0,i(40544))},offset:0},{id:"America/Phoenix",get title(){return o.t(null,void 0,i(14055))},offset:0},{id:"America/Santiago",get title(){return o.t(null,void 0,i(30231))},offset:0},{id:"America/Sao_Paulo",get title(){return o.t(null,void 0,i(91912))},offset:0},{id:"America/Toronto",get title(){return o.t(null,void 0,i(10095))},offset:0},{id:"America/Vancouver",get title(){return o.t(null,void 0,i(32838))},offset:0},{id:"US/Mountain",get title(){return o.t(null,void 0,i(27358))},offset:0},{id:"Asia/Almaty",get title(){return o.t(null,void 0,i(98128))},offset:0},{id:"Asia/Ashkhabad",get title(){return o.t(null,void 0,i(63627))},offset:0},{id:"Asia/Bahrain",get title(){return o.t(null,void 0,i(90594))},offset:0},{id:"Asia/Bangkok",get title(){return o.t(null,void 0,i(47045))},offset:0},{id:"Asia/Chongqing",get title(){return o.t(null,void 0,i(50349))},offset:0},{id:"Asia/Colombo",get title(){return o.t(null,void 0,i(10871))},offset:0},{id:"Asia/Dhaka",get title(){return o.t(null,void 0,i(24959))},offset:0},{id:"Asia/Dubai",get title(){return o.t(null,void 0,i(23650))},offset:0},{id:"Asia/Ho_Chi_Minh",get title(){return o.t(null,void 0,i(34491))},offset:0},{id:"Asia/Hong_Kong",get title(){return o.t(null,void 0,i(48861))},offset:0},{id:"Asia/Jakarta",get title(){return o.t(null,void 0,i(14995))},offset:0},{id:"Asia/Jerusalem",get title(){return o.t(null,void 0,i(36057))},offset:0},{id:"Asia/Karachi",get title(){return o.t(null,void 0,i(70913))},offset:0},{id:"Asia/Kabul",get title(){return o.t(null,void 0,i(99563))},offset:0},{id:"Asia/Kathmandu",get title(){return o.t(null,void 0,i(54533))},offset:0},{id:"Asia/Kolkata",get title(){return o.t(null,void 0,i(31561))},offset:0},{id:"Asia/Kuala_Lumpur",get title(){return o.t(null,void 0,i(38561))},offset:0},{id:"Asia/Kuwait",get title(){return o.t(null,void 0,i(76614))},offset:0},{id:"Asia/Manila",get title(){return o.t(null,void 0,i(48991))},offset:0},{id:"Asia/Muscat",get title(){return o.t(null,void 0,i(9865))},offset:0},{id:"Asia/Nicosia",get title(){return o.t(null,void 0,i(94600))},offset:0},{id:"Asia/Qatar",get title(){return o.t(null,void 0,i(28756))},offset:0},{id:"Asia/Riyadh",get title(){ +return o.t(null,void 0,i(37974))},offset:0},{id:"Asia/Seoul",get title(){return o.t(null,void 0,i(26820))},offset:0},{id:"Asia/Shanghai",get title(){return o.t(null,void 0,i(1852))},offset:0},{id:"Asia/Singapore",get title(){return o.t(null,void 0,i(77377))},offset:0},{id:"Asia/Taipei",get title(){return o.t(null,void 0,i(11034))},offset:0},{id:"Asia/Tehran",get title(){return o.t(null,void 0,i(6686))},offset:0},{id:"Asia/Tokyo",get title(){return o.t(null,void 0,i(69122))},offset:0},{id:"Asia/Yangon",get title(){return o.t(null,void 0,i(53168))},offset:0},{id:"Atlantic/Azores",get title(){return o.t(null,void 0,i(87580))},offset:0},{id:"Atlantic/Reykjavik",get title(){return o.t(null,void 0,i(13386))},offset:0},{id:"Australia/Adelaide",get title(){return o.t(null,void 0,i(37265))},offset:0},{id:"Australia/Brisbane",get title(){return o.t(null,void 0,i(79336))},offset:0},{id:"Australia/Perth",get title(){return o.t(null,void 0,i(24436))},offset:0},{id:"Australia/Sydney",get title(){return o.t(null,void 0,i(31622))},offset:0},{id:"Europe/Amsterdam",get title(){return o.t(null,void 0,i(36485))},offset:0},{id:"Europe/Athens",get title(){return o.t(null,void 0,i(73702))},offset:0},{id:"Europe/Belgrade",get title(){return o.t(null,void 0,i(71797))},offset:0},{id:"Europe/Berlin",get title(){return o.t(null,void 0,i(64313))},offset:0},{id:"Europe/Bratislava",get title(){return o.t(null,void 0,i(70876))},offset:0},{id:"Europe/Brussels",get title(){return o.t(null,void 0,i(91499))},offset:0},{id:"Europe/Bucharest",get title(){return o.t(null,void 0,i(33672))},offset:0},{id:"Europe/Budapest",get title(){return o.t(null,void 0,i(20313))},offset:0},{id:"Europe/Copenhagen",get title(){return o.t(null,void 0,i(38917))},offset:0},{id:"Europe/Dublin",get title(){return o.t(null,void 0,i(79716))},offset:0},{id:"Europe/Helsinki",get title(){return o.t(null,void 0,i(48203))},offset:0},{id:"Europe/Istanbul",get title(){return o.t(null,void 0,i(78326))},offset:0},{id:"Europe/Lisbon",get title(){return o.t(null,void 0,i(53375))},offset:0},{id:"Europe/London",get title(){return o.t(null,void 0,i(19439))},offset:0},{id:"Europe/Luxembourg",get title(){return o.t(null,void 0,i(81038))},offset:0},{id:"Europe/Madrid",get title(){return o.t(null,void 0,i(52066))},offset:0},{id:"Europe/Malta",get title(){return o.t(null,void 0,i(38365))},offset:0},{id:"Europe/Moscow",get title(){return o.t(null,void 0,i(64039))},offset:0},{id:"Europe/Oslo",get title(){return o.t(null,void 0,i(75722))},offset:0},{id:"Europe/Paris",get title(){return o.t(null,void 0,i(61879))},offset:0},{id:"Europe/Prague",get title(){return o.t(null,void 0,i(81248))},offset:0},{id:"Europe/Riga",get title(){return o.t(null,void 0,i(94022))},offset:0},{id:"Europe/Rome",get title(){return o.t(null,void 0,i(52961))},offset:0},{id:"Europe/Stockholm",get title(){return o.t(null,void 0,i(86716))},offset:0},{id:"Europe/Tallinn",get title(){return o.t(null,void 0,i(79995))},offset:0},{id:"Europe/Vienna",get title(){return o.t(null,void 0,i(23160))},offset:0},{id:"Europe/Vilnius", +get title(){return o.t(null,void 0,i(60534))},offset:0},{id:"Europe/Warsaw",get title(){return o.t(null,void 0,i(5959))},offset:0},{id:"Europe/Zurich",get title(){return o.t(null,void 0,i(62859))},offset:0},{id:"Pacific/Auckland",get title(){return o.t(null,void 0,i(66103))},offset:0},{id:"Pacific/Chatham",get title(){return o.t(null,void 0,i(36549))},offset:0},{id:"Pacific/Fakaofo",get title(){return o.t(null,void 0,i(98549))},offset:0},{id:"Pacific/Honolulu",get title(){return o.t(null,void 0,i(79668))},offset:0},{id:"Pacific/Norfolk",get title(){return o.t(null,void 0,i(67891))},offset:0}];function a(e,t,i){const o=function(e){return e.map((e=>{const{id:t}=e,{string:i,offset:o}=(0,s.parseTzOffset)(t);return{id:t,offset:o,get title(){return`(${i}) ${e.title}`}}}))}(e),n=i.filter((({alias:e})=>Boolean(e))).map((e=>{const{alias:t,id:i}=e,{string:o,offset:n}=(0,s.parseTzOffset)(t);return{id:i,offset:n,get title(){return`(${o}) ${e.title}`},alias:t}})),r=function(e){return e.sort(((e,t)=>{const i=e.offset-t.offset;return 0!==i?i:e.title.localeCompare(t.title)}))}(o.concat(n));return t.concat(r)}const l=a(r,n,[]),c=new Map;l.forEach((e=>{c.set(e.id,!0)}));const h=new Map;n.concat(r).forEach((e=>{h.set(e.id,!0)}));const d=e=>{l.splice(0,l.length,...a(r,n,e)),l.forEach((e=>{c.set(e.id,!0)}))};function u(e){return c.has(e)}function _(e){return h.get(e)||!1}function p(e){for(const{id:t,title:i}of r)if(t===e){return`${i} (${(0,s.parseTzOffset)(e).string})`}for(const{id:t,title:i}of l)if(t===e)return`${i}`;return e}},48096:(e,t,i)=>{"use strict";i.d(t,{Delegate:()=>n});const s=(0,i(9343).getLogger)("Common.Delegate");function o(e){return!e.singleShot}class n{constructor(){this.fire=this._fireImpl.bind(this),this._listeners=[]}subscribe(e,t,i){this._listeners.push({object:e,member:t,singleShot:!!i,skip:!1})}unsubscribe(e,t){for(let i=0;i=0;--t){const i=this._listeners[t];i.object===e&&(i.skip=!0,this._listeners.splice(t,1))}}destroy(){this._listeners=[]}_fireImpl(...e){const t=this._listeners;this._listeners=this._listeners.filter(o);const i=t.length;for(let o=0;o{"use strict";var s,o;i.d(t,{HorizontalAlign:()=>s,VerticalAlign:()=>o}),function(e){e.Left="left",e.Right="right",e.Center="center"}(s||(s={})),function(e){e.Top="top",e.Bottom="bottom",e.Middle="middle"}(o||(o={}))},55014:(e,t,i)=>{"use strict";i.d(t,{formatStudyError:()=>n,triesTranslateError:()=>o});var s=i(11542);function o(e){return r.get(e)||e}function n(e){return e.format({boldHighlightStart:"",boldHighlightEnd:""})} +const r=new Map([["You cannot see this pivot timeframe on this resolution",s.t(null,void 0,i(25059))],["The data vendor doesn't provide volume data for this symbol.",s.t(null,void 0,i(81657))],['Histogram is too large, please increase "Row Size" input.',s.t(null,void 0,i(72819))],["Histogram is too large, please reduce 'Row Size' input.",s.t(null,void 0,i(66751))],['Histogram is too large, please increase "Ticks Per Row" input.',s.t(null,void 0,i(94966))],["This script is invite-only. To request access, please contact its author.",s.t(null,void 0,i(76989))],["Volume Profile indicator available only on our upgraded plans.",s.t(null,void 0,i(39903))],["VOLUME_BIST_MIXED",s.t(null,void 0,i(69156))],["Runtime error",s.t(null,void 0,i(60630))],["Access error",s.t(null,void 0,i(77401))],["User-defined error",s.t(null,void 0,i(8580))],["Compilation error",s.t(null,void 0,i(12086))],["Metric error",s.t(null,void 0,i(83111))],["There's no data for your selected period and chart timeframe.",s.t(null,void 0,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,void 0,i(99274))],["Unexpected error in Deep Backtesting mode. Contact support for more information.",s.t(null,void 0,i(56815))],["check study unexpected error",s.t(null,void 0,i(83524))],["To calculate the VWAP indicator, more data is needed. Zoom out or scroll left to load more historical data.",s.t(null,void 0,i(41446))],["VWAP is waiting for more data",s.t(null,void 0,i(81030))],["The Bar Magnifier feature is only available to Premium users",s.t(null,void 0,i(45328))],["The bar magnifier is only available to the Premium plan or higher.",s.t(null,void 0,i(35601))]])},64971:(e,t,i)=>{"use strict";i.d(t,{getImage:()=>n});const s=new Map;function o(e){e.crossOrigin="anonymous"}function n(e,t,i=o){let n=s.get(e);return void 0===n&&(n=new Promise(((e,s)=>{const o=new Image;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";function s(e){const t=Object.create(e);return t.release=()=>{},t.ownership=()=>t,t}function o(e){const t=e;return t.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});var s=i(37236);function o(e,t=Date.now()){const i=(0,s.get_timezone)(e).offset_utc(t);let o="";const n=i/1e3/60/60;n%1&&(o=":"+Math.round(Math.abs(n%1*60)).toString().padStart(2,"0"));let r="";return r=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});var s=i(87465)},59149:e=>{"use strict";var t=[{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(){var e=[{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}];function i(e,t){var i=function(){};return i.prototype=t.prototype,e.prototype=new i,e}function s(){}function o(e){this.value=e}function n(){}function r(){}function a(){}function l(){}function c(){}function h(){}function d(){}function u(){}s.prototype.toString=function(){return this.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=/[+\-/*]/;function m(e){this.value=e}function g(e){this.value=e}function f(e){this.value=e}function y(){m.apply(this,arguments)}function v(){g.apply(this,arguments)}i(m,s),m.prototype.toString=function(){if(this.hasOwnProperty("_ticker")){var e=p.test(this._ticker)?"'":"";return e+(this._exchange?this._exchange+":":"")+this._ticker+e}return this.value},m.prototype.parse=function(){var e=_.exec(this.value);e[1]&&(this._exchange=e[1]),this._ticker=e[2]},m.prototype.parseAsFutures=function(){this.hasOwnProperty("_ticker")||this.parse();for(var e=function(e){return t.some((function(t){return t.t===e}))},i=2;i>=1;--i){var s=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))return this._exchange;null==e?delete this._exchange:this._exchange=e+""},m.prototype.ticker=function(e){if(this.hasOwnProperty("_ticker")||this.parse(),!(arguments.length>0))return this._ticker;null==e?delete this._ticker:this._ticker=e+"",delete this._root,delete this._contract},m.prototype.root=function(e){if(this.hasOwnProperty("_root")||this.parseAsFutures(),!(arguments.length>0))return this._root;null==e?delete this._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))return this._root;null==e?delete this._contract:(this._contract=e+"",this._root&&(this._ticker=this._root+this._contract))},i(g,s),g.prototype.toString=function(){return this.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(){return this.value},i(y,m),y.prototype.isIncomplete=!0,y.prototype.incompleteSuggest=function(){if("'"!==this.value)return String("'")},i(v,g),v.prototype.isIncomplete=!0;var S=new RegExp(e.map((function(e){return"("+("string"==typeof e.pattern?e.pattern.replace(/[\^$()[\]{}*+?|\\]/g,"\\$&"):e.pattern.source)+")"})).concat(".").join("|"),"g");function b(t,i){var s,n=[];e:for(;s=S.exec(t);){for(var r=e.length;r--;)if(s[r+1]){if(e[r].ctor){var a=new e[r].ctor(s[r+1]);a._offset=s.index,n.push(a)}continue e}var l=new f(s[0]);l._offset=s.index,n.push(l)}if(i&&i.recover){var c;for(r=n.length;r--;){var h=n[r];if(h instanceof g||h instanceof m){if(void 0!==c){var d=new m(""),u=n.splice(r,c-r+1,d);d.value=u.map((function(e){return e.value})).join("")}c=r}else h instanceof o||(c=void 0)}}return n}function w(e){for(var t=[],i=0;il.precedence&&(s[s.length-1].minPrecedence=l.precedence);else if(l instanceof n)s.push(t={minPrecedence:1/0,openBraceIndex:o});else if(l instanceof r){var c=e[(t=s.pop()).openBraceIndex-1],h=e[o+1];h instanceof a&&!(h.precedence<=t.minPrecedence)||!(!(c instanceof a)||c.precedencet.minPrecedence&&(s[s.length-1].minPrecedence=t.minPrecedence))}}for(o=i.length;o--;)e.splice(i[o],1);return e}function T(e){if("string"!=typeof e)throw new TypeError("expression must be a string");return(e=b(e)).filter((function(e){return e instanceof m})).map((function(e){return e.exchange()})).filter((function(e){return e}))}function P(e){return 1!==(e=T(e)).length?null:e[0]}function x(e,t){return(e=T(e)).some((function(e){return t.includes((e||"").toUpperCase())}))}function M(e){return e.join("")}return{tokenize:b,validate:function(e){return{currentState:"var"}},factorOutBraces:C,normalizeTokens:function(e){for(var t=0;t{"use strict";i.d(t,{TranslatedString:()=>s});class s{constructor(e,t){this._originalText=e,this._translatedText=t}originalText(){return this._originalText}translatedText(){return this._translatedText}format(e){const t={},i={};for(const o of Object.keys(e)){const n=e[o];n instanceof s?(t[o]=n.originalText(),i[o]=n.translatedText()):(t[o]=n.toString(),i[o]=n.toString())}const o=this._originalText.format(t),n=this._translatedText.format(i);return new s(o,n)}}},9787:(e,t,i)=>{"use strict";i.d(t,{Version:()=>o});var s=i(50151);class o{constructor(e,t){this._major=e,this._minor=t}major(){return this._major}minor(){return this._minor}isZero(){return 0===this._major&&0===this._minor}toString(){return this._major+"."+this._minor}compareTo(e){return this._majore._major?1:this._minore._minor?1:0}isLess(e){return this.compareTo(e)<0}isLessOrEqual(e){return this.compareTo(e)<=0}isEqual(e){return 0===this.compareTo(e)}isGreater(e){return this.compareTo(e)>0}isGreaterOrEqual(e){return this.compareTo(e)>=0}static parse(e){if(e instanceof o)return new o(e.major(),e.minor());if("number"==typeof e)return(0,s.assert)(Math.floor(e)===e,"Version should not be a float number"),new o(e,0);if("string"==typeof e){const t=e.split(".");if(1===t.length){const i=parseInt(t[0],10);return(0,s.assert)(!isNaN(i),"Bad version string: "+e),new o(i,0)}if(2===t.length){const i=parseInt(t[0],10);(0,s.assert)(!isNaN(i),"Bad version string: "+e);const n=parseInt(t[1],10);return(0,s.assert)(!isNaN(n),"Bad version string: "+e),new o(i,n)}throw new Error("Bad version string (one dot expected): "+e)}throw new Error("Bad version: "+e)}}o.ZERO=new o(0,0)},22613:(e,t,i)=>{"use strict";i.d(t,{WatchedValue:()=>s.WatchedValue});var s=i(52499)},62773:(e,t,i)=>{"use strict";i.d(t,{WatchedObject:()=>s.WatchedObject});var s=i(52499)},99247:(e,t,i)=>{"use strict";i.d(t,{MouseClickAutoBlurHandler:()=>r,initMouseClickAutoBlurHandler:()=>a});var s=i(81251),o=i(76460);const n="data-mouse-click-auto-blur";class r{constructor(){this._handler=e=>{document.activeElement instanceof HTMLElement&&((0,o.isKeyboardClick)(e)||e.target instanceof Element&&"INPUT"!==document.activeElement.tagName&&null!==document.activeElement.closest(`[${n}]`)&&document.activeElement.blur())},window.addEventListener("click",this._handler,!0)}static attributes(e=!0){return e?{[n]:!0}:{}}}const a=(0,s.default)((()=>new r))}, +22692:(e,t,i)=>{"use strict";i.d(t,{mapKeyCodeToDirection:()=>h,navigationOrderComparator:()=>r,queryFocusableElements:()=>l,queryTabbableElements:()=>a,updateTabIndexes:()=>c});var s,o=i(24640),n=i(15754);function r(e,t){return e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function a(e){return Array.from(e.querySelectorAll('button:not([disabled]):not([aria-disabled]):not([tabindex="-1"]), [tabindex]:not([disabled]):not([aria-disabled]):not([tabindex="-1"])')).filter((0,n.createScopedVisibleElementFilter)(e))}function l(e){return Array.from(e.querySelectorAll('button:not([disabled]):not([aria-disabled="true"]):not([aria-disabled=""]), [tabindex]:not([disabled]):not([aria-disabled="true"]):not([aria-disabled=""])')).filter((0,n.createScopedVisibleElementFilter)(e))}function c(){window.dispatchEvent(new CustomEvent("keyboard-navigation-activation",{bubbles:!0}))}function h(e){const t=(0,o.isRtl)();switch(e){case 38:return"blockPrev";case 40:return"blockNext";case 37:return t?"inlineNext":"inlinePrev";case 39:return t?"inlinePrev":"inlineNext";default:return null}}!function(e){e.BlockPrev="blockPrev",e.BlockNext="blockNext",e.InlinePrev="inlinePrev",e.InlineNext="inlineNext"}(s||(s={}))},66593:(e,t,i)=>{"use strict";i.d(t,{TOOLBAR_WIDTH_COLLAPSED:()=>o,TOOLBAR_WIDTH_EXPANDED:()=>s});const s=52,o=5},55308:(e,t,i)=>{"use strict";i.d(t,{isDrawingToolbarVisible:()=>l});var s=i(1765),o=i(37103),n=i(22613);const r=!o.enabled("hide_left_toolbar_by_default"),a=s.getBool("ChartDrawingToolbarWidget.visible",r),l=new n.WatchedValue(a)},9753:(e,t,i)=>{"use strict";i.d(t,{HEADER_TOOLBAR_HEIGHT_COLLAPSED:()=>n,HEADER_TOOLBAR_HEIGHT_EXPANDED:()=>o});var s=i(41183);const o=parseInt(s["css-value-header-toolbar-height"]),n=3},23745:(e,t,i)=>{"use strict";i.d(t,{shouldShowQuickSearchOnLib:()=>r});var s=i(49483),o=i(84015),n=i(37103);function r(){return!s.CheckMobile.any()&&!(0,o.isOnMobileAppPage)("any")&&!n.enabled("widget")&&n.enabled("header_quick_search")}},14429:(e,t,i)=>{"use strict";i.d(t,{ActionWithStandardIcon:()=>n});var s=i(41706),o=i(84696);class n extends s.Action{constructor(e){const{options:t,customActionOptions:i}=e;t.iconId&&(t.icon=t.icon??o.icons.get(t.iconId)),i&&i.iconId&&(i.icon=i.icon??o.icons.get(i.iconId)),super(e)}}},41706:(e,t,i)=>{"use strict";i.d(t,{Action:()=>c,Separator:()=>h});var s,o=i(50151),n=i(68335),r=i(4226),a=i(48096);class l extends a.Delegate{constructor(e){super(),this._onStartListening=null,this._onStopListening=null,this._onStartListening=e||null}subscribe(e,t,i){const s=0===this._listeners.length;super.subscribe(e,t,i),s&&this._listeners.length>0&&this._onStartListening&&(this._onStopListening=this._onStartListening())}unsubscribe(e,t){const i=0===this._listeners.length;super.unsubscribe(e,t),!i&&0===this._listeners.length&&this._onStopListening&&(this._onStopListening(),this._onStopListening=null)}unsubscribeAll(e){const t=0===this._listeners.length;super.unsubscribeAll(e),!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={}));class c{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)(void 0!==t,"actionId must be defined"),this.id=h,this._onUpdate=new l(d),this._options={actionId:t,...i},this.update(i),this._loadOptionsGetter=s??null,this._loadOptionsGetter&&(this._options.loading=!0),n&&(this._customAction=new c({actionId:t,options:n,optionsLoader:a,id:h}))}custom(){return this._customAction}execute(){this._options.checkable&&this.update({checked:!this._options.checked}),this._options.onExecute&&this._options.onExecute(this)}getLabel(){return this._options.label||""}getSubItems(){return this._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(){return this._loadOptionsPromise?this._loadOptionsPromise:this._loadOptionsGetter?(this._loadOptionsPromise=this._loadOptionsGetter().then((e=>this.update({...e,loading:!1}))),this._loadOptionsPromise):null}getSize(){return this._options.size??"normal"}getPayload(){return this._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(){return this._onUpdate}getState(){return this.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"in this._options?this._options.jsxLabel:void 0,isRepeatAccepted:this._options.isRepeatAccepted}}destroy(){this._destroyed=!0,this._onUpdate.destroy(),this._unbindShortcut(),this._options.onDestroy?.(),this._customAction?.destroy()}options(){return this._options}_bindShortcut(){if(!this._options.hotkeyGroup||!this._options.hotkeyHash)return;const e="string"==typeof this._options.label?this._options.label:this._options.name;this._hotkeyAction=this._options.hotkeyGroup.add({hotkey:this._options.hotkeyHash, +isRepeatAccepted:this._options.isRepeatAccepted,desc:e,handler:()=>this.execute(),isDisabled:()=>this.isDisabled()})}_unbindShortcut(){this._hotkeyAction&&(this._hotkeyAction.destroy(),delete this._hotkeyAction)}}class h{constructor(e){this.type="separator",this.id=r.guid(),this._hint=e}getHint(){return this._hint}}},84696:(e,t,i)=>{"use strict";i.d(t,{icons:()=>w});var s,o=i(53573),n=i(34369),r=i(39267),a=i(93544),l=i(84959),c=i(34487),h=i(11890),d=i(16911),u=i(25191),_=i(54190),p=i(6862),m=i(97874),g=i(2872),f=i(29453),y=i(94839),v=i(5845),S=i(1457),b=i(93379);!function(e){e.ChartShowDataWindow="Chart.ShowDataWindow",e.ChartReset="Chart.Reset",e.ChartRemoveSelectedObject="Chart.RemoveSelectedObject",e.Settings="Settings",e.ChartHide="Chart.Hide",e.ChartSymbolInfo="Chart.SymbolInfo",e.ChartFinancials="Chart.Financials",e.ChartTechnicals="Chart.Technicals",e.ChartDetailsMetrics="Chart.DetailsMetrics",e.ChartSeasonals="Chart.Seasonals",e.ChartAnalysis="Chart.Analysis",e.ChartStockBonds="Chart.StockBonds",e.ChartForecast="Chart.Forecast",e.ChartOptions="Chart.Options",e.ChartEconomyIdicators="Chart.EconomyIndicators",e.AlertAdd="Alert.Add",e.AlertEdit="Alert.Edit",e.AlertRestart="Alert.Restart",e.AlertStop="Alert.Stop",e.AlertFiresDownload="Alert.FiresDownload",e.ClearAll="Alert.Clear",e.ChartVisualOrder="Chart.VisualOrder",e.ChartShowObject="Chart.ShowObject",e.ChartPriceScale="Chart.PriceScale",e.ChartMove="Chart.Move",e.ChartApplyIndicator="Chart.ApplyIndicator",e.ChartUnlockObject="Chart.UnlockObject",e.ChartLockObject="Chart.LockObject",e.ChartAnchorLineTool="Chart.AnchorLineTool",e.ChartInsertRowTable="Chart.InsertRowTable",e.ChartInsertColumnTable="Chart.InsertColumnTable",e.ChartRemoveRowTable="Chart.RemoveRowTable",e.ChartRemoveColumnTable="Chart.RemoveColumnTable",e.ChartClone="Chart.Clone",e.ChartAddHorzLine="Chart.AddHorzLine",e.WatchlistAddSymbol="Watchlist.AddSymbol",e.WatchlistCreateNew="Watchlist.CreateNew",e.TextNoteAdd="TextNote.Add",e.TradingSell="Trading.Sell",e.TradingBuy="Trading.Buy",e.TradingAddOrder="Trading.AddOrder",e.ObjectsTreeCreateGroup="ObjectsTree.CreateGroup",e.ObjectsTreeRenameItem="ObjectsTree.RenameItem",e.IndicatorAddToFavorites="Indicator.AddToFavorites"}(s||(s={}));const w=new Map([["Chart.Reset",r],["Chart.RemoveSelectedObject",a],["Settings",n],["Chart.Hide",l],["Chart.SymbolInfo",c],["Chart.VisualOrder",h],["Chart.ShowObject",d],["Chart.PriceScale",u],["Chart.Move",_],["Chart.ApplyIndicator",p],["Chart.UnlockObject",m],["Chart.LockObject",g],["Chart.AnchorLineTool",f],["Chart.InsertRowTable",y],["Chart.InsertColumnTable",v],["Chart.RemoveRowTable",a],["Chart.RemoveColumnTable",a],["Chart.Clone",S],["Chart.AddHorzLine",b],["Indicator.AddToFavorites",o]])},31932:(e,t,i)=>{"use strict";function s(){return Promise.all([i.e(3462),i.e(6025),i.e(9378),i.e(1485),i.e(5456),i.e(6602)]).then(i.bind(i,95616))}i.d(t,{actionsProviderModule:()=>s})},72104:(e,t,i)=>{"use strict";i.d(t,{defaultChartWidgetActionsOptions:()=>s});const s={general:!0,mainSeries:!0,mainSeriesTrade:!1,esdStudies:!0, +studies:!0,fundamentals:!0,lineTools:!0,publishedCharts:!0,ordersAndPositions:!0,alerts:!0,chartEvents:!0,objectTree:!0,gotoLineTool:!1};var o;!function(e){e.Copy="Copy"}(o||(o={}))},92848:(e,t,i)=>{"use strict";i.d(t,{clipboardDataForSources:()=>l,isLineToolClipboardData:()=>a});var s=i(50151),o=i(36313),n=i(2088),r=i(26610);function a(e){return"drawing"===e.type}function l(e,t){if(1===t.length&&(0,n.isStudy)(t[0])){const e=t[0];return{title:e.title(o.TitleDisplayTarget.StatusLine),sources:[{source:(0,s.ensureNotNull)(e.state()),type:"study"}]}}const i={sources:[],title:""};return i.sources=t.filter((e=>e.copiable()&&(0,r.isLineTool)(e))).map((t=>{const i={type:"drawing",geometry:t.geometry(),source:{...t.state(!1),points:t.normalizedPoints()},modelId:e};return delete i.source.alertId,i})),i.sources.length>0?(1===i.sources.length?i.title=t[0].title(o.TitleDisplayTarget.StatusLine):i.title="Drawings",i):null}},33350:(e,t,i)=>{"use strict";i.d(t,{addExclusionArea:()=>T,addExclusionAreaByScope:()=>C,calcTextHorizontalShift:()=>b,clearRect:()=>p,createBoundCanvas:()=>v,createDisconnectedCanvas:()=>g,createDisconnectedCanvasByRenderingInfo:()=>f,disableSelection:()=>w,drawScaled:()=>m,drawWithExclusionAreaByScope:()=>P,fillRect:()=>_,getBindingRenderingInfo:()=>h,getContext2D:()=>d,getPrescaledContext2D:()=>u,measureText:()=>M,tryApplySuggestedCanvasBitmapSize:()=>S});var s=i(27714),o=i(50151),n=i(59239),r=i(57658),a=i(24640),l=i(49483);function c(e){return{horizontalPixelRatio:Math.max(1,e.bitmapSize.width/e.canvasElementClientSize.width),verticalPixelRatio:Math.max(1,e.bitmapSize.height/e.canvasElementClientSize.height)}}function h(e){return{...c(e),bitmapSize:e.bitmapSize,mediaSize:e.canvasElementClientSize}}function d(e){const t=(0,o.ensureNotNull)(e.getContext("2d"));return t.setTransform(1,0,0,1,0,0),t}function u(e){const t=(0,o.ensureNotNull)(e.getContext("2d")),i=(0,n.getCanvasDevicePixelRatio)(e);return t.setTransform(i,0,0,i,0,0),t}function _(e,t,i,s,o,n){e.save(),e.fillStyle=n,e.fillRect(t,i,s,o),e.restore()}function p(e,t,i,s,o,n){e.save(),e.globalCompositeOperation="copy",e.fillStyle=n,e.fillRect(t,i,s,o),e.restore()}function m(e,t,i,s){e.save(),e.scale(t,i),s(),e.restore()}function g(e,t,i){const s=y(e);return void 0===i&&(i=(0,n.getCanvasDevicePixelRatio)(s)),s.width=t.width*i,s.height=t.height*i,s}function f(e,t){const{bitmapSize:i,mediaSize:s}=t,o=y(e);return o.style.width=`${s.width}px`,o.style.height=`${s.height}px`,o.width=i.width,o.height=i.height,o}function y(e){const t=e.createElement("canvas");return w(t),t}function v(e,t){const i=y((0,o.ensureNotNull)(e.ownerDocument));e.appendChild(i);const n=(0,s.bindCanvasElementBitmapSizeTo)(i,{type:"device-pixel-content-box",transform:(e,t)=>0===e.width||0===e.height?e:{width:Math.max(e.width,t.width),height:Math.max(e.height,t.height)}});return n.resizeCanvasElement(t),n}function S(e){const t=e.suggestedBitmapSize;return null!==t&&t.width>0&&t.height>0&&(e.applySuggestedBitmapSize(),!0)}function b(e,t){return"center"===e.textAlign?0:(0, +a.isRtl)()?"start"===e.textAlign||"right"===e.textAlign?t:0:"start"===e.textAlign||"left"===e.textAlign?0:t}function w(e){e.style.userSelect="none",e.style.webkitUserSelect="none",e.style.msUserSelect="none",e.style.MozUserSelect="none",e.style.webkitTapHighlightColor="transparent"}function C(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:o,bitmapSize:n}=e;i.beginPath(),i.rect(0,0,n.width,n.height);for(let e=0;e{"use strict";i.d(t,{ChartChangesWatcher:()=>a,changedAll:()=>r});var s,o=i(67455),n=i(48096);!function(e){e[e.NothingChanged=0]="NothingChanged",e[e.ContentChanged=1]="ContentChanged",e[e.LineToolsChanged=2]="LineToolsChanged"}(s||(s={}));const r=3;class a{constructor(e,t,i){this._undoHistoryHasChanges=!1,this._changesMask=0,this._handleLayoutNameChanged=()=>{this._changesMask=1|this._changesMask},this._recalculateHaveChanges=()=>{const e=this._changesMask,t=this._undoHistoryHasChanges?1:0,i=this._lineToolsHaveChanges.value()?2:0;this._changesMask=t|i,e!==this._changesMask&&this._onValueChanged.fire(0!==this._changesMask)},this._chartWidgetCollection=e,this._undoHistory=e.undoHistory,this._lineToolsHaveChanges=e.lineToolsSynchronizerHasChanges,this._chartSaver=t,this._globalEvents=i,this._onValueChanged=new n.Delegate,this._hasChangesWV=(0,o.createWVFromGetterAndSubscription)((()=>this.hasChanges()),this.getOnChange()),this._subscribe()}destroy(){this._unsubscribe(),this._onValueChanged.destroy(),this._hasChangesWV.destroy()}changes(){return this._changesMask}hasChanges(){return this._changesMask>0}hasChangesWV(){return this._hasChangesWV}getOnChange(){return this._onValueChanged}_subscribe(){this._globalEvents.subscribe("chart_loaded",this._handleChartLoaded,this),this._globalEvents.subscribe("layout_loaded",this._handleLayoutLoaded,this),this._globalEvents.subscribe("chart_migrated",this._handleChartMigrated,this),this._globalEvents.subscribe("lineToolsResavedFromContent",this._handleChartMigrated,this),this._undoHistory.undoStack().onChange().subscribe(this,this._handleUndoHistoryChange),this._chartSaver?.chartSaved().subscribe(this,this._handleChartSaved),this._lineToolsHaveChanges.subscribe(this._recalculateHaveChanges);this._chartWidgetCollection.metaInfo.name.subscribe(this._handleLayoutNameChanged)}_unsubscribe(){this._globalEvents.unsubscribe("chart_loaded",this._handleChartLoaded,this),this._globalEvents.unsubscribe("layout_loaded",this._handleLayoutLoaded,this), +this._globalEvents.unsubscribe("chart_migrated",this._handleChartMigrated,this),this._globalEvents.unsubscribe("lineToolsResavedFromContent",this._handleChartMigrated,this),this._undoHistory.undoStack().onChange().unsubscribe(this,this._handleUndoHistoryChange),this._chartSaver?.chartSaved().unsubscribe(this,this._handleChartSaved),this._lineToolsHaveChanges.unsubscribe(this._recalculateHaveChanges);this._chartWidgetCollection.metaInfo.name.unsubscribe(this._handleLayoutNameChanged)}_setUndoHistoryHasChanges(e){this._undoHistoryHasChanges=e,this._recalculateHaveChanges()}_handleChartLoaded(){this._setUndoHistoryHasChanges(!1)}_handleLayoutLoaded(){this._setUndoHistoryHasChanges(!1)}_handleUndoHistoryChange(e){e?.affectsState()&&this._setUndoHistoryHasChanges(!0)}_handleChartMigrated(){this._setUndoHistoryHasChanges(!0)}_handleChartSaved(e){e&&this._setUndoHistoryHasChanges(!1)}}},57340:(e,t,i)=>{"use strict";i.d(t,{chartFloatingTooltipEnabledWV:()=>a});var s=i(1765),o=i(22613);const n="chart_floating_tooltip_enabled";function r(){return s.getJSON(n,true)}const a=new o.WatchedValue(r());a.subscribe((()=>s.setValue(n,a.value()))),s.onSync.subscribe(null,(()=>a.setValue(r())))},75579:(e,t,i)=>{"use strict";i.d(t,{ChartHotkeysListener:()=>g,globalEnvironmentState:()=>m,modifierPressed:()=>p,shiftPressed:()=>_});var s=i(26709),o=i(68335),n=i(35749),r=i(26610);var a=i(22613),l=i(93946);const c=new a.WatchedValue(Boolean((s.pressedKeys.value()??0)&o.Modifiers.Shift)),h=new a.WatchedValue(Boolean((s.pressedKeys.value()??0)&o.Modifiers.Mod)),d=new a.WatchedValue(Boolean((s.pressedKeys.value()??0)&o.Modifiers.Alt)),u=[o.Modifiers.None,o.Modifiers.Alt,o.Modifiers.Mod,o.Modifiers.Alt+o.Modifiers.Shift];function _(){return c}function p(){return h}function m(){return new l.EnvironmentState({altKey:d.value(),ctrlKey:p().value(),metaKey:p().value(),shiftKey:_().value()})}s.pressedKeys.subscribe(((e=0)=>{c.setValue(Boolean(e&o.Modifiers.Shift)),h.setValue(Boolean(e&o.Modifiers.Mod)),d.setValue(Boolean(e&o.Modifiers.Alt))}));class g{constructor(e,t){this._pressedKeyCode=null,this._boundKeydownHandler=null,this._boundKeyupHandler=null,this._chartWidget=e,this._parent=t,this._boundKeydownHandler=this._keydownHandler.bind(this),this._boundKeyupHandler=this._keyupHandler.bind(this),this._parent.ownerDocument.addEventListener("keydown",this._boundKeydownHandler),this._parent.ownerDocument.addEventListener("keyup",this._boundKeyupHandler)}destroy(){null!==this._boundKeydownHandler&&(this._parent.ownerDocument.removeEventListener("keydown",this._boundKeydownHandler),this._boundKeydownHandler=null),null!==this._boundKeyupHandler&&(this._parent.ownerDocument.removeEventListener("keyup",this._boundKeyupHandler),this._boundKeyupHandler=null)}_keydownHandler(e){ this._chartWidget.hasModel()&&this._chartWidget.isActive().value()&&(e.defaultPrevented||("text-editor"===window.document.activeElement?.getAttribute("data-name")&&this._handleTabKeyDown(e)||window.document.activeElement===window.document.body&&(this._handleMoveDrawingsKeyDown(e)||this._handleScrollKeyDown(e)||this._handleZoomKeyDown(e)))&&e.preventDefault())}_keyupHandler(e){this._chartWidget.hasModel()&&this._handleScrollKeyUp(e)}_handleTabKeyDown(e){const t=255&(0,o.hashFromEvent)(e),i=this._chartWidget.model();if(9===t){const t=i.selection().dataSources()[0];if(void 0!==t&&(s=t,(0,r.isLineTool)(s)&&"LineToolTable"===s.state().type)){const i=(0,o.modifiersFromEvent)(e);return t.switchActiveCell(i===o.Modifiers.Shift)}return!1}var s;return!1}_handleMoveDrawingsKeyDown(e){const t=255&(0,o.hashFromEvent)(e),i=this._chartWidget.model();switch(t){case 37:return i.moveSelectedToolsLeft();case 39:return i.moveSelectedToolsRight();case 38:return i.moveSelectedToolsUp();case 40:return i.moveSelectedToolsDown()}return!1}_handleScrollKeyDown(e){if(null!==this._pressedKeyCode)return!1;const t=(0,o.hashFromEvent)(e),i=255&t,s=(0,o.modifiersFromEvent)(e);let r;if(37===i)r=1;else{if(39!==i)return!1;r=-1}if(o.isMacKeyboard&&s===o.Modifiers.Mod||!u.includes(s))return!1;if((0,n.isNativeUIInteraction)(t,e.target))return!1;this._pressedKeyCode=i;const a=this._chartWidget.scrollHelper();return s===o.Modifiers.None?a.moveByBar(r):s===o.Modifiers.Alt||s===o.Modifiers.Mod?a.move(r):-1===r?a.scrollToRealtime(!0):a.scrollToFirstBar(),!0}_handleScrollKeyUp(e){if(null===this._pressedKeyCode)return!1;const t=(0,o.hashFromEvent)(e);if((0,n.isNativeUIInteraction)(t,e.target))return!1;return(255&t)===this._pressedKeyCode&&(this._pressedKeyCode=null,this._chartWidget.scrollHelper().stopMove(),!0)}_handleZoomKeyDown(e){const t=(0,o.hashFromEvent)(e),i=255&t;if((0,o.modifiersFromEvent)(e)!==o.Modifiers.Mod||(0,n.isNativeUIInteraction)(t,e.target))return!1;const s=this._chartWidget.model();if(38===i)s.zoomIn();else{if(40!==i)return!1;s.zoomOut()}return!0}}},64236:(e,t,i)=>{"use strict";i.d(t,{getChartWidgetApiTimeConverter:()=>l});var s=i(50151),o=i(32955),n=i(37103);const r=n.enabled("end_of_period_timescale_marks"),a=n.enabled("secondary_series_extend_time_scale");function l(e,t,i){return new h(function(e,t){const i=function(e,t){return e+t.session+t.timezone+(t.corrections||"")+(t.session_holidays||"")}(e,t);let s=c.get(i);void 0===s&&(s=(0,o.createDwmAligner)(e,t),c.set(i,s));return s}(e,t),i)}const c=new Map;class h{constructor(e,t){this._dwmAligner=e,this._chartModel=t}convertPublicTimeToInternalTime(e){return null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(1e3*e)/1e3:e}convertInternalTimeToPublicTime(e){return null!==this._dwmAligner?this._dwmAligner.timeToExchangeTradingDay(1e3*e)/1e3:e}convertTimePointIndexToPublicTime(e){const t=this._chartModel.timeScale();if(t.isEmpty())return null;let i=r?function(e,t){const i=e.indexToUserTime(t);if(null===i)return null;return i.getTime()/1e3 }(t,e):this.convertTimePointIndexToInternalTime(e);if(null!==i){const t=this._chartModel.mainSeries().bars(),s=t.contains(e),o=t.firstIndex(),n=t.lastIndex();!s&&(null!==o&&null!==n&&o<=e&&e<=n)&&a||(i=this.convertInternalTimeToPublicTime(i))}return i}convertTimePointIndexToInternalTime(e){const t=this._chartModel.timeScale();if(t.isEmpty())return null;const i=t.points(),{firstIndex:o,lastIndex:n}=(0,s.ensureNotNull)(i.range().value());let r=null;if(o<=e&&e<=n)r=i.valueAt(e);else if(e>n){const i=this._chartModel.mainSeries().syncModel();if(null!==i){const o=(0,s.ensureNotNull)(t.indexToTimePoint(n));r=i.projectTime(o,e-n)}}return r}}},84617:(e,t,i)=>{"use strict";i.d(t,{CHART_FONT_FAMILY:()=>n,setChartFontFamily:()=>o});const s="'Trebuchet MS', Roboto, Ubuntu, sans-serif";function o(e){n=e}let n=`-apple-system, BlinkMacSystemFont, ${s}`},31269:(e,t,i)=>{"use strict";i.d(t,{ContextMenuManager:()=>s});var s,o=i(12217),n=i(41706),r=i(87713);!function(e){let t=null,s=null;const a=[],l={createAction:e=>new n.Action({actionId:"Chart.CustomActionId",options:e}),createAsyncAction:e=>new n.Action({actionId:"Chart.CustomActionId",options:{},optionsLoader:e}),createSeparator:()=>new n.Separator};async function c(e,n={},r={menuName:""},c){null!==t&&(e=await t(e,l,r));let d=null;const u=()=>{const e=(0,o.indexOf)(a,(e=>e.renderer===d));-1!==e&&a.splice(e,1),void 0!==c&&c()};let _=!1;if(null!==s&&(d=await s(e,r,u)),d)_=!0,h();else{const t=await Promise.all([i.e(4109),i.e(1681),i.e(6032),i.e(3425),i.e(8260),i.e(1979),i.e(7780),i.e(1667),i.e(3290),i.e(2227),i.e(3179),i.e(6376),i.e(1584)]).then(i.bind(i,14474));d=new t.ContextMenuRenderer(e,n,u,h)}return a.push({renderer:d,isExternal:_}),d}function h(){(0,r.globalCloseMenu)(),a.forEach((e=>{e.isExternal&&e.renderer.isShown()&&e.renderer.hide()}))}e.createMenu=c,e.showMenu=function(e,t,i={},s,o){return c(e,i,s,o).then((e=>e.show(t)))},e.setCustomRendererFactory=function(e){s=e},e.setCustomItemsProcessor=function(e){t=e},e.hideAll=h,e.getShown=function(){for(let e=0;e{"use strict";i.d(t,{deleteLockedLineToolsProperty:()=>c});var s=i(1765),o=i(41072),n=i(5734);const r="delete_locked_linetools",a="toggle_delete_locked_linetools";function l(){const e=s.getBool(r,!0)&&s.getBool(n.doNotShowDeleteLockedLineKey,!1),t=s.getBool(a,e);return s.remove(r),s.setValue(a,t),t}const c=(0,o.createPrimitiveProperty)(l());c.subscribe(null,(()=>s.setValue(a,c.value()))),s.onSync.subscribe(null,(()=>c.setValue(l())))},5734:(e,t,i)=>{"use strict";i.d(t,{doNotShowDeleteLockedLineConfirmProperty:()=>a,doNotShowDeleteLockedLineKey:()=>n});var s=i(1765),o=i(41072);const n="do_not_show_delete_locked_line_confirm";function r(){return s.getBool(n,!1)}const a=(0,o.createPrimitiveProperty)(r());a.subscribe(null,(()=>s.setValue(n,a.value()))),s.onSync.subscribe(null,(()=>a.setValue(r())))},38414:(e,t,i)=>{"use strict";i.d(t,{DialogRenderer:()=>o});var s=i(22613);class o{constructor(){ this._container=document.createElement("div"),this._visibility=new s.WatchedValue(!1),this._rootInstance=null}visible(){return this._visibility.readonly()}_setVisibility(e){this._visibility.setValue(e)}}},70002:(e,t,i)=>{"use strict";var s;i.d(t,{TabNames:()=>s}),function(e){e.background="Background",e.coordinates="Coordinates",e.drawings="Drawings",e.events="Events",e.alerts="Alerts",e.inputs="Inputs",e.properties="Properties",e.scales="Scales",e.legend="Legend",e.sourceCode="Source Code",e.style="Style",e.symbol="Symbol",e.timezoneSessions="Timezone/Sessions",e.trading="Trading",e.visibility="Visibility",e.text="Text"}(s||(s={}))},69455:(e,t,i)=>{"use strict";i.d(t,{createFavoriteDrawingToolbar:()=>a,getFavoriteDrawingToolbarPromise:()=>r});var s=i(9753);let o=null,n=null;function r(){return n}function a(){null===n&&(n=Promise.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,63027)).then((({FavoriteDrawingToolbar:e})=>(o=null!==o?o:new e({left:window.innerWidth/2,top:s.HEADER_TOOLBAR_HEIGHT_EXPANDED+61}),o))))}},59239:(e,t,i)=>{"use strict";function s(e){return Math.max(1,e.ownerDocument?.defaultView?.devicePixelRatio||1)}i.d(t,{getCanvasDevicePixelRatio:()=>s})},96708:(e,t,i)=>{"use strict";i.d(t,{getPriceAxisNameInfo:()=>r});const s=["Z","Y","X","W","V","U","T","S"],o=["A","B","C","D","E","F","G","H"];class n{constructor(e){this.label=e}equals(e){return null!==e&&this.label===e.label}}function r(e,t){const i="left"===e?s:o,r=t{"use strict";i.d(t,{getTranslatedInputTitle:()=>n});var s=i(11542);const o={PercentageLTP:"Percentage LTP",Labels:"Pane labels",LineFills:"Line fills"};function n(e){return s.t(o[e]??e,{context:"input"},i(32856))}},60709:(e,t,i)=>{"use strict";i.d(t,{CHART_WIDGET_COLLECTION_SERVICE:()=>n,chartWidgetCollectionService:()=>r});var s,o=i(16216);!function(e){e.Multichart="multichart",e.ForceFullscreen="force-fullscreen"}(s||(s={}));const n={id:"ChartWidgetCollectionService"};function r(){return(0,o.hasService)(n)?(0,o.service)(n):null}},51304:(e,t,i)=>{"use strict";i.d(t,{InvalidationLevel:()=>s,InvalidationMask:()=>l,defaultInvalidationLevel:()=>r});var s,o=i(50151);class n{constructor(e=r){this._paneInvalidationLevel=r,this._leftPriceScalesInvalidationMap=new Map,this._rightPriceScalesInvalidationMap=new Map,this._legendWidgetInvalidated=!1,this._invalidationLevel=e}fullInvalidation(){return this._invalidationLevel}invalidateAll(e){this._invalidationLevel=Math.max(this._invalidationLevel,e)}invalidatePane(e){this._paneInvalidationLevel=Math.max(this._invalidationLevel,e)}invalidateLegendWidgetLayout(){this._legendWidgetInvalidated=!0}invalidatePriceScale(e,t,i){const s="left"===e?this._leftPriceScalesInvalidationMap:this._rightPriceScalesInvalidationMap,o=s.get(t)||r;s.set(t,Math.max(o,i))} @@ -216,7 +216,7 @@ this._target.removeEventListener("touchstart",e),this._target.removeEventListene ;return null}},23714:(e,t,i)=>{"use strict";i.d(t,{actualBehavior:()=>a,availableValues:()=>r,navigationButtonsVisibilityKey:()=>o,property:()=>n,restoreNavigationButtonsVisibilitySettingsValue:()=>l});var s=i(64876);const o="NavigationButtons.visibility",{property:n,availableValues:r,actualBehavior:a,restoreDefaultValue:l}=(0,s.createVisibilityController)(o)},61786:(e,t,i)=>{"use strict";i.d(t,{actualBehavior:()=>a,availableValues:()=>r,property:()=>n,restorePaneButtonsVisibilitySettingsValue:()=>l});var s=i(64876),o=i(23714);const{property:n,availableValues:r,actualBehavior:a,restoreDefaultValue:l}=(0,s.createVisibilityController)("PaneButtons.visibility",o.navigationButtonsVisibilityKey)},67763:(e,t,i)=>{"use strict";i.d(t,{AbstractJsonStoreService:()=>o,CommonJsonStoreService:()=>n});var s=i(48096);class o{constructor(e,t,i,o,n){this._onChange=new s.Delegate,this._handleChange=()=>{this._onChange.fire(this.get())},this._crossTabEvents=e,this._jsonKeyValueStore=t,this.CROSSTAB_EVENT_NAME=i,this.JSON_STORE_KEY=o,this.defaultStoreValue=this._serialize(n),this._subscribe()}get(){const e=this._jsonKeyValueStore.getJSON(this.JSON_STORE_KEY,this.defaultStoreValue);return this._deserialize(e)}set(e,t){const i=this._serialize(e);this._jsonKeyValueStore.setJSON(this.JSON_STORE_KEY,i,t),this._crossTabEvents.emit(this.CROSSTAB_EVENT_NAME),this._onChange.fire(e)}getOnChange(){return this._onChange}destroy(){this._unsubscribe(),this._onChange.destroy(),delete this._onChange}_subscribe(){this._crossTabEvents.on(this.CROSSTAB_EVENT_NAME,this._handleChange),this._jsonKeyValueStore.onSync.subscribe(this,this._handleChange)}_unsubscribe(){this._crossTabEvents.off(this.CROSSTAB_EVENT_NAME,this._handleChange),this._jsonKeyValueStore.onSync.unsubscribe(this,this._handleChange)}}class n extends o{_serialize(e){return e}_deserialize(e){return e}}},68028:(e,t,i)=>{"use strict";i.d(t,{CustomStatusModel:()=>c});var s=i(22613);const o="#9598a1",n=!1,r=null,a='';class l{constructor(e){this._visible=new s.WatchedValue(n),this._tooltip=new s.WatchedValue(r),this._icon=new s.WatchedValue(a),this._color=new s.WatchedValue(o),this._tooltipContent=new s.WatchedValue(null),this._symbol=e}symbol(){return this._symbol}tooltip(){return this._tooltip}icon(){return this._icon}color(){return this._color}visible(){return this._visible}tooltipContent(){return this._tooltipContent}}class c{constructor(){this._symbolCustomStatuses=new Map}getSymbolCustomStatus(e){if(this._symbolCustomStatuses.has(e))return this._symbolCustomStatuses.get(e);const t=new l(e);return this._symbolCustomStatuses.set(e,t),t}hideAll(){for(const e of this._symbolCustomStatuses.values())e.visible().setValue(!1)}static getInstance(){return null===this._instance&&(this._instance=new c),this._instance}}c._instance=null},87911:(e,t,i)=>{"use strict";i.d(t,{restoreShowMarketOpenStatusProperty:()=>c,showMarketOpenStatusProperty:()=>l});var s=i(41072),o=i(1765);const n="Chart.ShowMarketOpenStatus",r=!0 ;function a(){return o.getBool(n,r)}const l=(0,s.createPrimitiveProperty)(a());function c(){l.setValue(r),o.remove(n)}o.onSync.subscribe(null,(()=>l.setValue(a()))),l.subscribe(null,(()=>o.setValue(n,l.value())))},53107:(e,t,i)=>{"use strict";i.d(t,{MarketStatusModel:()=>u});var s,o=i(50151),n=i(37236),r=i(22613),a=i(48943),l=i(16329),c=i(95059);function h(e){return window.ChartApiInstance.serverTime()/1e3-e}function d(e,t,i){return e<=i?t<=i?1/0:t/1e3:Math.min(e,t)/1e3}!function(e){e.Open="market",e.Pre="pre_market",e.Post="post_market",e.Close="out_of_session",e.Holiday="holiday",e.Delisted="delisted",e.Expired="expired"}(s||(s={}));class u{constructor(e){this._currentSession=new r.WatchedValue(null),this._delistedByTypespecs=new r.WatchedValue(!1),this._sessionsSpec=null,this._nextSessionEdgeInternal=null,this._nextSessionEdge=new r.WatchedValue(null),this._recalcNextSessionEdgeTimerId=null,this._delay=0,this._futuresContractExpirationTime=null,this._quotesProvider=e;const{current_session:t}=e.quotes()??{};t&&this._currentSession.setValue(t),this._marketStatus=(0,a.combine)(((e,t,i)=>null===e?e:t?"delisted":i?"expired":function(e){switch(e){case"market":return"market";case"pre_market":return"pre_market";case"post_market":return"post_market";case"out_of_session":return"out_of_session";case"holiday":return"holiday"}(0,o.ensureNever)(e)}(e)),this._currentSession.weakReference(),this._delistedByTypespecs.weakReference(),(this._futuresContractExpirationTime?.expired()??new r.WatchedValue(!1)).weakReference()),e.quotesUpdate().subscribe(this,(e=>{this._currentSession.setValue(e?.values.current_session??null)})),e.quoteSymbolChanged().subscribe(this,(()=>{this._currentSession.setValue(null)}))}destroy(){this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._quotesProvider.quoteSymbolChanged().unsubscribeAll(this),null!==this._recalcNextSessionEdgeTimerId&&clearTimeout(this._recalcNextSessionEdgeTimerId),this._marketStatus.destroy()}futuresContractExpirationTime(){return this._futuresContractExpirationTime}setSymbolInfo(e){if(this._nextSessionEdgeInternal=null,null===e)return void(this._sessionsSpec=null);this._delay=(0,c.getSymbolDelaySeconds)(e);const t=new l.SessionsSpec(e.timezone,e.session_display??e.session,e.session_holidays,e.corrections);let i,s;const o=e.subsessions?.find((e=>"premarket"===e.id)),n=e.subsessions?.find((e=>"postmarket"===e.id));void 0!==o&&(i=new l.SessionsSpec(e.timezone,o["session-display"]??o.session,e.session_holidays,o["session-correction"])),void 0!==n&&(s=new l.SessionsSpec(e.timezone,n["session-display"]??n.session,e.session_holidays,n["session-correction"])),this._sessionsSpec={general:t,preMarket:i,postMarket:s},this._recalculateNextSessionEdge()}status(){return this._marketStatus}currentSession(){return this._currentSession}nextSessionEdge(){return this._nextSessionEdge}_getNextSessionEdgeInternal(){if(null===this._sessionsSpec)return null;const e=1e3*h(this._delay);if(null===this._nextSessionEdgeInternal||(this._nextSessionEdgeInternal.timestamp??1/0)<=e/1e3){ const{general:t,preMarket:i,postMarket:s}=this._sessionsSpec,o=(0,n.get_timezone)(t.timezone()),r=(0,n.utc_to_cal)(o,e),a=d((0,n.cal_to_utc)(o,t.alignToNearestSessionStart(r,1)),(0,n.cal_to_utc)(o,t.alignToNearestSessionEnd(r,1)),e),l=d(void 0!==i?(0,n.cal_to_utc)(o,i.alignToNearestSessionStart(r,1)):1/0,void 0!==i?(0,n.cal_to_utc)(o,i.alignToNearestSessionEnd(r,1)):1/0,e),c=d(void 0!==s?(0,n.cal_to_utc)(o,s.alignToNearestSessionStart(r,1)):1/0,void 0!==s?(0,n.cal_to_utc)(o,s.alignToNearestSessionEnd(r,1)):1/0,e);let u=Math.min(a,l,c);if(u===1/0){const e=h(this._delay),i=6e4,s=new Date(Math.round(new Date(1e3*e).getTime()/i)*i).getTime()+i,r=(0,n.utc_to_cal)(o,s),a=d((0,n.cal_to_utc)(o,t.alignToNearestSessionStart(r,1)),(0,n.cal_to_utc)(o,t.alignToNearestSessionEnd(r,1)),s),_=Math.min(a,l,c);_!==1/0?(this._nextSessionEdgeInternal={timestamp:u},u=_):this._nextSessionEdgeInternal={timestamp:null}}this._nextSessionEdgeInternal=u===c?{timestamp:u,status:"post_market"}:u===l?{timestamp:u,status:"pre_market"}:{timestamp:u}}return this._nextSessionEdgeInternal}_recalculateNextSessionEdge(){const e=this._getNextSessionEdgeInternal();if(null===e||null===e.timestamp)return void this._nextSessionEdge.setValue(null);const t={status:e.status,remainingSeconds:Math.max(0,e.timestamp-h(this._delay))};if(null===this._recalcNextSessionEdgeTimerId){const e=Number.isFinite(t.remainingSeconds)?Math.ceil(t.remainingSeconds%60):1;this._recalcNextSessionEdgeTimerId=setTimeout((()=>this._recalculateNextSessionEdgeByTimer()),1e3*e)}this._nextSessionEdge.setValue(t)}_recalculateNextSessionEdgeByTimer(){this._recalcNextSessionEdgeTimerId=null,this._recalculateNextSessionEdge()}}},50888:(e,t,i)=>{"use strict";i.d(t,{CRUCIAL_REALTIME_BATS:()=>l,firstReplacedByBatsExchange:()=>c,isAmexToCboeMigratedSymbol:()=>_,isDelay:()=>d,isEod:()=>h,witoutRealtime:()=>u});i(50151);var s=i(59149),o=i.n(s);const n=["DJ","JSE","BELEX"],r=["NZX"],a=["BIVA"],l=["AMEX","NASDAQ","NYSE"];function c(e){return null}function h(e,t){return o().hasEodSymbols(e.full_name)||6===t}function d(e){return void 0!==e&&e>0}function u(e){return"index"===e.type&&n.includes(e.listed_exchange)||"futures"===e.type&&r.includes(e.listed_exchange)||a.includes(e.listed_exchange)}function _(e,t){return"amex"===t&&"CBOE"===e}},18041:(e,t,i)=>{"use strict";i.d(t,{getStudyTemplateDescString:()=>r,getStudyTemplateMetaInfo:()=>o,getStudyTemplateSaveData:()=>n});var s=i(36313);function o(e,t){return{indicators:e.allStudies(!0).map((e=>({id:e.metaInfo().id,description:e.title(s.TitleDisplayTarget.StatusLine,!0,void 0,!0)}))),interval:t}}function n(e,t,i,s){const n=t.studyTemplate(i,s);return{name:e,content:JSON.stringify(n),meta_info:o(t,n.interval)}}function r(e){const t=new Map;return e.forEach((e=>{const[i,s]=t.get(e.id)||[e.description,0];t.set(e.id,[i,s+1])})),Array.from(t.values()).map((([e,t])=>`${e}${t>1?` x ${t}`:""}`)).join(", ")}},4745:(e,t,i)=>{"use strict";i.d(t,{canShowSpreadActions:()=>o,globalKeypressMatches:()=>n});var s=i(37103);function o(){let e=!1 -;return s.enabled("show_spread_operators")&&(e=!0),e}function n(e){if(e.ctrlKey)return!1;if(e.metaKey)return!1;if(!e.charCode)return!1;if(!e.which||e.which<=32)return!1;const t=e.target;return!t||!/^(input|textarea)$/i.test(t.tagName)&&"listbox"!==t.getAttribute("role")}},8686:(e,t,i)=>{"use strict";function s(){return Promise.all([i.e(8836),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(3672),i.e(3359),i.e(1697),i.e(4587),i.e(7833),i.e(8752),i.e(445),i.e(846),i.e(2227),i.e(4931),i.e(9418),i.e(3179),i.e(4426),i.e(2475),i.e(1754)]).then(i.bind(i,89324))}i.d(t,{loadNewSymbolSearch:()=>s})},49470:(e,t,i)=>{"use strict";i.d(t,{tradingService:()=>n});var s=i(16216);const o={id:"TradingService"};function n(){return(0,s.hasService)(o)?(0,s.service)(o):null}},28477:(e,t,i)=>{"use strict";i.d(t,{AbstractBarColorer:()=>s});class s{constructor(){this._backColorers=[]}barStyle(e,t,i){const s={};for(const o of this._backColorers)o.applyBarStyle(e,t,s,i);return this.applyBarStyle(e,t,s,i),s}pushBackBarColorer(e){this._backColorers.unshift(e)}firstColoredBar(e){return null}}},33718:(e,t,i)=>{"use strict";i.d(t,{addPlusButtonProperty:()=>p,restoreAddPlusButtonSettingsValue:()=>m,showPlusButtonOnCursor:()=>d});var s=i(26709),o=i(37103),n=i(1765),r=i(41072),a=i(22613);const l="add_plus_button";function c(){const e=s.keyboardPressedKeysState.value();return void 0!==e&&(Boolean(e.modifiers&s.Modifiers.Alt&&e.modifiers&s.Modifiers.Mod)&&(void 0===e.code||e.altOrOptionCode()||e.controlOrMetaCode()))}const h=new a.WatchedValue(c());s.keyboardPressedKeysState.subscribe((()=>h.setValue(c())));const d=h.readonly();function u(){return o.enabled("chart_crosshair_menu")}function _(){return n.getBool(l,u())}const p=(0,r.createPrimitiveProperty)(_());function m(){p.setValue(u()),n.remove(l)}n.onSync.subscribe(null,(()=>p.setValue(_()))),p.subscribe(null,(()=>{n.setValue(l,p.value()),o.setEnabled("chart_crosshair_menu",!o.enabled("chart_crosshair_menu"))}))},62301:(e,t,i)=>{"use strict";i.d(t,{alignToStep:()=>n});var s=i(60521),o=i.n(s);function n(e,t){return o()(e).div(t).round(0,o().roundHalfUp).mul(t).toNumber()}},25246:(e,t,i)=>{"use strict";i.d(t,{actualAutoLogButtonsVisibility:()=>l,autoLogButtonsVisibilityOptions:()=>r,autoLogButtonsVisibilityProperty:()=>n,restoreAutoLogButtonsVisibilitySettingsValue:()=>a});var s,o=i(64876);!function(e){e.SettingsKey="PriceAxisAutoLogButtons.visibility"}(s||(s={}));const{property:n,availableValues:r,restoreDefaultValue:a,actualBehavior:l}=(0,o.createVisibilityController)("PriceAxisAutoLogButtons.visibility")},72755:(e,t,i)=>{"use strict";i.d(t,{axisLabelBackgroundColor:()=>o});var s=i(58978);const o={common:s.colorsPalette["color-tv-blue-500"],active:s.colorsPalette["color-tv-blue-800"]};var n;!function(e){e.BorderColor="#2E84A6"}(n||(n={}))},32955:(e,t,i)=>{"use strict";i.d(t,{createDwmAligner:()=>h,createTimeToBarTimeAligner:()=>d,isAlignmentEnabled:()=>c});var s=i(37236),o=i(10892),n=i(47312),r=i(51101) +;return s.enabled("show_spread_operators")&&(e=!0),e}function n(e){if(e.ctrlKey)return!1;if(e.metaKey)return!1;if(!e.charCode)return!1;if(!e.which||e.which<=32)return!1;const t=e.target;return!t||!/^(input|textarea)$/i.test(t.tagName)&&"listbox"!==t.getAttribute("role")}},8686:(e,t,i)=>{"use strict";function s(){return Promise.all([i.e(8836),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(3672),i.e(3359),i.e(1697),i.e(4587),i.e(7833),i.e(8752),i.e(445),i.e(846),i.e(2227),i.e(4931),i.e(9418),i.e(3179),i.e(4426),i.e(9026),i.e(1754)]).then(i.bind(i,89324))}i.d(t,{loadNewSymbolSearch:()=>s})},49470:(e,t,i)=>{"use strict";i.d(t,{tradingService:()=>n});var s=i(16216);const o={id:"TradingService"};function n(){return(0,s.hasService)(o)?(0,s.service)(o):null}},28477:(e,t,i)=>{"use strict";i.d(t,{AbstractBarColorer:()=>s});class s{constructor(){this._backColorers=[]}barStyle(e,t,i){const s={};for(const o of this._backColorers)o.applyBarStyle(e,t,s,i);return this.applyBarStyle(e,t,s,i),s}pushBackBarColorer(e){this._backColorers.unshift(e)}firstColoredBar(e){return null}}},33718:(e,t,i)=>{"use strict";i.d(t,{addPlusButtonProperty:()=>p,restoreAddPlusButtonSettingsValue:()=>m,showPlusButtonOnCursor:()=>d});var s=i(26709),o=i(37103),n=i(1765),r=i(41072),a=i(22613);const l="add_plus_button";function c(){const e=s.keyboardPressedKeysState.value();return void 0!==e&&(Boolean(e.modifiers&s.Modifiers.Alt&&e.modifiers&s.Modifiers.Mod)&&(void 0===e.code||e.altOrOptionCode()||e.controlOrMetaCode()))}const h=new a.WatchedValue(c());s.keyboardPressedKeysState.subscribe((()=>h.setValue(c())));const d=h.readonly();function u(){return o.enabled("chart_crosshair_menu")}function _(){return n.getBool(l,u())}const p=(0,r.createPrimitiveProperty)(_());function m(){p.setValue(u()),n.remove(l)}n.onSync.subscribe(null,(()=>p.setValue(_()))),p.subscribe(null,(()=>{n.setValue(l,p.value()),o.setEnabled("chart_crosshair_menu",!o.enabled("chart_crosshair_menu"))}))},62301:(e,t,i)=>{"use strict";i.d(t,{alignToStep:()=>n});var s=i(60521),o=i.n(s);function n(e,t){return o()(e).div(t).round(0,o().roundHalfUp).mul(t).toNumber()}},25246:(e,t,i)=>{"use strict";i.d(t,{actualAutoLogButtonsVisibility:()=>l,autoLogButtonsVisibilityOptions:()=>r,autoLogButtonsVisibilityProperty:()=>n,restoreAutoLogButtonsVisibilitySettingsValue:()=>a});var s,o=i(64876);!function(e){e.SettingsKey="PriceAxisAutoLogButtons.visibility"}(s||(s={}));const{property:n,availableValues:r,restoreDefaultValue:a,actualBehavior:l}=(0,o.createVisibilityController)("PriceAxisAutoLogButtons.visibility")},72755:(e,t,i)=>{"use strict";i.d(t,{axisLabelBackgroundColor:()=>o});var s=i(58978);const o={common:s.colorsPalette["color-tv-blue-500"],active:s.colorsPalette["color-tv-blue-800"]};var n;!function(e){e.BorderColor="#2E84A6"}(n||(n={}))},32955:(e,t,i)=>{"use strict";i.d(t,{createDwmAligner:()=>h,createTimeToBarTimeAligner:()=>d,isAlignmentEnabled:()=>c});var s=i(37236),o=i(10892),n=i(47312),r=i(51101) ;const a=new n.SessionInfo("Etc/UTC","0000-0000:1234567");var l=i(37103);function c(){return!l.enabled("disable_resolution_rebuild")}const h=function(e,t,i){if(!e||!o.Interval.isDWM(t))return null;const l=new n.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=>{const t=(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)return e=>e;const s=new n.SessionInfo(i.timezone,i.session,i.session_holidays,i.corrections),o=(0,r.newBarBuilder)(t,s,s,!1);return e=>o.alignTimeIfPossible(e)}.bind(null,c())},17776:(e,t,i)=>{"use strict";i.d(t,{barFunctionByStyle:()=>o});var s=i(52746);function o(e,t){switch(e){case 12:return(0,s.barFunction)("low","low","close");case 2:case 18:case 20:case 14:case 15:case 3:case 10:case 13:return(0,s.barFunction)(t??"close");default:return(0,s.barFunction)("close","open")}}},28001:(e,t,i)=>{"use strict";i.d(t,{BarsRange:()=>o});var s=i(50151);class o{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(){return this._firstBar}lastBar(){return this._lastBar}count(){return this._lastBar-this._firstBar+1}contains(e){return this._firstBar<=e&&e<=this._lastBar}unite(e){return null===e?this:new o(Math.min(this._firstBar,e.firstBar()),Math.max(this._lastBar,e.lastBar()))}equals(e){return this._firstBar===e.firstBar()&&this._lastBar===e.lastBar()}static compare(e,t){return null===e||null===t?e===t:e.equals(t)}}},54370:(e,t,i)=>{"use strict";i.d(t,{allChartStyles:()=>o});var s=i(37103);function o(){return function(){const e=[0,1,9,13,2,14,15,3,16,10];return s.enabled("chart_style_hilo")&&e.push(12),e.push(21),e}().concat((s.enabled("japanese_chart_styles"),[8]))}},32853:(e,t,i)=>{"use strict";var s=i(49251).makeFont,o=i(49251).parseFont,n=i(9343).getLogger;const{drawPoly:r}=i(58221);var a=n("Model.ChartTradingUtils"),l={_fontHeightCache:{},_parsedColorCache:{},_parseColor:function(e){if(this._parsedColorCache[e])return this._parsedColorCache[e];var t=document.createElement("div");t.style.color=e;var i=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"};return this._parsedColorCache[e]=s,s},getColorFromProperties:function(e,t){var i=1-t.value()/100,s=this._parseColor(e.value());return"rgba("+s.r+","+s.g+","+s.b+","+i+")"},setColorToProperties:function(e,t,i){var s=this._parseColor(e);t.setValue("rgb("+s.r+","+s.g+","+s.b+")");var o=100*(1-s.a);i.setValue(Math.max(0,Math.min(o,100)))},getFontFromProperties:function(e,t,i,o){return s(t.value(),e.value(),o.value()?"italic":"",i.value()?"bold":"")},setFontToProperties:function(e,t,i,s,n){var r=o(e);null!==r?(r.family.length>0&&t.setValue(r.family), i.setValue(r.size),s.setValue(r.bold),n.setValue(r.italic)):a.logError("Invalid font: "+e)},fontHeight:function(e){if(!this._fontHeightCache[e]){var t=document.createElement("span");t.appendChild(document.createTextNode("height")),document.body.appendChild(t),t.style.cssText="font: "+e+"; white-space: nowrap; display: inline;";var i=t.offsetHeight;document.body.removeChild(t),this._fontHeightCache[e]=Math.ceil(i)}return this._fontHeightCache[e]},drawPolyHoverOrPress:function(e,t,i,s){s?(e.save(),e.fillStyle="rgba(0, 0, 0, 0.15)",r(e,t,!0),e.restore()):i&&(e.save(),e.fillStyle="rgba(0, 0, 0, 0.1)",r(e,t,!0),e.restore())},repaint:function(e){e.lightUpdate()},roundToMinTick:function(e,t){var i=1/e.mainSource().base();return i*Math.round(t/i)}};e.exports=l},93201:(e,t,i)=>{"use strict";var s;i.d(t,{ColorType:()=>s}),function(e){e.Solid="solid",e.Gradient="gradient"}(s||(s={}))},55803:(e,t,i)=>{"use strict";i.d(t,{ConflatedChunksBuilder:()=>r});var s=i(50151),o=i(12217);const n=[{barsToMerge:10,forBarspacingLargerThen:.03},{barsToMerge:30,forBarspacingLargerThen:.01},{barsToMerge:100,forBarspacingLargerThen:.003},{barsToMerge:500,forBarspacingLargerThen:0}];class r{constructor(e,t){this._plots=e,this._state={chunks:new Map,priceSource:null,priceSourcesProvider:t},this._setEmptyConflatedChunks()}conflatedChunks(e,t){if(t!==this._state.priceSource){this._state.priceSource=t;const e=this._plots.first();e&&(this._setEmptyConflatedChunks(),this._rebuildConflatedChunks(e))}const i=(0,s.ensureDefined)(n.find((t=>t.forBarspacingLargerThen<=e)));return(0,s.ensureDefined)(this._state.chunks.get(i.barsToMerge))}mergeData(e){const t=this._plots.size(),i=this._plots.merge(e);return i&&null!==this._state.priceSource&&(t===this._plots.size()&&i.index===this._plots.lastIndex()?this._updateLatestChunks():this._rebuildConflatedChunks(i)),i}moveData(e){this._plots.move(e),this._plots.size()>0&&this._clearState()}clearData(){this._plots.clear(),this._clearState()}_rebuildConflatedChunks(e){const t=this._state.priceSource;if(null===t)return;const i=e.index,r=this._state.priceSourcesProvider(t),a=(e,t,i)=>{let s=null;for(const o of e){const e=r(o.value);s&&o.index-s.startTime>=i.barsToMerge&&(t.push(s),s=null),s?(s.endTime=o.index,s.high=Math.max(s.high,e),s.low=Math.min(s.low,e),s.close=e):s={startTime:o.index,endTime:o.index,open:e,high:e,low:e,close:e}}s&&t.push(s)};n.forEach((e=>{const t=(0,s.ensureDefined)(this._state.chunks.get(e.barsToMerge)),n=(0,o.lowerbound)(t,i,((e,t)=>e.endTime0){const i=t[0].startTime-1,o=(0,s.ensureNotNull)(this._plots.firstIndex()),n=this._plots.rangeIterator(o,i),r=[];a(n,r,e);const l=r.concat(t);this._state.chunks.set(e.barsToMerge,l)}else{const i=(0,s.ensureNotNull)(this._plots.lastIndex());t.splice(n);let o=(0,s.ensureNotNull)(this._plots.firstIndex());t.length&&(o=t[t.length-1].endTime+1);const r=this._plots.rangeIterator(o,i);a(r,t,e)}}))}_updateLatestChunks(){const e=(0,s.ensureNotNull)(this._plots.last()),t=this._state.priceSourcesProvider("close");n.forEach((i=>{const o=(0, s.ensureDefined)(this._state.chunks.get(i.barsToMerge)),n=t(e.value),r=o[o.length-1];r.high=Math.max(r.high,n),r.low=Math.min(r.low,n),r.close=n,r.endTime=e.index}))}_setEmptyConflatedChunks(){n.forEach((e=>this._state.chunks.set(e.barsToMerge,[])))}_clearState(){this._state.chunks.clear(),this._state.priceSource=null}}},91106:(e,t,i)=>{"use strict";i.d(t,{actualCurrencyUnitVisibility:()=>c,currencyUnitVisibilityOptions:()=>a,currencyUnitVisibilityProperty:()=>r,migrateShowCurrencyAndShowUnitProperties:()=>d,restoreCurrencyUnitVisibilitySettingsValue:()=>l});var s,o=i(64876),n=i(1765);!function(e){e.SettingsKey="PriceAxisCurrencyAndUnit.visibility"}(s||(s={}));const{property:r,availableValues:a,restoreDefaultValue:l,actualBehavior:c}=(0,o.createVisibilityController)("PriceAxisCurrencyAndUnit.visibility");let h=!1;function d(e,t){h||(h=!0,void 0===n.default.getValue("PriceAxisCurrencyAndUnit.visibility")&&r().setValue(e||t?"alwaysOn":"alwaysOff"))}},66786:(e,t,i)=>{"use strict";i.d(t,{CustomSourceBase:()=>s});class s{constructor(e,t){this._id=e,this._model=t}id(){return this._id}isHoveredEnabled(){return!0}isSelectionEnabled(){return!1}priceScale(){return null}paneViews(e){return[]}labelPaneViews(e){return[]}priceAxisViews(e,t){return[]}updateViewsForPane(e,t){e.containsMainSeries()&&this.updateAllViews(t)}}},29447:(e,t,i)=>{"use strict";i.d(t,{isLineToolState:()=>r,isMainSeriesState:()=>o,isStudyLineToolState:()=>a,isStudyState:()=>n});var s=i(11946);function o(e){return"MainSeries"===e.type}function n(e){return Boolean(e.type)&&e.type.toLowerCase().startsWith("study")}function r(e){return Boolean(e.type)&&(0,s.isLineToolName)(e.type)}function a(e){return Boolean(e.type)&&(0,s.isStudyLineToolName)(e.type)}},72207:(e,t,i)=>{"use strict";i.d(t,{DataSource:()=>d,getTranslatedStringForSource:()=>c,toInputDisplayFlags:()=>h});var s=i(95804),o=i(36313),n=i(4226),r=i(48096),a=i(22613),l=i(69422);function c(e,t){return new s.TranslatedString(t.name(),t.title(e))}function h(e){switch(e){case o.TitleDisplayTarget.DataWindow:return l.InputDisplayFlags.DataWindow;case o.TitleDisplayTarget.StatusLine:case o.TitleDisplayTarget.Alerts:return l.InputDisplayFlags.StatusLine}}class d{constructor(e){this.isSeries=!1,this._isDestroyed=!1,this._hasAlert=new a.WatchedValue(!1),this._alertStatus=new a.WatchedValue(0),this._alertCreationAvailable=new a.WatchedValue(!1),this._zorder=0,this._priceScale=null,this._ownerSource=null,this._userEditEnabled=!0,this._priceScaleChanged=new r.Delegate,this._isSelectionEnabled=!0,this._instanceId=(0,n.randomHashN)(6),this._ownerSourceChanged=new r.Delegate,this._zOrderChanged=new r.Delegate,this._id=new a.WatchedValue(e??(0,n.randomHashN)(6))}destroy(){this._isDestroyed=!0}id(){return this._id.value()}idWV(){return this._id.readonly()}instanceId(){return this._instanceId}preferNoScale(){return!1}setId(e){this._id.setValue(e)}zorder(){return this._zorder}setZorder(e){"number"==typeof e&&this._zorder!==e&&(this._zorder=e,this._zOrderChanged.fire(e))}preferredZOrder(){return null} @@ -430,8 +430,8 @@ const e=this._promise=Promise.all([i.e(5121),i.e(8185),i.e(1681),i.e(5371),i.e(2 (0,j.showConfirm)({text:ce.format({name:e.name}),onConfirm:({dialogClose:t})=>new Promise((s=>{z.backend.invalidateStudyTemplatesList(),z.backend.removeStudyTemplate(e.id).then((()=>{this.refreshStudyTemplateList((()=>{const o=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"})}}var de=i(29803),ue=i(26010),_e=i(35727);class pe{constructor(e,t){this._visibility=new O.WatchedValue(!1),this._dialogPromise=null,this._dialog=null,this._chartWidgetCollection=e,this._options=t}visible(){return this._visibility.readonly()}show(e,t,i){const s=Array.isArray(e)?e:[],o=Array.isArray(e)?void 0: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(){return this._dialog}resetAllPages(){this._dialog?.resetAllStudies()}_requestDialog(e,t,s,o){if(null===this._dialogPromise){let n;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=>new e.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)}))}return this._dialogPromise}}var me=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);const xe=/^Etc\/GMT([+-])(\d{1,2}):?(\d\d)?$/,Me=new Map;function Ie(e){if(Me.has(e))return Me.get(e);const t=xe.test(e);return Me.set(e,t),t}const Ae=new Map;function Le(e){if(Ae.has(e))return Ae.get(e);const t=function(e){const t=e.match(xe);if(!t)return 0;const i="+"===t[1]?-1:1;return 60*(60*parseInt(t[2],10)+parseInt(t[3]||"0",10))*i}(e),i={time:[1924992e3+t],offset:[t]};return Ae.set(e,i),i}let ke=null;const Ee=new Map;class De{constructor(){this._customTimezones=new Map}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))throw new Error("Provided timezone alias is not within the list of supported timezones.");return(0,n.ensure)(this._customTimezones.get(e))}getAllTimezoneInfo(){return this.listTimezones()}getAliasTimezone(e){return this.getTimezoneInfo(e).alias}timezoneIsAvailable(e){return this._customTimezones.has(e)}updateChartTimezones(){(0,Pe.updateAvailableTimezones)(this.getAllTimezoneInfo())}getTimezoneData(e){if(Ee.has(e))return Ee.get(e);let t=null;if(Ie(e))t=Le(e);else if(this.timezoneIsAvailable(e)){const i=this.getAliasTimezone(e);Te.tzData[i]&&(t=Te.tzData[i]), !t&&Ie(i)&&(t=Le(i))}return t&&Ee.set(e,t),t}static instance(){return null===ke&&(ke=new De),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))throw new Error("Custom timezone id already exists.");if(!(0,Pe.timezoneIsSupported)(t.alias)&&!Ie(t.alias))throw new Error("Custom timezone alias is not a supported timezone.");if(e.length<1)throw new Error("Custom timezone id is empty");if(t.title.length<1)throw new Error("Custom timezone title is empty");this._customTimezones.set(e,t)}catch(e){console.warn(`Unable to add custom timezone. ${e}`)}}}(0,Ce.setCustomTimezones)(De);var Be=i(91106);let Ve=null;var Re=i(46082);class Ne{constructor(e){this._alive=new O.WatchedValue,this._container=new O.WatchedValue,this._width=new O.WatchedValue,this._height=new O.WatchedValue,this._fullscreen=new O.WatchedValue,this._detachable=new O.WatchedValue,this._fullscreenable=new O.WatchedValue,this._visible=new O.WatchedValue,this._availWidth=new O.WatchedValue,this._availHeight=new O.WatchedValue,this._owner=new O.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:()=>{const e=this._owner.value();e&&e.remove&&e.remove()},negotiateWidth:e=>{const t=this._owner.value();t&&t.negotiateWidth&&t.negotiateWidth(e)},negotiateHeight:e=>{const t=this._owner.value();t&&t.negotiateHeight&&t.negotiateHeight(e)},requestFullscreen:()=>{const e=this._owner.value();e&&e.requestFullscreen&&e.requestFullscreen()},exitFullscreen:()=>{const e=this._owner.value();e&&e.exitFullscreen&&e.exitFullscreen()},detach:e=>{const t=this._owner.value();t&&t.detach&&t.detach(e)},attach:()=>{const e=this._owner.value();e&&e.attach&&e.attach()}},e&&this.pushOwner(e)}destroy(){for(const e of this._ownersStack)this._unsubscribeOwner(e)}bridge(){return this._bridge}pushOwner(e){if(!e.alive.value())return;for(const e of this._ownersStack)this._unsubscribeOwner(e);const t={owner:e};this._ownersStack.push(t),this._subscribeOwner(t)}_subscribeOwner(e){const t=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){const i=e.subscriptions=[];this._visible.setValue(!1);const s=(e,t)=>{if(e){const s=e.spawn();i.push(s),s.subscribe((e=>{t.setValue(e)}),{callWithLast:!0})}else t.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(const t of e.subscriptions)t.unsubscribe();e.subscriptions=null}t&&e.deathWatcher&&(e.deathWatcher.unsubscribe(),e.deathWatcher=null)}_deadHandler(e){const t=this._ownersStack.indexOf(e);(0,n.assert)(-1!==t,"sanitized owner should be in stack");for(let e=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())}}class Oe{constructor(e){this._document=e,this.isFullscreen=new O.WatchedValue;const t=()=>{const e=["fullscreenElement","webkitFullscreenElement","mozFullscreenElement","mozFullScreenElement","msFullscreenElement"];for(let t=0;t{this.isVisible.setValue(!e[o])},i(),e.addEventListener(t,i,!1);break}}this.destroy=()=>{i&&(e.removeEventListener(t,i,!1),i=null)}}}var We,He=i(84015),ze=i(49483);!function(e){e.Quirks="quirks",e.Visual="visual"}(We||(We={}));function Ue(e,t){let i=0;for(const{min:s,max:o}of t){if(e0&&t.push({min:e,max:s})}return t.sort(((e,t)=>e.min-t.min||e.max-t.max)),t}function Ge(e,t){if(e.length!==t.length)return!1;for(let i=e.length;i--;){if(e[i].min!==t[i].min)return!1;if(e[i].max!==t[i].max)return!1}return!0}const qe=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={}));const Ke=l.enabled("bypass_chart_height_check");function Ye(e){const t=l.enabled("side_toolbar_in_fullscreen_mode"),i=l.enabled("header_in_fullscreen_mode");return"center"===e||"left"===e&&t||"top"===e&&i}var Ze=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);const ot=(0,ne.getLogger)("Common.UndoStack");class nt{constructor(){this._commands=[],this._onChange=new ae.Delegate}onChange(){return this._onChange}isEmpty(){return 0===this._commands.length}size(){return this._commands.length}clear(){this.isEmpty()||(this._commands.length=0,this._onChange.fire())}push(e){if(!(e instanceof st.UndoCommand))throw new TypeError("argument must be an instance of UndoCommand");this._commands.push(e),this._onChange.fire(e)}pop(){if(this.isEmpty())return void ot.logDebug("pop: undo stack is empty");const e=this._commands.pop();return this._onChange.fire(e),e}head(){if(!this.isEmpty())return this._commands[this._commands.length-1]}}class rt extends st.UndoCommand{constructor(e){super(e,!1),this._subcommands=[]}addCommand(e){this._subcommands.push(e)}isEmpty(){return 0===this._subcommands.length}redo(e){for(let t=0;t=0;t--)this._subcommands[t].undo(e)}commands(){return this._subcommands}affectsState(){return this._subcommands.some((e=>e.affectsState()))}}class at extends st.UndoCommand{constructor(e,t,i,s,o=!0){super(s,void 0,o),this._setter=e,this._oldValue=t,this._newValue=i}redo(){this._setter(this._newValue)}undo(){this._setter(this._oldValue)}}class lt extends at{constructor(e,t,i,s,o=!0){super((e=>this._vwState.setValue(e)),t,i,s,o),this._vwState=e}}const ct=(0,ne.getLogger)("Common.UndoHistory");var ht=i(87296),dt=i(95804),ut=i(3354);const _t=new dt.TranslatedString("change chart layout to {title}",a.t(null,void 0,i(68846)));class pt extends st.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)}}var mt=i(78861),gt=i(68335),ft=i(48943),yt=i(62773);function vt(e){const t={};return{promise:new Promise(((i,s)=>{e.subscribe(t,i,!0)})),destroy:()=>{e.unsubscribeAll(t)}}}var St=i(26867),bt=i(82095),wt=i(29447);class Ct extends X.DialogRenderer{constructor(e){super(),this._dialog=null,this._subscribe=e=>{this._setVisibility(e)},this._chartWidgetCollection=e}show(e){const t=this._chartWidgetCollection,s=t.activeChartWidget.value();return s.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=>{ -const n=new i.GeneralChartPropertiesDialogRenderer({chartWidgetCollection:t,propertyPages:o,activePageId:this._activePageId,model:s.model()});return this._dialog?.hide(),this._dialog?.visible().unsubscribe(this._subscribe),this._dialog=n,n.visible().subscribe(this._subscribe),n.show(e),this._activePageId=void 0,n}))))}hide(){this._dialog?.hide()}isVisible(){return this.visible().value()}focusOnText(){}setActivePage(e){this._activePageId=e}}class Tt extends X.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(){return Promise.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])=>{const i=new e.CompareModel(this._chartWidgetCollection);return t.getCompareDialogRenderer(i)}))}}var Pt=i(12217),xt=i(95059);const Mt=()=>i.e(4389).then(i.bind(i,67090));function It(e,t={}){return Mt().then((i=>i.copyToClipboardImageOfChart(e,t)))}function At(e,t={}){return Mt().then((i=>i.getImageOfChartSilently(e,t)))}var Lt=i(11946);function kt(e){const t=e.querySelector("#chart-aria-description");if(null!==t)return t;const i=e.createElement("div");return i.id="chart-aria-description",i.tabIndex=-1,i.role="alert",i.ariaLive="assertive",e.body.appendChild(i),i}function Et(e,t){const i={weekday:"long",year:"numeric",month:"long",day:"numeric",hour:t?"2-digit":void 0,minute:t?"2-digit":void 0,hour12:!0};return new Date(1e3*e).toLocaleString(void 0,i)}class Dt{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}async updateChartDescription(e,t,i){const s=function(e){const t=ut.layouts[e];return t?.count??1}(i),o=await this._buildChartContext(e,t,s);if(null===o)return;if(this._customProvider){const e=await this._customProvider(o);if(null!==e)return void this._setChartDescription(e)}if("en"!==this._locale)return;const n=function(e){const t=function(e){if(!l.enabled("aria_detailed_chart_descriptions")||!e.visibleData)return"";let t;try{t=function(e){let t=e.schema.findIndex((e=>"userTime"===e.type));t<0&&(t=e.schema.findIndex((e=>"time"===e.type)));if(t<0)throw new Error("Exported Data should contain `time`.");const i=Bt(e,(e=>"value"===e.type&&"series"===e.sourceType&&"close"===e.plotTitle),-1);if(i<0)throw new Error("Exported Data should contain `close`.") +i(16738)),et=i(83873),tt=i(87465),it=i(69109),st=i(72270);const ot=(0,ne.getLogger)("Common.UndoStack");class nt{constructor(){this._commands=[],this._onChange=new ae.Delegate}onChange(){return this._onChange}isEmpty(){return 0===this._commands.length}size(){return this._commands.length}clear(){this.isEmpty()||(this._commands.length=0,this._onChange.fire())}push(e){if(!(e instanceof st.UndoCommand))throw new TypeError("argument must be an instance of UndoCommand");this._commands.push(e),this._onChange.fire(e)}pop(){if(this.isEmpty())return void ot.logDebug("pop: undo stack is empty");const e=this._commands.pop();return this._onChange.fire(e),e}head(){if(!this.isEmpty())return this._commands[this._commands.length-1]}}class rt extends st.UndoCommand{constructor(e){super(e,!1),this._subcommands=[]}addCommand(e){this._subcommands.push(e)}isEmpty(){return 0===this._subcommands.length}redo(e){for(let t=0;t=0;t--)this._subcommands[t].undo(e)}commands(){return this._subcommands}affectsState(){return this._subcommands.some((e=>e.affectsState()))}}class at extends st.UndoCommand{constructor(e,t,i,s,o=!0){super(s,void 0,o),this._setter=e,this._oldValue=t,this._newValue=i}redo(){this._setter(this._newValue)}undo(){this._setter(this._oldValue)}}class lt extends at{constructor(e,t,i,s,o=!0){super((e=>this._vwState.setValue(e)),t,i,s,o),this._vwState=e}}const ct=(0,ne.getLogger)("Common.UndoHistory");var ht=i(87296),dt=i(95804),ut=i(3354);const _t=new dt.TranslatedString("change chart layout to {title}",a.t(null,void 0,i(68846)));class pt extends st.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)}}var mt=i(78861),gt=i(68335),ft=i(48943),yt=i(62773);function vt(e){const t={};return{promise:new Promise(((i,s)=>{e.subscribe(t,i,!0)})),destroy:()=>{e.unsubscribeAll(t)}}}var St=i(26867),bt=i(82095),wt=i(29447);class Ct extends X.DialogRenderer{constructor(e){super(),this._dialog=null,this._subscribe=e=>{this._setVisibility(e)},this._chartWidgetCollection=e}show(e){const t=this._chartWidgetCollection,s=t.activeChartWidget.value();return s.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=>{ +const n=new i.GeneralChartPropertiesDialogRenderer({chartWidgetCollection:t,propertyPages:o,activePageId:this._activePageId,model:s.model()});return this._dialog?.hide(),this._dialog?.visible().unsubscribe(this._subscribe),this._dialog=n,n.visible().subscribe(this._subscribe),n.show(e),this._activePageId=void 0,n}))))}hide(){this._dialog?.hide()}isVisible(){return this.visible().value()}focusOnText(){}setActivePage(e){this._activePageId=e}}class Tt extends X.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(){return Promise.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])=>{const i=new e.CompareModel(this._chartWidgetCollection);return t.getCompareDialogRenderer(i)}))}}var Pt=i(12217),xt=i(95059);const Mt=()=>i.e(4389).then(i.bind(i,67090));function It(e,t={}){return Mt().then((i=>i.copyToClipboardImageOfChart(e,t)))}function At(e,t={}){return Mt().then((i=>i.getImageOfChartSilently(e,t)))}var Lt=i(11946);function kt(e){const t=e.querySelector("#chart-aria-description");if(null!==t)return t;const i=e.createElement("div");return i.id="chart-aria-description",i.tabIndex=-1,i.role="alert",i.ariaLive="assertive",e.body.appendChild(i),i}function Et(e,t){const i={weekday:"long",year:"numeric",month:"long",day:"numeric",hour:t?"2-digit":void 0,minute:t?"2-digit":void 0,hour12:!0};return new Date(1e3*e).toLocaleString(void 0,i)}class Dt{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}async updateChartDescription(e,t,i){const s=function(e){const t=ut.layouts[e];return t?.count??1}(i),o=await this._buildChartContext(e,t,s);if(null===o)return;if(this._customProvider){const e=await this._customProvider(o);if(null!==e)return void this._setChartDescription(e)}if("en"!==this._locale)return;const n=function(e){const t=function(e){if(!l.enabled("aria_detailed_chart_descriptions")||!e.visibleData)return"";let t;try{t=function(e){let t=e.schema.findIndex((e=>"userTime"===e.type));t<0&&(t=e.schema.findIndex((e=>"time"===e.type)));if(t<0)throw new Error("Exported Data should contain `time`.");const i=Bt(e,(e=>"value"===e.type&&"series"===e.sourceType&&"close"===e.plotTitle),-1);if(i<0)throw new Error("Exported Data should contain `close`.") ;const s=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(const e of r)e.high>a.high.high&&(a.high=e),e.low=0?s:i}Dt._instance=null;var Vt=i(10555),Rt=i(58978),Nt=i(24377),Ot=i(50279),Ft=i(27714),Wt=i(62153);class Ht{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(void 0!==i){const s=t(e,i);if(null!==s&&(0,Ot.default)(s,this._activeLollipop.value()))return}this._activeLollipop.setValue(null)}}async showTooltip(e,t,s,o,r){const a=s();if(null===a||0===a.length)return;const{showLollipopTooltip:l}=await Promise.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=await o();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){return null!==this._lollipopTooltipRenderer&&void 0!==e&&this._lollipopTooltipRenderer.isClickInside(e)}_destroyTooltip(){this._lollipopTooltipRenderer?.hide(),this._lollipopTooltipRenderer=null}}var zt,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={}));class Zt{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=new Vt.Point(n+a,r-l);this._drawLollipop(e,c,t),this._drawLabel(e,c,t)}hitTest(e){const t=(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)(new Vt.Point(s,i),new Vt.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){const s=this._data.style,{horizontalPixelRatio:o}=i,n=this._fillRadius(o);s.lollipop.fillCircle&&s.lollipop.backgroundColor&&this._drawFilledCircle(e,t,n,s.lollipop.backgroundColor);const r=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){const s=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;const a=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){const t=this._data.style,i=Math.max(1,Math.floor(e));let s=Math.round(t.lollipop.width*e);return s%2!=i%2&&(s+=1),s/2}_drawBorderLine(e,t,i,s){const o=this._data.style ;e.strokeStyle=o.lollipop.strokeStyle,e.lineWidth=i,(0,$t.setLineStyle)(e,qt.LINESTYLE_SOLID),(0,$t.createCircle)(e,t.x,t.y,s),e.stroke()}_drawFilledCircle(e,t,i,s){e.fillStyle=s,(0,$t.createCircle)(e,t.x,t.y,i),e.fill()}}var Xt,Jt=i(64960),Qt=i(57658),ei=i(43838);!function(e){e[e.SpaceBetweenRows=25]="SpaceBetweenRows",e[e.TooltipTopMargin=15]="TooltipTopMargin",e[e.SpaceBetweenCardAndLollipop=8]="SpaceBetweenCardAndLollipop"}(Xt||(Xt={}));class ti{constructor(e,t){this._invalidated=!1,this._renderer=new jt.CompositeRenderer,this._textWidthCache=new Qt.TextWidthCache,this._stylesCache=null,this._lollipops={},this._lollipopsCounter=0,this._activeLollipopInfo=new yt.WatchedObject(null),this.onPaneBgChange=()=>{this._recreateStyles(this._model)},this._model=e,this._source=t,this._recreateStyles(e),e.backgroundColor().subscribe(this.onPaneBgChange),e.mainSeries().onSymbolIntervalChanged().subscribe(this,this._onSymbolOrIntervalChanged),this._lollipopTooltip=new Ht(this._activeLollipopInfo.spawnOwnership()),this._activeLollipopInfo.subscribe((()=>{this._source.updateAllViewsAndRepaint()}))}destroy(){this._model.backgroundColor().unsubscribe(this.onPaneBgChange),this._model.mainSeries().onSymbolIntervalChanged().unsubscribeAll(this),this._lollipopTooltip.destroy()}processClickInside(e,t,i){const s=this._lollipops[i];return!(!s||!s.visible)&&(this._lollipopMouseClickHandler(e,this._getLollipopRendererData(s),(0,Ft.size)({width:t.clientWidth,height:t.clientHeight}),{preventDefault:()=>{},target:t}),!0)}processClickOutside(e,t){this._lollipopTooltip.tryToHideTooltipByClickOutside(e,this._getActiveLollipopTooltipInfo.bind(this),t)}update(e){this._invalidated=!0}afterUpdate(e,t,i,s){}getStyle(e,t){let i=t;if(e.stack&&(i+="_stack:"+e.stack),"active"===i)return this._activeStyle;if("hovered"===i)return this._hoveredStyle;if("default"===i)return this._defaultStyle;if(this._stylesCache||(this._stylesCache={}),!this._stylesCache[i]){const s=(0,tt.clone)("active"===t?this._activeStyle:"hovered"===t?this._hoveredStyle:this._defaultStyle);e.stack&&(s.lollipop.incHeight=25*e.stack),this._stylesCache[i]=s}return this._stylesCache[i]}hasTooltip(e){return!0}clearActiveLollipop(){this._activeLollipopInfo.setValue(null)}async _specialTooltipStyles(e){}_getY(){let e=0;const t=this._model.panes();for(let i=t.length;i--;){const s=t[i];s.containsMainSeries()&&(e+=s.height())}return e}_showBarLine(e){return this.hasTooltip(e)&&(e.hovered||this._isLollipopActive(e))}_getLollipopRendererData(e){const t=this._getLollipopStatus(e),i=this.getStyle(e,t);return{id:e.id,itemIndex:e.itemIndex,centerPoint:new Vt.Point(e.basePoint.x,e.basePoint.y-i.lollipop.bottom-i.lollipop.height/2-(i.lollipop.incHeight||0)),style:i,status:t}}_createRenderers(e){const{mediaSize:t}=e;for(const i of Object.values(this._lollipops))if(void 0!==i&&i.visible){const s=this._getLollipopStatus(i),o=this.getStyle(i,s),n={id:i.id,itemIndex:i.itemIndex,centerPoint:new Vt.Point(i.basePoint.x,i.basePoint.y-o.lollipop.bottom-o.lollipop.height/2-(o.lollipop.incHeight||0)),style:o, @@ -447,9 +447,9 @@ function Vi(e,t,i,s){if(e.save(),i&&!s.highlightByAuthor&&(e.globalAlpha=.4),s.m _extractBarMarksRendererItemData(e,t){return{...super._extractBarMarksRendererItemData(e,t),showLabelWhenImageLoaded:t.showLabelWhenImageLoaded,image:t.image}}}class Hi extends Ii{constructor(e){super(e,new yi.DefaultProperty({defaultName:"UserDefinedBarsMarks",state:{visible:!0}})),this._paneView=new Wi(this,e),this._paneViews=[this._paneView],(0,mt.hideMarksOnBars)().subscribe(this,(()=>{this.properties().childs().visible.setValue(!(0,mt.hideMarksOnBars)().value())}))}destroy(){(0,mt.hideMarksOnBars)().unsubscribeAll(this),this._paneView.destroy(),super.destroy()}zorder(){return vi.sortSourcesPreOrdered.BarMarks}name(){return"UserDefinedBarsMarks"}userEditEnabled(){return!1}clearMarks(e=0){2!==e&&(super.clearMarks(),this.updateAllViewsAndRepaint())}hasContextMenu(){return!1}paneViews(){return this._properties.childs().visible.value()?this._paneViews:[]}isVisible(){return this.properties().childs().visible.value()}onClickOutside(e,t){this._paneView.onClickOutside(e,t)}contextMenuStatName(){return"UserDefinedBarsMarksContextMenu"}_initialize(){this.properties().childs().visible.setValue(!(0,mt.hideMarksOnBars)().value())}_plateViewData(e){const t={text:e.text,onClicked:e.onClicked};"object"==typeof e.color&&(t.theme="user_defined_theme",t.overridedTheme={},t.overridedTheme.border=e.color.border,t.overridedTheme.background=e.color.background);const i=(0,tt.isNumber)(e.borderWidth)?e.borderWidth:void 0,s=(0,tt.isNumber)(e.hoveredBorderWidth)?e.hoveredBorderWidth:void 0;if(void 0===i&&void 0===s||(t.overrideBorderWidth={width:i,hoveredWidth:s}),e.showLabelWhenImageLoaded&&(t.showLabelWhenImageLoaded=!0),e.imageUrl){const i=this.getImageElement(e.imageUrl);t.image=i}return t}_getData(e){const t=this._model.mainSeries().symbolInfo();if(!t)return;const i=this.roundRange(this._rangeDifference(e)),s=(0,Ai.getServerInterval)(this._model.mainSeries().properties().childs().interval.value());window.ChartApiInstance.getMarks(t,i.start,i.end,(t=>{for(const e of t)this._marks[e.id]=e,e.imageUrl&&this.addImageToStore(e.imageUrl);this._loadedRange=this._rangeUnion(e,this._loadedRange),this.updateAllViewsAndRepaint()}),s)}}var zi=i(55396);class Ui extends st.UndoCommand{constructor(e,t){super(null),this._chartModel=e,this._targetIndex=t}redo(){const e=this._chartModel.createPane(this._targetIndex,void 0,this._paneId);this._paneId=e.id()}undo(){const e=(0,n.ensureDefined)(this._paneId),t=this._chartModel.panes().find((t=>t.id()===e));void 0!==t&&this._chartModel.removePane(t)}createdPaneId(){return this._paneId}}var ji=i(91682),Gi=i(56616);const qi=(0,ne.getLogger)("Clipboard");var $i;!function(e){e.MagicAttrName="data-tradingview-clip"}($i||($i={}));class Ki{constructor(e){this._e=e}write(e){return(0,Gi.writeImpl)(this._toRaw(e),this._e)}_toRaw(e){const t={files:[]};t.text=e.text,void 0!==e.app?t.html=this._serializeAppData(e.app,e.text):e.html&&(t.html=e.html);for(const i of e.files||[])t.files.push(i);return t}_serializeAppData(e,t){return`${t?(0, ji.htmlEscape)(t.slice(0,256)):"📈"}`}}class Yi{constructor(e){this._e=e}async read(){this._e&&0===this._e.eventPhase&&(qi.logWarn("Cannot use an already dispatched ClipboardEvent for reading"),this._e=null);const e=this._e?this._readUsingEvent(this._e):await this._readUsingApi();return this._fromRaw(e)}_readUsingEvent(e){const t=(0,n.ensure)(e.clipboardData);e.preventDefault();const i={files:[]};for(let e=0;e0&&(t.files=e.files),t}_parseAppData(e){if(-1===e.slice(0,1024).indexOf("data-tradingview-clip"))return;const t=(new DOMParser).parseFromString(e,"text/html").querySelector("[data-tradingview-clip]");return t?t.getAttribute("data-tradingview-clip")||"":void 0}_readBlobAsText(e){return new Promise(((t,i)=>{const s=new FileReader;s.onloadend=()=>{t(s.result)},s.onerror=()=>{i(s.error)},s.readAsText(e)}))}}class Zi{constructor(e){this._callbacks=Object.assign({},e),this._boundOnCopy=this._onCopyEv.bind(this),this._boundOnCut=this._onCutEv.bind(this),this._boundOnPaste=this._onPasteEv.bind(this)}listen(){document.addEventListener("copy",this._boundOnCopy),document.addEventListener("cut",this._boundOnCut),document.addEventListener("paste",this._boundOnPaste)}async peek(){if("granted"!==(await navigator.permissions.query({name:"clipboard-read"})).state)throw new Error("clipboard-read is not granted");return new Yi(null).read()}uiRequestCopy(e){this._callbacks.copyRequested&&this._callbacks.copyRequested(new Ki(null),e)}uiRequestCut(e){this._callbacks.cutRequested&&this._callbacks.cutRequested(new Ki(null),e)}uiRequestPaste(e){this._callbacks.pasteRequested&&this._callbacks.pasteRequested(new Yi(null),e)}destroy(){document.removeEventListener("copy",this._boundOnCopy),document.removeEventListener("cut",this._boundOnCut),document.removeEventListener("paste",this._boundOnPaste)}_onCopyEv(e){e.defaultPrevented||this._callbacks.copyRequested&&this._callbacks.copyRequested(new Ki(e))}_onCutEv(e){e.defaultPrevented||this._callbacks.cutRequested&&this._callbacks.cutRequested(new Ki(e))}_onPasteEv(e){e.defaultPrevented||this._callbacks.pasteRequested&&this._callbacks.pasteRequested(new Yi(e))}}var Xi=i(35749);function Ji(e){const t=e.target ;return null!==t&&1===t.nodeType&&(0,Xi.isTextEditingField)(t)}function Qi(e){const t=e.target;if(null===t)return!1;const i=(t.ownerDocument||t).getSelection();return null!==i&&!i.isCollapsed}class es extends Zi{_onCopyEv(e){if(!Ji(e)&&!Qi(e))return super._onCopyEv(e)}_onCutEv(e){if(!Ji(e)&&!Qi(e))return super._onCutEv(e)}_onPasteEv(e){if(!Ji(e))return super._onPasteEv(e)}}const ts=new dt.TranslatedString("apply toolbars theme",a.t(null,void 0,i(86708)));class is extends st.UndoCommand{constructor(e,t,i=!0){super(ts),this._prevThemeName=e,this._themeName=t,this._syncState=i}undo(){(0,L.isStdThemeName)(this._prevThemeName)&&((0,k.setTheme)(this._prevThemeName),this._syncState&&(0,L.syncTheme)())}redo(){(0,L.isStdThemeName)(this._themeName.toLowerCase())&&((0,k.setTheme)(this._themeName.toLowerCase()),this._syncState&&(0,L.syncTheme)())}}var ss=i(11751),os=i(72972),ns=i(19844);i(26352);const rs=new dt.TranslatedString("apply indicators to entire layout",a.t(null,void 0,i(70507))),as=new dt.TranslatedString("apply chart theme",a.t(null,void 0,i(68231)));a.t(null,void 0,i(28298)),a.t(null,void 0,i(78972)),a.t(null,void 0,i(10615)),a.t(null,void 0,i(81518)),a.t(null,void 0,i(92101)),a.t(null,void 0,i(94656));function ls(e,t){for(const i of e.sources){if("study"!==i.type)return!0;if(t.checkIfFeatureAvailable(new ns.StudyMetaInfo(i.source.metaInfo),[]))return!0}return!1}function cs(e){return function(e){return Mt().then((t=>t.downloadClientScreenshot(e)))}(e)}function hs(e){return function(e){return Mt().then((t=>t.copyToClipboardClientScreenshot(e)))}(e).then((()=>{(0,ee.emit)("onClientScreenshotCopiedToClipboard")}))}const ds={s:0,"2h":0,"2v":1,"3h":0,"3v":2,"3s":0,"3r":1,"2-1":1,"1-2":1,4:1,"4v":3,"4h":0,"4s":0,"4s-l":0,"1-3":1,"3-1":3,"2-2-l":0,"2-2-r":1,"2-2":3,"1-4":1,"5h":0,"5v":0,"5s":0,"5s-l":0,"2-3":2,"3-2":3,"4-1":4,"2-3-l":0,"2-3-r":2,6:1,"6h":0,"6v":0,"6c":4,"2-4":2,"4-2":4,"4-3":4,"7h":0,"7s":0,8:1,"8c":6,"8h":0,"8v":0,"9s":6,"5-4":5,"9h":0,"9v":0,"10c5":1,"10h":0,"10v":0,"12c6":1,"12c4":3,"12h":0,"14c7":1,"16c8":1,"16c4":3};async function us(e,t=this.activeChartWidget.value()){return!!t&&(this.setChartStyle(t,e),!0)}var _s=i(62548),ps=i(15943),ms=i(24317),gs=i(29970),fs=i(31237);function ys(e,t){const i=Object.create(Object.getPrototypeOf(e));for(const s of t)Object.prototype.hasOwnProperty.call(e,s)&&(i[s]=e[s]);return i}var vs=i(96937),Ss=i(90995);let bs;class ws extends X.DialogRenderer{constructor(){super(),this._dialog=null,this._subscribe=e=>{this._setVisibility(e)}}show(){this._load().then((e=>e.show()))}hide(){this._dialog?.hide()}static getInstance(){return bs||(bs=new ws),bs}_load(){return Promise.all([i.e(4856),i.e(8185),i.e(1681),i.e(5371),i.e(2202),i.e(5563),i.e(2647),i.e(3439),i.e(8933),i.e(6032),i.e(3672),i.e(3359),i.e(8894),i.e(5743),i.e(7827),i.e(9836),i.e(1450),i.e(4719),i.e(2227),i.e(4931),i.e(7437),i.e(9418),i.e(3179),i.e(6193),i.e(5386),i.e(4862)]).then(i.bind(i,73536)).then((e=>(this._dialog?.hide(),this._dialog?.visible().unsubscribe(this._subscribe), -this._dialog=new e.ObjectTreeDialogRenderer,this._dialog.visible().subscribe(this._subscribe),this._dialog)))}}var Cs,Ts=i(69422),Ps=i(43337);async function xs(e,t,s,o,n,r="default"){let l,c=[];const h=e.model().model(),d=(0,tt.clone)(t),u=new Ps.Property({inputs:d}),_=function(e,t){return"symbol"===t?e.inputs.filter((t=>t.id===e.symbolInputId())):e.inputs.filter((e=>e.confirm))}(s,r),p=()=>{l&&h.removeCustomSource(l)},m=()=>{p(),n()},g=e=>{o({inputs:e,parentSources:c}),p()},f=_.filter(Ts.isTimeOrPriceNotHiddenInput);if(f.length>0)try{const t=await Promise.all([i.e(5234),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(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(9487),i.e(445),i.e(846),i.e(8220),i.e(3329),i.e(9970),i.e(6052),i.e(9590),i.e(4678),i.e(9965),i.e(9742),i.e(4248),i.e(2227),i.e(4931),i.e(9418),i.e(4426),i.e(2475),i.e(9928),i.e(8604),i.e(5893),i.e(3030)]).then(i.bind(i,73339)),o=await t.selectInputValuesOnChart(e,f,u,s.shortDescription,s.inputs);if(l=o.customSourceId,o.destPane&&ns.StudyMetaInfo.getSourceInputIds(s).length>0){const e=o.destPane.mainDataSource();c=e===h.mainSeries()?[]:[e]}else c=[]}catch(e){return void m()}f.length!==_.length?Promise.all([i.e(5234),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(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(9487),i.e(445),i.e(846),i.e(8220),i.e(3329),i.e(9970),i.e(6052),i.e(9590),i.e(4678),i.e(9965),i.e(9742),i.e(4248),i.e(2227),i.e(4931),i.e(9418),i.e(4426),i.e(2475),i.e(9928),i.e(8604),i.e(5893),i.e(3030)]).then(i.bind(i,29638)).then((t=>{const o=new t.ConfirmInputsDialogRenderer(function(e){if("symbol"===e)return a.t(null,void 0,i(46501));return a.t(null,void 0,i(48141))}(r),_,u,r,s,e.model(),g,m);return o.show(),o})):g(u.state().inputs||{})}!function(e){e.Default="default",e.Symbol="symbol"}(Cs||(Cs={}));let Ms=null;var Is=i(25338),As=(i(40987),i(50470)),Ls=i(58096);class ks{constructor(e){this._shown=!1,this._el=(0,As.parseHtmlElement)(function(e=""){return`
`}()),this.setSize(Ls.spinnerSizeMap[e||Ls.DEFAULT_SIZE])}spin(e){return this._el.classList.add("tv-spinner--shown"),void 0===this._container&&(this._container=e,void 0!==e&&e.appendChild(this._el)),this._shown=!0,this}stop(e){return e&&void 0!==this._container&&this._container.removeChild(this._el),this._el&&this._el.classList.remove("tv-spinner--shown"),this._shown=!1,this}setStyle(e){return Object.keys(e).forEach((t=>{const i=e[t];void 0!==i&&this._el.style.setProperty(t,i)})),this}style(){return this._el.style}setSize(e){const t=void 0!==e?`tv-spinner--size_${e}`:"";return this._el.className=`tv-spinner ${t} ${this._shown?"tv-spinner--shown":""}`,this}getEl(){return this._el}destroy(){this.stop(),delete this._el,delete this._container}}function Es(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ds(e){return e.reduce(((e,t)=>{ -for(const i in t)if(Es(t,i)){const s=t[i],o=e[i];o?o.push(s):e[i]=[s]}return e}),{})}var Bs,Vs=i(75579);!function(e){e[e.AccelerationPerMSecPixels=.003]="AccelerationPerMSecPixels",e[e.MaxSpeedPerMSecPixels=1.1]="MaxSpeedPerMSecPixels"}(Bs||(Bs={}));class Rs{constructor(e){this._chartModel=null,this._animation=null,this._chart=e,this._chart.withModel(this,(()=>{this._chartModel=this._chart.model()}))}destroy(){this._animation?.stop()}move(e){if(null!==this._chartModel){if(this._chartModel.timeScale().isEmpty())return;const t=.003,i=1.1,s=Math.round(i/t);this._moveImpl(((o,n,r)=>{const a=Math.min(n,s),l=e*t*Math.pow(a,2)/2;if(n<=s)return o+l;const c=Number.isFinite(r)?Math.max(0,s-r):0;return o+l+e*(n-a-c)*i+e*(i*c-t*Math.pow(c,2)/2)}),(e=>Math.max(0,s-e)+s))}}moveByBar(e){if(null!==this._chartModel){const t=this._chartModel.timeScale(),i=t.visibleBarsStrictRange();if(t.isEmpty()||null===i)return;const s=300,o=i.lastBar();this._moveImpl(((i,n)=>{const r=Math.floor(Math.max(0,n-s)/100)+1,a=o+e*r,l=t.indexToCoordinate(o);return i+(t.indexToCoordinate(a)-l)}),(()=>0),!0)}}stopMove(){this._animation?.stop(),this._animation=null}scrollToRealtime(e,t){if(null===this._chartModel)return;this._chartModel.timeScale().scrollToRealtime(e,t);const i=this._chart.chartWidgetCollection();!i.lock.dateRange.value()&&i.lock.trackTime.value()&&i.chartModels().value().forEach((t=>{t!==this._chartModel&&t.timeScale().scrollToRealtime(e)}))}scrollToFirstBar(){this._chartModel?.timeScale().scrollToFirstBar()}_moveImpl(e,t,i){if(null===this._chartModel)return;const s=this._chartModel.timeScale();if(s.isEmpty())return;if(i&&null!==s.visibleBarsStrictRange()){const e=s.indexToCoordinate(s.visibleBarsStrictRange().lastBar())+s.barSpacing()/2;Math.abs(s.width()-e)>s.barSpacing()/6&&s.setRightOffset(Math.round(s.rightOffset()))}const o=performance.now();let n=1/0;this._animation={getStartPosition:()=>0,getPosition:t=>(t=Math.min(n,t),e(0,t-o,n-t)),finished:e=>e>=n,stop:()=>{const e=performance.now()-o;n=performance.now()+t(e)}},this._chartModel.model().stopTimeScaleAnimation(),this._chartModel.model().setTimeScaleAnimation(this._animation)}}var Ns=i(70002);let Os=null;function Fs(e,t,s,o,n){return Promise.all([i.e(3240),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(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(4059),i.e(1488),i.e(6697),i.e(903),i.e(5445),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(6265)]).then(i.bind(i,12981)).then((i=>{Os?.hide();const r=i.EditObjectDialogRenderer;return Os=new r(e,t,o,n),Os.show(s),Os}))}var Ws=i(2088);let Hs=null;var zs=i(26610),Us=i(35107);const js={[Ns.TabNames.symbol]:"symbol",[Ns.TabNames.legend]:"legend",[Ns.TabNames.scales]:"scales",[Ns.TabNames.trading]:"trading", -[Ns.TabNames.events]:"events",[Ns.TabNames.alerts]:"alerts",[Ns.TabNames.timezoneSessions]:"canvas",[Ns.TabNames.text]:"text",[Ns.TabNames.style]:"style",[Ns.TabNames.visibility]:"visibility"},Gs={[Ns.TabNames.style]:"style",[Ns.TabNames.visibility]:"visibilities"};async function qs(e,t,s={},o,n){const r=o.activeChartWidget.value(),{initialTab:a,tabName:l}=s;if(l&&!a&&(s.initialTab=Gs[l]),(0,Us.isStudyLineTool)(e)&&function(e){if(!(0,Us.isStudyLineTool)(e))return!1;return["LineToolFixedRangeVolumeProfile","LineToolVbPFixed",null].filter(tt.notNull).some((t=>e.toolname===t))}(e))return r.propertiesDefinitionsForSource(e).then((i=>null!==i?Fs(e,t,s,n,i):null));if((0,Ws.isStudy)(e)&&function(e){const{shortId:t}=e.metaInfo();return"Overlay"===t}(e)||(0,zs.isLineTool)(e))return r.propertiesDefinitionsForSource(e).then((o=>{if(null!==o){return function(e){return Promise.all([i.e(4752),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(9323),i.e(8220),i.e(3329),i.e(9970),i.e(6052),i.e(9590),i.e(4678),i.e(159),i.e(9965),i.e(9742),i.e(6043),i.e(4059),i.e(1488),i.e(903),i.e(4633),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(6780)]).then(i.bind(i,75892)).then((t=>{Hs?.hide();const i=t.SourcePropertiesEditorRenderer;return Hs=new i(e),Hs.show({shouldReturnFocus:e.shouldReturnFocus}),Hs}))}({propertyPages:o,model:t,source:e,activePageId:l&&js[l],shouldReturnFocus:s.shouldReturnFocus})}return null}));if((0,Ws.isStudyStub)(e))return null;if((0,Ws.isStudy)(e))return Fs(e,t,s,n);{const e=l&&js[l],t=o.getChartPropertiesDialogRenderer();return t.setActivePage(e),t.show(s)}}var $s=i(24633);async function Ks(){return(await Promise.all([i.e(1171),i.e(7682),i.e(2227),i.e(139)]).then(i.bind(i,81200))).ErrorCardRenderer}var Ys=i(55014),Zs=i(89837);const Xs=(0,Rt.getHexColorByName)("color-cold-gray-700"),Js=(0,Rt.getHexColorByName)("color-cold-gray-400"),Qs=(0,Rt.getHexColorByName)("color-cold-gray-900"),eo=(0,Rt.getHexColorByName)("color-white"),to=a.t(null,void 0,i(18905)),io=a.t(null,void 0,i(63245));function so(e){return e?{...e,message:(0,Ys.formatStudyError)(e.message),rawHtml:!0}:null}class oo{constructor(e,t=!1){this._container=null,this._errorCardRenderer=null,this._mainSeriesErrorMessage=null,this._banErrorMessage=new O.WatchedValue(null).spawn(),this._hasError=new O.WatchedValue(!1),this._renderInsideContainer=!1,this._errorMessageHandler=e=>{this._hasError.setValue(null!==e),e=so(e),!this._renderInsideContainer&&this._chartWidget.hasModel()?this._updatePaneWidgets(e):this._renderErrorWithoutModel(e)},this._chartWidget=e,this._renderInsideContainer=t,this._subscribeToMainSeriesErrors()}destroy(){this._mainSeriesErrorMessage?.destroy(),this._banErrorMessage.destroy(),this._errorCardRenderer?.then((e=>{e.container.remove(),e.destroy()}))}updatePaneWidgets(){ +this._dialog=new e.ObjectTreeDialogRenderer,this._dialog.visible().subscribe(this._subscribe),this._dialog)))}}var Cs,Ts=i(69422),Ps=i(43337);async function xs(e,t,s,o,n,r="default"){let l,c=[];const h=e.model().model(),d=(0,tt.clone)(t),u=new Ps.Property({inputs:d}),_=function(e,t){return"symbol"===t?e.inputs.filter((t=>t.id===e.symbolInputId())):e.inputs.filter((e=>e.confirm))}(s,r),p=()=>{l&&h.removeCustomSource(l)},m=()=>{p(),n()},g=e=>{o({inputs:e,parentSources:c}),p()},f=_.filter(Ts.isTimeOrPriceNotHiddenInput);if(f.length>0)try{const t=await Promise.all([i.e(5234),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(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(9487),i.e(445),i.e(846),i.e(8220),i.e(3329),i.e(9970),i.e(6052),i.e(9590),i.e(4678),i.e(9965),i.e(9742),i.e(4248),i.e(2227),i.e(4931),i.e(9418),i.e(4426),i.e(9026),i.e(9928),i.e(8604),i.e(5893),i.e(3030)]).then(i.bind(i,73339)),o=await t.selectInputValuesOnChart(e,f,u,s.shortDescription,s.inputs);if(l=o.customSourceId,o.destPane&&ns.StudyMetaInfo.getSourceInputIds(s).length>0){const e=o.destPane.mainDataSource();c=e===h.mainSeries()?[]:[e]}else c=[]}catch(e){return void m()}f.length!==_.length?Promise.all([i.e(5234),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(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(9487),i.e(445),i.e(846),i.e(8220),i.e(3329),i.e(9970),i.e(6052),i.e(9590),i.e(4678),i.e(9965),i.e(9742),i.e(4248),i.e(2227),i.e(4931),i.e(9418),i.e(4426),i.e(9026),i.e(9928),i.e(8604),i.e(5893),i.e(3030)]).then(i.bind(i,29638)).then((t=>{const o=new t.ConfirmInputsDialogRenderer(function(e){if("symbol"===e)return a.t(null,void 0,i(46501));return a.t(null,void 0,i(48141))}(r),_,u,r,s,e.model(),g,m);return o.show(),o})):g(u.state().inputs||{})}!function(e){e.Default="default",e.Symbol="symbol"}(Cs||(Cs={}));let Ms=null;var Is=i(25338),As=(i(40987),i(50470)),Ls=i(58096);class ks{constructor(e){this._shown=!1,this._el=(0,As.parseHtmlElement)(function(e=""){return`
`}()),this.setSize(Ls.spinnerSizeMap[e||Ls.DEFAULT_SIZE])}spin(e){return this._el.classList.add("tv-spinner--shown"),void 0===this._container&&(this._container=e,void 0!==e&&e.appendChild(this._el)),this._shown=!0,this}stop(e){return e&&void 0!==this._container&&this._container.removeChild(this._el),this._el&&this._el.classList.remove("tv-spinner--shown"),this._shown=!1,this}setStyle(e){return Object.keys(e).forEach((t=>{const i=e[t];void 0!==i&&this._el.style.setProperty(t,i)})),this}style(){return this._el.style}setSize(e){const t=void 0!==e?`tv-spinner--size_${e}`:"";return this._el.className=`tv-spinner ${t} ${this._shown?"tv-spinner--shown":""}`,this}getEl(){return this._el}destroy(){this.stop(),delete this._el,delete this._container}}function Es(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Ds(e){return e.reduce(((e,t)=>{ +for(const i in t)if(Es(t,i)){const s=t[i],o=e[i];o?o.push(s):e[i]=[s]}return e}),{})}var Bs,Vs=i(75579);!function(e){e[e.AccelerationPerMSecPixels=.003]="AccelerationPerMSecPixels",e[e.MaxSpeedPerMSecPixels=1.1]="MaxSpeedPerMSecPixels"}(Bs||(Bs={}));class Rs{constructor(e){this._chartModel=null,this._animation=null,this._chart=e,this._chart.withModel(this,(()=>{this._chartModel=this._chart.model()}))}destroy(){this._animation?.stop()}move(e){if(null!==this._chartModel){if(this._chartModel.timeScale().isEmpty())return;const t=.003,i=1.1,s=Math.round(i/t);this._moveImpl(((o,n,r)=>{const a=Math.min(n,s),l=e*t*Math.pow(a,2)/2;if(n<=s)return o+l;const c=Number.isFinite(r)?Math.max(0,s-r):0;return o+l+e*(n-a-c)*i+e*(i*c-t*Math.pow(c,2)/2)}),(e=>Math.max(0,s-e)+s))}}moveByBar(e){if(null!==this._chartModel){const t=this._chartModel.timeScale(),i=t.visibleBarsStrictRange();if(t.isEmpty()||null===i)return;const s=300,o=i.lastBar();this._moveImpl(((i,n)=>{const r=Math.floor(Math.max(0,n-s)/100)+1,a=o+e*r,l=t.indexToCoordinate(o);return i+(t.indexToCoordinate(a)-l)}),(()=>0),!0)}}stopMove(){this._animation?.stop(),this._animation=null}scrollToRealtime(e,t){if(null===this._chartModel)return;this._chartModel.timeScale().scrollToRealtime(e,t);const i=this._chart.chartWidgetCollection();!i.lock.dateRange.value()&&i.lock.trackTime.value()&&i.chartModels().value().forEach((t=>{t!==this._chartModel&&t.timeScale().scrollToRealtime(e)}))}scrollToFirstBar(){this._chartModel?.timeScale().scrollToFirstBar()}_moveImpl(e,t,i){if(null===this._chartModel)return;const s=this._chartModel.timeScale();if(s.isEmpty())return;if(i&&null!==s.visibleBarsStrictRange()){const e=s.indexToCoordinate(s.visibleBarsStrictRange().lastBar())+s.barSpacing()/2;Math.abs(s.width()-e)>s.barSpacing()/6&&s.setRightOffset(Math.round(s.rightOffset()))}const o=performance.now();let n=1/0;this._animation={getStartPosition:()=>0,getPosition:t=>(t=Math.min(n,t),e(0,t-o,n-t)),finished:e=>e>=n,stop:()=>{const e=performance.now()-o;n=performance.now()+t(e)}},this._chartModel.model().stopTimeScaleAnimation(),this._chartModel.model().setTimeScaleAnimation(this._animation)}}var Ns=i(70002);let Os=null;function Fs(e,t,s,o,n){return Promise.all([i.e(3240),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(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(4059),i.e(1488),i.e(6697),i.e(903),i.e(5445),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(6265)]).then(i.bind(i,12981)).then((i=>{Os?.hide();const r=i.EditObjectDialogRenderer;return Os=new r(e,t,o,n),Os.show(s),Os}))}var Ws=i(2088);let Hs=null;var zs=i(26610),Us=i(35107);const js={[Ns.TabNames.symbol]:"symbol",[Ns.TabNames.legend]:"legend",[Ns.TabNames.scales]:"scales",[Ns.TabNames.trading]:"trading", +[Ns.TabNames.events]:"events",[Ns.TabNames.alerts]:"alerts",[Ns.TabNames.timezoneSessions]:"canvas",[Ns.TabNames.text]:"text",[Ns.TabNames.style]:"style",[Ns.TabNames.visibility]:"visibility"},Gs={[Ns.TabNames.style]:"style",[Ns.TabNames.visibility]:"visibilities"};async function qs(e,t,s={},o,n){const r=o.activeChartWidget.value(),{initialTab:a,tabName:l}=s;if(l&&!a&&(s.initialTab=Gs[l]),(0,Us.isStudyLineTool)(e)&&function(e){if(!(0,Us.isStudyLineTool)(e))return!1;return["LineToolFixedRangeVolumeProfile","LineToolVbPFixed",null].filter(tt.notNull).some((t=>e.toolname===t))}(e))return r.propertiesDefinitionsForSource(e).then((i=>null!==i?Fs(e,t,s,n,i):null));if((0,Ws.isStudy)(e)&&function(e){const{shortId:t}=e.metaInfo();return"Overlay"===t}(e)||(0,zs.isLineTool)(e))return r.propertiesDefinitionsForSource(e).then((o=>{if(null!==o){return function(e){return Promise.all([i.e(4752),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(9323),i.e(8220),i.e(3329),i.e(9970),i.e(6052),i.e(9590),i.e(4678),i.e(159),i.e(9965),i.e(9742),i.e(6043),i.e(4059),i.e(1488),i.e(903),i.e(4633),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(6780)]).then(i.bind(i,75892)).then((t=>{Hs?.hide();const i=t.SourcePropertiesEditorRenderer;return Hs=new i(e),Hs.show({shouldReturnFocus:e.shouldReturnFocus}),Hs}))}({propertyPages:o,model:t,source:e,activePageId:l&&js[l],shouldReturnFocus:s.shouldReturnFocus})}return null}));if((0,Ws.isStudyStub)(e))return null;if((0,Ws.isStudy)(e))return Fs(e,t,s,n);{const e=l&&js[l],t=o.getChartPropertiesDialogRenderer();return t.setActivePage(e),t.show(s)}}var $s=i(24633);async function Ks(){return(await Promise.all([i.e(1171),i.e(7682),i.e(2227),i.e(139)]).then(i.bind(i,81200))).ErrorCardRenderer}var Ys=i(55014),Zs=i(89837);const Xs=(0,Rt.getHexColorByName)("color-cold-gray-700"),Js=(0,Rt.getHexColorByName)("color-cold-gray-400"),Qs=(0,Rt.getHexColorByName)("color-cold-gray-900"),eo=(0,Rt.getHexColorByName)("color-white"),to=a.t(null,void 0,i(18905)),io=a.t(null,void 0,i(63245));function so(e){return e?{...e,message:(0,Ys.formatStudyError)(e.message),rawHtml:!0}:null}class oo{constructor(e,t=!1){this._container=null,this._errorCardRenderer=null,this._mainSeriesErrorMessage=null,this._banErrorMessage=new O.WatchedValue(null).spawn(),this._hasError=new O.WatchedValue(!1),this._renderInsideContainer=!1,this._errorMessageHandler=e=>{this._hasError.setValue(null!==e),e=so(e),!this._renderInsideContainer&&this._chartWidget.hasModel()?this._updatePaneWidgets(e):this._renderErrorWithoutModel(e)},this._chartWidget=e,this._renderInsideContainer=t,this._subscribeToMainSeriesErrors()}destroy(){this._mainSeriesErrorMessage?.destroy(),this._banErrorMessage.destroy(),this._errorCardRenderer?.then((e=>{e.container.remove(),e.destroy()}))}updatePaneWidgets(){ this._updatePaneWidgets()}setContainer(e){if(this._container!==e){this._container=e,this._errorCardRenderer?.then((e=>e.container.remove()));const t=this._getErrorMessage();t&&this._errorMessageHandler(t)}}hasError(){return this._hasError.readonly()}_updatePaneWidgets(e=this._getErrorMessage()){this._chartWidget.paneWidgets().forEach((t=>t.setErrorMessage(e)))}async _renderErrorWithoutModel(e){if(null===this._container||null===e&&null===this._errorCardRenderer)return;const t=await this._getErrorCardRenderer();this._container.contains(t.container)||this._container.appendChild(t.container),t.update(this._createErrorCardRendererState(e))}async _getErrorCardRenderer(){return this._errorCardRenderer||(this._errorCardRenderer=this._createErrorCardRenderer())}async _createErrorCardRenderer(){return new(await Ks())}_createErrorCardRendererState(e){return e?{message:e.message,icon:e.icon,textColor:k.watchedTheme.value()===$s.StdTheme.Dark?Js:Xs,backgroundColor:k.watchedTheme.value()===$s.StdTheme.Dark?Qs:eo,solutionId:e.solutionId,rawHtml:e.rawHtml,buttons:e.buttons}:{message:null}}_subscribeToMainSeriesErrors(){const e=this._chartWidget;e.withModel(this,(()=>{const t=e.model().model().mainSeries();this._mainSeriesErrorMessage=(0,ft.combine)(((t,s)=>{if(t)return t;if(null===s)return null;switch(s.type){case"invalid_symbol":return this._createErrorParamsForInvalidSymbol(e);case"calculations_error":return{message:s.errorMessage,icon:"attention"};case"no_data":return{message:a.t(null,void 0,i(36252)),icon:"ghost"};case"unsupported_resolution":return this._createErrorParamsForUnsupportedResolution(e)}}),this._banErrorMessage.weakReference(),(0,xt.getSeriesDisplayErrorWV)(t).ownership()),this._mainSeriesErrorMessage.subscribe(this._errorMessageHandler,{callWithLast:!0})}))}_createErrorParamsForInvalidSymbol(e){return{message:`${a.t(null,void 0,i(52969))}
${a.t(null,void 0,i(53272))}`,icon:"ghost",rawHtml:!0,maxHeight:400,zeroHeight:200,buttons:[{name:io,onClick:async()=>{e.setActive(!0);const t=e.model().mainSeries(),i=t.symbol(),s=t.properties().childs().shortName.value(),o="option"===t.symbolInfo()?.type,n=t.symbolInfo()?.pro_name;let r=t.isSpread()?i:s||i||"";if(l.enabled("symbol_search_option_chain_selector")&&o&&n){const e=await resolveUnderlyingSymbol(n);e&&(r={type:"option",value:n,underlying:e})}(0,vs.showDialog)({defaultValue:r,enableOptionsChain:l.enabled("symbol_search_option_chain_selector")})}}]}}_createErrorParamsForUnsupportedResolution(e){const t=e.model().mainSeries().unsupportedResolutionState().value();return null===t?null:{message:(0,Zs.getErrorFromUnsupportedResolutionState)(t,!0),icon:"unsupported-resolution",rawHtml:!0,maxHeight:400,zeroHeight:200,buttons:[{name:to.format({resolution:t.applicableResolution}),onClick:()=>{e.setActive(!0),de.linking.setIntervalAndLogInitiator(t.applicableResolution,"Error state")}}]}}_getErrorMessage(){return so(this._banErrorMessage.value()||this._mainSeriesErrorMessage?.value()||null)}}var no,ro=i(59239),ao=i(51304),lo=i(39612),co=i(93201),ho=i(98155),uo=i(11044) ;class _o{constructor(e,t){this._showed=!1,this._additionalReadyPromise=null,this._cw=e,this._element=document.createElement("div"),this._element.classList.add(uo.screen),t.appendChild(this._element),this._cw.withModel(this,this._connectToModel)}destroy(){this.hide(),this._element.remove()}show(e,t){if(e){const e=this._cw.model().mainSeries().status();if(1!==e&&2!==e)return}this._additionalReadyPromise=t,this._cw.setInLoadingState(!0),this._showed||(this._showed=!0,this._show())}hide(){this._cw.setInLoadingState(!1),this._showed&&this._hide()}isShown(){return this._showed}_connectToModel(){const e=this._cw.model().mainSeries(),t=e.dataEvents();t.symbolError().subscribe(this,(e=>{e!==ho.permissionDenied&&this.hide()})),t.seriesError().subscribe(this,(()=>{(0,l.enabled)("hide_loading_screen_on_series_error")&&this.hide()})),e.statusWV().subscribe((e=>{if(4!==e&&12!==e&&13!==e&&14!==e||this.hide(),bt.seriesReadyStatuses.has(e)){const e=this._additionalReadyPromise;e?e.then((()=>{this.hide()})):this.hide()}}))}_show(){const e=this._cw.properties().childs().paneProperties.childs();let t;if(e.backgroundType.value()===co.ColorType.Solid)t=e.background.value();else{t=`linear-gradient(${e.backgroundGradientStartColor.value()},${e.backgroundGradientEndColor.value()})`}this._element.style.background=t,this._element.classList.add(uo.fade)}_hide(){this._showed=!1,this._element.classList.remove(uo.fade)}}function po(e,t){let{deltaX:i,deltaY:s}=e;switch(i/=100,s/=100,t.deltaMode){case t.DOM_DELTA_PAGE:i*=120,s*=120;break;case t.DOM_DELTA_LINE:i*=32,s*=32}return{deltaX:i,deltaY:s}}!function(e){e[e.MaxNextEventDelay=100]="MaxNextEventDelay",e[e.IgnoreSmallerDeltaCoeff=3]="IgnoreSmallerDeltaCoeff"}(no||(no={}));class mo{constructor(){this._totalDeltaX=0,this._totalDeltaY=0,this._prevWheelTime=0}processWheel(e){e.timeStamp-this._prevWheelTime>100&&this._reset();const t=!(0,ze.isMac)()&&e.shiftKey,i=t?-e.deltaY:e.deltaX,s=t?e.deltaX:e.deltaY;this._totalDeltaX+=i,this._totalDeltaY+=s,this._prevWheelTime=e.timeStamp;const o={deltaX:i,deltaY:s};return 0===this._totalDeltaX||0===this._totalDeltaY||(Math.abs(this._totalDeltaX)>=Math.abs(3*this._totalDeltaY)&&(o.deltaY=0),Math.abs(this._totalDeltaY)>=Math.abs(3*this._totalDeltaX)&&(o.deltaX=0)),po(o,e)}_reset(){this._totalDeltaX=0,this._totalDeltaY=0}}var go,fo=i(77914),yo=i(15266);!function(e){e[e.Height=1]="Height",e[e.MinPaneHeight=30]="MinPaneHeight"}(go||(go={}));class vo{constructor(e,t,i){this._handleEl=null,this._resizeInfo=null,this._colorCache={lineColor:"",backgroundColor:"",color:""},this._selected=new O.WatchedValue,this._chart=e,this._topPaneIndex=t,this._bottomPaneIndex=i,this._element=document.createElement("div"),this._element.classList.add(yo.paneSeparator),this._element.style.background=this._color(),this.adjustSize(),this._element.addEventListener("click",(()=>{}));const s=document.createElement("div");s.classList.add(yo.handle),this._element.appendChild(s),this._mouseEventHandler=new Wt.MouseEventHandler(s,this,{treatVertTouchDragAsPageScroll:!1, treatHorzTouchDragAsPageScroll:!0}),this._handleEl=s,this._handleEl.classList.toggle(yo.mobile,ze.CheckMobile.any()),this._element.setAttribute("aria-hidden","true"),this._selected.subscribe((e=>this._handleEl?.classList.toggle(yo.selected,e)))}destroy(){this._mouseEventHandler.destroy(),this._element.parentElement&&this._element.parentElement.removeChild(this._element)}topPaneIndex(){return this._topPaneIndex}bottomPaneIndex(){return this._bottomPaneIndex}getElement(){return this._element}hide(){this._element.classList.add("js-hidden")}show(){this._element.classList.remove("js-hidden")}selected(){return this._selected.readonly()}adjustSize(){this._element.style.height=vo.height()+"px"}mouseEnterEvent(e){const{topPane:t,bottomPane:i}=this._topBottomPane(!0);null!==t&&null!==i&&(0,n.ensureNotNull)(this._handleEl).classList.add(yo.hovered)}mouseLeaveEvent(e){(0,n.ensureNotNull)(this._handleEl).classList.remove(yo.hovered)}mouseDownEvent(e){this._mouseDownOrTouchStartEvent(e)}tapEvent(){this._selected.setValue(!this._selected.value())}touchStartEvent(e){this._selected.value()&&this._mouseDownOrTouchStartEvent(e)}pressedMouseMoveEvent(e){this._pressedMouseOrTouchMoveEvent(e)}touchMoveEvent(e){this._selected.value()&&this._pressedMouseOrTouchMoveEvent(e)}mouseUpEvent(e){this._mouseUpOrTouchEndEvent(e)}touchEndEvent(e){this._selected.value()&&this._mouseUpOrTouchEndEvent(e)}touchStartOutsideEvent(){this._selected.setValue(!1)}update(){this._element.style.background=this._color().toString()}paint(){}image(){const{topPane:e}=this._topBottomPane(!1),t=e.leftPriceAxisesContainer().getWidth(),i=e.width(),s=e.rightPriceAxisesContainer().getWidth(),o=this._color(),n=(0,Kt.createDisconnectedCanvas)(document,(0,Ft.size)({width:t,height:1})),r=(0,Kt.getPrescaledContext2D)(n);r.fillStyle=o,r.fillRect(0,0,t,1);const a=(0,Kt.createDisconnectedCanvas)(document,(0,Ft.size)({width:i,height:1})),l=(0,Kt.getPrescaledContext2D)(a);l.fillStyle=o,l.fillRect(0,0,i,1);const c=(0,Kt.createDisconnectedCanvas)(document,(0,Ft.size)({width:s,height:1})),h=(0,Kt.getPrescaledContext2D)(c);return h.fillStyle=o,h.fillRect(0,0,s,1),{type:"separator",leftAxis:{content:n.toDataURL(),canvas:n,contentWidth:t,contentHeight:1},rightAxis:{content:c.toDataURL(),canvas:c,contentWidth:s,contentHeight:1},content:a.toDataURL(),canvas:a,contentWidth:i,contentHeight:1}}static height(){const e=window.devicePixelRatio||1;return e>=1?1:1/e}_mouseDownOrTouchStartEvent(e){const{topPane:t,bottomPane:i}=this._topBottomPane(!0);if(null===t||null===i)return;const s=t.state().stretchFactor()+i.state().stretchFactor(),o=s/(t.height()+i.height()),r=30*o;s<=2*r||(this._resizeInfo={startY:e.pageY,prevStretchTopPane:t.state().stretchFactor(),maxPaneStretch:s-r,totalStretch:s,pixelStretchFactor:o,minPaneStretch:r},(0,n.ensureNotNull)(this._handleEl).classList.add(yo.active))}_pressedMouseOrTouchMoveEvent(e){const{topPane:t,bottomPane:i}=this._topBottomPane(!0),s=this._resizeInfo;if(null===s||null===t||null===i)return;const o=(e.pageY-s.startY)*s.pixelStretchFactor,n=(0, @@ -667,7 +667,7 @@ ft.combine)((e=>[e?e.mainSeries().symbolInfoWV().weakReference():new O.WatchedVa this._onWidget&&(o?this._widgetCustomer="cme":r&&(this._widgetCustomer=r)),this._compareDialog=this._chartWidgetCollection.getCompareDialogRenderer();const m=this._contentSeriesProperties();m&&(l=m.symbol,c=m.interval),void 0===this._options.useUserChartPreferences&&(this._options.useUserChartPreferences=!0);const g="chartproperties.mainSeriesProperties",f=this._options.useUserChartPreferences?(0,h.defaults)(g):(0,h.factoryDefaults)(g),y=this._mainSeriesProperties,v=c||f.interval||"D";null!==u&&(0,xt.isValidStyle)(u)||(u=(0,xt.isValidStyle)(f.style)?f.style:(0,xt.getDefaultStyle)(Re.Interval.isRange(v))),y.merge({visible:!0,symbol:l||window.DEFAULT_SYMBOL,shortName:"",timeframe:"",interval:v,currencyId:null,unitId:null,style:u,sessionId:_}),this._symbolWV.setValue(l),this._resolutionWV.setValue(v),this._containsData&&this._mainSeriesProperties.merge({showCountdown:!1}),a&&(0,Pe.timezoneIsAvailable)(a)&&this._properties.childs().timezone.setValue(a),this._options.container.subscribe((e=>{this._setElement(e)}),{callWithLast:!0});const S=()=>{this.resize()};this._options.width.subscribe(S),this._options.height.subscribe(S),this._options.visible.subscribe(this._updateTimingsMeterState.bind(this))}refreshMarks(){this.model().barsMarksSources().forEach((e=>e.refreshData()))}clearMarks(e){this.model().barsMarksSources().forEach((t=>t.clearMarks(e)))}setTimezone(e){const t=e;t&&(0,Pe.timezoneIsAvailable)(t)?this.properties().childs().timezone.setValue(t):console.warn("Incorrect timezone: "+JSON.stringify(t))}getTimezone(){return this.properties().childs().timezone.value()}destroy(){hg.chartFloatingTooltipEnabledWV.unsubscribe(this._onChartFloatingTooltipEnabledChanged),this._chartFloatingTooltipController?.destroy(),this._tooltipPopupHintDestroySignal?.abort(),this._chartSession.disconnect(),this._unsetActions(),this._hotkeys?.destroy(),this._lineToolsSynchronizer?.destroy(),this._noExchangeSubscrptionWarning?.destroy(),window.loginStateChange.unsubscribe(this,this._handleLoginStateChanged),null!==this._model&&(this._model.model().backgroundTopColor().unsubscribe(this._updateThemedColorBound),this._model.model().backgroundColor().unsubscribe(this._updateThemedColorBound),this._model.model().crosshairSource().moved().unsubscribe(this,this._updateAriaPriceDescription),this._model.destroy()),this._ariaPriceDescription=null,this._customLegendWidgetsFactoryMap.clear(),this._scrollHelper.destroy(),this._errorRenderer.destroy(),this._chartSession.criticalError().unsubscribe(this,this._onChartSessionCriticalError),this._chartSession.isConnected().unsubscribe(this._onChartSessionIsConnectedChanged),this._chartSession.destroy(),this._persistentLogSwitcher?.destroy(),this._isDestroyed=!0,this._aboutToBeDestroyed.fire(),this._removeMaximizeHotkey?.(),this._removeMaximizeHotkey=null,0!==this._drawRafId&&this._parent?.ownerDocument.defaultView?.cancelAnimationFrame(this._drawRafId),this._backgroundTopColorSpawn?.destroy(),this._backgroundBottomColorSpawn?.destroy(),this._timingsMeter?.stopCollect(),this._timingsMeter=null ;const e=this._paneWidgets.value();for(let t=0;t!!(0,Ws.isStudy)(t)&&e(t.metaInfo())))}model(){return(0,n.ensureNotNull)(this._model)}id(){return this._id}layoutId(){return this._chartWidgetCollection.metaInfo.uid.value()}properties(){return this._properties}mainSeriesProperties(){return this._mainSeriesProperties}readOnly(){return Boolean(this._options.readOnly)}isActive(){return this._isActive.readonly()}isHovered(){return this._isHovered.readonly()}crossHairSyncEnabled(){return this._chartWidgetCollection.lock.crosshair.value()}isVisible(){return this._isVisible.value()}setVisible(e){this._isVisible.setValue(e)}visible(){return this._isVisible.readonly()}isCollapsed(){ return this._collapsed.value()}setCollapsed(e){this._collapsed.setValue(e)}collapsed(){return this._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){const t=this.model(),i=e.filter((e=>e!==t.mainSeries()&&e!==t.lineBeingCreated()&&e.isUserDeletable()));if(0===i.length)return;let s=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()));const o=!!i.find((e=>(0,zs.isLineTool)(e)&&e.isLocked?.()));if(s&&s.hasChildren()){const e=s.getAllChildren().map((e=>e.name(!0)));(0,fs.showDeleteStudyTreeConfirm)(e,(()=>{t.removeSelectedSources()}))}else o?(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)return this._setSymbolIntervalContentOverrides.symbol||window.DEFAULT_SYMBOL;if(!e)return this._symbolWV.value();const t=this._model.mainSeries().properties().childs();return t.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(){return this._resolutionWV.value()}symbolWV(){return this._symbolWV.readonly()}symbolInfoWV(){return this._symbolInfoWV}resolutionWV(){return this._resolutionWV.readonly()}loadRange(e){if(this._model){this.screen.show();this._model.loadRange(e)||this.screen.hide()}}async showGeneralChartProperties(e,t){if(!l.enabled("show_chart_property_page"))return Promise.resolve(null);const s=await this._showChartProperties(this.model().mainSeries(),e,{doNotCloseOnBgClick:!0,onResetToDefault:async()=>{this.model().restorePreferences() -;const[e,t]=await Promise.all([Promise.resolve().then(i.bind(i,22489)),Promise.resolve().then(i.bind(i,71843))]),s=e.getCurrentTheme().name;t.loadTheme(this.chartWidgetCollection(),{themeName:s,standardTheme:!0})},shouldReturnFocus:t?.shouldReturnFocus});if(null===s)return null;const o=()=>{s.hide(),this._chartWidgetCollection.activeChartWidget.unsubscribe(o)};return this._chartWidgetCollection.activeChartWidget.subscribe(o),s}showChartPropertiesForSource(e,t,i,s){return l.enabled("property_pages")&&e.userEditEnabled()?e===this.model().model().mainSeries()?this.showGeneralChartProperties(t):((i=i||{}).onResetToDefault=()=>{((0,zs.isLineTool)(e)||(0,Ws.isStudy)(e))&&this.model().restorePropertiesForSource.bind(this._model,e)},this._showChartProperties(e,t,i,s)):Promise.resolve(null)}toggleCompareOrAdd(){this._compareDialog.visible().value()?this._compareDialog.hide():this._compareDialog.show()}tags(){return this._model?this._model.calculateDefaultTags():[]}options(){return this._options}ownerDocument(){return(0,n.ensureNotNull)(this._parent).ownerDocument}async showChartPropertiesForSources(e){if(!l.enabled("property_pages"))return Promise.resolve(null);const{sources:t,title:s,tabName:o,renamable:r}=e,c=(0,n.ensureNotNull)(this._model),h=Ds(t.map((e=>e.properties().childs()))),d=Ds(t.map((e=>e.properties().childs().intervalsVisibilities))),[{createPropertyPage:u},{getSelectionStylePropertiesDefinitions:_},{getSelectionIntervalsVisibilitiesPropertiesDefinition:p},{getSelectionCoordinatesPropertyDefinition:m}]=await Promise.all([Promise.all([i.e(3198),i.e(5410),i.e(2745),i.e(8823),i.e(8537)]).then(i.bind(i,60567)),Promise.all([i.e(3198),i.e(5410),i.e(2745),i.e(8823),i.e(8537)]).then(i.bind(i,6255)),Promise.all([i.e(3198),i.e(5410),i.e(2745),i.e(8823),i.e(8537)]).then(i.bind(i,73863)),Promise.all([i.e(3198),i.e(5410),i.e(2745),i.e(8823),i.e(8537)]).then(i.bind(i,97578))]);return async function(e){const{SourcesPropertiesEditorRenderer:t}=await Promise.all([i.e(4752),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(9323),i.e(8220),i.e(3329),i.e(9970),i.e(6052),i.e(9590),i.e(4678),i.e(159),i.e(9965),i.e(9742),i.e(6043),i.e(4059),i.e(1488),i.e(903),i.e(4633),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(6780)]).then(i.bind(i,66512)),s=new t(e);return null!==Ms&&(Ms.hide(),Ms=s),s.show(),s}({sources:t,propertyPages:[u(_(h,c),"style",a.t(null,void 0,i(92516))),u({definitions:[m(t,c)]},"displacement",a.t(null,void 0,i(70132))),u(p(d,c),"visibility",a.t(null,void 0,i(40091)))],undoModel:c,title:s,activeTabId:o,renamable:r})}getPriceAxisWidthChangedByName(e){return"left"===e?this._lhsPriceAxisWidthChanged:this._rhsPriceAxisWidthChanged}getPriceAxisMaxWidthByName(e){return"left"===e?this._lhsAxesWidth:this._rhsAxesWidth}timeAxisHeight(){ +;const[e,t]=await Promise.all([Promise.resolve().then(i.bind(i,22489)),Promise.resolve().then(i.bind(i,71843))]),s=e.getCurrentTheme().name;t.loadTheme(this.chartWidgetCollection(),{themeName:s,standardTheme:!0})},shouldReturnFocus:t?.shouldReturnFocus});if(null===s)return null;const o=()=>{s.hide(),this._chartWidgetCollection.activeChartWidget.unsubscribe(o)};return this._chartWidgetCollection.activeChartWidget.subscribe(o),s}showChartPropertiesForSource(e,t,i,s){return l.enabled("property_pages")&&e.userEditEnabled()?e===this.model().model().mainSeries()?this.showGeneralChartProperties(t):((i=i||{}).onResetToDefault=()=>{((0,zs.isLineTool)(e)||(0,Ws.isStudy)(e))&&this.model().restorePropertiesForSource.bind(this._model,e)},this._showChartProperties(e,t,i,s)):Promise.resolve(null)}toggleCompareOrAdd(){this._compareDialog.visible().value()?this._compareDialog.hide():this._compareDialog.show()}tags(){return this._model?this._model.calculateDefaultTags():[]}options(){return this._options}ownerDocument(){return(0,n.ensureNotNull)(this._parent).ownerDocument}async showChartPropertiesForSources(e){if(!l.enabled("property_pages"))return Promise.resolve(null);const{sources:t,title:s,tabName:o,renamable:r}=e,c=(0,n.ensureNotNull)(this._model),h=Ds(t.map((e=>e.properties().childs()))),d=Ds(t.map((e=>e.properties().childs().intervalsVisibilities))),[{createPropertyPage:u},{getSelectionStylePropertiesDefinitions:_},{getSelectionIntervalsVisibilitiesPropertiesDefinition:p},{getSelectionCoordinatesPropertyDefinition:m}]=await Promise.all([Promise.all([i.e(3198),i.e(5410),i.e(2745),i.e(8823),i.e(8537)]).then(i.bind(i,60567)),Promise.all([i.e(3198),i.e(5410),i.e(2745),i.e(8823),i.e(8537)]).then(i.bind(i,6255)),Promise.all([i.e(3198),i.e(5410),i.e(2745),i.e(8823),i.e(8537)]).then(i.bind(i,73863)),Promise.all([i.e(3198),i.e(5410),i.e(2745),i.e(8823),i.e(8537)]).then(i.bind(i,97578))]);return async function(e){const{SourcesPropertiesEditorRenderer:t}=await Promise.all([i.e(4752),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(9323),i.e(8220),i.e(3329),i.e(9970),i.e(6052),i.e(9590),i.e(4678),i.e(159),i.e(9965),i.e(9742),i.e(6043),i.e(4059),i.e(1488),i.e(903),i.e(4633),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(6780)]).then(i.bind(i,66512)),s=new t(e);return null!==Ms&&(Ms.hide(),Ms=s),s.show(),s}({sources:t,propertyPages:[u(_(h,c),"style",a.t(null,void 0,i(92516))),u({definitions:[m(t,c)]},"displacement",a.t(null,void 0,i(70132))),u(p(d,c),"visibility",a.t(null,void 0,i(40091)))],undoModel:c,title:s,activeTabId:o,renamable:r})}getPriceAxisWidthChangedByName(e){return"left"===e?this._lhsPriceAxisWidthChanged:this._rhsPriceAxisWidthChanged}getPriceAxisMaxWidthByName(e){return"left"===e?this._lhsAxesWidth:this._rhsAxesWidth}timeAxisHeight(){ return null!==this._timeAxisWidget?this._timeAxisWidget.size.height:0}withModel(e,t){null!==this._model?t.call(e):this.modelCreated().subscribe(e,t,!0)}hasModel(){return null!==this._model}onRedraw(){return this._redraw}copyLineToOtherCharts(){const e=(0,n.ensureNotNull)(this._model),t=e.selection().lineDataSources().filter((e=>e.isSynchronizable()));e.model().copyToOtherCharts(t,!0)}toggleLockSelectedObject(){const e=this.model();e.selection().lineDataSources().forEach((t=>{const i=t.properties().frozen.value();e.setProperty(t.properties().frozen,!i,(i?Sg:bg).format({title:new dt.TranslatedString(t.name(),t.title(pa.TitleDisplayTarget.StatusLine))}),Wr.lineToolsDoNotAffectChartInvalidation)}))}hideDataSources(e){if(e.length){const t=e.map((e=>e.properties().visible)),i=e.map((()=>!1));this.model().setProperties(t,i,vg.format({title:new dt.TranslatedString(e[0].name(),e[0].title(pa.TitleDisplayTarget.StatusLine))}))}}hideSelectedObject(){this.hideDataSources(this.model().selection().dataSources().filter((e=>!0)))}unlinkSelectedLine(){const e=(0,n.ensureNotNull)(this._model),t=e.selection().lineDataSources();e.unlinkLines(t)}paneWidgetsWV(){return this._paneWidgets}paneWidgets(){return this._paneWidgets.value()}paneWidgetSeparators(e){const t=this.paneWidgets().indexOf(e),i={};return this._paneSeparators.forEach((e=>{e.topPaneIndex()===t&&(i.separatorBelow=e),e.bottomPaneIndex()===t&&(i.separatorAbove=e)})),i}activePaneWidget(){return this._activePaneWidget.readonly()}paneByState(e){return this._paneWidgets.value().find((t=>t.hasState()&&t.state()===e))??null}paneByCanvas(e){return this._paneWidgets.value().find((t=>t.hasCanvas(e)))??null}timeAxisByCanvas(e){return this._timeAxisWidget?.hasCanvas(e)?this._timeAxisWidget:null}selectPointMode(){return(0,n.ensureNotNull)(this._model).model().selectPointMode()}cancelRequestSelectPoint(){const e=(0,n.ensureNotNull)(this._model).model();e.cancelRequestSelectPoint(),e.setReplayStatus(e.isInReplay().value()?3:0),e.clearCurrentPosition()}requestSelectPoint(e,t){const i=(0,n.ensureNotNull)(this._model);return e.selectPointMode===mt.SelectPointMode.Replay&&i.model().setReplayStatus(1),new Promise(((s,o)=>{const n=()=>!!this.isVisible()||(o("Chartwidget must be visible"),this.cancelRequestSelectPoint(),!1);if(!n())return;(0,mt.resetToCursor)(!0),i.lineBeingCreated()&&i.cancelCreatingLine();let r=!1;const a={};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(),void 0!==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(){return this.model().isInReplay().value(),Promise.resolve()}showSourceProperties(e,t){e===this.model().mainSeries()&&(t=Ns.TabNames.symbol), this.showChartPropertiesForSource(e,t)}onScroll(){return this._onScroll}onZoom(){return this._onZoom}onTagsChanged(){return this._tagsChanged}onWidget(){return this._onWidget}containsVolume(){return this.model().dataSources().some((e=>(0,Ws.isStudy)(e)&&"Volume"===e.metaInfo().shortId))}containsStudy(e){return this.containsStudyByPredicate((t=>t.id===e||t.fullId===e))}isSmall(){return this._width()<550||this._height()<300}onCmeWidget(){return"cme"===this._widgetCustomer}widgetCustomer(){return this._widgetCustomer}compareSymbols(){return this._compareSymbols}images(e){window.TradingView.printing=!0;const t=this.model().selection().allSources();this.model().selectionMacro((e=>e.clearSelection())),this.model().model().recalculateAllPanes((0,wi.globalChangeEvent)());const i=(t,i)=>{t.paint(i,ao.InvalidationMask.timeScale(ao.InvalidationLevel.Light,!0).invalidationForTimeScale());const s={showCollapsedStudies:Boolean(e?.showCollapsedStudies),status:e?.status};return t.getScreenshotData(s)},s=[],o=this.maximizedPaneWidget();if(null!==o){const e=this._paneWidgets.value().indexOf(o);s.push(i(o,ao.InvalidationMask.light().invalidationForPane(e)))}else{const e=this._paneWidgets.value();e.forEach(((t,o)=>{s.push(i(t,ao.InvalidationMask.light().invalidationForPane(o))),o{t.forEach((t=>{e.addSourceToSelection(t)}))})),this.model().model().recalculateAllPanes((0,wi.globalChangeEvent)()),this.model().model().lightUpdate();const r=this.mainSeriesQuotesAndMetainfo();return{panes:s,timeAxis:n,colors:{text:this.properties().childs().scalesProperties.childs().textColor.value(),bg:this.properties().childs().paneProperties.childs().background.value(),scales:this.properties().childs().scalesProperties.childs().lineColor.value()},meta:r.meta,ohlc:r.ohlc,quotes:r.quotes}}insertStudy(e,t,i,s,o){return this._insertStudyOrReplaceStub(e,t,void 0,i,s,o)}replaceStubByStudy(e,t,i,s,o,n){return e.updateDescriptor(t),this._insertStudyOrReplaceStub(t,i,e,s,o,n)}addOverlayStudy(e,t,i){const s=this.model();return this._options&&this._options.isSymbolAvailable?this._options.isSymbolAvailable(e).then((async o=>{if(!o)return null;await(0,os.studyMetaInfoRepository)().requestMetaInfo();const n=s.createStudyInserter({type:"java",studyId:"Overlay@tv-basicstudies"},[]),r={allowExtendTimeScale:i};if(l.enabled("use_overrides_for_overlay")){const e=(0,h.factoryDefaults)("study_Overlay@tv-basicstudies.style");r.style=e}return n.setPropertiesState(r),n.setForceOverlay(t),n.insert((()=>Promise.resolve({inputs:{symbol:e},parentSources:[]})))})):Promise.resolve(null)}addCompareStudy(e){const t=this.model();return this._options&&this._options.isSymbolAvailable?this._options.isSymbolAvailable(e).then((async i=>i?(await(0, os.studyMetaInfoRepository)().requestMetaInfo(),t.createStudyInserter({type:"java",studyId:"Compare@tv-basicstudies"},[]).insert((()=>Promise.resolve({inputs:{symbol:e},parentSources:[]})))):null)):Promise.resolve(null)}showIndicators(e,t){if(window.studyMarket)return window.studyMarket.visible().value()?void window.studyMarket.hide():(window.studyMarket.show(e,t),window.studyMarket)}setSaveChartService(e){this._saveChartService=e,null!==this._lineToolsSynchronizer&&this._lineToolsSynchronizer.setSaveChartService(e)}getSaveChartService(){return this._saveChartService}mainSeriesQuotesAndMetainfo(){let e,t,i;const s=this._model&&this._model.mainSeries();if(s){const o=e=>null==e?"":s.formatter().format(e,{signNegative:!0,useRtlFormat:!1}),n=e=>null==e?"":e+"";e={resolution:s.interval(),symbol:s.symbol(),values:s.legendValuesProvider().getValues(null)};const r=s.symbolInfo();r&&(e.symbol=r.full_name,e.description=r.description,e.exchange=r.exchange);const a=s.bars().last();null!==a&&(t=a.value.slice(1,5).map(o));const l=s.quotes();l&&(i={change:o(l.change),changePercent:n(l.change_percent),last:o(l.last_price)})}return{meta:e,ohlc:t,quotes:i}}isMultipleLayout(){return this._isMultipleLayout}updateCrossHairPositionIfNeeded(){if(this._model){const e=(0,lo.lastMouseOrTouchEventInfo)();if(e.isTouch){const t=this.maximizedPaneWidget()||this._paneWidgets.value()[0];if(t.hasState()&&(!e.stylus&&(this._isLineToolModeExceptBrush()||(0,mt.toolIsMeasure)(mt.tool.value()))||this.selectPointMode().value()!==mt.SelectPointMode.None)){const e=.5*this._model.model().timeScale().width(),i=.5*t.state().defaultPriceScale().height();t.setCursorPosition(e,i)}const i=this._model.model().crosshairSource();i.updateAllViews((0,wi.sourceChangeEvent)(i.id()))}}}trackingModePaneWidget(){if(!(0,lo.lastMouseOrTouchEventInfo)().isTouch)return null;for(const e of this.paneWidgets())if(e.trackingModeEnabled())return e;return null}startTrackingMode(){if((0,lo.lastMouseOrTouchEventInfo)().isTouch){this.exitTrackingMode(),this.updateCrossHairPositionIfNeeded();const e=this.maximizedPaneWidget()||this._paneWidgets.value()[0],t=this.model().model().crosshairSource().currentPoint();e.startTrackingMode(t,t)}}exitTrackingMode(){(0,lo.lastMouseOrTouchEventInfo)().isTouch&&this.paneWidgets().some((e=>e.trackingModeEnabled()))&&(this.paneWidgets().forEach((e=>e.exitTrackingMode())),this.model().model().clearCurrentPosition())}onToolChanged(){const e=this.model().model();e.lineBeingCreated()&&!e.lineBeingCreateFromExternal()&&this._cancelCreatingLine(),this.selectPointMode().value()!==mt.SelectPointMode.None&&this.cancelRequestSelectPoint(),this.exitTrackingMode()}setInLoadingState(e){this._inLoadingState=e}paint(e){const t=e??ao.InvalidationMask.full();t.validationActions().forEach((e=>e()));const i=this.maximizedPaneWidget();this._paneWidgets.value().forEach(((e,s)=>{null!==i&&i!==e||e.paint(t.invalidationForPane(s),t.invalidationForTimeScale())})),this._timeAxisWidget&&this._timeAxisWidget.paint(t.invalidationForTimeScale()),this._redraw.fire()}GUIResetScales(){ @@ -712,17 +712,17 @@ this._bottomToolbarDestroyer=()=>{null!==this._bottomToolbarWidget&&(this._botto h.onScroll().subscribe(this,(()=>this._onScroll.fire())),h.withModel(null,(()=>{h.lineToolsSynchronizer()?.hasChanges().subscribe(this._recalcHasChanges,{callWithLast:!0})})),s.destroy=()=>{if(s.rdState.owner.unsubscribe(o),s.hiddenInLayout.unsubscribe(r),s.collapsed.unsubscribe(a),this._options.resizerBridge.visible.unsubscribe(l),h.linkingGroupIndex().unsubscribe(this._updateLinkingGroupCharts),h.onZoom().unsubscribeAll(this),h.onScroll().unsubscribeAll(this),h.lineToolsSynchronizer()?.hasChanges().unsubscribe(this._recalcHasChanges),s.timingsMeter?.destroy(),s.rdState.destroy(),h.destroy(),h.hasModel()){const e=h.model().mainSeries();e.intervalObj().unsubscribe(d),e.lastSplits().unsubscribe(u)}},this._chartWidgetCreatedDelegate.fire(h),s}_addNewChartWidget(e,t){let i,s=this._savedChartWidgetOptions.shift();if(void 0!==s){const e=this.activeChartWidget.value();e&&e.lineToolsSynchronizer()&&(i=e.lineToolsAndGroupsDTO())}else s=this._getCopiedChartStateAsWidgetContent();const o={...this._widgetOptions,...s,...0===e||this._symbolLock.value()?void 0:{defSymbol:null}},n=this._createChartWidget(o),{chartWidget:r}=n;return r.modelCreated().subscribe(null,(()=>{t?t():this._checkAllPendingModelsAlreadyCreated(),this._dateRangeLock.value()&&r===this.activeChartWidget.value()&&this._subscribeToCompletedEventForDateRangeSync(r,!0);const e=r.lineToolsSynchronizer();void 0!==i&&e&&[...i.entries()].map((([t,i])=>{0!==t&&e.applyDTO(i,t).then((()=>{e.invalidateAll(!0)}))}));let s=!1;const o=()=>{const e=this._chartWidgetsDefs.filter((e=>(e.chartWidget!==r||!s)&&e.chartWidget.hasModel())).map((e=>e.chartWidget.model()));this._chartModels.setValue(e)};o(),r.onAboutToBeDestroyed().subscribe(null,(()=>{s=!0,o()}))}),!0),n}_subscribeToCompletedEventForDateRangeSync(e,t){const i=e.id();if(vf.has(i))return;const s=()=>{vf.has(i)&&(vf.delete(i),this._syncChartsDateRangesWithActiveChartRange(t?e:void 0))};e.model().mainSeries().dataEvents().completed().subscribe(null,s,!0),vf.set(i,{cw:e,callback:s})}_syncChartsDateRangesWithActiveChartRange(e){if(!this._dateRangeLock.value()||null!==this._currentLayoutResizeAction.value())return;const t=this.activeChartWidget.value(),i=t.model().mainSeries();if(!(0,xt.isTimeBasedStyle)(i.style()))return;const s=t.model().timeScale(),o=s.visibleBarsStrictRange();if(null===o)return;const r=(0,n.ensureNotNull)(s.points().range().value());let a=s.indexToTimePoint(o.firstBar());null===a&&i.endOfData()&&(a=s.indexToTimePoint(r.firstIndex));let l=s.indexToTimePoint(o.lastBar());if(null===l&&(l=s.indexToTimePoint(r.lastIndex)),null===a||null===l)return void this._subscribeToCompletedEventForDateRangeSync(t,!1);vf.delete(t.id());let c=1e3*a,h=1e3*l;if(i.isDWM()){const e=new Date(c),t=new Date(h);(0,Ce.set_hms)(e,0,0,0,0),(0,Ce.set_hms)(t,0,0,0,0),c=e.getTime(),h=t.getTime()}for(let i=0;i{})),ee.emit("sync_date_range",t,i)}_hideChart(e){e.hiddenInLayout.setValue(!0);const t=e.container.value();t.parentNode&&t.parentNode.removeChild(t)}_updateChartsVisibility(){const{count:e}=this._layoutTemplate.value(),t=this._maximizedChartDef.value();this._chartWidgetsDefs.forEach(((i,s)=>{(t?t===i:s1)}_getStateForChartImpl(e,t,i,s,o,n){if(e{return{...e,sources:(t=e.sources,t.filter((e=>!(0,Lt.isLineToolName)(e.type))))};var t})))}):r;var a,l}_chartsCountToSave(){return this._actualLayoutCount()}_updateActiveChartInterval(){const e=this.activeChartWidget.value();e?.hasModel()&&this._activeChartInterval.setValue(e.model().mainSeries().intervalObj().value())}_createCombineTrackTimeLock(){return(0,ft.combine)(((e,t)=>e||t),this._trackTimeLock.weakReference(),this._someOfWidgetsAreInSelectingReplayPointMode(this._layoutWV,this._chartWidgetsDefs).ownership())}_someOfWidgetsAreInSelectingReplayPointMode(e,t){return new O.WatchedValue(!1).spawn()}_getChartWidgetsForIntervalLock(){return(this._intervalLock.value()?this._chartWidgetsDefs.map((e=>e.chartWidget)):[this.activeChartWidget.value()]).filter((e=>e.hasModel()))}_applyResolution(e,t,i=this.activeChartWidget.value()){const s=this._flags;if((0,ht.setLastUsedResolution)(e),s.setNewResolution=!0,void 0===t&&(t=i.linkingGroupIndex().value()),this._intervalLock.value())for(const t of this._chartWidgetsDefs){const i=t.chartWidget;i.resolutionWV().value()!==e&&i.setResolution(e)}else i.setResolution(e);s.setNewResolution=!1}async _checkForLineToolsSplitsAdjustment(e){1}_clearSplitters(e=0){const t=this._splitters.value();t.splice(e).forEach((e=>{e.splitterElement.remove(),e.mouseListener.destroy(),e.mouseHandler.destroy()})),this._splitters.setValue([...t])}_recalculateMaximizedChartDef(){this._maximizedChartDef.setValue(null)}_validateLayoutSizes(e){}_validateLayoutSizesState(e,t){}_validateLayoutSizesStateRecursive(e,t,i,s){}}var xf=i(69455) ;const Mf=["LineToolTrendLine","LineToolRay","LineToolInfoLine","LineToolExtended","LineToolRegressionTrend","LineToolRotatedRectangle","LineToolParallelChannel","LineToolFlatBottom","LineToolDisjointAngle","LineToolPitchfork","LineToolSchiffPitchfork","LineToolSchiffPitchfork2","LineToolInsidePitchfork","LineToolVertLine","LineToolCrossLine","LineToolHorzLine","LineToolHorzRay","LineToolTrendAngle"];function If(e,t=!1,s=!1){if(!l.enabled("popup_hints"))return()=>{};const o=e.getContainer();let r=null,c=null;return mt.tool.subscribe(h),mt.createdLineTool.subscribe(null,u),mt.finishedLineTool.subscribe(null,_),e.layoutSizesChanged().subscribe(p),t||ze.CheckMobile.any()||!g("hint.startFocusedZoom")||(c=function(e,t){let i=!1;const s=o=>{o?(i&&t(o),e.onZoom().unsubscribe(null,s)):i||(t(o),i=!0)};return e.onZoom().subscribe(null,s),()=>e.onZoom().unsubscribe(null,s)}(e,(function(e){if(!g("hint.startFocusedZoom"))return;if(e)r&&(c=null,f("hint.startFocusedZoom"));else{m(a.t(null,void 0,i(81712)).format({key:(0,gt.humanReadableModifiers)(gt.Modifiers.Mod,!1)}),"hint.startFocusedZoom")}}))),()=>{mt.tool.unsubscribe(h),mt.createdLineTool.unsubscribe(null,u),mt.finishedLineTool.unsubscribe(null,_),e.layoutSizesChanged().unsubscribe(p),c?.()};function h(){const e=mt.tool.value(),t=ze.CheckMobile.any();if(!t&&(0,mt.toolIsDemonstration)(e)&&g("hint.demonstrationCursorSelected")){return void m(a.t(null,void 0,i(87133)).format({key:(0,gt.humanReadableModifiers)(gt.Modifiers.Alt,!1)}),"hint.demonstrationCursorSelected")}if(s&&t&&(o=e,Mf.includes(o)))return void async function(){0}();var o;if("LineToolTextAbsolute"===e&&g("hint.anchoredTextWillBeRemoved"))return void m(a.t(null,void 0,i(77705)),"hint.anchoredTextWillBeRemoved");if(!g("hint.touchPainting"))return;const n=(0,Lt.isLineToolDrawWithoutPoints)(e);!(0,Lt.isStudyLineToolName)(e)||"LineToolRegressionTrend"===e||n||t?(0,Lt.isLineToolName)(e)&&!(0,Lt.isLineDrawnWithPressedButton)(e)&&!n&&t?m(a.t(null,void 0,i(60663)),"hint.touchPainting"):r&&r.hide():m(a.t(null,void 0,i(14985)),"hint.touchPainting")}function u(){const e=mt.tool.value();"LineToolPath"===e&&g("hint.finishBuildPathByDblClick")?m(a.t(null,void 0,i(75296)),"hint.finishBuildPathByDblClick"):"LineToolPolyline"===e&&g("hint.finishBuildPolylineByDblClick")&&m(a.t(null,void 0,i(17409)),"hint.finishBuildPolylineByDblClick")}function _(){if(r){const e=mt.tool.value();"LineToolPath"===e?f("hint.finishBuildPathByDblClick"):"LineToolPolyline"===e&&f("hint.finishBuildPolylineByDblClick")}}function p(){if(!g("hint.startResizingChartInLayout"))return;m(ze.CheckMobile.any()?a.t(null,void 0,i(36539)):a.t(null,void 0,i(9430)),"hint.startResizingChartInLayout")}function m(e,t){if(r)r.show(e,f.bind(null,t));else{const s=mt.tool.value();Promise.all([i.e(6195),i.e(628),i.e(2227),i.e(6166)]).then(i.bind(i,91759)).then((i=>{r=new i.ChartEventHintRenderer(o),s===mt.tool.value()&&r.show(e,f.bind(null,t))}))}}function g(e){return!Boolean(d.getBool(e))}function f(e){d.setValue(e,!0,{forceFlush:!0}),(0,n.ensureNotNull)(r).destroy(), -null!==c&&c(),r=null}}class Af{constructor(e,t,i){this.handler=e,this.customId=t,this.singleShot=i}}function Lf(e,t){return`${e}__${t}`}function kf(e){for(const t of Object.keys(e)){const i=e[t];if((0,tt.isObject)(i))throw new Error(`Study with non-simple inputs cannot be created: ${t}=${JSON.stringify(i)}`)}return e}class Ef{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)=>{const t=e[0];if(!Array.isArray(t)||t.length<6)return;const i={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=new Map,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(){return this._studyEngine.supportedResolutions()||["1","3","5","15","30","45","60","120","180","240","1D","1W","1M"]}availableCurrencies(){const e=this._studyEngine.supportedCurrencies().map((e=>"string"==typeof e?{id:e,code:e}:e));return Promise.resolve(e)}availableUnits(){return Promise.resolve(this._studyEngine.supportedUnits())}async availablePriceSources(e){return await this._studyEngine.supportedPriceSources(e)??[]}supportedSymbolsTypes(){return this._studyEngine.supportedSymbolsTypes()??[]}symbolsGrouping(){const e={};for(const[t,i]of Object.entries(this._studyEngine.symbolsGrouping()))e[t]=i instanceof RegExp?i:new RegExp(i);return e}start(){this._enabled=!0,this._fireEvent("start_enabled")}unsubscribe(e,t){const i=this._callbacks[e];i&&i.splice(i.indexOf(t),1)}on(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this}chartCreateSession(e,t){return this._studyEngine.chartCreateSession(e),!1}chartDeleteSession(e){return this._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){delete this._sessions[e],delete this._notificationHandlers[e],this._studyEngine.stopSources(e)}connected(){return this._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){return this._studyEngine.switchTimezone(e,t),!1}receiveLocalResponse(e){this._dispatchNotification(e),this._fireEvent("message_"+e.method,void 0,!0)}getMarks(e,t,i,s,o){const n=s;this._studyEngine.getMarks(e,t,i,n,o)}getTimescaleMarks(e,t,i,s,o){const n=s;this._studyEngine.getTimescaleMarks(e,t,i,n,o)}resolveSymbol(e,t,i,s){return this._notificationHandlers[e][t]=new Af(s,t),this._studyEngine.resolveSymbol(e,t,i),!1}requestFirstBarTime(e,t,i,s){throw new Error("Method not implemented.")}createSeries(e,t,i,s,o,n,r,a){this._notificationHandlers[e][t]=new Af((o=>{"series_completed"===o.method&&null!==r&&(this._applyTimeFrame(e,s,t,i,r),r=null),a(o)}),t);const l={countBack:n||300};return null!==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){return delete this._notificationHandlers[e][t],this._studyEngine.removeSeries(e,t),!1}setVisibleTimeRange(e,t,i,s,o,r,a,l,c,h){let d=s,u=!0!==(a=a||{}).applyDefaultRightMargin&&void 0===a.percentRightMargin&&void 0!==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));const p=()=>{const s=this._studyEngine.sessionTimeScale(e);if(null===s)return void(h&&h(new Error("Session time scale is not available")));const o=s.indexOfTime(1e3*d);let _;if(null===u)_=s.lastSessionBarIndex();else{const e=s.indexOfTime(1e3*u);_=e&&e.index}if(null===o||null===_)return void(h&&h(new Error("Bars are not available")));let p=o.index;if(o.timeMs<1e3*d&&(p+=1),!1===r){const e=(0,n.ensureNotNull)(s.firstSessionBarIndex());p_?h&&h(new Error("Invalid visible range")):(this._chartApiMessagerProvider.getChartApiMessager(e).onSeriesTimeframeUpdate(t,i,p,_,a,c),l&&setTimeout(l,0))};if(this._studyEngine.isTimeScaleExtendedTo(e,1e3*s))return void p();const m=this._chartApiMessagerProvider.getChartApiMessager(e).beforeSeriesCompleted,g=this._chartApiMessagerProvider.getChartApiMessager(e).seriesError;function f(e,s){e===t&&s===i&&(m.unsubscribe(null,f),g.unsubscribe(null,y),p())}function y(e,s){e===t&&s===i&&m.unsubscribe(null,f)}void 0!==this._setVisibleRangeTimeout[e]&&clearTimeout(this._setVisibleRangeTimeout[e]),this._setVisibleRangeTimeout[e]=window.setTimeout((()=>{delete this._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){return this._notificationHandlers[e][t]=new Af((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){const o="number"==typeof t?t:i;return this._studyEngine.extendSeriesRange(e,o),!1}allStudiesMetadata(){return this._studyMetaInfoCache.studiesMetadata()}requestMetadata(){return new Promise((e=>{const t=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){return this._isNonCountedStudy(t.id)||this.studyCounter<210?{success:!0}:{success:!1,reason:"general",limitValue:210}}getStudyCounter(e){return this.studyCounter}getFundamentalCounter(e){return 0}createStudy(e,t,i,s,o,n,r,a){if(!this.canCreateStudy(e,a).success){const e=new Error("Exceeded the limit of studies");throw e.cause="TooManyStudies",e}return this._notificationHandlers[e][t]=new Af(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]){delete this._notificationHandlers[e][t];const i=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){return this._notificationHandlers[e][t]=new Af(o,t),this._studyEngine.modifyStudy(e,t,i,kf(s)),!1}notifyStudy(e,t,i,s){throw new Error("Method not implemented.")}createPointset(e,t,i,s,o,n,r){return this._notificationHandlers[e][t]=new Af(r,t),this._studyEngine.createPointset(e,t,s,o,n),!1}modifyPointset(e,t,i,s,o){throw new Error("Method not implemented.")}removePointset(e,t){return this._notificationHandlers[e][t]=null,this._studyEngine.removePointset(e,t),!1}requestMoreTickmarks(e,t,i,s){return this._studyEngine.requestMoreTickmarks(e,i),!1}setFutureTickmarksMode(e,t){throw new Error("Method not implemented.")}serverTime(){return this._studyEngine.serverTime()}quoteCreateSession(e){return this._studyEngine.quoteCreateSession(e),!1}quoteDeleteSession(e){return this._studyEngine.quoteDeleteSession(e),!1}quoteAddSymbols(e,t){return-1!==t.indexOf(void 0)&&(console.warn("Got undefined in quoteAddSymbols"),t=t.filter((e=>!!e))),this._studyEngine.quoteAddSymbols(e,t),!1}quoteRemoveSymbols(e,t){return this._studyEngine.quoteRemoveSymbols(e,t),!1}quoteFastSymbols(e,t){return this._studyEngine.quoteFastSymbols(e,t),!1}quoteSetFields(e,t){return this._studyEngine.quoteSetFields(e,t),!1}quoteHibernateAll(e){return this._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){let r,a,l={},c=!0;if("period-back"===o.type){const t=this._studyEngine.getSeriesLastBarTime(e,i);if(null===t)return;a=t/1e3;const s=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;const d=(0,Jd.createDwmAligner)((0,n.ensureNotNull)(this._studyEngine.getSeriesInterval(e,i)),h) -;null!==d&&(a=d.timeToExchangeTradingDay(1e3*a)/1e3,r=d.timeToExchangeTradingDay(1e3*r)/1e3),l={applyDefaultRightMargin:!0},c=this._studyEngine.hasStudyWithExtendedTimeScale(e)}else r=o.from,a=o.to;this.setVisibleTimeRange(e,i,s,r,a,c,l,void 0,o,void 0)}_fireEvent(e,t,i){if(this._callbacks.hasOwnProperty(e)){const s=this._callbacks[e].slice(0);i||(this._callbacks[e]=[]);for(let e=0;ethis.isToolEnabled(e.description)||e.is_hidden_study))}isToolEnabled(e){const t=this._findTool(e);return"black"===this._studiesAccess.type?!(t&&!t.grayed):!!t}isToolGrayed(e){const t=this._findTool(e);return!(!t||!t.grayed)}_findTool(e){let t=null;for(let i=0;i{this._toolbarThemeChanged.fire(e)},this._opts=e, -k.watchedTheme.subscribe(this._onWatchedThemeChanged)}destroy(){k.watchedTheme.unsubscribe(this._onWatchedThemeChanged)}isStdTheme(){const e=this._opts.chartWidgetCollection.getAll().every((e=>null!==e.model().model().getThemeNameIfStdTheme()));return Promise.resolve(e)}async setStdTheme(e,t=!0,i){await(0,Vf.loadTheme)(this._opts.chartWidgetCollection,{themeName:e,standardTheme:!0,syncState:t,noUndo:i})}setStdThemeForLayout(e,t=!0){(0,k.setTheme)(e),t&&(0,L.syncTheme)()}getCurrentThemeName(){return(0,L.getCurrentTheme)().name}toolbarThemeChanged(){return this._toolbarThemeChanged}}function Nf(e){return e in Of}const Of={cursor:{name:"cursor",onlySelectable:!0},dot:{name:"dot",onlySelectable:!0},arrow_cursor:{name:"arrow",onlySelectable:!0},eraser:{name:"eraser",onlySelectable:!0},measure:{name:"measure",onlySelectable:!0},zoom:{name:"zoom",onlySelectable:!0},brush:{name:"LineToolBrush"},highlighter:{name:"LineToolHighlighter"},text:{name:"LineToolText"},anchored_text:{name:"LineToolTextAbsolute",isAnchored:!0},note:{name:"LineToolNote"},text_note:{name:"LineToolTextNote"},anchored_note:{name:"LineToolNoteAbsolute",isAnchored:!0},signpost:{name:"LineToolSignpost"},callout:{name:"LineToolCallout"},balloon:{name:"LineToolBalloon"},comment:{name:"LineToolComment"},arrow_up:{name:"LineToolArrowMarkUp"},arrow_down:{name:"LineToolArrowMarkDown"},arrow_left:{name:"LineToolArrowMarkLeft"},arrow_right:{name:"LineToolArrowMarkRight"},price_label:{name:"LineToolPriceLabel"},price_note:{name:"LineToolPriceNote"},arrow_marker:{name:"LineToolArrowMarker"},flag:{name:"LineToolFlagMark"},image:{name:"LineToolImage"},table:{name:"LineToolTable"},vertical_line:{name:"LineToolVertLine"},horizontal_line:{name:"LineToolHorzLine"},cross_line:{name:"LineToolCrossLine"},horizontal_ray:{name:"LineToolHorzRay"},trend_line:{name:"LineToolTrendLine"},info_line:{name:"LineToolInfoLine"},trend_angle:{name:"LineToolTrendAngle"},arrow:{name:"LineToolArrow"},ray:{name:"LineToolRay"},extended:{name:"LineToolExtended"},parallel_channel:{name:"LineToolParallelChannel"},disjoint_angle:{name:"LineToolDisjointAngle"},flat_bottom:{name:"LineToolFlatBottom"},anchored_vwap:{name:"LineToolAnchoredVWAP"},pitchfork:{name:"LineToolPitchfork"},schiff_pitchfork_modified:{name:"LineToolSchiffPitchfork"},schiff_pitchfork:{name:"LineToolSchiffPitchfork2"},inside_pitchfork:{name:"LineToolInsidePitchfork"},pitchfan:{name:"LineToolPitchfan"},gannbox:{name:"LineToolGannSquare"},gannbox_square:{name:"LineToolGannComplex"},gannbox_fixed:{name:"LineToolGannFixed"},gannbox_fan:{name:"LineToolGannFan"},fib_retracement:{name:"LineToolFibRetracement"},fib_trend_ext:{name:"LineToolTrendBasedFibExtension"},fib_speed_resist_fan:{name:"LineToolFibSpeedResistanceFan"},fib_timezone:{name:"LineToolFibTimeZone"},fib_trend_time:{name:"LineToolTrendBasedFibTime"},fib_circles:{name:"LineToolFibCircles"},fib_spiral:{name:"LineToolFibSpiral"},fib_speed_resist_arcs:{name:"LineToolFibSpeedResistanceArcs"},fib_wedge:{name:"LineToolFibWedge"},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"}};const Ff=new ae.Delegate;var Wf=i(44862),Hf=i(51829);function zf(e,t,i){if(i.isDays())return t;if(e.moveTo(1e3*t),i.isIntraday()){const i=e.indexOfBar(1e3*t);if(i<0)throw new Error(`${t} is out of the instrument session `);return e.endOfBar(i)/1e3}return e.startOfBar(Hf.SessionStage.LASTBAR_SESSION)/1e3}class Uf{constructor(e){this._timeScale=e}coordinateToTime(e){const t=this._timeScale.coordinateToIndex(e);return this._timeScale.indexToTimePoint(t)}barSpacingChanged(){return this._timeScale.barSpacingChanged()}rightOffsetChanged(){return this._timeScale.rightOffsetChanged()}setRightOffset(e){this._timeScale.setRightOffset(e)}setBarSpacing(e){this._timeScale.setBarSpacing(e)}barSpacing(){return this._timeScale.barSpacing()}rightOffset(){return this._timeScale.rightOffset()}width(){return this._timeScale.width()}defaultRightOffset(){return this._timeScale.defaultRightOffset().spawn()}defaultRightOffsetPercentage(){return this._timeScale.defaultRightOffsetPercentage().spawn()}usePercentageRightOffset(){return this._timeScale.usePercentageRightOffset().spawn()}isEmpty(){return this._timeScale.isEmpty()}scrollToFirstBar(e){this._timeScale.scrollToFirstBar(e)}scrollToRealtime(e){this._timeScale.scrollToRealtime(!1,e)}pointsCount(){return this._timeScale.points().size()}leftVisibleBarUTCTime(){const e=this._timeScale.visibleBarsStrictRange()?.firstBar()??null;return null===e?null:this._timeScale.indexToTimePoint(e)}} -const jf=new dt.TranslatedString("change timezone",a.t(null,void 0,i(20137)));class Gf{constructor(e){this._onTimezoneChanged=new ae.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(){return Pe.availableTimezones}getTimezone(){const e=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(){return this._onTimezoneChanged}}class qf{constructor(e,t){this._chartUndoModel=e,this._chartModel=e.model(),this._priceScale=t}getMode(){const e=this._priceScale.properties().childs();return e.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(){return this._priceScale.isInverted()}setInverted(e){this._priceScale.properties().childs().isInverted.setValue(e)}isLocked(){return this._priceScale.isLockScale()}setLocked(e){this._priceScale.setMode({lockScale:e})}isAutoScale(){return this._priceScale.isAutoScale()}setAutoScale(e){this._priceScale.setMode({autoScale:e})}getVisiblePriceRange(){return this._priceScale.priceRangeInPrice()}setVisiblePriceRange(e){this._priceScale.setPriceRangeInPrice(e),this._chartModel.lightUpdate()}hasMainSeries(){return this._priceScale.hasMainSeries()}getStudies(){return this._priceScale.getStudies().map((e=>e.id()))}currency(){const e=this._chartModel.availableCurrencies(),t=this._priceScale.currency(e);return null===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){const t=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(){const e=this._chartModel.availableUnits(),t=this._priceScale.unit(e);return null===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){const t=this._priceScale.mainSource()?.firstValue();return null==t?null:this._priceScale.coordinateToPrice(e,t)}measureUnitId(){const e=this._priceScale.measureUnitId(this._chartModel.availableUnits());return null===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)};var t}function Kf(e){return{id:e.id(),name:e.metaInfo().description}}const Yf=new dt.TranslatedString("change pane height",a.t(null,void 0,i(14691)));class Zf extends st.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(){const e=this._model.panes();for(let t=0;t!e.isSpeciallyZOrderedSource())).map((t=>function(e,t){return t===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(){return this._pane.height()}setHeight(e){const t=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");const s=i.indexOf(this._pane);(0,n.assert)(-1!==s,"Invalid pane index");const o=new Zf(t,s,e);this._chartWidget.model().undoHistory().pushUndoCommand(o)}moveTo(e){const t=this.paneIndex();t!==e&&((0,n.assert)(e>=0&&e({...e,id:e.id,localizedName:void 0!==e.name?(0,Jf.getTranslatedInputTitle)(e.name):""})))}function ey(e){const t={};if(e.defaults){const i=(0,Al.default)(e.defaults);t.defaults=i}return void 0!==e.plots&&(t.plots=(0,Al.default)(e.plots)),void 0!==e.styles&&(t.styles=(0,Al.default)(e.styles)),void 0!==e.bands&&(t.bands=(0,Al.default)(e.bands)),void 0!==e.filledAreas&&(t.filledAreas=(0,Al.default)(e.filledAreas)),void 0!==e.palettes&&(t.palettes=(0,Al.default)(e.palettes)),t}var ty=i(82130);class iy{constructor(e,t){this._onStudyCompleted=new ae.Delegate,this._onStudyError=new ae.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){case gh.StudyStatusType.Completed:this._onStudyCompleted.fire();break;case gh.StudyStatusType.Error:this._onStudyError.fire()}}))}isUserEditEnabled(){return this._study.userEditEnabled()}setUserEditEnabled(e){this._study.setUserEditEnabled(e)}getInputsInfo(){return Qf(this._study.metaInfo())}getInputValues(){const e=this._study.inputs({symbolsForChartApi:!1,asObject:!0});return Object.keys(e).map((t=>{const i=e[t];return{id:t,value:(0,tt.isObject)(i)?i.v:i}}))}getStyleInfo(){return ey(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){const t=this.getInputValues();for(const i of e){void 0!==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)&&new la(this._model,this._study,null).redo()}mergeDown(){this._model.isMergeDownAvailableForSource(this._study)&&new ca(this._model,this._study,null).redo()}unmergeUp(){this._model.isUnmergeAvailableForSource(this._study)&&new na(this._model,this._study,null).redo()}unmergeDown(){this._model.isUnmergeAvailableForSource(this._study)&&new oa(this._model,this._study,null).redo()}paneIndex(){return this._model.panes().indexOf(this._model.paneForSource(this._study))}onDataLoaded(){return this._onStudyCompleted}onStudyError(){return this._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(){return new qf(this._undoModel,(0,n.ensureNotNull)(this._study.priceScale()))}symbolSource(){const e=(0,n.ensureNotNull)(this._study.symbolSource());return{symbol:e.symbol(),currencyId:e.currency(),unitId:e.unit()}}currency(){return this._study.currency()}changePriceScale(e){const t=(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"),new Tl(this._model,this._study,i,"overlay",null).redo();break;case"as-series":(0,n.assert)(i===t,"Study should be on the main pane"),new Pl(this._model,this._study,i,this._model.mainSeries().priceScale(),null).redo();break;case"new-left":new Tl(this._model,this._study,i,"left",null).redo();break;case"new-right":new Tl(this._model,this._study,i,"right",null).redo();break;default:const s=this._model.dataSourceForId(e);if(null===s)throw new Error(`There is no study with entityId='${e}'`);const o=i===this._model.paneForSource(s);(0,n.assert)(o,"Both studies should be on the same pane");const r=(0,n.ensureNotNull)(s.priceScale()),a=kr(this._study,r,this._model),l=ih(this._study,r,this._model);new Pl(this._model,this._study,i,r,null).redo(),null!==a&&new bl(this._model,r,a,null).redo(),null!==l&&new wl(this._model,r,l,null).redo()}}isVisible(){return this._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(){return this._study.metaInfo().plots.length>0}dataLength(){if(this._study.status().type!==gh.StudyStatusType.Completed)return 0;return this._study.metaInfo().plots.length>0?this._study.data().size():this._model.mainSeries().bars().size()}isLoading(){const e=this._study.status();return e.type===gh.StudyStatusType.Undefined||e.type===gh.StudyStatusType.Loading}hasError(){return this._study.status().type===gh.StudyStatusType.Error}hasPendingUnresolvedSymbols(){return this._study.hasPendingUnresolvedSymbols()}anyGraphicsReady(){return!(0,ty.isStudyGraphicsEmpty)(this._study.graphics())}graphicsViewsReady(){return this._study.graphicsViewsReady()}properties(){return this._study.properties()}setProperties(e){this._study.properties().mergeAndFire(e)}async applyToEntireLayout(){const{ActionsProvider:e}=await(0,Go.actionsProviderModule)();if(this._isStudyDestroyed)return;const t=new e(this._chartWidget),i=(await t.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(){return this._study.title(pa.TitleDisplayTarget.StatusLine)}symbolsResolved(){return this._study.symbolsResolved()}study(){return this._study}}const sy=new Map([["LineToolBezierQuadro",3],["LineToolBezierCubic",4]]);function oy(e){const t=sy.get(e.toolname);if(void 0!==t)return t;const i=e.pointsCount();return-1===i?e.points().length:i}function ny(e){return"LineToolRiskRewardLong"===e||"LineToolRiskRewardShort"===e}const ry=["alwaysShowStats","entryPrice","inputs.first bar time","inputs.last bar time","interval","linesWidths","points","snapTo45Degrees","stopPrice","symbol","symbolStateVersion","currencyId","unitId","targetPrice","zOrderVersion"];class ay{constructor(e,t,i){this._source=e,this._undoModel=t,this._model=t.model(),this._pointsConverter=i}isSelectionEnabled(){return this._source.isSelectionEnabled()}setSelectionEnabled(e){this._source.setSelectionEnabled(e)}isSavingEnabled(){return this._source.isSavedInChart()}setSavingEnabled(e){this._source.setSavingInChartEnabled(e)}isShowInObjectsTreeEnabled(){return this._source.showInObjectTree()}setShowInObjectsTreeEnabled(e){this._source.setShowInObjectsTreeEnabled(e)}isUserEditEnabled(){return this._source.userEditEnabled()}setUserEditEnabled(e){this._source.setUserEditEnabled(e)}bringToFront(){this._model.bringToFront([this._source])}sendToBack(){this._model.sendToBack([this._source])}getProperties(e,t){return this._source.properties().state(ry,e,t)}setProperties(e,t){(0,yi.allowSavingDefaults)(!!t),this._source.properties().mergeAndFire(e),(0,yi.allowSavingDefaults)(!1)}getPoints(){let e=this._source.points();const t=oy(this._source);return e.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;const t=oy(this._source);if(t!==e.length)throw new Error(`Wrong points count. Required: ${t}, provided: ${e.length}`);const i=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(){return this._source.positionPercents()}setAnchoredPosition(e){const t=this._source.fixedPoint(),i=this._source.linkKey().value(),s=void 0===t?null:this._source.screenPointToPoint(t);if(!this._source.isFixed()||void 0===t||null===i||null===s)return;const o={logical:s,screen:t},n=new Map;n.set(i,e),this._model.startMovingSources([this._source],o,null,new Map),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;const i=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}}class Af{constructor(e,t,i){this.handler=e,this.customId=t,this.singleShot=i}}function Lf(e,t){return`${e}__${t}`}function kf(e){for(const t of Object.keys(e)){const i=e[t];if((0,tt.isObject)(i))throw new Error(`Study with non-simple inputs cannot be created: ${t}=${JSON.stringify(i)}`)}return e}class Ef{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)=>{const t=e[0];if(!Array.isArray(t?.value)||t.value.length<6)return;const i={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=new Map,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(){return this._studyEngine.supportedResolutions()||["1","3","5","15","30","45","60","120","180","240","1D","1W","1M"]}availableCurrencies(){const e=this._studyEngine.supportedCurrencies().map((e=>"string"==typeof e?{id:e,code:e}:e));return Promise.resolve(e)}availableUnits(){return Promise.resolve(this._studyEngine.supportedUnits())}async availablePriceSources(e){return await this._studyEngine.supportedPriceSources(e)??[]}supportedSymbolsTypes(){return this._studyEngine.supportedSymbolsTypes()??[]}symbolsGrouping(){const e={};for(const[t,i]of Object.entries(this._studyEngine.symbolsGrouping()))e[t]=i instanceof RegExp?i:new RegExp(i);return e}start(){this._enabled=!0,this._fireEvent("start_enabled")}unsubscribe(e,t){const i=this._callbacks[e];i&&i.splice(i.indexOf(t),1)}on(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this}chartCreateSession(e,t){return this._studyEngine.chartCreateSession(e),!1}chartDeleteSession(e){return this._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){delete this._sessions[e],delete this._notificationHandlers[e],this._studyEngine.stopSources(e)}connected(){return this._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){return this._studyEngine.switchTimezone(e,t),!1}receiveLocalResponse(e){this._dispatchNotification(e),this._fireEvent("message_"+e.method,void 0,!0)}getMarks(e,t,i,s,o){const n=s;this._studyEngine.getMarks(e,t,i,n,o)}getTimescaleMarks(e,t,i,s,o){const n=s;this._studyEngine.getTimescaleMarks(e,t,i,n,o)}resolveSymbol(e,t,i,s){return this._notificationHandlers[e][t]=new Af(s,t),this._studyEngine.resolveSymbol(e,t,i),!1}requestFirstBarTime(e,t,i,s){throw new Error("Method not implemented.")}createSeries(e,t,i,s,o,n,r,a){this._notificationHandlers[e][t]=new Af((o=>{"series_completed"===o.method&&null!==r&&(this._applyTimeFrame(e,s,t,i,r),r=null),a(o)}),t);const l={countBack:n||300};return null!==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){return delete this._notificationHandlers[e][t],this._studyEngine.removeSeries(e,t),!1}setVisibleTimeRange(e,t,i,s,o,r,a,l,c,h){let d=s,u=!0!==(a=a||{}).applyDefaultRightMargin&&void 0===a.percentRightMargin&&void 0!==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));const p=()=>{const s=this._studyEngine.sessionTimeScale(e);if(null===s)return void(h&&h(new Error("Session time scale is not available")));const o=s.indexOfTime(1e3*d);let _;if(null===u)_=s.lastSessionBarIndex();else{const e=s.indexOfTime(1e3*u);_=e&&e.index}if(null===o||null===_)return void(h&&h(new Error("Bars are not available")));let p=o.index;if(o.timeMs<1e3*d&&(p+=1),!1===r){const e=(0,n.ensureNotNull)(s.firstSessionBarIndex());p_?h&&h(new Error("Invalid visible range")):(this._chartApiMessagerProvider.getChartApiMessager(e).onSeriesTimeframeUpdate(t,i,p,_,a,c),l&&setTimeout(l,0))};if(this._studyEngine.isTimeScaleExtendedTo(e,1e3*s))return void p();const m=this._chartApiMessagerProvider.getChartApiMessager(e).beforeSeriesCompleted,g=this._chartApiMessagerProvider.getChartApiMessager(e).seriesError;function f(e,s){e===t&&s===i&&(m.unsubscribe(null,f),g.unsubscribe(null,y),p())}function y(e,s){e===t&&s===i&&m.unsubscribe(null,f)}void 0!==this._setVisibleRangeTimeout[e]&&clearTimeout(this._setVisibleRangeTimeout[e]),this._setVisibleRangeTimeout[e]=window.setTimeout((()=>{delete this._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){return this._notificationHandlers[e][t]=new Af((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){const o="number"==typeof t?t:i;return this._studyEngine.extendSeriesRange(e,o),!1}allStudiesMetadata(){return this._studyMetaInfoCache.studiesMetadata()}requestMetadata(){return new Promise((e=>{const t=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){return this._isNonCountedStudy(t.id)||this.studyCounter<210?{success:!0}:{success:!1,reason:"general",limitValue:210}}getStudyCounter(e){return this.studyCounter}getFundamentalCounter(e){return 0}createStudy(e,t,i,s,o,n,r,a){if(!this.canCreateStudy(e,a).success){const e=new Error("Exceeded the limit of studies");throw e.cause="TooManyStudies",e}return this._notificationHandlers[e][t]=new Af(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]){delete this._notificationHandlers[e][t];const i=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){return this._notificationHandlers[e][t]=new Af(o,t),this._studyEngine.modifyStudy(e,t,i,kf(s)),!1}notifyStudy(e,t,i,s){throw new Error("Method not implemented.")}createPointset(e,t,i,s,o,n,r){return this._notificationHandlers[e][t]=new Af(r,t),this._studyEngine.createPointset(e,t,s,o,n),!1}modifyPointset(e,t,i,s,o){throw new Error("Method not implemented.")}removePointset(e,t){return this._notificationHandlers[e][t]=null,this._studyEngine.removePointset(e,t),!1}requestMoreTickmarks(e,t,i,s){return this._studyEngine.requestMoreTickmarks(e,i),!1}setFutureTickmarksMode(e,t){throw new Error("Method not implemented.")}serverTime(){return this._studyEngine.serverTime()}quoteCreateSession(e){return this._studyEngine.quoteCreateSession(e),!1}quoteDeleteSession(e){return this._studyEngine.quoteDeleteSession(e),!1}quoteAddSymbols(e,t){return-1!==t.indexOf(void 0)&&(console.warn("Got undefined in quoteAddSymbols"),t=t.filter((e=>!!e))),this._studyEngine.quoteAddSymbols(e,t),!1}quoteRemoveSymbols(e,t){return this._studyEngine.quoteRemoveSymbols(e,t),!1}quoteFastSymbols(e,t){return this._studyEngine.quoteFastSymbols(e,t),!1}quoteSetFields(e,t){return this._studyEngine.quoteSetFields(e,t),!1}quoteHibernateAll(e){return this._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){let r,a,l={},c=!0;if("period-back"===o.type){const t=this._studyEngine.getSeriesLastBarTime(e,i);if(null===t)return;a=t/1e3;const s=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;const d=(0, +Jd.createDwmAligner)((0,n.ensureNotNull)(this._studyEngine.getSeriesInterval(e,i)),h);null!==d&&(a=d.timeToExchangeTradingDay(1e3*a)/1e3,r=d.timeToExchangeTradingDay(1e3*r)/1e3),l={applyDefaultRightMargin:!0},c=this._studyEngine.hasStudyWithExtendedTimeScale(e)}else r=o.from,a=o.to;this.setVisibleTimeRange(e,i,s,r,a,c,l,void 0,o,void 0)}_fireEvent(e,t,i){if(this._callbacks.hasOwnProperty(e)){const s=this._callbacks[e].slice(0);i||(this._callbacks[e]=[]);for(let e=0;ethis.isToolEnabled(e.description)||e.is_hidden_study))}isToolEnabled(e){const t=this._findTool(e);return"black"===this._studiesAccess.type?!(t&&!t.grayed):!!t}isToolGrayed(e){const t=this._findTool(e);return!(!t||!t.grayed)}_findTool(e){let t=null;for(let i=0;i{ +this._toolbarThemeChanged.fire(e)},this._opts=e,k.watchedTheme.subscribe(this._onWatchedThemeChanged)}destroy(){k.watchedTheme.unsubscribe(this._onWatchedThemeChanged)}isStdTheme(){const e=this._opts.chartWidgetCollection.getAll().every((e=>null!==e.model().model().getThemeNameIfStdTheme()));return Promise.resolve(e)}async setStdTheme(e,t=!0,i){await(0,Vf.loadTheme)(this._opts.chartWidgetCollection,{themeName:e,standardTheme:!0,syncState:t,noUndo:i})}setStdThemeForLayout(e,t=!0){(0,k.setTheme)(e),t&&(0,L.syncTheme)()}getCurrentThemeName(){return(0,L.getCurrentTheme)().name}toolbarThemeChanged(){return this._toolbarThemeChanged}}function Nf(e){return e in Of}const Of={cursor:{name:"cursor",onlySelectable:!0},dot:{name:"dot",onlySelectable:!0},arrow_cursor:{name:"arrow",onlySelectable:!0},eraser:{name:"eraser",onlySelectable:!0},measure:{name:"measure",onlySelectable:!0},zoom:{name:"zoom",onlySelectable:!0},brush:{name:"LineToolBrush"},highlighter:{name:"LineToolHighlighter"},text:{name:"LineToolText"},anchored_text:{name:"LineToolTextAbsolute",isAnchored:!0},note:{name:"LineToolNote"},text_note:{name:"LineToolTextNote"},anchored_note:{name:"LineToolNoteAbsolute",isAnchored:!0},signpost:{name:"LineToolSignpost"},callout:{name:"LineToolCallout"},balloon:{name:"LineToolBalloon"},comment:{name:"LineToolComment"},arrow_up:{name:"LineToolArrowMarkUp"},arrow_down:{name:"LineToolArrowMarkDown"},arrow_left:{name:"LineToolArrowMarkLeft"},arrow_right:{name:"LineToolArrowMarkRight"},price_label:{name:"LineToolPriceLabel"},price_note:{name:"LineToolPriceNote"},arrow_marker:{name:"LineToolArrowMarker"},flag:{name:"LineToolFlagMark"},image:{name:"LineToolImage"},table:{name:"LineToolTable"},vertical_line:{name:"LineToolVertLine"},horizontal_line:{name:"LineToolHorzLine"},cross_line:{name:"LineToolCrossLine"},horizontal_ray:{name:"LineToolHorzRay"},trend_line:{name:"LineToolTrendLine"},info_line:{name:"LineToolInfoLine"},trend_angle:{name:"LineToolTrendAngle"},arrow:{name:"LineToolArrow"},ray:{name:"LineToolRay"},extended:{name:"LineToolExtended"},parallel_channel:{name:"LineToolParallelChannel"},disjoint_angle:{name:"LineToolDisjointAngle"},flat_bottom:{name:"LineToolFlatBottom"},anchored_vwap:{name:"LineToolAnchoredVWAP"},pitchfork:{name:"LineToolPitchfork"},schiff_pitchfork_modified:{name:"LineToolSchiffPitchfork"},schiff_pitchfork:{name:"LineToolSchiffPitchfork2"},inside_pitchfork:{name:"LineToolInsidePitchfork"},pitchfan:{name:"LineToolPitchfan"},gannbox:{name:"LineToolGannSquare"},gannbox_square:{name:"LineToolGannComplex"},gannbox_fixed:{name:"LineToolGannFixed"},gannbox_fan:{name:"LineToolGannFan"},fib_retracement:{name:"LineToolFibRetracement"},fib_trend_ext:{name:"LineToolTrendBasedFibExtension"},fib_speed_resist_fan:{name:"LineToolFibSpeedResistanceFan"},fib_timezone:{name:"LineToolFibTimeZone"},fib_trend_time:{name:"LineToolTrendBasedFibTime"},fib_circles:{name:"LineToolFibCircles"},fib_spiral:{name:"LineToolFibSpiral"},fib_speed_resist_arcs:{name:"LineToolFibSpeedResistanceArcs"},fib_wedge:{name:"LineToolFibWedge"}, +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"}};const Ff=new ae.Delegate;var Wf=i(44862),Hf=i(51829);function zf(e,t,i){if(i.isDays())return t;if(e.moveTo(1e3*t),i.isIntraday()){const i=e.indexOfBar(1e3*t);if(i<0)throw new Error(`${t} is out of the instrument session `);return e.endOfBar(i)/1e3}return e.startOfBar(Hf.SessionStage.LASTBAR_SESSION)/1e3}class Uf{constructor(e){this._timeScale=e}coordinateToTime(e){const t=this._timeScale.coordinateToIndex(e);return this._timeScale.indexToTimePoint(t)}barSpacingChanged(){return this._timeScale.barSpacingChanged()}rightOffsetChanged(){return this._timeScale.rightOffsetChanged()}setRightOffset(e){this._timeScale.setRightOffset(e)}setBarSpacing(e){this._timeScale.setBarSpacing(e)}barSpacing(){return this._timeScale.barSpacing()}rightOffset(){return this._timeScale.rightOffset()}width(){return this._timeScale.width()}defaultRightOffset(){return this._timeScale.defaultRightOffset().spawn()}defaultRightOffsetPercentage(){return this._timeScale.defaultRightOffsetPercentage().spawn()}usePercentageRightOffset(){return this._timeScale.usePercentageRightOffset().spawn()}isEmpty(){return this._timeScale.isEmpty()}scrollToFirstBar(e){this._timeScale.scrollToFirstBar(e)}scrollToRealtime(e){this._timeScale.scrollToRealtime(!1,e)}pointsCount(){return this._timeScale.points().size()}leftVisibleBarUTCTime(){const e=this._timeScale.visibleBarsStrictRange()?.firstBar()??null +;return null===e?null:this._timeScale.indexToTimePoint(e)}}const jf=new dt.TranslatedString("change timezone",a.t(null,void 0,i(20137)));class Gf{constructor(e){this._onTimezoneChanged=new ae.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(){return Pe.availableTimezones}getTimezone(){const e=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(){return this._onTimezoneChanged}}class qf{constructor(e,t){this._chartUndoModel=e,this._chartModel=e.model(),this._priceScale=t}getMode(){const e=this._priceScale.properties().childs();return e.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(){return this._priceScale.isInverted()}setInverted(e){this._priceScale.properties().childs().isInverted.setValue(e)}isLocked(){return this._priceScale.isLockScale()}setLocked(e){this._priceScale.setMode({lockScale:e})}isAutoScale(){return this._priceScale.isAutoScale()}setAutoScale(e){this._priceScale.setMode({autoScale:e})}getVisiblePriceRange(){return this._priceScale.priceRangeInPrice()}setVisiblePriceRange(e){this._priceScale.setPriceRangeInPrice(e),this._chartModel.lightUpdate()}hasMainSeries(){return this._priceScale.hasMainSeries()}getStudies(){return this._priceScale.getStudies().map((e=>e.id()))}currency(){const e=this._chartModel.availableCurrencies(),t=this._priceScale.currency(e);return null===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){const t=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(){const e=this._chartModel.availableUnits(),t=this._priceScale.unit(e);return null===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){const t=this._priceScale.mainSource()?.firstValue();return null==t?null:this._priceScale.coordinateToPrice(e,t)}measureUnitId(){const e=this._priceScale.measureUnitId(this._chartModel.availableUnits());return null===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)};var t}function Kf(e){return{id:e.id(),name:e.metaInfo().description}}const Yf=new dt.TranslatedString("change pane height",a.t(null,void 0,i(14691)));class Zf extends st.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(){const e=this._model.panes();for(let t=0;t!e.isSpeciallyZOrderedSource())).map((t=>function(e,t){return t===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(){return this._pane.height()}setHeight(e){const t=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");const s=i.indexOf(this._pane);(0,n.assert)(-1!==s,"Invalid pane index");const o=new Zf(t,s,e);this._chartWidget.model().undoHistory().pushUndoCommand(o)}moveTo(e){const t=this.paneIndex();t!==e&&((0,n.assert)(e>=0&&e({...e,id:e.id,localizedName:void 0!==e.name?(0,Jf.getTranslatedInputTitle)(e.name):""})))}function ey(e){const t={};if(e.defaults){const i=(0,Al.default)(e.defaults);t.defaults=i}return void 0!==e.plots&&(t.plots=(0,Al.default)(e.plots)),void 0!==e.styles&&(t.styles=(0,Al.default)(e.styles)),void 0!==e.bands&&(t.bands=(0,Al.default)(e.bands)),void 0!==e.filledAreas&&(t.filledAreas=(0,Al.default)(e.filledAreas)),void 0!==e.palettes&&(t.palettes=(0,Al.default)(e.palettes)),t}var ty=i(82130);class iy{constructor(e,t){this._onStudyCompleted=new ae.Delegate,this._onStudyError=new ae.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){case gh.StudyStatusType.Completed:this._onStudyCompleted.fire();break;case gh.StudyStatusType.Error:this._onStudyError.fire()}}))}isUserEditEnabled(){return this._study.userEditEnabled()}setUserEditEnabled(e){this._study.setUserEditEnabled(e)}getInputsInfo(){return Qf(this._study.metaInfo())}getInputValues(){const e=this._study.inputs({symbolsForChartApi:!1,asObject:!0});return Object.keys(e).map((t=>{const i=e[t];return{id:t,value:(0,tt.isObject)(i)?i.v:i}}))}getStyleInfo(){return ey(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){const t=this.getInputValues();for(const i of e){void 0!==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)&&new la(this._model,this._study,null).redo()}mergeDown(){this._model.isMergeDownAvailableForSource(this._study)&&new ca(this._model,this._study,null).redo()}unmergeUp(){this._model.isUnmergeAvailableForSource(this._study)&&new na(this._model,this._study,null).redo()}unmergeDown(){this._model.isUnmergeAvailableForSource(this._study)&&new oa(this._model,this._study,null).redo()}paneIndex(){return this._model.panes().indexOf(this._model.paneForSource(this._study))}onDataLoaded(){return this._onStudyCompleted}onStudyError(){return this._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(){return new qf(this._undoModel,(0,n.ensureNotNull)(this._study.priceScale()))}symbolSource(){const e=(0,n.ensureNotNull)(this._study.symbolSource());return{symbol:e.symbol(),currencyId:e.currency(),unitId:e.unit()}}currency(){return this._study.currency()}changePriceScale(e){const t=(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"),new Tl(this._model,this._study,i,"overlay",null).redo();break;case"as-series":(0,n.assert)(i===t,"Study should be on the main pane"),new Pl(this._model,this._study,i,this._model.mainSeries().priceScale(),null).redo();break;case"new-left":new Tl(this._model,this._study,i,"left",null).redo();break;case"new-right":new Tl(this._model,this._study,i,"right",null).redo();break;default:const s=this._model.dataSourceForId(e);if(null===s)throw new Error(`There is no study with entityId='${e}'`);const o=i===this._model.paneForSource(s);(0,n.assert)(o,"Both studies should be on the same pane");const r=(0,n.ensureNotNull)(s.priceScale()),a=kr(this._study,r,this._model),l=ih(this._study,r,this._model);new Pl(this._model,this._study,i,r,null).redo(),null!==a&&new bl(this._model,r,a,null).redo(),null!==l&&new wl(this._model,r,l,null).redo()}}isVisible(){return this._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(){return this._study.metaInfo().plots.length>0}dataLength(){if(this._study.status().type!==gh.StudyStatusType.Completed)return 0;return this._study.metaInfo().plots.length>0?this._study.data().size():this._model.mainSeries().bars().size()}isLoading(){const e=this._study.status();return e.type===gh.StudyStatusType.Undefined||e.type===gh.StudyStatusType.Loading}hasError(){return this._study.status().type===gh.StudyStatusType.Error}hasPendingUnresolvedSymbols(){return this._study.hasPendingUnresolvedSymbols()}anyGraphicsReady(){return!(0,ty.isStudyGraphicsEmpty)(this._study.graphics())}graphicsViewsReady(){return this._study.graphicsViewsReady()}properties(){return this._study.properties()}setProperties(e){this._study.properties().mergeAndFire(e)}async applyToEntireLayout(){const{ActionsProvider:e}=await(0,Go.actionsProviderModule)();if(this._isStudyDestroyed)return;const t=new e(this._chartWidget),i=(await t.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(){return this._study.title(pa.TitleDisplayTarget.StatusLine)}symbolsResolved(){return this._study.symbolsResolved()}study(){return this._study}}const sy=new Map([["LineToolBezierQuadro",3],["LineToolBezierCubic",4]]);function oy(e){const t=sy.get(e.toolname);if(void 0!==t)return t;const i=e.pointsCount();return-1===i?e.points().length:i}function ny(e){return"LineToolRiskRewardLong"===e||"LineToolRiskRewardShort"===e}const ry=["alwaysShowStats","entryPrice","inputs.first bar time","inputs.last bar time","interval","linesWidths","points","snapTo45Degrees","stopPrice","symbol","symbolStateVersion","currencyId","unitId","targetPrice","zOrderVersion"];class ay{constructor(e,t,i){this._source=e,this._undoModel=t,this._model=t.model(),this._pointsConverter=i}isSelectionEnabled(){return this._source.isSelectionEnabled()}setSelectionEnabled(e){this._source.setSelectionEnabled(e)}isSavingEnabled(){return this._source.isSavedInChart()}setSavingEnabled(e){this._source.setSavingInChartEnabled(e)}isShowInObjectsTreeEnabled(){return this._source.showInObjectTree()}setShowInObjectsTreeEnabled(e){this._source.setShowInObjectsTreeEnabled(e)}isUserEditEnabled(){return this._source.userEditEnabled()}setUserEditEnabled(e){this._source.setUserEditEnabled(e)}bringToFront(){this._model.bringToFront([this._source])}sendToBack(){this._model.sendToBack([this._source])}getProperties(e,t){return this._source.properties().state(ry,e,t)}setProperties(e,t){(0,yi.allowSavingDefaults)(!!t),this._source.properties().mergeAndFire(e),(0,yi.allowSavingDefaults)(!1)}getPoints(){let e=this._source.points();const t=oy(this._source);return e.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;const t=oy(this._source);if(t!==e.length)throw new Error(`Wrong points count. Required: ${t}, provided: ${e.length}`);const i=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(){return this._source.positionPercents()}setAnchoredPosition(e){const t=this._source.fixedPoint(),i=this._source.linkKey().value(),s=void 0===t?null:this._source.screenPointToPoint(t);if(!this._source.isFixed()||void 0===t||null===i||null===s)return;const o={logical:s,screen:t},n=new Map;n.set(i,e),this._model.startMovingSources([this._source],o,null,new Map),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;const i=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(){ return this._source.isSourceHidden()}getRawPoints(){return this._source.points()}getNormalizedPoints(){return this._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,new Map),this._model.moveSources({logical:t,screen:(0,n.ensureNotNull)(this._source.pointToScreenPoint(t))},new Map),this._model.endMovingSources(!1)}dataAndViewsReady(){return this._source.dataAndViewsReady()}zorder(){return this._source.zorder()}symbol(){return this._source.properties().symbol.value()}currency(){return this._source.properties().currencyId.value()}unit(){return this._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(){return this._source.sharingMode().value()}lineDataSource(){return this._source}template(){return this._source.template()}}class ly{constructor(e,t){this._series=e,this._undoModel=t,this._model=t.model()}isUserEditEnabled(){return this._series.userEditEnabled()}setUserEditEnabled(e){this._series.setUserEditEnabled(e)}mergeUp(){this._model.isMergeUpAvailableForSource(this._series)&&new la(this._model,this._series,null).redo()}mergeDown(){this._model.isMergeDownAvailableForSource(this._series)&&new ca(this._model,this._series,null).redo()}unmergeUp(){this._model.isUnmergeAvailableForSource(this._series)&&new na(this._model,this._series,null).redo()}unmergeDown(){this._model.isUnmergeAvailableForSource(this._series)&&new oa(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(){new Tl(this._model,this._series,this._pane(),"right",null).redo()}detachToLeft(){new Tl(this._model,this._series,this._pane(),"left",null).redo()}detachNoScale(){new Tl(this._model,this._series,this._pane(),"overlay",null).redo()}changePriceScale(e){const t=(0,n.ensureNotNull)(this._model.paneForSource(this._series));switch(e){case"new-left":new Tl(this._model,this._series,t,"left",null).redo();break;case"new-right":new Tl(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"),new Tl(this._model,this._series,t,"overlay",null).redo();break;default:const i=this._model.dataSourceForId(e) ;if(null===i)throw new Error(`There is no study with entityId='${e}'`);const s=this._model.paneForSource(i)===t;(0,n.assert)(s,"Study should be on the main pane");const o=(0,n.ensureNotNull)(i.priceScale());new Pl(this._model,this._series,t,o,null).redo()}}isVisible(){return this._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(){return this._series.id()}chartStyleProperties(e,t){return t?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(){return this._series.bars().size()}endOfData(){return this._series.endOfData()}symbolSource(){return{symbol:this._series.symbol(),currencyId:this._series.currency(),unitId:this._series.unit()}}series(){return this._series}isLoading(){return this._series.isLoading()}isInReplay(){return this._series.isInReplay()}data(){return this._series.data()}priceScale(){return new qf(this._undoModel,this._series.priceScale())}seriesErrorMessage(){return this._series.seriesErrorMessage()}compositeStatusVW(){return this._series.compositeStatusVW()}properties(){return this._series.properties()}_pane(){return(0,n.ensureNotNull)(this._model.paneForSource(this._series))}}function cy(e){switch(e){case 0:return"barStyle";case 1:return"candleStyle";case 2:return"lineStyle";case 14:return"lineWithMarkersStyle";case 15:return"steplineStyle";case 3:return"areaStyle";case 16:return"hlcAreaStyle";case 4:return"renkoStyle";case 5:return"kagiStyle";case 6:return"pnfStyle";case 7:return"pbStyle";case 8:return"haStyle";case 9:return"hollowCandleStyle";case 10:return"baselineStyle";case 11:return"rangeStyle";case 12:return"hiloStyle";case 13:return"columnStyle";case 17:return"volFootprintStyle";case 18:return"tpoStyle";case 19:return"volCandlesStyle";case 20:return"svpStyle";case 21:return"hlcBarsStyle";default:(0,n.ensureNever)(e)}throw new Error(`unsupported chart style: ${e}`)}var hy=i(32112);function dy(e,t){const{symbolChanged:i,currencyChanged:s,unitChanged:o,styleChangeRequiresRestart:n}=e.compareSymbolParams(t);return!(i||s||o||n)}function uy(e,t){e.isLoading()&&!e.isFailed()||t(e.isFailed());const i=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(){return this._controller.createGroupFromSelection().id}removeGroup(e){const t=(0,n.ensureDefined)(this._groupById(e));this._controller.removeGroup(t)}groups(){return this._controller.groups().map((e=>e.id))}shapesInGroup(e){const t=(0, n.ensureDefined)(this._groupById(e));return(0,vi.sortSources)(t.lineTools()).map((e=>e.id()))}excludeShapeFromGroup(e,t){const i=(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){const i=(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){const t=(0,n.ensureDefined)(this._groupById(e));return this._controller.availableZOrderOperations(t)}bringToFront(e){const t=(0,n.ensureDefined)(this._groupById(e));this._controller.bringToFront(t)}bringForward(e){const t=(0,n.ensureDefined)(this._groupById(e));this._controller.bringForward(t)}sendBackward(e){const t=(0,n.ensureDefined)(this._groupById(e));this._controller.sendBackward(t)}sendToBack(e){const t=(0,n.ensureDefined)(this._groupById(e));this._controller.sendToBack(t)}insertAfter(e,t){const i=(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){const i=(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){const i=(0,n.ensureDefined)(this._groupById(e));this._controller.setGroupVisibility(i,t)}groupLock(e){return(0,n.ensureDefined)(this._groupById(e)).locked()}setGroupLock(e,t){const i=(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){const i=(0,n.ensureDefined)(this._groupById(e));this._controller.setGroupName(i,t)}canBeGroupped(e){const t=e.map((e=>(0,n.ensureNotNull)(this._model.dataSourceForId(e))));return!t.some((e=>!(0,zs.isLineTool)(e)))&&this._controller.canBeGroupped(t)}_groupById(e){return this._controller.groups().find((t=>t.id===e))}}var py=i(18041);const my=new dt.TranslatedString("change price to bar ratio",a.t(null,void 0,i(2509))),gy=new dt.TranslatedString("toggle lock scale",a.t(null,void 0,i(49695)));function fy(e,t){return t.map((t=>(0,n.ensureNotNull)(e.dataSourceForId(t))))}class yy{constructor(e,t){this._visibleBarsChanged=new ae.Delegate,this._crosshairMoved=new ae.Delegate,this._dataSourceHovered=new ae.Delegate,this._ranges=null,this._zoomUndoStackIsNotEmpty=null,this._panes=new WeakMap,this._studies=new WeakMap,this._lineDataSources=new WeakMap,this._selectionApi=null,this._lollipopSourcesApi=null,this._prevVisibleRange=null,this._prevHoveredSourceId=null,this._onSymbolChangedDelegate=new ae.Delegate,this._chartWidget=e,this._activateChart=t,this._timezoneApi=new Gf(e),this._chartWidget.withModel(this,(()=>{ @@ -730,83 +730,84 @@ this._chartWidget.model().crosshairSource().moved().subscribe(this,this._onCross }),o)}))}async setSymbol(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))return i?.(),!0;s||this._activateChart();const n=this._chartWidget.chartWidgetCollection(),r=await n.setSymbol(e,void 0,this._chartWidget);return r&&uy(this._chartWidget.model().mainSeries(),(e=>{!e&&i&&i()})),r}async setResolution(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())return i?.(),!0;s||this._activateChart();const r=await this._chartWidget.chartWidgetCollection().setResolution(n,void 0,this._chartWidget);return r&&uy(this._chartWidget.model().mainSeries(),(e=>{!e&&i&&i()})),r}async setChartType(e,t){if(this._chartWidget.model().mainSeries().properties().childs().style.value()===e)return t?.(),!0;const i=this._chartWidget.chartWidgetCollection().setChartStyleToWidget(e,this._chartWidget);return uy(this._chartWidget.model().mainSeries(),(e=>{!e&&t&&t()})),i}resetData(){this._chartWidget.model().mainSeries().rerequestData()}executeActionById(e){this._chartWidget.executeActionById(e)}getCheckableActionState(e){return this._chartWidget.getCheckableActionState(e)}refreshMarks(){this._chartWidget.refreshMarks()}clearMarks(e){this._chartWidget.clearMarks(e)}getBarsMarksSources(){return this._chartWidget.model().barsMarksSources()}getAllShapes(){return this._chartWidget.model().model().allLineTools().map($f).filter((e=>null!==e.name))}getAllStudies(){return this._chartWidget.model().model().allStudies(!0).map(Kf)}getStudyTemplateSnapshot(e,t,i){return(0,py.getStudyTemplateSaveData)(e,this._chartWidget.model().model(),t,i)}getStudyTemplateDescString(){const e=(0,py.getStudyTemplateMetaInfo)(this._chartWidget.model().model());return(0,py.getStudyTemplateDescString)(e.indicators)}async applyStudyTemplateByRecord(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?await z.backend.getStandardStudyTemplateById(i,o):await z.backend.getStudyTemplateById(i).then(o)}chartTemplate(){return this._chartWidget.model().model().template()}applyChartTempalte(e){this._chartWidget.chartWidgetCollection().applyTheme(e)}getAllPanesHeight(){const e=this._chartWidget.model().model().panes();if(this._chartWidget.hasMaximizedPane()){let t=0,i=0;e.forEach((e=>{t+=e.height(),i+=e.stretchFactor()}));const s=i/t;return e.map((e=>Math.round(e.stretchFactor()/s*100)/100))}return e.map((e=>e.height()))}setAllPanesHeight(e){const t=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.");const s=i.reduce(((e,t)=>e+t.stretchFactor()),0)/e.reduce(((e,t)=>e+t));e.forEach(((e,t)=>{const o=e*s;i[t].setStretchFactor(o)})),t.fullUpdate()}maximizeChart(){ this._chartWidget.requestFullscreen()}isMaximized(){return this._chartWidget.inFullscreen()}restoreChart(){this._chartWidget.exitFullscreen()}restoreChartPreferences(){this._chartWidget.model().restorePreferences()}availableZOrderOperations(e){const t=fy(this._chartWidget.model().model(),e);return this._chartWidget.model().availableZOrderOperations(t)}sendToBack(e){const t=fy(this._chartWidget.model().model(),e);this._chartWidget.model().sendToBack(t)}bringToFront(e){const t=fy(this._chartWidget.model().model(),e);this._chartWidget.model().bringToFront(t)}bringForward(e){const t=fy(this._chartWidget.model().model(),e);this._chartWidget.model().bringForward(t)}sendBackward(e){const t=fy(this._chartWidget.model().model(),e);this._chartWidget.model().sendBackward(t)}insertAfter(e,t){const i=this._chartWidget.model().model(),s=fy(i,e),o=(0,n.ensureNotNull)(i.dataSourceForId(t));this._chartWidget.model().insertAfter(s,o)}insertBefore(e,t){const i=this._chartWidget.model().model(),s=fy(i,e),o=(0,n.ensureNotNull)(i.dataSourceForId(t));this._chartWidget.model().insertBefore(s,o)}sessions(){return this._chartWidget.model().model().sessions()?.get()??null}chartModel(){return this._chartWidget.model().model()}chartUndoModel(){return this._chartWidget.model()}chartWidget(){return this._chartWidget}getTimeScaleLogicalRange(){return this._chartWidget.model().timeScale().logicalRange()}setEntityVisibility(e,t){console.warn("`setEntityVisibility` is deprecated. Use shape/study API instead");const i=this._chartWidget.model().model().dataSourceForId(e);if(!i)return;const s=i.properties();s&&s.visible&&s.visible.setValue(t)}async createStudy(e,t,i,s,o,n){if("function"==typeof o)return console.warn('"createStudy" does not take "callback" parameter anymore'),Promise.resolve(null);if(n=n||{},"string"!=typeof e)return this._createStudy(e);e=e.toLowerCase();const r=await(0,os.studyMetaInfoRepository)().findAllJavaStudies(),a=ns.StudyMetaInfo.findStudyMetaInfoByDescription(r,e);if(n.checkLimit){const e=this._chartWidget.model().canCreateStudy({id:a.id});if(!e.success)return(0,wr.showTooManyStudiesNotice)(e.limitValue),Promise.resolve(null)}const l=(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:throw new Error(`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.");const e={};for(let t=0;tPromise.resolve({inputs:s||{},parentSources:[] }))).then((e=>(o&&(0,Wf.applyOverridesToStudy)(e,o),i&&e.setUserEditEnabled(!1),e.id())))}waitForStudyCreated(e){return this._chartWidget.model().model().waitForStudy(e)}compileFailedStudies(){return this._chartWidget.model().model().studiesWV().value().filter((e=>e.isPine()&&e.hasCompileError()))}getStudyById(e){const t=this._chartWidget.model().model().getStudyById(e);if(null===t)throw new Error("There is no such study");return this._getStudyApi(t)}getSeries(){const e=this._chartWidget.model(),t=e.mainSeries();return new ly(t,e)}createShape(e,t){return this._createMultipointShape(this._convertUserPointsToDataSource([e]),t)}async createMultipointShape(e,t){return this._createMultipointShape(this._convertUserPointsToDataSource(e),t)}getShapeById(e){const t=this._chartWidget.model().model().getLineToolById(e);if(null===t)throw new Error("There is no such shape");return this._getLineDataSourceApi(t)}removeEntity(e,t){const i=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){const t=this._chartWidget.model().model().dataSourceForId(e);t&&this._chartWidget.model().removeSource(t,!1)}removeAllShapes(){this._chartWidget.removeAllDrawingTools()}removeAllStudies(){this._chartWidget.removeAllStudies()}selection(){return null===this._selectionApi&&(this._selectionApi=new hy.SelectionApi(this._chartWidget.model().model())),this._selectionApi}showPropertiesDialog(e){const t=this._chartWidget.model().model().dataSourceForId(e);if(null===t)throw new Error(`Study or shape ${e} does not exist`);this._chartWidget.showChartPropertiesForSource(t)}createStudyTemplate(e){return this._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(){throw new Error("createOrderLine is only available on Trading Platform")}createPositionLine(){throw new Error("createPositionLine is only available on Trading Platform")}createExecutionShape(){throw new Error("createExecutionShape is only available on Trading Platform")}symbol(){return this._chartWidget.symbolWV().value()}symbolExt(){const e=this._chartWidget.model().mainSeries().symbolInfo();if(null===e)return null;const t=((e,t)=>{const i={};return t.forEach((t=>{void 0!==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"]);return t.pro_name=e.pro_name,t}resolution(){return this._chartWidget.model().mainSeries().interval()}marketStatus(){return this._chartWidget.model().mainSeries().marketStatusModel().currentSession().spawn()}getVisibleRange(){const e={from:0,to:0},t=this._chartWidget.model().timeScale(),i=t.visibleBarsStrictRange();if(null===i)return e;const s=i.firstBar(),o=i.lastBar(),r=this._convertIndexToPublicTime(o);if(null===r)return e;const a=Math.max((0,n.ensureNotNull)(t.points().range().value()).firstIndex,s);return e.from=(0,n.ensureNotNull)(this._convertIndexToPublicTime(a)),e.to=r,e}getVisibleBarsRange(){const e=this._chartWidget.model().timeScale(),t=e.visibleBarsStrictRange();if(null===t)return null;const i=this._convertIndexToPublicTime(t.firstBar()),s=t.lastBar()-Math.max(0,Math.ceil(e.rightOffset())),o=this._convertIndexToPublicTime(s);return null===i||null===o?null:{from:i,to:o}}getVisiblePriceRange(){if(console.warn("`getVisiblePriceRange` is deprecated. Use Price Scale API instead"),!this._chartWidget.model().mainSeries())return null;return this._chartWidget.model().mainSeries().priceScale().priceRangeInPrice()}scrollPosition(){return console.warn("`scrollPosition` is deprecated. Use rightOffset from Time Scale API instead"),this._chartWidget.model().timeScale().rightOffset()}defaultScrollPosition(){return console.warn("`defaultScrollPosition` is deprecated. Use defaultRightOffset from Time Scale API instead"),this._chartWidget.model().timeScale().defaultRightOffset().value()}priceFormatter(){return this._chartWidget.model().mainSeries().priceScale().formatter()}chartType(){return this._chartWidget.model().mainSeries().properties().childs().style.value()}setTimezone(e){this._chartWidget.setTimezone(e)}getTimezone(){return this._chartWidget.getTimezone()}getTimezoneApi(){return this._timezoneApi}getPanes(){return this._chartWidget.model().model().panes().map((e=>this._getPaneApi(e)))}exportData(e){if(!l.enabled("charting_library_export_chart_data"))return Promise.reject("Data export is not supported");const t={...e};return void 0!==t.from&&(t.from=this._convertTimeFromPublic(t.from)),void 0!==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){const e=new O.WatchedValue(!1);this._zoomUndoStackIsNotEmpty=e.spawn(),this._chartWidget.withModel(this,(()=>{const t=this._chartWidget.model().zoomStack();t.onChange().subscribe(this,(()=>e.setValue(!t.isEmpty())))}))}return this._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(){return new _y(this._chartWidget.model().lineToolsGroupController(),this._chartWidget.model().model())}isSelectBarRequested(){return this._chartWidget.selectPointMode().value()!==mt.SelectPointMode.None}requestSelectBar(){return this.isSelectBarRequested()?Promise.reject("already requested"):new Promise(((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){const t=this._prepareEndOfPeriodArgs();return zf(t.barBuilder,e,t.intervalObj)}endOfPeriodToBarTime(e){const t=this._prepareEndOfPeriodArgs();return function(e,t,i){if(i.isDays())return t;const s=1e3*t-1;if(e.moveTo(s),i.isIntraday()){const i=e.indexOfBar(s);if(i<0)throw new Error(`${t} is out of the instrument session `);return e.startOfBar(i)/1e3}return e.startOfBar(0)/1e3}(t.barBuilder,e,t.intervalObj)}createAnchoredShape(e,t){const i=()=>new Error(`Cannot create "${t.shape}" shape`),s=t.shape;if(Nf(s)&&!0!==Of[s].isAnchored)throw console.warn(`${s} is not an anchored shape. It can be created using createShape or createMultipointShape`),i();const o=this._chartWidget.model().model(),n=o.mainSeries();if(o.timeScale().isEmpty())throw i();const r=void 0!==t.ownerStudyId?o.dataSourceForId(t.ownerStudyId):n,a=this._convertPositionPercentToDataSource(e,r);if(null===a)throw i();return this._createMultipointShape([a],t)}properties(){return this._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(){return this._chartWidget.chartPainted()}applyOverrides(e){this._chartWidget.applyOverrides(e)}addOverlayStudy(e,t,i){return this._chartWidget.addOverlayStudy(e,t,i)}lineToolsSynchronizer(){return this._chartWidget.lineToolsSynchronizer()}cloneLineTool(e){const t=this._chartWidget.model(),i=t.model().dataSourceForId(e);return t.cloneLineTools([i],!1)[0]}shareLineTools(e,t){ -const i=this._chartWidget.model(),s=e.map((e=>i.model().dataSourceForId(e)));i.shareLineTools(s,t)}getLollipopSourcesApi(){throw new Error("getLollipopSourcesApi is not supported")}clickAtLatestUpdatesLollipop(){throw new Error("clickAtLatestUpdatesLollipop is not supported")}linkingGroupIndex(){return this._apiLinkingGroupIndex.spawn()}loadingScreenActive(){return this._chartWidget.screen.isShown()}symbolResolvingActive(){for(const e of this._chartWidget.model().model().symbolSources())if(e.symbolResolvingActive().value())return!0;return!1}hasModel(){return this._chartWidget.hasModel()}disableAllUtilitySources(){0}chartProto(){return kg.prototype}ranges(){throw new Error("not implemented")}getTimeScale(){return new Uf(this._chartWidget.model().timeScale())}async loadChartTemplate(e){await(0,Vf.loadTheme)(this._chartWidget.chartWidgetCollection(),{themeName:e,standardTheme:!1,noUndo:!1,onlyActiveChart:!0})}setTimeFrame(e){this.setActive(),this._chartWidget.loadRange(e)}async syncTime(e){if(this._chartWidget.hasModel()){const t=this._chartWidget.model().model(),i=t.mainSeries().syncModel();if(i)return t.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");const s=i??!0,o=(0,n.ensureNotNull)(this.lineToolsSynchronizer()).getDTO(e,t,s);return delete o.clientId,o}async applyLineToolsState(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(){return this._chartWidget.model().model().replayStatus()}replayStudyStrategyProperties(){return this._chartWidget.model().model().replayStudyStrategyProperties()}insertStudyWithoutCheck(e,t,i,s,o){return this._chartWidget.model().insertStudyWithoutCheck(new ns.StudyMetaInfo(e,o),t,i,s)}copyEntityToClipboard(e){const t=this._chartWidget.model().model().dataSourceForId(e);t&&this._chartWidget.chartWidgetCollection().clipboard.uiRequestCopy([t])}pasteFromClipboard(){this._chartWidget.chartWidgetCollection().clipboard.uiRequestPaste()}inactivityGaps(){return this._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){const t=this._chartWidget.model(),i=t.model(),s=(0, -n.ensureNotNull)(i.paneForSource(i.mainSeries()));await(0,xo.ensureLineToolLoaded)(e);const o={pane:s,point:(()=>{const e=(0,n.ensureNotNull)(t.mainSeries().bars().last());return{index:e.index,price:e.value[4],interval:i.mainSeries().interval()}})(),linetool:e,actionSource:"API"};return i.createLineTool(o).adapter()}_createStudy(e){return Promise.reject("Pine Script® and java studies are not supported")}_convertTimeToPublic(e){return this._getTimeConverter().convertInternalTimeToPublicTime(e)}_convertIndexToPublicTime(e){return null===this._chartWidget.model().mainSeries().symbolInfo()?null:this._getTimeConverter().convertTimePointIndexToPublicTime(e)}_convertPositionPercentToDataSource(e,t){const i=this._chartWidget.model().timeScale(),s=t.priceScale(),o=t.firstValue();if(null==o||!isFinite(o)||null===s)return null;const n=i.coordinateToIndex(e.x*i.width());return{price:s.coordinateToPrice(e.y*s.height(),o),index:n}}_convertUserPointsToDataSource(e){const t=this._chartWidget.model().model(),i=t.mainSeries(),s=t.timeScale().points(),o=i.data();if(t.timeScale().isEmpty())return null;const r=e.map((e=>e.time||0)),a=this._alignPoints(r),l=(e,t,r)=>{const a=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){const t=(0,n.ensureNotNull)(i.syncModel()).distance(c,e);t.success&&(l.index=l.index+t.result)}else if(enew Error(`Cannot create "${s.shape}" shape`),s=Object.assign({},{filled:!0},t),o=Of[s.shape]||Of.flag;const r=this._chartWidget.model().model(),a=r.mainSeries();if(r.timeScale().isEmpty())throw i();const l=void 0!==s.ownerStudyId?r.dataSourceForId(s.ownerStudyId)??a:a,c=r.paneForSource(l);if(null===e||null===c)throw i();if(o.onlySelectable)throw new Error(`Cannot create "${s.shape}" shape`);if("LineToolIcon"===o.name){const e=s;if(e.icon=e.icon||e.overrides&&e.overrides.icon,!s.hasOwnProperty("icon"))throw new Error("icon must be specified in options");e.overrides=e.overrides||{},e.overrides.icon=e.icon}await(0,xo.ensureLineToolLoaded)(o.name);const h=(0,zs.createLineToolProperties)(r.backgroundTheme().spawnOwnership(),o.name,!r.readOnly());if((0,zs.prepareLineToolPropertiesByOwnerSource)(h,l),s.overrides)for(const e in s.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]);let d;void 0!==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();const u=d.createLineTool({pane:c,point:e[0],linetool:o.name,properties:h,ownerSource:l,actionSource:"API"});if(null===u)throw h.destroy(),i();if(u.properties()!==h&&h.destroy(),ny(o.name)){if(e.length>2)throw new Error(`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{const t=u.pointsCount();if(t!==e.length&&-1!==t)throw new Error(`Wrong points count for ${s.shape}. Required ${t}`);const i=new To.EnvironmentState(void 0,!0),n=(0,Lt.isLineDrawnWithPressedButton)(o.name);for(let t=1;te.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(){const e=this._chartWidget.model().model(),t=e.timezone(),i=(0,n.ensureNotNull)(e.mainSeries().symbolInfo()),s=e.mainSeries().interval(),o=new Cd.SessionInfo(t,i.session,i.session_holidays,i.corrections);return{barBuilder:(0,Td.newBarBuilder)(s,o,o),intervalObj:Re.Interval.parse(s)}}_getPaneApi(e){let t=this._panes.get(e);return void 0===t&&(t=new Xf(e,this._chartWidget),this._panes.set(e,t)),t}_getStudyApi(e){let t=this._studies.get(e);return void 0===t&&(t=new iy(e,this._chartWidget),this._studies.set(e,t)),t}_getLineDataSourceApi(e){let t=this._lineDataSources.get(e);return void 0===t&&(t=new ay(e,this._chartWidget.model(),{apiPointsToDataSource:this._convertUserPointsToDataSource.bind(this),dataSourcePointsToPriced:e=>{const t=(0,n.ensureNotNull)(this._chartWidget.model().mainSeries().syncModel()),i=this._chartWidget.model().timeScale();return e.map((e=>{const s=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){const t=this._chartWidget.model().model(),i=t.mainSeries(),s=i.interval(),o=i.symbolInfo();if(t.timeScale().isEmpty()||!Re.Interval.isDWM(s)||null===o)return e;const n=(0,Jd.createDwmAligner)(s,o);return null===n?e:e.map((e=>n.timeToSessionStart(1e3*e)/1e3))}_onLogicalRangeChanged(){const e=this._chartWidget.model().mainSeries(),t=e.data().isEmpty();if(null!==this._chartWidget.model().timeScale().visibleBarsStrictRange()&&t)return void e.dataEvents().completed().subscribe(this,this._onLogicalRangeChanged,!0);const i=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"))throw new Error(`${e} can only be used when 'saveload_separate_drawings_storage' featureset is enabled`)}_onSymbolChanged(e){var t;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, -delay:t.delay,expired:t.expired,expiration_date:t.expiration_date,sector:t.sector,industry:t.industry,currency_code:t.currency_code,original_currency_code:t.original_currency_code,unit_id:t.unit_id,original_unit_id:t.original_unit_id,unit_conversion_types:t.unit_conversion_types,subsession_id:t.subsession_id,subsessions:t.subsessions,price_source_id:t.price_source_id,price_sources:t.source2?[t.source2]:[],logo_urls:t.library_custom_fields?.logo_urls,exchange_logo:t.library_custom_fields?.exchange_logo,library_custom_fields:t.library_custom_fields})}}var vy=i(52092);class Sy{loginRequired(){throw new Error("Not implemented")}onGoProDialog(e,t){throw new Error("Not implemented")}}function by(){throw new Error("not implemented")}function wy(e){const t=new O.WatchedValue(e.value()),i=t=>{(0,yi.allowSavingDefaults)(!0),e.setValue(t),(0,yi.allowSavingDefaults)(!1)};return t.subscribe(i),e.subscribe(t,(()=>{t.setValue(e.value())})),t.spawn((()=>{e.unsubscribeAll(t),t.unsubscribe(i)}))}class Cy extends Sy{constructor(e){super(),this.linking=de.linking,this._lockDrawingsWatchedValue=null,this._hideDrawingsWatchedValue=null,this._hideIndicatorsWatchedValue=null,this._studyTemplatesDrawer=null,this._fontIconsSettingsDrawer=null,this._favoriteDrawingsToolbar=null,this._webview=null,this._activeChartWidgetWV=new O.WatchedValue(null),this._activeChartRangeState=new Bf.WatchedObject({ranges:[]}),this._themesApi=null,this._newsApiDeferredPromise=null,this._newsApiRejectionReason=null,this._watchlistApiDeferredPromise=null,this._watchlistApiRejectionReason=null,this._widgetbarApiDeferredPromise=null,this._widgetbarApiRejectionReason=null,this._isDestroyed=!1,this._widgebarApi=null,this._chartWidgets=new WeakMap,this._layoutSettingsDrawer=null,this._magnetEnabledWV=null,this._magnetModeWV=null,this._magnetSnapsToIndicatorsWV=null,this._drawOnAllCharts=(0,ye.convertPropertyToWatchedValue)((0,mt.drawOnAllCharts)()),this._replayApi=null,this._pineEditorApi=null,this._backtestingStrategyApi=null,this._supportTicketData=null,this._activeChartWidgetChangedDelegate=new ae.Delegate,this._alerts=null,this._activateChart=e=>{this.setActiveChart(this._chartIndex(e))};const{chartApiInstance:t,chartWidgetCollection:i,studyMarket:s,saveChartService:o,loadChartService:n,sharingChartService:r=null,webview:a=null,favoriteServices:l,alertsServices:c,supportTicketData:h=null}=e;this._chartApiInstance=t,this._chartWidgetCollection=i,this._studyMarket=s,this._saveChartService=o,this._sharingChartService=r,this._loadChartService=n,this._favoriteServices=l,this._intervalsService=null,this._alertsWidgetDialog=null,this._detailsDialogController=null,this._supportedChartStylesSpawn=de.linking.supportedChartStyles.spawn(),this._chartWidgetCollection.onAboutToBeDestroyed.subscribe(null,(()=>this.destroy()),!0),this._webview=a,this._alertService=null,this._supportTicketData=h;const d=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(){return null===this._themesApi&&(this._themesApi=new Rf({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,void 0)}unsubscribe(e,t){ee.unsubscribe(e,t,void 0)}onActiveChartChanged(){return this._activeChartWidgetChangedDelegate}webview(){return by(),this._webview}connect(){by()}disconnect(){by()}onConnectionStatusChanged(e){by()}isConnected(){by()}supportTicketData(){return this._supportTicketData}setPublishChartOptions(e){by()}publishChart(e){by()}studyTemplatesDrawerApi(){by()}fontIconsSettingsDrawer(){by()}intervalsService(){by()}alertService(){by()}async alerts(){by()}supportedChartTypes(){return this._supportedChartStylesSpawn}setBrokerName(e){this._chartWidgetCollection.setBroker(e)}getDrawOnAllCharts(){return(0,mt.drawOnAllCharts)().value()}drawOnAllCharts(e){return(0,mt.drawOnAllCharts)().setValue(e)}drawOnAllChartsEnabled(){return this._drawOnAllCharts}getDrawOnAllChartsMode(){return(0,mt.drawOnAllChartsMode)().value()}drawOnAllChartsMode(e){(0,mt.drawOnAllChartsMode)().setValue(e)}currencies(){return this._chartApiInstance?.availableCurrencies()??Promise.reject()}units(){return this._chartApiInstance?.availableUnits()??Promise.reject()}disableTrackingEvents(){(0,re.disableTrackingEvents)()}getSaveChartService(){return this._saveChartService}symbolSync(){return this._symbolSync}intervalSync(){return this._intervalSync}dateRangeSync(){return this._dateRangeSync} -crosshairSync(){return this._crosshairSync}timeSync(){return this._timeSync}setSymbolSearchUI(e){by()}chart(e=0){if(e<0||e>=this.chartsCount())throw Error("Incorrect index: "+e);return this._getChartWidgetApi(this._chartWidgetCollection.getAll()[e])}*charts(){for(let e=0;e=0&&e(this._favoriteDrawingsToolbar||(this._favoriteDrawingsToolbar=new e.FavoriteDrawingsApi),this._favoriteDrawingsToolbar)))}sharingChart(){return this._sharingChartService}watchlist(){by()}setWatchlistApiPromise(e){by()}news(){by()}setNewsApiPromise(e){by()}widgetbar(){by()} -setWidgetbarApiPromise(e){by()}getChartStorage(){return getChartStorage()}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(){return null===this._magnetEnabledWV&&(this._magnetEnabledWV=wy((0,mt.properties)().childs().magnet)),this._magnetEnabledWV}magnetMode(){return null===this._magnetModeWV&&(this._magnetModeWV=wy((0,mt.properties)().childs().magnetMode)),this._magnetModeWV}magnetSnapsToIndicators(){return null===this._magnetSnapsToIndicatorsWV&&(this._magnetSnapsToIndicatorsWV=wy((0,mt.properties)().childs().magnetSnapsToIndicators)),this._magnetSnapsToIndicatorsWV}flushBufferedData(){Ff.fire()}chartWidgetCollectionState(e){return this._chartWidgetCollection.state(e)}chartWidgetCollectionSeriesStatuses(){return this._chartWidgetCollection.chartSeriesStatuses()}watermark(){{const e=P_.getInstance();if(!e.ready())throw new Error("Watermark API is not initialised yet.");return e}}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(){return this._chartWidgetCollection.startFullscreen()}exitFullscreen(){return this._chartWidgetCollection.exitFullscreen()}getFavoriteChartStylesService(){by()}getFavoriteIntervalsService(){by()}getFavoriteCurrencyUnitConversionApi(){by()}getIntervals(){let e=[];const t=(0,ht.getCustomResolutions)();return null!==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){return Qf(ns.StudyMetaInfo.findStudyMetaInfoByDescription((0,n.ensureNotNull)(this._chartApiInstance).allStudiesMetadata(),e))}getStudyStyles(e){return ey(ns.StudyMetaInfo.findStudyMetaInfoByDescription((0,n.ensureNotNull)(this._chartApiInstance).allStudiesMetadata(),e))}getSymbolInterval(e){const t={symbol:this.linking.proSymbol.value(),interval:this.linking.interval.value()};return e?.(t),t}hasChartChanges(){return this._chartWidgetCollection.hasChanges()}async loadChart(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));const t=await this._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")}}async loadChartFromServer(e){await(this._loadChartService?.loadChart(e,!1))}async loadLayoutFromServerByLayoutId(e,t,i){await(this._loadChartService?.loadChartByUrl(e,!!t,i))}layoutId(){return this._chartWidgetCollection.metaInfo.uid.value()}async createNewLayout(e){by()}lockAllDrawingTools(){return null===this._lockDrawingsWatchedValue&&(this._lockDrawingsWatchedValue=new O.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(){return null===this._hideDrawingsWatchedValue&&(this._hideDrawingsWatchedValue=new O.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(){return null===this._hideIndicatorsWatchedValue&&(this._hideIndicatorsWatchedValue=new O.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(){return this._chartWidgetCollection.activeChartWidget.value().model().mainSeries().priceScale().formatter()}onContextMenu(e){ee.subscribe("onContextMenu",(t=>{t.callback(e(t.unixtime,t.price))}),void 0)}onGrayedObjectClicked(e){ee.subscribe("onGrayedObjectClicked",e,void 0)}removeChartFromServer(e,t){z.backend.removeChart(e).then(t)}saveChart(e,t){if(!this._saveChartService)return;const i=this._saveChartService.saveToJSON(t);return e&&e(JSON.parse(i.content))}saveChartToServer(e,t,i){this._saveChartService&&this._saveChartService.saveChartSilently(e,t,i)}selectedLineTool(){const e=Object.keys(Of),t=mt.tool.value();for(let i=0;i{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(){return null}showNoticeDialog(e){(0,j.showWarning)({title:e.title,text:e.body||"",onClose:e.callback})}showSupportDialog(){by()}showSaveAsChartDialog(){const e=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){return this._chartWidgetCollection.clientSnapshot(e)}takeScreenshot(){return this._chartWidgetCollection.takeScreenshot()}trading(){by()}waitTrading(){by()}viewMode(){by()}viewModeWatchedValue(){by()}async dummyBrokerController(){return Promise.reject("Not implemented")}pineLibApi(){return by(),{saveNew,saveNext,requestBuiltinScripts}}resetCache(){(0,r.getChartingLibraryGlobalContext)().ChartApiInstance.resetCache()}getSymbolAliasService(){throw new Error("not supported")}static setContextMenuOptions(e){void 0!==e.items_processor&&Io.ContextMenuManager.setCustomItemsProcessor(e.items_processor),void 0!==e.renderer_factory&&Io.ContextMenuManager.setCustomRendererFactory(e.renderer_factory)}_getChartWidgetApi(e){let t=this._chartWidgets.get(e);return void 0===t&&(t=new yy(e,this._activateChart.bind(null,e)),this._chartWidgets.set(e,t)),t}_chartIndex(e){return this._chartWidgetCollection.getAll().indexOf(e)}_activeChartWidget(){return this._chartWidgetCollection.activeChartWidget.value()}_toggleUnitConversionMenu(e,t,i,s,o){if(t)return void ee.emit(e,t,-1,-1,"");const r=this._chartWidgetCollection.getAll(),a=r.findIndex((e=>e.model().model().id()===i));if(-1===a)return;const l=(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);var Ty=i(78136),Py=i(19979);const xy={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"};function My(e){return xy[e]||"www"}var Iy=i(33065),Ay=i(70893),Ly=i(50946);i(59449);const ky={customBrandingTradingViewText:Rt.colorsPalette["color-brand"],customBrandingText:Rt.colorsPalette["color-cold-gray-850"],background:Rt.colorsPalette["color-cold-gray-900"], -shadow:Rt.colorsPalette["color-cold-gray-700"],text:Rt.colorsPalette["color-white"],staticTextBackground:(0,Ro.generateColor)(Rt.colorsPalette["color-cold-gray-800"],20),logo:Rt.colorsPalette["color-white"],platformBgColor:Rt.colorsPalette["color-cold-gray-900"],platformFgColor:Rt.colorsPalette["color-cold-gray-200"]},Ey={customBrandingTradingViewText:Rt.colorsPalette["color-brand"],customBrandingText:Rt.colorsPalette["color-cold-gray-850"],background:Rt.colorsPalette["color-white"],shadow:Rt.colorsPalette["color-cold-gray-150"],text:Rt.colorsPalette["color-cold-gray-900"],staticTextBackground:(0,Ro.generateColor)(Rt.colorsPalette["color-white"],20),logo:Rt.colorsPalette["color-cold-gray-900"],platformBgColor:Rt.colorsPalette["color-white"],platformFgColor:Rt.colorsPalette["color-cold-gray-900"]};const Dy=new Map([["logo-old-style",Ly],["tradingview-old-style",Ay]]),By=l.enabled("adaptive_logo"),Vy=l.enabled("small_no_display"),Ry=l.enabled("38914"),Ny="site_branding",Oy="widget_branding",Fy="widget_referral_branding",Wy="widget_custom_branding",Hy="widget_custom_no_powered_branding",zy="fundamental_branding",Uy="fundamental_custom_branding",jy="fundamental_custom_no_powered_branding",Gy="library_branding",qy="library_custom_branding",$y="library_custom_no_powered_branding",Ky=navigator.userAgent.toLowerCase().indexOf("chrome")>-1&&-1===navigator.userAgent.toLowerCase().indexOf("edge"),Yy=window.urlParams||{},Zy=window.initData||{};Yy.no_referral_id&&enable(Yy.referral_id||"","aggressive");const Xy=a.t(null,void 0,i(98856)),Jy=Ry?a.t(null,void 0,i(44676)):a.t(null,void 0,i(92800));a.t(null,void 0,i(46768)),a.t(null,void 0,i(83470)),a.t(null,void 0,i(3140));var Qy;!function(e){e[e.OldFontAdditionalVerticalOffset=0]="OldFontAdditionalVerticalOffset",e[e.NewFontAdditionalVerticalOffset=.1]="NewFontAdditionalVerticalOffset",e[e.StrokeWidth=4]="StrokeWidth",e[e.StaticLogoHorizontalTextOffset=5]="StaticLogoHorizontalTextOffset",e[e.TextWidthCompensation=2]="TextWidthCompensation",e[e.AdaptiveWidthToHideText=500]="AdaptiveWidthToHideText",e[e.WidthToHideLogoIfSmallNoDisplayEnabled=480]="WidthToHideLogoIfSmallNoDisplayEnabled",e[e.TextAdditionalCropWidth=11]="TextAdditionalCropWidth",e[e.BadgeLogoMargin=-11]="BadgeLogoMargin",e[e.BadgeTextMargin=-8]="BadgeTextMargin",e[e.TextAnimatedAlphaStart=.3]="TextAnimatedAlphaStart",e[e.TextAnimatedAlphaEnd=1]="TextAnimatedAlphaEnd",e[e.AnimationDuration=200]="AnimationDuration"}(Qy||(Qy={}));(0,ze.onWidget)();class ev extends Ad.CustomSourceBase{constructor(e,t,i){super(e,t),this._canvasWidth=0,this._paneHeight=0,this._left=13,this._bottom=36,this._layout=Ny,this._needToShow=!0,this._showBranding=!1,this._customLogoSrc="",this._customLogoLink="",this._tradingviewLogoLinkToPath="",this._cubicBezier=new br.CubicBezier(.4,.01,.22,1),this._openAnimation=null,this._closeAnimation=null,this._powBy=null,this._custom=null,this._destroyed=!1,this._mainSeries=this._model.mainSeries(),this._visible=i,this._showForPro=!t.onWidget();const s=()=>this._model.updateSource(this) -;this._visible.subscribe(s),this._dark=t.dark().spawn(),this._dark.subscribe(s),this._checkLayout(),this._layout!==Wy&&this._layout!==Uy||(this._left=8,this._bottom=5);const o=()=>{this._needToShow?this._showBranding=!0:this._showBranding=!1};this._resizeHandlerDelayed=(0,Ol.default)(o,200),o(),window.addEventListener("resize",this._resizeHandlerDelayed),this._model.isSnapshot()?this._init():(this._mainSeries.dataEvents().symbolResolved().subscribe(this,this._init),null!==this._mainSeries.symbolInfo()&&this._init()),this._renderer={draw:this.draw.bind(this),hitTest:this.hitTest.bind(this)},t.onWidget()||window.loginStateChange.subscribe(this,this._init)}destroy(){window.removeEventListener("resize",this._resizeHandlerDelayed),this._mainSeries.dataEvents().symbolResolved().unsubscribeAll(this),this._powBy&&this._powBy.destroy(),this._model.onWidget()||window.loginStateChange.unsubscribeAll(this),this._visible.release(),this._dark.destroy(),this._destroyed=!0}paneViews(e){if(window.TradingView.printing&&this._layout!==Hy&&this._layout!==jy)return[];if(!this._visible.value())return[];if(this._layout===Ny&&!this._showForPro&&window.user&&window.user.is_pro)return[];const t=this._model.mainPane();if(!t)return[];const i=l.enabled("move_logo_to_main_pane");let s=!1;if(e.maximized().value())s=!0;else if(i)s=t.collapsed().value()?e===this._model.panes().find((e=>!e.collapsed().value())):e.isMainPane().value();else if(this._model.lastPane().collapsed().value()){const t=this._model.panes();for(let i=t.length-1;i>=0;--i){const o=t[i];if(!o.collapsed().value()){s=o===e;break}}}else s=e.isLast();return s?[{renderer:this.renderer.bind(this)}]:[]}labelPaneViews(e){return[]}priceAxisViews(e,t){return[]}updateAllViews(){}updateViewsForPane(e){}priceScale(){return null}renderer(e){return this._paneHeight=e.mediaSize.height,this._canvasWidth=e.mediaSize.width,this._renderer}hasContextMenu(){return!1}onClickOutside(){this._hasAnimation()&&this._startCloseAnimation()}hitTest(e){if(!this._showBranding||l.enabled("logo_without_link"))return null;if(this._powBy&&this._layout!==Hy&&this._layout!==jy&&(this._powBy.hitTest(e)||this._custom&&this._custom.hitTest(e))){const e=!0;return new Ut.HitTestResult(Ut.HitTarget.Custom,{hideCrosshairLinesOnHover:!0,cursorType:e?ei.PaneCursorType.Pointer:ei.PaneCursorType.Default,clickHandler:()=>{this._openLink()},tapHandler:()=>{this._hasAnimation()?this._toggleOpenAnimatedOrOpenLink():this._openLink()},mouseEnterHandler:()=>{this._hasAnimation()&&this._startOpenAnimation()},mouseLeaveHandler:()=>{this._hasAnimation()&&this._startCloseAnimation()},mouseDownHandler:()=>{0},mouseUpHandler:()=>{0}})}return null}tvUrl(){const e="https://"+function(e){return My(e)+".tradingview.com"}((Zy.querySettings?.locale??Zy.currentLocaleInfo?.language)||"en");let t=new URL(e);if(this._customLogoLink)return this._customLogoLink;if(this._layout===Gy||this._layout===qy){let e;switch(!0){case l.enabled("charting_library"):e="library";break;case l.enabled("trading_terminal"):e="trading-terminal"} -this._tradingviewLogoLinkToPath&&(t.pathname=this._tradingviewLogoLinkToPath),t.searchParams.append("utm_source",window.location.origin),t.searchParams.append("utm_medium","library"),e&&t.searchParams.append("utm_campaign",e)}return t.toString()}draw(e,t){if(!this._showBranding)return;let i=0;Yy.utm=!0,(0,Kt.drawScaled)(e,t.horizontalPixelRatio,t.verticalPixelRatio,(()=>{if(this._powBy&&this._powBy.show){i=this._powBy.height,e.save();const s=new Vt.Point(this._left,this._paneHeight-this._bottom-i);this._powBy.draw(s,e,t,this._canvasWidth),e.restore()}if(this._custom&&this._custom.show){e.save();const s=new Vt.Point(this._left,this._paneHeight-this._bottom-i-this._custom.height);this._custom.draw(s,e,t),e.restore()}}))}_init(){this._checkLayout();const e=this._mainSeries.symbolInfo();this._powBy&&this._powBy.destroy(),this._powBy=new rv(this._layout,e?.name||"",this._model,(()=>this._model.fullUpdate())),this._custom=new av(this._layout,this._customLogoSrc,(()=>this._model.fullUpdate())),this._openAnimation=null,this._closeAnimation=null,this._model.lightUpdate()}_checkLayout(){if(l.enabled("widget"))0;else{{const e=JSON.parse(Yy.logo)||{};e.image?(this._customLogoSrc=e.image,this._customLogoLink=e.link,this._needToShow=l.enabled("widget_logo"),l.enabled("link_to_tradingview")?this._layout=qy:this._layout=$y):(e.tradingviewLogoLinkToPath&&(this._tradingviewLogoLinkToPath=e.tradingviewLogoLinkToPath.replace(/^\//,"")),this._layout=Gy,this._needToShow=l.enabled("widget_logo"))}}}_startOpenAnimation(){if(null!==this._openAnimation)return;null!==this._closeAnimation&&(this._closeAnimation.stop(),this._closeAnimation=null);const e=(0,n.ensureNotNull)(this._powBy).animationStep();this._openAnimation=(0,xr.doAnimate)({from:e,to:1,duration:200*(1-e),easing:this._cubicBezier.easingFunc,onStep:this._animatedDrawStep.bind(this)})}_startCloseAnimation(){if(null!==this._closeAnimation)return;null!==this._openAnimation&&(this._openAnimation.stop(),this._openAnimation=null);const e=(0,n.ensureNotNull)(this._powBy).animationStep();this._closeAnimation=(0,xr.doAnimate)({from:e,to:0,duration:200*e,easing:this._cubicBezier.easingFunc,onStep:this._animatedDrawStep.bind(this)})}_animatedDrawStep(e,t){(0,n.ensureNotNull)(this._powBy).animatedDrawStep(t),this._model.lightUpdate()}_hasAnimation(){return null!==this._powBy&&this._powBy.hasAnimation()}_openGoPro(){0}_openLink(){if((0,ze.isSymphonyEmbed)())return!1;if(this._layout===Ny)return this._model.isSnapshot()||this._openGoPro(),!1;l.enabled("widget");return(0,n.ensureNotNull)(window.open(this.tvUrl(),"_blank")).opener=null,!0}_toggleOpenAnimatedOrOpenLink(){null!==this._openAnimation&&this._openAnimation.completed()?this._openLink()||this._startCloseAnimation():this._startOpenAnimation()}}function tv(e){return!Vy||e>480}function iv(e){return!By||e>500}let sv={},ov={};class nv{constructor(){this._topLeftPoint=null,this._hitTestHeight=null}hitTest(e){const t=this._getHitTestBox();if(t)return(0,Gt.pointInBox)(e,t)}_getHitTestBox(){const e=this._topLeftPoint;if(e){const{x:t,y:i}=e;return(0, -Vt.box)(e,new Vt.Point(t+this.width,i+(this._hitTestHeight??this.height)))}}}class rv extends nv{constructor(e,t,i,s){super(),this.show=!0,this.hovered=!1,this.active=!1,this._needDisplayImage=!1,this._textAnimatedAlpha=1,this._textAnimatedAlphaStart=1,this._textAdditionalCropWidth=0,this._textAnimatedAlphaEnd=1,this._badgeData={logoMargin:0,textMargin:0,width:0},this._invertTextCropDirection=!1,this._font=`px ${m.CHART_FONT_FAMILY}`,this._txt="TradingView",this._maximizedAnimationTextWidth=0,this._logoWidth=0,this._textWidthCache=new Qt.TextWidthCache,this._pixelRatio={horizontalPixelRatio:NaN,verticalPixelRatio:NaN},this._model=i,this._layout=e,this._symbol=t,this._showTradeWithLogo=!1,this._showAnimatedBranding=l.enabled("show_animated_logo")||e===Oy,this._alwaysMaximized=l.enabled("logo_always_maximized")||this._model.isSnapshot()&&!ze.CheckMobile.any()||!1,this._fontSize=this._showAnimatedBranding||this._layout===Fy?11:14,this._showAnimatedBranding||this._layout!==Wy&&this._layout!==Uy||(this._fontSize=12),this._sizeConstants=(this._model.isSnapshot(),{brandCircleSize:32,textAsImageWidthCompensation:0,leftOffset:0,bottomOffset:-23,logoLeftOffset:1,logoTextOffset:6}),this.width=this._minimizedAnimationWidth(),this._animatedWidth=this.width,this.height=this._fontSize+2,this._requestRepaint=s,this._init(),this._checkFontLoaded(),this._recalculateMetrics()}destroy(){this._model.properties().childs().paneProperties.childs().background.unsubscribeAll(this),this._model.onChartThemeLoaded().unsubscribeAll(this)}hasAnimation(){return this._showAnimatedBranding&&!this._alwaysMaximized}animationStep(){const e=this._minimizedAnimationWidth(),t=this._maximizedAnimationWidth();return(this._animatedWidth-e)/(t-e)}animatedDrawStep(e){const t=this._minimizedAnimationWidth(),i=this._maximizedAnimationWidth();this._animatedWidth=t+e*(i-t),this._textAnimatedAlpha=this._textAnimatedAlphaStart+e*(this._textAnimatedAlphaEnd-this._textAnimatedAlphaStart)}draw(e,t,i,s){const{brandCircleSize:o,logoLeftOffset:n,leftOffset:r,bottomOffset:a}=this._sizeConstants;this._needDisplayImage&&tv(s)&&(e=new Vt.Point(e.x+r,e.y-a)),this._topLeftPoint=e,t.translate(e.x,e.y);const{horizontalPixelRatio:l,verticalPixelRatio:c}=i;(0,Iy.equalPixelRatios)(i,this._pixelRatio)||(this._textWidthCache.reset(),this._pixelRatio={horizontalPixelRatio:l,verticalPixelRatio:c});const h=this._colors;if(this._showAnimatedBranding){if(this._needDisplayImage){const e=this._getLogoImage(h.logo);this.width=this._animatedWidth,this._drawLogo(t,e,this._animatedWidth,this._animatedWidth,this._animatedWidth>this._sizeConstants.brandCircleSize)}}else if(this._layout===Wy||this._layout===Uy){t.font=this._fontSize+this._font;const e=t.measureText(this._txt).width+2;this.width=e+t.measureText("TradingView").width+2,t.save(),t.globalAlpha=.7,t.fillStyle=this._colors.customBrandingText,t.fillText(this._txt,0,12),t.fillStyle=this._colors.customBrandingTradingViewText,t.fillText("TradingView",e,12),t.restore()}else if(tv(s))if(this._needDisplayImage){const e=this._getLogoImage(h.logo) -;t.save(),this._drawBgCircle(t,o/2);const{width:i,height:r}=e.logoImage.viewBox(),a=new Vt.Point(Math.round((o-i)/2)-1+n,Math.floor((o-r)/2)+1);this._drawLogoImage(t,a,e.logoImage);const l=iv(s);l&&(t.translate(o+5,Math.round(this._fontSize*("px EuclidCircular"===this._font?.1:0))),this._drawTextStroke(t),this._drawTextFill(t)),t.restore(),this.width=o,l&&(this.width+=this._maximizedAnimationTextWidth)}else{const e=iv(s);e&&(t.save(),t.translate(Ky?-.5:0,-.5),this._drawTextStroke(t),this._drawTextFill(t),t.restore()),e&&(this.width=this._maximizedAnimationTextWidth)}else this.width=0}showTradeWithLogo(e){this._showTradeWithLogo=e}_minimizedAnimationWidth(){return this._sizeConstants.brandCircleSize+this._badgeData.logoMargin+this._badgeData.width}_maximizedAnimationWidth(){return this._sizeConstants.brandCircleSize+this._sizeConstants.logoTextOffset+this._maximizedAnimationTextWidth+this._badgeData.width+this._badgeData.textMargin}_drawTradeWithLogo(e,t,i){0}_drawLogo(e,t,i,s,o){const{brandCircleSize:n,logoLeftOffset:r,logoTextOffset:a}=this._sizeConstants;e.save(),this._drawFillRectWithRoundedCorner(e,-.5,0,i,n,n/2);const{logoImage:l,textImage:c,proBadgeImage:h}=t,{width:d,height:u}=l.viewBox(),_=new Vt.Point(Math.round((n-d)/2)-1+r,Math.floor((n-u)/2)+1);if(o){const t=new Vt.Point(_.x+d+a,_.y),i=e.globalAlpha;e.globalAlpha*=this._textAnimatedAlpha;const o=s-this._sizeConstants.brandCircleSize-a-this._badgeData.logoMargin-this._badgeData.width;this._drawImageCropWidth(e,t,c,o),e.globalAlpha=i}if(h){const{width:t,height:i}=h.viewBox();h.render(e,{targetViewBox:{x:_.x+this.width-t,y:Math.floor((n-i)/2)+1,width:t,height:i}})}this._drawLogoImage(e,_,l),e.restore()}_init(){ov={},sv={},this._checkLayout(),this.show&&(this._updateColors(),this._updateHeight(),this._model.properties().childs().paneProperties.childs().background.subscribe(this,this._updateColors),this._model.onChartThemeLoaded().subscribe(this,this._updateColors))}_updateHeight(){this._needDisplayImage?this.height=this._sizeConstants.brandCircleSize:this.height=this._fontSize+2}_checkFontLoaded(){if(!this._showAnimatedBranding&&document.fonts&&document.fonts.check&&document.fonts.load){document.fonts.check(`${this._fontSize}px EuclidCircular`)?this._font="px EuclidCircular":document.fonts.load(`${this._fontSize}px EuclidCircular`,this._txt).then((()=>{this._font="px EuclidCircular",this._recalculateMetrics(),this._requestRepaint()}))}}_recalculateMetrics(){const e=(0,Kt.createDisconnectedCanvas)(document,(0,Ft.size)({width:0,height:0})),t=(0,Kt.getPrescaledContext2D)(e);t.font=this._fontSize+this._font;const i=this._needDisplayImage?this._getLogoImage(this._colors.logo):null;let s=i?i.textImage.viewBox().width+this._sizeConstants.textAsImageWidthCompensation:Math.ceil(t.measureText(this._txt).width)+2+8;s%2==0&&(s+=1),this._maximizedAnimationTextWidth=s,this._textWidthCache.reset(),this._logoWidth=i?.logoImage.viewBox().width??0,this._animatedWidth=this._alwaysMaximized?this._maximizedAnimationWidth():this._minimizedAnimationWidth()}_updateColors(){ -this._colors=this._model.dark().value()?ky:Ey}_getLogoImage(e){return function(e,t,i,s,o){const r=ov,a=[t,i,o&&"tradeWith"].filter(Boolean).join("-"),l=r[a];if(void 0!==l)return l;const[c,h,d]=function(e,t,i){return i?["logo-trade-with","tradingview-trade-with"]:["logo-old-style","tradingview-old-style",void 0]}(0,0,o),u=e=>e.replace(/fill="#[\da-f]{6}"/gi,`fill="${i}"`),_={logoImage:e(u((0,n.ensureDefined)(Dy.get(c)))),textImage:e(u((0,n.ensureDefined)(Dy.get(h)))),proBadgeImage:d?e(u((0,n.ensureDefined)(Dy.get(d)))):void 0};return r[a]=_,_}(Mo.svgRenderer,this._model.dark().value()?"dark":"light",e,0,this._showTradeWithLogo)}_checkLayout(){switch(this._layout){case Oy:case Fy:case Wy:case zy:case Uy:case qy:case Gy:case Ny:this.show=!0;break;case Hy:case jy:case $y:this.show=!1}switch(this._layout){case Gy:this._needDisplayImage=!0,this._txt=Xy;break;case qy:this._txt=Jy}}_drawTextStroke(e){e.save(),e.textBaseline="middle",e.textAlign="start",e.font=this._fontSize+this._font,e.strokeStyle=this._colors.staticTextBackground,e.lineWidth=4,e.lineJoin="round",e.strokeText(this._txt,0,this._sizeConstants.brandCircleSize/2+this._textWidthCache.yMidCorrection(e,this._txt)),e.restore()}_drawTextFill(e){e.save(),e.textBaseline="middle",e.textAlign="start",e.font=this._fontSize+this._font,e.fillStyle=this._colors.text,e.fillText(this._txt,0,this._sizeConstants.brandCircleSize/2+this._textWidthCache.yMidCorrection(e,this._txt)),e.restore()}_drawImageCropWidth(e,t,i,s){e.save();const{logoMargin:o,textMargin:n}=this._badgeData;e.beginPath();const{width:r,height:a}=i.viewBox();e.rect(t.x-this._textAdditionalCropWidth,t.y,s+this._textAdditionalCropWidth,a),e.clip(),i.render(e,{targetViewBox:{x:t.x-(this._invertTextCropDirection?r-s-o+n:0),y:t.y,width:r,height:a}}),e.restore()}_drawBgCircle(e,t){const i=2*Math.PI;e.save(),e.beginPath(),e.fillStyle=this._colors.shadow,e.arc(t,t,t+1,0,i),e.fill(),e.closePath(),e.restore(),e.save(),e.beginPath(),e.fillStyle=this._colors.background,e.arc(t,t,t,0,i,!1),e.fill(),e.closePath(),e.restore()}_drawFillRectWithRoundedCorner(e,t,i,s,o,n,r){e.save(),(0,$t.drawRoundRect)(e,t-1,i-1,s+2,o+2,n),e.fillStyle=this._backgroundShadowFillStyle(),e.fill(),e.closePath(),e.restore(),e.save(),(0,$t.drawRoundRect)(e,t,i,s,o,r??n),e.fillStyle=this._backgroundFillStyle(),e.fill(),e.closePath(),e.restore()}_tradeWithLogoBackgroundColor(){return""}_backgroundShadowFillStyle(){return this._colors.shadow}_backgroundFillStyle(){return this._colors.background}_drawLogoImage(e,t,i){const{width:s,height:o}=i.viewBox();i.render(e,{targetViewBox:{x:t.x,y:t.y,width:s,height:o}})}}class av extends nv{constructor(e,t,i){super(),this.show=!1,this.width=0,this.height=0,this._ready=!1,this._layout=e,this._src=t,this._onReadyCallback=i,this._checkLayout();const s=new Image;this._img=s,this.show&&(s.addEventListener("load",(()=>{this.width=Math.round(s.width),this.height=Math.round(s.height),this._ready=!0,this._onReadyCallback&&this._onReadyCallback()})),s.crossOrigin="anonymous",s.src=this._src)}draw(e,t,i){ -this._topLeftPoint=e,this._ready&&(t.translate(e.x,e.y),t.drawImage(this._img,-.5,-.5,this.width,this.height))}_checkLayout(){switch(this._layout){case Wy:case Hy:case Uy:case jy:case qy:case $y:this.show=!0;break;case Ny:case Oy:case Fy:case zy:case Gy:this.show=!1}}}var lv=i(55279),cv=i(48961);class hv{constructor(e,t){this._headerToolbar=e,this._dropdownId=t}applyOptions(e){this._headerToolbar.updateDropdown(this._dropdownId,e)}remove(){this._headerToolbar.removeDropdown(this._dropdownId)}}var dv=i(68028);class uv{constructor(e){this._symbolModel=e}getVisible(){return this._symbolModel.visible().value()}setVisible(e){return this._symbolModel.visible().setValue(e),this}getIcon(){return this._symbolModel.icon().value()}setIcon(e){return this._symbolModel.icon().setValue(e),this}getColor(){return this._symbolModel.color().value()}setColor(e){return this._symbolModel.color().setValue(e),this}getTooltip(){return this._symbolModel.tooltip().value()}setTooltip(e){return this._symbolModel.tooltip().setValue(e),this}getDropDownContent(){return this._symbolModel.tooltipContent().value()}setDropDownContent(e){return this._symbolModel.tooltipContent().setValue(e),this}}class _v{symbol(e){return new uv(this._model().getSymbolCustomStatus(e))}hideAll(){this._model().hideAll()}static getInstance(){return null===this._instance&&(this._instance=new _v),this._instance}_model(){return dv.CustomStatusModel.getInstance()}}_v._instance=null;var pv=i(22692),mv=i(15754);var gv=i(23745),fv=i(10980),yv=i(43222);class vv{constructor(e,t){this._server=e,this._session=t,this.beforeSeriesCompleted=new ae.Delegate,this.seriesError=new ae.Delegate}onSymbolResolved(e,t){this._server.receiveLocalResponse({method:"symbol_resolved",params:[this._session,e,t]})}onSymbolError(e,t){this._server.receiveLocalResponse({method:"symbol_error",params:[this._session,e,t]})}onStudyError(e,t,i){this._server.receiveLocalResponse({method:"study_error",params:[this._session,e,t,i]})}onSeriesLoading(e,t){this._server.receiveLocalResponse({method:"series_loading",params:[this._session,e,t]})}onSeriesCompleted(e,t,i){this.beforeSeriesCompleted.fire(e,t),this._server.receiveLocalResponse({method:"series_completed",params:[this._session,e,i,t]})}onSeriesError(e,t,i){this._server.receiveLocalResponse({method:"series_error",params:[this._session,e,t,i]}),this.seriesError.fire(e,t)}onStudyCompleted(e,t){this._server.receiveLocalResponse({method:"study_completed",params:[this._session,e,t]})}onStudyLoading(e,t){this._server.receiveLocalResponse({method:"study_loading",params:[this._session,e,t]})}onTickmarksUpdated(e,t){const i={method:"tickmark_update",params:[this._session,{index:e,zoffset:0,changes:[],marks:t,index_diff:[]}]};this._server.receiveLocalResponse(i)}onTimescaleUpdate(e,t){const i={method:"timescale_update",params:[this._session,this._prepareDataUpdateObjects(t),{index:e.pointsIndex,zoffset:0,changes:e.points,marks:e.marks,index_diff:e.indexChange,baseIndex:e.baseIndex,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){const r={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){const o={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){const t={};return e.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}}class Sv{constructor(){this._instances=new Map}createChartApiMessager(e,t){const i=new vv(t,e);return this._instances.set(e,i),i}getChartApiMessager(e){return(0,n.ensureDefined)(this._instances.get(e),`ChartapiMessager instance for session ${e}`)}}const bv={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"};class Tv{get(e){return NaN}set(e){}indexOf(e){return NaN}adopt(e,t,i){return NaN}}var Pv=i(60911);class xv{constructor(e,t){this.color=bv,this.linestyle=wv,this.plotstyle=Cv,this.barstate={isLast:()=>this._ctx.symbol.isLastBar},this.input={bool:()=>{const e=this._inputCallback(this._inputIndex++);return(0,n.assert)("boolean"==typeof e,"Study input value should be a boolean"),e},int:()=>{const e=this._inputCallback(this._inputIndex++);return(0,n.assert)("number"==typeof e,"Study input value should be a number"),e},source:()=>{const e=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:()=>{const e=this._inputCallback(this._inputIndex++);return(0,n.assert)("string"==typeof e,"Study input value should be a string"),e},symbol:()=>{const e=this._inputCallback(this._inputIndex++);return(0,n.assert)("string"==typeof e,"Study input value should be a symbol string"),e}},this.request={security:(e,t)=>{const i=this._symbolIndexByTickerId.get(e);this._addedTickerIds.has(e)||this._ctx.new_sym(e,Py.Std.period(this._ctx)),(0,n.assert)(void 0!==i,`Unknown tickerId ${e}`);const s=this._ctx.new_unlimited_var(Py.Std.time(this._ctx));this._ctx.select_sym(i) -;const o=this._ctx.new_unlimited_var(Py.Std.time(this._ctx)),r=t?.expression?.()??this.close();return this._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)=>{const i=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)=>{const i=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)=>{let i;if((0,Pv.isEncodedExtendedSymbol)(e))i=e;else{const s={symbol:e,session:t};i=(0,Pv.encodeExtendedSymbolOrGetSimpleSymbolString)(s)}return this._symbolIndexByTickerId.has(i)||this._symbolIndexByTickerId.set(i,++this._symbolIndex),i}},this.timeframe={change:e=>{if(isNaN(Py.Std.time(this._ctx)))return!1;const t=(0,Td.newBarBuilder)(e,this._ctx.symbol.session,null);t.moveTo(Py.Std.time(this._ctx));return 0===t.startOfBar(0)-Py.Std.time(this._ctx)},isDWM:()=>this._ctx.symbol.isdwm()},this._addedTickerIds=new Set,this._symbolIndexByTickerId=new Map,this._returnValues=[],this._ctx=e,this._inputCallback=t,this._inputIndex=0,this._symbolIndex=0}open(){return this._ctx.new_var(Py.Std.open(this._ctx))}high(){return this._ctx.new_var(Py.Std.high(this._ctx))}low(){return this._ctx.new_var(Py.Std.low(this._ctx))}close(){return this._ctx.new_var(Py.Std.close(this._ctx))}volume(){return this._ctx.new_var(Py.Std.volume(this._ctx))}year(){return Py.Std.year(this._ctx)}na(e){return!!Py.Std.na(e)}series(e){return this._ctx.new_var(e)}fill(e,t,i){}hline(e,t){return{id:""}}indicator(e){}plot(e,t){const i="number"==typeof e?e:e.get(0),s=void 0===t?.offset?i:{offset:t.offset,value:i};return this._returnValues.push(s),{id:""}}getReturnValues(){return this._returnValues}setMinimumAdditionalDepth(e){this._ctx.setMinimumAdditionalDepth(e)}}var Mv=i(18330);const Iv=e=>{switch(e){case"data_window":return Ts.InputDisplayFlags.DataWindow;case"none":return Ts.InputDisplayFlags.None;default:return Ts.InputDisplayFlags.All}},Av=e=>{switch(e){case"data_window":return 2;case"none":return 0;default:return 15}};class Lv{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"}),new Tv),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:new Tv,min:e=>(0,Hd.isNumber)(e)?0:new Tv,negative:e=>(0,Hd.isNumber)(e)?0:new Tv},this.ta={change:e=>new Tv,correlation:(e,t,i)=>new Tv,cum:e=>new Tv,ema:()=>new Tv,rma:()=>new Tv,sma:()=>new Tv,vwap:()=>[new Tv,new Tv,new Tv],wma:()=>new Tv},this.request={security:e=>(this._tickers.push(e),new Tv)},this.runtime={error:e=>{throw new Error(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(){return this._title}getStudyMetainfo(){var e,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(){return this._tickers}open(){return new Tv}high(){return new Tv}low(){return new Tv}close(){return new Tv}volume(){return new Tv}year(){return 0}na(e){return!1}series(e){return new Tv}fill(e,t,i){const s=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}`);const c=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}),void 0===this._defaults.filledAreasStyle&&(this._defaults.filledAreasStyle={}),this._defaults.filledAreasStyle[s]=(e=>{if((e=>void 0===e?.color)(e))return{bottomColor:e?.bottomColor,fillType:"gradient",topColor:e?.topColor,visible:"all"===e?.display};return{fillType:void 0,color:e?.color??"TODO",visible:"all"===e?.display}})(i)}hline(e,t){const i=this._getNextBandId();this._bands.push({id:i,isHidden:!1,name:t?.title??"Level"}),void 0===this._defaults.bands&&(this._defaults.bands=[]);const s={color:t?.color??"#808080",linestyle:t?.linestyle??wv.hline.style_dashed,linewidth:t?.linewidth??1,value:e,visible:"none"!==t?.display,name:""};return this._defaults.bands.push(s),{id:i}} -indicator(e){void 0!==e.title&&(this._title=e.title),void 0!==e.shortTitle&&(this._shortTitle=e.shortTitle),void 0!==e.format&&(this._format={type:e.format,precision:e.precision}),void 0!==e.version&&(this._version=e.version),this._overlay=!!e.overlay}plot(e,t){const i=this._getNextPlotId();return this._plots.push({type:t?.style??"line",id:i}),void 0===this._defaults.styles&&(this._defaults.styles={}),this._defaults.styles[i]=(e=>{switch(e?.style){case void 0:case"line":return{color:e?.color??"#0496FF",display:Av(e?.display),linestyle:Mv.LineStyle.Solid,linewidth:e?.linewidth??1,plottype:jd.LineStudyPlotStyle.Line,trackPrice:!1,transparency:0};default:throw new Error("")}})(t),this._styles[i]={isHidden:!1,joinPoints:!1,title:t?.title??"Plot"},{id:i}}setMinimumAdditionalDepth(e){}_input(e){this._inputs.push(e),void 0===this._defaults.inputs&&(this._defaults.inputs={}),this._defaults.inputs[e.id]=(0,n.ensureDefined)(e.defval,"study input default value")}_getNextInputId(){return`in_${this._inputs.length}`}_getNextPlotId(){return`plot_${this._plots.length}`}_getNextBandId(){return`hline_${this._bands.length}`}_getNextFillId(){return`fill_${this._filledAreas.length}`}}var kv=i(4659);class Ev{build(e){const t=new Lv;return e(t),{name:t.getStudyName(),metainfo:t.getStudyMetainfo(),constructor:class{main(t,i,s){try{const s=new xv(t,i);e(s);const o=s.getReturnValues();return 0===o.length?null:o}catch(e){Py.Std.error(this._getErrorMessage(e))}}_getErrorMessage(e){if(e instanceof kv.StudyError)throw e;return(e instanceof Error?e.message:null==e?"Unknown error":e.toString()).replace(/:/g,"")}}}}}const Dv={palettes:{},inputs:[],plots:[{id:"open",type:"line"},{id:"high",type:"line"},{id:"low",type:"line"},{id:"close",type:"line"},{id:"volume",type:"line"}],graphics:{},_metainfoVersion:48,description:"Unnamed Study",format:{type:"inherit"},is_hidden_study:!0,is_price_study:!1,shortDescription:"Unnamed Study",description_localized:"Unnamed Study",id:"BarSetHeikenAshi@tv-prostudies",shortId:"BarSetHeikenAshi",packageId:"tv-basicstudies",version:13,fullId:"BarSetHeikenAshi@tv-basicstudies-13",productId:"tv-basicstudies",name:"BarSetHeikenAshi@tv-basicstudies",defaults:{},linkedToSeries:!1};class Bv{constructor(){this._metainfoCache=[]}studiesMetadata(){return 0===this._metainfoCache.length&&(this._metainfoCache=(0,r.getChartingLibraryGlobalContext)().JSServer.studyLibrary.map((e=>new ns.StudyMetaInfo(e.metainfo))),this._metainfoCache.push(new ns.StudyMetaInfo(Dv))),this._metainfoCache}}var Vv=i(78966),Rv=i.n(Vv);class Nv{createMarketStatusWatcher(e,t,i,s){return new(Rv())(e,t,i,s)}}class Ov{constructor(e){this._studyLibrary=e}findStudyObject(e){e.endsWith("!")&&(e=e.slice(0,-1));const t=e.split("@")[0],i=this._studyLibrary.filter((i=>i.metainfo.id===e||i.metainfo.shortDescription===t));if(0===i.length)return null;return i[0]}}var Fv,Wv=i(63193),Hv=i(56052),zv=i(82433),Uv=i(47132),jv=i(16329);class Gv{constructor(e,t){this.info=e,this.bars=t||[],this.isBarClosed=!0,this.firstLoadedTimeMs=0!==this.bars.length?this.bars[0].time:1/0, -this._emptyBarCount=0,this._lastBarIsEmpty=!1}symbolinfo(){return this.info}isLastBarClosed(){return this.isBarClosed}setLastBarClosed(e){this.isBarClosed=e}bar(e){const t=this.bars[e];if(void 0===t)throw new Error(`BarSet has no value at index ${e}`);return t}count(){return this.bars.length}emptyBarCount(){return this._emptyBarCount}add(e,t,i){void 0===i&&(i=!1);const s=e,o=this.bars,n=o.length,r=s.time,a=0===n?NaN:o[n-1].time;0===n||a{this._destroyed||this._processPendingSubscribers()}),0),s}removeSubscription(e){const t=this._pendingSubscribers.find((t=>t.key===e));if(t)return void this._pendingSubscribers.splice(this._pendingSubscribers.indexOf(t),1);const i=this._subscribers.find((t=>t.key===e));if(i)return this._subscribers.splice(this._subscribers.indexOf(i),1),void(this._subscribers.length||(this._resetCacheTimeout=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();const e=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(){const e=this._symbolInfo.currency_code,t=this._symbolInfo.unit_id;return`${(new Date).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(){void 0!==this._symbolInfo.expiration_date&&(this._nextTime=1e3*this._symbolInfo.expiration_date,this._leftDate=1e3*(this._symbolInfo.expiration_date+1))}_dealignTime(e){return null===this._dwmAligner?e:this._dwmAligner.timeToExchangeTradingDay(e)}_normalizeRange(e){const t=void 0!==e.to?e.to:this._dealignTime(this._now());if(0===this._cache.bars.length||void 0!==e.to&&t<=(0,n.ensureNotNull)(this._leftDate))return{countBack:e.countBack,to:t};const i=null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(t):t,s=(0,Pt.lowerbound)(this._cache.bars,i,((e,t)=>e.time{e.onErrorCallback(t)}))}let t=this._normalizeRange(e[0].range);for(const i of e.map((e=>this._normalizeRange(e.range))))(i.tot.countBack)&&(t=i);this._logMessage(`Leftmost subscriber requires ${t.countBack} bars prior ${$v(t.to)}`);!(null===this._leftDate||t.to{const t=this._moveSubscriberToRealtime(e);this._returnHistoryDataToSubscriber(e,t)})),this._subscribeRealtimeIfNeeded()):this._ensureRequestedTo(t)}_moveSubscriberToRealtime(e){const t={key:e.key,onHistoryCallback:e.onHistoryCallback,barset:null};return this._subscribers.push(t),t}_isSymbolExpired(){ -return this._symbolInfo.expired||void 0!==this._symbolInfo.expiration_date}_subscribeRealtimeIfNeeded(){!this._subscribers.length||this._realtimeOn||this._isSymbolExpired()||this._subscribeRealtime()}_subscribeRealtime(){if(this._symbolInfo.expired||this._realtimeOn)return;this._realtimeOn=!0,this._datafeed.subscribeBars(this._symbolInfo,this._resolution,(e=>{null!==this._dwmAligner&&(e.time=this._dwmAligner.timeToSessionStart(e.time)),this._putToCacheNewBar(e),this._subscribers.forEach((t=>{const i=t.barset;if(null===i)throw new Error("subscriber.barset is null");i.add(e),t.onHistoryCallback(i)}))}),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){const i=this._normalizeRange(e.range),s=this._createBarsetForRange(i);s.count()>0?this._logMessage("Bars to return for request {0}: total {1} bars in [{2} ... {3}] ".format(e.key,s.count(),$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){const t=null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(e.to):e.to,i=(0,Pt.lowerbound)(this._cache.bars,t,((e,t)=>e.time{if(!this._destroyed)if(r)this._logMessage("getBars callback is already called before",!0);else{if(r=!0,e.length>0){const t=` [${$v(e[0].time)} ... ${$v(e[e.length-1].time)}]`;this._logMessage(`Receiving bars: total ${e.length} bars in ${t}, requested range: ${n}`)}else this._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(){return this._nextSubscriptionId++}_checkBars(e,t=!1){if(l.enabled("charting_library_debug_mode"))for(let i=1;i"number"!=typeof e[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)return this._logMessage("Time range of received data is the same as cached one. Skip the update."),!0;if(0!==this._cache.bars.length&&e[e.length-1].time===this._cache.bars[0].time&&this._cache.bars.splice(0,1),0!==this._cache.bars.length&&e[e.length-1].time>=this._cache.bars[0].time){const t=this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time;if(this._cache.bars=[],!t)return this._leftDate=null,!1;this._logMessage("Received history up to now instead of incremental update. Return exactly what is requested.")}return this._cache.bars=[...e,...this._cache.bars],this._checkBars(this._cache.bars,!0),!0}_putToCacheNewBar(e){const t=this._cache.bars.length,i=e.time,s=0===t?NaN:this._cache.bars[t-1].time;0===t||st.destroy())),this._threads={},delete this._datafeed}purgeCache(){this._forEachThread(((e,t)=>t.destroy())),this._threads={}}resetCache(){this._forEachThread(((e,t)=>t.resetCache()))}subscribe(e,t,i,s,o){const n=qv(e,t);this._threads[n]||(this._threads[n]=this._createThread(e,t));return n+'"'+this._threads[n].addSubscription(i,s,o)}unsubscribe(e){const t=e.split('"');if(2!==t.length)return void this._logWarning("Wrong guid format");const i=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){return new Kv(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(`${(new Date).toISOString()} FEED: ${e}`)}}class Zv{constructor(){this._listeners=[]}listenersCount(){return this._listeners.reduce(((e,t)=>e+(t?1:0)),0)}addListener(e,t){this._listeners.push({dataListener:e,onErrorCallback:t}),this._barset&&e(this._barset),this._errorMsg&&t(this._errorMsg)}removeListener(e){const t=this._listeners.filter((t=>t&&t.dataListener===e));if(0===t.length)return;const i=this._listeners.indexOf(t[0]);delete this._listeners[i]}onError(e){this._errorMsg=e||"unspecified error";const t=this._listeners,i=t.length;for(let s=0;se.id===Xv.SubsessionId.Regular)),i=e.subsessions.find((e=>e.id===Xv.SubsessionId.PreMarket)),s=e.subsessions.find((e=>e.id===Xv.SubsessionId.PostMarket));void 0!==t&&(this.regularSubsession=new jv.SessionsSpec(e.timezone,t.session,e.session_holidays,t["session-correction"])),void 0!==i&&(this.preMarketSubsession=new jv.SessionsSpec(e.timezone,i.session,e.session_holidays,i["session-correction"])),void 0!==s&&(this.postMarketSubsession=new jv.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(){const e=this.time;if(!this.isdwm()||isNaN(e))return e;const t=(0,n.ensureDefined)(this.timezone,"symbol instrument timezone");let i=(0,Ce.utc_to_cal)(t,e);return i=this.session.spec.correctTradingDay(i),(0,Ce.cal_to_utc)(t,i)}lastbar(e){if(isNaN(e.time))return;let t=e.time;if(this.dwm_aligner){const e=(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))}const i=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)}}class Qv{constructor(e){this.mindepth=0,this.original=NaN,this.modified=!1,this._hist=null,this._histPos=0,this.symbol=e}valueOf(){return this.get(0)}get(e=0){return isNaN(e)&&(e=0),e=e||0,this._hist?e>=this._hist.length?(console.error("not enough depth: "+this),NaN):this._get(e):(this.mindepth=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){let e=Py.Std.na(this.mindepth)?Py.Std.max_series_default_size:Py.Std.max(this.mindepth+1,1);e=Math.round(e);const t=new Array(e);for(let i=0;i0&&void 0!==e&&i.set(e),i}new_unlimited_var(e){const t=this._vars;t.length<=this._varsIndex&&t.push(new eS(this.symbol));const i=t[this._varsIndex++];return arguments.length>0&&i.set(e),i}new_ctx(){return this._ctx.length<=this._ctxIndex&&this._ctx.push(new tS(this.symbol)),this._ctx[this._ctxIndex++]}prepare(e){this._ctxIndex=0,this._varsIndex=0;for(let t=0;te&&(e=i)}return e}stop(){this.symbol=null,this._vars=null}setMinimumAdditionalDepth(e){this.minimumAdditionalDepth=e}}function iS(e){return!Array.isArray(e)&&"composite"!==e.type&&"non_series_bars"!==e.type&&!!e.nonseries}class sS{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=new tS(this.add_sym(e,t,i,s,h,c)),this.init()}calc(e){const t=this._ctx,i=this._body;t.prepare(e);const s=i.main(t,this._inputCallback,e);var o;if(null!=s)if(null===(o=s)||Array.isArray(o)||"composite"!==o.type)this._processResult(s);else for(let e=0;e1&&this._runner.host.enableDwmAligning&&r.enable_dwm_aligning(this._symbols[0].session,r.session),r}maxAdditionalDepth(){return this._symbols[0].isAdditionalDepthAllowed?this._ctx.maxAdditionalDepth():0}stop(){this._symbols=null,this._ctx?.stop(),this._ctx=null}get_sym(e){return this._symbols[e]}_processResult(e){const t=this._ctx;var i;this._out&&e&&(!isNaN(t.symbol.time)||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)})))}}class oS{constructor(e){this._nonseriesUpdate=null,this._script=null,this._symbols=[],this._barsets=[],this._subscription=[],this.host=e,this._isRecalculated=!1,this.isStarted=!1,this.start()}add_sym(e,t,i,s,o,n,r){const a=new Jv(e,t,i,s,o,r,n);return this._symbols.push(a),a}get_sym(e){return this._symbols[e]}out(e,t){if(this._nonseriesUpdate){const i=Object.assign({},this._nonseriesUpdate);t.splice(0,0,e.time),i.lastBar=t,this.host.nonseriesOut(e,i)}else this.host.out(e,t)}start(){this.isStarted=!0;const e=this.host,t=new sS(e.tickerid,e.period,e.currencyCode,e.unitId,this,e.body,this.out.bind(this),e.input,e.nonseriesOut,e.symbolInfo,e.subsessionId);this._script=t;const i=[],s=this._symbols,o=Object.assign({},e.dataRange,{countBack:(e.dataRange.countBack??0)+this._script.maxAdditionalDepth() -}),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=>{function i(i,s){let o=(0,Jd.createTimeToBarTimeAligner)(i,s)(e);const r=(0,Jd.createDwmAligner)(i,s);return null!==r&&(o=r.timeToExchangeTradingDay(o)),{to:o,countBack:(0,n.ensureNotNull)(t,"script runner script").maxAdditionalDepth()}}for(let e=1;e=0;t--){const i=e[t],s=this._barsets[t],o=s.count();for(let e=0;ee.endOfData));t&&this.host.setNoMoreData(),this.host.recalc(this,{endOfData:t,firstLoadedTimeMs:this._barsets[0].firstLoadedTimeMs,emptyBarCount:this._barsets[0].emptyBarCount()})}catch(e){if(!(e instanceof kv.StudyError))throw e;this.host.onErrorCallback(e.message,e.title)}}}class nS{constructor(e){this.runner=new oS(e)}stop(){this.runner.stop()}isStarted(){return this.runner.isStarted}}class rS{constructor(e,t,i,s,o,n,r,a,l,c,h){this.listeners=t,this._isRecalculated=!1,this._symbolInfo=a,this.engine=new nS({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:()=>{throw new Error("BarBuildItem scripts should not need to access any input values")},recalc:(e,t)=>{this._recalc(t)},out:(e,t)=>{this._out(e,t)},nonseriesOut:(e,t)=>{this._nonseriesOut(e,t)},setNoMoreData:()=>{this._barset&&(this._barset.endOfData=!0)},onErrorCallback:e=>{this.listeners.onError(e)}})}stop(){this.engine?this.engine.stop():console.error("Internal library error 0x1")}_recalc(e){ -this._isRecalculated&&console.error("recalc called twice!"),this._barset||(this._barset=new Gv(this._symbolInfo)),e&&(this._barset.firstLoadedTimeMs=e.firstLoadedTimeMs,this._barset.endOfData=e.endOfData),this.listeners.fire(this._barset),this._isRecalculated=!0}_nonseriesOut(e,t){const i=Object.assign({},t);i.nonseries=!0,i.data=t.bars,delete i.bars,i.barsetSize=this._barset?this._barset.count():0,i.lastBar=this._barset&&this._barset.count()>0?this._barset.bar(this._barset.count()-1):null,this.listeners.fire(i,!0)}_out(e,t){const i=t[0];if(isNaN(i))return;const s={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=new Gv((0,n.ensureDefined)(e.info,"bar builder item output symbol info")));const r=t[8],a=t[9];if(r instanceof Array&&a)for(let e=0;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)}}var hS=i(99955);class dS{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):void 0,e.setMinimumAdditionalDepth(0)}main(e){const t=(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):void 0,P=e.new_var(Py.Std.close(e)).get(1),x=T instanceof Array?P:NaN;return c.set(f),h.set(y),d.set(v),u.set(b),[s,f,y,v,S,b,w,C,T,x]}_extrapolate(e,t){return isNaN(e)||isNaN(t)?void 0:(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);class pS{constructor(e){this._host=e,this._cache={}}subscribe(e,t,i,s,o,n,r,a,l,c,h){const d=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){const t=this._getCache(e.key);t&&t.listeners.removeListener(e.listener)}removeUnused(){const e=[],t=e=>!!this._cache[e];for(const i in this._cache)if(t(i)){0===(0,n.ensureNotNull)(this._cache[i],`datafeed cache item ${i}`).listeners.listenersCount()&&e.push(i)}if(0!==e.length){for(let t=0;t{const s=mS(e,t,i),o=t(s);return void 0!==o?o:s}))}(e,t,i):(0,tt.isObject)(e)&&((0,tt.isHashObject)(e)||i&&i.visitInstances)?function(e,t,i){const s={};return Object.keys(e).forEach((o=>{const n=mS(e[o],t,i),r=t(n);s[o]=void 0!==r?r:n})),s}(e,t,i):e}function gS(e,t,i){const s=mS(e,t,i),o=t(s) -;return void 0!==o?o:s}var fS,yS=i(92211);function vS(e,t){return e.length>t}!function(e){e[e.DefaultExtrapolateLimit=2e5]="DefaultExtrapolateLimit",e[e.ExtendedExtrapolateLimit=45e4]="ExtendedExtrapolateLimit"}(fS||(fS={}));class SS{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=new Cd.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),this._barBuilder=(0,Td.newBarBuilder)(t,this._session,null)}destroy(){this.clear()}interval(){return this._interval}barBuilder(){return this._barBuilder}symbolInfo(){return this._symbolInfo}clear(){this._firstRealBarTimeMs=null,this._historyBarsCache=[],this._barsTimes=[],this._lastRealBarTimeMs=null,this._futureBarsCache=[],this._minFutureBarsCount=0,this._projectionFirstIndex=1/0}firstFutureBarIndex(){return this._barsTimes.length}futureBars(){return this._futureBarsCache}replaceBarsTimesTail(e,t=e.length){if(0===e.length)return;if(0===this._barsTimes.length)return void this.setBarsTimes(e,t);const i=e[0],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){const i=this._barsTimes;if(this._barsTimes=e.slice(),this._projectionFirstIndex=0===this._barsTimes.length?1/0:t,0===e.length)return this._historyBarsCache=[],this._futureBarsCache=[],this._firstRealBarTimeMs=null,void(this._lastRealBarTimeMs=null);0!==i.length&&i[i.length-1]===e[e.length-1]||this._setLastRealBarTime(e[e.length-1]),0!==i.length&&i[0]===e[0]||(this._historyBarsCache=[],this._firstRealBarTimeMs=e[0])}extrapolateTimeWithOffsetToTime(e,t){if(0===t)return{timeMs:e,exact:!0};0===this._barsTimes.length&&(t<0?null===this._firstRealBarTimeMs?this._firstRealBarTimeMs=e:(this._extendHistoryCacheToTimeFromRight(Math.min(e,null!==this._lastRealBarTimeMs?this._lastRealBarTimeMs:1/0)),this._ensureExtrapolatedToHistoryTime(e)):null===this._lastRealBarTimeMs?this._lastRealBarTimeMs=e:(this._extendFutureCacheToTimeFromLeft(Math.max(e,null!==this._firstRealBarTimeMs?this._firstRealBarTimeMs:1/0)),this.ensureExtrapolatedToFutureTime(e)));const i=this.indexOfTime(e);if(null===i)return null;const s=this.timeOfBarIndex(i.index+t,0);return null===s?null:((i.index<0||this._projectionFirstIndex<=i.index)&&(s.exact=!1),s)}indexOfTime(e){if(null!==this._firstRealBarTimeMs&&ethis._lastRealBarTimeMs){this.ensureExtrapolatedToFutureTime(e);let t=(0,Pt.lowerbound_int)(this._futureBarsCache,e);if(0!==this._futureBarsCache.length&&t===this._futureBarsCache.length&&e>this._futureBarsCache[this._futureBarsCache.length-1])return null;this._futureBarsCache[t]!==e&&(t-=1);const i=Math.max(1,this._barsTimes.length)+t;return{index:i,timeMs:i===this._barsTimes.length-1?(0,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){const e=this.timeOfBarIndex(0,0);return null===e?null:{index:0,timeMs:e.timeMs}}return null}let t=(0,Pt.lowerbound_int)(this._barsTimes,e);return this._barsTimes[t]!==e&&(t-=1),{index:t,timeMs:this._barsTimes[t]}}setMinFutureBarsCount(e){this._minFutureBarsCount=e,0!==this._barsTimes.length&&this._ensureExtrapolatedToFutureBar(e)}ensureExtrapolatedToFutureTime(e){null!==this._lastRealBarTimeMs&&this._lastRealBarTimeMs>=e||vS(this._futureBarsCache,this._extrapolateLimit)||0!==this._futureBarsCache.length&&this._futureBarsCache[this._futureBarsCache.length-1]>=e||(l.enabled("disable_resolution_rebuild")&&(this._interval.isDays()||this._interval.isWeeks())&&this._barsTimes.length>=2?this._extendFutureCacheFromRight(((t,i)=>{const s=this._futureBarsCache.length>0?this._futureBarsCache[this._futureBarsCache.length-1]:t;return this._calculateBarPattern(s,e,null)})):this._extendFutureCacheFromRight(((t,i)=>(0,hS.extrapolateBarsFrontToTime)(this._barBuilder,t,e,this._extrapolateLimit,!0).times)),this._futureBarsCache[this._futureBarsCache.length-1]=this._barsTimes.length){const t=e-Math.max(1,this._barsTimes.length);return this._ensureExtrapolatedToFutureBar(t+1), -t>=this._futureBarsCache.length?null:{timeMs:this._futureBarsCache[t],exact:!1}}return{timeMs:this._barsTimes[e],exact:ethis._extrapolateLimit)break;c++}return r}_extendFutureCacheFromRight(e){const t=0!==this._futureBarsCache.length?this._futureBarsCache[this._futureBarsCache.length-1]:this._lastRealBarTimeMs;if(null===t)return!1;const i=e(t,this._futureBarsCache.length)||[];return 0!==i.length&&(this._futureBarsCache=this._futureBarsCache.concat(i),!0)}_extendHistoryCacheFromLeft(e){const t=0!==this._historyBarsCache.length?this._historyBarsCache[0]:this._firstRealBarTimeMs;if(null===t)return;const i=e(t,this._historyBarsCache.length);this._historyBarsCache=i.concat(this._historyBarsCache)}_extendFutureCacheToTimeFromLeft(e){if(null!==this._lastRealBarTimeMs&&this._lastRealBarTimeMs<=e)return;if((0,n.assert)(0===this._barsTimes.length||e===this._barsTimes[this._barsTimes.length-1],"invalid argument"),this._lastRealBarTimeMs=e,0===this._futureBarsCache.length)return;const t=(0,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;const t=(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)=>{const s=this._futureBarsCache.length>0?this._futureBarsCache[this._futureBarsCache.length-1]:t,o=e-i;return this._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)=>{const s=(0,hS.extrapolateBarsFrontToTime)(this._barBuilder,t-1,e-1,this._extrapolateLimit,!0).times;return s[s.length-1]===t?s.slice(0,-1):s})),(0===this._historyBarsCache.length||this._historyBarsCache[0]>e)&&this._ensureExtrapolatedToHistoryBar(this._historyBarsCache.length+1))}}function bS(e){return 60*e*60*1e3}function wS(e){return 60*e*1e3}const CS=[{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}];var TS,PS;function xS(e,t){if(null!==t){if(e.getUTCFullYear()!==t.getUTCFullYear())return 70;if(e.getUTCMonth()!==t.getUTCMonth())return 60;if(e.getUTCDate()!==t.getUTCDate())return 50;const i=t.getTime(),s=e.getTime();for(let e=CS.length-1;e>=0;--e)if(Math.floor(i/CS[e].divisor)!==Math.floor(s/CS[e].divisor))return CS[e].weight}return 18}function MS(e,t,i=0){if(0===e.length)return[];let s=i,o=i;const n=[];for(;s=t.length?(n.push({old:s,new:Fh.INVALID_TIME_POINT_INDEX}),s++):e[s].timeMs===t[o].timeMs?(s!==o&&n.push({old:s,new:o}),s++,o++):e[s].timeMs{if(e.new===t.new&&e.new===Fh.INVALID_TIME_POINT_INDEX)return e.old-t.old;if(e.new===Fh.INVALID_TIME_POINT_INDEX)return-1;if(t.new===Fh.INVALID_TIME_POINT_INDEX)return 1;const i=e.old-e.new,s=t.old-t.new;return i>0?s>0?e.old-t.old:-1:s<0?t.new-e.new:1}))}function IS(e,t){return{span:e.markWeight,time:e.displayTime,index:t}}!function(e){e[e.FutureTickMarksLimit=1e3]="FutureTickMarksLimit"}(PS||(PS={}));class AS{constructor(){this._completed=!0,this._mainSymbolExtrapolator=null,this._pointDataByTimePoint=new Map,this._instanceIds=new Set,this._displayTimezone=null,this._minFutureBarsCount=0,this._sortedTimePoints=[],this._needRebuildEndOfPeriod=l.enabled("end_of_period_timescale_marks"),this._shouldAlignDwmBarsToMainSeries=l.enabled("align_dwm_bars_to_main_series")}destroy(){this.clearTimeScale()}setCompleted(e){this._completed=e}isCompleted(){return this._completed}clearTimeScale(){return this._pointDataByTimePoint.clear(),this._instanceIds.clear(),this._sortedTimePoints=[],{baseIndex:null,pointsIndex:0,indexChange:[],marks:[],points:[],clearTickMarks:!0}}indexOfTime(e){if(0===this._sortedTimePoints.length)return null===this._mainSymbolExtrapolator?null:this._mainSymbolExtrapolator.indexOfTime(e);if(ethis._sortedTimePoints[this._sortedTimePoints.length-1].timeMs){if(null===this._mainSymbolExtrapolator)return null;const t=this._mainSymbolExtrapolator.indexOfTime(e),i=this._mainSymbolExtrapolator.indexOfTime(this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs);if(null===t||null===i)return null;const s=t.index-i.index-1;return{index:this._sortedTimePoints.length+s,timeMs:t.timeMs}}let t=(0,Pt.lowerbound)(this._sortedTimePoints,e,((e,t)=>e.timeMs({timeMs:e,markWeight:0,displayTime:NaN})));this._fillPointsData(i,0,0!==this._sortedTimePoints.length?this._sortedTimePoints[this._sortedTimePoints.length-1].displayTime:null);const s=[];for(let t=e;tIS(e,i+t)));return s.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;let t=-1,i=(0,Pt.lowerbound)(this._sortedTimePoints,Math.round(1e3*e[0].value[0]),((e,t)=>e.timeMse.timeMs{for(;s=this._sortedTimePoints.length){const t=this.indexOfTime(e);if(null===t)return Fh.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(){return 0===this._sortedTimePoints.length?null:this._sortedTimePoints[0].timeMs}replaceStudyBarsTimesTail(e,t){return this._replaceInstanceBarsTimesTail(e,t)}replaceBarsTimesTail(e,t){return this._replaceInstanceBarsTimesTail(e,t)}setSeriesBarsTimes(e,t){return this._setBarsTimes(e,t)}setStudyBarsTimes(e,t,i){ -return this._setBarsTimes(e,t,i)}_setBarsTimes(e,t,i){const s=0!==this._pointDataByTimePoint.size;if(this._instanceIds.has(e))for(const t of this._sortedTimePoints)t.pointData.instances.delete(e);0===t.length?this._instanceIds.delete(e):this._instanceIds.add(e),this._addBarsTimesToInstance(e,t,!1),s&&this._cleanupPointsData(this._sortedTimePoints);const o=[];this._pointDataByTimePoint.forEach(((e,t)=>{o.push({markWeight:0,timeMs:t,displayTime:NaN,pointData:e})})),o.sort(((e,t)=>e.timeMs-t.timeMs));const n=this._updateTimeScalePoints(o);return this._applyTimeScaleChanges(n,i||!1)}_replaceInstanceBarsTimesTail(e,t){if(0===t.length)return null;if(!this._instanceIds.has(e))return this._setBarsTimes(e,t);const i=[],s=(0,Pt.lowerbound)(this._sortedTimePoints,t[0],((e,t)=>e.timeMs({timeMs:e.timeMs,pointData:e.pointData,markWeight:0,displayTime:NaN})));for(let e=s;ee.timeMs-t.timeMs));const r=this._updateTimeScalePointsTail(n);return this._applyTimeScaleChanges(r,!1)}_updateFutureBars(){if(0===this._minFutureBarsCount||null===this._mainSymbolExtrapolator)return;if(0!==this._sortedTimePoints.length){const e=this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs;this._mainSymbolExtrapolator.ensureExtrapolatedToFutureTime(e)}const e=this._futureBarsFirstPointIndex();this._mainSymbolExtrapolator.setMinFutureBarsCount(e+this._minFutureBarsCount)}_addBarsTimesToInstance(e,t,i){const s=i?[]:null;for(const i of t){const t=this._pointDataByTimePoint.get(i);if(void 0===t){const t=new Set;t.add(e);const o={index:0,instances:t};this._pointDataByTimePoint.set(i,o),null!==s&&s.push({timeMs:i,pointData:o})}else t.instances.add(e)}return s}_futureBarsFirstPointIndex(){if(null===this._mainSymbolExtrapolator||0===this._sortedTimePoints.length)return 0;const e=this._mainSymbolExtrapolator.futureBars();return(0,Pt.upperbound_int)(e,this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs)}_futureBars(){return null===this._mainSymbolExtrapolator?[]:this._mainSymbolExtrapolator.futureBars().slice(this._futureBarsFirstPointIndex(),this._futureBarsFirstPointIndex()+1e3)}_cleanupPointsData(e){for(const t of e)0===t.pointData.instances.size&&this._pointDataByTimePoint.delete(t.timeMs)}_updateTimeScalePoints(e){let t=-1;for(let i=0;ie.timeMs=this._sortedTimePoints.length)continue;this._sortedTimePoints[n].timeMs!==o.timeMs&&-1===i&&(i=n)}const s=t+e.length;if(i=LS(i,this._sortedTimePoints.length,s),-1===i)return null;this._fillPointsData(e,0,0===t||0===this._sortedTimePoints.length?null:this._sortedTimePoints[t-1].displayTime);const o=MS(this._sortedTimePoints.slice(t),e).map((e=>({old:e.old+t,new:e.new===Fh.INVALID_TIME_POINT_INDEX?e.new:e.new+t})));{const i=this._sortedTimePoints;let o=0;for(;t+o1&&null===i){const t=Math.ceil(n/(e.length-1)),i=new Date(1e3*(e[0].displayTime-t));e[0].markWeight=xS(new Date(1e3*e[0].displayTime),i)}}(e,t,i)}_applyTimeScaleChanges(e,t){if(null===e)return t?(this._fillPointsData(this._sortedTimePoints,0),{points:[],pointsIndex:0,baseIndex:this._getBaseIndex(),indexChange:[],marks:this.tickMarks(0),clearTickMarks:!0}):null;let i=e.pointsIndex;if(0!==i&&t&&(this._fillPointsData(this._sortedTimePoints,0),i=0),0===this._sortedTimePoints.length)return{baseIndex:null,pointsIndex:0,indexChange:[],marks:[],points:[],clearTickMarks:!0};const s=[];for(let t=e.pointsIndex;t[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=new Map([["horizlines",(e,t)=>{const i=e;i.startIndex=t.get(i.startIndex),i.endIndex=t.get(i.endIndex)}],["hhists",(e,t)=>{const i=e;i.firstBarTime=t.get(i.firstBarTime),i.lastBarTime=t.get(i.lastBarTime)}],["vertlines",(e,t)=>{const i=e;i.index=t.get(i.index)}],["polygons",(e,t)=>{const i=e;for(const e of i.points)e.index=t.get(e.index)}],["backgrounds",(e,t)=>{const i=e;i.start=t.get(i.start),i.stop=t.get(i.stop)}]]);class DS{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),void 0,void 0,void 0,void 0]}}const BS=(0,ne.getLogger)("ChartApi.PointsetsManager");class VS{constructor(){this._pointsetsDataBySymbol=new Map}destroy(){this._pointsetsDataBySymbol.clear()}createPointset(e,t,i,s,o){let n=this._pointsetsDataBySymbol.get(t);void 0===n&&(n=new Map,this._pointsetsDataBySymbol.set(t,n));const r=[];for(const t of s){const[s,n,a]=t;if("number"!=typeof s||Number.isNaN(s)){BS.logWarn(`Pointset time is invalid: id=${e}, ${s} of type ${typeof s}`);continue}const l=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){const t=[];this._pointsetsDataBySymbol.forEach(((i,s)=>{i.delete(e),0===i.size&&t.push(s)}));for(const e of t)this._pointsetsDataBySymbol.delete(e)}invalidatePointsetsForSymbol(e,t){const i=this._pointsetsDataBySymbol.get(e);void 0!==i&&i.forEach(((e,i)=>{if(Re.Interval.isEqual(e.resolution,t))for(const t of e.points)null!==t.extrapolation&&t.extrapolation.exact&&(t.extrapolation.exact=!1)}))}getUpdatesForSymbol(e,t,i,s){const o=new Map,n=this._pointsetsDataBySymbol.get(e);return void 0!==n&&n.forEach(((e,n)=>{const r=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(let s=0;s ${t}`),null;o.push({index:i,value:[r.index,r.timeMs/1e3]})}return o}}const RS=-5e6,NS="pre_post_market_sessions",OS=l.enabled(NS),FS=l.enabled("pay_attention_to_ticker_not_symbol");class WS{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=new Map,this._symbolIdToSymbolRequestString=new Map,this._callbacks={},this._serverTimeOffset=0,this._logMessage("Datafeed settings received: {0}".format(JSON.stringify(window.configurationData))),this._datafeedConfiguration=function(e){const t=(0,tt.merge)({},e),i=t.supported_resolutions;if(!i||0===i.length)return t.supported_resolutions=void 0,t;const s=[];for(let e=0;e{this._serverTimeOffset=e-(new Date).valueOf()/1e3})),this._invalidatedPointsetSessions=new Set,this._refreshPointsetsTimerId=null,this._pointsetsManagers={},this._quotesInfo={},this._depthInfo={},this._endOfData={},this._computeStudyCounter=0,this._symbolExtrapolators={},this._timeScales={},this._cachedDatafeed=new Yv(e,this.serverTimeOffset.bind(this),this._datafeedConfiguration.reset_cache_timeout);const o=(e,t,i)=>{const s=new Cd.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),o=(0,Td.newBarBuilder)(t,s,s);return e=>{if(e&&e.count()){const t=1e3*this.getCurrentUTCTime();o.moveTo(t),o.indexOfBar(t)>=0&&e.setLastBarClosed(!1)}i(e)}};this._pineDatafeed=new pS({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(const e of Object.keys(this._quotesInfo))this._stopQuotesSubscription(e);this._cachedDatafeed.destroy(),this._externalDatafeed=null;for(const e of Object.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(){return this._serverTimeOffset}getCurrentUTCTime(){return(new Date).valueOf()/1e3+this._serverTimeOffset}serverTime(){return 1e3*this.getCurrentUTCTime()}switchTimezone(e,t){ -this._timeScales[e].setTimezone(t);const i=this._timeScales[e].tickMarks();null!==i&&this._chartApiMessagerProvider.getChartApiMessager(e).onTickmarksUpdated(0,i)}on(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this}supportedResolutions(){return this._datafeedConfiguration.supported_resolutions}supportedCurrencies(){return this._datafeedConfiguration.currency_codes||[]}supportedUnits(){return this._datafeedConfiguration.units||{}}supportedPriceSources(e){return new Promise(((t,i)=>{this._resolveSymbolImpl(e,(e=>{t(JS(e).price_sources)}),(e=>{i(e)}))}))}supportedSymbolsTypes(){return this._datafeedConfiguration.symbols_types||[]}symbolsGrouping(){return this._datafeedConfiguration.symbols_grouping||{futures:/$a/}}getMarks(e,t,i,s,o){const r={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,new Date(1e3*t).toUTCString(),new Date(1e3*i).toUTCString())),this._externalDatafeed.getMarks(JS(e),t,i,(t=>{const i=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)));const a=(0,Jd.createDwmAligner)(o,e),c=l.enabled("two_character_bar_marks_labels"),h=i.map((e=>{const t=e;return t.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,new Date(1e3*t).toUTCString(),new Date(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)));const i=(0,Jd.createDwmAligner)(o,e),r=t.map((e=>{const t=e;return t.tickmark=null!==i?i.timeToSessionStart(1e3*e.time)/1e3:e.time,t}));s(r)}),o))}getSeriesLastBarTime(e,t){const i=this._getSeriesData(e,t);return null===i||0===i.length?null:i[i.length-1].timeMs}getSeriesInterval(e,t){const i=this._studiesCache[e][t];return i?i.resolution:null}onSessionSeriesError(e){this.stopSources(e);const t=this._mainSeriesRecord(e);null!==t&&(t.error=!0),this._applyTimeScaleUpdate(e,this._timeScales[e].clearTimeScale())}stopSources(e){for(const t of this._getStudiesCacheSessionKeys(e)){const i=this._studiesCache[e][t];i&&"series"===i.type&&this._stopSourcesTree(e,t)}}getSeriesSymbolInfo(e,t){const i=this._studiesCache[e][t];return i?i.symbolInfo:null}modifySeries(e,t,i,s,o,r){const a=this._mainSeriesRecord(e);if(null===a||a.guid!==t){ -if(null!==a&&a.error)return this._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(const i of this._getStudiesCacheSessionKeys(e)){const s=this._studiesCache[e][i];if(s&&"study"===s.type&&s.parentId===t){this._studiesNonSeriesTimes[e][i]=null;const t=this._studiesCache[e][s.parentId];this._createStudy(t.symbolId,t.resolution,s.studyObject,e,i,s.turnaround,s.parentId,(0,n.ensure)(s.inputs))}}}else this._modifyMainSeries(e,i,s,o,r)}createStudy(e,t,i,s,o,n){const r=this._studiesCache[e][i],a=this._studyLibrary.findStudyObject(o);if(null===a)return $S("Study does not exist: "+o),void this._chartApiMessagerProvider.getChartApiMessager(e).onStudyError(t,s,"unknown study name");const l=new a.constructor;this._studiesCache[e]=this._studiesCache[e]||{},this._studiesCache[e][t]={studyObject:l,guid:t,type:"study",inputs:n,metainfo:a.metainfo,turnaround:s,parentId:i},this._studiesNonSeriesTimes[e][t]=null,this._createStudy(r.symbolId,r.resolution,l,e,t,s,i,n)}modifyStudy(e,t,i,s){const o=this._studiesCache[e][t];if(!o)throw Error("This should never happen");const n=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){return this._timeScales[e]||null}isTimeScaleExtendedTo(e,t){const i=(0,n.ensure)(this._mainSeriesRecord(e));if(Re.Interval.isDWM(i.resolution)&&null!=i.symbolInfo){const e=(0,Jd.createDwmAligner)(i.resolution,i.symbolInfo);null!==e&&(t=e.timeToSessionStart(t))}const s=this._timeScales[e].indexOfTime(t);return null!==s&&s.index>=0}ensureExtendedTo(e,t,i){if(!this._studiesCache[t][e])throw Error("This should never happen");setTimeout((()=>{this._recreateSourcesForDataRange(t,{to:i})}),0)}extendSeriesRange(e,t){let i=this._timeScales[e].firstSeriesBarTime();if(null===i)return void this._logMessage("Nothing to extend - there is no points on time scale");const s=(0,n.ensure)(this._mainSeriesRecord(e));if(Re.Interval.isDWM(s.resolution)&&null!=s.symbolInfo){const e=(0,Jd.createDwmAligner)(s.resolution,s.symbolInfo);null!==e&&(i=e.timeToExchangeTradingDay(i))}const o=(0,n.ensure)(this._symbolIdToSymbolRequestString.get(US(e,s.symbolId))),r=this._barsCoefficients(o,s.resolution),a=r.barsCoefficient||1;if(!r.barsCoefficient){const i=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){return this._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);const c=new DS;this._studiesCache[e]=this._studiesCache[e]||{};const h=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)void 0!==t.countBack&&null!==a&&0!==a.length&&(t.to=a[0].timeMs),i&&null!=i.firstLoadedTimeMs?t.to=void 0!==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));else if(1===r)t=Object.assign({},i.initialDatarange);else{const e=c[h].firstSeriesBarTime();(void 0===t.to||null!==e&&e{const a=[];if(void 0!==r){const e=(r.data||[]).reduce(((e,t)=>Math.max(e,t[0]||0)),-1);if(null!=r.projectionTime)for(let t=0;t<=e;++t)a.push(r.projectionTime+t)}let l=null,c=null;const h=s?this._getSymbolExtrapolator(e,s,o):null;if(void 0!==n){const i=n.map((e=>e.timeMs)).concat(a);null!==h&&h.replaceBarsTimesTail(i,n.length),c=this._timeScales[e].replaceBarsTimesTail(t,i),l=n}else{const i=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&&void 0===r)return;this._timeScales[e].fillIndexesInRows(l);const d=void 0!==r?this._prepareSeriesNonSeriesData(e,t,r):null;this._chartApiMessagerProvider.getChartApiMessager(e).onDataUpdate(t,i,l,d)},g=s=>{const o=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)=>{const d=this._studiesCache[e][t];if(!d)throw Error("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){const i=(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);const c=s[s.length-1];if(n){if(!this._studiesCache[e][t])throw Error("This should never happen");this._logMessage("New bar arrived: symbol {0}, resolution {1}, bar {2}".format(l.full_name,o,JSON.stringify(c)))}else this._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)throw new Error("unexpected non-series data type for series "+s.type);const r=this._getSeriesData(e,t);if(null!==r)m((0,n.ensure)(o.info),0===r.length?void 0:[r[r.length-1]],s);else{const o=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);const i=this._timeScales[e].setStudyBarsTimes(t,[],!0);this._applyTimeScaleUpdate(e,i),this._updateTimeScaleState(e)}delete this._studiesCache[e][t],delete this._studiesNonSeriesTimes[e][t]}removeSeries(e,t){this._stopSourcesTree(e,t),delete this._studiesCache[e][t],this._updateMainTsBuilder(e),this._timeScales[e].isCompleted()&&this._timeScales[e].setCompleted(!1);const i=this._timeScales[e].setSeriesBarsTimes(t,[]);this._applyTimeScaleUpdate(e,i),this._updateTimeScaleState(e)}requestMoreTickmarks(e,t){const i=this._timeScales[e];i.setMinFutureBarsCount(i.minFutureBarsCount()+t);const s=i.firstFutureBarIndex(),o=i.tickMarks(s);this._chartApiMessagerProvider.getChartApiMessager(e).onTickmarksUpdated(s,o)}chartCreateSession(e){this._pointsetsManagers[e]=new VS,this._timeScales[e]=new AS,this._studiesNonSeriesTimes[e]={}}chartDeleteSession(e){this._pointsetsManagers[e].destroy(),delete this._pointsetsManagers[e],this._timeScales[e].destroy(),delete this._timeScales[e],delete this._studiesNonSeriesTimes[e]}removePointset(e,t){this._pointsetsManagers[e].removePointset(t)}async createPointset(e,t,i,s,o){const n=this._resolvePromisesBySymbolId.get(US(e,i));if(void 0===n)return;let r;try{r=(await n).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 `{0}`, exchange: `{1}`, type `{2}`".format(e,t,i));this._externalDatafeed.searchSymbols(e,t,i,(e=>{this._logMessage("Symbol search response: {0}".format(JSON.stringify(e))),e.forEach((e=>{XS(e.logo_urls,e.exchange_logo,e)})),s(e)}),o)}resolveSymbol(e,t,i){this._symbolIdToSymbolRequestString.set(US(e,t),i),this._resolvePromisesBySymbolId.set(US(e,t),new Promise(((s,o)=>{this._resolveSymbolImpl(i,(o=>{this._chartApiMessagerProvider.getChartApiMessager(e).onSymbolResolved(t,o),s({symbolInfo:o,requestedSymbol:i})}),(i=>{this._chartApiMessagerProvider.getChartApiMessager(e).onSymbolError(t,i),o(i)}))})))}quoteCreateSession(e){this._quotesInfo[e]={symbols:[],fastSymbols:[],listenerGUID:void 0}}quoteDeleteSession(e){this._stopQuotesSubscription(e),delete this._quotesInfo[e]}quoteSetFields(e,t){}quoteAddSymbols(e,t){this._quotesInfo[e].symbols=this._filteredSymbols(this._quotesInfo[e].symbols.concat(t)),this._restartQuotesSubscription(e)}quoteRemoveSymbols(e,t){this._quotesInfo[e].symbols=this._quotesInfo[e].symbols.filter((e=>t.indexOf(e)<0)),this._restartQuotesSubscription(e)}quoteFastSymbols(e,t){this._quotesInfo[e].fastSymbols=this._filteredSymbols(t),this._restartQuotesSubscription(e)}quoteHibernateAll(e){}depthCreateSession(e){this._depthInfo[e]={symbol:null,listenerGUID:void 0}}depthDeleteSession(e){this._depthInfo[e].symbol=null,this._stopDepthSubscription(e),delete this._depthInfo[e]}depthSetSymbol(e,t){this._depthInfo[e].symbol=t,this._restartDepthSubscription(e)}hasStudyWithExtendedTimeScale(e){for(const t of this._getStudiesCacheSessionKeys(e)){if("study"===this._studiesCache[e][t].type&&this._studyCanExtendTimeScale(e,t))return!0}return!1}_stopDepthSubscription(e){this._depthInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeDepth?.(this._depthInfo[e].listenerGUID),this._depthInfo[e].listenerGUID=void 0)}_restartDepthSubscription(e){this._stopDepthSubscription(e),this._startDepthSubscription(e)}_startDepthSubscription(e){const t=this._depthInfo[e].symbol;if(!t)return;const i=e=>e.map((e=>({p:e.price,v:e.volume}))),s=e=>({s:t,bids:i(e.bids),asks:i(e.asks)}),o=t=>{t.snapshot?this._chartApiMessagerProvider.getChartApiMessager(e).onDepthData([e,s(t)]):this._chartApiMessagerProvider.getChartApiMessager(e).onDepthUpdate([e,s(t)])};this._externalDatafeed.subscribeDepth&&(this._depthInfo[e].listenerGUID=this._externalDatafeed.subscribeDepth(t,(t=>{this._depthInfo[e]&&o(t)})))}_restartQuotesSubscription(e){this._stopQuotesSubscription(e),this._startQuotesSubscription(e)}async _startQuotesSubscription(e){const t={},i={},s=(t,i)=>{const s="ok"===t.s,o=this._marketStatusWatchers[e][t.n],n={...t,symbolname:t.n,status:t.s,values:{...t.v,change:s?t.v.ch:void 0, -last_price:s?t.v.lp:void 0,change_percent:s?t.v.chp:void 0,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:void 0)&&o.stop(),this._chartApiMessagerProvider.getChartApiMessager(e).onQuotesData([e,n])},o=n=>{n.forEach((r=>{const a=r.n;if(i[a]?.size>0){const t=[...i[a]].map((e=>({...r,n:e})));if(l.enabled("charting_library_debug_mode")){const t=void 0!==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(void 0!==t[r.n]&&null!==t[r.n])s(r,t[r.n]);else if(l.enabled("charting_library_debug_mode")){const t=void 0!==this._quotesInfo[e].listenerGUID?`with listenerGUID ${this._quotesInfo[e].listenerGUID}`:"";this._logMessage(`QUOTES Data for unexpected symbol ${a} ${t}: ${JSON.stringify(n)}`)}}))},r=async e=>{try{const[s,o]=KS(e),r=await new Promise(((e,t)=>{this._resolveSymbolByName(s,o,e,t)})),a=(0,n.ensure)(r.ticker);return t[a]=t[e]=JS(r),a===e?a:(void 0===i[a]&&(i[a]=new Set),a!==e&&i[a].add(e),a)}catch{return null}},a=async e=>[...new Set((await Promise.all([...new Set(e)].map(r))).filter((e=>null!==e)))];if(this._externalDatafeed.getQuotes&&!l.enabled("charting_library")){const[t,i]=await Promise.all([a(this._quotesInfo[e].symbols),a(this._quotesInfo[e].fastSymbols)]),s={};if(l.enabled("charting_library_debug_mode")){const e=WS.debugGetQuotesRequestId++;this._logMessage(`QUOTES Requesting data for symbols ${JSON.stringify(t)} with request ID ${e}`);for(const i of t){const t=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(const e of n)void 0!==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){void 0===this._marketStatusWatchers[e]&&(this._marketStatusWatchers[e]={});for(let i=0;ithis._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){const t=[];return e.forEach((e=>{e instanceof Object||t.indexOf(e)<0&&t.push(e)})),t}_refreshPointsets(e){e.forEach((e=>{const t=this._studiesCache[e];if(null==t)return;let i=null;for(const e of Object.keys(t)){const s=t[e];if("series"===s.type){i=s;break}}if(null===i||null==i.symbolInfo)return;const s=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){const i=[];for(const s of this._getStudiesCacheSessionKeys(e)){const o=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)){const i=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(const t of this._getStudiesCacheSessionKeys(e)){const i=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){const s=this._studiesCache[e][t];this.createSeries(e,t,s.turnaround,s.symbolId,s.resolution,i,!0);for(const i of this._getStudiesCacheSessionKeys(e)){const o=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){const i={};i[t]={turnaround:this._studiesCache[e][t].turnaround};for(const s of this._getStudiesCacheSessionKeys(e)){const o=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){const s=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=>{const t=e[0]||0;return t<0?(0,n.ensure)(o)[(0,n.ensure)(o).length+t].timeMs:i.projectionTime+t})))}}_seriesCount(e){let t=0;for(const i of this._getStudiesCacheSessionKeys(e)){"series"===this._studiesCache[e][i].type&&(t+=1)}return t} -_modifyMainSeries(e,t,i,s,o){this.stopSources(e);const r=this._mainSeriesRecord(e);let a=!1;for(const n of this._getStudiesCacheSessionKeys(e)){const c=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;const n=ZS(o),c={countBack:n||0};l.enabled("request_only_visible_range_on_reset")&&n&&(delete this._objectsDataCache[jS(e,r.guid)],delete this._studiesCache[e][r.guid]),this.createSeries(e,r.guid,s,t,i,c,!0)}}for(const t of this._getStudiesCacheSessionKeys(e)){const i=this._studiesCache[e][t];if(i&&"study"===i.type){this._studiesNonSeriesTimes[e][t]=null;const s=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){let t=null,i=null;for(const s of this._getStudiesCacheSessionKeys(e)){const o=this._studiesCache[e][s];if("series"===o.type&&(null===t&&(t=o),o.isMain)){i=o;break}}return null===i&&(i=t),null!==i&&(i.isMain=!0),i}_stopSourcesTree(e,t){for(const i of this._getStudiesCacheSessionKeys(e)){const s=this._studiesCache[e][i];s&&(("series"===s.type&&i===t||"study"===s.type&&s.parentId===t)&&(s.engine&&s.engine.isStarted()&&s.engine.stop(),s.activeResolve=-1))}this._pineDatafeed.removeUnused()}_getSeriesData(e,t){return this._objectsDataCache[jS(e,t)]||null}_resolveSymbolImpl(e,t,i){var s;(0,Pv.isEncodedExtendedSymbol)(e)||(s="Expect to get symbol encoded string, but got the following instead: "+e,console.error(`${(new Date).toISOString()} ${s}`));const[o,n]=KS(e);this._resolveSymbolByName(o,n,t,i)}_getSymbolExtrapolator(e,t,i){const s=(0,n.ensure)(Re.Interval.normalize(i)),o=function(e,t,i){const s=void 0!==t.subsession_id?","+t.subsession_id:"";return e+","+t.full_name+","+i+s}(e,t,s);let r=this._symbolExtrapolators[o];return void 0===r&&(r=new SS(t,s),this._symbolExtrapolators[o]=r),r}_barsCoefficients(e,t){const i=(0,Pv.decodeExtendedSymbol)(e);if(!("type"in i)||void 0===i.type)return{};const s=e+t;return this._barsCoefficientsCache[s]||(this._barsCoefficientsCache[s]={}),this._barsCoefficientsCache[s]}_studyCanExtendTimeScale(e,t){const i=this._studiesCache[e][t]?.metainfo;return void 0!==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=void 0),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(`${(new Date).toISOString()} ${e}`)}_resolveSymbolByName(e,t,i,s){let o;const n=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||void 0,r||void 0,a||void 0),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){return new Promise(((o,n)=>{const r=qS(e,t,i,s);this._logMessage("Symbol resolve requested: `{0}` ".format(r));let a=!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)));const t=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),void 0!==e.has_no_volume&&(e.visible_plots_set=e.has_no_volume?"ohlc":"ohlcv"),void 0===e.visible_plots_set&&(e.visible_plots_set="ohlcv"),e.supported_resolutions){const t=[];for(const i of e.supported_resolutions){const e=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,delete e.has_ticks,!0===t.shouldUseSubsessions&&Array.isArray(e.subsessions))for(let t=0;t!Re.Interval.isValid(e))).forEach((e=>{i("supported_resolutions field contains invalid value: "+e)})),OS||(void 0!==e.subsessions&&i(`Symbol info contains subsessions but the ${NS} feature is not enabled, so the subsessions will be ignored`),void 0!==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)){const s=this._callbacks[e];for(let e=0;e{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)&&void 0!==r.to){const e=(0,Jd.createDwmAligner)(s,i);null!==e&&(r.to=e.timeToExchangeTradingDay(r.to))}if(r.from&&r.to){const e=(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 _=new nS({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){const s=e.time,o="number"==typeof t?[t]:t;for(let e=0;eu[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"in t)||(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])throw Error("This should never happen");this._studiesCache[e][o].engine=_}catch(e){if(!((0,zv.default)(e)&&"studyError"in e&&e.studyError))throw e;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=_;const v=this._resolvePromisesBySymbolId.get(US(e,i));if(void 0===v)throw new Error("This should never happen");let S,b;try{const e=await v;S=e.symbolInfo,b=e.requestedSymbol}catch(e){return void(y()&&h.onSymbolErrorCallback(zS(e,"unknown symbol error")))}y()&&f(S,b)}_getDataRangeForStudy(e,t){const i=this._studiesCache[e][t],s={...this._seriesDataRange(e,i.parentId)},o=this._studiesCache[e][i.parentId];return this._studyCanExtendTimeScale(e,t)&&o?.completed?void 0!==i.dataRange?i.dataRange:(i.firstLoadedTimeMs&&(s.to=i.firstLoadedTimeMs),s):s}_seriesDataRange(e,t){const i=this._studiesCache[e][t];return null!==i.firstLoadedTimeMs?{to:i.firstLoadedTimeMs,countBack:0}:i.dataRange}_createStudy(e,t,i,s,o,r,a,l){this._studiesCache[s][o].completed=!1;const c=(e=>{if(Array.isArray(e))return e;const t=[],i=this._studiesCache[s][o].metainfo.inputs;if((0,Hv.default)(i))for(let s=0;s{const n=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)){const t=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{} -;const t={},i=this._studiesCache[s][o].metainfo;return e.forEach(((e,s)=>{t[(0,n.ensure)(i.plots)[s].id]=e})),{data:{offsets:t},indexes:[]}};let u=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){const e=this._getSeriesData(s,a)?.[0];if(void 0===e)return 1/0;u=e.timeMs}return u}),{onDataReadyCallback:(e,t,i)=>{_&&0===e.length||h(e,d(t))},onRealtimeCallback:(e,t,i,n,a)=>{const l=YS(e);if(this._studyCanExtendTimeScale(s,o)){const e=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;let i=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":const t=this._timeScales[s].replaceStudyBarsTimesTail(o,e.times);this._applyTimeScaleUpdate(s,t);break;case"study_graphics":{const t={data:{graphicsCmds:e.data?.graphicsCmds,isUpdate:e.data?.isUpdate},indexes:[]},i=function(e){const t=e.data&&e.data.graphicsCmds&&e.data.graphicsCmds.create;if(!t)return[];const i=new Map,s=new Set;kS.forEach(((e,o)=>{const n=t[o];if(n)for(const t of n)for(const o of t.data){const t=e(o);for(const e of t)i.set(e,-1),s.add(e)}}));const o=Array.from(s).sort(((e,t)=>e-t));return o.forEach(((e,t)=>i.set(e,t))),ES.forEach(((e,s)=>{const o=t[s];if(o)for(const t of o)for(const s of t.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":{const t={data:e.data,indexes:[]},i=t?.data?.data?.pivots,n=void 0!==i;let r=function(e){const t={};gS(e,(e=>{(0,zv.default)(e)&&Object.keys(e).forEach((i=>{i.endsWith("__t")&&(t[e[i]]=!0)}))}),{visitInstances:!0});const i=Object.keys(t).map(Number).sort(((e,t)=>e-t));return i.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){const e=new Set,t=[],s=[];let o=0;for(let n=a.length-1;n>=0;n--){const l=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){const s=e+"!"+t+"@"+i;return Boolean(this._endOfData[s])}_setEndOfData(e,t,i,s){const o=e+"!"+t+"@"+i;this._endOfData[o]=!1!==s}_applyTimeScaleUpdate(e,t){ -if(null===t)return;const i=[];for(const t of this._getStudiesCacheSessionKeys(e)){const s=this._studiesCache[e][t];if(s&&"study"===s.type){const o=this._studiesNonSeriesTimes[e][t];if(o){const n={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((()=>{const t=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){const i=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){const t=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){const i=this._getSymbolExtrapolator(e,t.symbolInfo,t.resolution);this._timeScales[e].setMainSymbolExtrapolator(i)}}_updateTimeScaleState(e){if(!this._studiesCache[e])return;let t=!0,i=!0;for(const s of this._getStudiesCacheSessionKeys(e)){const o=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){return void 0!==this._studiesCache[e]?Object.keys(this._studiesCache[e]):[]}}WS.debugGetQuotesRequestId=1;const HS=WS;function zS(e,t){return"string"==typeof e?e:(0,zv.default)(e)&&e&&"message"in e&&(0,et.default)(e.message)?e.message:t}function US(e,t){return e+"_"+t}function jS(e,t){return e+"_"+t}function GS(e,t,i,s){return e+(t?"_#_"+t:"")+(i?"_#_"+i:"")+(s?"_#_"+s:"")}function qS(e,t,i,s){return[e,t,i,s].filter((e=>(0,et.default)(e)&&e.length>0)).join("|")}function $S(e){console.warn(`${(new Date).toISOString()} ${e}`)}function KS(e){const t=(0,Pv.decodeExtendedSymbol)(e),i="string"==typeof t.symbol?t:t.symbol;return[i.symbol,{currency:"currency-id"in i&&i["currency-id"],unit:"unit-id"in i&&i["unit-id"],session:"session"in i?i.session===Xv.SubsessionId.Regular?void 0:i.session:void 0}]}function YS(e){const t=e.findIndex((e=>e.index!==RS));return-1===t?[]:0===t?e:e.slice(t)}function ZS(e){if(null===e||"number"==typeof e)return e;if("object"==typeof e&&Array.isArray(e)){switch(e[0]){case"bar_count":return e[2];case"from_to":return e.length>=3?e[2]??null:null}}return null}function XS(e,t,i){if(i.logoid=void 0,i["base-currency-logoid"]=void 0,i["currency-logoid"]=void 0,e){if("string"==typeof e)return void $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=void 0)}function JS(e){return e.timezone=e.timezone,e}(0,A.setClasses)();const QS=(0,r.getChartingLibraryGlobalContext)(),eb=(0,r.getChartingLibraryOwner)(),tb=new class{constructor(e,t){ -this._updateDocumentHeight=e=>{"visual"===this._viewportType&&this._window.document.documentElement.style.setProperty("height",`${e}px`,"important")},this._window=e,this._fullscreenApi=new Oe(e.document),this._viewportType=ze.CheckMobile.iOS()&&!(0,He.isOnMobileAppPage)("any")&&this._window.visualViewport?"visual":"quirks","visual"===this._viewportType?this._viewport=(0,n.ensure)(this._window.visualViewport):this._viewport=this._window;const i=this._layoutSizeSensor=this._window.document.createElement("div");i.id="layout-size-sensor",i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.right="0",i.style.bottom="0",i.style.pointerEvents="none",i.style.visibility="hidden",this._initFullscreen()}allocate(){this.free();const e=this._window.document,t=e.createElement("div");t.classList.add("js-rootresizer__contents"),t.style.position="relative",t.style.width="100%",t.style.height="100%",e.body.insertAdjacentElement("afterbegin",t),e.body.insertAdjacentElement("afterbegin",this._layoutSizeSensor),this._visibilityApi=new Fe(this._window.document);const i={alive:new O.WatchedValue(!0),fullscreenable:new O.WatchedValue(!0),container:new O.WatchedValue(t),width:new O.WatchedValue,height:new O.WatchedValue,availWidth:new O.WatchedValue,availHeight:new O.WatchedValue,visible:this._visibilityApi.isVisible,fullscreen:this._fullscreenApi.isFullscreen,remove:()=>{i.alive.setValue(!1)},attach:()=>{i.alive.setValue(!1),this._window.close()},requestFullscreen:()=>{this._requestFullscreen()},exitFullscreen:()=>{this._exitFullscreen()}};return i.alive.subscribe((e=>{e||i!==this._area||this.free()})),this._area=i,this._resizeHandler=()=>{const e=this._width(i)||800,t=this._height(i)||600;i.availHeight.setValue(t),i.availWidth.setValue(e),i.height.setValue(t),i.width.setValue(e)},this._area.height.subscribe(this._updateDocumentHeight,{callWithLast:!0}),this._resizeHandler(),this._viewport.addEventListener("resize",this._resizeHandler),new Ne(i).bridge()}free(){if(this._resizeHandler&&(this._viewport.removeEventListener("resize",this._resizeHandler),this._resizeHandler=void 0),this._visibilityApi&&(this._visibilityApi.destroy(),this._visibilityApi=void 0),this._area){const e=this._area;this._area=void 0,e.height.unsubscribe(this._updateDocumentHeight),e.alive.setValue(!1);const t=e.container.value(),i=t?.parentElement;i&&(i.removeChild(t),i.removeChild(this._layoutSizeSensor))}}_height(e){if("visual"===this._viewportType)return this._layoutSizeSensor.clientHeight;return e.container.value().clientHeight}_width(e){return e.container.value().clientWidth}_requestFullscreen(){this._fullscreenApi.enter()}_exitFullscreen(){this._fullscreenApi.exit()}_initFullscreen(){this._fullscreenApi.isFullscreen.subscribe((e=>{this._resizeHandler&&this._resizeHandler()}))}}(window),ib=new class{constructor(e){this._processVisibility=e=>{const t=e.container.value();return this.affectsLayout(e.name)?(t&&t.classList.toggle("js-hidden",!1),!0):(t&&t.classList.toggle("js-hidden",!0),!1)},this._setWidth=(e,t,i)=>{let s=i -;this._fullscreenArea!==e.name&&(e.availWidth.setValue(i),e.canNegotiate.width&&(s=Ue(i,e.negotiations.width))),t||(s=0);const o=e.container.value();return o&&t&&(o.style.width=s+"px"),e.width.setValue(s),s},this._setHeight=(e,t,i)=>{let s=i;this._fullscreenArea!==e.name&&(e.availHeight.setValue(i),e.canNegotiate.height&&(s=Ue(i,e.negotiations.height))),t||(s=0);const o=e.container.value();return o&&t&&(o.style.height=s+"px"),e.height.setValue(s),s};const t=e.container.value();if(!t)throw new Error("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){const t=e&&e.areaName;if(-1===this._availableAreas.indexOf(t))throw new Error("unknown options.areaName");this.free(t);const i=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(const e in this._areas)this._areas[e]===s&&this.free(e)},negotiateWidth:e=>{if(!s.canNegotiate.width)return;const t=je(e);Ge(s.negotiations.width,t)||(s.negotiations.width=t,this.recalculate())},negotiateHeight:e=>{if(!s.canNegotiate.height)return;const t=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=void 0,"center"===t&&this._bridge.exitFullscreen(),this._updateFullscreen())},width:new O.WatchedValue,height:new O.WatchedValue,availWidth:new O.WatchedValue,availHeight:new O.WatchedValue,alive:new O.WatchedValue(!0),container:new O.WatchedValue(i),visible:new O.WatchedValue(!0),fullscreen:new O.WatchedValue(!1),fullscreenable:new O.WatchedValue("right"===t||"center"===t),rdState:new Ne};return s.rdState.pushOwner(s),this._areas[t]=s,s.rdState.owner.subscribe((e=>{const i=s.container.value();if(e!==s)i&&(i.innerHTML="",i.parentElement&&i.parentElement.removeChild(i));else{let e=null;for(let i=this._availableAreas.indexOf(t);i--;){const t=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){const t=this._areas[e];if(!t)return;this._areas[e]=void 0;const i=t.container.value();i&&i.parentElement&&i.parentElement.removeChild(i),t.alive.setValue(!1)}recalculate(){const e={};this._recalcSingleRunToken=e -;const t=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();let d=0,u=0,_=0,p=0,m=0,g=0,f=0,y=0;if(e===this._recalcSingleRunToken&&l){const e=this._processVisibility(l);y=this._setHeight(l,e,h),this._setWidth(l,e,c)}if(e===this._recalcSingleRunToken&&t){const e=this._processVisibility(t);f=this._setHeight(t,e,h),g=this._setWidth(t,e,c);const i=t.container.value();e&&i&&(i.style.top=y+"px")}let v=0;if(e===this._recalcSingleRunToken&&n){const e=this._processVisibility(n),t=n.container.value();e&&t&&(t.style.left=g+"px",t.style.top=y+"px");const i=c-g;this._setWidth(n,e,i),d=this._setHeight(n,e,h),d&&(v=1)}if(e===this._recalcSingleRunToken&&i){const e=this._processVisibility(i),t=Math.max(f,d);_=this._setWidth(i,e,c),_&&(_+=4),_&&1===v&&(v=4);const s=i.container.value();e&&s&&(s.style.top=t+y+v+"px"),this._setHeight(i,e,h-t-y)}if(e===this._recalcSingleRunToken&&s){const e=this._processVisibility(s);let t=c-_;qe||(t-=300),m=this._setWidth(s,e,t),m&&1===v&&(v=4),this._setHeight(s,e,h-y-d-v)}if(e===this._recalcSingleRunToken&&o){const e=this._processVisibility(o);let t=c-_-m;qe||(t-=300),p=this._setWidth(o,e,t),p&&1===v&&(v=4),this._setHeight(o,e,h-y-d-v);const i=o.container.value();e&&i&&(i.style.top=d+y+v+"px")}const S=m+p;let b=0,w=c-_-m-p-(S?4:0);const C=Boolean(m||!S);if(!p&&m&&(w+=4),e===this._recalcSingleRunToken&&r){const e=this._processVisibility(r),t=r.container.value();e&&t&&(t.style.left=_+"px",t.classList.toggle("no-border-top-left-radius",!_),t.classList.toggle("no-border-top-right-radius",C)),this._setWidth(r,e,w);const i=h-y;b=Math.min(300,i-0),u=this._setHeight(r,e,i)+4}const T=Boolean(d&&(_||S));if(this._container.classList.toggle("layout-with-border-radius",T),e===this._recalcSingleRunToken&&a){const e=this._processVisibility(a),t=a.container.value();e&&t&&(t.style.left=_+"px",t.style.top=d+y+v+"px",t.classList.toggle("no-border-bottom-left-radius",!u||!_),t.classList.toggle("no-border-bottom-right-radius",C||!u),t.classList.toggle("no-border-top-left-radius",Boolean(!_&&S)),t.classList.toggle("no-border-top-right-radius",C)),this._setWidth(a,e,w);const i=h-d-u-y-v;this._setHeight(a,e,Math.max(i,b))}if(e===this._recalcSingleRunToken&&s&&this.affectsLayout("tradingpanel")){const e=s.container.value();e&&(e.style.right=m&&p?`${p+4}px`:`${p}px`,e.style.top=y+d+v+"px",e.style.borderTopRightRadius=T&&p?"4px":"0px")}e===this._recalcSingleRunToken&&this._updateVisibility()}affectsLayout(e){const t=this._areas[e];if(!t)return!1;if(t.rdState.owner.value()!==t)return!1;if(this._fullscreenArea&&this._fullscreenArea!==e)return Ye(e);if(this._width.value()<=567||this._height.value()<=445&&!Ke){if(!["center","top","left","topleft","extratop"].includes(e))return!1}return!0}_updateVisibility(){const e=this._bridge.visible.value();for(let t=0;t{QS.ChartApiInstance.start()})),"function"==typeof rb){const e=rb({Std:Py.Std});e&&e.then?e.then((e=>{if(!Array.isArray(e))return console.warn("custom_indicators_getter should be a function that returns a Promise object which result is an array of custom indicators"),void ab.resolve();const t=QS.JSServer;for(const i of e)if("function"==typeof i){const e=(new Ev).build(i);t.studyLibrary.push.call(t.studyLibrary,e)}else t.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())}else ab.resolve();QS.widgetReady=e=>{ee.subscribe("onChartReady",e,null)};const yb=ob.theme?.toLowerCase()??$s.StdTheme.Light;var vb;function Sb(e){QS.__defaultsOverrides=QS.__defaultsOverrides||{},(0,ge.deepExtend)(QS.__defaultsOverrides,e),void 0!==TradingView.defaultProperties&&void 0!==TradingView.defaultProperties.chartproperties&&((0,h.applyDefaultsOverrides)(TradingView.defaultProperties.chartproperties),(0,h.applyDefaultOverridesToLinetools)())}vb=yb,L.themes[vb]&&(0,k.setTheme)(vb),async function(e){if(!db||void 0===e)return;try{ -const{overrideStandardThemes:t}=await i.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(const t in e.order)TradingView.defaultProperties.linetoolorder[t]=e.order[t];if(e.position)for(const t in e.position)TradingView.defaultProperties.linetoolposition[t]=e.position[t];return null===fb?Promise.resolve():fb.then((t=>{function i(e){const t={};for(const i of Object.keys(e??{})){const s=i.split(".");let o=t;for(const e of s.slice(0,s.length-1))o.hasOwnProperty(e)||(o[e]={}),o=o[e];o[s[s.length-1]]=e[i]}return t}if(null===t)return;const s=i(e.brokerOrder),o=i(e.brokerPosition);t?.overrideTradedGroupStyles({order:{lightTheme:s,darkTheme:s},position:{lightTheme:o,darkTheme:o}})}))},QS.changeTheme=(e,t)=>{const i=L.themes[e.toLowerCase()];return i?QS.tradingViewApi.themes().setStdTheme(i.name,!0,t&&t.disableUndo):Promise.resolve()},QS.getTheme=()=>QS.tradingViewApi.themes().getCurrentThemeName(),QS.customThemes=async()=>{if(!db)return Promise.reject(new Error("The library_custom_color_themes feature must be enabled to use the custom themes API"));return new((await i.e(2413).then(i.bind(i,82753))).CustomThemesApi)},QS.is_authenticated=!1;JSON.parse(QS.urlParams.brokerConfig);a.t(null,void 0,i(94566)),a.t(null,void 0,i(92800)),a.t(null,void 0,i(44676));let bb=null;const wb=(0,me.createDeferredPromise)();let Cb;const Tb=()=>{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")){const e=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)(void 0===TradingView.defaultProperties,"Default properties are inited before applying overrides"),Sb(JSON.parse(ob.overrides));const e=ob.numeric_formatting?JSON.parse(ob.numeric_formatting):void 0;e&&("string"==typeof e.decimal_sign&&(ue.formatterOptionsLibraryOverrides.decimalSign=e.decimal_sign[0]),"string"==typeof e.grouping_separator&&(ue.formatterOptionsLibraryOverrides.groupingSeparator=e.grouping_separator[0]));const t=new Sv,s=new Nv,c=new Bv,h=ob.studiesAccess&&JSON.parse(ob.studiesAccess)||{type:"black",tools:[]},d=new Df(h,c),u=new Ov((0,r.getChartingLibraryGlobalContext)().JSServer.studyLibrary),_=new HS(eb.datafeed,t,s,u);QS.ChartApiInstance=new Ef(t,_,c,d) -;const p=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)),eb.customTimezones&&De.instance().addTimezones(eb.customTimezones);const m=ob.chartContent?JSON.parse(ob.chartContent).json:void 0,g=ob.chartContentExtendedData?JSON.parse(ob.chartContentExtendedData):m?m.extendedData:void 0,f=ob.interval||"D",v=function(e){const t=/(\d+)(\w+)/;return e.map((e=>{const s=(0,n.ensureNotNull)(t.exec(e.text)),o=s[2].toLowerCase(),r=parseInt(s[1]),l="y"===o?12*r+"M":r+o,c=Re.Interval.parse(l.toUpperCase()),h=Re.Interval.parse(e.resolution);return{text:e.title||{y:a.t(null,{plural:"{count}y",count:r,context:"short_N_year"},i(46766)),m:a.t(null,{plural:"{count}m",count:r,context:"short_N_month"},i(58590)),d:a.t(null,{plural:"{count}d",count:r,context:"short_N_day"},i(47801))}[o]||`${r}${o}`,description:e.description||"",value:{value:c.value(),type:"period-back"},targetResolution:h.value(),requiresIntraday:c.isIntraday()}}))}(JSON.parse(ob.timeFrames)),S={resizerBridge:gb,padding:l.enabled("border_around_the_chart")?2:0,content:m,widgetOptions:{addToWatchlistEnabled:!1,hideIdeas:!0,addVolume:(0,n.ensureDefined)(QS.ChartApiInstance.studiesAccessController).isToolEnabled("Volume"),muteSessionErrors:!0,timezone:ob.timezone,defSymbol:ob.symbol??"",defInterval:m?"":f,compareSymbols:ob.compareSymbols&&JSON.parse(ob.compareSymbols),defTimeframe:(b=eb.timeframe,b?"string"==typeof b?b:{...b,type:"time-range"}:b),paneContextMenuEnabled:l.enabled("pane_context_menu"),paneContextMenu:{mainSeriesTrade:sb},priceScaleContextMenuEnabled:l.enabled("scales_context_menu"),currencyConversionEnabled:l.enabled("pricescale_currency"),unitConversionEnabled:l.enabled("pricescale_unit"),legendWidgetEnabled:l.enabled("legend_widget"),legendWidget:{contextMenu:{settings:l.enabled("show_chart_property_page"),showOpenMarketStatus:l.enabled("display_market_status")}},sourceStatusesWidget:{errorSolution:!1},marketStatusWidgetEnabled:l.enabled("display_market_status"),chartWarningWidget:{subscriptionFullInfo:!1},timeScaleWidget:{contextMenuEnabled:l.enabled("scales_context_menu"),timezoneMenuEnabled:l.enabled("timezone_menu"),priceAxisLabelsOptions:{showLabels:l.enabled("main_series_scale_menu")}},timeScale:{preserveBarSpacing:!1,lockVisibleTimeRangeOnResize:l.enabled("lock_visible_time_range_on_resize"),rightBarStaysOnScroll:l.enabled("right_bar_stays_on_scroll"),minBarSpacing:ob.time_scale&&JSON.parse(ob.time_scale).min_bar_spacing},goToDateEnabled:l.enabled("go_to_date"),crossHair:{menuEnabled:l.enabled("chart_crosshair_menu")},handleScale:{mouseWheel:l.enabled("mouse_wheel_scale"),pinch:l.enabled("pinch_scale"),axisPressedMouseMove:{time:l.enabled("axis_pressed_mouse_move_scale"), -price:l.enabled("axis_pressed_mouse_move_scale")}},handleScroll:{mouseWheel:l.enabled("mouse_wheel_scroll"),pressedMouseMove:l.enabled("pressed_mouse_move_scroll"),horzTouchDrag:l.enabled("horz_touch_drag_scroll"),vertTouchDrag:l.enabled("vert_touch_drag_scroll")},shiftVisibleRangeOnNewBar:l.enabled("shift_visible_range_on_new_bar"),croppedTickMarks:l.enabled("cropped_tick_marks"),countdownEnabled:l.enabled("countdown"),indicatorsDialogShortcutEnabled:l.enabled("insert_indicator_dialog_shortcut")},seriesControlBarEnabled:l.enabled("timeframes_toolbar"),seriesControlBar:{timeFramesWidgetEnabled:!0,timeFramesWidget:{goToDateEnabled:l.enabled("go_to_date"),availableTimeFrames:(e,t)=>{if(!e)return[];if(t!==bt.STATUS_DELAYED&&t!==bt.STATUS_DELAYED_STREAMING&&t!==bt.STATUS_EOD&&t!==bt.STATUS_READY)return[];return v.filter((t=>!(t.requiresIntraday&&!e.has_intraday)&&!(e.supported_resolutions&&!e.supported_resolutions.includes(t.targetResolution))))}},timeWidgetEnabled:!0,timeWidget:{timezoneMenuEnabled:l.enabled("timezone_menu")},adjustForDividendsButtonEnabled:!1,sessionIdButtonEnabled:l.enabled("pre_post_market_sessions"),backAdjustmentButtonEnabled:!1,settlementAsCloseButtonEnabled:!1,percentageScaleButtonEnabled:!0,logScaleButtonEnabled:!0,autoScaleButtonEnabled:!0,layoutFullscreenButtonEnabled:!0,mobileChangeLayoutEnabled:!1},globalEvents:!0,snapshotUrl:ob.snapshotUrl,mobileForceChartMaximizeEnabled:!1,saveChartEnabled:l.enabled("save_shortcut")};var b;hb&&((0,xf.createFavoriteDrawingToolbar)(),S.widgetOptions.isDrawingToolbarVisible=P.isDrawingToolbarVisible),g&&(S.metaInfo={id:g.uid,name:g.name,description:g.description,uid:g.uid,username:""}),eb.additionalSymbolInfoFields&&(0,lv.setAdditionalSymbolInfoFields)(eb.additionalSymbolInfoFields);const w=eb.symbolSearchComplete;w&&(0,cv.setSymbolSearchCompleteOverrideFunction)(w);const C=QS.chartWidgetCollection=new Pf(S);let x=!1;C.onAboutToBeDestroyed.subscribe(null,(()=>{x=!0}),!0),function(e){e.addCustomSource("branding",((t,i)=>{const s=(0,ft.combine)(((e,t)=>{const s=e??t;return null!==s&&s.hasModel()&&s.model().model()===i}),e.maximizedChartWidget().weakReference(),e.leftBottomChartWidget().weakReference());return new ev(t,i,s.ownership())}),Co.CustomSourceLayer.Topmost)}(C),QS.studyMarket=new pe(C),Je.registerService(Xe.CHART_WIDGET_COLLECTION_SERVICE,C),C.activeChartWidget.subscribe((e=>{ee.emit("activeChartChanged",C.getAll().indexOf(e))})),QS.saver=new N.ChartSaver(C);const A=new I.ChartChangesWatcher(C,QS.saver,ee),k=new Z(C,QS.saver,A);C.setSaveChartService(k);const E=new oe(C);QS.chartWidget=C.activeChartWidget.value(),QS.pro=new TradingView.Pro;const B=function(e){if(!pb)return null;const t=JSON.parse(ob.favorites);t.intervals=t.intervals.map((e=>{let t=""+e;return t.match(/1[DWMYdwmy]/)&&(t=t.slice(1)),t})),l.enabled("study_templates")&&(Cb=new he({chartWidgetCollection:e.chartWidgetCollection}));let s;const o=ob.header_widget_buttons_mode;"fullsize"===o&&(s=["full"]);"compact"===o&&(s=["small"]);const n=(0,gv.shouldShowQuickSearchOnLib)()?function(e){ -const t=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=>{const s=new(0,i.GlobalSearchDialogRenderer)(e);return null!==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):void 0;return new T(new y,{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"));const V=function(e){if(mb){const t=ob.toolbarbg&&/^[0-9a-f]+$/i.test(ob.toolbarbg)?String(ob.toolbarbg):void 0;if(t){const e=document.createElement("style");e.textContent="body,.chart-controls-bar,#footer-chart-panel{background-color:#"+t+" !important}",document.head.appendChild(e)}return new M({bgColor:t,chartWidgetCollection:e,drawingsAccess:ob.drawingsAccess?JSON.parse(ob.drawingsAccess):void 0,resizerBridge:mb,onClick:Ab})}return null}(C),R=null;QS.tradingViewApi=new Cy({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)){const e=Math.max(0,+(0,n.ensureDefined)(ob.ssreqdelay));(0,Ty.setSearchRequestDelay)(e)}QS.ChartApiInstance.connect(),(async()=>{const{LineToolPropertiesWidget:e}=await Promise.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))})();const O=document.querySelector(".tv-content");null!==O&&O.addEventListener("contextmenu",(e=>{e.target instanceof Element&&"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}));let F=!1;function W(){ -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){const e=L.getStdTheme(yb);e&&e.content&&void 0===m&&C.applyTheme({theme:e.content,onlyActiveChart:!1,restoreNonThemeDefaults:!1,themeName:yb,standardTheme:!0,syncState:!0,noUndo:!0}).then((()=>QS.applyOverrides(QS.__defaultsOverrides)))}if(l.enabled("charting_library_debug_mode")&&ee.subscribeToAll(((...e)=>{console.log(`${(new Date).toISOString()} Event "${e[0]}", arguments: ${JSON.stringify(e.slice(1))}`)})),F)return;F=!0,If(C),function(e,t){const s=a.t(null,void 0,i(37367)).format({emoji:"👍"}),o=a.t(null,void 0,i(69804)).format({emoji:"👍"}),r=a.t(null,void 0,i(6655)).format({emoji:"👍"});ee.on("onServerScreenshotCopiedToClipboard",(()=>h(s)),null),ee.on("onClientScreenshotCopiedToClipboard",(()=>h(o)),null),ee.on("onServerScreenshotEmbedCodeCopiedToClipboard",(()=>h(r)),null);let l=null;const c=e.getContainer();function h(e){l?l.show(e):Promise.all([i.e(5371),i.e(2307),i.e(2227),i.e(92)]).then(i.bind(i,1524)).then((i=>{l||(l=new i.ChartScreenshotHintRenderer((0,n.ensureNotNull)(c),{bottomPadding:t.seriesControlBarEnabled}),l.show(e))}))}}(C,{seriesControlBarEnabled:l.enabled("timeframes_toolbar")});P_.getInstance().setWidgetCollection(QS.chartWidgetCollection)})),C.getAll().some((e=>e.isInitialized()))?W():function(e,t){const i=e.getAll(),s=()=>{t(),i.forEach((e=>{e.chartWidgetInitialized().unsubscribe(null,s)}))};i.forEach((e=>{e.chartWidgetInitialized().subscribe(null,s,!0)}))}(C,W),ee.subscribe("chart_load_requested",(e=>{QS.tradingViewApi.loadChart({json:JSON.parse(e.content),extendedData:e})}),null)};window.addEventListener("unload",(()=>{nb.abort(),QS.widgetbar&&(QS.widgetbar.destroy(),QS.widgetbar=null),QS.chartWidgetCollection&&(QS.chartWidgetCollection.destroy(),QS.chartWidgetCollection=null),QS.ChartApiInstance&&QS.ChartApiInstance.disconnect(),(0,Ze.destroyQuoteSessions)(),QS.ChartApiInstance&&(QS.ChartApiInstance.destroy(),QS.ChartApiInstance=null)})),l.enabled("saveload_storage_customization")&&(eb.saveLoadAdapter?E.setCustomAdapter(eb.saveLoadAdapter):QS.urlParams.chartsStorageUrl&&QS.urlParams.clientId?E.initialize(QS.urlParams.clientId,QS.urlParams.userId,QS.urlParams.chartsStorageUrl,QS.urlParams.chartsStorageVer||"1.0"):(l.setEnabled("saveload_storage_customization",!1),l.setEnabled("header_saveload",!1))),void 0!==eb.imageStorageAdapter&&l.enabled("image_drawingtool")&&(0,fv.setImageStorageAdapter)(eb.imageStorageAdapter);const Pb=(0,me.createDeferredPromise)();function xb(){Pb.resolve()}eb.loadLastChart&&l.enabled("saveload_storage_customization")?E.getCharts().then((e=>{if(0===e.length)return void xb();const t=e.sort(((e,t)=>t.modified_iso-e.modified_iso))[0];E.getChartContent(t).then((e=>{const t=e,i=JSON.parse(t.content);i.extendedData=e,ob.chartContent=JSON.stringify({json:i}),xb()})).catch(xb)})).catch(xb):xb();const Mb=async function(){ -if(l.enabled("saveload_separate_drawings_storage")){const e=await i.e(7129).then(i.bind(i,67387));return Bm=e.LineToolsSynchronizer,!0}return!1}(),Ib=(0,me.createDeferredPromise)();function Ab(){const e=TradingView.bottomWidgetBar;e&&e.turnOffMaximize()}Promise.all([Ib.promise,Pb.promise,QS.loadedCustomCss,Mb,cb.promise]).then((()=>{const e=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(new Date),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);const e=(0,n.ensureNotNull)(document.URL.match(new RegExp("(:?.*://)([^/]+)/.*")))[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")}var t,i,s,o,r,a})),(()=>{let e=!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=(()=>{const e=D.createGroup({desc:"API",order:yv.ACTION_API_GROUP_ORDER});return(t,i)=>{var s;e.add({hotkey:(s=t,"number"==typeof s?s:"string"==typeof s?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){const s={received:!1};QS.dispatchEvent(new CustomEvent("innerWindowLoad",{detail:s})),!s.received&&t{e(t+1,i)}),10*Math.pow(2,t))}(),QS.createButton=e=>{if(null===bb)throw new Error("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;const t=(0,fe.randomHash)();return bb.addButton(t,e)??t},QS.removeButton=e=>{if(null===bb)throw new Error("Cannot remove button: header widget is not ready or is not loaded - use `headerReady` to wait until header is ready");return bb.removeButton(e)},QS.createDropdown=e=>{if(void 0===e)throw new Error("Cannot create dropdown without any parameters. Please refer to the documentation");void 0===e.align&&(e.align="left");const t=(0,fe.randomHash)();return bb?(bb.addDropdown(t,e),Promise.resolve(new hv(bb,t))):wb.promise.then((()=>((0,n.ensureNotNull)(bb).addDropdown(t,e),new hv((0,n.ensureNotNull)(bb),t))))},QS.getAllFeatures=()=>{const e=l.getAllFeatures();return Object.keys(e).forEach((t=>{isNaN(parseFloat(t))||delete e[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,new Set(["connectionStatus"]);const Lb=ob.locale||"en",kb=Dt.getInstance();kb.createElement(document),kb.setLocale(Lb),QS.customChartDescriptionFunction&&kb.setCustomProvider(QS.customChartDescriptionFunction);const Eb=Sm.getInstance();Eb.createElement(document),Eb.setLocale(Lb),function(){const e=l.enabled("accessible_keyboard_shortcuts")?(0,B.humanReadableHash)(9):`${(0,B.humanReadableModifiers)(B.Modifiers.Alt,!1)} + ${(0,B.humanReadableHash)(90)}`,t=`${(0,B.humanReadableModifiers)(B.Modifiers.Mod,!1)} + ${(0,B.humanReadableHash)(75)}`,s=a.t(null,void 0,i(7697)),o=[a.t(null,{replace:{shortcut:e}},i(85166)),a.t(null,{replace:{shortcut:t}},i(57959)),a.t(null,void 0,i(36332)),a.t(null,void 0,i(9687)),a.t(null,void 0,i(40490)),a.t(null,void 0,i(27884))],n=document.createElement("p");n.innerText=s;const r=document.createElement("ul");o.forEach((e=>{const t=document.createElement("li");t.innerText=e,r.appendChild(t)}));const c=document.createElement("div");c.setAttribute("role","contentinfo"),c.setAttribute("aria-hidden","false"),c.style.fontSize="0",c.appendChild(n),c.appendChild(r),document.body.insertBefore(c,document.body.firstChild)}(),window.addEventListener("keydown",(e=>{const t=(0,B.hashFromEvent)(e);9!==t&&t!==D.Modifiers.Shift+9||(0,pv.updateTabIndexes)()})),new zo.Action({actionId:"UnknownAction",options:{label:"",onExecute:()=>{(0,pv.updateTabIndexes)();const[e]=Array.from(document.querySelectorAll('button:not([disabled]):not([aria-disabled]):not([tabindex="-1"]), input:not([disabled]):not([aria-disabled]):not([tabindex="-1"]), [tabindex]:not([disabled]):not([aria-disabled]):not([tabindex="-1"])')).filter((0,mv.createScopedVisibleElementFilter)(document.documentElement)).sort(pv.navigationOrderComparator);void 0!==e&&e.focus()},hotkeyHash:l.enabled("accessible_keyboard_shortcuts")?9:D.Modifiers.Alt+90,hotkeyGroup:(0,D.createGroup)({desc:"Global shortcuts"})}})},52959:(e,t,i)=>{"use strict";function s(){return window}function o(){const e=s();return e.parent[e.urlParams.uid]}i.d(t,{getChartingLibraryGlobalContext:()=>s,getChartingLibraryOwner:()=>o})},29063:(e,t,i)=>{"use strict";i.r(t);var s=i(21097),o=i(51768),n=i(76422),r=i(38780);function a(e,t=!1){"loading"!==document.readyState?t?setTimeout((()=>e()),1):e():document.addEventListener("DOMContentLoaded",(()=>e()))}new Promise((e=>{a(e)}));function l(e,t="x"){let i=!1;return"x"!==t&&"both"!==t||(i=i||e.offsetWidth(t.nodeType===Node.TEXT_NODE&&e.push(t.textContent||""),e)),[]).join("").trim();return s?{type:"text",data:s}:{type:"none"}}function u(e,t){let i=!1;const s=e.children;for(let e=0;e{(0,r.hide)(),t.removeEventListener("blur",s),t.removeEventListener("active-descendant-blur",s)};t.addEventListener("blur",s),t.addEventListener("active-descendant-blur",s)}}a((()=>{document.addEventListener("mouseenter",(e=>{const t=e.target;if(t instanceof HTMLElement&&t.matches(".apply-overflow-tooltip")){const e=h(t);if(t.matches(".apply-overflow-tooltip--check-children-recursively")){if(!c(t,e))return}else if(t.matches(".apply-overflow-tooltip--check-children")){if(!u(t,e))return}else if(!l(t,e))return;(0,r.showOnElement)(t,{content:d(t)});const i=()=>{(0,r.hide)(),["mouseleave","mousedown"].forEach((e=>t.removeEventListener(e,i)))};["mouseleave","mousedown"].forEach((e=>t.addEventListener(e,i)))}}),!0),document.addEventListener("focus",_,!0),document.addEventListener("active-descendant-focus",_,!0)}));var p=i(48096),m=i(11417);var g=i(39527);function f(e){return()=>{e()}}var y=i(3343),v=i(34811),S=i(15754);const b=(e=document.documentElement,t)=>document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,(e=>t=>{if(1!==t.nodeType)return NodeFilter.FILTER_SKIP;const i=t;return(0,S.isInertRoot)(i)?NodeFilter.FILTER_REJECT:(0,S.isVisibilityVisible)(i)&&i.matches(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP})(t));const w=(e=document.documentElement)=>b(e,S.FOCUSABLE_SELECTOR);const C=`[${v.FOCUS_TRAP_DATA_ATTRIBUTE}="true"]`;class T{constructor(){this._handleMouseDown=()=>{this._forwardTab=void 0},this._handleKeyDown=e=>{this._forwardTab=void 0,[9,y.Modifiers.Shift+9].includes((0,y.hashFromEvent)(e))&&(this._forwardTab=!e.shiftKey)},this._handleFocus=e=>{const t=e.target;if(void 0===this._forwardTab||!(t instanceof HTMLElement))return;const i=this._findDeepestFocusTrapElement(document.documentElement);if(!(i instanceof HTMLElement)||!i||i.contains(t))return;e.preventDefault(),e.stopPropagation(),t.blur() -;const s=i.compareDocumentPosition(t);if(s&Node.DOCUMENT_POSITION_PRECEDING||s&Node.DOCUMENT_POSITION_FOLLOWING){const e=this._forwardTab?x(i):x(i,!0);e instanceof HTMLElement&&e.focus()}},document.documentElement.addEventListener("focus",this._handleFocus,{capture:!0}),document.documentElement.addEventListener("keydown",this._handleKeyDown,{capture:!0}),document.documentElement.addEventListener("mousedown",this._handleMouseDown,{capture:!0})}destroy(){document.documentElement.removeEventListener("focus",this._handleFocus,{capture:!0}),document.documentElement.removeEventListener("keydown",this._handleKeyDown,{capture:!0}),document.documentElement.removeEventListener("mousedown",this._handleMouseDown,{capture:!0})}_findDeepestFocusTrapElement(e){const t=e.querySelectorAll(C);let i=null,s=-1;return t.forEach((t=>{const o=this._calculateParentCount(t,e);o>s&&(s=o,i=t)})),i}_calculateParentCount(e,t){let i=0,s=e.parentElement;for(;s&&s!==t;)"true"===s.getAttribute(v.FOCUS_TRAP_DATA_ATTRIBUTE)&&i++,s=s.parentElement;return i}}const P=f((()=>new T));function x(e,t){return t?function(e){return function(e){for(e.currentNode=e.root;null!==e.lastChild(););return e.currentNode===e.root?null:e.currentNode}(w(e))}(e):function(e){return t=w(e),t.currentNode=t.root,t.nextNode();var t}(e)}const M=f((()=>{P()}));var I=i(99247);let A;function L(e){window.TVSettings&&window.TVSettings.sync(window.user.settings),window.is_authenticated?(e||(initOfferLoginStateChangeButton(),onGoPro()&&window.location.reload()),!1===window.user.profile_data_filled&&((0,o.trackEvent)("Conversion","First login"),delete window.user.profile_data_filled)):availableOffersWrapper.runOrUpdate((e=>{Object.keys(e).forEach((t=>{const i=t;e[i].available_for_anons||delete e[i]})),window.user={username:"Guest",following:"0",followers:"0",ignore_list:[],available_offers:e},m.TVLocalStorage.removeItem("trial_availiable")}))}A=window.loginStateChange?window.loginStateChange:window.loginStateChange=new p.Delegate,A.subscribe(null,L),s.TVXWindowEvents.on("loginStateChange",(e=>{const t=JSON.parse(e);window.user=t.user,window.is_authenticated=!!t.is_authenticated,A.fire()})),s.TVXWindowEvents.on("signOut",(()=>{!function(){if(window.initData.lfs){const e=document.getElementsByClassName("js-admin-warning")[0];document.body.removeChild(e)}let e=!0;[/^\/chart\//,/^\/share-your-love\//,/^\/pine\//].forEach((t=>{t.test(window.location.pathname)&&(e=!1)})),e&&window.location.reload()}()})),(()=>{const e="user-obj-changed",t={};window.crossTabSyncUserAttr=t=>{const i={};t instanceof Array?t.forEach((e=>{i[e]=window.user[e]})):i[t]=window.user[t],s.TVXWindowEvents.emit(e,JSON.stringify(i))},s.TVXWindowEvents.on(e,(e=>{const i=JSON.parse(e);let s;for(s in i)if(i.hasOwnProperty(s)){window.user[s]=i[s];(t[s]||[]).forEach((e=>{e.fire(i[s])}))}}))})(),window.TradingView.changeLoginState=e=>{window.is_authenticated=!!e,s.TVXWindowEvents.emit("loginStateChange",JSON.stringify({is_authenticated:window.is_authenticated,user:window.user})), -window.is_authenticated&&n.emit("GLOBAL_EVENT_SIGN_IN_SUCCESS"),A.fire()},window.loginUser=function(e){window.user=(0,g.deepExtend)({},e),window.TradingView.changeLoginState(!0)},window.loginRequiredDelegate=new p.Delegate,window.runOrSignIn=(e,t)=>{t||(t={}),e()},window.onLoginStateChange=L,window.TradingView.setTrialAvailiable=e=>{m.TVLocalStorage.setItem("trial_availiable",e?"1":"0")},window.TradingView.notificationsChanged=new p.Delegate,M(),(0,I.initMouseClickAutoBlurHandler)()},43229:(e,t,i)=>{"use strict";i.d(t,{AsyncResourceWrapper:()=>s});class s{constructor(e,t){this._destroyed=!1,this._callbacks=[],this._resource={pendingResource:e},this._destroyFn=t,e.then((e=>{if(this._destroyed)this._destroyFn?.(e);else{this._resource.resource=e;for(const t of this._callbacks)t(e)}})).finally((()=>{this._callbacks=[]}))}destroy(){this._resource.resource&&this._destroyFn?.(this._resource.resource),this._resource={pendingResource:Promise.reject("Resource is destroyed").catch((()=>{}))},this._callbacks=[],this._destroyed=!0}callFunction(e){this._destroyed||(this._resource.resource?e(this._resource.resource):this._callbacks.push(e))}get(){return this._destroyed||!this._resource.resource?null:this._resource.resource}promise(){return this._resource.pendingResource}}},52859:(e,t,i)=>{"use strict";i.r(t),i.d(t,{alphaToTransparency:()=>r,applyAlpha:()=>n,applyTransparency:()=>l,colorFromBackground:()=>u,colorToInteger:()=>g,generateColor:()=>o,getLuminance:()=>h,gradientColorAtPercent:()=>_,isHexColor:()=>d,resetTransparency:()=>c,rgbaFromInteger:()=>p,rgbaToInteger:()=>m,transparencyToAlpha:()=>a});var s=i(24377);function o(e,t,i){if(t=t||0,!d(e))return i?(0,s.rgbaToString)((0,s.rgba)((0,s.parseRgb)(e),(0,s.normalizeAlphaComponent)(a(t)))):e;const[o,n,r]=(0,s.parseRgb)(e),l=(0,s.normalizeAlphaComponent)(a(t));return(0,s.rgbaToString)([o,n,r,l])}function n(e,t,i){const o=(0,s.tryParseRgba)(e);if(null===o)throw new Error(`Invalid color: ${e}`);const[n,r,a,l]=o,c=(0,s.normalizeAlphaComponent)(t*(i?l:1));return(0,s.rgbaToString)((0,s.rgba)([n,r,a],c))}function r(e){return 100*(1-e)}function a(e){if(e<0||e>100)throw new Error("invalid transparency");return 1-e/100}function l(e,t){if("transparent"===e)return e;const i=(0,s.parseRgba)(e),o=i[3];return(0,s.rgbaToString)((0,s.rgba)(i[0],i[1],i[2],a(t)*o))}function c(e){return"transparent"===e?e:d(e)?e.slice(0,7):(0,s.rgbaToString)((0,s.rgba)((0,s.parseRgb)(e),(0,s.normalizeAlphaComponent)(1)))}function h(e){const t=(0,s.parseRgb)(e).map((e=>(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)));return Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function d(e){return 0===e.indexOf("#")}function u(e){return"black"===(0,s.rgbToBlackWhiteString)((0,s.parseRgb)(e),150)?"#ffffff":"#000000"}function _(e,t,i){const[o,n,r,a]=(0,s.parseRgba)(e),[l,c,h,d]=(0,s.parseRgba)(t),u=(0,s.rgba)(Math.round(o+i*(l-o)),Math.round(n+i*(c-n)),Math.round(r+i*(h-r)),a+i*(d-a));return(0,s.rgbaToString)(u)}function p(e){const t=(e=Math.round(e))%256;e-=t;const i=(e/=256)%256;e-=i;const s=(e/=256)%256 -;e-=s;return`rgba(${t},${i},${s},${(e/=256)/255})`}function m(e){const t=Math.round(255*e[3]);return e[0]+256*e[1]+65536*e[2]+16777216*t}function g(e){const t=(0,s.tryParseRgba)(e);return null===t?0:m(t)}},29970:(e,t,i)=>{"use strict";i.d(t,{colorsAreCloseEnough:()=>h,isColorDark:()=>_});var s,o=i(81251),n=i(24377);function r(e){return e<0&&(e+=2*Math.PI),e}function a(e,t){const[i,s,o]=e,[n,a,l]=t,c=(Math.sqrt(s**2+o**2)+Math.sqrt(a**2+l**2))/2,h=.5*(1-Math.sqrt(Math.pow(c,7)/(Math.pow(c,7)+6103515625))),d=(1+h)*s,u=(1+h)*a,_=Math.sqrt(d*d+o*o),p=Math.sqrt(u*u+l*l),m=0===o&&0===d?0:r(Math.atan2(o,d)),g=0===l&&0===u?0:r(Math.atan2(l,u)),f=n-i,y=p-_;let v;const S=_*p;0===S?v=0:(v=g-m,v<-Math.PI?v+=2*Math.PI:v>Math.PI&&(v-=2*Math.PI));const b=2*Math.sqrt(S)*Math.sin(v/2),w=(i+n)/2,C=(_+p)/2;let T;const P=m+g;T=_*p==0?P:Math.abs(m-g)<=Math.PI?P/2:P<2*Math.PI?(P+2*Math.PI)/2:(P-2*Math.PI)/2;const x=1-.17*Math.cos(T-Math.PI/6)+.24*Math.cos(2*T)+.32*Math.cos(3*T+Math.PI/30)-.2*Math.cos(4*T-Math.PI/180*63),M=Math.PI/6*Math.exp(-Math.pow((T-Math.PI/180*275)/(Math.PI/180*25),2)),I=2*Math.sqrt(Math.pow(C,7)/(Math.pow(C,7)+6103515625)),A=1+.015*Math.pow(w-50,2)/Math.sqrt(20+Math.pow(w-50,2)),L=1+.045*C,k=1+.015*C*x,E=-Math.sin(2*M)*I;return Math.sqrt(Math.pow(f/(1*A),2)+Math.pow(y/(1*L),2)+Math.pow(b/(1*k),2)+E*(y/(1*L))*(b/(1*k)))}!function(e){e[e.Pow25In7=6103515625]="Pow25In7",e[e.LWeight=1]="LWeight",e[e.CWeight=1]="CWeight",e[e.HWeight=1]="HWeight"}(s||(s={}));const l=[127,127,127];function c(e){const t=e[3],i=e.slice(0,3);for(let e=0;e<3;e++)i[e]=Math.round(i[e]*t+l[e]*(1-t));return i}function h(e,t){return a(g(p(c((0,n.parseRgba)(e)))),g(p(c((0,n.parseRgba)(t)))))<3}const d=(0,o.default)((()=>g(p([0,0,0])))),u=(0,o.default)((()=>g(p([255,255,255]))));function _(e){const t=g(p(c((0,n.parseRgba)(e))));return a(t,d()).04045?Math.pow((o+.055)/1.055,2.4):o/12.92),l=100*(n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92),c=100*(r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92);return[.4124*a+.3576*l+.1805*c,.2126*a+.7152*l+.0722*c,.0193*a+.1192*l+.9505*c]}var m;function g(e){const[t,i,s]=e,o=t/95.047,n=i/100,r=s/108.883,a=o>.008856?Math.pow(o,1/3):7.787*o+16/116,l=n>.008856?Math.pow(n,1/3):7.787*n+16/116;return[116*l-16,500*(a-l),200*(l-(r>.008856?Math.pow(r,1/3):7.787*r+16/116))]}!function(e){e[e.X=95.047]="X",e[e.Y=100]="Y",e[e.Z=108.883]="Z"}(m||(m={}))},22961:(e,t,i)=>{"use strict";function s(e,t,i){return e*(1-i)+t*i}i.d(t,{doAnimate:()=>r,lerp:()=>s});const o={from:0,duration:250,easing:i(76662).easingFunc.easeOutCubic};class n{constructor(e){this._doing=!0,this._completed=!1,this._options={...o,...e};const t=performance.now();window.requestAnimationFrame((e=>{this._animation(t,this._options.from,e)}))}stop(){this._doing=!1}completed(){return this._completed}_animation(e,t,i){if(!this._doing)return void this._finishAnimation() -;const o=(i=!i||i<1e12?performance.now():i)-e,n=o>=this._options.duration||t===this._options.to,r=s(this._options.from,this._options.to,this._options.easing(o/this._options.duration)),a=n?this._options.to:r,l=a-t;this._options.onStep(l,a),n?this._finishAnimation():window.requestAnimationFrame((t=>{this._animation(e,a,t)}))}_finishAnimation(){this._options.onComplete&&this._options.onComplete(),this._completed=!0}}function r(e){return new n(e)}},32925:(e,t,i)=>{"use strict";i.d(t,{fetch:()=>o});var s=i(9343);new class{constructor(e,t){this._test=e[t]={}}provide(e,t){this._test[e]=t}}(window,"qaGlobals"),(0,s.getLogger)("Fetch");function o(e,t,i={}){return window.fetch(e,t)}},67225:(e,t,i)=>{"use strict";i.d(t,{GradientColorCache:()=>o});var s=i(52859);class o{constructor(){this._color1="",this._color2="",this._colors=new Map}gradientColor(e,t,i){if(t===e)return t;i=Math.max(0,Math.min(100,Math.round(100*i))),this._color1===e&&this._color2===t||(this._colors.clear(),this._color1=e,this._color2=t);let o=this._colors.get(i);return void 0===o&&(o=(0,s.gradientColorAtPercent)(e,t,i/100),this._colors.set(i,o)),o}}},49251:(e,t,i)=>{"use strict";function s(e,t,i,s){return`${s?s+" ":""}${i?i+" ":""}${e}px ${t}`}i.d(t,{makeFont:()=>s,parseFont:()=>n});const o=/(bold )?(italic )?(\d+)(px|pt) (.*)$/;function n(e){const t=o.exec(e);return null===t?null:{family:t[5],size:parseInt(t[3])*("pt"===t[4]?.75:1),bold:Boolean(t[1]),italic:Boolean(t[2])}}},18113:(e,t,i)=>{"use strict";i.d(t,{getPersistentLogger:()=>o});let s=null;function o(){return s}},24640:(e,t,i)=>{"use strict";i.r(t),i.d(t,{detectAutoDirection:()=>b,forceLTRStr:()=>u,forceLTRStrSsr:()=>_,forceRTLStr:()=>m,getLTRScrollLeft:()=>g,getLTRScrollLeftOffset:()=>f,isRtl:()=>o,startWithLTR:()=>d,stripLTRMarks:()=>h,stripLTRStrSsr:()=>p});var s=i(64531);const o=()=>"rtl"===window.document.dir,n="‎",r="‪",a="‫",l="‬",c=new RegExp(n+"|"+r+"|"+a+"|"+l,"g");function h(e){return""!==e&&o()&&null!=e?e.replace(c,""):e}function d(e){return""!==e&&o()&&null!=e?n+e:e}function u(e){return""!==e&&o()&&null!=e?r+e+l:e}function _(e){return r+e+l}function p(e){return e.startsWith(r)&&e.endsWith(l)?e.slice(1,-1):e}function m(e){return""!==e&&o()&&null!=e?a+e+l:e}function g(e){return(0,s.getNormalizedScrollLeft)(e,"rtl")}function f(e,t){const i=(0,s.detectScrollType)();if("indeterminate"===i)return 0;switch(i){case"negative":t=e.clientWidth-e.scrollWidth+t;break;case"reverse":t=e.scrollWidth-e.clientWidth-t}return t}var y;!function(e){e.LTR="ltr",e.RTL="rtl",e.UNKNOWN=""}(y||(y={}));const v=/[^\u0000-\u0040\u005B-\u0060\u007B-\u00BF\u00D7\u00F7\u02B9-\u02FF\u2000-\u200E\u2010-\u2029\u202C\u202F-\u2BFF]/,S=/[\u0590-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC]/;function b(e){const t=v.exec(e);return t?S.test(t[0])?"rtl":"ltr":""}},76662:(e,t,i)=>{"use strict";i.d(t,{CubicBezier:()=>s.CubicBezier,dur:()=>s.dur,easingFunc:()=>s.easingFunc});var s=i(74991)},59672:(e,t,i)=>{"use strict";function s(){ -return Promise.all([i.e(6342),i.e(8185),i.e(2202),i.e(8894),i.e(5743),i.e(6954),i.e(2227),i.e(2077)]).then(i.bind(i,3014))}i.d(t,{loadChangeIntervalDialog:()=>s})},59613:(e,t,i)=>{"use strict";i.d(t,{showChangeIntervalDialogAsync:()=>n});var s=i(59672);let o=null;function n(e){const t=o=(0,s.loadChangeIntervalDialog)().then((i=>{t===o&&i.showChangeIntervalDialog(e)}));return t}},92572:(e,t,i)=>{"use strict";function s(e){return Promise.all([i.e(7629),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(2537),i.e(8894),i.e(5743),i.e(9487),i.e(3329),i.e(4678),i.e(4059),i.e(861),i.e(2227),i.e(9418),i.e(3179),i.e(4426),i.e(9928),i.e(8604),i.e(1859)]).then(i.bind(i,62256)).then((t=>t.showGoToDateDialog(e)))}i.d(t,{showGoToDateDialog:()=>s})},70347:(e,t,i)=>{"use strict";i.d(t,{runOrSigninWithFeature:()=>s});const s=(e,t)=>{e()};window.TradingView.runOrSigninWithFeature=s},16708:(e,t,i)=>{"use strict";i.d(t,{DeleteLockedLineToolReason:()=>s,confirmRemovingLockedLineTools:()=>d,showDeleteLockedLineToolsConfirm:()=>h});var s,o=i(11542),n=i(3615),r=i(5734),a=i(89947);!function(e){e[e.RemoveSelected=0]="RemoveSelected",e[e.RemoveAll=1]="RemoveAll"}(s||(s={}));const l=o.t(null,void 0,i(41019)),c=o.t(null,void 0,i(41019));async function h(e,t){if(r.doNotShowDeleteLockedLineConfirmProperty.value())return void t(a.deleteLockedLineToolsProperty.value());const{getContent:h}=await Promise.all([i.e(7328),i.e(3425),i.e(6052),i.e(1065),i.e(4598)]).then(i.bind(i,30627));(0,n.showConfirm)({title:o.t(null,void 0,i(71692)),content:h(e===s.RemoveSelected?l:c),id:`${r.doNotShowDeleteLockedLineKey}-confirm`,mainButtonText:o.t(null,void 0,i(93123)),mainButtonIntent:"danger",cancelButtonText:o.t(null,void 0,i(99024)),onConfirm:({dialogClose:e})=>{r.doNotShowDeleteLockedLineConfirmProperty.value()&&a.deleteLockedLineToolsProperty.setValue(!0),t(!0),e()},onCancel:({dialogClose:e})=>{r.doNotShowDeleteLockedLineConfirmProperty.value()&&a.deleteLockedLineToolsProperty.setValue(!1),t(!1),e()}})}function d(e){return new Promise((t=>{h(e,t)}))}},31237:(e,t,i)=>{"use strict";i.d(t,{showDeleteStudyTreeConfirm:()=>r});var s=i(11542),o=i(3615);const n=5;function r(e,t){let r,a="";if(e.length>n){const t=e.length-n+1;r=e.slice(0,n-1),a=s.t(null,{plural:"and {nameCount} more indicators.",count:t},i(31550)).format({nameCount:t.toString()})}else r=e;const l='
    '+r.map((e=>`
  • ${e}
  • `)).join("")+"
"+a,c=s.t(null,void 0,i(4995))+l;(0,o.showConfirm)({title:s.t(null,void 0,i(97767)),html:c,mainButtonText:s.t(null,void 0,i(67410)),mainButtonIntent:"danger",cancelButtonText:s.t(null,void 0,i(4543)),onConfirm:({dialogClose:e})=>{t(),e()}})}},10341:(e,t,i)=>{"use strict";i.d(t,{showTooManyStudiesNotice:()=>n});var s=i(11542),o=i(3615);function n(e){(0,o.showWarning)({title:s.t(null,void 0,i(66719)),text:s.t(null,{replace:{number:`${e}`}},i(86146))})}},55279:(e,t,i)=>{"use strict";i.d(t,{getAdditionalSymbolInfoFields:()=>n,setAdditionalSymbolInfoFields:()=>o});let s=[];function o(e){s=e} -function n(){return s}},84526:(e,t,i)=>{"use strict";function s(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});var s=i(50279),o=i(50151),n=(i(11542),i(14411)),r=i(23024),a=i(48096),l=i(37103),c=i(81593);function h(e,t){e.content=JSON.stringify(t)}new WeakMap;new TextEncoder;class d{constructor(e){this._prevChartState=null,this._chartSavedDelegate=new a.Delegate,this._chartAboutToBeSavedDelegate=new a.Delegate,this._chartSizeLimitExceededDelegate=new a.Delegate,this._isSaveInProcess=!1,this._savingToken=null,this._chartWidgetCollection=e}async saveChartLineTools(e,t,s,o){if(l.enabled("saveload_separate_drawings_storage")){const n=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){const e=this._chartWidgetCollection.metaInfo.uid.value();l(e)}}),!0);const{SavingLineToolsLibraryError:e}=await i.e(5565).then(i.bind(i,98653));throw new e("Layout ID not yet created.",!0)}return l(a)}return Promise.reject("Line tools storage is not supported")}layoutId(){return this._chartWidgetCollection.metaInfo.uid.value()}saveChartSilently(e,t,i){const s=i||{};this._isSaveInProcess=!0,this._chartAboutToBeSavedDelegate.fire(),this._saveChart((e=>{const t=e&&l.enabled("saveload_separate_drawings_storage"),i=this._getChartWidgetCollectionState(!1,void 0,void 0,void 0,t),o=this._getCommonSavingInfo(!1);return h(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&&delete this._prevChartState.savingToken}),(e=>{this._chartSavedDelegate.fire(!1),this._isSaveInProcess=!1,t&&t(e)}),s)}saveToJSON(e){const t=e&&!1===e.includeDrawings||void 0,i=this._getCommonSavingInfo(!1);return h(i,this._getChartWidgetCollectionState(!1,!0,t,void 0,t)),i}isSaveInProcess(){return this._isSaveInProcess}_getChartWidgetCollectionState(e,t,i,s,o){let n=!1;return e?n=!0:(t=!0,s=!1),this._chartWidgetCollection.state({withData:!!e,skipLineToolsFromOtherSymbols:!!i,wipeSensitiveData:!!s,skipLineTools:o,skipHiddenSources:n,addOnlyActiveChart:!t})}_getCommonSavingInfo(e){const t=this._chartWidgetCollection,i=this._chartWidgetCollection.chartsSymbols()[t.activeChartWidget.value().id()],s={...(o=i,{...o,legs:JSON.stringify(o.legs??[])})};var o;const n=t.metaInfo,r=n.id.value();return null!==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)=>{const i=t.lineToolsSynchronizer();if(i){e[0]||=i.hasUnsavedMigrationsFromChartState();const t=i.flushPendingSavings();t&&e[1].push(t)}return e}),[!1,[]]);return t.length&&await Promise.all(t),t.length>0&&e}return!1}_invalidateAllLineTools(){this._chartWidgetCollection.getAll().forEach((e=>e.lineToolsSynchronizer()?.invalidateAll()))}_saveChartImpl(e,t,i,s,o,n){let r;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((async e=>{const t=e instanceof Response?e:void 0,i=e instanceof Error?e:void 0;this._savingToken=null;const o=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){const a=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()};let h=r.changes??n.changedAll;l.enabled("saveload_separate_drawings_storage")&&this._invalidateAllLineTools();let d=!0;if(2&h||l.enabled("saveload_separate_drawings_storage"))try{await this._saveLineToolsToStorage()&&(h|=1)}catch(e){h|=1;const{SavingLineToolsLibraryError:t}=await i.e(5565).then(i.bind(i,98653));e instanceof t&&e.safe||(d=!1)}if(1&h){const i=e(d);if((0,s.default)(this._prevChartState,i)&&null!==c.id)return this._chartSavedDelegate.fire(!0),void t(c,i);0;const n=(e,i)=>(d||this._chartWidgetCollection.getAll().forEach((e=>e.lineToolsSynchronizer()?.markAsValidatedBecauseOfSavingToContent())),t(e,i));return this._saveChartImpl(i,c,n,o,r,e)}this._chartSavedDelegate.fire(!0),t(c,e(d))}}},71846:(e,t,i)=>{"use strict";var s=i(12362).ChartSaverBase;i.i18next(null,void 0,i(49947));t.ChartSaver=class extends s{constructor(e){super(e)}chartSizeLimitExceeded(){return this._chartSizeLimitExceededDelegate}chartAboutToBeSaved(){return this._chartAboutToBeSavedDelegate}chartSaved(){return this._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){return this.isScriptNameValid(e)&&this.isScriptDescriptionValid(t)}openInNewTab(e,t,i){e.publishInProgress=!0,i||this.isScriptDescribersValid(t.name,t.description)&&undefined(new Promise((function(t){e.setPopupUrl=t})))}onPublish(e,t){}}},19e3:(e,t,i)=>{"use strict";i.d(t,{getTranslatedSymbolDescription:()=>s});i(11542);function s(e){return e.description||""}},29242:(e,t,i)=>{"use strict";function s(e){return e+"…"}i.d(t,{appendEllipsis:()=>s})},58043:(e,t,i)=>{"use strict" -;function s(e){let t;if("object"!=typeof e||null==e||"number"==typeof e.nodeType)t=e;else if(e instanceof Date)t=new Date(e.valueOf());else if(Array.isArray(e)){t=[];let i=0;const o=e.length;for(;is})},39527:(e,t,i)=>{"use strict";function s(e,...t){return e&&"object"==typeof e?(0===t.length||t.forEach((t=>{null!=t&&"object"==typeof t&&Object.keys(t).forEach((i=>{const n=e[i],r=t[i];if(r===e)return;const a=Array.isArray(r);if(r&&(o(r)||a)){let t;t=a?n&&Array.isArray(n)?n:[]:n&&o(n)?n:{},e[i]=s(t,r)}else void 0!==r&&(e[i]=r)}))})),e):e}function o(e){if(!e||"[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);if(!t)return!0;const i=Object.hasOwnProperty.toString,s=t.hasOwnProperty("constructor")&&t.constructor;return"function"==typeof s&&i.call(s)===i.call(Object)}i.d(t,{deepExtend:()=>s})},88723:(e,t,i)=>{"use strict";function s(){let e,t;return{promise:new Promise(((i,s)=>{e=i,t=s})),reject:t,resolve:e}}i.d(t,{createDeferredPromise:()=>s})},39058:(e,t,i)=>{"use strict";function s(e){if(void 0===e)return"";if(e instanceof Error){let t=e.message;return e.stack&&(t+=" "+e.stack),t}return"string"==typeof e?e.toString():JSON.stringify(e)}i.d(t,{errorToString:()=>s})},4168:(e,t,i)=>{"use strict";i.r(t),i.d(t,{guid:()=>s.guid,randomHash:()=>s.randomHash,randomHashN:()=>s.randomHashN});var s=i(4226)},50470:(e,t,i)=>{"use strict";i.d(t,{parseHtml:()=>n,parseHtmlElement:()=>r});const s=new WeakMap;var o;function n(e,t){let i,o;return i=null==t?document.documentElement:9===t.nodeType?t.documentElement:t,s&&(o=s.get(i)),o||(o=i.ownerDocument.createRange(),o.selectNodeContents(i),s&&s.set(i,o)),o.createContextualFragment(e)}function r(e,t){const i=n(e,t),s=i.firstElementChild;return null!==s&&i.removeChild(s),s}!function(e){e[e.Element=1]="Element",e[e.Document=9]="Document"}(o||(o={}))},26867:(e,t,i)=>{"use strict";function s(e){e.preventDefault()}i.d(t,{preventDefault:()=>s,preventDefaultForContextMenu:()=>n});const o=["input:not([type])",'input[type="text"]','input[type="email"]','input[type="password"]','input[type="search"]','input[type="number"]','input[type="url"]',"textarea","a[href]",'*[contenteditable="true"]',"[data-allow-context-menu]"];function n(e){const t=e.target;t&&!t.closest(o.join(", "))&&e.preventDefault()}},53470:(e,t,i)=>{"use strict";function s(e){return e.reduce((function(e,t,i){return~e.indexOf(t)||e.push(t),e}),[])}i.r(t),i.d(t,{uniq:()=>s})},34369:e=>{e.exports=''},93544:e=>{ -e.exports=''},53573:e=>{e.exports=''},34487:e=>{e.exports=''},11890:e=>{e.exports=''},5845:e=>{e.exports=''},94839:e=>{e.exports=''},29453:e=>{e.exports=''},50946:e=>{e.exports=''},70893:e=>{ +})(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"]);return t.pro_name=e.pro_name,t}resolution(){return this._chartWidget.model().mainSeries().interval()}marketStatus(){return this._chartWidget.model().mainSeries().marketStatusModel().currentSession().spawn()}getVisibleRange(){const e={from:0,to:0},t=this._chartWidget.model().timeScale(),i=t.visibleBarsStrictRange();if(null===i)return e;const s=i.firstBar(),o=i.lastBar(),r=this._convertIndexToPublicTime(o);if(null===r)return e;const a=Math.max((0,n.ensureNotNull)(t.points().range().value()).firstIndex,s);return e.from=(0,n.ensureNotNull)(this._convertIndexToPublicTime(a)),e.to=r,e}getVisibleBarsRange(){const e=this._chartWidget.model().timeScale();if(null===e.visibleBarsStrictRange())return null;let t=this.chartModel().mainSeries().data();for(const e of this.chartModel().dataSources())if((0,An.isPriceDataSource)(e)&&e.isVisible()){const i=e.barsProvider().bars(),s=i.last(),o=t.last();null!==s&&null!==o&&s.index>o.index&&(t=i)}const i=e.visibleStrictDataRange(t);if(null===i)return null;const s=this._convertIndexToPublicTime(i.firstBar()),o=this._convertIndexToPublicTime(i.lastBar());return null===s||null===o?null:{from:s,to:o}}getVisiblePriceRange(){if(console.warn("`getVisiblePriceRange` is deprecated. Use Price Scale API instead"),!this._chartWidget.model().mainSeries())return null;return this._chartWidget.model().mainSeries().priceScale().priceRangeInPrice()}scrollPosition(){return console.warn("`scrollPosition` is deprecated. Use rightOffset from Time Scale API instead"),this._chartWidget.model().timeScale().rightOffset()}defaultScrollPosition(){return console.warn("`defaultScrollPosition` is deprecated. Use defaultRightOffset from Time Scale API instead"),this._chartWidget.model().timeScale().defaultRightOffset().value()}priceFormatter(){return this._chartWidget.model().mainSeries().priceScale().formatter()}chartType(){return this._chartWidget.model().mainSeries().properties().childs().style.value()}setTimezone(e){this._chartWidget.setTimezone(e)}getTimezone(){return this._chartWidget.getTimezone()}getTimezoneApi(){return this._timezoneApi}getPanes(){return this._chartWidget.model().model().panes().map((e=>this._getPaneApi(e)))}exportData(e){ +if(!l.enabled("charting_library_export_chart_data"))return Promise.reject("Data export is not supported");const t={...e};return void 0!==t.from&&(t.from=this._convertTimeFromPublic(t.from)),void 0!==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){const e=new O.WatchedValue(!1);this._zoomUndoStackIsNotEmpty=e.spawn(),this._chartWidget.withModel(this,(()=>{const t=this._chartWidget.model().zoomStack();t.onChange().subscribe(this,(()=>e.setValue(!t.isEmpty())))}))}return this._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(){return new _y(this._chartWidget.model().lineToolsGroupController(),this._chartWidget.model().model())}isSelectBarRequested(){return this._chartWidget.selectPointMode().value()!==mt.SelectPointMode.None}requestSelectBar(){return this.isSelectBarRequested()?Promise.reject("already requested"):new Promise(((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){const t=this._prepareEndOfPeriodArgs();return zf(t.barBuilder,e,t.intervalObj)}endOfPeriodToBarTime(e){const t=this._prepareEndOfPeriodArgs();return function(e,t,i){if(i.isDays())return t;const s=1e3*t-1;if(e.moveTo(s),i.isIntraday()){const i=e.indexOfBar(s);if(i<0)throw new Error(`${t} is out of the instrument session `);return e.startOfBar(i)/1e3}return e.startOfBar(0)/1e3}(t.barBuilder,e,t.intervalObj)}createAnchoredShape(e,t){const i=()=>new Error(`Cannot create "${t.shape}" shape`),s=t.shape;if(Nf(s)&&!0!==Of[s].isAnchored)throw console.warn(`${s} is not an anchored shape. It can be created using createShape or createMultipointShape`),i();const o=this._chartWidget.model().model(),n=o.mainSeries();if(o.timeScale().isEmpty())throw i();const r=void 0!==t.ownerStudyId?o.dataSourceForId(t.ownerStudyId):n,a=this._convertPositionPercentToDataSource(e,r);if(null===a)throw i();return this._createMultipointShape([a],t)}properties(){return this._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(){return this._chartWidget.chartPainted()}applyOverrides(e){this._chartWidget.applyOverrides(e)}addOverlayStudy(e,t,i){ +return this._chartWidget.addOverlayStudy(e,t,i)}lineToolsSynchronizer(){return this._chartWidget.lineToolsSynchronizer()}cloneLineTool(e){const t=this._chartWidget.model(),i=t.model().dataSourceForId(e);return t.cloneLineTools([i],!1)[0]}shareLineTools(e,t){const i=this._chartWidget.model(),s=e.map((e=>i.model().dataSourceForId(e)));i.shareLineTools(s,t)}getLollipopSourcesApi(){throw new Error("getLollipopSourcesApi is not supported")}clickAtLatestUpdatesLollipop(){throw new Error("clickAtLatestUpdatesLollipop is not supported")}linkingGroupIndex(){return this._apiLinkingGroupIndex.spawn()}loadingScreenActive(){return this._chartWidget.screen.isShown()}symbolResolvingActive(){for(const e of this._chartWidget.model().model().symbolSources())if(e.symbolResolvingActive().value())return!0;return!1}hasModel(){return this._chartWidget.hasModel()}disableAllUtilitySources(){0}chartProto(){return kg.prototype}ranges(){throw new Error("not implemented")}getTimeScale(){return new Uf(this._chartWidget.model().timeScale())}async loadChartTemplate(e){await(0,Vf.loadTheme)(this._chartWidget.chartWidgetCollection(),{themeName:e,standardTheme:!1,noUndo:!1,onlyActiveChart:!0})}setTimeFrame(e){this.setActive(),this._chartWidget.loadRange(e)}async syncTime(e){if(this._chartWidget.hasModel()){const t=this._chartWidget.model().model(),i=t.mainSeries().syncModel();if(i)return t.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");const s=i??!0,o=(0,n.ensureNotNull)(this.lineToolsSynchronizer()).getDTO(e,t,s);return delete o.clientId,o}async applyLineToolsState(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(){return this._chartWidget.model().model().replayStatus()}replayStudyStrategyProperties(){return this._chartWidget.model().model().replayStudyStrategyProperties()}insertStudyWithoutCheck(e,t,i,s,o){return this._chartWidget.model().insertStudyWithoutCheck(new ns.StudyMetaInfo(e,o),t,i,s)}copyEntityToClipboard(e){const t=this._chartWidget.model().model().dataSourceForId(e);t&&this._chartWidget.chartWidgetCollection().clipboard.uiRequestCopy([t])}pasteFromClipboard(){this._chartWidget.chartWidgetCollection().clipboard.uiRequestPaste()}inactivityGaps(){return this._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){const t=this._chartWidget.model(),i=t.model(),s=(0,n.ensureNotNull)(i.paneForSource(i.mainSeries()));await(0,xo.ensureLineToolLoaded)(e);const o={pane:s,point:(()=>{const e=(0,n.ensureNotNull)(t.mainSeries().bars().last());return{index:e.index,price:e.value[4],interval:i.mainSeries().interval()}})(),linetool:e,actionSource:"API"};return i.createLineTool(o).adapter()}_createStudy(e){return Promise.reject("Pine Script® and java studies are not supported")}_convertTimeToPublic(e){return this._getTimeConverter().convertInternalTimeToPublicTime(e)}_convertIndexToPublicTime(e){return null===this._chartWidget.model().mainSeries().symbolInfo()?null:this._getTimeConverter().convertTimePointIndexToPublicTime(e)}_convertPositionPercentToDataSource(e,t){const i=this._chartWidget.model().timeScale(),s=t.priceScale(),o=t.firstValue();if(null==o||!isFinite(o)||null===s)return null;const n=i.coordinateToIndex(e.x*i.width());return{price:s.coordinateToPrice(e.y*s.height(),o),index:n}}_convertUserPointsToDataSource(e){const t=this._chartWidget.model().model(),i=t.mainSeries(),s=t.timeScale().points(),o=i.data();if(t.timeScale().isEmpty())return null;const r=e.map((e=>e.time||0)),a=this._alignPoints(r),l=(e,t,r)=>{const a=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){const t=(0,n.ensureNotNull)(i.syncModel()).distance(c,e);t.success&&(l.index=l.index+t.result)}else if(enew Error(`Cannot create "${s.shape}" shape`),s=Object.assign({},{filled:!0},t),o=Of[s.shape]||Of.flag;const r=this._chartWidget.model().model(),a=r.mainSeries();if(r.timeScale().isEmpty())throw i();const l=void 0!==s.ownerStudyId?r.dataSourceForId(s.ownerStudyId)??a:a,c=r.paneForSource(l);if(null===e||null===c)throw i();if(o.onlySelectable)throw new Error(`Cannot create "${s.shape}" shape`);if("LineToolIcon"===o.name){const e=s;if(e.icon=e.icon||e.overrides&&e.overrides.icon,!s.hasOwnProperty("icon"))throw new Error("icon must be specified in options");e.overrides=e.overrides||{},e.overrides.icon=e.icon}await(0,xo.ensureLineToolLoaded)(o.name);const h=(0,zs.createLineToolProperties)(r.backgroundTheme().spawnOwnership(),o.name,!r.readOnly());if((0,zs.prepareLineToolPropertiesByOwnerSource)(h,l),s.overrides)for(const e in s.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]);let d;void 0!==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();const u=d.createLineTool({pane:c,point:e[0],linetool:o.name,properties:h,ownerSource:l,actionSource:"API"});if(null===u)throw h.destroy(),i();if(u.properties()!==h&&h.destroy(),ny(o.name)){if(e.length>2)throw new Error(`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{const t=u.pointsCount();if(t!==e.length&&-1!==t)throw new Error(`Wrong points count for ${s.shape}. Required ${t}`);const i=new To.EnvironmentState(void 0,!0),n=(0,Lt.isLineDrawnWithPressedButton)(o.name);for(let t=1;te.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(){const e=this._chartWidget.model().model(),t=e.timezone(),i=(0,n.ensureNotNull)(e.mainSeries().symbolInfo()),s=e.mainSeries().interval(),o=new Cd.SessionInfo(t,i.session,i.session_holidays,i.corrections);return{barBuilder:(0,Td.newBarBuilder)(s,o,o),intervalObj:Re.Interval.parse(s)}}_getPaneApi(e){let t=this._panes.get(e);return void 0===t&&(t=new Xf(e,this._chartWidget),this._panes.set(e,t)),t}_getStudyApi(e){let t=this._studies.get(e);return void 0===t&&(t=new iy(e,this._chartWidget),this._studies.set(e,t)),t}_getLineDataSourceApi(e){let t=this._lineDataSources.get(e);return void 0===t&&(t=new ay(e,this._chartWidget.model(),{apiPointsToDataSource:this._convertUserPointsToDataSource.bind(this),dataSourcePointsToPriced:e=>{const t=(0,n.ensureNotNull)(this._chartWidget.model().mainSeries().syncModel()),i=this._chartWidget.model().timeScale();return e.map((e=>{const s=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){const t=this._chartWidget.model().model(),i=t.mainSeries(),s=i.interval(),o=i.symbolInfo();if(t.timeScale().isEmpty()||!Re.Interval.isDWM(s)||null===o)return e;const n=(0,Jd.createDwmAligner)(s,o);return null===n?e:e.map((e=>n.timeToSessionStart(1e3*e)/1e3))}_onLogicalRangeChanged(){const e=this._chartWidget.model().mainSeries(),t=e.data().isEmpty();if(null!==this._chartWidget.model().timeScale().visibleBarsStrictRange()&&t)return void e.dataEvents().completed().subscribe(this,this._onLogicalRangeChanged,!0);const i=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"))throw new Error(`${e} can only be used when 'saveload_separate_drawings_storage' featureset is enabled`)}_onSymbolChanged(e){var t;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,delay:t.delay,expired:t.expired,expiration_date:t.expiration_date,sector:t.sector,industry:t.industry,currency_code:t.currency_code,original_currency_code:t.original_currency_code,unit_id:t.unit_id,original_unit_id:t.original_unit_id,unit_conversion_types:t.unit_conversion_types,subsession_id:t.subsession_id,subsessions:t.subsessions,price_source_id:t.price_source_id,price_sources:t.source2?[t.source2]:[],logo_urls:t.library_custom_fields?.logo_urls,exchange_logo:t.library_custom_fields?.exchange_logo,library_custom_fields:t.library_custom_fields})}}var vy=i(52092);class Sy{loginRequired(){throw new Error("Not implemented")}onGoProDialog(e,t){throw new Error("Not implemented")}}function by(){throw new Error("not implemented")}function wy(e){const t=new O.WatchedValue(e.value()),i=t=>{(0,yi.allowSavingDefaults)(!0),e.setValue(t),(0,yi.allowSavingDefaults)(!1)};return t.subscribe(i),e.subscribe(t,(()=>{t.setValue(e.value())})),t.spawn((()=>{e.unsubscribeAll(t),t.unsubscribe(i)}))}class Cy extends Sy{constructor(e){super(),this.linking=de.linking,this._lockDrawingsWatchedValue=null,this._hideDrawingsWatchedValue=null,this._hideIndicatorsWatchedValue=null,this._studyTemplatesDrawer=null,this._fontIconsSettingsDrawer=null,this._favoriteDrawingsToolbar=null,this._webview=null,this._activeChartWidgetWV=new O.WatchedValue(null),this._activeChartRangeState=new Bf.WatchedObject({ranges:[]}),this._themesApi=null,this._newsApiDeferredPromise=null,this._newsApiRejectionReason=null,this._watchlistApiDeferredPromise=null,this._watchlistApiRejectionReason=null,this._widgetbarApiDeferredPromise=null,this._widgetbarApiRejectionReason=null,this._isDestroyed=!1,this._widgebarApi=null,this._chartWidgets=new WeakMap,this._layoutSettingsDrawer=null,this._magnetEnabledWV=null,this._magnetModeWV=null,this._magnetSnapsToIndicatorsWV=null,this._drawOnAllCharts=(0,ye.convertPropertyToWatchedValue)((0,mt.drawOnAllCharts)()),this._replayApi=null,this._pineEditorApi=null,this._backtestingStrategyApi=null,this._supportTicketData=null,this._activeChartWidgetChangedDelegate=new ae.Delegate,this._alerts=null,this._activateChart=e=>{this.setActiveChart(this._chartIndex(e))};const{chartApiInstance:t,chartWidgetCollection:i,studyMarket:s,saveChartService:o,loadChartService:n,sharingChartService:r=null,webview:a=null,favoriteServices:l,alertsServices:c,supportTicketData:h=null}=e;this._chartApiInstance=t,this._chartWidgetCollection=i,this._studyMarket=s,this._saveChartService=o,this._sharingChartService=r,this._loadChartService=n,this._favoriteServices=l,this._intervalsService=null,this._alertsWidgetDialog=null,this._detailsDialogController=null, +this._supportedChartStylesSpawn=de.linking.supportedChartStyles.spawn(),this._chartWidgetCollection.onAboutToBeDestroyed.subscribe(null,(()=>this.destroy()),!0),this._webview=a,this._alertService=null,this._supportTicketData=h;const d=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(){return null===this._themesApi&&(this._themesApi=new Rf({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,void 0)}unsubscribe(e,t){ee.unsubscribe(e,t,void 0)}onActiveChartChanged(){return this._activeChartWidgetChangedDelegate}webview(){return by(),this._webview}connect(){by()}disconnect(){by()}onConnectionStatusChanged(e){by()}isConnected(){by()}supportTicketData(){return this._supportTicketData}setPublishChartOptions(e){by()}publishChart(e){by()}studyTemplatesDrawerApi(){by()}fontIconsSettingsDrawer(){by()}intervalsService(){by()}alertService(){by()}async alerts(){by()}supportedChartTypes(){return this._supportedChartStylesSpawn}setBrokerName(e){this._chartWidgetCollection.setBroker(e)}getDrawOnAllCharts(){return(0,mt.drawOnAllCharts)().value()}drawOnAllCharts(e){return(0,mt.drawOnAllCharts)().setValue(e)}drawOnAllChartsEnabled(){return this._drawOnAllCharts}getDrawOnAllChartsMode(){return(0,mt.drawOnAllChartsMode)().value()}drawOnAllChartsMode(e){(0,mt.drawOnAllChartsMode)().setValue(e) +}currencies(){return this._chartApiInstance?.availableCurrencies()??Promise.reject()}units(){return this._chartApiInstance?.availableUnits()??Promise.reject()}disableTrackingEvents(){(0,re.disableTrackingEvents)()}getSaveChartService(){return this._saveChartService}symbolSync(){return this._symbolSync}intervalSync(){return this._intervalSync}dateRangeSync(){return this._dateRangeSync}crosshairSync(){return this._crosshairSync}timeSync(){return this._timeSync}setSymbolSearchUI(e){by()}chart(e=0){if(e<0||e>=this.chartsCount())throw Error("Incorrect index: "+e);return this._getChartWidgetApi(this._chartWidgetCollection.getAll()[e])}*charts(){for(let e=0;e=0&&e(this._favoriteDrawingsToolbar||(this._favoriteDrawingsToolbar=new e.FavoriteDrawingsApi),this._favoriteDrawingsToolbar)))}sharingChart(){return this._sharingChartService}watchlist(){by()}setWatchlistApiPromise(e){by()}news(){by()}setNewsApiPromise(e){by()}widgetbar(){by()}setWidgetbarApiPromise(e){by()}getChartStorage(){return getChartStorage()}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(){return null===this._magnetEnabledWV&&(this._magnetEnabledWV=wy((0,mt.properties)().childs().magnet)),this._magnetEnabledWV}magnetMode(){return null===this._magnetModeWV&&(this._magnetModeWV=wy((0,mt.properties)().childs().magnetMode)),this._magnetModeWV}magnetSnapsToIndicators(){return null===this._magnetSnapsToIndicatorsWV&&(this._magnetSnapsToIndicatorsWV=wy((0,mt.properties)().childs().magnetSnapsToIndicators)),this._magnetSnapsToIndicatorsWV}flushBufferedData(){Ff.fire()}chartWidgetCollectionState(e){return this._chartWidgetCollection.state(e)}chartWidgetCollectionSeriesStatuses(){return this._chartWidgetCollection.chartSeriesStatuses()}watermark(){{const e=P_.getInstance();if(!e.ready())throw new Error("Watermark API is not initialised yet.");return e}}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(){return this._chartWidgetCollection.startFullscreen()}exitFullscreen(){return this._chartWidgetCollection.exitFullscreen()}getFavoriteChartStylesService(){by()}getFavoriteIntervalsService(){by()}getFavoriteCurrencyUnitConversionApi(){by()}getIntervals(){let e=[];const t=(0,ht.getCustomResolutions)();return null!==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){return Qf(ns.StudyMetaInfo.findStudyMetaInfoByDescription((0,n.ensureNotNull)(this._chartApiInstance).allStudiesMetadata(),e))}getStudyStyles(e){return ey(ns.StudyMetaInfo.findStudyMetaInfoByDescription((0,n.ensureNotNull)(this._chartApiInstance).allStudiesMetadata(),e))}getSymbolInterval(e){const t={symbol:this.linking.proSymbol.value(),interval:this.linking.interval.value()};return e?.(t),t}hasChartChanges(){return this._chartWidgetCollection.hasChanges()}async loadChart(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));const t=await this._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")}}async loadChartFromServer(e){await(this._loadChartService?.loadChart(e,!1))}async loadLayoutFromServerByLayoutId(e,t,i){await(this._loadChartService?.loadChartByUrl(e,!!t,i))}layoutId(){return this._chartWidgetCollection.metaInfo.uid.value()}async createNewLayout(e){by()}lockAllDrawingTools(){return null===this._lockDrawingsWatchedValue&&(this._lockDrawingsWatchedValue=new O.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(){return null===this._hideDrawingsWatchedValue&&(this._hideDrawingsWatchedValue=new O.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(){return null===this._hideIndicatorsWatchedValue&&(this._hideIndicatorsWatchedValue=new O.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(){return this._chartWidgetCollection.activeChartWidget.value().model().mainSeries().priceScale().formatter()}onContextMenu(e){ee.subscribe("onContextMenu",(t=>{t.callback(e(t.unixtime,t.price))}),void 0)}onGrayedObjectClicked(e){ee.subscribe("onGrayedObjectClicked",e,void 0)}removeChartFromServer(e,t){z.backend.removeChart(e).then(t)}saveChart(e,t){if(!this._saveChartService)return;const i=this._saveChartService.saveToJSON(t);return e&&e(JSON.parse(i.content))}saveChartToServer(e,t,i){this._saveChartService&&this._saveChartService.saveChartSilently(e,t,i)}selectedLineTool(){const e=Object.keys(Of),t=mt.tool.value();for(let i=0;i{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(){return null}showNoticeDialog(e){(0,j.showWarning)({title:e.title,text:e.body||"",onClose:e.callback})}showSupportDialog(){by()}showSaveAsChartDialog(){const e=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){return this._chartWidgetCollection.clientSnapshot(e)}takeScreenshot(){return this._chartWidgetCollection.takeScreenshot()}trading(){by()}waitTrading(){by()}viewMode(){by()}viewModeWatchedValue(){by()}async dummyBrokerController(){return Promise.reject("Not implemented")}pineLibApi(){return by(),{saveNew,saveNext,requestBuiltinScripts}}resetCache(){(0,r.getChartingLibraryGlobalContext)().ChartApiInstance.resetCache()}getSymbolAliasService(){throw new Error("not supported")}static setContextMenuOptions(e){void 0!==e.items_processor&&Io.ContextMenuManager.setCustomItemsProcessor(e.items_processor),void 0!==e.renderer_factory&&Io.ContextMenuManager.setCustomRendererFactory(e.renderer_factory)}_getChartWidgetApi(e){let t=this._chartWidgets.get(e);return void 0===t&&(t=new yy(e,this._activateChart.bind(null,e)),this._chartWidgets.set(e,t)),t}_chartIndex(e){return this._chartWidgetCollection.getAll().indexOf(e)}_activeChartWidget(){return this._chartWidgetCollection.activeChartWidget.value()}_toggleUnitConversionMenu(e,t,i,s,o){if(t)return void ee.emit(e,t,-1,-1,"");const r=this._chartWidgetCollection.getAll(),a=r.findIndex((e=>e.model().model().id()===i));if(-1===a)return;const l=(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);var Ty=i(78136),Py=i(19979);const xy={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"};function My(e){return xy[e]||"www"}var Iy=i(33065),Ay=i(70893),Ly=i(50946);i(59449);const ky={customBrandingTradingViewText:Rt.colorsPalette["color-brand"],customBrandingText:Rt.colorsPalette["color-cold-gray-850"],background:Rt.colorsPalette["color-cold-gray-900"],shadow:Rt.colorsPalette["color-cold-gray-700"],text:Rt.colorsPalette["color-white"],staticTextBackground:(0,Ro.generateColor)(Rt.colorsPalette["color-cold-gray-800"],20),logo:Rt.colorsPalette["color-white"],platformBgColor:Rt.colorsPalette["color-cold-gray-900"],platformFgColor:Rt.colorsPalette["color-cold-gray-200"]},Ey={customBrandingTradingViewText:Rt.colorsPalette["color-brand"],customBrandingText:Rt.colorsPalette["color-cold-gray-850"],background:Rt.colorsPalette["color-white"],shadow:Rt.colorsPalette["color-cold-gray-150"],text:Rt.colorsPalette["color-cold-gray-900"],staticTextBackground:(0,Ro.generateColor)(Rt.colorsPalette["color-white"],20),logo:Rt.colorsPalette["color-cold-gray-900"],platformBgColor:Rt.colorsPalette["color-white"],platformFgColor:Rt.colorsPalette["color-cold-gray-900"]};const Dy=new Map([["logo-old-style",Ly],["tradingview-old-style",Ay]]),By=l.enabled("adaptive_logo"),Vy=l.enabled("small_no_display"),Ry=l.enabled("38914"),Ny="site_branding",Oy="widget_branding",Fy="widget_referral_branding",Wy="widget_custom_branding",Hy="widget_custom_no_powered_branding",zy="fundamental_branding",Uy="fundamental_custom_branding",jy="fundamental_custom_no_powered_branding",Gy="library_branding",qy="library_custom_branding",$y="library_custom_no_powered_branding",Ky=navigator.userAgent.toLowerCase().indexOf("chrome")>-1&&-1===navigator.userAgent.toLowerCase().indexOf("edge"),Yy=window.urlParams||{},Zy=window.initData||{};Yy.no_referral_id&&enable(Yy.referral_id||"","aggressive");const Xy=a.t(null,void 0,i(98856)),Jy=Ry?a.t(null,void 0,i(44676)):a.t(null,void 0,i(92800));a.t(null,void 0,i(46768)),a.t(null,void 0,i(83470)),a.t(null,void 0,i(3140));var Qy;!function(e){e[e.OldFontAdditionalVerticalOffset=0]="OldFontAdditionalVerticalOffset",e[e.NewFontAdditionalVerticalOffset=.1]="NewFontAdditionalVerticalOffset",e[e.StrokeWidth=4]="StrokeWidth",e[e.StaticLogoHorizontalTextOffset=5]="StaticLogoHorizontalTextOffset",e[e.TextWidthCompensation=2]="TextWidthCompensation",e[e.AdaptiveWidthToHideText=500]="AdaptiveWidthToHideText",e[e.WidthToHideLogoIfSmallNoDisplayEnabled=480]="WidthToHideLogoIfSmallNoDisplayEnabled",e[e.TextAdditionalCropWidth=11]="TextAdditionalCropWidth",e[e.BadgeLogoMargin=-11]="BadgeLogoMargin",e[e.BadgeTextMargin=-8]="BadgeTextMargin",e[e.TextAnimatedAlphaStart=.3]="TextAnimatedAlphaStart",e[e.TextAnimatedAlphaEnd=1]="TextAnimatedAlphaEnd",e[e.AnimationDuration=200]="AnimationDuration"}(Qy||(Qy={}));(0,ze.onWidget)();class ev extends Ad.CustomSourceBase{constructor(e,t,i){super(e,t),this._canvasWidth=0,this._paneHeight=0,this._left=13,this._bottom=36,this._layout=Ny,this._needToShow=!0,this._showBranding=!1,this._customLogoSrc="", +this._customLogoLink="",this._tradingviewLogoLinkToPath="",this._cubicBezier=new br.CubicBezier(.4,.01,.22,1),this._openAnimation=null,this._closeAnimation=null,this._powBy=null,this._custom=null,this._destroyed=!1,this._mainSeries=this._model.mainSeries(),this._visible=i,this._showForPro=!t.onWidget();const s=()=>this._model.updateSource(this);this._visible.subscribe(s),this._dark=t.dark().spawn(),this._dark.subscribe(s),this._checkLayout(),this._layout!==Wy&&this._layout!==Uy||(this._left=8,this._bottom=5);const o=()=>{this._needToShow?this._showBranding=!0:this._showBranding=!1};this._resizeHandlerDelayed=(0,Ol.default)(o,200),o(),window.addEventListener("resize",this._resizeHandlerDelayed),this._model.isSnapshot()?this._init():(this._mainSeries.dataEvents().symbolResolved().subscribe(this,this._init),null!==this._mainSeries.symbolInfo()&&this._init()),this._renderer={draw:this.draw.bind(this),hitTest:this.hitTest.bind(this)},t.onWidget()||window.loginStateChange.subscribe(this,this._init)}destroy(){window.removeEventListener("resize",this._resizeHandlerDelayed),this._mainSeries.dataEvents().symbolResolved().unsubscribeAll(this),this._powBy&&this._powBy.destroy(),this._model.onWidget()||window.loginStateChange.unsubscribeAll(this),this._visible.release(),this._dark.destroy(),this._destroyed=!0}paneViews(e){if(window.TradingView.printing&&this._layout!==Hy&&this._layout!==jy)return[];if(!this._visible.value())return[];if(this._layout===Ny&&!this._showForPro&&window.user&&window.user.is_pro)return[];const t=this._model.mainPane();if(!t)return[];const i=l.enabled("move_logo_to_main_pane");let s=!1;if(e.maximized().value())s=!0;else if(i)s=t.collapsed().value()?e===this._model.panes().find((e=>!e.collapsed().value())):e.isMainPane().value();else if(this._model.lastPane().collapsed().value()){const t=this._model.panes();for(let i=t.length-1;i>=0;--i){const o=t[i];if(!o.collapsed().value()){s=o===e;break}}}else s=e.isLast();return s?[{renderer:this.renderer.bind(this)}]:[]}labelPaneViews(e){return[]}priceAxisViews(e,t){return[]}updateAllViews(){}updateViewsForPane(e){}priceScale(){return null}renderer(e){return this._paneHeight=e.mediaSize.height,this._canvasWidth=e.mediaSize.width,this._renderer}hasContextMenu(){return!1}onClickOutside(){this._hasAnimation()&&this._startCloseAnimation()}hitTest(e){if(!this._showBranding||l.enabled("logo_without_link"))return null;if(this._powBy&&this._layout!==Hy&&this._layout!==jy&&(this._powBy.hitTest(e)||this._custom&&this._custom.hitTest(e))){const e=!0;return new Ut.HitTestResult(Ut.HitTarget.Custom,{hideCrosshairLinesOnHover:!0,cursorType:e?ei.PaneCursorType.Pointer:ei.PaneCursorType.Default,clickHandler:()=>{this._openLink()},tapHandler:()=>{this._hasAnimation()?this._toggleOpenAnimatedOrOpenLink():this._openLink()},mouseEnterHandler:()=>{this._hasAnimation()&&this._startOpenAnimation()},mouseLeaveHandler:()=>{this._hasAnimation()&&this._startCloseAnimation()},mouseDownHandler:()=>{0},mouseUpHandler:()=>{0}})}return null}tvUrl(){const e="https://"+function(e){ +return My(e)+".tradingview.com"}((Zy.querySettings?.locale??Zy.currentLocaleInfo?.language)||"en");let t=new URL(e);if(this._customLogoLink)return this._customLogoLink;if(this._layout===Gy||this._layout===qy){let e;switch(!0){case l.enabled("charting_library"):e="library";break;case l.enabled("trading_terminal"):e="trading-terminal"}this._tradingviewLogoLinkToPath&&(t.pathname=this._tradingviewLogoLinkToPath),t.searchParams.append("utm_source",window.location.origin),t.searchParams.append("utm_medium","library"),e&&t.searchParams.append("utm_campaign",e)}return t.toString()}draw(e,t){if(!this._showBranding)return;let i=0;Yy.utm=!0,(0,Kt.drawScaled)(e,t.horizontalPixelRatio,t.verticalPixelRatio,(()=>{if(this._powBy&&this._powBy.show){i=this._powBy.height,e.save();const s=new Vt.Point(this._left,this._paneHeight-this._bottom-i);this._powBy.draw(s,e,t,this._canvasWidth),e.restore()}if(this._custom&&this._custom.show){e.save();const s=new Vt.Point(this._left,this._paneHeight-this._bottom-i-this._custom.height);this._custom.draw(s,e,t),e.restore()}}))}_init(){this._checkLayout();const e=this._mainSeries.symbolInfo();this._powBy&&this._powBy.destroy(),this._powBy=new rv(this._layout,e?.name||"",this._model,(()=>this._model.fullUpdate())),this._custom=new av(this._layout,this._customLogoSrc,(()=>this._model.fullUpdate())),this._openAnimation=null,this._closeAnimation=null,this._model.lightUpdate()}_checkLayout(){if(l.enabled("widget"))0;else{{const e=JSON.parse(Yy.logo)||{};e.image?(this._customLogoSrc=e.image,this._customLogoLink=e.link,this._needToShow=l.enabled("widget_logo"),l.enabled("link_to_tradingview")?this._layout=qy:this._layout=$y):(e.tradingviewLogoLinkToPath&&(this._tradingviewLogoLinkToPath=e.tradingviewLogoLinkToPath.replace(/^\//,"")),this._layout=Gy,this._needToShow=l.enabled("widget_logo"))}}}_startOpenAnimation(){if(null!==this._openAnimation)return;null!==this._closeAnimation&&(this._closeAnimation.stop(),this._closeAnimation=null);const e=(0,n.ensureNotNull)(this._powBy).animationStep();this._openAnimation=(0,xr.doAnimate)({from:e,to:1,duration:200*(1-e),easing:this._cubicBezier.easingFunc,onStep:this._animatedDrawStep.bind(this)})}_startCloseAnimation(){if(null!==this._closeAnimation)return;null!==this._openAnimation&&(this._openAnimation.stop(),this._openAnimation=null);const e=(0,n.ensureNotNull)(this._powBy).animationStep();this._closeAnimation=(0,xr.doAnimate)({from:e,to:0,duration:200*e,easing:this._cubicBezier.easingFunc,onStep:this._animatedDrawStep.bind(this)})}_animatedDrawStep(e,t){(0,n.ensureNotNull)(this._powBy).animatedDrawStep(t),this._model.lightUpdate()}_hasAnimation(){return null!==this._powBy&&this._powBy.hasAnimation()}_openGoPro(){0}_openLink(){if((0,ze.isSymphonyEmbed)())return!1;if(this._layout===Ny)return this._model.isSnapshot()||this._openGoPro(),!1;l.enabled("widget");return(0,n.ensureNotNull)(window.open(this.tvUrl(),"_blank")).opener=null,!0}_toggleOpenAnimatedOrOpenLink(){ +null!==this._openAnimation&&this._openAnimation.completed()?this._openLink()||this._startCloseAnimation():this._startOpenAnimation()}}function tv(e){return!Vy||e>480}function iv(e){return!By||e>500}let sv={},ov={};class nv{constructor(){this._topLeftPoint=null,this._hitTestHeight=null}hitTest(e){const t=this._getHitTestBox();if(t)return(0,Gt.pointInBox)(e,t)}_getHitTestBox(){const e=this._topLeftPoint;if(e){const{x:t,y:i}=e;return(0,Vt.box)(e,new Vt.Point(t+this.width,i+(this._hitTestHeight??this.height)))}}}class rv extends nv{constructor(e,t,i,s){super(),this.show=!0,this.hovered=!1,this.active=!1,this._needDisplayImage=!1,this._textAnimatedAlpha=1,this._textAnimatedAlphaStart=1,this._textAdditionalCropWidth=0,this._textAnimatedAlphaEnd=1,this._badgeData={logoMargin:0,textMargin:0,width:0},this._invertTextCropDirection=!1,this._font=`px ${m.CHART_FONT_FAMILY}`,this._txt="TradingView",this._maximizedAnimationTextWidth=0,this._logoWidth=0,this._textWidthCache=new Qt.TextWidthCache,this._pixelRatio={horizontalPixelRatio:NaN,verticalPixelRatio:NaN},this._model=i,this._layout=e,this._symbol=t,this._showTradeWithLogo=!1,this._showAnimatedBranding=l.enabled("show_animated_logo")||e===Oy,this._alwaysMaximized=l.enabled("logo_always_maximized")||this._model.isSnapshot()&&!ze.CheckMobile.any()||!1,this._fontSize=this._showAnimatedBranding||this._layout===Fy?11:14,this._showAnimatedBranding||this._layout!==Wy&&this._layout!==Uy||(this._fontSize=12),this._sizeConstants=(this._model.isSnapshot(),{brandCircleSize:32,textAsImageWidthCompensation:0,leftOffset:0,bottomOffset:-23,logoLeftOffset:1,logoTextOffset:6}),this.width=this._minimizedAnimationWidth(),this._animatedWidth=this.width,this.height=this._fontSize+2,this._requestRepaint=s,this._init(),this._checkFontLoaded(),this._recalculateMetrics()}destroy(){this._model.properties().childs().paneProperties.childs().background.unsubscribeAll(this),this._model.onChartThemeLoaded().unsubscribeAll(this)}hasAnimation(){return this._showAnimatedBranding&&!this._alwaysMaximized}animationStep(){const e=this._minimizedAnimationWidth(),t=this._maximizedAnimationWidth();return(this._animatedWidth-e)/(t-e)}animatedDrawStep(e){const t=this._minimizedAnimationWidth(),i=this._maximizedAnimationWidth();this._animatedWidth=t+e*(i-t),this._textAnimatedAlpha=this._textAnimatedAlphaStart+e*(this._textAnimatedAlphaEnd-this._textAnimatedAlphaStart)}draw(e,t,i,s){const{brandCircleSize:o,logoLeftOffset:n,leftOffset:r,bottomOffset:a}=this._sizeConstants;this._needDisplayImage&&tv(s)&&(e=new Vt.Point(e.x+r,e.y-a)),this._topLeftPoint=e,t.translate(e.x,e.y);const{horizontalPixelRatio:l,verticalPixelRatio:c}=i;(0,Iy.equalPixelRatios)(i,this._pixelRatio)||(this._textWidthCache.reset(),this._pixelRatio={horizontalPixelRatio:l,verticalPixelRatio:c});const h=this._colors;if(this._showAnimatedBranding){if(this._needDisplayImage){const e=this._getLogoImage(h.logo);this.width=this._animatedWidth,this._drawLogo(t,e,this._animatedWidth,this._animatedWidth,this._animatedWidth>this._sizeConstants.brandCircleSize)} +}else if(this._layout===Wy||this._layout===Uy){t.font=this._fontSize+this._font;const e=t.measureText(this._txt).width+2;this.width=e+t.measureText("TradingView").width+2,t.save(),t.globalAlpha=.7,t.fillStyle=this._colors.customBrandingText,t.fillText(this._txt,0,12),t.fillStyle=this._colors.customBrandingTradingViewText,t.fillText("TradingView",e,12),t.restore()}else if(tv(s))if(this._needDisplayImage){const e=this._getLogoImage(h.logo);t.save(),this._drawBgCircle(t,o/2);const{width:i,height:r}=e.logoImage.viewBox(),a=new Vt.Point(Math.round((o-i)/2)-1+n,Math.floor((o-r)/2)+1);this._drawLogoImage(t,a,e.logoImage);const l=iv(s);l&&(t.translate(o+5,Math.round(this._fontSize*("px EuclidCircular"===this._font?.1:0))),this._drawTextStroke(t),this._drawTextFill(t)),t.restore(),this.width=o,l&&(this.width+=this._maximizedAnimationTextWidth)}else{const e=iv(s);e&&(t.save(),t.translate(Ky?-.5:0,-.5),this._drawTextStroke(t),this._drawTextFill(t),t.restore()),e&&(this.width=this._maximizedAnimationTextWidth)}else this.width=0}showTradeWithLogo(e){this._showTradeWithLogo=e}_minimizedAnimationWidth(){return this._sizeConstants.brandCircleSize+this._badgeData.logoMargin+this._badgeData.width}_maximizedAnimationWidth(){return this._sizeConstants.brandCircleSize+this._sizeConstants.logoTextOffset+this._maximizedAnimationTextWidth+this._badgeData.width+this._badgeData.textMargin}_drawTradeWithLogo(e,t,i){0}_drawLogo(e,t,i,s,o){const{brandCircleSize:n,logoLeftOffset:r,logoTextOffset:a}=this._sizeConstants;e.save(),this._drawFillRectWithRoundedCorner(e,-.5,0,i,n,n/2);const{logoImage:l,textImage:c,proBadgeImage:h}=t,{width:d,height:u}=l.viewBox(),_=new Vt.Point(Math.round((n-d)/2)-1+r,Math.floor((n-u)/2)+1);if(o){const t=new Vt.Point(_.x+d+a,_.y),i=e.globalAlpha;e.globalAlpha*=this._textAnimatedAlpha;const o=s-this._sizeConstants.brandCircleSize-a-this._badgeData.logoMargin-this._badgeData.width;this._drawImageCropWidth(e,t,c,o),e.globalAlpha=i}if(h){const{width:t,height:i}=h.viewBox();h.render(e,{targetViewBox:{x:_.x+this.width-t,y:Math.floor((n-i)/2)+1,width:t,height:i}})}this._drawLogoImage(e,_,l),e.restore()}_init(){ov={},sv={},this._checkLayout(),this.show&&(this._updateColors(),this._updateHeight(),this._model.properties().childs().paneProperties.childs().background.subscribe(this,this._updateColors),this._model.onChartThemeLoaded().subscribe(this,this._updateColors))}_updateHeight(){this._needDisplayImage?this.height=this._sizeConstants.brandCircleSize:this.height=this._fontSize+2}_checkFontLoaded(){if(!this._showAnimatedBranding&&document.fonts&&document.fonts.check&&document.fonts.load){document.fonts.check(`${this._fontSize}px EuclidCircular`)?this._font="px EuclidCircular":document.fonts.load(`${this._fontSize}px EuclidCircular`,this._txt).then((()=>{this._font="px EuclidCircular",this._recalculateMetrics(),this._requestRepaint()}))}}_recalculateMetrics(){const e=(0,Kt.createDisconnectedCanvas)(document,(0,Ft.size)({width:0,height:0})),t=(0,Kt.getPrescaledContext2D)(e);t.font=this._fontSize+this._font +;const i=this._needDisplayImage?this._getLogoImage(this._colors.logo):null;let s=i?i.textImage.viewBox().width+this._sizeConstants.textAsImageWidthCompensation:Math.ceil(t.measureText(this._txt).width)+2+8;s%2==0&&(s+=1),this._maximizedAnimationTextWidth=s,this._textWidthCache.reset(),this._logoWidth=i?.logoImage.viewBox().width??0,this._animatedWidth=this._alwaysMaximized?this._maximizedAnimationWidth():this._minimizedAnimationWidth()}_updateColors(){this._colors=this._model.dark().value()?ky:Ey}_getLogoImage(e){return function(e,t,i,s,o){const r=ov,a=[t,i,o&&"tradeWith"].filter(Boolean).join("-"),l=r[a];if(void 0!==l)return l;const[c,h,d]=function(e,t,i){return i?["logo-trade-with","tradingview-trade-with"]:["logo-old-style","tradingview-old-style",void 0]}(0,0,o),u=e=>e.replace(/fill="#[\da-f]{6}"/gi,`fill="${i}"`),_={logoImage:e(u((0,n.ensureDefined)(Dy.get(c)))),textImage:e(u((0,n.ensureDefined)(Dy.get(h)))),proBadgeImage:d?e(u((0,n.ensureDefined)(Dy.get(d)))):void 0};return r[a]=_,_}(Mo.svgRenderer,this._model.dark().value()?"dark":"light",e,0,this._showTradeWithLogo)}_checkLayout(){switch(this._layout){case Oy:case Fy:case Wy:case zy:case Uy:case qy:case Gy:case Ny:this.show=!0;break;case Hy:case jy:case $y:this.show=!1}switch(this._layout){case Gy:this._needDisplayImage=!0,this._txt=Xy;break;case qy:this._txt=Jy}}_drawTextStroke(e){e.save(),e.textBaseline="middle",e.textAlign="start",e.font=this._fontSize+this._font,e.strokeStyle=this._colors.staticTextBackground,e.lineWidth=4,e.lineJoin="round",e.strokeText(this._txt,0,this._sizeConstants.brandCircleSize/2+this._textWidthCache.yMidCorrection(e,this._txt)),e.restore()}_drawTextFill(e){e.save(),e.textBaseline="middle",e.textAlign="start",e.font=this._fontSize+this._font,e.fillStyle=this._colors.text,e.fillText(this._txt,0,this._sizeConstants.brandCircleSize/2+this._textWidthCache.yMidCorrection(e,this._txt)),e.restore()}_drawImageCropWidth(e,t,i,s){e.save();const{logoMargin:o,textMargin:n}=this._badgeData;e.beginPath();const{width:r,height:a}=i.viewBox();e.rect(t.x-this._textAdditionalCropWidth,t.y,s+this._textAdditionalCropWidth,a),e.clip(),i.render(e,{targetViewBox:{x:t.x-(this._invertTextCropDirection?r-s-o+n:0),y:t.y,width:r,height:a}}),e.restore()}_drawBgCircle(e,t){const i=2*Math.PI;e.save(),e.beginPath(),e.fillStyle=this._colors.shadow,e.arc(t,t,t+1,0,i),e.fill(),e.closePath(),e.restore(),e.save(),e.beginPath(),e.fillStyle=this._colors.background,e.arc(t,t,t,0,i,!1),e.fill(),e.closePath(),e.restore()}_drawFillRectWithRoundedCorner(e,t,i,s,o,n,r){e.save(),(0,$t.drawRoundRect)(e,t-1,i-1,s+2,o+2,n),e.fillStyle=this._backgroundShadowFillStyle(),e.fill(),e.closePath(),e.restore(),e.save(),(0,$t.drawRoundRect)(e,t,i,s,o,r??n),e.fillStyle=this._backgroundFillStyle(),e.fill(),e.closePath(),e.restore()}_tradeWithLogoBackgroundColor(){return""}_backgroundShadowFillStyle(){return this._colors.shadow}_backgroundFillStyle(){return this._colors.background}_drawLogoImage(e,t,i){const{width:s,height:o}=i.viewBox();i.render(e,{targetViewBox:{x:t.x,y:t.y,width:s,height:o +}})}}class av extends nv{constructor(e,t,i){super(),this.show=!1,this.width=0,this.height=0,this._ready=!1,this._layout=e,this._src=t,this._onReadyCallback=i,this._checkLayout();const s=new Image;this._img=s,this.show&&(s.addEventListener("load",(()=>{this.width=Math.round(s.width),this.height=Math.round(s.height),this._ready=!0,this._onReadyCallback&&this._onReadyCallback()})),s.crossOrigin="anonymous",s.src=this._src)}draw(e,t,i){this._topLeftPoint=e,this._ready&&(t.translate(e.x,e.y),t.drawImage(this._img,-.5,-.5,this.width,this.height))}_checkLayout(){switch(this._layout){case Wy:case Hy:case Uy:case jy:case qy:case $y:this.show=!0;break;case Ny:case Oy:case Fy:case zy:case Gy:this.show=!1}}}var lv=i(55279),cv=i(48961);class hv{constructor(e,t){this._headerToolbar=e,this._dropdownId=t}applyOptions(e){this._headerToolbar.updateDropdown(this._dropdownId,e)}remove(){this._headerToolbar.removeDropdown(this._dropdownId)}}var dv=i(68028);class uv{constructor(e){this._symbolModel=e}getVisible(){return this._symbolModel.visible().value()}setVisible(e){return this._symbolModel.visible().setValue(e),this}getIcon(){return this._symbolModel.icon().value()}setIcon(e){return this._symbolModel.icon().setValue(e),this}getColor(){return this._symbolModel.color().value()}setColor(e){return this._symbolModel.color().setValue(e),this}getTooltip(){return this._symbolModel.tooltip().value()}setTooltip(e){return this._symbolModel.tooltip().setValue(e),this}getDropDownContent(){return this._symbolModel.tooltipContent().value()}setDropDownContent(e){return this._symbolModel.tooltipContent().setValue(e),this}}class _v{symbol(e){return new uv(this._model().getSymbolCustomStatus(e))}hideAll(){this._model().hideAll()}static getInstance(){return null===this._instance&&(this._instance=new _v),this._instance}_model(){return dv.CustomStatusModel.getInstance()}}_v._instance=null;var pv=i(22692),mv=i(15754);var gv=i(23745),fv=i(10980),yv=i(43222);class vv{constructor(e,t){this._server=e,this._session=t,this.beforeSeriesCompleted=new ae.Delegate,this.seriesError=new ae.Delegate}onSymbolResolved(e,t){this._server.receiveLocalResponse({method:"symbol_resolved",params:[this._session,e,t]})}onSymbolError(e,t){this._server.receiveLocalResponse({method:"symbol_error",params:[this._session,e,t]})}onStudyError(e,t,i){this._server.receiveLocalResponse({method:"study_error",params:[this._session,e,t,i]})}onSeriesLoading(e,t){this._server.receiveLocalResponse({method:"series_loading",params:[this._session,e,t]})}onSeriesCompleted(e,t,i){this.beforeSeriesCompleted.fire(e,t),this._server.receiveLocalResponse({method:"series_completed",params:[this._session,e,i,t]})}onSeriesError(e,t,i){this._server.receiveLocalResponse({method:"series_error",params:[this._session,e,t,i]}),this.seriesError.fire(e,t)}onStudyCompleted(e,t){this._server.receiveLocalResponse({method:"study_completed",params:[this._session,e,t]})}onStudyLoading(e,t){this._server.receiveLocalResponse({method:"study_loading",params:[this._session,e,t]})}onTickmarksUpdated(e,t){const i={ +method:"tickmark_update",params:[this._session,{index:e,zoffset:0,changes:[],marks:t,index_diff:[]}]};this._server.receiveLocalResponse(i)}onTimescaleUpdate(e,t){const i={method:"timescale_update",params:[this._session,this._prepareDataUpdateObjects(t),{index:e.pointsIndex,zoffset:0,changes:e.points,marks:e.marks,index_diff:e.indexChange,baseIndex:e.baseIndex,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){const r={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){const o={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){const t={};return e.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}}class Sv{constructor(){this._instances=new Map}createChartApiMessager(e,t){const i=new vv(t,e);return this._instances.set(e,i),i}getChartApiMessager(e){return(0,n.ensureDefined)(this._instances.get(e),`ChartapiMessager instance for session ${e}`)}}const bv={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"};class Tv{get(e){return NaN}set(e){}indexOf(e){return NaN}adopt(e,t,i){return NaN}}var Pv=i(60911);class xv{constructor(e,t){this.color=bv,this.linestyle=wv,this.plotstyle=Cv,this.barstate={isLast:()=>this._ctx.symbol.isLastBar},this.input={bool:()=>{const e=this._inputCallback(this._inputIndex++);return(0,n.assert)("boolean"==typeof e,"Study input value should be a boolean"),e},int:()=>{const e=this._inputCallback(this._inputIndex++);return(0,n.assert)("number"==typeof e,"Study input value should be a number"),e},source:()=>{const e=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:()=>{const e=this._inputCallback(this._inputIndex++);return(0,n.assert)("string"==typeof e,"Study input value should be a string"),e},symbol:()=>{ +const e=this._inputCallback(this._inputIndex++);return(0,n.assert)("string"==typeof e,"Study input value should be a symbol string"),e}},this.request={security:(e,t)=>{const i=this._symbolIndexByTickerId.get(e);this._addedTickerIds.has(e)||this._ctx.new_sym(e,Py.Std.period(this._ctx)),(0,n.assert)(void 0!==i,`Unknown tickerId ${e}`);const s=this._ctx.new_unlimited_var(Py.Std.time(this._ctx));this._ctx.select_sym(i);const o=this._ctx.new_unlimited_var(Py.Std.time(this._ctx)),r=t?.expression?.()??this.close();return this._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)=>{const i=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)=>{const i=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)=>{let i;if((0,Pv.isEncodedExtendedSymbol)(e))i=e;else{const s={symbol:e,session:t};i=(0,Pv.encodeExtendedSymbolOrGetSimpleSymbolString)(s)}return this._symbolIndexByTickerId.has(i)||this._symbolIndexByTickerId.set(i,++this._symbolIndex),i}},this.timeframe={change:e=>{if(isNaN(Py.Std.time(this._ctx)))return!1;const t=(0,Td.newBarBuilder)(e,this._ctx.symbol.session,null);t.moveTo(Py.Std.time(this._ctx));return 0===t.startOfBar(0)-Py.Std.time(this._ctx)},isDWM:()=>this._ctx.symbol.isdwm()},this._addedTickerIds=new Set,this._symbolIndexByTickerId=new Map,this._returnValues=[],this._ctx=e,this._inputCallback=t,this._inputIndex=0,this._symbolIndex=0}open(){return this._ctx.new_var(Py.Std.open(this._ctx))}high(){return this._ctx.new_var(Py.Std.high(this._ctx))}low(){return this._ctx.new_var(Py.Std.low(this._ctx))}close(){return this._ctx.new_var(Py.Std.close(this._ctx))}volume(){return this._ctx.new_var(Py.Std.volume(this._ctx))}year(){return Py.Std.year(this._ctx)}na(e){return!!Py.Std.na(e)}series(e){return this._ctx.new_var(e)}fill(e,t,i){}hline(e,t){return{id:""}}indicator(e){}plot(e,t){const i="number"==typeof e?e:e.get(0),s=void 0===t?.offset?i:{offset:t.offset,value:i};return this._returnValues.push(s),{id:""}}getReturnValues(){return this._returnValues}setMinimumAdditionalDepth(e){this._ctx.setMinimumAdditionalDepth(e)}}var Mv=i(18330);const Iv=e=>{switch(e){case"data_window":return Ts.InputDisplayFlags.DataWindow;case"none":return Ts.InputDisplayFlags.None;default:return Ts.InputDisplayFlags.All}},Av=e=>{ +switch(e){case"data_window":return 2;case"none":return 0;default:return 15}};class Lv{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"}),new Tv),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:new Tv,min:e=>(0,Hd.isNumber)(e)?0:new Tv,negative:e=>(0,Hd.isNumber)(e)?0:new Tv},this.ta={change:e=>new Tv,correlation:(e,t,i)=>new Tv,cum:e=>new Tv,ema:()=>new Tv,rma:()=>new Tv,sma:()=>new Tv,vwap:()=>[new Tv,new Tv,new Tv],wma:()=>new Tv},this.request={security:e=>(this._tickers.push(e),new Tv)},this.runtime={error:e=>{throw new Error(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(){return this._title}getStudyMetainfo(){var e,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(){return this._tickers}open(){return new Tv}high(){return new Tv}low(){return new Tv}close(){return new Tv}volume(){return new Tv}year(){return 0}na(e){return!1}series(e){return new Tv}fill(e,t,i){const s=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}`);const c=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}),void 0===this._defaults.filledAreasStyle&&(this._defaults.filledAreasStyle={}),this._defaults.filledAreasStyle[s]=(e=>{if((e=>void 0===e?.color)(e))return{bottomColor:e?.bottomColor,fillType:"gradient",topColor:e?.topColor,visible:"all"===e?.display};return{fillType:void 0, +color:e?.color??"TODO",visible:"all"===e?.display}})(i)}hline(e,t){const i=this._getNextBandId();this._bands.push({id:i,isHidden:!1,name:t?.title??"Level"}),void 0===this._defaults.bands&&(this._defaults.bands=[]);const s={color:t?.color??"#808080",linestyle:t?.linestyle??wv.hline.style_dashed,linewidth:t?.linewidth??1,value:e,visible:"none"!==t?.display,name:""};return this._defaults.bands.push(s),{id:i}}indicator(e){void 0!==e.title&&(this._title=e.title),void 0!==e.shortTitle&&(this._shortTitle=e.shortTitle),void 0!==e.format&&(this._format={type:e.format,precision:e.precision}),void 0!==e.version&&(this._version=e.version),this._overlay=!!e.overlay}plot(e,t){const i=this._getNextPlotId();return this._plots.push({type:t?.style??"line",id:i}),void 0===this._defaults.styles&&(this._defaults.styles={}),this._defaults.styles[i]=(e=>{switch(e?.style){case void 0:case"line":return{color:e?.color??"#0496FF",display:Av(e?.display),linestyle:Mv.LineStyle.Solid,linewidth:e?.linewidth??1,plottype:jd.LineStudyPlotStyle.Line,trackPrice:!1,transparency:0};default:throw new Error("")}})(t),this._styles[i]={isHidden:!1,joinPoints:!1,title:t?.title??"Plot"},{id:i}}setMinimumAdditionalDepth(e){}_input(e){this._inputs.push(e),void 0===this._defaults.inputs&&(this._defaults.inputs={}),this._defaults.inputs[e.id]=(0,n.ensureDefined)(e.defval,"study input default value")}_getNextInputId(){return`in_${this._inputs.length}`}_getNextPlotId(){return`plot_${this._plots.length}`}_getNextBandId(){return`hline_${this._bands.length}`}_getNextFillId(){return`fill_${this._filledAreas.length}`}}var kv=i(4659);class Ev{build(e){const t=new Lv;return e(t),{name:t.getStudyName(),metainfo:t.getStudyMetainfo(),constructor:class{main(t,i,s){try{const s=new xv(t,i);e(s);const o=s.getReturnValues();return 0===o.length?null:o}catch(e){Py.Std.error(this._getErrorMessage(e))}}_getErrorMessage(e){if(e instanceof kv.StudyError)throw e;return(e instanceof Error?e.message:null==e?"Unknown error":e.toString()).replace(/:/g,"")}}}}}const Dv={palettes:{},inputs:[],plots:[{id:"open",type:"line"},{id:"high",type:"line"},{id:"low",type:"line"},{id:"close",type:"line"},{id:"volume",type:"line"}],graphics:{},_metainfoVersion:48,description:"Unnamed Study",format:{type:"inherit"},is_hidden_study:!0,is_price_study:!1,shortDescription:"Unnamed Study",description_localized:"Unnamed Study",id:"BarSetHeikenAshi@tv-prostudies",shortId:"BarSetHeikenAshi",packageId:"tv-basicstudies",version:13,fullId:"BarSetHeikenAshi@tv-basicstudies-13",productId:"tv-basicstudies",name:"BarSetHeikenAshi@tv-basicstudies",defaults:{},linkedToSeries:!1};class Bv{constructor(){this._metainfoCache=[]}studiesMetadata(){return 0===this._metainfoCache.length&&(this._metainfoCache=(0,r.getChartingLibraryGlobalContext)().JSServer.studyLibrary.map((e=>new ns.StudyMetaInfo(e.metainfo))),this._metainfoCache.push(new ns.StudyMetaInfo(Dv))),this._metainfoCache}}var Vv=i(78966),Rv=i.n(Vv);class Nv{createMarketStatusWatcher(e,t,i,s){return new(Rv())(e,t,i,s)}}class Ov{constructor(e){this._studyLibrary=e} +findStudyObject(e){e.endsWith("!")&&(e=e.slice(0,-1));const t=e.split("@")[0],i=this._studyLibrary.filter((i=>i.metainfo.id===e||i.metainfo.shortDescription===t));if(0===i.length)return null;return i[0]}}var Fv,Wv=i(63193),Hv=i(56052),zv=i(82433),Uv=i(47132),jv=i(16329);class Gv{constructor(e,t){this.info=e,this.bars=t||[],this.isBarClosed=!0,this.firstLoadedTimeMs=0!==this.bars.length?this.bars[0].time:1/0,this._emptyBarCount=0,this._lastBarIsEmpty=!1}symbolinfo(){return this.info}isLastBarClosed(){return this.isBarClosed}setLastBarClosed(e){this.isBarClosed=e}bar(e){const t=this.bars[e];if(void 0===t)throw new Error(`BarSet has no value at index ${e}`);return t}count(){return this.bars.length}emptyBarCount(){return this._emptyBarCount}add(e,t,i){void 0===i&&(i=!1);const s=e,o=this.bars,n=o.length,r=s.time,a=0===n?NaN:o[n-1].time;0===n||a{this._destroyed||this._processPendingSubscribers()}),0),s}removeSubscription(e){const t=this._pendingSubscribers.find((t=>t.key===e));if(t)return void this._pendingSubscribers.splice(this._pendingSubscribers.indexOf(t),1) +;const i=this._subscribers.find((t=>t.key===e));if(i)return this._subscribers.splice(this._subscribers.indexOf(i),1),void(this._subscribers.length||(this._resetCacheTimeout=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();const e=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(){const e=this._symbolInfo.currency_code,t=this._symbolInfo.unit_id;return`${(new Date).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(){void 0!==this._symbolInfo.expiration_date&&(this._nextTime=1e3*this._symbolInfo.expiration_date,this._leftDate=1e3*(this._symbolInfo.expiration_date+1))}_dealignTime(e){return null===this._dwmAligner?e:this._dwmAligner.timeToExchangeTradingDay(e)}_normalizeRange(e){const t=void 0!==e.to?e.to:this._dealignTime(this._now());if(0===this._cache.bars.length||void 0!==e.to&&t<=(0,n.ensureNotNull)(this._leftDate))return{countBack:e.countBack,to:t};const i=null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(t):t,s=(0,Pt.lowerbound)(this._cache.bars,i,((e,t)=>e.time{e.onErrorCallback(t)}))}let t=this._normalizeRange(e[0].range);for(const i of e.map((e=>this._normalizeRange(e.range))))(i.tot.countBack)&&(t=i);this._logMessage(`Leftmost subscriber requires ${t.countBack} bars prior ${$v(t.to)}`);!(null===this._leftDate||t.to{const t=this._moveSubscriberToRealtime(e) +;this._returnHistoryDataToSubscriber(e,t)})),this._subscribeRealtimeIfNeeded()):this._ensureRequestedTo(t)}_moveSubscriberToRealtime(e){const t={key:e.key,onHistoryCallback:e.onHistoryCallback,barset:null};return this._subscribers.push(t),t}_isSymbolExpired(){return this._symbolInfo.expired||void 0!==this._symbolInfo.expiration_date}_subscribeRealtimeIfNeeded(){!this._subscribers.length||this._realtimeOn||this._isSymbolExpired()||this._subscribeRealtime()}_subscribeRealtime(){if(this._symbolInfo.expired||this._realtimeOn)return;this._realtimeOn=!0,this._datafeed.subscribeBars(this._symbolInfo,this._resolution,(e=>{null!==this._dwmAligner&&(e.time=this._dwmAligner.timeToSessionStart(e.time)),this._putToCacheNewBar(e),this._subscribers.forEach((t=>{const i=t.barset;if(null===i)throw new Error("subscriber.barset is null");i.add(e),t.onHistoryCallback(i)}))}),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){const i=this._normalizeRange(e.range),s=this._createBarsetForRange(i);s.count()>0?this._logMessage("Bars to return for request {0}: total {1} bars in [{2} ... {3}] ".format(e.key,s.count(),$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){const t=null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(e.to):e.to,i=(0,Pt.lowerbound)(this._cache.bars,t,((e,t)=>e.time{if(!this._destroyed)if(r)this._logMessage("getBars callback is already called before",!0);else{if(r=!0,e.length>0){const t=` [${$v(e[0].time)} ... ${$v(e[e.length-1].time)}]`;this._logMessage(`Receiving bars: total ${e.length} bars in ${t}, requested range: ${n}`)}else this._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(){return this._nextSubscriptionId++}_checkBars(e,t=!1){if(l.enabled("charting_library_debug_mode"))for(let i=1;i"number"!=typeof e[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)return this._logMessage("Time range of received data is the same as cached one. Skip the update."),!0;if(0!==this._cache.bars.length&&e[e.length-1].time===this._cache.bars[0].time&&this._cache.bars.splice(0,1),0!==this._cache.bars.length&&e[e.length-1].time>=this._cache.bars[0].time){const t=this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time;if(this._cache.bars=[],!t)return this._leftDate=null,!1;this._logMessage("Received history up to now instead of incremental update. Return exactly what is requested.")}return this._cache.bars=[...e,...this._cache.bars],this._checkBars(this._cache.bars,!0),!0}_putToCacheNewBar(e){const t=this._cache.bars.length,i=e.time,s=0===t?NaN:this._cache.bars[t-1].time;0===t||st.destroy())),this._threads={},delete this._datafeed}purgeCache(){this._forEachThread(((e,t)=>t.destroy())),this._threads={}}resetCache(){this._forEachThread(((e,t)=>t.resetCache()))}subscribe(e,t,i,s,o){const n=qv(e,t);this._threads[n]||(this._threads[n]=this._createThread(e,t));return n+'"'+this._threads[n].addSubscription(i,s,o)}unsubscribe(e){const t=e.split('"');if(2!==t.length)return void this._logWarning("Wrong guid format");const i=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){return new Kv(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(`${(new Date).toISOString()} FEED: ${e}`)}}class Zv{constructor(){this._listeners=[]}listenersCount(){return this._listeners.reduce(((e,t)=>e+(t?1:0)),0)}addListener(e,t){this._listeners.push({dataListener:e,onErrorCallback:t}),this._barset&&e(this._barset),this._errorMsg&&t(this._errorMsg)}removeListener(e){ +const t=this._listeners.filter((t=>t&&t.dataListener===e));if(0===t.length)return;const i=this._listeners.indexOf(t[0]);delete this._listeners[i]}onError(e){this._errorMsg=e||"unspecified error";const t=this._listeners,i=t.length;for(let s=0;se.id===Xv.SubsessionId.Regular)),i=e.subsessions.find((e=>e.id===Xv.SubsessionId.PreMarket)),s=e.subsessions.find((e=>e.id===Xv.SubsessionId.PostMarket));void 0!==t&&(this.regularSubsession=new jv.SessionsSpec(e.timezone,t.session,e.session_holidays,t["session-correction"])),void 0!==i&&(this.preMarketSubsession=new jv.SessionsSpec(e.timezone,i.session,e.session_holidays,i["session-correction"])),void 0!==s&&(this.postMarketSubsession=new jv.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(){const e=this.time;if(!this.isdwm()||isNaN(e))return e;const t=(0, +n.ensureDefined)(this.timezone,"symbol instrument timezone");let i=(0,Ce.utc_to_cal)(t,e);return i=this.session.spec.correctTradingDay(i),(0,Ce.cal_to_utc)(t,i)}lastbar(e,t){if(isNaN(e.time))return;let i=e.time;if(this.dwm_aligner){const e=(0,Ce.get_cal_from_unix_timestamp_ms)(this.dwm_aligner.sessionSrc().timezone,i);!this._shouldAlignDwmBarsToMainSeries||this.dwm_aligner.sessionTgt().spec.includesDay(e)?(this.dwm_aligner.moveTo(i),i=this.dwm_aligner.startOfBar(0)):this._canExtendTimeScale&&this.utcTimezone&&((0,Ce.set_hms)(e,0,0,0,0,this.utcTimezone),i=(0,Ce.cal_to_utc)(this.utcTimezone,e))}const s=this.time!==i;s&&this.index>=0&&!this.isBarClosed&&(this.isNewBar=!1,this.isBarClosed=!0,this.script.calc(this)),this.time=i,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=s,this.isBarClosed=!!e.isBarClosed,this.isLastBar=!!e.isLastBar,this.projectionTime=e.projectionTime||NaN,this.isBarUpdate=!!t,this.isNewBar&&(this.index++,this.isFirstBar=0===this.index),this.script.calc(this)}}class Qv{constructor(e){this.mindepth=0,this.original=NaN,this.modified=!1,this._hist=null,this._histPos=0,this.symbol=e}valueOf(){return this.get(0)}get(e=0){return isNaN(e)&&(e=0),e=e||0,this._hist?e>=this._hist.length?(console.error("not enough depth: "+this),NaN):this._get(e):(this.mindepth=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){let e=Py.Std.na(this.mindepth)?Py.Std.max_series_default_size:Py.Std.max(this.mindepth+1,1);e=Math.round(e);const t=new Array(e);for(let i=0;i{const i=t.indexOf(e.get());return-1===i?0:i})():0,o=t.get(s);let n=e.indexOf(o);if(0!==i){const i=t.get(s+1);if(!Py.Std.na(i)){n=n===e.indexOf(i)?-1:n}}return n<0?NaN:this._get(n)}indexOf(e){if(!this._hist)return this.mindepth=NaN,-1;if(Py.Std.na(e))return-1;const t=this._hist.length,i=this.symbol.index+1,s=Math.min(t,i),o=(0,Pt.upperbound_int)(this._hist,e,0,s);return 0===o?-1:s-o}_get(e){if(null===this._hist)return NaN;let t=this._histPos-e;return t<0&&(t+=this._hist.length),this._hist[t]}}class eS extends Qv{add_hist(){if(this._hist||(this._hist=new Float64Array(2e3),this._histPos=-1),this._histPos=this._histPos+1,this._histPos===this._hist.length){const e=new Float64Array(2*this._hist.length);e.set(this._hist),this._hist=e}this._hist[this._histPos]=this.original}}class tS{constructor(e){ +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){return this.symbol.script.add_sym(e,t,i,s,o,void 0)}select_sym(e){const t=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){return void 0!==e&&e===this.symbol.script.get_sym(0)}new_var(e){const t=this._vars;t.length<=this._varsIndex&&t.push(new Qv(this.symbol));const i=t[this._varsIndex++];return arguments.length>0&&void 0!==e&&i.set(e),i}new_unlimited_var(e){const t=this._vars;t.length<=this._varsIndex&&t.push(new eS(this.symbol));const i=t[this._varsIndex++];return arguments.length>0&&i.set(e),i}new_ctx(){return this._ctx.length<=this._ctxIndex&&this._ctx.push(new tS(this.symbol)),this._ctx[this._ctxIndex++]}prepare(e){this._ctxIndex=0,this._varsIndex=0;for(let t=0;te&&(e=i)}return e}stop(){this.symbol=null,this._vars=null}setMinimumAdditionalDepth(e){this.minimumAdditionalDepth=e}setTargetAnchor(e){this.targetAnchor=e}}function iS(e){return!Array.isArray(e)&&"composite"!==e.type&&"non_series_bars"!==e.type&&!!e.nonseries}class sS{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=new tS(this.add_sym(e,t,i,s,h,c)),this.init()}calc(e){const t=this._ctx,i=this._body;t.prepare(e);const s=i.main(t,this._inputCallback,e);var o;if(null!=s)if(null===(o=s)||Array.isArray(o)||"composite"!==o.type)this._processResult(s);else for(let e=0;e1&&this._runner.host.enableDwmAligning&&r.enable_dwm_aligning(this._symbols[0].session,r.session),r}maxAdditionalDepth(){return this._symbols[0].isAdditionalDepthAllowed?this._ctx.maxAdditionalDepth():0}targetAnchor(){return this._ctx.targetAnchor}stop(){this._symbols=null,this._ctx?.stop(),this._ctx=null}get_sym(e){return this._symbols[e]}_processResult(e){const t=this._ctx;var i;this._out&&e&&(!isNaN(t.symbol.time)||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)})))}}class oS{constructor(e){this._nonseriesUpdate=null,this._script=null,this._symbols=[],this._barsets=[],this._subscription=[],this.host=e,this._isRecalculated=!1,this.isStarted=!1, +this.start()}add_sym(e,t,i,s,o,n,r){const a=new Jv(e,t,i,s,o,r,n);return this._symbols.push(a),a}get_sym(e){return this._symbols[e]}out(e,t){if(this._nonseriesUpdate){const i=Object.assign({},this._nonseriesUpdate);t.splice(0,0,e.time),i.lastBar=t,this.host.nonseriesOut(e,i)}else this.host.out(e,t)}start(){this.isStarted=!0;const e=this.host,t=new sS(e.tickerid,e.period,e.currencyCode,e.unitId,this,e.body,this.out.bind(this),e.input,e.nonseriesOut,e.symbolInfo,e.subsessionId);this._script=t;const i=[],s=this._symbols;let o=null;const r=this._script.targetAnchor();let a=0;if(null!==r&&"number"==typeof e.dataRange.to){const t=(0,Ce.get_timezone)(e.symbolInfo.timezone);if(!t)return;const i=(0,Ce.utc_to_cal)(t,e.dataRange.to);if("Week"===r){const e=(i.getDay()+6)%7;i.setDate(i.getDate()-e)}else if("Month"===r)i.setDate(1);else if("Quarter"===r){const e=3*Math.floor(i.getMonth()/3);i.setMonth(e),i.setDate(1)}else if("Year"===r)i.setMonth(0),i.setDate(1);else if("Decade"===r){const e=10*Math.floor(i.getFullYear()/10);i.setFullYear(e),i.setMonth(0),i.setDate(1)}else if("Session"===r){const t=Cd.SessionInfo.create(e.symbolInfo.timezone,e.symbolInfo.session,e.symbolInfo.session_holidays,e.symbolInfo.corrections);o=(0,Td.alignExchangeTimeToSessionStartAndReturnUTC)(t.spec,i)}if("Session"!==r&&(i.setHours(0,0,0,0),o=(0,Ce.cal_to_utc)(t,i)),null!==o){const t=e.symbolInfo,i=Re.Interval.parse(e.period);a=(0,Td.getPeriodsBetweenDates)(t.session,t.session_holidays,t.corrections,i.letter(),i.multiplier(),o,e.dataRange.to),e.dataRange.from=o}}const l=Object.assign({},e.dataRange,{countBack:Math.max((e.dataRange.countBack??0)+this._script.maxAdditionalDepth(),a)}),c=s[0],h=(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))},d=(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)},u=()=>l;h(c,u,(e=>{!e.nonseries&&Number.isFinite(e.firstLoadedTimeMs)&&(e=>{function i(i,s){let r=(0,Jd.createTimeToBarTimeAligner)(i,s)(e);const a=(0,Jd.createDwmAligner)(i,s);null!==a&&(r=a.timeToExchangeTradingDay(r));let l=0;if(null!==o){const e=Re.Interval.parse(i);l=(0,Td.getPeriodsBetweenDates)(s.session,s.session_holidays,s.corrections,e.letter(),e.multiplier(),o,r)}return{to:o??r,countBack:Math.max((0,n.ensureNotNull)(t,"script runner script").maxAdditionalDepth(),Math.ceil(1.05*l))}}for(let e=1;e=0;t--){const i=e[t],s=this._barsets[t],o=s.count();for(let e=0;ee.endOfData));t&&this.host.setNoMoreData(),this.host.recalc(this,{endOfData:t,firstLoadedTimeMs:this._barsets[0].firstLoadedTimeMs,emptyBarCount:this._barsets[0].emptyBarCount()})}catch(e){if(!(e instanceof kv.StudyError))throw e;this.host.onErrorCallback(e.message,e.title)}}}class nS{constructor(e){this.runner=new oS(e)}stop(){this.runner.stop()}isStarted(){return this.runner.isStarted}}class rS{constructor(e,t,i,s,o,n,r,a,l,c,h){this.listeners=t,this._isRecalculated=!1,this._symbolInfo=a,this.engine=new nS({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:()=>{throw new Error("BarBuildItem scripts should not need to access any input values")},recalc:(e,t)=>{this._recalc(t)},out:(e,t)=>{this._out(e,t)},nonseriesOut:(e,t)=>{this._nonseriesOut(e,t)},setNoMoreData:()=>{this._barset&&(this._barset.endOfData=!0)},onErrorCallback:e=>{this.listeners.onError(e)}})}stop(){this.engine?this.engine.stop():console.error("Internal library error 0x1")}_recalc(e){this._isRecalculated&&console.error("recalc called twice!"),this._barset||(this._barset=new Gv(this._symbolInfo)),e&&(this._barset.firstLoadedTimeMs=e.firstLoadedTimeMs,this._barset.endOfData=e.endOfData),this.listeners.fire(this._barset),this._isRecalculated=!0}_nonseriesOut(e,t){const i=Object.assign({},t);i.nonseries=!0,i.data=t.bars,delete i.bars,i.barsetSize=this._barset?this._barset.count():0,i.lastBar=this._barset&&this._barset.count()>0?this._barset.bar(this._barset.count()-1):null,this.listeners.fire(i,!0)}_out(e,t){const i=t[0];if(isNaN(i))return;const s={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=new Gv((0,n.ensureDefined)(e.info,"bar builder item output symbol info")));const r=t[8],a=t[9];if(r instanceof Array&&a)for(let e=0;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)}}var hS=i(99955);class dS{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):void 0,e.setMinimumAdditionalDepth(0)}main(e){const t=(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):void 0,P=e.new_var(Py.Std.close(e)).get(1),x=T instanceof Array?P:NaN;return c.set(f),h.set(y),d.set(v),u.set(b),[s,f,y,v,S,b,w,C,T,x]}_extrapolate(e,t){return isNaN(e)||isNaN(t)?void 0:(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);class pS{constructor(e){this._host=e,this._cache={}}subscribe(e,t,i,s,o,n,r,a,l,c,h){const d=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){const t=this._getCache(e.key);t&&t.listeners.removeListener(e.listener)}removeUnused(){const e=[],t=e=>!!this._cache[e];for(const i in this._cache)if(t(i)){0===(0,n.ensureNotNull)(this._cache[i],`datafeed cache item ${i}`).listeners.listenersCount()&&e.push(i)}if(0!==e.length){for(let t=0;t{const s=mS(e,t,i),o=t(s);return void 0!==o?o:s}))}(e,t,i):(0,tt.isObject)(e)&&((0,tt.isHashObject)(e)||i&&i.visitInstances)?function(e,t,i){const s={};return Object.keys(e).forEach((o=>{const n=mS(e[o],t,i),r=t(n);s[o]=void 0!==r?r:n})),s}(e,t,i):e}function gS(e,t,i){const s=mS(e,t,i),o=t(s);return void 0!==o?o:s}var fS,yS=i(92211);function vS(e,t){return e.length>t}!function(e){e[e.DefaultExtrapolateLimit=2e5]="DefaultExtrapolateLimit",e[e.ExtendedExtrapolateLimit=45e4]="ExtendedExtrapolateLimit"}(fS||(fS={}));class SS{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=new Cd.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),this._barBuilder=(0,Td.newBarBuilder)(t,this._session,null)}destroy(){this.clear()}interval(){return this._interval}barBuilder(){return this._barBuilder}symbolInfo(){return this._symbolInfo}clear(){this._firstRealBarTimeMs=null,this._historyBarsCache=[],this._barsTimes=[],this._lastRealBarTimeMs=null,this._futureBarsCache=[],this._minFutureBarsCount=0,this._projectionFirstIndex=1/0}firstFutureBarIndex(){return this._barsTimes.length} +futureBars(){return this._futureBarsCache}replaceBarsTimesTail(e,t=e.length){if(0===e.length)return;if(0===this._barsTimes.length)return void this.setBarsTimes(e,t);const i=e[0],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){const i=this._barsTimes;if(this._barsTimes=e.slice(),this._projectionFirstIndex=0===this._barsTimes.length?1/0:t,0===e.length)return this._historyBarsCache=[],this._futureBarsCache=[],this._firstRealBarTimeMs=null,void(this._lastRealBarTimeMs=null);0!==i.length&&i[i.length-1]===e[e.length-1]||this._setLastRealBarTime(e[e.length-1]),0!==i.length&&i[0]===e[0]||(this._historyBarsCache=[],this._firstRealBarTimeMs=e[0])}extrapolateTimeWithOffsetToTime(e,t){if(0===t)return{timeMs:e,exact:!0};0===this._barsTimes.length&&(t<0?null===this._firstRealBarTimeMs?this._firstRealBarTimeMs=e:(this._extendHistoryCacheToTimeFromRight(Math.min(e,null!==this._lastRealBarTimeMs?this._lastRealBarTimeMs:1/0)),this._ensureExtrapolatedToHistoryTime(e)):null===this._lastRealBarTimeMs?this._lastRealBarTimeMs=e:(this._extendFutureCacheToTimeFromLeft(Math.max(e,null!==this._firstRealBarTimeMs?this._firstRealBarTimeMs:1/0)),this.ensureExtrapolatedToFutureTime(e)));const i=this.indexOfTime(e);if(null===i)return null;const s=this.timeOfBarIndex(i.index+t,0);return null===s?null:((i.index<0||this._projectionFirstIndex<=i.index)&&(s.exact=!1),s)}indexOfTime(e){if(null!==this._firstRealBarTimeMs&&ethis._lastRealBarTimeMs){this.ensureExtrapolatedToFutureTime(e);let t=(0,Pt.lowerbound_int)(this._futureBarsCache,e);if(0!==this._futureBarsCache.length&&t===this._futureBarsCache.length&&e>this._futureBarsCache[this._futureBarsCache.length-1])return null;this._futureBarsCache[t]!==e&&(t-=1);const i=Math.max(1,this._barsTimes.length)+t;return{index:i,timeMs:i===this._barsTimes.length-1?(0,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){const e=this.timeOfBarIndex(0,0);return null===e?null:{index:0,timeMs:e.timeMs}}return null}let t=(0,Pt.lowerbound_int)(this._barsTimes,e);return this._barsTimes[t]!==e&&(t-=1),{index:t,timeMs:this._barsTimes[t]}}setMinFutureBarsCount(e){ +this._minFutureBarsCount=e,0!==this._barsTimes.length&&this._ensureExtrapolatedToFutureBar(e)}ensureExtrapolatedToFutureTime(e){null!==this._lastRealBarTimeMs&&this._lastRealBarTimeMs>=e||vS(this._futureBarsCache,this._extrapolateLimit)||0!==this._futureBarsCache.length&&this._futureBarsCache[this._futureBarsCache.length-1]>=e||(l.enabled("disable_resolution_rebuild")&&(this._interval.isDays()||this._interval.isWeeks())&&this._barsTimes.length>=2?this._extendFutureCacheFromRight(((t,i)=>{const s=this._futureBarsCache.length>0?this._futureBarsCache[this._futureBarsCache.length-1]:t;return this._calculateBarPattern(s,e,null)})):this._extendFutureCacheFromRight(((t,i)=>(0,hS.extrapolateBarsFrontToTime)(this._barBuilder,t,e,this._extrapolateLimit,!0).times)),this._futureBarsCache[this._futureBarsCache.length-1]=this._barsTimes.length){const t=e-Math.max(1,this._barsTimes.length);return this._ensureExtrapolatedToFutureBar(t+1),t>=this._futureBarsCache.length?null:{timeMs:this._futureBarsCache[t],exact:!1}}return{timeMs:this._barsTimes[e],exact:ethis._extrapolateLimit)break;c++}return r}_extendFutureCacheFromRight(e){const t=0!==this._futureBarsCache.length?this._futureBarsCache[this._futureBarsCache.length-1]:this._lastRealBarTimeMs;if(null===t)return!1;const i=e(t,this._futureBarsCache.length)||[];return 0!==i.length&&(this._futureBarsCache=this._futureBarsCache.concat(i),!0)}_extendHistoryCacheFromLeft(e){ +const t=0!==this._historyBarsCache.length?this._historyBarsCache[0]:this._firstRealBarTimeMs;if(null===t)return;const i=e(t,this._historyBarsCache.length);this._historyBarsCache=i.concat(this._historyBarsCache)}_extendFutureCacheToTimeFromLeft(e){if(null!==this._lastRealBarTimeMs&&this._lastRealBarTimeMs<=e)return;if((0,n.assert)(0===this._barsTimes.length||e===this._barsTimes[this._barsTimes.length-1],"invalid argument"),this._lastRealBarTimeMs=e,0===this._futureBarsCache.length)return;const t=(0,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;const t=(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)=>{const s=this._futureBarsCache.length>0?this._futureBarsCache[this._futureBarsCache.length-1]:t,o=e-i;return this._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)=>{const s=(0,hS.extrapolateBarsFrontToTime)(this._barBuilder,t-1,e-1,this._extrapolateLimit,!0).times;return s[s.length-1]===t?s.slice(0,-1):s})),(0===this._historyBarsCache.length||this._historyBarsCache[0]>e)&&this._ensureExtrapolatedToHistoryBar(this._historyBarsCache.length+1))}}function bS(e){return 60*e*60*1e3}function wS(e){return 60*e*1e3}const CS=[{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}];var TS,PS;function xS(e,t){if(null!==t){if(e.getUTCFullYear()!==t.getUTCFullYear())return 70;if(e.getUTCMonth()!==t.getUTCMonth())return 60;if(e.getUTCDate()!==t.getUTCDate())return 50;const i=t.getTime(),s=e.getTime() +;for(let e=CS.length-1;e>=0;--e)if(Math.floor(i/CS[e].divisor)!==Math.floor(s/CS[e].divisor))return CS[e].weight}return 18}function MS(e,t,i=0){if(0===e.length)return[];let s=i,o=i;const n=[];for(;s=t.length?(n.push({old:s,new:Fh.INVALID_TIME_POINT_INDEX}),s++):e[s].timeMs===t[o].timeMs?(s!==o&&n.push({old:s,new:o}),s++,o++):e[s].timeMs{if(e.new===t.new&&e.new===Fh.INVALID_TIME_POINT_INDEX)return e.old-t.old;if(e.new===Fh.INVALID_TIME_POINT_INDEX)return-1;if(t.new===Fh.INVALID_TIME_POINT_INDEX)return 1;const i=e.old-e.new,s=t.old-t.new;return i>0?s>0?e.old-t.old:-1:s<0?t.new-e.new:1}))}function IS(e,t){return{span:e.markWeight,time:e.displayTime,index:t}}!function(e){e[e.FutureTickMarksLimit=1e3]="FutureTickMarksLimit"}(PS||(PS={}));class AS{constructor(){this._completed=!0,this._mainSymbolExtrapolator=null,this._pointDataByTimePoint=new Map,this._instanceIds=new Set,this._displayTimezone=null,this._minFutureBarsCount=0,this._sortedTimePoints=[],this._needRebuildEndOfPeriod=l.enabled("end_of_period_timescale_marks"),this._shouldAlignDwmBarsToMainSeries=l.enabled("align_dwm_bars_to_main_series")}destroy(){this.clearTimeScale()}setCompleted(e){this._completed=e}isCompleted(){return this._completed}clearTimeScale(){return this._pointDataByTimePoint.clear(),this._instanceIds.clear(),this._sortedTimePoints=[],{baseIndex:null,pointsIndex:0,indexChange:[],marks:[],points:[],clearTickMarks:!0}}indexOfTime(e){if(0===this._sortedTimePoints.length)return null===this._mainSymbolExtrapolator?null:this._mainSymbolExtrapolator.indexOfTime(e);if(ethis._sortedTimePoints[this._sortedTimePoints.length-1].timeMs){if(null===this._mainSymbolExtrapolator)return null;const t=this._mainSymbolExtrapolator.indexOfTime(e),i=this._mainSymbolExtrapolator.indexOfTime(this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs);if(null===t||null===i)return null;const s=t.index-i.index-1;return{index:this._sortedTimePoints.length+s,timeMs:t.timeMs}}let t=(0,Pt.lowerbound)(this._sortedTimePoints,e,((e,t)=>e.timeMs({timeMs:e,markWeight:0,displayTime:NaN})));this._fillPointsData(i,0,0!==this._sortedTimePoints.length?this._sortedTimePoints[this._sortedTimePoints.length-1].displayTime:null);const s=[];for(let t=e;tIS(e,i+t)));return s.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;let t=-1,i=(0,Pt.lowerbound)(this._sortedTimePoints,Math.round(1e3*e[0].value[0]),((e,t)=>e.timeMse.timeMs{for(;s=this._sortedTimePoints.length){const t=this.indexOfTime(e);if(null===t)return Fh.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(){return 0===this._sortedTimePoints.length?null:this._sortedTimePoints[0].timeMs}replaceStudyBarsTimesTail(e,t){return this._replaceInstanceBarsTimesTail(e,t)}replaceBarsTimesTail(e,t){return this._replaceInstanceBarsTimesTail(e,t)}setSeriesBarsTimes(e,t){return this._setBarsTimes(e,t)}setStudyBarsTimes(e,t,i){return this._setBarsTimes(e,t,i)}_setBarsTimes(e,t,i){const s=0!==this._pointDataByTimePoint.size;if(this._instanceIds.has(e))for(const t of this._sortedTimePoints)t.pointData.instances.delete(e);0===t.length?this._instanceIds.delete(e):this._instanceIds.add(e),this._addBarsTimesToInstance(e,t,!1),s&&this._cleanupPointsData(this._sortedTimePoints);const o=[];this._pointDataByTimePoint.forEach(((e,t)=>{o.push({markWeight:0,timeMs:t,displayTime:NaN,pointData:e})})),o.sort(((e,t)=>e.timeMs-t.timeMs));const n=this._updateTimeScalePoints(o);return this._applyTimeScaleChanges(n,i||!1)}_replaceInstanceBarsTimesTail(e,t){if(0===t.length)return null;if(!this._instanceIds.has(e))return this._setBarsTimes(e,t);const i=[],s=(0,Pt.lowerbound)(this._sortedTimePoints,t[0],((e,t)=>e.timeMs({timeMs:e.timeMs,pointData:e.pointData,markWeight:0,displayTime:NaN})));for(let e=s;ee.timeMs-t.timeMs));const r=this._updateTimeScalePointsTail(n);return this._applyTimeScaleChanges(r,!1)}_updateFutureBars(){if(0===this._minFutureBarsCount||null===this._mainSymbolExtrapolator)return;if(0!==this._sortedTimePoints.length){const e=this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs;this._mainSymbolExtrapolator.ensureExtrapolatedToFutureTime(e)}const e=this._futureBarsFirstPointIndex();this._mainSymbolExtrapolator.setMinFutureBarsCount(e+this._minFutureBarsCount)}_addBarsTimesToInstance(e,t,i){const s=i?[]:null;for(const i of t){const t=this._pointDataByTimePoint.get(i);if(void 0===t){const t=new Set;t.add(e);const o={index:0,instances:t};this._pointDataByTimePoint.set(i,o),null!==s&&s.push({timeMs:i,pointData:o})}else t.instances.add(e)}return s}_futureBarsFirstPointIndex(){if(null===this._mainSymbolExtrapolator||0===this._sortedTimePoints.length)return 0;const e=this._mainSymbolExtrapolator.futureBars();return(0,Pt.upperbound_int)(e,this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs)}_futureBars(){return null===this._mainSymbolExtrapolator?[]:this._mainSymbolExtrapolator.futureBars().slice(this._futureBarsFirstPointIndex(),this._futureBarsFirstPointIndex()+1e3)}_cleanupPointsData(e){for(const t of e)0===t.pointData.instances.size&&this._pointDataByTimePoint.delete(t.timeMs)}_updateTimeScalePoints(e){let t=-1;for(let i=0;ie.timeMs=this._sortedTimePoints.length)continue;this._sortedTimePoints[n].timeMs!==o.timeMs&&-1===i&&(i=n)}const s=t+e.length;if(i=LS(i,this._sortedTimePoints.length,s),-1===i)return null;this._fillPointsData(e,0,0===t||0===this._sortedTimePoints.length?null:this._sortedTimePoints[t-1].displayTime);const o=MS(this._sortedTimePoints.slice(t),e).map((e=>({old:e.old+t,new:e.new===Fh.INVALID_TIME_POINT_INDEX?e.new:e.new+t})));{const i=this._sortedTimePoints;let o=0;for(;t+o1&&null===i){const t=Math.ceil(n/(e.length-1)),i=new Date(1e3*(e[0].displayTime-t));e[0].markWeight=xS(new Date(1e3*e[0].displayTime),i)}}(e,t,i)}_applyTimeScaleChanges(e,t){if(null===e)return t?(this._fillPointsData(this._sortedTimePoints,0),{points:[],pointsIndex:0,baseIndex:this._getBaseIndex(),indexChange:[],marks:this.tickMarks(0),clearTickMarks:!0}):null;let i=e.pointsIndex;if(0!==i&&t&&(this._fillPointsData(this._sortedTimePoints,0),i=0),0===this._sortedTimePoints.length)return{baseIndex:null,pointsIndex:0,indexChange:[],marks:[],points:[],clearTickMarks:!0};const s=[];for(let t=e.pointsIndex;t[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=new Map([["horizlines",(e,t)=>{const i=e;i.startIndex=t.get(i.startIndex),i.endIndex=t.get(i.endIndex)}],["hhists",(e,t)=>{const i=e;i.firstBarTime=t.get(i.firstBarTime),i.lastBarTime=t.get(i.lastBarTime)}],["vertlines",(e,t)=>{const i=e;i.index=t.get(i.index)}],["polygons",(e,t)=>{const i=e;for(const e of i.points)e.index=t.get(e.index)}],["backgrounds",(e,t)=>{const i=e;i.start=t.get(i.start),i.stop=t.get(i.stop)}]]);class DS{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),void 0,void 0,void 0,void 0]}}const BS=(0,ne.getLogger)("ChartApi.PointsetsManager");class VS{constructor(){this._pointsetsDataBySymbol=new Map}destroy(){this._pointsetsDataBySymbol.clear()} +createPointset(e,t,i,s,o){let n=this._pointsetsDataBySymbol.get(t);void 0===n&&(n=new Map,this._pointsetsDataBySymbol.set(t,n));const r=[];for(const t of s){const[s,n,a]=t;if("number"!=typeof s||Number.isNaN(s)){BS.logWarn(`Pointset time is invalid: id=${e}, ${s} of type ${typeof s}`);continue}const l=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){const t=[];this._pointsetsDataBySymbol.forEach(((i,s)=>{i.delete(e),0===i.size&&t.push(s)}));for(const e of t)this._pointsetsDataBySymbol.delete(e)}invalidatePointsetsForSymbol(e,t){const i=this._pointsetsDataBySymbol.get(e);void 0!==i&&i.forEach(((e,i)=>{if(Re.Interval.isEqual(e.resolution,t))for(const t of e.points)null!==t.extrapolation&&t.extrapolation.exact&&(t.extrapolation.exact=!1)}))}getUpdatesForSymbol(e,t,i,s){const o=new Map,n=this._pointsetsDataBySymbol.get(e);return void 0!==n&&n.forEach(((e,n)=>{const r=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(let s=0;s ${t}`),null;o.push({index:i,value:[r.index,r.timeMs/1e3]})}return o}}const RS=-5e6,NS="pre_post_market_sessions",OS=l.enabled(NS),FS=l.enabled("pay_attention_to_ticker_not_symbol");class WS{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=new Map,this._symbolIdToSymbolRequestString=new Map,this._callbacks={},this._serverTimeOffset=0,this._logMessage("Datafeed settings received: {0}".format(JSON.stringify(window.configurationData))),this._datafeedConfiguration=function(e){const t=(0,tt.merge)({},e),i=t.supported_resolutions;if(!i||0===i.length)return t.supported_resolutions=void 0,t;const s=[];for(let e=0;e{this._serverTimeOffset=e-(new Date).valueOf()/1e3})), +this._invalidatedPointsetSessions=new Set,this._refreshPointsetsTimerId=null,this._pointsetsManagers={},this._quotesInfo={},this._depthInfo={},this._endOfData={},this._computeStudyCounter=0,this._symbolExtrapolators={},this._timeScales={},this._cachedDatafeed=new Yv(e,this.serverTimeOffset.bind(this),this._datafeedConfiguration.reset_cache_timeout);const o=(e,t,i)=>{const s=new Cd.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),o=(0,Td.newBarBuilder)(t,s,s);return e=>{if(e&&e.count()){const t=1e3*this.getCurrentUTCTime();o.moveTo(t),o.indexOfBar(t)>=0&&e.setLastBarClosed(!1)}i(e)}};this._pineDatafeed=new pS({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(const e of Object.keys(this._quotesInfo))this._stopQuotesSubscription(e);this._cachedDatafeed.destroy(),this._externalDatafeed=null;for(const e of Object.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(){return this._serverTimeOffset}getCurrentUTCTime(){return(new Date).valueOf()/1e3+this._serverTimeOffset}serverTime(){return 1e3*this.getCurrentUTCTime()}switchTimezone(e,t){this._timeScales[e].setTimezone(t);const i=this._timeScales[e].tickMarks();null!==i&&this._chartApiMessagerProvider.getChartApiMessager(e).onTickmarksUpdated(0,i)}on(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this}supportedResolutions(){return this._datafeedConfiguration.supported_resolutions}supportedCurrencies(){return this._datafeedConfiguration.currency_codes||[]}supportedUnits(){return this._datafeedConfiguration.units||{}}supportedPriceSources(e){return new Promise(((t,i)=>{this._resolveSymbolImpl(e,(e=>{t(JS(e).price_sources)}),(e=>{i(e)}))}))}supportedSymbolsTypes(){return this._datafeedConfiguration.symbols_types||[]}symbolsGrouping(){return this._datafeedConfiguration.symbols_grouping||{futures:/$a/}}getMarks(e,t,i,s,o){const r={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,new Date(1e3*t).toUTCString(),new Date(1e3*i).toUTCString())),this._externalDatafeed.getMarks(JS(e),t,i,(t=>{const i=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)));const a=(0,Jd.createDwmAligner)(o,e),c=l.enabled("two_character_bar_marks_labels"),h=i.map((e=>{const t=e;return t.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,new Date(1e3*t).toUTCString(),new Date(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)));const i=(0,Jd.createDwmAligner)(o,e),r=t.map((e=>{const t=e;return t.tickmark=null!==i?i.timeToSessionStart(1e3*e.time)/1e3:e.time,t}));s(r)}),o))}getSeriesLastBarTime(e,t){const i=this._getSeriesData(e,t);return null===i||0===i.length?null:i[i.length-1].timeMs}getSeriesInterval(e,t){const i=this._studiesCache[e][t];return i?i.resolution:null}onSessionSeriesError(e){this.stopSources(e);const t=this._mainSeriesRecord(e);null!==t&&(t.error=!0),this._applyTimeScaleUpdate(e,this._timeScales[e].clearTimeScale())}stopSources(e){for(const t of this._getStudiesCacheSessionKeys(e)){const i=this._studiesCache[e][t];i&&"series"===i.type&&this._stopSourcesTree(e,t)}}getSeriesSymbolInfo(e,t){const i=this._studiesCache[e][t];return i?i.symbolInfo:null}modifySeries(e,t,i,s,o,r){const a=this._mainSeriesRecord(e);if(null===a||a.guid!==t){if(null!==a&&a.error)return this._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(const i of this._getStudiesCacheSessionKeys(e)){const s=this._studiesCache[e][i];if(s&&"study"===s.type&&s.parentId===t){this._studiesNonSeriesTimes[e][i]=null;const t=this._studiesCache[e][s.parentId];this._createStudy(t.symbolId,t.resolution,s.studyObject,e,i,s.turnaround,s.parentId,(0,n.ensure)(s.inputs))}}}else this._modifyMainSeries(e,i,s,o,r)}createStudy(e,t,i,s,o,n){const r=this._studiesCache[e][i],a=this._studyLibrary.findStudyObject(o);if(null===a)return $S("Study does not exist: "+o),void this._chartApiMessagerProvider.getChartApiMessager(e).onStudyError(t,s,"unknown study name");const l=new a.constructor;this._studiesCache[e]=this._studiesCache[e]||{},this._studiesCache[e][t]={studyObject:l,guid:t,type:"study",inputs:n,metainfo:a.metainfo,turnaround:s,parentId:i},this._studiesNonSeriesTimes[e][t]=null, +this._createStudy(r.symbolId,r.resolution,l,e,t,s,i,n)}modifyStudy(e,t,i,s){const o=this._studiesCache[e][t];if(!o)throw Error("This should never happen");const n=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){return this._timeScales[e]||null}isTimeScaleExtendedTo(e,t){const i=(0,n.ensure)(this._mainSeriesRecord(e));if(Re.Interval.isDWM(i.resolution)&&null!=i.symbolInfo){const e=(0,Jd.createDwmAligner)(i.resolution,i.symbolInfo);null!==e&&(t=e.timeToSessionStart(t))}const s=this._timeScales[e].indexOfTime(t);return null!==s&&s.index>=0}ensureExtendedTo(e,t,i){if(!this._studiesCache[t][e])throw Error("This should never happen");setTimeout((()=>{this._recreateSourcesForDataRange(t,{to:i})}),0)}extendSeriesRange(e,t){let i=this._timeScales[e].firstSeriesBarTime();if(null===i)return void this._logMessage("Nothing to extend - there is no points on time scale");const s=(0,n.ensure)(this._mainSeriesRecord(e));if(Re.Interval.isDWM(s.resolution)&&null!=s.symbolInfo){const e=(0,Jd.createDwmAligner)(s.resolution,s.symbolInfo);null!==e&&(i=e.timeToExchangeTradingDay(i))}const o=(0,n.ensure)(this._symbolIdToSymbolRequestString.get(US(e,s.symbolId))),r=this._barsCoefficients(o,s.resolution),a=r.barsCoefficient||1;if(!r.barsCoefficient){const i=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){return this._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);const c=new DS;this._studiesCache[e]=this._studiesCache[e]||{};const h=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)void 0!==t.countBack&&null!==a&&0!==a.length&&(t.to=a[0].timeMs),i&&null!=i.firstLoadedTimeMs?t.to=void 0!==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));else if(1===r)t=Object.assign({},i.initialDatarange);else{const e=c[h].firstSeriesBarTime();(void 0===t.to||null!==e&&e{const a=[];if(void 0!==r){const e=(r.data||[]).reduce(((e,t)=>Math.max(e,t[0]||0)),-1);if(null!=r.projectionTime)for(let t=0;t<=e;++t)a.push(r.projectionTime+t)}let l=null,c=null;const h=s?this._getSymbolExtrapolator(e,s,o):null;if(void 0!==n){const i=n.map((e=>e.timeMs)).concat(a);null!==h&&h.replaceBarsTimesTail(i,n.length),c=this._timeScales[e].replaceBarsTimesTail(t,i),l=n}else{const i=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&&void 0===r)return;this._timeScales[e].fillIndexesInRows(l);const d=void 0!==r?this._prepareSeriesNonSeriesData(e,t,r):null;this._chartApiMessagerProvider.getChartApiMessager(e).onDataUpdate(t,i,l,d)},g=s=>{const o=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)=>{const d=this._studiesCache[e][t];if(!d)throw Error("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){const i=(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);const c=s[s.length-1];if(n){if(!this._studiesCache[e][t])throw Error("This should never happen");this._logMessage("New bar arrived: symbol {0}, resolution {1}, bar {2}".format(l.full_name,o,JSON.stringify(c)))}else this._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)throw new Error("unexpected non-series data type for series "+s.type);const r=this._getSeriesData(e,t);if(null!==r)m((0,n.ensure)(o.info),0===r.length?void 0:[r[r.length-1]],s);else{const o=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);const i=this._timeScales[e].setStudyBarsTimes(t,[],!0);this._applyTimeScaleUpdate(e,i),this._updateTimeScaleState(e)}delete this._studiesCache[e][t],delete this._studiesNonSeriesTimes[e][t]}removeSeries(e,t){this._stopSourcesTree(e,t),delete this._studiesCache[e][t],this._updateMainTsBuilder(e),this._timeScales[e].isCompleted()&&this._timeScales[e].setCompleted(!1);const i=this._timeScales[e].setSeriesBarsTimes(t,[]);this._applyTimeScaleUpdate(e,i),this._updateTimeScaleState(e)}requestMoreTickmarks(e,t){const i=this._timeScales[e];i.setMinFutureBarsCount(i.minFutureBarsCount()+t);const s=i.firstFutureBarIndex(),o=i.tickMarks(s);this._chartApiMessagerProvider.getChartApiMessager(e).onTickmarksUpdated(s,o)}chartCreateSession(e){this._pointsetsManagers[e]=new VS,this._timeScales[e]=new AS,this._studiesNonSeriesTimes[e]={}}chartDeleteSession(e){this._pointsetsManagers[e].destroy(),delete this._pointsetsManagers[e],this._timeScales[e].destroy(),delete this._timeScales[e],delete this._studiesNonSeriesTimes[e]}removePointset(e,t){this._pointsetsManagers[e].removePointset(t)}async createPointset(e,t,i,s,o){const n=this._resolvePromisesBySymbolId.get(US(e,i));if(void 0===n)return;let r;try{r=(await n).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(void 0===this._externalDatafeed.searchSymbolsPaginated)return void this.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=>{ +XS(e.logo_urls,e.exchange_logo,e)})),t(e,i)}))}resolveSymbol(e,t,i){this._symbolIdToSymbolRequestString.set(US(e,t),i),this._resolvePromisesBySymbolId.set(US(e,t),new Promise(((s,o)=>{this._resolveSymbolImpl(i,(o=>{this._chartApiMessagerProvider.getChartApiMessager(e).onSymbolResolved(t,o),s({symbolInfo:o,requestedSymbol:i})}),(i=>{this._chartApiMessagerProvider.getChartApiMessager(e).onSymbolError(t,i),o(i)}))})))}quoteCreateSession(e){this._quotesInfo[e]={symbols:[],fastSymbols:[],listenerGUID:void 0}}quoteDeleteSession(e){this._stopQuotesSubscription(e),delete this._quotesInfo[e]}quoteSetFields(e,t){}quoteAddSymbols(e,t){this._quotesInfo[e].symbols=this._filteredSymbols(this._quotesInfo[e].symbols.concat(t)),this._restartQuotesSubscription(e)}quoteRemoveSymbols(e,t){this._quotesInfo[e].symbols=this._quotesInfo[e].symbols.filter((e=>t.indexOf(e)<0)),this._restartQuotesSubscription(e)}quoteFastSymbols(e,t){this._quotesInfo[e].fastSymbols=this._filteredSymbols(t),this._restartQuotesSubscription(e)}quoteHibernateAll(e){}depthCreateSession(e){this._depthInfo[e]={symbol:null,listenerGUID:void 0}}depthDeleteSession(e){this._depthInfo[e].symbol=null,this._stopDepthSubscription(e),delete this._depthInfo[e]}depthSetSymbol(e,t){this._depthInfo[e].symbol=t,this._restartDepthSubscription(e)}hasStudyWithExtendedTimeScale(e){for(const t of this._getStudiesCacheSessionKeys(e)){if("study"===this._studiesCache[e][t].type&&this._studyCanExtendTimeScale(e,t))return!0}return!1}_stopDepthSubscription(e){this._depthInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeDepth?.(this._depthInfo[e].listenerGUID),this._depthInfo[e].listenerGUID=void 0)}_restartDepthSubscription(e){this._stopDepthSubscription(e),this._startDepthSubscription(e)}_startDepthSubscription(e){const t=this._depthInfo[e].symbol;if(!t)return;const i=e=>e.map((e=>({p:e.price,v:e.volume}))),s=e=>({s:t,bids:i(e.bids),asks:i(e.asks)}),o=t=>{t.snapshot?this._chartApiMessagerProvider.getChartApiMessager(e).onDepthData([e,s(t)]):this._chartApiMessagerProvider.getChartApiMessager(e).onDepthUpdate([e,s(t)])};this._externalDatafeed.subscribeDepth&&(this._depthInfo[e].listenerGUID=this._externalDatafeed.subscribeDepth(t,(t=>{this._depthInfo[e]&&o(t)})))}_restartQuotesSubscription(e){this._stopQuotesSubscription(e),this._startQuotesSubscription(e)}async _startQuotesSubscription(e){const t={},i={},s=(t,i)=>{const s="ok"===t.s,o=this._marketStatusWatchers[e][t.n],n={...t,symbolname:t.n,status:t.s,values:{...t.v,change:s?t.v.ch:void 0,last_price:s?t.v.lp:void 0,change_percent:s?t.v.chp:void 0,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:void 0)&&o.stop(),this._chartApiMessagerProvider.getChartApiMessager(e).onQuotesData([e,n])},o=n=>{n.forEach((r=>{const a=r.n;if(i[a]?.size>0){const t=[...i[a]].map((e=>({...r,n:e})));if(l.enabled("charting_library_debug_mode")){ +const t=void 0!==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(void 0!==t[r.n]&&null!==t[r.n])s(r,t[r.n]);else if(l.enabled("charting_library_debug_mode")){const t=void 0!==this._quotesInfo[e].listenerGUID?`with listenerGUID ${this._quotesInfo[e].listenerGUID}`:"";this._logMessage(`QUOTES Data for unexpected symbol ${a} ${t}: ${JSON.stringify(n)}`)}}))},r=async e=>{try{const[s,o]=KS(e),r=await new Promise(((e,t)=>{this._resolveSymbolByName(s,o,e,t)})),a=(0,n.ensure)(r.ticker);return t[a]=t[e]=JS(r),a===e?a:(void 0===i[a]&&(i[a]=new Set),a!==e&&i[a].add(e),a)}catch{return null}},a=async e=>[...new Set((await Promise.all([...new Set(e)].map(r))).filter((e=>null!==e)))];if(this._externalDatafeed.getQuotes&&!l.enabled("charting_library")){const[t,i]=await Promise.all([a(this._quotesInfo[e].symbols),a(this._quotesInfo[e].fastSymbols)]),s={};if(l.enabled("charting_library_debug_mode")){const e=WS.debugGetQuotesRequestId++;this._logMessage(`QUOTES Requesting data for symbols ${JSON.stringify(t)} with request ID ${e}`);for(const i of t){const t=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(const e of n)void 0!==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){void 0===this._marketStatusWatchers[e]&&(this._marketStatusWatchers[e]={});for(let i=0;ithis._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){const t=[];return e.forEach((e=>{e instanceof Object||t.indexOf(e)<0&&t.push(e)})),t}_refreshPointsets(e){e.forEach((e=>{const t=this._studiesCache[e];if(null==t)return;let i=null;for(const e of Object.keys(t)){const s=t[e];if("series"===s.type){i=s;break}}if(null===i||null==i.symbolInfo)return;const s=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){const i=[];for(const s of this._getStudiesCacheSessionKeys(e)){const o=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)){const i=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(const t of this._getStudiesCacheSessionKeys(e)){const i=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){const s=this._studiesCache[e][t];this.createSeries(e,t,s.turnaround,s.symbolId,s.resolution,i,!0);for(const i of this._getStudiesCacheSessionKeys(e)){const o=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){const i={};i[t]={turnaround:this._studiesCache[e][t].turnaround};for(const s of this._getStudiesCacheSessionKeys(e)){const o=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){const s=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=>{const t=e[0]||0;return t<0?(0,n.ensure)(o)[(0,n.ensure)(o).length+t].timeMs:i.projectionTime+t})))}}_seriesCount(e){let t=0;for(const i of this._getStudiesCacheSessionKeys(e)){"series"===this._studiesCache[e][i].type&&(t+=1)}return t}_modifyMainSeries(e,t,i,s,o){this.stopSources(e);const r=this._mainSeriesRecord(e);let a=!1;for(const n of this._getStudiesCacheSessionKeys(e)){const c=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;const n=ZS(o),c={countBack:n||0};l.enabled("request_only_visible_range_on_reset")&&n&&(delete this._objectsDataCache[jS(e,r.guid)],delete this._studiesCache[e][r.guid]), +this.createSeries(e,r.guid,s,t,i,c,!0)}}for(const t of this._getStudiesCacheSessionKeys(e)){const i=this._studiesCache[e][t];if(i&&"study"===i.type){this._studiesNonSeriesTimes[e][t]=null;const s=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){let t=null,i=null;for(const s of this._getStudiesCacheSessionKeys(e)){const o=this._studiesCache[e][s];if("series"===o.type&&(null===t&&(t=o),o.isMain)){i=o;break}}return null===i&&(i=t),null!==i&&(i.isMain=!0),i}_stopSourcesTree(e,t){for(const i of this._getStudiesCacheSessionKeys(e)){const s=this._studiesCache[e][i];s&&(("series"===s.type&&i===t||"study"===s.type&&s.parentId===t)&&(s.engine&&s.engine.isStarted()&&s.engine.stop(),s.activeResolve=-1))}this._pineDatafeed.removeUnused()}_getSeriesData(e,t){return this._objectsDataCache[jS(e,t)]||null}_resolveSymbolImpl(e,t,i){var s;(0,Pv.isEncodedExtendedSymbol)(e)||(s="Expect to get symbol encoded string, but got the following instead: "+e,console.error(`${(new Date).toISOString()} ${s}`));const[o,n]=KS(e);this._resolveSymbolByName(o,n,t,i)}_getSymbolExtrapolator(e,t,i){const s=(0,n.ensure)(Re.Interval.normalize(i)),o=function(e,t,i){const s=void 0!==t.subsession_id?","+t.subsession_id:"";return e+","+t.full_name+","+i+s}(e,t,s);let r=this._symbolExtrapolators[o];return void 0===r&&(r=new SS(t,s),this._symbolExtrapolators[o]=r),r}_barsCoefficients(e,t){const i=(0,Pv.decodeExtendedSymbol)(e);if(!("type"in i)||void 0===i.type)return{};const s=e+t;return this._barsCoefficientsCache[s]||(this._barsCoefficientsCache[s]={}),this._barsCoefficientsCache[s]}_studyCanExtendTimeScale(e,t){const i=this._studiesCache[e][t]?.metainfo;return void 0!==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=void 0),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(`${(new Date).toISOString()} ${e}`)}_resolveSymbolByName(e,t,i,s){let o;const n=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||void 0,r||void 0,a||void 0),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){return new Promise(((o,n)=>{const r=qS(e,t,i,s);this._logMessage("Symbol resolve requested: `{0}` ".format(r));let a=!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)));const t=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),void 0!==e.has_no_volume&&(e.visible_plots_set=e.has_no_volume?"ohlc":"ohlcv"),void 0===e.visible_plots_set&&(e.visible_plots_set="ohlcv"),e.supported_resolutions){const t=[];for(const i of e.supported_resolutions){const e=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,delete e.has_ticks,!0===t.shouldUseSubsessions&&Array.isArray(e.subsessions))for(let t=0;t!Re.Interval.isValid(e))).forEach((e=>{i("supported_resolutions field contains invalid value: "+e)})),OS||(void 0!==e.subsessions&&i(`Symbol info contains subsessions but the ${NS} feature is not enabled, so the subsessions will be ignored`),void 0!==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)){const s=this._callbacks[e];for(let e=0;e{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)&&void 0!==r.to){const e=(0,Jd.createDwmAligner)(s,i);null!==e&&(r.to=e.timeToExchangeTradingDay(r.to))}if(r.from&&r.to){const e=(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 _=new nS({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){let s=e.time;const o="number"==typeof t?[t]:t;if(o[0]&&"object"==typeof o[0]&&"timeMs"in o[0]){const e=o[0];o.splice(0,1),s=void 0===e.timeMs||isNaN(s)?s:e.timeMs}for(let e=0;eu[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"in t)||(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])throw Error("This should never happen");this._studiesCache[e][o].engine=_}catch(e){if(!((0,zv.default)(e)&&"studyError"in e&&e.studyError))throw e;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=_;const v=this._resolvePromisesBySymbolId.get(US(e,i));if(void 0===v)throw new Error("This should never happen");let S,b;try{const e=await v;S=e.symbolInfo,b=e.requestedSymbol}catch(e){return void(y()&&h.onSymbolErrorCallback(zS(e,"unknown symbol error")))}y()&&f(S,b)}_getDataRangeForStudy(e,t){const i=this._studiesCache[e][t],s={...this._seriesDataRange(e,i.parentId)},o=this._studiesCache[e][i.parentId];return this._studyCanExtendTimeScale(e,t)&&o?.completed?void 0!==i.dataRange?i.dataRange:(i.firstLoadedTimeMs&&(s.to=i.firstLoadedTimeMs),s):s}_seriesDataRange(e,t){const i=this._studiesCache[e][t];return null!==i.firstLoadedTimeMs?{to:i.firstLoadedTimeMs,countBack:0}:i.dataRange}_createStudy(e,t,i,s,o,r,a,l){this._studiesCache[s][o].completed=!1;const c=(e=>{if(Array.isArray(e))return e;const t=[],i=this._studiesCache[s][o].metainfo.inputs;if((0,Hv.default)(i))for(let s=0;s{const n=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)){const t=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{};const t={},i=this._studiesCache[s][o].metainfo;return e.forEach(((e,s)=>{t[(0,n.ensure)(i.plots)[s].id]=e})),{data:{offsets:t},indexes:[]}};let u=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){const e=this._getSeriesData(s,a)?.[0];if(void 0===e)return 1/0;u=e.timeMs}return u}),{onDataReadyCallback:(e,t,i)=>{ +_&&0===e.length||h(e,d(t))},onRealtimeCallback:(e,t,i,n,a)=>{const l=YS(e);if(this._studyCanExtendTimeScale(s,o)){const e=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;let i=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":const t=this._timeScales[s].replaceStudyBarsTimesTail(o,e.times);this._applyTimeScaleUpdate(s,t);break;case"study_graphics":{const t={data:{graphicsCmds:e.data?.graphicsCmds,isUpdate:e.data?.isUpdate},indexes:[]},i=function(e){const t=e.data&&e.data.graphicsCmds&&e.data.graphicsCmds.create;if(!t)return[];const i=new Map,s=new Set;kS.forEach(((e,o)=>{const n=t[o];if(n)for(const t of n)for(const o of t.data){const t=e(o);for(const e of t)i.set(e,-1),s.add(e)}}));const o=Array.from(s).sort(((e,t)=>e-t));return o.forEach(((e,t)=>i.set(e,t))),ES.forEach(((e,s)=>{const o=t[s];if(o)for(const t of o)for(const s of t.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":{const t={data:e.data,indexes:[]},i=t?.data?.data?.pivots,n=void 0!==i;let r=function(e){const t={};gS(e,(e=>{(0,zv.default)(e)&&Object.keys(e).forEach((i=>{i.endsWith("__t")&&(t[e[i]]=!0)}))}),{visitInstances:!0});const i=Object.keys(t).map(Number).sort(((e,t)=>e-t));return i.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){const e=new Set,t=[],s=[];let o=0;for(let n=a.length-1;n>=0;n--){const l=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){const s=e+"!"+t+"@"+i;return Boolean(this._endOfData[s])}_setEndOfData(e,t,i,s){const o=e+"!"+t+"@"+i;this._endOfData[o]=!1!==s}_applyTimeScaleUpdate(e,t){if(null===t)return;const i=[];for(const t of this._getStudiesCacheSessionKeys(e)){const s=this._studiesCache[e][t];if(s&&"study"===s.type){const o=this._studiesNonSeriesTimes[e][t];if(o){const n={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((()=>{const t=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){const i=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){const t=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){const i=this._getSymbolExtrapolator(e,t.symbolInfo,t.resolution);this._timeScales[e].setMainSymbolExtrapolator(i)}}_updateTimeScaleState(e){if(!this._studiesCache[e])return;let t=!0,i=!0;for(const s of this._getStudiesCacheSessionKeys(e)){const o=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){return void 0!==this._studiesCache[e]?Object.keys(this._studiesCache[e]):[]}}WS.debugGetQuotesRequestId=1;const HS=WS;function zS(e,t){return"string"==typeof e?e:(0,zv.default)(e)&&e&&"message"in e&&(0,et.default)(e.message)?e.message:t}function US(e,t){return e+"_"+t}function jS(e,t){return e+"_"+t}function GS(e,t,i,s){return e+(t?"_#_"+t:"")+(i?"_#_"+i:"")+(s?"_#_"+s:"")}function qS(e,t,i,s){return[e,t,i,s].filter((e=>(0,et.default)(e)&&e.length>0)).join("|")}function $S(e){console.warn(`${(new Date).toISOString()} ${e}`)}function KS(e){const t=(0,Pv.decodeExtendedSymbol)(e),i="string"==typeof t.symbol?t:t.symbol;return[i.symbol,{currency:"currency-id"in i&&i["currency-id"],unit:"unit-id"in i&&i["unit-id"],session:"session"in i?i.session===Xv.SubsessionId.Regular?void 0:i.session:void 0}]}function YS(e){const t=e.findIndex((e=>e.index!==RS));return-1===t?[]:0===t?e:e.slice(t)}function ZS(e){if(null===e||"number"==typeof e)return e;if("object"==typeof e&&Array.isArray(e)){switch(e[0]){case"bar_count":return e[2];case"from_to":return e.length>=3?e[2]??null:null}}return null}function XS(e,t,i){if(i.logoid=void 0,i["base-currency-logoid"]=void 0,i["currency-logoid"]=void 0,e){if("string"==typeof e)return void $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=void 0)}function JS(e){return e.timezone=e.timezone,e}(0,A.setClasses)();const QS=(0,r.getChartingLibraryGlobalContext)(),eb=(0,r.getChartingLibraryOwner)(),tb=new class{constructor(e,t){this._updateDocumentHeight=e=>{"visual"===this._viewportType&&this._window.document.documentElement.style.setProperty("height",`${e}px`,"important")},this._window=e,this._fullscreenApi=new Oe(e.document),this._viewportType=ze.CheckMobile.iOS()&&!(0,He.isOnMobileAppPage)("any")&&this._window.visualViewport?"visual":"quirks", +"visual"===this._viewportType?this._viewport=(0,n.ensure)(this._window.visualViewport):this._viewport=this._window;const i=this._layoutSizeSensor=this._window.document.createElement("div");i.id="layout-size-sensor",i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.right="0",i.style.bottom="0",i.style.pointerEvents="none",i.style.visibility="hidden",this._initFullscreen()}allocate(){this.free();const e=this._window.document,t=e.createElement("div");t.classList.add("js-rootresizer__contents"),t.style.position="relative",t.style.width="100%",t.style.height="100%",e.body.insertAdjacentElement("afterbegin",t),e.body.insertAdjacentElement("afterbegin",this._layoutSizeSensor),this._visibilityApi=new Fe(this._window.document);const i={alive:new O.WatchedValue(!0),fullscreenable:new O.WatchedValue(!0),container:new O.WatchedValue(t),width:new O.WatchedValue,height:new O.WatchedValue,availWidth:new O.WatchedValue,availHeight:new O.WatchedValue,visible:this._visibilityApi.isVisible,fullscreen:this._fullscreenApi.isFullscreen,remove:()=>{i.alive.setValue(!1)},attach:()=>{i.alive.setValue(!1),this._window.close()},requestFullscreen:()=>{this._requestFullscreen()},exitFullscreen:()=>{this._exitFullscreen()}};return i.alive.subscribe((e=>{e||i!==this._area||this.free()})),this._area=i,this._resizeHandler=()=>{const e=this._width(i)||800,t=this._height(i)||600;i.availHeight.setValue(t),i.availWidth.setValue(e),i.height.setValue(t),i.width.setValue(e)},this._area.height.subscribe(this._updateDocumentHeight,{callWithLast:!0}),this._resizeHandler(),this._viewport.addEventListener("resize",this._resizeHandler),new Ne(i).bridge()}free(){if(this._resizeHandler&&(this._viewport.removeEventListener("resize",this._resizeHandler),this._resizeHandler=void 0),this._visibilityApi&&(this._visibilityApi.destroy(),this._visibilityApi=void 0),this._area){const e=this._area;this._area=void 0,e.height.unsubscribe(this._updateDocumentHeight),e.alive.setValue(!1);const t=e.container.value(),i=t?.parentElement;i&&(i.removeChild(t),i.removeChild(this._layoutSizeSensor))}}_height(e){if("visual"===this._viewportType)return this._layoutSizeSensor.clientHeight;return e.container.value().clientHeight}_width(e){return e.container.value().clientWidth}_requestFullscreen(){this._fullscreenApi.enter()}_exitFullscreen(){this._fullscreenApi.exit()}_initFullscreen(){this._fullscreenApi.isFullscreen.subscribe((e=>{this._resizeHandler&&this._resizeHandler()}))}}(window),ib=new class{constructor(e){this._processVisibility=e=>{const t=e.container.value();return this.affectsLayout(e.name)?(t&&t.classList.toggle("js-hidden",!1),!0):(t&&t.classList.toggle("js-hidden",!0),!1)},this._setWidth=(e,t,i)=>{let s=i;this._fullscreenArea!==e.name&&(e.availWidth.setValue(i),e.canNegotiate.width&&(s=Ue(i,e.negotiations.width))),t||(s=0);const o=e.container.value();return o&&t&&(o.style.width=s+"px"),e.width.setValue(s),s},this._setHeight=(e,t,i)=>{let s=i;this._fullscreenArea!==e.name&&(e.availHeight.setValue(i),e.canNegotiate.height&&(s=Ue(i,e.negotiations.height))), +t||(s=0);const o=e.container.value();return o&&t&&(o.style.height=s+"px"),e.height.setValue(s),s};const t=e.container.value();if(!t)throw new Error("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){const t=e&&e.areaName;if(-1===this._availableAreas.indexOf(t))throw new Error("unknown options.areaName");this.free(t);const i=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(const e in this._areas)this._areas[e]===s&&this.free(e)},negotiateWidth:e=>{if(!s.canNegotiate.width)return;const t=je(e);Ge(s.negotiations.width,t)||(s.negotiations.width=t,this.recalculate())},negotiateHeight:e=>{if(!s.canNegotiate.height)return;const t=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=void 0,"center"===t&&this._bridge.exitFullscreen(),this._updateFullscreen())},width:new O.WatchedValue,height:new O.WatchedValue,availWidth:new O.WatchedValue,availHeight:new O.WatchedValue,alive:new O.WatchedValue(!0),container:new O.WatchedValue(i),visible:new O.WatchedValue(!0),fullscreen:new O.WatchedValue(!1),fullscreenable:new O.WatchedValue("right"===t||"center"===t),rdState:new Ne};return s.rdState.pushOwner(s),this._areas[t]=s,s.rdState.owner.subscribe((e=>{const i=s.container.value();if(e!==s)i&&(i.innerHTML="",i.parentElement&&i.parentElement.removeChild(i));else{let e=null;for(let i=this._availableAreas.indexOf(t);i--;){const t=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){const t=this._areas[e];if(!t)return;this._areas[e]=void 0;const i=t.container.value();i&&i.parentElement&&i.parentElement.removeChild(i),t.alive.setValue(!1)}recalculate(){const e={};this._recalcSingleRunToken=e;const t=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();let d=0,u=0,_=0,p=0,m=0,g=0,f=0,y=0;if(e===this._recalcSingleRunToken&&l){const e=this._processVisibility(l);y=this._setHeight(l,e,h),this._setWidth(l,e,c)} +if(e===this._recalcSingleRunToken&&t){const e=this._processVisibility(t);f=this._setHeight(t,e,h),g=this._setWidth(t,e,c);const i=t.container.value();e&&i&&(i.style.top=y+"px")}let v=0;if(e===this._recalcSingleRunToken&&n){const e=this._processVisibility(n),t=n.container.value();e&&t&&(t.style.left=g+"px",t.style.top=y+"px");const i=c-g;this._setWidth(n,e,i),d=this._setHeight(n,e,h),d&&(v=1)}if(e===this._recalcSingleRunToken&&i){const e=this._processVisibility(i),t=Math.max(f,d);_=this._setWidth(i,e,c),_&&(_+=4),_&&1===v&&(v=4);const s=i.container.value();e&&s&&(s.style.top=t+y+v+"px"),this._setHeight(i,e,h-t-y)}if(e===this._recalcSingleRunToken&&s){const e=this._processVisibility(s);let t=c-_;qe||(t-=300),m=this._setWidth(s,e,t),m&&1===v&&(v=4),this._setHeight(s,e,h-y-d-v)}if(e===this._recalcSingleRunToken&&o){const e=this._processVisibility(o);let t=c-_-m;qe||(t-=300),p=this._setWidth(o,e,t),p&&1===v&&(v=4),this._setHeight(o,e,h-y-d-v);const i=o.container.value();e&&i&&(i.style.top=d+y+v+"px")}const S=m+p;let b=0,w=c-_-m-p-(S?4:0);const C=Boolean(m||!S);if(!p&&m&&(w+=4),e===this._recalcSingleRunToken&&r){const e=this._processVisibility(r),t=r.container.value();e&&t&&(t.style.left=_+"px",t.classList.toggle("no-border-top-left-radius",!_),t.classList.toggle("no-border-top-right-radius",C)),this._setWidth(r,e,w);const i=h-y;b=Math.min(300,i-0),u=this._setHeight(r,e,i)+4}const T=Boolean(d&&(_||S));if(this._container.classList.toggle("layout-with-border-radius",T),e===this._recalcSingleRunToken&&a){const e=this._processVisibility(a),t=a.container.value();e&&t&&(t.style.left=_+"px",t.style.top=d+y+v+"px",t.classList.toggle("no-border-bottom-left-radius",!u||!_),t.classList.toggle("no-border-bottom-right-radius",C||!u),t.classList.toggle("no-border-top-left-radius",Boolean(!_&&S)),t.classList.toggle("no-border-top-right-radius",C)),this._setWidth(a,e,w);const i=h-d-u-y-v;this._setHeight(a,e,Math.max(i,b))}if(e===this._recalcSingleRunToken&&s&&this.affectsLayout("tradingpanel")){const e=s.container.value();e&&(e.style.right=m&&p?`${p+4}px`:`${p}px`,e.style.top=y+d+v+"px",e.style.borderTopRightRadius=T&&p?"4px":"0px")}e===this._recalcSingleRunToken&&this._updateVisibility()}affectsLayout(e){const t=this._areas[e];if(!t)return!1;if(t.rdState.owner.value()!==t)return!1;if(this._fullscreenArea&&this._fullscreenArea!==e)return Ye(e);if(this._width.value()<=567||this._height.value()<=445&&!Ke){if(!["center","top","left","topleft","extratop"].includes(e))return!1}return!0}_updateVisibility(){const e=this._bridge.visible.value();for(let t=0;t{QS.ChartApiInstance.start()})),"function"==typeof rb){const e=rb({Std:Py.Std});e&&e.then?e.then((e=>{if(!Array.isArray(e))return console.warn("custom_indicators_getter should be a function that returns a Promise object which result is an array of custom indicators"),void ab.resolve();const t=QS.JSServer;for(const i of e)if("function"==typeof i){const e=(new Ev).build(i);t.studyLibrary.push.call(t.studyLibrary,e)}else t.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())}else ab.resolve();QS.widgetReady=e=>{ee.subscribe("onChartReady",e,null)};const yb=ob.theme?.toLowerCase()??$s.StdTheme.Light;var vb;function Sb(e){QS.__defaultsOverrides=QS.__defaultsOverrides||{},(0,ge.deepExtend)(QS.__defaultsOverrides,e),void 0!==TradingView.defaultProperties&&void 0!==TradingView.defaultProperties.chartproperties&&((0,h.applyDefaultsOverrides)(TradingView.defaultProperties.chartproperties),(0,h.applyDefaultOverridesToLinetools)())}vb=yb,L.themes[vb]&&(0,k.setTheme)(vb),async function(e){if(!db||void 0===e)return;try{const{overrideStandardThemes:t}=await i.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(const t in e.order)TradingView.defaultProperties.linetoolorder[t]=e.order[t];if(e.position)for(const t in e.position)TradingView.defaultProperties.linetoolposition[t]=e.position[t];return null===fb?Promise.resolve():fb.then((t=>{function i(e){const t={};for(const i of Object.keys(e??{})){const s=i.split(".");let o=t;for(const e of s.slice(0,s.length-1))o.hasOwnProperty(e)||(o[e]={}),o=o[e];o[s[s.length-1]]=e[i]}return t}if(null===t)return;const s=i(e.brokerOrder),o=i(e.brokerPosition);t?.overrideTradedGroupStyles({order:{lightTheme:s,darkTheme:s},position:{lightTheme:o,darkTheme:o}})}))},QS.changeTheme=(e,t)=>{const i=L.themes[e.toLowerCase()];return i?QS.tradingViewApi.themes().setStdTheme(i.name,!0,t&&t.disableUndo):Promise.resolve()},QS.getTheme=()=>QS.tradingViewApi.themes().getCurrentThemeName(),QS.customThemes=async()=>{if(!db)return Promise.reject(new Error("The library_custom_color_themes feature must be enabled to use the custom themes API"));return new((await i.e(2413).then(i.bind(i,82753))).CustomThemesApi)},QS.is_authenticated=!1;JSON.parse(QS.urlParams.brokerConfig);a.t(null,void 0,i(94566)),a.t(null,void 0,i(92800)),a.t(null,void 0,i(44676));let bb=null;const wb=(0,me.createDeferredPromise)();let Cb;const Tb=()=>{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")){const e=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)(void 0===TradingView.defaultProperties,"Default properties are inited before applying overrides"),Sb(JSON.parse(ob.overrides));const e=ob.numeric_formatting?JSON.parse(ob.numeric_formatting):void 0;e&&("string"==typeof e.decimal_sign&&(ue.formatterOptionsLibraryOverrides.decimalSign=e.decimal_sign[0]),"string"==typeof e.grouping_separator&&(ue.formatterOptionsLibraryOverrides.groupingSeparator=e.grouping_separator[0]));const t=new Sv,s=new Nv,c=new Bv,h=ob.studiesAccess&&JSON.parse(ob.studiesAccess)||{type:"black",tools:[]},d=new Df(h,c),u=new Ov((0,r.getChartingLibraryGlobalContext)().JSServer.studyLibrary),_=new HS(eb.datafeed,t,s,u);QS.ChartApiInstance=new Ef(t,_,c,d);const p=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)), +eb.customTimezones&&De.instance().addTimezones(eb.customTimezones);const m=ob.chartContent?JSON.parse(ob.chartContent).json:void 0,g=ob.chartContentExtendedData?JSON.parse(ob.chartContentExtendedData):m?m.extendedData:void 0,f=ob.interval||"D",v=function(e){const t=/(\d+)(\w+)/;return e.map((e=>{const s=(0,n.ensureNotNull)(t.exec(e.text)),o=s[2].toLowerCase(),r=parseInt(s[1]),l="y"===o?12*r+"M":r+o,c=Re.Interval.parse(l.toUpperCase()),h=Re.Interval.parse(e.resolution);return{text:e.title||{y:a.t(null,{plural:"{count}y",count:r,context:"short_N_year"},i(46766)),m:a.t(null,{plural:"{count}m",count:r,context:"short_N_month"},i(58590)),d:a.t(null,{plural:"{count}d",count:r,context:"short_N_day"},i(47801))}[o]||`${r}${o}`,description:e.description||"",value:{value:c.value(),type:"period-back"},targetResolution:h.value(),requiresIntraday:c.isIntraday()}}))}(JSON.parse(ob.timeFrames)),S={resizerBridge:gb,padding:l.enabled("border_around_the_chart")?2:0,content:m,widgetOptions:{addToWatchlistEnabled:!1,hideIdeas:!0,addVolume:(0,n.ensureDefined)(QS.ChartApiInstance.studiesAccessController).isToolEnabled("Volume"),muteSessionErrors:!0,timezone:ob.timezone,defSymbol:ob.symbol??"",defInterval:m?"":f,compareSymbols:ob.compareSymbols&&JSON.parse(ob.compareSymbols),defTimeframe:(b=eb.timeframe,b?"string"==typeof b?b:{...b,type:"time-range"}:b),paneContextMenuEnabled:l.enabled("pane_context_menu"),paneContextMenu:{mainSeriesTrade:sb},priceScaleContextMenuEnabled:l.enabled("scales_context_menu"),currencyConversionEnabled:l.enabled("pricescale_currency"),unitConversionEnabled:l.enabled("pricescale_unit"),legendWidgetEnabled:l.enabled("legend_widget"),legendWidget:{contextMenu:{settings:l.enabled("show_chart_property_page"),showOpenMarketStatus:l.enabled("display_market_status")}},sourceStatusesWidget:{errorSolution:!1},marketStatusWidgetEnabled:l.enabled("display_market_status"),chartWarningWidget:{subscriptionFullInfo:!1},timeScaleWidget:{contextMenuEnabled:l.enabled("scales_context_menu"),timezoneMenuEnabled:l.enabled("timezone_menu"),priceAxisLabelsOptions:{showLabels:l.enabled("main_series_scale_menu")}},timeScale:{preserveBarSpacing:!1,lockVisibleTimeRangeOnResize:l.enabled("lock_visible_time_range_on_resize"),rightBarStaysOnScroll:l.enabled("right_bar_stays_on_scroll"),minBarSpacing:ob.time_scale&&JSON.parse(ob.time_scale).min_bar_spacing},goToDateEnabled:l.enabled("go_to_date"),crossHair:{menuEnabled:l.enabled("chart_crosshair_menu")},handleScale:{mouseWheel:l.enabled("mouse_wheel_scale"),pinch:l.enabled("pinch_scale"),axisPressedMouseMove:{time:l.enabled("axis_pressed_mouse_move_scale"),price:l.enabled("axis_pressed_mouse_move_scale")}},handleScroll:{mouseWheel:l.enabled("mouse_wheel_scroll"),pressedMouseMove:l.enabled("pressed_mouse_move_scroll"),horzTouchDrag:l.enabled("horz_touch_drag_scroll"),vertTouchDrag:l.enabled("vert_touch_drag_scroll")},shiftVisibleRangeOnNewBar:l.enabled("shift_visible_range_on_new_bar"),croppedTickMarks:l.enabled("cropped_tick_marks"),countdownEnabled:l.enabled("countdown"), +indicatorsDialogShortcutEnabled:l.enabled("insert_indicator_dialog_shortcut")},seriesControlBarEnabled:l.enabled("timeframes_toolbar"),seriesControlBar:{timeFramesWidgetEnabled:!0,timeFramesWidget:{goToDateEnabled:l.enabled("go_to_date"),availableTimeFrames:(e,t)=>{if(!e)return[];if(t!==bt.STATUS_DELAYED&&t!==bt.STATUS_DELAYED_STREAMING&&t!==bt.STATUS_EOD&&t!==bt.STATUS_READY)return[];return v.filter((t=>!(t.requiresIntraday&&!e.has_intraday)&&!(e.supported_resolutions&&!e.supported_resolutions.includes(t.targetResolution))))}},timeWidgetEnabled:!0,timeWidget:{timezoneMenuEnabled:l.enabled("timezone_menu")},adjustForDividendsButtonEnabled:!1,sessionIdButtonEnabled:l.enabled("pre_post_market_sessions"),backAdjustmentButtonEnabled:!1,settlementAsCloseButtonEnabled:!1,percentageScaleButtonEnabled:!0,logScaleButtonEnabled:!0,autoScaleButtonEnabled:!0,layoutFullscreenButtonEnabled:!0,mobileChangeLayoutEnabled:!1},globalEvents:!0,snapshotUrl:ob.snapshotUrl,mobileForceChartMaximizeEnabled:!1,saveChartEnabled:l.enabled("save_shortcut")};var b;hb&&((0,xf.createFavoriteDrawingToolbar)(),S.widgetOptions.isDrawingToolbarVisible=P.isDrawingToolbarVisible),g&&(S.metaInfo={id:g.uid,name:g.name,description:g.description,uid:g.uid,username:""}),eb.additionalSymbolInfoFields&&(0,lv.setAdditionalSymbolInfoFields)(eb.additionalSymbolInfoFields);const w=eb.symbolSearchComplete;w&&(0,cv.setSymbolSearchCompleteOverrideFunction)(w);const C=QS.chartWidgetCollection=new Pf(S);let x=!1;C.onAboutToBeDestroyed.subscribe(null,(()=>{x=!0}),!0),function(e){e.addCustomSource("branding",((t,i)=>{const s=(0,ft.combine)(((e,t)=>{const s=e??t;return null!==s&&s.hasModel()&&s.model().model()===i}),e.maximizedChartWidget().weakReference(),e.leftBottomChartWidget().weakReference());return new ev(t,i,s.ownership())}),Co.CustomSourceLayer.Topmost)}(C),QS.studyMarket=new pe(C),Je.registerService(Xe.CHART_WIDGET_COLLECTION_SERVICE,C),C.activeChartWidget.subscribe((e=>{ee.emit("activeChartChanged",C.getAll().indexOf(e))})),QS.saver=new N.ChartSaver(C);const A=new I.ChartChangesWatcher(C,QS.saver,ee),k=new Z(C,QS.saver,A);C.setSaveChartService(k);const E=new oe(C);QS.chartWidget=C.activeChartWidget.value(),QS.pro=new TradingView.Pro;const B=function(e){if(!pb)return null;const t=JSON.parse(ob.favorites);t.intervals=t.intervals.map((e=>{let t=""+e;return t.match(/1[DWMYdwmy]/)&&(t=t.slice(1)),t})),l.enabled("study_templates")&&(Cb=new he({chartWidgetCollection:e.chartWidgetCollection}));let s;const o=ob.header_widget_buttons_mode;"fullsize"===o&&(s=["full"]);"compact"===o&&(s=["small"]);const n=(0,gv.shouldShowQuickSearchOnLib)()?function(e){const t=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(9026),i.e(1890),i.e(1727),i.e(9754)]).then(i.bind(i,11065)).then((i=>{const s=new(0, +i.GlobalSearchDialogRenderer)(e);return null!==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):void 0;return new T(new y,{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"));const V=function(e){if(mb){const t=ob.toolbarbg&&/^[0-9a-f]+$/i.test(ob.toolbarbg)?String(ob.toolbarbg):void 0;if(t){const e=document.createElement("style");e.textContent="body,.chart-controls-bar,#footer-chart-panel{background-color:#"+t+" !important}",document.head.appendChild(e)}return new M({bgColor:t,chartWidgetCollection:e,drawingsAccess:ob.drawingsAccess?JSON.parse(ob.drawingsAccess):void 0,resizerBridge:mb,onClick:Ab})}return null}(C),R=null;QS.tradingViewApi=new Cy({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)){const e=Math.max(0,+(0,n.ensureDefined)(ob.ssreqdelay));(0,Ty.setSearchRequestDelay)(e)}QS.ChartApiInstance.connect(),(async()=>{const{LineToolPropertiesWidget:e}=await Promise.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))})();const O=document.querySelector(".tv-content");null!==O&&O.addEventListener("contextmenu",(e=>{e.target instanceof Element&&"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}));let F=!1;function W(){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){const e=L.getStdTheme(yb);e&&e.content&&void 0===m&&C.applyTheme({theme:e.content,onlyActiveChart:!1,restoreNonThemeDefaults:!1,themeName:yb,standardTheme:!0,syncState:!0,noUndo:!0 +}).then((()=>QS.applyOverrides(QS.__defaultsOverrides)))}if(l.enabled("charting_library_debug_mode")&&ee.subscribeToAll(((...e)=>{console.log(`${(new Date).toISOString()} Event "${e[0]}", arguments: ${JSON.stringify(e.slice(1))}`)})),F)return;F=!0,If(C),function(e,t){const s=a.t(null,void 0,i(37367)).format({emoji:"👍"}),o=a.t(null,void 0,i(69804)).format({emoji:"👍"}),r=a.t(null,void 0,i(6655)).format({emoji:"👍"});ee.on("onServerScreenshotCopiedToClipboard",(()=>h(s)),null),ee.on("onClientScreenshotCopiedToClipboard",(()=>h(o)),null),ee.on("onServerScreenshotEmbedCodeCopiedToClipboard",(()=>h(r)),null);let l=null;const c=e.getContainer();function h(e){l?l.show(e):Promise.all([i.e(5371),i.e(2307),i.e(2227),i.e(92)]).then(i.bind(i,1524)).then((i=>{l||(l=new i.ChartScreenshotHintRenderer((0,n.ensureNotNull)(c),{bottomPadding:t.seriesControlBarEnabled}),l.show(e))}))}}(C,{seriesControlBarEnabled:l.enabled("timeframes_toolbar")});P_.getInstance().setWidgetCollection(QS.chartWidgetCollection)})),C.getAll().some((e=>e.isInitialized()))?W():function(e,t){const i=e.getAll(),s=()=>{t(),i.forEach((e=>{e.chartWidgetInitialized().unsubscribe(null,s)}))};i.forEach((e=>{e.chartWidgetInitialized().subscribe(null,s,!0)}))}(C,W),ee.subscribe("chart_load_requested",(e=>{QS.tradingViewApi.loadChart({json:JSON.parse(e.content),extendedData:e})}),null)};window.addEventListener("unload",(()=>{nb.abort(),QS.widgetbar&&(QS.widgetbar.destroy(),QS.widgetbar=null),QS.chartWidgetCollection&&(QS.chartWidgetCollection.destroy(),QS.chartWidgetCollection=null),QS.ChartApiInstance&&QS.ChartApiInstance.disconnect(),(0,Ze.destroyQuoteSessions)(),QS.ChartApiInstance&&(QS.ChartApiInstance.destroy(),QS.ChartApiInstance=null)})),l.enabled("saveload_storage_customization")&&(eb.saveLoadAdapter?E.setCustomAdapter(eb.saveLoadAdapter):QS.urlParams.chartsStorageUrl&&QS.urlParams.clientId?E.initialize(QS.urlParams.clientId,QS.urlParams.userId,QS.urlParams.chartsStorageUrl,QS.urlParams.chartsStorageVer||"1.0"):(l.setEnabled("saveload_storage_customization",!1),l.setEnabled("header_saveload",!1))),void 0!==eb.imageStorageAdapter&&l.enabled("image_drawingtool")&&(0,fv.setImageStorageAdapter)(eb.imageStorageAdapter);const Pb=(0,me.createDeferredPromise)();function xb(){Pb.resolve()}eb.loadLastChart&&l.enabled("saveload_storage_customization")?E.getCharts().then((e=>{if(0===e.length)return void xb();const t=e.sort(((e,t)=>t.modified_iso-e.modified_iso))[0];E.getChartContent(t).then((e=>{const t=e,i=JSON.parse(t.content);i.extendedData=e,ob.chartContent=JSON.stringify({json:i}),xb()})).catch(xb)})).catch(xb):xb();const Mb=async function(){if(l.enabled("saveload_separate_drawings_storage")){const e=await i.e(7129).then(i.bind(i,67387));return Bm=e.LineToolsSynchronizer,!0}return!1}(),Ib=(0,me.createDeferredPromise)();function Ab(){const e=TradingView.bottomWidgetBar;e&&e.turnOffMaximize()}Promise.all([Ib.promise,Pb.promise,QS.loadedCustomCss,Mb,cb.promise]).then((()=>{const e=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(new Date),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);const e=(0,n.ensureNotNull)(document.URL.match(new RegExp("(:?.*://)([^/]+)/.*")))[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")}var t,i,s,o,r,a})),(()=>{let e=!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=(()=>{const e=D.createGroup({desc:"API",order:yv.ACTION_API_GROUP_ORDER});return(t,i)=>{var s;e.add({hotkey:(s=t,"number"==typeof s?s:"string"==typeof s?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){const s={received:!1};QS.dispatchEvent(new CustomEvent("innerWindowLoad",{detail:s})),!s.received&&t{e(t+1,i)}),10*Math.pow(2,t))}(),QS.createButton=e=>{if(null===bb)throw new Error("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;const t=(0,fe.randomHash)();return bb.addButton(t,e)??t},QS.removeButton=e=>{if(null===bb)throw new Error("Cannot remove button: header widget is not ready or is not loaded - use `headerReady` to wait until header is ready");return bb.removeButton(e)},QS.createDropdown=e=>{if(void 0===e)throw new Error("Cannot create dropdown without any parameters. Please refer to the documentation");void 0===e.align&&(e.align="left");const t=(0,fe.randomHash)();return bb?(bb.addDropdown(t,e),Promise.resolve(new hv(bb,t))):wb.promise.then((()=>((0,n.ensureNotNull)(bb).addDropdown(t,e),new hv((0,n.ensureNotNull)(bb),t))))},QS.getAllFeatures=()=>{const e=l.getAllFeatures();return Object.keys(e).forEach((t=>{isNaN(parseFloat(t))||delete e[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,new Set(["connectionStatus"]);const Lb=ob.locale||"en",kb=Dt.getInstance();kb.createElement(document),kb.setLocale(Lb), +QS.customChartDescriptionFunction&&kb.setCustomProvider(QS.customChartDescriptionFunction);const Eb=Sm.getInstance();Eb.createElement(document),Eb.setLocale(Lb),function(){const e=l.enabled("accessible_keyboard_shortcuts")?(0,B.humanReadableHash)(9):`${(0,B.humanReadableModifiers)(B.Modifiers.Alt,!1)} + ${(0,B.humanReadableHash)(90)}`,t=`${(0,B.humanReadableModifiers)(B.Modifiers.Mod,!1)} + ${(0,B.humanReadableHash)(75)}`,s=a.t(null,void 0,i(7697)),o=[a.t(null,{replace:{shortcut:e}},i(85166)),a.t(null,{replace:{shortcut:t}},i(57959)),a.t(null,void 0,i(36332)),a.t(null,void 0,i(9687)),a.t(null,void 0,i(40490)),a.t(null,void 0,i(27884))],n=document.createElement("p");n.innerText=s;const r=document.createElement("ul");o.forEach((e=>{const t=document.createElement("li");t.innerText=e,r.appendChild(t)}));const c=document.createElement("div");c.setAttribute("role","contentinfo"),c.setAttribute("aria-hidden","false"),c.style.fontSize="0",c.appendChild(n),c.appendChild(r),document.body.insertBefore(c,document.body.firstChild)}(),window.addEventListener("keydown",(e=>{const t=(0,B.hashFromEvent)(e);9!==t&&t!==D.Modifiers.Shift+9||(0,pv.updateTabIndexes)()})),new zo.Action({actionId:"UnknownAction",options:{label:"",onExecute:()=>{(0,pv.updateTabIndexes)();const[e]=Array.from(document.querySelectorAll('button:not([disabled]):not([aria-disabled]):not([tabindex="-1"]), input:not([disabled]):not([aria-disabled]):not([tabindex="-1"]), [tabindex]:not([disabled]):not([aria-disabled]):not([tabindex="-1"])')).filter((0,mv.createScopedVisibleElementFilter)(document.documentElement)).sort(pv.navigationOrderComparator);void 0!==e&&e.focus()},hotkeyHash:l.enabled("accessible_keyboard_shortcuts")?9:D.Modifiers.Alt+90,hotkeyGroup:(0,D.createGroup)({desc:"Global shortcuts"})}})},52959:(e,t,i)=>{"use strict";function s(){return window}function o(){const e=s();return e.parent[e.urlParams.uid]}i.d(t,{getChartingLibraryGlobalContext:()=>s,getChartingLibraryOwner:()=>o})},29063:(e,t,i)=>{"use strict";i.r(t);var s=i(21097),o=i(51768),n=i(76422),r=i(38780);function a(e,t=!1){"loading"!==document.readyState?t?setTimeout((()=>e()),1):e():document.addEventListener("DOMContentLoaded",(()=>e()))}new Promise((e=>{a(e)}));function l(e,t="x"){let i=!1;return"x"!==t&&"both"!==t||(i=i||e.offsetWidth(t.nodeType===Node.TEXT_NODE&&e.push(t.textContent||""),e)),[]).join("").trim();return s?{ +type:"text",data:s}:{type:"none"}}function u(e,t){let i=!1;const s=e.children;for(let e=0;e{(0,r.hide)(),t.removeEventListener("blur",s),t.removeEventListener("active-descendant-blur",s)};t.addEventListener("blur",s),t.addEventListener("active-descendant-blur",s)}}a((()=>{document.addEventListener("mouseenter",(e=>{const t=e.target;if(t instanceof HTMLElement&&t.matches(".apply-overflow-tooltip")){const e=h(t);if(t.matches(".apply-overflow-tooltip--check-children-recursively")){if(!c(t,e))return}else if(t.matches(".apply-overflow-tooltip--check-children")){if(!u(t,e))return}else if(!l(t,e))return;(0,r.showOnElement)(t,{content:d(t)});const i=()=>{(0,r.hide)(),["mouseleave","mousedown"].forEach((e=>t.removeEventListener(e,i)))};["mouseleave","mousedown"].forEach((e=>t.addEventListener(e,i)))}}),!0),document.addEventListener("focus",_,!0),document.addEventListener("active-descendant-focus",_,!0)}));var p=i(48096),m=i(11417);var g=i(39527);function f(e){return()=>{e()}}var y=i(3343),v=i(34811),S=i(15754);const b=(e=document.documentElement,t)=>document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,(e=>t=>{if(1!==t.nodeType)return NodeFilter.FILTER_SKIP;const i=t;return(0,S.isInertRoot)(i)?NodeFilter.FILTER_REJECT:(0,S.isVisibilityVisible)(i)&&i.matches(e)?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP})(t));const w=(e=document.documentElement)=>b(e,S.FOCUSABLE_SELECTOR);const C=`[${v.FOCUS_TRAP_DATA_ATTRIBUTE}="true"]`;class T{constructor(){this._handleMouseDown=()=>{this._forwardTab=void 0},this._handleKeyDown=e=>{this._forwardTab=void 0,[9,y.Modifiers.Shift+9].includes((0,y.hashFromEvent)(e))&&(this._forwardTab=!e.shiftKey)},this._handleFocus=e=>{const t=e.target;if(void 0===this._forwardTab||!(t instanceof HTMLElement))return;const i=this._findDeepestFocusTrapElement(document.documentElement);if(!(i instanceof HTMLElement)||!i||i.contains(t))return;e.preventDefault(),e.stopPropagation(),t.blur();const s=i.compareDocumentPosition(t);if(s&Node.DOCUMENT_POSITION_PRECEDING||s&Node.DOCUMENT_POSITION_FOLLOWING){const e=this._forwardTab?x(i):x(i,!0);e instanceof HTMLElement&&e.focus()}},document.documentElement.addEventListener("focus",this._handleFocus,{capture:!0}),document.documentElement.addEventListener("keydown",this._handleKeyDown,{capture:!0}),document.documentElement.addEventListener("mousedown",this._handleMouseDown,{capture:!0})}destroy(){document.documentElement.removeEventListener("focus",this._handleFocus,{capture:!0}), +document.documentElement.removeEventListener("keydown",this._handleKeyDown,{capture:!0}),document.documentElement.removeEventListener("mousedown",this._handleMouseDown,{capture:!0})}_findDeepestFocusTrapElement(e){const t=e.querySelectorAll(C);let i=null,s=-1;return t.forEach((t=>{const o=this._calculateParentCount(t,e);o>s&&(s=o,i=t)})),i}_calculateParentCount(e,t){let i=0,s=e.parentElement;for(;s&&s!==t;)"true"===s.getAttribute(v.FOCUS_TRAP_DATA_ATTRIBUTE)&&i++,s=s.parentElement;return i}}const P=f((()=>new T));function x(e,t){return t?function(e){return function(e){for(e.currentNode=e.root;null!==e.lastChild(););return e.currentNode===e.root?null:e.currentNode}(w(e))}(e):function(e){return t=w(e),t.currentNode=t.root,t.nextNode();var t}(e)}const M=f((()=>{P()}));var I=i(99247);let A;function L(e){window.TVSettings&&window.TVSettings.sync(window.user.settings),window.is_authenticated?(e||(initOfferLoginStateChangeButton(),onGoPro()&&window.location.reload()),!1===window.user.profile_data_filled&&((0,o.trackEvent)("Conversion","First login"),delete window.user.profile_data_filled)):availableOffersWrapper.runOrUpdate((e=>{Object.keys(e).forEach((t=>{const i=t;e[i].available_for_anons||delete e[i]})),window.user={username:"Guest",following:"0",followers:"0",ignore_list:[],available_offers:e},m.TVLocalStorage.removeItem("trial_availiable")}))}A=window.loginStateChange?window.loginStateChange:window.loginStateChange=new p.Delegate,A.subscribe(null,L),s.TVXWindowEvents.on("loginStateChange",(e=>{const t=JSON.parse(e);window.user=t.user,window.is_authenticated=!!t.is_authenticated,A.fire()})),s.TVXWindowEvents.on("signOut",(()=>{!function(){if(window.initData.lfs){const e=document.getElementsByClassName("js-admin-warning")[0];document.body.removeChild(e)}let e=!0;[/^\/chart\//,/^\/share-your-love\//,/^\/pine\//].forEach((t=>{t.test(window.location.pathname)&&(e=!1)})),e&&window.location.reload()}()})),(()=>{const e="user-obj-changed",t={};window.crossTabSyncUserAttr=t=>{const i={};t instanceof Array?t.forEach((e=>{i[e]=window.user[e]})):i[t]=window.user[t],s.TVXWindowEvents.emit(e,JSON.stringify(i))},s.TVXWindowEvents.on(e,(e=>{const i=JSON.parse(e);let s;for(s in i)if(i.hasOwnProperty(s)){window.user[s]=i[s];(t[s]||[]).forEach((e=>{e.fire(i[s])}))}}))})(),window.TradingView.changeLoginState=e=>{window.is_authenticated=!!e,s.TVXWindowEvents.emit("loginStateChange",JSON.stringify({is_authenticated:window.is_authenticated,user:window.user})),window.is_authenticated&&n.emit("GLOBAL_EVENT_SIGN_IN_SUCCESS"),A.fire()},window.loginUser=function(e){window.user=(0,g.deepExtend)({},e),window.TradingView.changeLoginState(!0)},window.loginRequiredDelegate=new p.Delegate,window.runOrSignIn=(e,t)=>{t||(t={}),e()},window.onLoginStateChange=L,window.TradingView.setTrialAvailiable=e=>{m.TVLocalStorage.setItem("trial_availiable",e?"1":"0")},window.TradingView.notificationsChanged=new p.Delegate,M(),(0,I.initMouseClickAutoBlurHandler)()},43229:(e,t,i)=>{"use strict";i.d(t,{AsyncResourceWrapper:()=>s});class s{constructor(e,t){ +this._destroyed=!1,this._callbacks=[],this._resource={pendingResource:e},this._destroyFn=t,e.then((e=>{if(this._destroyed)this._destroyFn?.(e);else{this._resource.resource=e;for(const t of this._callbacks)t(e)}})).finally((()=>{this._callbacks=[]}))}destroy(){this._resource.resource&&this._destroyFn?.(this._resource.resource),this._resource={pendingResource:Promise.reject("Resource is destroyed").catch((()=>{}))},this._callbacks=[],this._destroyed=!0}callFunction(e){this._destroyed||(this._resource.resource?e(this._resource.resource):this._callbacks.push(e))}get(){return this._destroyed||!this._resource.resource?null:this._resource.resource}promise(){return this._resource.pendingResource}}},52859:(e,t,i)=>{"use strict";i.r(t),i.d(t,{alphaToTransparency:()=>r,applyAlpha:()=>n,applyTransparency:()=>l,colorFromBackground:()=>u,colorToInteger:()=>g,generateColor:()=>o,getLuminance:()=>h,gradientColorAtPercent:()=>_,isHexColor:()=>d,resetTransparency:()=>c,rgbaFromInteger:()=>p,rgbaToInteger:()=>m,transparencyToAlpha:()=>a});var s=i(24377);function o(e,t,i){if(t=t||0,!d(e))return i?(0,s.rgbaToString)((0,s.rgba)((0,s.parseRgb)(e),(0,s.normalizeAlphaComponent)(a(t)))):e;const[o,n,r]=(0,s.parseRgb)(e),l=(0,s.normalizeAlphaComponent)(a(t));return(0,s.rgbaToString)([o,n,r,l])}function n(e,t,i){const o=(0,s.tryParseRgba)(e);if(null===o)throw new Error(`Invalid color: ${e}`);const[n,r,a,l]=o,c=(0,s.normalizeAlphaComponent)(t*(i?l:1));return(0,s.rgbaToString)((0,s.rgba)([n,r,a],c))}function r(e){return 100*(1-e)}function a(e){if(e<0||e>100)throw new Error("invalid transparency");return 1-e/100}function l(e,t){if("transparent"===e)return e;const i=(0,s.parseRgba)(e),o=i[3];return(0,s.rgbaToString)((0,s.rgba)(i[0],i[1],i[2],a(t)*o))}function c(e){return"transparent"===e?e:d(e)?e.slice(0,7):(0,s.rgbaToString)((0,s.rgba)((0,s.parseRgb)(e),(0,s.normalizeAlphaComponent)(1)))}function h(e){const t=(0,s.parseRgb)(e).map((e=>(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)));return Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function d(e){return 0===e.indexOf("#")}function u(e){return"black"===(0,s.rgbToBlackWhiteString)((0,s.parseRgb)(e),150)?"#ffffff":"#000000"}function _(e,t,i){const[o,n,r,a]=(0,s.parseRgba)(e),[l,c,h,d]=(0,s.parseRgba)(t),u=(0,s.rgba)(Math.round(o+i*(l-o)),Math.round(n+i*(c-n)),Math.round(r+i*(h-r)),a+i*(d-a));return(0,s.rgbaToString)(u)}function p(e){const t=(e=Math.round(e))%256;e-=t;const i=(e/=256)%256;e-=i;const s=(e/=256)%256;e-=s;return`rgba(${t},${i},${s},${(e/=256)/255})`}function m(e){const t=Math.round(255*e[3]);return e[0]+256*e[1]+65536*e[2]+16777216*t}function g(e){const t=(0,s.tryParseRgba)(e);return null===t?0:m(t)}},29970:(e,t,i)=>{"use strict";i.d(t,{colorsAreCloseEnough:()=>h,isColorDark:()=>_});var s,o=i(81251),n=i(24377);function r(e){return e<0&&(e+=2*Math.PI),e}function a(e,t){ +const[i,s,o]=e,[n,a,l]=t,c=(Math.sqrt(s**2+o**2)+Math.sqrt(a**2+l**2))/2,h=.5*(1-Math.sqrt(Math.pow(c,7)/(Math.pow(c,7)+6103515625))),d=(1+h)*s,u=(1+h)*a,_=Math.sqrt(d*d+o*o),p=Math.sqrt(u*u+l*l),m=0===o&&0===d?0:r(Math.atan2(o,d)),g=0===l&&0===u?0:r(Math.atan2(l,u)),f=n-i,y=p-_;let v;const S=_*p;0===S?v=0:(v=g-m,v<-Math.PI?v+=2*Math.PI:v>Math.PI&&(v-=2*Math.PI));const b=2*Math.sqrt(S)*Math.sin(v/2),w=(i+n)/2,C=(_+p)/2;let T;const P=m+g;T=_*p==0?P:Math.abs(m-g)<=Math.PI?P/2:P<2*Math.PI?(P+2*Math.PI)/2:(P-2*Math.PI)/2;const x=1-.17*Math.cos(T-Math.PI/6)+.24*Math.cos(2*T)+.32*Math.cos(3*T+Math.PI/30)-.2*Math.cos(4*T-Math.PI/180*63),M=Math.PI/6*Math.exp(-Math.pow((T-Math.PI/180*275)/(Math.PI/180*25),2)),I=2*Math.sqrt(Math.pow(C,7)/(Math.pow(C,7)+6103515625)),A=1+.015*Math.pow(w-50,2)/Math.sqrt(20+Math.pow(w-50,2)),L=1+.045*C,k=1+.015*C*x,E=-Math.sin(2*M)*I;return Math.sqrt(Math.pow(f/(1*A),2)+Math.pow(y/(1*L),2)+Math.pow(b/(1*k),2)+E*(y/(1*L))*(b/(1*k)))}!function(e){e[e.Pow25In7=6103515625]="Pow25In7",e[e.LWeight=1]="LWeight",e[e.CWeight=1]="CWeight",e[e.HWeight=1]="HWeight"}(s||(s={}));const l=[127,127,127];function c(e){const t=e[3],i=e.slice(0,3);for(let e=0;e<3;e++)i[e]=Math.round(i[e]*t+l[e]*(1-t));return i}function h(e,t){return a(g(p(c((0,n.parseRgba)(e)))),g(p(c((0,n.parseRgba)(t)))))<3}const d=(0,o.default)((()=>g(p([0,0,0])))),u=(0,o.default)((()=>g(p([255,255,255]))));function _(e){const t=g(p(c((0,n.parseRgba)(e))));return a(t,d()).04045?Math.pow((o+.055)/1.055,2.4):o/12.92),l=100*(n>.04045?Math.pow((n+.055)/1.055,2.4):n/12.92),c=100*(r>.04045?Math.pow((r+.055)/1.055,2.4):r/12.92);return[.4124*a+.3576*l+.1805*c,.2126*a+.7152*l+.0722*c,.0193*a+.1192*l+.9505*c]}var m;function g(e){const[t,i,s]=e,o=t/95.047,n=i/100,r=s/108.883,a=o>.008856?Math.pow(o,1/3):7.787*o+16/116,l=n>.008856?Math.pow(n,1/3):7.787*n+16/116;return[116*l-16,500*(a-l),200*(l-(r>.008856?Math.pow(r,1/3):7.787*r+16/116))]}!function(e){e[e.X=95.047]="X",e[e.Y=100]="Y",e[e.Z=108.883]="Z"}(m||(m={}))},22961:(e,t,i)=>{"use strict";function s(e,t,i){return e*(1-i)+t*i}i.d(t,{doAnimate:()=>r,lerp:()=>s});const o={from:0,duration:250,easing:i(76662).easingFunc.easeOutCubic};class n{constructor(e){this._doing=!0,this._completed=!1,this._options={...o,...e};const t=performance.now();window.requestAnimationFrame((e=>{this._animation(t,this._options.from,e)}))}stop(){this._doing=!1}completed(){return this._completed}_animation(e,t,i){if(!this._doing)return void this._finishAnimation();const o=(i=!i||i<1e12?performance.now():i)-e,n=o>=this._options.duration||t===this._options.to,r=s(this._options.from,this._options.to,this._options.easing(o/this._options.duration)),a=n?this._options.to:r,l=a-t;this._options.onStep(l,a),n?this._finishAnimation():window.requestAnimationFrame((t=>{this._animation(e,a,t)}))}_finishAnimation(){this._options.onComplete&&this._options.onComplete(),this._completed=!0}}function r(e){return new n(e)}},32925:(e,t,i)=>{"use strict";i.d(t,{fetch:()=>o}) +;var s=i(9343);new class{constructor(e,t){this._test=e[t]={}}provide(e,t){this._test[e]=t}}(window,"qaGlobals"),(0,s.getLogger)("Fetch");function o(e,t,i={}){return window.fetch(e,t)}},67225:(e,t,i)=>{"use strict";i.d(t,{GradientColorCache:()=>o});var s=i(52859);class o{constructor(){this._color1="",this._color2="",this._colors=new Map}gradientColor(e,t,i){if(t===e)return t;i=Math.max(0,Math.min(100,Math.round(100*i))),this._color1===e&&this._color2===t||(this._colors.clear(),this._color1=e,this._color2=t);let o=this._colors.get(i);return void 0===o&&(o=(0,s.gradientColorAtPercent)(e,t,i/100),this._colors.set(i,o)),o}}},49251:(e,t,i)=>{"use strict";function s(e,t,i,s){return`${s?s+" ":""}${i?i+" ":""}${e}px ${t}`}i.d(t,{makeFont:()=>s,parseFont:()=>n});const o=/(bold )?(italic )?(\d+)(px|pt) (.*)$/;function n(e){const t=o.exec(e);return null===t?null:{family:t[5],size:parseInt(t[3])*("pt"===t[4]?.75:1),bold:Boolean(t[1]),italic:Boolean(t[2])}}},18113:(e,t,i)=>{"use strict";i.d(t,{getPersistentLogger:()=>o});let s=null;function o(){return s}},24640:(e,t,i)=>{"use strict";i.r(t),i.d(t,{detectAutoDirection:()=>b,forceLTRStr:()=>u,forceLTRStrSsr:()=>_,forceRTLStr:()=>m,getLTRScrollLeft:()=>g,getLTRScrollLeftOffset:()=>f,isRtl:()=>o,startWithLTR:()=>d,stripLTRMarks:()=>h,stripLTRStrSsr:()=>p});var s=i(64531);const o=()=>"rtl"===window.document.dir,n="‎",r="‪",a="‫",l="‬",c=new RegExp(n+"|"+r+"|"+a+"|"+l,"g");function h(e){return""!==e&&o()&&null!=e?e.replace(c,""):e}function d(e){return""!==e&&o()&&null!=e?n+e:e}function u(e){return""!==e&&o()&&null!=e?r+e+l:e}function _(e){return r+e+l}function p(e){return e.startsWith(r)&&e.endsWith(l)?e.slice(1,-1):e}function m(e){return""!==e&&o()&&null!=e?a+e+l:e}function g(e){return(0,s.getNormalizedScrollLeft)(e,"rtl")}function f(e,t){const i=(0,s.detectScrollType)();if("indeterminate"===i)return 0;switch(i){case"negative":t=e.clientWidth-e.scrollWidth+t;break;case"reverse":t=e.scrollWidth-e.clientWidth-t}return t}var y;!function(e){e.LTR="ltr",e.RTL="rtl",e.UNKNOWN=""}(y||(y={}));const v=/[^\u0000-\u0040\u005B-\u0060\u007B-\u00BF\u00D7\u00F7\u02B9-\u02FF\u2000-\u200E\u2010-\u2029\u202C\u202F-\u2BFF]/,S=/[\u0590-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC]/;function b(e){const t=v.exec(e);return t?S.test(t[0])?"rtl":"ltr":""}},76662:(e,t,i)=>{"use strict";i.d(t,{CubicBezier:()=>s.CubicBezier,dur:()=>s.dur,easingFunc:()=>s.easingFunc});var s=i(74991)},59672:(e,t,i)=>{"use strict";function s(){return Promise.all([i.e(6342),i.e(8185),i.e(2202),i.e(8894),i.e(5743),i.e(6954),i.e(2227),i.e(2077)]).then(i.bind(i,3014))}i.d(t,{loadChangeIntervalDialog:()=>s})},59613:(e,t,i)=>{"use strict";i.d(t,{showChangeIntervalDialogAsync:()=>n});var s=i(59672);let o=null;function n(e){const t=o=(0,s.loadChangeIntervalDialog)().then((i=>{t===o&&i.showChangeIntervalDialog(e)}));return t}},92572:(e,t,i)=>{"use strict";function s(e){ +return Promise.all([i.e(7629),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(2537),i.e(8894),i.e(5743),i.e(9487),i.e(3329),i.e(4678),i.e(4059),i.e(861),i.e(2227),i.e(9418),i.e(3179),i.e(4426),i.e(9928),i.e(8604),i.e(1859)]).then(i.bind(i,62256)).then((t=>t.showGoToDateDialog(e)))}i.d(t,{showGoToDateDialog:()=>s})},70347:(e,t,i)=>{"use strict";i.d(t,{runOrSigninWithFeature:()=>s});const s=(e,t)=>{e()};window.TradingView.runOrSigninWithFeature=s},16708:(e,t,i)=>{"use strict";i.d(t,{DeleteLockedLineToolReason:()=>s,confirmRemovingLockedLineTools:()=>d,showDeleteLockedLineToolsConfirm:()=>h});var s,o=i(11542),n=i(3615),r=i(5734),a=i(89947);!function(e){e[e.RemoveSelected=0]="RemoveSelected",e[e.RemoveAll=1]="RemoveAll"}(s||(s={}));const l=o.t(null,void 0,i(41019)),c=o.t(null,void 0,i(41019));async function h(e,t){if(r.doNotShowDeleteLockedLineConfirmProperty.value())return void t(a.deleteLockedLineToolsProperty.value());const{getContent:h}=await Promise.all([i.e(7328),i.e(3425),i.e(6052),i.e(1065),i.e(4598)]).then(i.bind(i,30627));(0,n.showConfirm)({title:o.t(null,void 0,i(71692)),content:h(e===s.RemoveSelected?l:c),id:`${r.doNotShowDeleteLockedLineKey}-confirm`,mainButtonText:o.t(null,void 0,i(93123)),mainButtonIntent:"danger",cancelButtonText:o.t(null,void 0,i(99024)),onConfirm:({dialogClose:e})=>{r.doNotShowDeleteLockedLineConfirmProperty.value()&&a.deleteLockedLineToolsProperty.setValue(!0),t(!0),e()},onCancel:({dialogClose:e})=>{r.doNotShowDeleteLockedLineConfirmProperty.value()&&a.deleteLockedLineToolsProperty.setValue(!1),t(!1),e()}})}function d(e){return new Promise((t=>{h(e,t)}))}},31237:(e,t,i)=>{"use strict";i.d(t,{showDeleteStudyTreeConfirm:()=>r});var s=i(11542),o=i(3615);const n=5;function r(e,t){let r,a="";if(e.length>n){const t=e.length-n+1;r=e.slice(0,n-1),a=s.t(null,{plural:"and {nameCount} more indicators.",count:t},i(31550)).format({nameCount:t.toString()})}else r=e;const l='
    '+r.map((e=>`
  • ${e}
  • `)).join("")+"
"+a,c=s.t(null,void 0,i(4995))+l;(0,o.showConfirm)({title:s.t(null,void 0,i(97767)),html:c,mainButtonText:s.t(null,void 0,i(67410)),mainButtonIntent:"danger",cancelButtonText:s.t(null,void 0,i(4543)),onConfirm:({dialogClose:e})=>{t(),e()}})}},10341:(e,t,i)=>{"use strict";i.d(t,{showTooManyStudiesNotice:()=>n});var s=i(11542),o=i(3615);function n(e){(0,o.showWarning)({title:s.t(null,void 0,i(66719)),text:s.t(null,{replace:{number:`${e}`}},i(86146))})}},55279:(e,t,i)=>{"use strict";i.d(t,{getAdditionalSymbolInfoFields:()=>n,setAdditionalSymbolInfoFields:()=>o});let s=[];function o(e){s=e}function n(){return s}},84526:(e,t,i)=>{"use strict";function s(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}) +;var s=i(50279),o=i(50151),n=(i(11542),i(14411)),r=i(23024),a=i(48096),l=i(37103),c=i(81593);function h(e,t){e.content=JSON.stringify(t)}new WeakMap;new TextEncoder;class d{constructor(e){this._prevChartState=null,this._chartSavedDelegate=new a.Delegate,this._chartAboutToBeSavedDelegate=new a.Delegate,this._chartSizeLimitExceededDelegate=new a.Delegate,this._isSaveInProcess=!1,this._savingToken=null,this._chartWidgetCollection=e}async saveChartLineTools(e,t,s,o){if(l.enabled("saveload_separate_drawings_storage")){const n=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){const e=this._chartWidgetCollection.metaInfo.uid.value();l(e)}}),!0);const{SavingLineToolsLibraryError:e}=await i.e(5565).then(i.bind(i,98653));throw new e("Layout ID not yet created.",!0)}return l(a)}return Promise.reject("Line tools storage is not supported")}layoutId(){return this._chartWidgetCollection.metaInfo.uid.value()}saveChartSilently(e,t,i){const s=i||{};this._isSaveInProcess=!0,this._chartAboutToBeSavedDelegate.fire(),this._saveChart((e=>{const t=e&&l.enabled("saveload_separate_drawings_storage"),i=this._getChartWidgetCollectionState(!1,void 0,void 0,void 0,t),o=this._getCommonSavingInfo(!1);return h(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&&delete this._prevChartState.savingToken}),(e=>{this._chartSavedDelegate.fire(!1),this._isSaveInProcess=!1,t&&t(e)}),s)}saveToJSON(e){const t=e&&!1===e.includeDrawings||void 0,i=this._getCommonSavingInfo(!1);return h(i,this._getChartWidgetCollectionState(!1,!0,t,void 0,t)),i}isSaveInProcess(){return this._isSaveInProcess}_getChartWidgetCollectionState(e,t,i,s,o){let n=!1;return e?n=!0:(t=!0,s=!1),this._chartWidgetCollection.state({withData:!!e,skipLineToolsFromOtherSymbols:!!i,wipeSensitiveData:!!s,skipLineTools:o,skipHiddenSources:n,addOnlyActiveChart:!t})}_getCommonSavingInfo(e){const t=this._chartWidgetCollection,i=this._chartWidgetCollection.chartsSymbols()[t.activeChartWidget.value().id()],s={...(o=i,{...o,legs:JSON.stringify(o.legs??[])})};var o;const n=t.metaInfo,r=n.id.value();return null!==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)=>{const i=t.lineToolsSynchronizer();if(i){e[0]||=i.hasUnsavedMigrationsFromChartState();const t=i.flushPendingSavings();t&&e[1].push(t)}return e}),[!1,[]]);return t.length&&await Promise.all(t),t.length>0&&e}return!1 +}_invalidateAllLineTools(){this._chartWidgetCollection.getAll().forEach((e=>e.lineToolsSynchronizer()?.invalidateAll()))}_saveChartImpl(e,t,i,s,o,n){let r;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((async e=>{const t=e instanceof Response?e:void 0,i=e instanceof Error?e:void 0;this._savingToken=null;const o=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){const a=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()};let h=r.changes??n.changedAll;l.enabled("saveload_separate_drawings_storage")&&this._invalidateAllLineTools();let d=!0;if(2&h||l.enabled("saveload_separate_drawings_storage"))try{await this._saveLineToolsToStorage()&&(h|=1)}catch(e){h|=1;const{SavingLineToolsLibraryError:t}=await i.e(5565).then(i.bind(i,98653));e instanceof t&&e.safe||(d=!1)}if(1&h){const i=e(d);if((0,s.default)(this._prevChartState,i)&&null!==c.id)return this._chartSavedDelegate.fire(!0),void t(c,i);0;const n=(e,i)=>(d||this._chartWidgetCollection.getAll().forEach((e=>e.lineToolsSynchronizer()?.markAsValidatedBecauseOfSavingToContent())),t(e,i));return this._saveChartImpl(i,c,n,o,r,e)}this._chartSavedDelegate.fire(!0),t(c,e(d))}}},71846:(e,t,i)=>{"use strict";var s=i(12362).ChartSaverBase;i.i18next(null,void 0,i(49947));t.ChartSaver=class extends s{constructor(e){super(e)}chartSizeLimitExceeded(){return this._chartSizeLimitExceededDelegate}chartAboutToBeSaved(){return this._chartAboutToBeSavedDelegate}chartSaved(){return this._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){return this.isScriptNameValid(e)&&this.isScriptDescriptionValid(t)}openInNewTab(e,t,i){e.publishInProgress=!0,i||this.isScriptDescribersValid(t.name,t.description)&&undefined(new Promise((function(t){e.setPopupUrl=t})))}onPublish(e,t){}}},19e3:(e,t,i)=>{"use strict";i.d(t,{getTranslatedSymbolDescription:()=>s});i(11542);function s(e){return e.description||""}},29242:(e,t,i)=>{"use strict";function s(e){return e+"…"}i.d(t,{appendEllipsis:()=>s})},58043:(e,t,i)=>{"use strict";function s(e){let t;if("object"!=typeof e||null==e||"number"==typeof e.nodeType)t=e;else if(e instanceof Date)t=new Date(e.valueOf());else if(Array.isArray(e)){t=[];let i=0;const o=e.length;for(;is})},39527:(e,t,i)=>{"use strict" +;function s(e,...t){return e&&"object"==typeof e?(0===t.length||t.forEach((t=>{null!=t&&"object"==typeof t&&Object.keys(t).forEach((i=>{const n=e[i],r=t[i];if(r===e)return;const a=Array.isArray(r);if(r&&(o(r)||a)){let t;t=a?n&&Array.isArray(n)?n:[]:n&&o(n)?n:{},e[i]=s(t,r)}else void 0!==r&&(e[i]=r)}))})),e):e}function o(e){if(!e||"[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);if(!t)return!0;const i=Object.hasOwnProperty.toString,s=t.hasOwnProperty("constructor")&&t.constructor;return"function"==typeof s&&i.call(s)===i.call(Object)}i.d(t,{deepExtend:()=>s})},88723:(e,t,i)=>{"use strict";function s(){let e,t;return{promise:new Promise(((i,s)=>{e=i,t=s})),reject:t,resolve:e}}i.d(t,{createDeferredPromise:()=>s})},39058:(e,t,i)=>{"use strict";function s(e){if(void 0===e)return"";if(e instanceof Error){let t=e.message;return e.stack&&(t+=" "+e.stack),t}return"string"==typeof e?e.toString():JSON.stringify(e)}i.d(t,{errorToString:()=>s})},4168:(e,t,i)=>{"use strict";i.r(t),i.d(t,{guid:()=>s.guid,randomHash:()=>s.randomHash,randomHashN:()=>s.randomHashN});var s=i(4226)},50470:(e,t,i)=>{"use strict";i.d(t,{parseHtml:()=>n,parseHtmlElement:()=>r});const s=new WeakMap;var o;function n(e,t){let i,o;return i=null==t?document.documentElement:9===t.nodeType?t.documentElement:t,s&&(o=s.get(i)),o||(o=i.ownerDocument.createRange(),o.selectNodeContents(i),s&&s.set(i,o)),o.createContextualFragment(e)}function r(e,t){const i=n(e,t),s=i.firstElementChild;return null!==s&&i.removeChild(s),s}!function(e){e[e.Element=1]="Element",e[e.Document=9]="Document"}(o||(o={}))},26867:(e,t,i)=>{"use strict";function s(e){e.preventDefault()}i.d(t,{preventDefault:()=>s,preventDefaultForContextMenu:()=>n});const o=["input:not([type])",'input[type="text"]','input[type="email"]','input[type="password"]','input[type="search"]','input[type="number"]','input[type="url"]',"textarea","a[href]",'*[contenteditable="true"]',"[data-allow-context-menu]"];function n(e){const t=e.target;t&&!t.closest(o.join(", "))&&e.preventDefault()}},53470:(e,t,i)=>{"use strict";function s(e){return e.reduce((function(e,t,i){return~e.indexOf(t)||e.push(t),e}),[])}i.r(t),i.d(t,{uniq:()=>s})},34369:e=>{e.exports=''},93544:e=>{e.exports=''},53573:e=>{ +e.exports=''},34487:e=>{e.exports=''},11890:e=>{e.exports=''},5845:e=>{e.exports=''},94839:e=>{e.exports=''},29453:e=>{e.exports=''},50946:e=>{e.exports=''},70893:e=>{ e.exports=''},1457:e=>{ e.exports=''},55824:e=>{e.exports=''},99875:e=>{e.exports=''},2872:e=>{e.exports=''},7983:e=>{e.exports=''},39267:e=>{e.exports=''},16911:e=>{e.exports=''},6862:e=>{e.exports=''},54190:e=>{e.exports=''},25191:e=>{ e.exports=''},93379:e=>{e.exports=''},84959:e=>{e.exports=''},97874:e=>{e.exports=''},1866:e=>{ diff --git a/charting_library/bundles/runtime.ddf792da21403fea7e07.js b/charting_library/bundles/runtime.06e455b5bc27a2ed7f94.js similarity index 78% rename from charting_library/bundles/runtime.ddf792da21403fea7e07.js rename to charting_library/bundles/runtime.06e455b5bc27a2ed7f94.js index c46686c9..5e633eb5 100644 --- a/charting_library/bundles/runtime.ddf792da21403fea7e07.js +++ b/charting_library/bundles/runtime.06e455b5bc27a2ed7f94.js @@ -1,9 +1,9 @@ (()=>{"use strict";var e,a,c,d,f,b={},t={};function o(e){var a=t[e];if(void 0!==a)return a.exports;var c=t[e]={id:e,loaded:!1,exports:{}};return b[e].call(c.exports,c,c.exports,o),c.loaded=!0,c.exports}o.m=b,o.c=t,o._plural={ar:(e,a=6,c=(0==e?0:1==e?1:2==e?2:e%100>=3&&e%100<=10?3:e%100>=11&&e%100<=99?4:5))=>null==e?0:+c,cs:(e,a=3,c=(1==e?0:e>=2&&e<=4?1:2))=>null==e?0:+c,ru:(e,a=3,c=(e%10==1&&e%100!=11?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2))=>null==e?0:+c,ro:(e,a=3,c=(1==e?0:e%100>19||e%100==0&&0!=e?2:1))=>null==e?0:+c,pl:(e,a=3,c=(1==e?0:e%10>=2&&e%10<=4&&(e%100<10||e%100>=20)?1:2))=>null==e?0:+c,pt:(e,a=2,c=1!=e)=>null==e?0:+c,de:(e,a=2,c=1!=e)=>null==e?0:+c,en:(e,a=2,c=1!=e)=>null==e?0:+c,es:(e,a=2,c=1!=e)=>null==e?0:+c,sv:(e,a=2,c=1!=e)=>null==e?0:+c,it:(e,a=2,c=1!=e)=>null==e?0:+c,tr:(e,a=2,c=1!=e)=>null==e?0:+c,el:(e,a=2,c=1!=e)=>null==e?0:+c,fr:(e,a=2,c=e>1)=>null==e?0:+c,fa:(e,a=1,c=0)=>null==e?0:+c,ja:(e,a=1,c=0)=>null==e?0:+c,ko:(e,a=1,c=0)=>null==e?0:+c,th:(e,a=1,c=0)=>null==e?0:+c,vi:(e,a=1,c=0)=>null==e?0:+c,zh:(e,a=1,c=0)=>null==e?0:+c,he_IL:(e,a=4,c=(1==e?0:2==e?1:e>10&&e%10==0?2:3))=>null==e?0:+c,ca_ES:(e,a=2,c=1!=e)=>null==e?0:+c,nl_NL:(e,a=2,c=1!=e)=>null==e?0:+c,hu_HU:(e,a=2,c=1!=e)=>null==e?0:+c,id_ID:(e,a=1,c=0)=>null==e?0:+c,ms_MY:(e,a=1,c=0)=>null==e?0:+c,zh_TW:(e,a=1,c=0)=>null==e?0:+c},e=[],o.O=(a,c,d,f)=>{if(!c){var b=1/0;for(r=0;r=f)&&Object.keys(o.O).every((e=>o.O[e](c[l])))?c.splice(l--,1):(t=!1,f0&&e[r-1][2]>f;r--)e[r]=e[r-1];e[r]=[c,d,f]},o.n=e=>{var a=e&&e.__esModule?()=>e.default:()=>e;return o.d(a,{a}),a},c=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,o.t=function(e,d){if(1&d&&(e=this(e)),8&d)return e;if("object"==typeof e&&e){if(4&d&&e.__esModule)return e;if(16&d&&"function"==typeof e.then)return e}var f=Object.create(null);o.r(f);var b={};a=a||[null,c({}),c([]),c(c)];for(var t=2&d&&e;"object"==typeof t&&!~a.indexOf(t);t=c(t))Object.getOwnPropertyNames(t).forEach((a=>b[a]=()=>e[a]));return b.default=()=>e,o.d(f,b),f},o.d=(e,a)=>{for(var c in a)o.o(a,c)&&!o.o(e,c)&&Object.defineProperty(e,c,{enumerable:!0,get:a[c]})},o.f={},o.e=e=>Promise.all(Object.keys(o.f).reduce(((a,c)=>(o.f[c](e,a),a)),[])), o.u=e=>7617===e?"__LANG__.7617.cd80164477ae293d1bdf.js":8370===e?"__LANG__.8370.fa349b4816cd5b9bc50e.js":3721===e?"__LANG__.3721.cb0d7b01382649fffd1d.js":3581===e?"__LANG__.3581.29b14493cc3e702d776e.js":5121===e?"__LANG__.5121.a92442628878335f4f3c.js":7336===e?"__LANG__.7336.6e18afbcefc01fb0a06e.js":2346===e?"__LANG__.2346.a49a3f3441f33cfb055f.js":9520===e?"__LANG__.9520.56af53115bbb024475fe.js":91===e?"__LANG__.91.cfe4af4f43df761935ee.js":7871===e?"__LANG__.7871.59122d3f77e952e748d7.js":4040===e?"__LANG__.4040.6a01859316957dfa346e.js":8955===e?"__LANG__.8955.700afc0c6907cb35f040.js":2578===e?"__LANG__.2578.938cf92f5dab5e5b0f6a.js":3198===e?"__LANG__.3198.c73543d008f163aced66.js":3644===e?"__LANG__.3644.019797455a157bd8d965.js":1550===e?"__LANG__.1550.c851f7f3d80aa5a0a934.js":6342===e?"__LANG__.6342.85f957808125f840ce9a.js":8836===e?"__LANG__.8836.0ee8ffb3a9c55b7b58b3.js":4856===e?"__LANG__.4856.c3871a39af69453cb6ce.js":5234===e?"__LANG__.5234.986cc7933e7bf3aef5ec.js":2342===e?"__LANG__.2342.b15afe64e782db72472d.js":9426===e?"__LANG__.9426.516b9333f7265e656acf.js":6645===e?"__LANG__.6645.7ba6974e274efb237aba.js":3355===e?"__LANG__.3355.ac5731fdbc557b4fa953.js":3181===e?"__LANG__.3181.6f1f41b2f4a774e55fab.js":8896===e?"__LANG__.8896.55c7f87523b7cd780aed.js":9494===e?"__LANG__.9494.f0f29843a7ef74e68b5a.js":1427===e?"__LANG__.1427.108225f7c40f4967981f.js":7952===e?"__LANG__.7952.85afde6421df8ba2eb90.js":1308===e?"__LANG__.1308.bf60d54f92e58a11cef1.js":6760===e?"__LANG__.6760.f123afd5d94dec4ab450.js":6155===e?"__LANG__.6155.1bb6d590d58258e4ca2b.js":2303===e?"__LANG__.2303.b9f2005c3298b17e69c5.js":1432===e?"__LANG__.1432.16a1c5ab4a09534bf143.js":8763===e?"__LANG__.8763.1b022d608d6fadf0e635.js":7850===e?"__LANG__.7850.345c7f95940b47ec4aa3.js":7122===e?"__LANG__.7122.9f21877d4815945ac06f.js":4543===e?"__LANG__.4543.7f9d6f608dc178e710a6.js":5111===e?"__LANG__.5111.c4904e57d6f3d3bab2bf.js":5402===e?"__LANG__.5402.19446f1f611894261d5a.js":6290===e?"__LANG__.6290.a78fc99d10230f3f6323.js":8736===e?"__LANG__.8736.4e59a9d79d389b2f9ccd.js":7598===e?"__LANG__.7598.37348e19233483f5b004.js":3240===e?"__LANG__.3240.cbd133da26a90520ef36.js":4752===e?"__LANG__.4752.4b2e6ffeff801779d651.js":4109===e?"__LANG__.4109.f06cf21015312cc5fb37.js":1095===e?"__LANG__.1095.2b72aa95ba31c5a3e7d2.js":8975===e?"__LANG__.8975.32960d0fab142040a5de.js":3462===e?"__LANG__.3462.d46273e3a7aeebabb3ce.js":6778===e?"__LANG__.6778.7e992b7f13f1141f18e1.js":8622===e?"__LANG__.8622.0923d68d9f576c1c99b8.js":7629===e?"__LANG__.7629.f0fcaddae9863eeae12f.js":7328===e?"__LANG__.7328.846a89c55684c7825f53.js":6729===e?"__LANG__.6729.8f853252801947d589ee.js":8535===e?"__LANG__.8535.3d432e94419675297fed.js":5700===e?"__LANG__.5700.7faeb0b70cce839eea0c.js":1715===e?"__LANG__.1715.cdf667ccc2f352cc7781.js":1874===e?"__LANG__.1874.6736f182b5b04f0b0337.js":1629===e?"__LANG__.1629.ae7b8f399cea7d558be2.js":1861===e?"__LANG__.1861.7dfa9c241aa5b48b3e82.js":7037===e?"__LANG__.7037.07cb1c1fbb6b7560f350.js":({92:"chart-screenshot-hint",139:"get-error-card",319:"line-tool-table", 341:"line-tool-schiff-pitchfork2",360:"demonstration-highlighter",380:"line-tool-price-note",507:"study-pane-views",569:"line-tool-arrow-mark",574:"line-tool-horizontal-ray",607:"study-property-pages-with-definitions",620:"tablecontext-menu",688:"line-tool-callout",731:"add-compare-dialog",906:"line-tool-fib-speed-resistance-fan",925:"line-tool-extended",961:"line-tool-path",1155:"line-tool-5points-pattern",1277:"line-tool-balloon",1282:"line-tool-vertical-line",1313:"line-tool-pitch-fan",1314:"line-tool-position",1455:"line-tool-date-and-price-range",1470:"line-tool-arrow-marker",1506:"line-tool-fib-timezone",1583:"lt-pane-views",1584:"context-menu-renderer",1713:"line-tool-sine-line",1754:"symbol-search-dialog",1859:"go-to-date-dialog-impl",1890:"line-tools-icons",1963:"line-tool-gann-complex",2050:"line-tool-parallel-channel",2077:"change-interval-dialog",2087:"line-tool-highlighter",2183:"study-inputs-pane-views",2232:"line-tool-order",2283:"line-tool-fib-channel",2306:"floating-toolbars",2312:"line-tool-text",2377:"hammerjs",2413:"custom-themes-api",2704:"currency-label-menu",2816:"line-tool-fib-circles",2878:"drawing-toolbar",2962:"chart-floating-tooltip",3005:"header-toolbar",3030:"new-confirm-inputs-dialog",3248:"line-tool-note",3314:"line-tool-fib-wedge",3378:"line-tool-head-and-shoulders",3383:"line-tool-triangle-pattern",3555:"price-scale-mode-buttons-renderer",3596:"general-property-page",3710:"line-tool-fib-speed-resistance-arcs",3723:"line-tool-fib-retracement",3866:"line-tool-poly-line",3945:"line-tool-projection",3952:"line-tool-risk-reward",3966:"line-tool-comment",4013:"custom-intervals-add-dialog",4015:"line-tool-rotated-rectangle",4079:"series-pane-views",4201:"line-tool-horizontal-line",4273:"line-tool-date-range",4389:"take-chart-image-impl",4598:"delete-locked-line-confirm-dialog-content",4602:"line-tool-three-drivers",4674:"line-tool-signpost",4731:"line-tool-trend-based-fib-extension",4862:"object-tree-dialog",4934:"line-tool-ray",4981:"line-tool-gann-fan",5009:"load-chart-dialog",5055:"line-tool-pitchfork",5093:"chart-widget-gui",5122:"line-tool-brush",5206:"line-tool-bars-pattern",5231:"line-tool-image",5248:"library-studies",5283:"line-tool-abcd",5500:"line-tool-anchored-vwap",5516:"restricted-toolset",5529:"line-tool-emoji",5551:"favorite-drawings-api",5565:"ichart-storage",5572:"chart-floating-tooltip-activation-hint",5592:"chart-text-editor-renderer",5598:"lt-stickers-atlas",5639:"currency-label-menu-events",5695:"line-tool-volume-profile",5967:"line-tool-arc",6124:"chart-storage-library-http",6166:"chart-event-hint",6265:"new-edit-object-dialog",6336:"line-tool-gann-fixed",6432:"line-tool-triangle",6456:"study-market",6477:"line-tool-price-range",6484:"line-tool-price-label",6602:"chart-actions-provider",6631:"study-template-dialog",6740:"line-tool-cypher-pattern",6748:"line-tool-circle",6780:"source-properties-editor",7038:"insert-image-dialog",7078:"general-chart-properties-dialog",7127:"line-tool-trend-based-fib-time",7129:"line-tools-synchronizer",7175:"line-tool-schiff-pitchfork", -7203:"line-tool-cross-line",7260:"chart-bottom-toolbar",7271:"compare-model",7488:"line-tool-info-line",7539:"studies",7553:"react-popper",7563:"line-tool-ghost-feed",7648:"show-theme-save-dialog",7660:"line-tool-ellipse",7806:"line-tool-icon",7987:"lt-icons-atlas",8020:"user-defined-bars-marks-tooltip",8061:"line-tool-bezier-quadro",8090:"line-tool-fib-spiral",8313:"chart-storage-external-adapter",8334:"line-tool-time-cycles",8372:"line-tool-trend-angle",8422:"line-tool-rectangle",8468:"line-tool-inside-pitchfork",8537:"lt-property-pages-with-definitions",8607:"line-tool-arrow",8673:"line-tool-trend-line",8820:"line-tool-flag-mark",8890:"simple-dialog",8949:"line-tool-sticker",9014:"line-tool-bezier-cubic",9039:"lollipop-tooltip-renderer",9123:"line-tool-text-note",9310:"line-tool-flat-bottom",9374:"symbol-info-dialog-impl",9445:"line-tool-cyclic-lines",9478:"line-tool-gann-square",9498:"export-data",9534:"line-tool-prediction",9581:"line-tool-disjoint-channel",9685:"series-icons-map",9748:"line-tool-regression-trend",9754:"global-search-dialog",9790:"favorite-indicators"}[e]||e)+"."+{4:"e9f7877e2088cf681289",92:"20aec3fd3e04096eae8a",139:"9bac6b5005b2fe097cf3",159:"cbc87a51dd6c9a180ef8",319:"bfad5173227ff4b17ee9",341:"a9eb3484dc231697e64a",360:"7ab37b19fbd43b62435c",380:"0beb21ac39ce88afd40a",445:"947b894960c6e4035c0e",507:"ab403205125f170be9e2",509:"f24584403d44ed8cf3ed",569:"f0be320dc06ad56040bf",574:"7ff8a41f54edcb4ad73d",607:"c82ef5c409f191cc7c5d",620:"bcf3249fc32562e96280",624:"3b396e1376ddaa5e6358",628:"84f8ec3b19bcd5e342c8",683:"0d6a0e2ec02f15fe66eb",688:"0c88ce61641b39b90734",731:"3cab117ede5b1696d880",769:"cfef16111d0547178795",844:"c1e23fb55ad878f2607f",846:"baf9aedca844155d20c9",861:"d4f5022cd90ecd9d2455",903:"ef8462a4afcb96b7c33a",906:"d3f7742cd1f166c581ca",917:"41b6aa03c55ba682d104",925:"e847213b4f2f0347eec1",961:"654ee1abe8bd1c5165c5",986:"af29b1f88812e58c9f6c",1065:"1a73602ef366a609998c",1155:"6b6008c2c60cff13d7f4",1166:"a76cf4fe58acee8e54a9",1171:"e0f88030f3be0449d302",1277:"1e3ca2deba9ec68bfb74",1282:"3b73ca25e6d4f290597f",1313:"916eb4d87cdda49b9337",1314:"2506e7de45c96e5a349c",1450:"0f90392e173237a41bdd",1455:"68694affc8c3e0026b38",1470:"a0c22c988dfd930151e0",1485:"d2c9ddbfe2c9c5be9408",1488:"7a2557d0f4174d30ac4e",1506:"fc2e96a3d5be8f6cf400",1553:"ee2f0024a59277fd480e",1583:"46eba403be0c79c4c268",1584:"8c4f4cb9afe40b12ae55",1667:"ec7c9e13d3905c94b87f",1681:"890334aa5a1cc78f12c8",1697:"43150b369abc9d0324cd",1713:"7c959039148dcdcb411c",1727:"98e9d718a90f5c1c2f73",1754:"20a5ff1d11fd823861a0",1859:"31645b04b5b7067c6f13",1890:"593acab581cc4008ee11",1963:"39d46b134506f3af6fa4",1979:"286be1b48da9ba13da09",2050:"2a03f458a0e8196446f8",2077:"c0b97c344387b26d21f6",2087:"68a78bdd28274b4eee9e",2112:"0195ddd98768340d8fec",2164:"fcf5a0c7415d9ec1cd7c",2183:"46d4342f0c3b4c3d2ace",2202:"fddc8c100feabdd18b24",2227:"c1c4b4d4d12f9774793f",2232:"29d5136824af61f3f42d",2283:"7bfc63a600845bb7c674",2306:"e8ff289dd4e8225bc29e",2307:"66d27ab06c446545a05e",2312:"cd23d9dd0093c019ab0c",2318:"141ae360b6739148b2e9", -2377:"6e30e0c48af40bf2f6c0",2413:"91c6261b25d95d0206c9",2475:"1ed8b62332af605c5bee",2477:"44f2c96353966357ded8",2537:"757e1b655415c200c3d1",2641:"6bc828587e178a0d5a82",2647:"a5bd9c1c3a60a1a33fbc",2704:"7b67895aa33526804d36",2745:"73995b6670d622d97310",2816:"8233da87004918cf16a9",2878:"6b7c3410c1316a4d200d",2891:"ac7f12fc1eff206762f9",2962:"ee7512aef60ddf211a3a",3005:"2a1db3d6309536cde3c0",3014:"0d409362ec30f40d042e",3030:"dcc30f3b10fd6f3fbf5d",3179:"78787edf30f25d297844",3248:"676be3f4442ff78d5909",3290:"6910babced1a4b7d82c4",3314:"61f270a9e021377493ed",3329:"3b6659d129ab817bf283",3359:"1b4513bbb949dd541093",3378:"22b0af1ad7bc3caff507",3383:"7639e6b21de21984b315",3425:"af0c72a8ad3cbb55c070",3439:"6edfdd8233c74ba93ffe",3460:"74c66fe5d6bb7d727f80",3476:"8eebafed8a9bfd4d994f",3555:"8233b5c0f504dc44029c",3596:"79d509486a68c67bd42f",3637:"e64dc1e10403bb8fd262",3672:"570d4e00cc01ba41bcbb",3710:"acc36603d066c9ff74f4",3723:"7335c975cc2059982d78",3853:"4937ff6eb025cfe033b4",3866:"03d73838d0c3f6e6175f",3945:"ba7b0e3fd2be17890ee3",3946:"9d95111f4d6d5b4bfe5c",3952:"3892601e661ca0cce990",3966:"6ed22a54d039cd836365",4013:"b8d6122ddbbdb8e39789",4015:"945c9c31a5cee9d3ec48",4059:"661b68c32b4d54e6e0b3",4079:"d0fc27c1b07f5dd20dee",4201:"78f078e0d615080aa096",4240:"8d07b4c64394ebb30caf",4248:"5196f36fe87bffc5d369",4273:"0132e0e4462b6a180a0e",4389:"6e666e01441227ae61e3",4422:"0cb0df3f853033542a6d",4426:"4117c7a82199deed7db8",4495:"5a1c9623236398857e9d",4587:"97df39319183f566cbed",4598:"929d7a8647b3a31b6ab6",4602:"bccaa58617af6b80394c",4633:"41bc9073db4c6464bfe9",4674:"dc3ff0721cdfd2f1f2d7",4678:"42e9586c89b5320f9169",4719:"84dbe54b64e289f139c3",4731:"dc36aa4a1036fb9527b0",4765:"61e6a00741e34817e943",4862:"254833ed6030cf146329",4931:"f6d9da1269f09f247d63",4934:"3acbaa057b9c87dd7988",4981:"c59f4d3b2dc0a2024eaf",5009:"d56997e275ea6c8ce8e8",5055:"a88013f12dd83e1452ad",5093:"4ec424eb56739ee22285",5122:"89cef390d6784c56bef1",5206:"52a3e11d9b3b5bc1646b",5231:"e3ddef45e551d908b5f6",5248:"39ff0f3eccbe95f714c4",5283:"be622efff93d74be8bbb",5371:"9de35d41d3d3e039c8de",5386:"400def58328bce500f3d",5410:"d55fe54ddbf5d3a1d03e",5445:"7b009df16b3b27c38689",5456:"5550ada1b5274d2b1fc9",5500:"ee34ab83987798413131",5516:"85a0d8dc30a084c60f7d",5529:"6cae9429d8424851a2a2",5551:"201637bb9164a0295e57",5563:"83a4f87818bf4ff2bfe8",5565:"1144e5a1b4f8503ee572",5572:"c120f2a52855c1fe7d0f",5592:"b48fc8c98953c7eda089",5598:"9df1e0887f8f2a9647cd",5639:"cce0f47b553a89bc56af",5695:"301c7c0b2d7d0d350c2e",5705:"3cfd1fd3b91f816a5125",5743:"771457a25aa42edee0ff",5834:"69ab2e5fa5d329989319",5893:"e5c9a9c5e41a157ad197",5967:"5875f32d774104aec9cc",6025:"bd352ea0e85294a25497",6032:"c695879e27813308dd9e",6043:"72c78cd6a493066e3f6a",6052:"280b181318e81a6ba94d",6094:"6f20060bb84156233774",6124:"6b7203a5d4ce2ebe7728",6166:"523a7e995356abbe4417",6178:"21167b99135337cfb9e1",6193:"15a1126a4ea5d5a80cbc",6195:"2a2e890e37c620dd8a6b",6265:"361202b1c34b1599dc84",6336:"a290d202d5b312334a52",6376:"482cfbb8133455c17c92",6432:"3ebd6a05e3dfa3144914",6456:"2204b6a90bef20ca1042", -6477:"a6e3dd8f0814081210f4",6484:"3f630bc80a66fbab32c7",6602:"5db78c705ae2a12ecca3",6631:"53e20cb6fcfea8a141f8",6633:"ce659c5f85016e2da899",6668:"0e223b3dc3e6bb3bdb80",6697:"6e2317eb6e10b3735190",6740:"96f4b196b30af8149b1c",6748:"55c4519e230a1ecdb2a0",6780:"7a5c1b3e221693ee044c",6864:"279ef4c9539497429e92",6870:"24242fd039923007864f",6954:"080101562d2c5bb23540",6956:"bcfe4e0c904e0632995c",7038:"aa6d69b04635c68a27c7",7078:"3c4da8067ded124e4550",7127:"05844bc9d761ae4120b3",7129:"9ffb159f9a256ce9891e",7175:"a89eba2b1fd6dbea7597",7203:"e2d5a96e3878862a52a0",7260:"6ceb4aef3a79d9831607",7271:"f01e49e03e8825756d78",7369:"d67754d2d1e6cd4a44cc",7399:"7fd926a23ad78726980d",7437:"7596a99a3f7c5f7d8009",7463:"75e07b6f3ad409e47e9e",7488:"49e58aee829a5e999fc4",7519:"01180f215ff7af433df6",7539:"3ad353a5758b0064f87a",7553:"b1e6942ddf9308862833",7563:"75238f216412b5b0e268",7648:"459f47945f2aa1d9d634",7660:"e25d052f78f749289278",7682:"0af9f99ebcf82f1d5e87",7691:"4fb3dccf1633e286214e",7777:"30fdb48f3b1c2bddfa9a",7780:"98495589560ea0cb6ff5",7806:"f1cb45a285a1a13e744c",7827:"f9257d961450fe4aaccb",7833:"1fe6e910e77fd7261449",7903:"213d45b03f5212091898",7987:"44402958fd0934b94ac1",8020:"e90e05d2b7455360cb92",8061:"d3d3437db87092392682",8090:"64de1f98a3e94f14b9d1",8093:"15bdc35e257d730d0e71",8185:"fefab7a1a5f120cf5ab9",8220:"2a38ccbdd84f1abe7915",8260:"2d3311187bd6b3c611b2",8313:"9c1267d07e48b8d8f53f",8334:"4d1e9c3ebcc966dc3fbb",8372:"599f71b4f74f08c1cc64",8402:"8d6877692120b620a62f",8422:"216a3e91b03758570d50",8468:"365a9361e977be1706b4",8537:"6830c12ee5b23fa3f44b",8604:"f5c94c10beff56dd17a0",8607:"df25e780dfd698c5a129",8673:"e757c9194429a5eb95fe",8752:"2a3dca6ff062a372cc7c",8820:"8a8c7003ba1bc6c0214c",8823:"d0f6a13ebe9b55e5ae25",8890:"3c45f27ba6b780f9400c",8894:"1683e77c7e5628df4950",8933:"6cb7f1f9073b85d8c845",8949:"e181251198aaa1117d54",9002:"444dbc0f0b0d52291fab",9014:"31c32a1a84600d0f1c1f",9036:"9953ef9e5769935c7d74",9039:"1afddcf7bdf27af86d03",9123:"ad640e5494bbbc11419c",9297:"6ea3acdbf182c6c13ce8",9310:"a66b1a03e022c1dcb27e",9323:"dd7d6e1bcd754d2b0e8c",9374:"0c0a6ebf536991d0d4a2",9378:"dbb8d40e653f515b8f67",9418:"963c6d55bb9a6e9d6402",9445:"3903f31dd6234b01103e",9468:"c4efc189b2e620d1c20a",9478:"fb2d6fbc8234a4cab300",9487:"18e48cb0664ad0850dcc",9498:"0e123d391a9c2338f4ae",9534:"c451035dd0fa34ea862a",9581:"1029215755374bd9b1bf",9590:"01544016ba818c77f7df",9646:"be31e7fc19174a6d5c4a",9658:"63d5629b678ac1549bcd",9685:"0fab90a4ed52f242db2f",9742:"66d9c870e64bb83a87e4",9748:"012a564374d0cb602844",9754:"f532e65043c071476f6b",9790:"fa8f30be53475647c1ed",9836:"ddd6d83413044c8048bf",9928:"65ec9af0076c17eaa8c1",9965:"f8cf217d1e8bc83d432b",9970:"08d56f22bb40e2ab1088"}[e]+".js",o.miniCssF=e=>e+"."+{4:"975cc7b264b6bd3c596d",159:"3e4f89ce6749c1e5f8df",445:"8577632fdab29ee53ddf",509:"7e5e9ba6624b240fc4c7",628:"b8ffba49e1636aade6c4",683:"9ce134321e5f7ed1c4ad",844:"4db113a94ddabe52ea7c",846:"783c8fdad80b7ee894e8",861:"d3c8a2d509847638ea25",903:"e764dd9f961674c26dbd",1065:"d8e66f4c4d6c2e5e9e51",1166:"fa77c9e386a131cac9da",1171:"146c7925be9f43c9c767", -1450:"8f1c6b9900df1caf5e97",1488:"720d3939e07b55dd54ff",1667:"a0f6cab48aafa4924d69",1681:"df517de208b59f042c3b",1697:"042d72d2c0eaafd88d54",1979:"727d53fabf38782d4a1f",2112:"10fd79bdcf7d87919e93",2202:"414409a383bce0796e9b",2307:"2fb1c26f9bc4323a9ce1",2318:"8bdd9c9cc1661e5b303f",2537:"a8e87c60a250a6212b03",2641:"8fe6a787670a4a8ef383",2647:"a9ca47adf1a97f5f023d",3014:"b5b7477b23dda9a91666",3290:"dfbe2771427c6e7a0057",3329:"e21e82febf357ba86937",3359:"515b38c2fad56295e0d7",3425:"2c71d427960b55da9a78",3439:"18a88ac7f1dc31fa83da",3460:"ee113a455fc80caafc76",3476:"30d51195eb2fb72fcf64",3637:"9a63d1db88d74be3cc39",3672:"362fa6a7ab1f3e3b06c4",3853:"4ae445e5f095a01ba045",3946:"7318655b786d7fb40f50",4059:"b6fc40ed6b3d8311f086",4240:"56bc31ea089745c54b33",4248:"9515eeb06dd8e381efe7",4422:"78e9455cd23b69174473",4495:"be501b970b417ba6c2a8",4587:"2fb5f6f3eb739c16078d",4633:"add1585dafb8756f4ac1",4678:"3a91d5cb712d91b3d494",4719:"a3b6b5f9792e79b01fbc",4765:"e81302eea6c8be4f4718",5371:"76e4283712e58a36266a",5445:"093db358753a840ab939",5563:"2020d73e26d49ab4f152",5743:"efabcbfa402a97d8655c",5834:"79247ad88246410e4399",6032:"128b53aa00cd47668af0",6043:"16c0fd7539d08ad5ffd3",6052:"d49d6f461c53e70b38bc",6094:"a6a9dab4a3149840bbeb",6178:"39e6202ba00cf6f84f33",6195:"dd31c566c5cea85cb34d",6633:"50b8e8846c82b9394624",6697:"401ea4c022390e1da1c1",6870:"bf8e610b24f018b18606",6954:"d4ea7d03cf19941c7fa4",6956:"bb51b63e079c12f34d9d",7369:"488cdb889af5bc213e7a",7399:"f60e2fa80861d26a1fe2",7463:"0c60a2665496872c6cc1",7519:"a7570fbc77731eca9b60",7682:"0b2eb20106b0fa40dbc9",7691:"ce7b2959f31f83034b45",7777:"891d2b2ce44704ebece2",7780:"dad95b9e4df028f98405",7827:"6ac93924147c2fb8d322",7833:"f2e1edd6097be38e73da",8185:"fbb750fd312778403036",8220:"dd6dce5d2a6f56d0f41e",8260:"62352517083dd5dfd292",8752:"52267c3fa7dd7ef53af4",8894:"b07b23323d7ced0545c0",8933:"45a42558763ddf6de336",9002:"bb4d91a9e1bdd3b5c7da",9036:"0585c4fac59f4fe82f95",9297:"f956807450cbc2bb54ad",9323:"b86e76f1c9dea8b48f7e",9468:"8628031453e97b61d8a0",9487:"31287178347f44fad165",9590:"56ae013b90ba2722383d",9646:"1f177ff6c1d61bbb7d1a",9658:"a9e76e41b28aa8a84efe",9742:"4d4891102ba1094f3993",9836:"c5a2f31610f22e588456",9965:"99898a3b8bbfa6046421",9970:"3bc725690d7178ac1772"}[e]+".css",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),d={},f="tradingview:",o.l=(e,a,c,b)=>{if(d[e])d[e].push(a);else{var t,l;if(void 0!==c)for(var n=document.getElementsByTagName("script"),r=0;r{t.onerror=t.onload=null,clearTimeout(_);var f=d[e];if(delete d[e], +7203:"line-tool-cross-line",7260:"chart-bottom-toolbar",7271:"compare-model",7488:"line-tool-info-line",7539:"studies",7553:"react-popper",7563:"line-tool-ghost-feed",7648:"show-theme-save-dialog",7660:"line-tool-ellipse",7806:"line-tool-icon",7987:"lt-icons-atlas",8020:"user-defined-bars-marks-tooltip",8061:"line-tool-bezier-quadro",8090:"line-tool-fib-spiral",8313:"chart-storage-external-adapter",8334:"line-tool-time-cycles",8372:"line-tool-trend-angle",8422:"line-tool-rectangle",8468:"line-tool-inside-pitchfork",8537:"lt-property-pages-with-definitions",8607:"line-tool-arrow",8673:"line-tool-trend-line",8820:"line-tool-flag-mark",8890:"simple-dialog",8949:"line-tool-sticker",9014:"line-tool-bezier-cubic",9039:"lollipop-tooltip-renderer",9123:"line-tool-text-note",9310:"line-tool-flat-bottom",9374:"symbol-info-dialog-impl",9445:"line-tool-cyclic-lines",9478:"line-tool-gann-square",9498:"export-data",9534:"line-tool-prediction",9581:"line-tool-disjoint-channel",9685:"series-icons-map",9748:"line-tool-regression-trend",9754:"global-search-dialog",9790:"favorite-indicators"}[e]||e)+"."+{4:"e9f7877e2088cf681289",92:"20aec3fd3e04096eae8a",139:"9bac6b5005b2fe097cf3",159:"cbc87a51dd6c9a180ef8",319:"bfad5173227ff4b17ee9",341:"a9eb3484dc231697e64a",360:"7ab37b19fbd43b62435c",380:"0beb21ac39ce88afd40a",445:"947b894960c6e4035c0e",507:"ab403205125f170be9e2",509:"f24584403d44ed8cf3ed",569:"f0be320dc06ad56040bf",574:"7ff8a41f54edcb4ad73d",607:"c82ef5c409f191cc7c5d",620:"bcf3249fc32562e96280",624:"3b396e1376ddaa5e6358",628:"84f8ec3b19bcd5e342c8",683:"0d6a0e2ec02f15fe66eb",688:"0c88ce61641b39b90734",731:"c700b910ca230864c99c",769:"cfef16111d0547178795",844:"c1e23fb55ad878f2607f",846:"baf9aedca844155d20c9",861:"d4f5022cd90ecd9d2455",903:"ef8462a4afcb96b7c33a",906:"d3f7742cd1f166c581ca",917:"41b6aa03c55ba682d104",925:"e847213b4f2f0347eec1",961:"654ee1abe8bd1c5165c5",986:"af29b1f88812e58c9f6c",1065:"1a73602ef366a609998c",1155:"6b6008c2c60cff13d7f4",1166:"a76cf4fe58acee8e54a9",1171:"e0f88030f3be0449d302",1277:"1e3ca2deba9ec68bfb74",1282:"3b73ca25e6d4f290597f",1313:"916eb4d87cdda49b9337",1314:"2506e7de45c96e5a349c",1450:"0f90392e173237a41bdd",1455:"68694affc8c3e0026b38",1470:"a0c22c988dfd930151e0",1485:"62487782be5544fea53d",1488:"7a2557d0f4174d30ac4e",1506:"fc2e96a3d5be8f6cf400",1553:"ee2f0024a59277fd480e",1583:"46eba403be0c79c4c268",1584:"8c4f4cb9afe40b12ae55",1667:"ec7c9e13d3905c94b87f",1681:"890334aa5a1cc78f12c8",1697:"43150b369abc9d0324cd",1713:"7c959039148dcdcb411c",1727:"98e9d718a90f5c1c2f73",1754:"54853b5c5b40e1f16d7e",1859:"31645b04b5b7067c6f13",1890:"593acab581cc4008ee11",1963:"39d46b134506f3af6fa4",1979:"286be1b48da9ba13da09",2050:"2a03f458a0e8196446f8",2077:"c0b97c344387b26d21f6",2087:"68a78bdd28274b4eee9e",2112:"0195ddd98768340d8fec",2164:"fcf5a0c7415d9ec1cd7c",2183:"46d4342f0c3b4c3d2ace",2202:"fddc8c100feabdd18b24",2227:"c1c4b4d4d12f9774793f",2232:"29d5136824af61f3f42d",2283:"7bfc63a600845bb7c674",2306:"b5394bfa95332ed5a617",2307:"66d27ab06c446545a05e",2312:"cd23d9dd0093c019ab0c",2318:"141ae360b6739148b2e9", +2377:"6e30e0c48af40bf2f6c0",2413:"91c6261b25d95d0206c9",2477:"44f2c96353966357ded8",2537:"757e1b655415c200c3d1",2641:"6bc828587e178a0d5a82",2647:"a5bd9c1c3a60a1a33fbc",2704:"7b67895aa33526804d36",2745:"73995b6670d622d97310",2816:"8233da87004918cf16a9",2878:"6b7c3410c1316a4d200d",2891:"ac7f12fc1eff206762f9",2962:"ee7512aef60ddf211a3a",3005:"2a1db3d6309536cde3c0",3014:"0d409362ec30f40d042e",3030:"dcc30f3b10fd6f3fbf5d",3179:"78787edf30f25d297844",3248:"676be3f4442ff78d5909",3290:"6910babced1a4b7d82c4",3314:"61f270a9e021377493ed",3329:"3b6659d129ab817bf283",3359:"1b4513bbb949dd541093",3378:"22b0af1ad7bc3caff507",3383:"7639e6b21de21984b315",3425:"af0c72a8ad3cbb55c070",3439:"6edfdd8233c74ba93ffe",3460:"74c66fe5d6bb7d727f80",3476:"8eebafed8a9bfd4d994f",3555:"8233b5c0f504dc44029c",3596:"79d509486a68c67bd42f",3637:"e64dc1e10403bb8fd262",3672:"570d4e00cc01ba41bcbb",3710:"acc36603d066c9ff74f4",3723:"7335c975cc2059982d78",3853:"4937ff6eb025cfe033b4",3866:"03d73838d0c3f6e6175f",3945:"ba7b0e3fd2be17890ee3",3946:"9d95111f4d6d5b4bfe5c",3952:"3892601e661ca0cce990",3966:"6ed22a54d039cd836365",4013:"b8d6122ddbbdb8e39789",4015:"945c9c31a5cee9d3ec48",4059:"661b68c32b4d54e6e0b3",4079:"d0fc27c1b07f5dd20dee",4201:"78f078e0d615080aa096",4240:"8d07b4c64394ebb30caf",4248:"5196f36fe87bffc5d369",4273:"0132e0e4462b6a180a0e",4389:"6e666e01441227ae61e3",4422:"0cb0df3f853033542a6d",4426:"4117c7a82199deed7db8",4495:"5a1c9623236398857e9d",4587:"97df39319183f566cbed",4598:"929d7a8647b3a31b6ab6",4602:"bccaa58617af6b80394c",4633:"41bc9073db4c6464bfe9",4674:"dc3ff0721cdfd2f1f2d7",4678:"42e9586c89b5320f9169",4719:"84dbe54b64e289f139c3",4731:"dc36aa4a1036fb9527b0",4765:"61e6a00741e34817e943",4862:"254833ed6030cf146329",4931:"f6d9da1269f09f247d63",4934:"3acbaa057b9c87dd7988",4981:"c59f4d3b2dc0a2024eaf",5009:"d56997e275ea6c8ce8e8",5055:"a88013f12dd83e1452ad",5093:"4ec424eb56739ee22285",5122:"89cef390d6784c56bef1",5206:"52a3e11d9b3b5bc1646b",5231:"e3ddef45e551d908b5f6",5248:"39ff0f3eccbe95f714c4",5283:"be622efff93d74be8bbb",5371:"9de35d41d3d3e039c8de",5386:"400def58328bce500f3d",5410:"d55fe54ddbf5d3a1d03e",5445:"7b009df16b3b27c38689",5456:"5550ada1b5274d2b1fc9",5500:"ee34ab83987798413131",5516:"85a0d8dc30a084c60f7d",5529:"6cae9429d8424851a2a2",5551:"201637bb9164a0295e57",5563:"83a4f87818bf4ff2bfe8",5565:"1144e5a1b4f8503ee572",5572:"c120f2a52855c1fe7d0f",5592:"b48fc8c98953c7eda089",5598:"9df1e0887f8f2a9647cd",5639:"cce0f47b553a89bc56af",5695:"301c7c0b2d7d0d350c2e",5705:"3cfd1fd3b91f816a5125",5743:"771457a25aa42edee0ff",5834:"69ab2e5fa5d329989319",5893:"de851bcf23a70646c585",5967:"5875f32d774104aec9cc",6025:"bd352ea0e85294a25497",6032:"c695879e27813308dd9e",6043:"72c78cd6a493066e3f6a",6052:"280b181318e81a6ba94d",6094:"6f20060bb84156233774",6124:"6b7203a5d4ce2ebe7728",6166:"523a7e995356abbe4417",6178:"21167b99135337cfb9e1",6193:"15a1126a4ea5d5a80cbc",6195:"2a2e890e37c620dd8a6b",6265:"361202b1c34b1599dc84",6336:"a290d202d5b312334a52",6376:"482cfbb8133455c17c92",6432:"3ebd6a05e3dfa3144914",6456:"2204b6a90bef20ca1042",6477:"a6e3dd8f0814081210f4", +6484:"3f630bc80a66fbab32c7",6602:"c29faaaa30fce24293fa",6631:"53e20cb6fcfea8a141f8",6633:"ce659c5f85016e2da899",6668:"0e223b3dc3e6bb3bdb80",6697:"6e2317eb6e10b3735190",6740:"96f4b196b30af8149b1c",6748:"55c4519e230a1ecdb2a0",6780:"7a5c1b3e221693ee044c",6864:"279ef4c9539497429e92",6870:"24242fd039923007864f",6954:"080101562d2c5bb23540",6956:"bcfe4e0c904e0632995c",7038:"aa6d69b04635c68a27c7",7078:"3c4da8067ded124e4550",7127:"05844bc9d761ae4120b3",7129:"9ffb159f9a256ce9891e",7175:"a89eba2b1fd6dbea7597",7203:"e2d5a96e3878862a52a0",7260:"6ceb4aef3a79d9831607",7271:"f01e49e03e8825756d78",7369:"d67754d2d1e6cd4a44cc",7399:"7fd926a23ad78726980d",7437:"7596a99a3f7c5f7d8009",7463:"75e07b6f3ad409e47e9e",7488:"49e58aee829a5e999fc4",7519:"01180f215ff7af433df6",7539:"3ad353a5758b0064f87a",7553:"b1e6942ddf9308862833",7563:"75238f216412b5b0e268",7648:"459f47945f2aa1d9d634",7660:"e25d052f78f749289278",7682:"0af9f99ebcf82f1d5e87",7691:"4fb3dccf1633e286214e",7777:"30fdb48f3b1c2bddfa9a",7780:"98495589560ea0cb6ff5",7806:"f1cb45a285a1a13e744c",7827:"f9257d961450fe4aaccb",7833:"1fe6e910e77fd7261449",7903:"213d45b03f5212091898",7987:"44402958fd0934b94ac1",8020:"e90e05d2b7455360cb92",8061:"d3d3437db87092392682",8090:"64de1f98a3e94f14b9d1",8093:"15bdc35e257d730d0e71",8185:"fefab7a1a5f120cf5ab9",8220:"2a38ccbdd84f1abe7915",8260:"2d3311187bd6b3c611b2",8313:"9c1267d07e48b8d8f53f",8334:"4d1e9c3ebcc966dc3fbb",8372:"599f71b4f74f08c1cc64",8402:"8d6877692120b620a62f",8422:"216a3e91b03758570d50",8468:"365a9361e977be1706b4",8537:"6830c12ee5b23fa3f44b",8604:"f5c94c10beff56dd17a0",8607:"df25e780dfd698c5a129",8673:"e757c9194429a5eb95fe",8752:"2a3dca6ff062a372cc7c",8820:"8a8c7003ba1bc6c0214c",8823:"d0f6a13ebe9b55e5ae25",8890:"3c45f27ba6b780f9400c",8894:"1683e77c7e5628df4950",8933:"6cb7f1f9073b85d8c845",8949:"e181251198aaa1117d54",9002:"444dbc0f0b0d52291fab",9014:"31c32a1a84600d0f1c1f",9026:"75767d113c906e89c496",9036:"9953ef9e5769935c7d74",9039:"1afddcf7bdf27af86d03",9123:"ad640e5494bbbc11419c",9297:"6ea3acdbf182c6c13ce8",9310:"a66b1a03e022c1dcb27e",9323:"dd7d6e1bcd754d2b0e8c",9374:"0c0a6ebf536991d0d4a2",9378:"dbb8d40e653f515b8f67",9418:"963c6d55bb9a6e9d6402",9445:"3903f31dd6234b01103e",9468:"c4efc189b2e620d1c20a",9478:"fb2d6fbc8234a4cab300",9487:"18e48cb0664ad0850dcc",9498:"0e123d391a9c2338f4ae",9534:"c451035dd0fa34ea862a",9581:"1029215755374bd9b1bf",9590:"01544016ba818c77f7df",9646:"be31e7fc19174a6d5c4a",9658:"63d5629b678ac1549bcd",9685:"0fab90a4ed52f242db2f",9742:"66d9c870e64bb83a87e4",9748:"012a564374d0cb602844",9754:"95f16ea4245f74436891",9790:"fa8f30be53475647c1ed",9836:"ddd6d83413044c8048bf",9928:"65ec9af0076c17eaa8c1",9965:"f8cf217d1e8bc83d432b",9970:"08d56f22bb40e2ab1088"}[e]+".js",o.miniCssF=e=>e+"."+{4:"975cc7b264b6bd3c596d",159:"3e4f89ce6749c1e5f8df",445:"8577632fdab29ee53ddf",509:"7e5e9ba6624b240fc4c7",628:"b8ffba49e1636aade6c4",683:"9ce134321e5f7ed1c4ad",844:"4db113a94ddabe52ea7c",846:"783c8fdad80b7ee894e8",861:"d3c8a2d509847638ea25",903:"e764dd9f961674c26dbd",1065:"d8e66f4c4d6c2e5e9e51",1166:"fa77c9e386a131cac9da",1171:"146c7925be9f43c9c767", +1450:"8f1c6b9900df1caf5e97",1488:"720d3939e07b55dd54ff",1667:"a0f6cab48aafa4924d69",1681:"df517de208b59f042c3b",1697:"042d72d2c0eaafd88d54",1979:"727d53fabf38782d4a1f",2112:"10fd79bdcf7d87919e93",2202:"414409a383bce0796e9b",2307:"2fb1c26f9bc4323a9ce1",2318:"8bdd9c9cc1661e5b303f",2537:"a8e87c60a250a6212b03",2641:"8fe6a787670a4a8ef383",2647:"a9ca47adf1a97f5f023d",3014:"b5b7477b23dda9a91666",3290:"dfbe2771427c6e7a0057",3329:"e21e82febf357ba86937",3359:"515b38c2fad56295e0d7",3425:"2c71d427960b55da9a78",3439:"18a88ac7f1dc31fa83da",3460:"ee113a455fc80caafc76",3476:"30d51195eb2fb72fcf64",3637:"9a63d1db88d74be3cc39",3672:"362fa6a7ab1f3e3b06c4",3853:"4ae445e5f095a01ba045",3946:"7318655b786d7fb40f50",4059:"b6fc40ed6b3d8311f086",4240:"56bc31ea089745c54b33",4248:"9515eeb06dd8e381efe7",4422:"78e9455cd23b69174473",4495:"be501b970b417ba6c2a8",4587:"2fb5f6f3eb739c16078d",4633:"add1585dafb8756f4ac1",4678:"3a91d5cb712d91b3d494",4719:"a3b6b5f9792e79b01fbc",4765:"e81302eea6c8be4f4718",5371:"76e4283712e58a36266a",5445:"093db358753a840ab939",5563:"2020d73e26d49ab4f152",5743:"efabcbfa402a97d8655c",5834:"79247ad88246410e4399",6032:"128b53aa00cd47668af0",6043:"16c0fd7539d08ad5ffd3",6052:"d49d6f461c53e70b38bc",6094:"bd5174488126d28070f4",6178:"39e6202ba00cf6f84f33",6195:"dd31c566c5cea85cb34d",6633:"50b8e8846c82b9394624",6697:"401ea4c022390e1da1c1",6870:"bf8e610b24f018b18606",6954:"d4ea7d03cf19941c7fa4",6956:"bb51b63e079c12f34d9d",7369:"488cdb889af5bc213e7a",7399:"f60e2fa80861d26a1fe2",7463:"0c60a2665496872c6cc1",7519:"a7570fbc77731eca9b60",7682:"0b2eb20106b0fa40dbc9",7691:"ce7b2959f31f83034b45",7777:"891d2b2ce44704ebece2",7780:"dad95b9e4df028f98405",7827:"6ac93924147c2fb8d322",7833:"f2e1edd6097be38e73da",8185:"fbb750fd312778403036",8220:"dd6dce5d2a6f56d0f41e",8260:"62352517083dd5dfd292",8752:"52267c3fa7dd7ef53af4",8894:"b07b23323d7ced0545c0",8933:"45a42558763ddf6de336",9002:"bb4d91a9e1bdd3b5c7da",9036:"0585c4fac59f4fe82f95",9297:"f956807450cbc2bb54ad",9323:"b86e76f1c9dea8b48f7e",9468:"8628031453e97b61d8a0",9487:"31287178347f44fad165",9590:"56ae013b90ba2722383d",9646:"1f177ff6c1d61bbb7d1a",9658:"a9e76e41b28aa8a84efe",9742:"4d4891102ba1094f3993",9836:"c5a2f31610f22e588456",9965:"99898a3b8bbfa6046421",9970:"3bc725690d7178ac1772"}[e]+".css",o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=(e,a)=>Object.prototype.hasOwnProperty.call(e,a),d={},f="tradingview:",o.l=(e,a,c,b)=>{if(d[e])d[e].push(a);else{var t,l;if(void 0!==c)for(var n=document.getElementsByTagName("script"),r=0;r{t.onerror=t.onload=null,clearTimeout(_);var f=d[e];if(delete d[e], t.parentNode&&t.parentNode.removeChild(t),f&&f.forEach((e=>e(c))),a)return a(c)},_=setTimeout(s.bind(null,void 0,{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"!=typeof Symbol&&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),(()=>{var e;o.g.importScripts&&(e=o.g.location+"");var a=o.g.document;if(!e&&a&&(a.currentScript&&(e=a.currentScript.src),!e)){var c=a.getElementsByTagName("script");c.length&&(e=c[c.length-1].src)}if(!e)throw new Error("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)),(()=>{const e=o.u;o.u=a=>e(a).replace("__LANG__",o.g.language)})(),o.p=o.g.WEBPACK_PUBLIC_PATH||o.p;var l=o.e,n=Object.create(null);function r(e,a){return l(e).catch((function(){return new Promise((function(c){var d=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);var a=function(){delete n[e]};n[e].then(a,a)}return n[e]},(()=>{if("undefined"!=typeof document){var e=e=>new Promise(((a,c)=>{var d=o.miniCssF(e),f=o.p+d;if(((e,a)=>{for(var c=document.getElementsByTagName("link"),d=0;d{var b=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{var t=c&&("load"===c.type?"missing":c.type),o=c&&c.target&&c.target.href||a,l=new Error("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, 9658:1,9742:1,9836:1,9965:1,9970:1}[c]&&d.push(a[c]=e(c).then((()=>{a[c]=0}),(e=>{throw delete a[c],e})))}}})(),o.i18next=(e,a={},c,d=o.g.language)=>{if(null===e){if(Array.isArray(c))return c[void 0===a.count?0:o._plural[d](a.count)].replace(/{(\w+)}/g,((e,c)=>void 0!==(a.replace||a)[c]?(a.replace||a)[c]:e));if("object"==typeof c){if(o.g.customTranslateFunction){const e=o.g.customTranslateFunction(c.en[o._plural.en(a.count)],c.en[0],c[o.g.language]?c[o.g.language][o._plural[o.g.language](a.count)]:void 0);if(null!==e)return e.replace(/{(\w+)}/g,((e,c)=>void 0!==(a.replace||a)[c]?(a.replace||a)[c]:e))}return c[o.g.language]?o.i18next(null,a,c[o.g.language]):o.i18next(null,a,c.en,"en")}}else if(c&&e){const d=`${e}${a.context?`_${a.context}`:""}`;if(c[d])return o.i18next(null,a,c[d])}return"number"==typeof e?e.toString():"string"!=typeof e?"":e},(()=>{var e={3666:0,481:0};o.f.j=(a,c)=>{var d=o.o(e,a)?e[a]:void 0;if(0!==d)if(d)c.push(d[2]);else if(/^(1(6(67|81|97)|065|166|171|450|488|59|979)|2(64[17]|112|202|307|318|537)|3(4(25|39|60|76)|6(37|66|72)|014|290|329|359|853|946)|4(24[08]|4(22|5|95)||059|587|633|678|719|765|81)|5(09|371|445|563|743|834)|6(0(32|43|52|94)|95[46]|178|195|28|633|697|83|870)|7((36|39|51)9|463|682|691|777|780|827|833)|8(185|220|260|44|46|61|752|894|933)|9(0(02|3|36)|297|323|468|487|590|646|658|742|836|965|970))$/.test(a))e[a]=0;else{var f=new Promise(((c,f)=>d=e[a]=[c,f]));c.push(d[2]=f);var b=o.p+o.u(a),t=new Error;o.l(b,(c=>{if(o.o(e,a)&&(0!==(d=e[a])&&(e[a]=void 0),d)){var f=c&&("load"===c.type?"missing":c.type),b=c&&c.target&&c.target.src;t.message="Loading chunk "+a+" failed.\n("+f+": "+b+")",t.name="ChunkLoadError",t.type=f,t.request=b,d[1](t)}}),"chunk-"+a,a)}},o.O.j=a=>0===e[a];var a=(a,c)=>{var d,f,[b,t,l]=c,n=0;if(b.some((a=>0!==e[a]))){for(d in t)o.o(t,d)&&(o.m[d]=t[d]);if(l)var r=l(o)}for(a&&a(c);n{const{miniCssF:e}=o;o.miniCssF=a=>self.document&&"rtl"===self.document.dir?e(a).replace(/\.css$/,".rtl.css"):e(a)})()})(); \ No newline at end of file diff --git a/charting_library/bundles/symbol-search-dialog.20a5ff1d11fd823861a0.js b/charting_library/bundles/symbol-search-dialog.54853b5c5b40e1f16d7e.js similarity index 97% rename from charting_library/bundles/symbol-search-dialog.20a5ff1d11fd823861a0.js rename to charting_library/bundles/symbol-search-dialog.54853b5c5b40e1f16d7e.js index b77233d6..6c928803 100644 --- a/charting_library/bundles/symbol-search-dialog.20a5ff1d11fd823861a0.js +++ b/charting_library/bundles/symbol-search-dialog.54853b5c5b40e1f16d7e.js @@ -1,2 +1,2 @@ -"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[1754],{89324:(e,t,o)=>{o.r(t),o.d(t,{Components:()=>h,showDefaultSearchDialog:()=>c,showSymbolSearchItemsDialog:()=>l.showSymbolSearchItemsDialog});var a=o(29803),s=(o(32563),o(4745)),n=o(48961),l=o(1861),i=o(22613),r=o(84015);o(37103),o(49483);!(0,r.isOnMobileAppPage)("any")&&window.matchMedia("(min-width: 602px) and (min-height: 445px)").matches;function c(e){new i.WatchedValue({});const t=(0,n.getSymbolSearchCompleteOverrideFunction)(),{defaultValue:o,showSpreadActions:r,source:c,onSearchComplete:h,trackResultsOptions:d,...m}=e,u={...m,showSpreadActions:r??(0,s.canShowSpreadActions)(),onSymbolFiltersParamsChange:void 0,onSearchComplete:(e,o)=>{t(e[0].symbol,e[0].result).then((e=>{a.linking.setSymbolAndLogInitiator(e.symbol,"symbol search"),h?.(e.symbol)}))},onEmptyResults:void 0};(0,l.showSymbolSearchItemsDialog)({...u,defaultValue:o})}const h={SymbolSearchWatchlistDialogContentItem:null,SymbolSearchWatchlistDialog:null}},1861:(e,t,o)=>{o.d(t,{showSymbolSearchItemsDialog:()=>r});var a=o(50959),s=o(50655),n=o(51826),l=o(40336),i=o(87896);function r(e){const{symbolTypeFilter:t,initialMode:o="symbolSearch",autofocus:r=!0,defaultValue:c,showSpreadActions:h,selectSearchOnInit:d,onSearchComplete:m,dialogTitle:u,placeholder:S,fullscreen:g,initialScreen:p,wrapper:y,dialog:b,contentItem:w,onClose:C,onOpen:f,footer:O,symbolTypes:I,searchInput:v,emptyState:M,hideMarkedListFlag:D,dialogWidth:F="auto",manager:R,shouldReturnFocus:A,onSymbolFiltersParamsChange:P,onEmptyResults:k,customSearchSymbols:V,enableOptionsChain:E,disableRecents:T,overrideQueryParams:W,hiddenFilterIds:_,showRecents:K,searchInitiationPoint:x,selectedSymbolSettingsKey:L,filterValuesSettingsKey:Q}=e;if(n.dialogsOpenerManager.isOpened("SymbolSearch")||n.dialogsOpenerManager.isOpened("ChangeIntervalDialog"))return;const j=document.createElement("div"),q=a.createElement(s.SlotContext.Provider,{value:R??null},a.createElement(l.SymbolSearchItemsDialog,{symbolTypeFilter:t,onClose:B,initialMode:o,defaultValue:c,showSpreadActions:h,hideMarkedListFlag:D,selectSearchOnInit:d,onSearchComplete:m,dialogTitle:u,placeholder:S,fullscreen:g,initialScreen:p,wrapper:y,dialog:b,contentItem:w,footer:O,symbolTypes:I,searchInput:v,emptyState:M,autofocus:r,dialogWidth:F,shouldReturnFocus:A,onSymbolFiltersParamsChange:P,onEmptyResults:k,customSearchSymbols:V,enableOptionsChain:E,disableRecents:T,overrideQueryParams:W,hiddenFilterIds:_,showRecents:K,searchInitiationPoint:x,selectedSymbolSettingsKey:L,filterValuesSettingsKey:Q})),z=(0,i.createReactRoot)(q,j);function B(){z.unmount(),n.dialogsOpenerManager.setAsClosed("SymbolSearch"),C&&C()}return n.dialogsOpenerManager.setAsOpened("SymbolSearch"),f&&f(),{close:B}}},51826:(e,t,o)=>{o.d(t,{DialogsOpenerManager:()=>a,dialogsOpenerManager:()=>s});class a{constructor(){this._storage=new Map}setAsOpened(e,t){this._storage.set(e,t)}setAsClosed(e){this._storage.delete(e)}isOpened(e){return this._storage.has(e)}getDialogPayload(e){return this._storage.get(e)}} +"use strict";(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[1754],{89324:(e,t,o)=>{o.r(t),o.d(t,{Components:()=>h,showDefaultSearchDialog:()=>c,showSymbolSearchItemsDialog:()=>l.showSymbolSearchItemsDialog});var a=o(29803),s=(o(32563),o(4745)),n=o(48961),l=o(1861),i=o(22613),r=o(84015);o(37103),o(49483);!(0,r.isOnMobileAppPage)("any")&&window.matchMedia("(min-width: 602px) and (min-height: 445px)").matches;function c(e){new i.WatchedValue({});const t=(0,n.getSymbolSearchCompleteOverrideFunction)(),{defaultValue:o,showSpreadActions:r,source:c,onSearchComplete:h,trackResultsOptions:d,...m}=e,u={...m,showSpreadActions:r??(0,s.canShowSpreadActions)(),onSymbolFiltersParamsChange:void 0,onSearchComplete:(e,o)=>{t(e[0].symbol,e[0].result).then((e=>{a.linking.setSymbolAndLogInitiator(e.symbol,"symbol search"),h?.(e.symbol)}))},onEmptyResults:void 0};(0,l.showSymbolSearchItemsDialog)({...u,defaultValue:o})}const h={SymbolSearchWatchlistDialogContentItem:null,SymbolSearchWatchlistDialog:null}},1861:(e,t,o)=>{o.d(t,{showSymbolSearchItemsDialog:()=>r});var a=o(50959),s=o(50655),n=o(51826),l=o(59071),i=o(87896);function r(e){const{symbolTypeFilter:t,initialMode:o="symbolSearch",autofocus:r=!0,defaultValue:c,showSpreadActions:h,selectSearchOnInit:d,onSearchComplete:m,dialogTitle:u,placeholder:S,fullscreen:g,initialScreen:p,wrapper:y,dialog:b,contentItem:w,onClose:C,onOpen:f,footer:O,symbolTypes:I,searchInput:v,emptyState:M,hideMarkedListFlag:D,dialogWidth:F="auto",manager:R,shouldReturnFocus:A,onSymbolFiltersParamsChange:P,onEmptyResults:k,customSearchSymbols:V,enableOptionsChain:E,disableRecents:T,overrideQueryParams:W,hiddenFilterIds:_,showRecents:K,searchInitiationPoint:x,selectedSymbolSettingsKey:L,filterValuesSettingsKey:Q}=e;if(n.dialogsOpenerManager.isOpened("SymbolSearch")||n.dialogsOpenerManager.isOpened("ChangeIntervalDialog"))return;const j=document.createElement("div"),q=a.createElement(s.SlotContext.Provider,{value:R??null},a.createElement(l.SymbolSearchItemsDialog,{symbolTypeFilter:t,onClose:B,initialMode:o,defaultValue:c,showSpreadActions:h,hideMarkedListFlag:D,selectSearchOnInit:d,onSearchComplete:m,dialogTitle:u,placeholder:S,fullscreen:g,initialScreen:p,wrapper:y,dialog:b,contentItem:w,footer:O,symbolTypes:I,searchInput:v,emptyState:M,autofocus:r,dialogWidth:F,shouldReturnFocus:A,onSymbolFiltersParamsChange:P,onEmptyResults:k,customSearchSymbols:V,enableOptionsChain:E,disableRecents:T,overrideQueryParams:W,hiddenFilterIds:_,showRecents:K,searchInitiationPoint:x,selectedSymbolSettingsKey:L,filterValuesSettingsKey:Q})),z=(0,i.createReactRoot)(q,j);function B(){z.unmount(),n.dialogsOpenerManager.setAsClosed("SymbolSearch"),C&&C()}return n.dialogsOpenerManager.setAsOpened("SymbolSearch"),f&&f(),{close:B}}},51826:(e,t,o)=>{o.d(t,{DialogsOpenerManager:()=>a,dialogsOpenerManager:()=>s});class a{constructor(){this._storage=new Map}setAsOpened(e,t){this._storage.set(e,t)}setAsClosed(e){this._storage.delete(e)}isOpened(e){return this._storage.has(e)}getDialogPayload(e){return this._storage.get(e)}} const s=new a}}]); \ No newline at end of file diff --git a/charting_library/charting_library.cjs.js b/charting_library/charting_library.cjs.js index 6e58365c..8d376aab 100644 --- a/charting_library/charting_library.cjs.js +++ b/charting_library/charting_library.cjs.js @@ -1 +1 @@ -"use strict";var e,t,i,o,r,n,a,s,l,d,c,h,g,u,C,p,S,m,y,T,_,b,P,L,w,A,f,v,I,O,R,D,x,k,V,F,W,E,M,B,N,U,H,j,z,G,$,J,K,q,Z,Q,Y,X,ee,te,ie,oe,re,ne,ae,se,le,de,ce,he,ge,ue,Ce,pe,Se,me,ye,Te,_e,be,Pe,Le,we,Ae,fe,ve,Ie,Oe,Re,De;function xe(e,t){const i={...e};for(const o in t)"object"!=typeof e[o]||null===e[o]||Array.isArray(e[o])?void 0!==t[o]&&(i[o]=t[o]):i[o]=xe(e[o],t[o]);return i}exports.ActionId=void 0,(e=exports.ActionId||(exports.ActionId={})).UnknownAction="UnknownAction",e.Spinner="Spinner",e.Loading="Loading",e.AlertAdd="Alert.Add",e.AlertEdit="Alert.Edit",e.AlertsClone="Alerts.Clone",e.AlertsRemove="Alerts.Remove",e.AlertsRemoveAll="Alerts.RemoveAll",e.AlertsRemoveFiltered="Alerts.RemoveFiltered",e.AlertsRemoveAllInactive="Alerts.RemoveAllInactive",e.AlertsRemoveAllWatchlistInactive="Alerts.RemoveAllWatchlistInactive",e.AlertsRemoveFires="Alerts.RemoveFires",e.AlertsRestart="Alerts.Restart",e.AlertsRestartAllInactive="Alerts.RestartAllInactive",e.AlertsRestartFilteredInactive="Alerts.RestartFilteredInactive",e.AlertsStop="Alerts.Stop",e.AlertsStopAll="Alerts.StopAll",e.AlertsStopFilteredActive="Alerts.StopFilteredActive",e.AlertsExportFiresToCSV="Alerts.ExportFiresToCSV",e.AlertsLogClear="AlertsLog.Clear",e.AlertsLogRemoveFiltered="AlertsLog.RemoveFiltered",e.ChartAddIndicatorToAllCharts="Chart.AddIndicatorToAllCharts",e.ChartAddSymbolToWatchList="Chart.AddSymbolToWatchList",e.ChartAlertLabelToggleExtendLines="Chart.AlertLabel.ToggleExtendLines",e.ChartApplyIndicatorsToAllCharts="Chart.ApplyIndicatorsToAllCharts",e.ChartIndicatorApplyChildIndicator="Chart.Indicator.ApplyChildIndicator",e.ChartIndicatorApplyFinancials="Chart.Indicator.ApplyFinancials",e.ChartIndicatorAbout="Chart.Indicator.About",e.ChartIndicatorPineLogs="Chart.Indicator.PineLogs",e.ChartIndicatorPineSource="Chart.Indicator.PineSource",e.ChartIndicatorAddFavorites="Chart.Indicator.AddFavorites",e.ChartChangeTimeZone="Chart.ChangeTimeZone",e.ChartClipboardCopyPrice="Chart.Clipboard.CopyPrice",e.ChartClipboardCopyLineTools="Chart.Clipboard.CopyLineTools",e.ChartClipboardCopySource="Chart.Clipboard.CopySource",e.ChartClipboardPasteSource="Chart.Clipboard.PasteSource",e.ChartCrosshairLockVerticalCursor="Chart.Crosshair.LockVerticalCursor",e.ChartCrosshairPlusButtonDrawHorizontalLine="Chart.Crosshair.PlusButton.DrawHorizontalLine",e.ChartCustomActionId="Chart.CustomActionId",e.ChartDialogsShowChangeInterval="Chart.Dialogs.ShowChangeInterval",e.ChartDialogsShowChangeSymbol="Chart.Dialogs.ShowChangeSymbol",e.ChartDialogsShowCompareOrAddSymbol="Chart.Dialogs.ShowCompareOrAddSymbol",e.ChartDialogsShowGeneralSettings="Chart.Dialogs.ShowGeneralSettings",e.ChartDialogsShowGeneralSettingsLegendTab="Chart.Dialogs.ShowGeneralSettings.LegendTab",e.ChartDialogsShowGeneralSettingsSymbolTab="Chart.Dialogs.ShowGeneralSettings.SymbolTab",e.ChartDialogsShowGeneralScalesTab="Chart.Dialogs.ShowGeneralSettings.ScalesTab",e.ChartDialogsShowGeneralSettingsEventsTab="Chart.Dialogs.ShowGeneralSettings.EventsTab",e.ChartDialogsShowGeneralSettingsAlertsTab="Chart.Dialogs.ShowGeneralSettings.AlertsTab",e.ChartDialogsShowGoToDate="Chart.Dialogs.ShowGoToDate",e.ChartDialogsShowInsertIndicators="Chart.Dialogs.ShowInsertIndicators",e.ChartDialogsShowInsertFinancials="Chart.Dialogs.ShowInsertFinancials",e.ChartDialogsShowInsertSeasonals="Chart.Dialogs.ShowInsertSeasonals",e.ChartDialogsShowInsertStockBonds="Chart.Dialogs.ShowInsertStockBonds",e.ChartDialogsShowInsertAnalysis="Chart.Dialogs.ShowInsertAnalysis",e.ChartDialogsShowInsertTechnicals="Chart.Dialogs.ShowInsertTechnicals",e.ChartDialogsShowInsertForecast="Chart.Dialogs.ShowInsertForecast",e.ChartDialogsShowInsertOptions="Chart.Dialogs.ShowInsertOptions",e.ChartDetailsMetricsActionId="Chart.Dialogs.DetailsMetrics",e.ChartDialogsShowInsertEconomyIndicators="Chart.Dialogs.ShowInsertEconomyIndicators",e.ChartDialogsShowSymbolInfo="Chart.Dialogs.ShowSymbolInfo",e.ChartDrawingToolbarToggleVisibility="Chart.DrawingToolbar.ToggleVisibility",e.ChartExternalActionId="Chart.ExternalActionId",e.ChartFavoriteDrawingToolsToolbarHide="Chart.FavoriteDrawingToolsToolbar.Hide",e.ChartIndicatorShowSettingsDialog="Chart.Indicator.ShowSettingsDialog",e.ChartLegendToggleLastDayChangeValuesVisibility="Chart.Legend.ToggleLastDayChangeValuesVisibility",e.ChartLinkingGroupSync="Chart.LinkingGroupSync",e.ChartLinkingGroupSyncChangeGroup="Chart.LinkingGroupSync.ChangeGroup",e.ChartLegendToggleBarChangeValuesVisibility="Chart.Legend.ToggleBarChangeValuesVisibility",e.ChartLegendTogglePriceSourceVisibility="Chart.Legend.TogglePriceSourceVisibility",e.ChartLegendToggleIndicatorArgumentsVisibility="Chart.Legend.ToggleIndicatorArgumentsVisibility",e.ChartLegendToggleIndicatorTitlesVisibility="Chart.Legend.ToggleIndicatorTitlesVisibility",e.ChartLegendToggleIndicatorValuesVisibility="Chart.Legend.ToggleIndicatorValuesVisibility",e.ChartLegendToggleOhlcValuesVisibility="Chart.Legend.ToggleOhlcValuesVisibility",e.ChartLegendToggleOpenMarketStatusVisibility="Chart.Legend.ToggleOpenMarketStatusVisibility",e.ChartLegendToggleSymbolVisibility="Chart.Legend.ToggleSymbolVisibility",e.ChartLegendToggleVolumeVisibility="Chart.Legend.ToggleVolumeVisibility",e.ChartLines="Chart.Lines",e.ChartLinesToggleBidAskLinesVisibility="Chart.Lines.ToggleBidAskLinesVisibility",e.ChartLinesToggleHighLowLinesVisibility="Chart.Lines.ToggleHighLowLinesVisibility",e.ChartLinesToggleAverageLineVisibility="Chart.Lines.ToggleAverageLineVisibility",e.ChartLinesTogglePrePostMarketPriceLineVisibility="Chart.Lines.TogglePrePostMarketPriceLineVisibility",e.ChartLinesToggleSeriesPrevCloseLineVisibility="Chart.Lines.ToggleSeriesPrevCloseLineVisibility",e.ChartLinesToggleSeriesPriceLineVisibility="Chart.Lines.ToggleSeriesPriceLineVisibility",e.ChartLineToolBarsPatternToggleFlipped="Chart.LineTool.BarsPattern.ToggleFlipped",e.ChartLineToolBarsPatternToggleMirrored="Chart.LineTool.BarsPattern.ToggleMirrored",e.ChartLineToolRiskRewardReverse="Chart.LineTool.RiskReward.Reverse",e.ChartLineToolClone="Chart.LineTool.Clone",e.ChartLineToolCreateLimitOrderFromState="Chart.LineTool.CreateLimitOrderFromState",e.ChartLineToolElliotChangeDegreeProperty="Chart.LineTool.Elliot.ChangeDegreeProperty",e.ChartLineToolNoSync="Chart.LineTool.NoSync",e.ChartLineToolPitchforkChangeTypeToInside="Chart.LineTool.Pitchfork.ChangeTypeToInside",e.ChartLineToolPitchforkChangeTypeToModifiedSchiff="Chart.LineTool.Pitchfork.ChangeTypeToModifiedSchiff",e.ChartLineToolPitchforkChangeTypeToOriginal="Chart.LineTool.Pitchfork.ChangeTypeToOriginal",e.ChartLineToolPitchforkChangeTypeToSchiff="Chart.LineTool.Pitchfork.ChangeTypeToSchiff",e.ChartLineToolSyncInLayout="Chart.LineTool.SyncInLayout",e.ChartLineToolSyncGlobally="Chart.LineTool.SyncGlobally",e.ChartLineToolTemplates="Chart.LineTool.Templates",e.ChartLineToolTemplatesApply="Chart.LineTool.Templates.Apply",e.ChartLineToolTemplatesApplyDefaults="Chart.LineTool.Templates.ApplyDefaults",e.ChartLineToolTemplatesSaveAs="Chart.LineTool.Templates.SaveAs",e.ChartLineToolToolbarChangeFontSizeProperty="Chart.LineTool.Toolbar.ChangeFontSizeProperty",e.ChartLineToolToolbarChangeLineStyleToDashed="Chart.LineTool.Toolbar.ChangeLineStyleToDashed",e.ChartLineToolToolbarChangeLineStyleToDotted="Chart.LineTool.Toolbar.ChangeLineStyleToDotted",e.ChartLineToolToolbarChangeLineStyleToSolid="Chart.LineTool.Toolbar.ChangeLineStyleToSolid",e.ChartMarksToggleVisibility="Chart.Marks.ToggleVisibility",e.ChartMoveChartInLayout="Chart.MoveChartInLayout",e.ChartMoveChartInLayoutBack="Chart.MoveChartInLayout.Back",e.ChartMoveChartInLayoutForward="Chart.MoveChartInLayout.Forward",e.ChartTpoResetAllMergesAndSplits="Chart.TPO.ResetAllMergesAndSplits",e.ChartTpoSplitBlock="Chart.TPO.SplitBlock",e.ChartTpoMergeBlock="Chart.TPO.MergeBlock",e.ChartObjectTreeShow="Chart.ObjectTree.Show",e.ChartDataWindowShow="Chart.DataWindow.Show",e.ChartPaneControlsDeletePane="Chart.PaneControls.DeletePane",e.ChartPaneControlsMaximizePane="Chart.PaneControls.MaximizePane",e.ChartPaneControlsMinimizePane="Chart.PaneControls.MinimizePane",e.ChartPaneControlsMovePaneDown="Chart.PaneControls.MovePaneDown",e.ChartPaneControlsMovePaneUp="Chart.PaneControls.MovePaneUp",e.ChartPaneControlsCollapsePane="Chart.PaneControls.CollapsePane",e.ChartPaneControlsRestorePane="Chart.PaneControls.RestorePane",e.ChartPriceScaleLabels="Chart.PriceScale.Labels",e.ChartPriceScaleLabelsToggleBidAskLabelsVisibility="Chart.PriceScale.Labels.ToggleBidAskLabelsVisibility",e.ChartPriceScaleLabelsToggleHighLowPriceLabelsVisibility="Chart.PriceScale.Labels.ToggleHighLowPriceLabelsVisibility",e.ChartPriceScaleLabelsToggleAveragePriceLabelVisibility="Chart.PriceScale.Labels.ToggleAveragePriceLabelVisibility",e.ChartPriceScaleLabelsToggleIndicatorsNameLabelsVisibility="Chart.PriceScale.Labels.ToggleIndicatorsNameLabelsVisibility",e.ChartPriceScaleLabelsToggleIndicatorsValueLabelsVisibility="Chart.PriceScale.Labels.ToggleIndicatorsValueLabelsVisibility",e.ChartPriceScaleLabelsTogglePrePostMarketLabelsVisibility="Chart.PriceScale.Labels.TogglePrePostMarketLabelsVisibility",e.ChartPriceScaleLabelsToggleNoOverlappingLabelsVisibility="Chart.PriceScale.Labels.ToggleNoOverlappingLabelsVisibility",e.ChartPriceScaleLabelsToggleSeriesLastValueVisibility="Chart.PriceScale.Labels.ToggleSeriesLastValueVisibility",e.ChartPriceScaleLabelsToggleSymbolNameLabelsVisibility="Chart.PriceScale.Labels.ToggleSymbolNameLabelsVisibility",e.ChartPriceScaleLabelsToggleSymbolPrevCloseValueVisibility="Chart.PriceScale.Labels.ToggleSymbolPrevCloseValueVisibility",e.ChartPriceScaleMergeAllScales="Chart.PriceScale.MergeAllScales",e.ChartPriceScaleMergeAllScalesToLeft="Chart.PriceScale.MergeAllScalesToLeft",e.ChartPriceScaleMergeAllScalesToRight="Chart.PriceScale.MergeAllScalesToRight",e.ChartPriceScaleMoveToLeft="Chart.PriceScale.MoveToLeft",e.ChartPriceScaleMoveToRight="Chart.PriceScale.MoveToRight",e.ChartPriceScaleReset="Chart.PriceScale.Reset",e.ChartPriceScaleToggleAddOrderPlusButtonVisibility="Chart.PriceScale.ToggleAddOrderPlusButtonVisibility",e.ChartPriceScaleToggleAutoScale="Chart.PriceScale.ToggleAutoScale",e.ChartPriceScaleToggleAutoScaleSeriesOnly="Chart.PriceScale.ToggleAutoScaleSeriesOnly",e.ChartPriceScaleToggleCountdownToBarCloseVisibility="Chart.PriceScale.ToggleCountdownToBarCloseVisibility",e.ChartPriceScaleToggleIndexedTo100="Chart.PriceScale.ToggleIndexedTo100",e.ChartPriceScaleToggleInvertScale="Chart.PriceScale.ToggleInvertScale",e.ChartPriceScaleToggleLogarithmic="Chart.PriceScale.ToggleLogarithmic",e.ChartPriceScaleTogglePercentage="Chart.PriceScale.TogglePercentage",e.ChartPriceScaleToggleRegular="Chart.PriceScale.ToggleRegular",e.ChartRedo="Chart.Redo",e.ChartRemoveAllIndicators="Chart.RemoveAllIndicators",e.ChartRemoveAllIndicatorsAndLineTools="Chart.RemoveAllIndicatorsAndLineTools",e.ChartRemoveAllLineTools="Chart.RemoveAllLineTools",e.ChartScalesReset="Chart.Scales.Reset",e.ChartScalesToggleLockPriceToBarRatio="Chart.Scales.ToggleLockPriceToBarRatio",e.ChartScrollToLineTool="Chart.ScrollToLineTool",e.ChartSelectedObjectHide="Chart.SelectedObject.Hide",e.ChartSelectedObjectRemove="Chart.SelectedObject.Remove",e.ChartSelectedObjectShow="Chart.SelectedObject.Show",e.ChartSelectedObjectShowSettingsDialog="Chart.SelectedObject.ShowSettingsDialog",e.ChartSelectedObjectInsertRowTable="Chart.SelectedObject.InsertRowTable",e.ChartSelectedObjectInsertColumnTable="Chart.SelectedObject.InsertColumnTable",e.ChartSelectedObjectRemoveRowTable="Chart.SelectedObject.RemoveRowTable",e.ChartSelectedObjectRemoveColumnTable="Chart.SelectedObject.RemoveColumnTable",e.ChartSelectedObjectToggleLocked="Chart.SelectedObject.ToggleLocked",e.ChartSelectedObjectToggleAnchored="Chart.SelectedObject.ToggleAnchored",e.ChartSeriesPriceScaleToggleAutoScale="Chart.Series.PriceScale.ToggleAutoScale",e.ChartSeriesPriceScaleToggleIndexedTo100="Chart.Series.PriceScale.ToggleIndexedTo100",e.ChartSeriesPriceScaleToggleInvertPriceScale="Chart.Series.PriceScale.ToggleInvertPriceScale",e.ChartSeriesPriceScaleToggleLogarithmic="Chart.Series.PriceScale.ToggleLogarithmic",e.ChartSeriesPriceScaleTogglePercentage="Chart.Series.PriceScale.TogglePercentage",e.ChartSeriesPriceScaleToggleRegular="Chart.Series.PriceScale.ToggleRegular",e.ChartSessionBreaksToggleVisibility="Chart.SessionBreaks.ToggleVisibility",e.ChartSetSession="Chart.SetSession",e.ChartSourceChangePriceScale="Chart.Source.ChangePriceScale",e.ChartSourceMergeDown="Chart.Source.MergeDown",e.ChartSourceMergeUp="Chart.Source.MergeUp",e.ChartSourceMoveToNoScale="Chart.Source.MoveToNoScale",e.ChartSourceMoveToOtherScale="Chart.Source.MoveToOtherScale",e.ChartSourceMoveToPane="Chart.Source.MoveToPane",e.ChartSourceUnmergeDown="Chart.Source.UnmergeDown",e.ChartSourceUnmergeUp="Chart.Source.UnmergeUp",e.ChartSourceVisualOrder="Chart.Source.VisualOrder",e.ChartSourceVisualOrderBringForward="Chart.Source.VisualOrder.BringForward",e.ChartSourceVisualOrderBringToFront="Chart.Source.VisualOrder.BringToFront",e.ChartSourceVisualOrderSendBackward="Chart.Source.VisualOrder.SendBackward",e.ChartSourceVisualOrderSendToBack="Chart.Source.VisualOrder.SendToBack",e.ChartSourceResetInputPoints="Chart.Source.ResetInputPoints",e.ChartOpenTableView="Chart.OpenTableView",e.ChartThemeApply="Chart.Theme.Apply",e.ChartThemeApplyCustom="Chart.Theme.Apply.Custom",e.ChartThemeSaveAs="Chart.Theme.SaveAs",e.ChartTimeScaleReset="Chart.TimeScale.Reset",e.ChartUndo="Chart.Undo",e.ChartShowAllIdeas="Chart.ShowAllIdeas",e.ChartShowIdeasOfFollowedUsers="Chart.ShowIdeasOfFollowedUsers",e.ChartShowMyIdeasOnly="Chart.ShowMyIdeasOnly",e.ChartToggleVisibilityAllLineTools="Chart.ToggleVisibility.AllLineTools",e.ChartToggleVisibilityContinuousContractSwitch="Chart.ToggleVisibility.ContinuousContractSwitch",e.ChartToggleVisibilityContractExpiration="Chart.ToggleVisibility.ContractExpiration",e.ChartToggleVisibilityDividends="Chart.ToggleVisibility.Dividends",e.ChartToggleVisibilityEarnings="Chart.ToggleVisibility.Earnings",e.ChartToggleVisibilityEconomicEvents="Chart.ToggleVisibility.EconomicEvents",e.ChartToggleVisibilitySplits="Chart.ToggleVisibility.Splits",e.ChartToggleVisibilityLatestNewsAndMinds="Chart.ToggleVisibility.LatestNewsAndMinds",e.ChartToggleVisibilityKeyFactsToday="Chart.ToggleVisibility.KeyFactsToday",e.ChartSourceIntervalsVisibility="Chart.Source.IntervalsVisibility",e.ChartSourceIntervalsVisibilityCurrentAndAbove="Chart.Source.IntervalsVisibility.CurrentAndAbove",e.ChartSourceIntervalsVisibilityCurrentAndBelow="Chart.Source.IntervalsVisibility.CurrentAndBelow",e.ChartSourceIntervalsVisibilityOnlyCurrent="Chart.Source.IntervalsVisibility.Current",e.ChartSourceIntervalsVisibilityAll="Chart.Source.IntervalsVisibility.All",e.NoteCreate="Note.Create",e.NoteEdit="Note.Edit",e.NoteRemove="Note.Remove",e.ObjectsTreeCreateGroup="ObjectsTree.CreateGroup",e.ObjectsTreeRemoveItem="ObjectsTree.RemoveItem",e.ObjectsTreeRenameItem="ObjectsTree.RenameItem",e.ObjectsTreeToggleItemLocked="ObjectsTree.ToggleItemLocked",e.ObjectsTreeToggleItemVisibility="ObjectsTree.ToggleItemVisibility",e.PineEditorConsoleCopyMessage="PineEditor.Console.CopyMessage",e.PineEditorConsoleToggleVisibility="PineEditor.Console.ToggleVisibility",e.PineEditorConsoleClear="PineEditor.Console.Clear",e.ScreenerColumnRemove="Screener.Column.Remove",e.ScreenerFilterChange="Screener.Filter.Change",e.ScreenerFilterReset="Screener.Filter.Reset",e.ScreenerToggleVisibilityCurrency="Screener.ToggleVisibility.Currency",e.ScreenerToggleVisibilityDescription="Screener.ToggleVisibility.Description",e.ScreenerToggleVisibilityRating="Screener.ToggleVisibility.Rating",e.ScreenerToggleVisibilitySymbolType="Screener.ToggleVisibility.SymbolType",e.TradingAddOrder="Trading.AddOrder",e.TradingCancelOrder="Trading.CancelOrder",e.TradingClosePosition="Trading.ClosePosition",e.TradingCustomActionId="Trading.CustomActionId",e.TradingDOMPlaceLimitOrder="Trading.DOMPlaceLimitOrder",e.TradingDOMPlaceMarketOrder="Trading.DOMPlaceMarketOrder",e.TradingDOMPlaceStopLimitOrder="Trading.DOMPlaceStopLimitOrder",e.TradingDOMPlaceStopOrder="Trading.DOMPlaceStopOrder",e.TradingEditOrder="Trading.EditOrder",e.TradingModifyPosition="Trading.ModifyPosition",e.TradingReversePosition="Trading.ReversePosition",e.TradingSellBuyButtonsToggleVisibility="Trading.SellBuyButtonsToggleVisibility",e.TradingTradeFromChart="Trading.TradeFromChart",e.TradingNoOverlapMode="Trading.NoOverlapMode",e.TradingShowSelectBrokerPanel="Trading.ShowSelectBrokerPanel",e.TradingOrderTitle="Trading.OrderTitle",e.TradingPositionTitle="Trading.PositionTitle",e.WatchlistActions="Watchlist.Actions",e.WatchlistAddSelectedSymbolsToCompare="Watchlist.AddSelectedSymbolsToCompare ",e.WatchlistAddSymbolToCompare="Watchlist.AddSymbolToCompare",e.WatchlistAddSymbolToSection="Watchlist.AddSymbolToSection",e.WatchlistChangeFlaggedGroupColor="Watchlist.ChangeFlaggedGroupColor",e.WatchlistAddSymbol="Watchlist.AddSymbol",e.WatchlistCreate="Watchlist.Create",e.WatchlistAddSelectedSymbols="Watchlist.AddSelectedSymbols",e.WatchlistAddSelectedSymbolsLists="Watchlist.AddSelectedSymbols.Lists",e.WatchlistGetDisplayedTickerDescription="Watchlist.GetDisplayedTickerDescription",e.WatchlistCreateSection="Watchlist.CreateSection",e.WatchlistFlagSelectedSymbols="Watchlist.FlagSelectedSymbols",e.WatchlistFlagSymbol="Watchlist.FlagSymbol",e.WatchlistOpenSymbolChart="Watchlist.OpenSymbolChart",e.WatchlistOpenSymbolOverview="Watchlist.OpenSymbolOverview",e.WatchlistRemoveSection="Watchlist.RemoveSection",e.WatchlistRemoveSymbol="Watchlist.RemoveSymbol",e.WatchlistRenameSection="Watchlist.RenameSection",e.WatchlistUnflagAllSymbols="Watchlist.UnflagAllSymbols",e.WatchlistUnflagSelectedSymbols="Watchlist.UnflagSelectedSymbols",e.WatchlistUnflagSymbol="Watchlist.UnflagSymbol",function(e){e.extractErrorReason=function(e){return e.params[1]}}(t||(t={})),function(e){e.Default="default",e.FullSingleSession="full_single_session"}(i||(i={})),exports.TimeFrameType=void 0,(o=exports.TimeFrameType||(exports.TimeFrameType={})).PeriodBack="period-back",o.TimeRange="time-range",function(e){e.PeriodBack="period-back",e.TimeRange="time-range"}(r||(r={})),exports.MarketStatus=void 0,(n=exports.MarketStatus||(exports.MarketStatus={})).Open="market",n.Pre="pre_market",n.Post="post_market",n.Close="out_of_session",n.Holiday="holiday",exports.MenuItemType=void 0,(a=exports.MenuItemType||(exports.MenuItemType={})).Separator="separator",a.Action="action",exports.ClearMarksMode=void 0,(s=exports.ClearMarksMode||(exports.ClearMarksMode={}))[s.All=0]="All",s[s.BarMarks=1]="BarMarks",s[s.TimeScaleMarks=2]="TimeScaleMarks",exports.LineStudyPlotStyle=void 0,(l=exports.LineStudyPlotStyle||(exports.LineStudyPlotStyle={}))[l.Line=0]="Line",l[l.Histogram=1]="Histogram",l[l.Cross=3]="Cross",l[l.Area=4]="Area",l[l.Columns=5]="Columns",l[l.Circles=6]="Circles",l[l.LineWithBreaks=7]="LineWithBreaks",l[l.AreaWithBreaks=8]="AreaWithBreaks",l[l.StepLine=9]="StepLine",l[l.StepLineWithDiamonds=10]="StepLineWithDiamonds",l[l.StepLineWithBreaks=11]="StepLineWithBreaks",exports.StudyPlotType=void 0,(d=exports.StudyPlotType||(exports.StudyPlotType={})).Line="line",d.Colorer="colorer",d.BarColorer="bar_colorer",d.BgColorer="bg_colorer",d.TextColorer="text_colorer",d.OhlcColorer="ohlc_colorer",d.CandleWickColorer="wick_colorer",d.CandleBorderColorer="border_colorer",d.UpColorer="up_colorer",d.DownColorer="down_colorer",d.Shapes="shapes",d.Chars="chars",d.Arrows="arrows",d.Data="data",d.DataOffset="dataoffset",d.OhlcOpen="ohlc_open",d.OhlcHigh="ohlc_high",d.OhlcLow="ohlc_low",d.OhlcClose="ohlc_close",function(e){e.AlertCondition="alertcondition"}(c||(c={})),exports.StudyPlotDisplayTarget=void 0,(h=exports.StudyPlotDisplayTarget||(exports.StudyPlotDisplayTarget={}))[h.None=0]="None",h[h.Pane=1]="Pane",h[h.DataWindow=2]="DataWindow",h[h.PriceScale=4]="PriceScale",h[h.StatusLine=8]="StatusLine",h[h.All=15]="All",function(e){e[e.None=0]="None",e[e.Pane=1]="Pane",e[e.DataWindow=2]="DataWindow",e[e.PriceScale=4]="PriceScale",e[e.StatusLine=8]="StatusLine",e[e.All=15]="All"}(g||(g={})),exports.OhlcStudyPlotStyle=void 0,(u=exports.OhlcStudyPlotStyle||(exports.OhlcStudyPlotStyle={})).OhlcBars="ohlc_bars",u.OhlcCandles="ohlc_candles",function(e){e.Auto="auto",e.Tiny="tiny",e.Small="small",e.Normal="normal",e.Large="large",e.Huge="huge"}(C||(C={})),exports.StudyInputType=void 0,(p=exports.StudyInputType||(exports.StudyInputType={})).Integer="integer",p.Float="float",p.Price="price",p.Bool="bool",p.Text="text",p.Symbol="symbol",p.Session="session",p.Source="source",p.Resolution="resolution",p.Time="time",p.BarTime="bar_time",p.Color="color",p.Textarea="text_area",function(e){e[e.None=0]="None",e[e.DataWindow=2]="DataWindow",e[e.StatusLine=8]="StatusLine",e[e.All=15]="All"}(S||(S={})),function(e){e.InitialCapital="initial_capital",e.Currency="currency",e.DefaultQTYValue="default_qty_value",e.DefaultQTYType="default_qty_type",e.Pyramiding="pyramiding",e.ComissionValue="commission_value",e.ComissionType="commission_type",e.BacktestFillLimitsAssumtion="backtest_fill_limits_assumption",e.Slippage="slippage",e.CalcOnOrderFills="calc_on_order_fills",e.CalcOnEveryTick="calc_on_every_tick",e.MarginLong="margin_long",e.MarginShort="margin_short",e.UseBarMagnifier="use_bar_magnifier",e.ProcessOrdersOnClose="process_orders_on_close",e.FillOrdersOnStandardOHLC="fill_orders_on_standard_ohlc"}(m||(m={})),function(e){e.Fixed="fixed",e.CashPerOrder="cash_per_order",e.PercentOfEquity="percent_of_equity"}(y||(y={})),function(e){e.Percent="percent",e.CashPerContract="cash_per_contract",e.CashPerOrder="cash_per_order"}(T||(T={})),function(e){e.FirstBar="first_visible_bar_time",e.LastBar="last_visible_bar_time",e.Realtime="subscribeRealtime"}(_||(_={})),function(e){e.FgColor="__chart_fgcolor",e.BgColor="__chart_bgcolor"}(b||(b={})),exports.StudyTargetPriceScale=void 0,(P=exports.StudyTargetPriceScale||(exports.StudyTargetPriceScale={}))[P.Right=0]="Right",P[P.Left=1]="Left",P[P.NoScale=2]="NoScale",function(e){e[e.Right=0]="Right",e[e.Left=1]="Left",e[e.None=2]="None"}(L||(L={})),exports.FilledAreaType=void 0,(w=exports.FilledAreaType||(exports.FilledAreaType={})).TypePlots="plot_plot",w.TypeHlines="hline_hline",function(e){e[e.StopLoss=0]="StopLoss",e[e.TrailingStop=1]="TrailingStop",e[e.GuaranteedStop=2]="GuaranteedStop"}(A||(A={})),function(e){e.Futures="futures",e.Options="options",e.Others="others",e.FutureAndOptions="futureAndOptions"}(f||(f={})),function(e){e.PerContract="contract",e.Fixed="fixed",e.Percent="percent",e.Disabled="disabled"}(v||(v={})),function(e){e.Stocks="stocks",e.Futures="futures",e.Forex="forex",e.Crypto="crypto",e.Others="others"}(I||(I={})),function(e){e.Symbol="symbol"}(O||(O={})),function(e){e[e.Critical=0]="Critical",e[e.Informational=1]="Informational"}(R||(R={})),function(e){e[e.PopUp=0]="PopUp",e[e.Notification=1]="Notification"}(D||(D={})),function(e){e.Quantity="qty",e.OrderSide="side",e.Price="price",e.Duration="duration",e.Brackets="brackets",e.StopLossType="slType"}(x||(x={})),function(e){e[e.CONNECTED=1]="CONNECTED",e[e.CONNECTING=2]="CONNECTING",e[e.DISCONNECTED=3]="DISCONNECTED",e[e.ERROR=4]="ERROR"}(k||(k={})),exports.ConnectionStatus=void 0,(V=exports.ConnectionStatus||(exports.ConnectionStatus={}))[V.Connected=1]="Connected",V[V.Connecting=2]="Connecting",V[V.Disconnected=3]="Disconnected",V[V.Error=4]="Error",function(e){e[e.LIMIT=1]="LIMIT",e[e.MARKET=2]="MARKET",e[e.STOP=3]="STOP",e[e.STOPLIMIT=4]="STOPLIMIT"}(F||(F={})),exports.OrderType=void 0,(W=exports.OrderType||(exports.OrderType={}))[W.Limit=1]="Limit",W[W.Market=2]="Market",W[W.Stop=3]="Stop",W[W.StopLimit=4]="StopLimit",function(e){e[e.BUY=1]="BUY",e[e.SELL=-1]="SELL"}(E||(E={})),exports.Side=void 0,(M=exports.Side||(exports.Side={}))[M.Buy=1]="Buy",M[M.Sell=-1]="Sell",function(e){e[e.CANCELED=1]="CANCELED",e[e.FILLED=2]="FILLED",e[e.INACTIVE=3]="INACTIVE",e[e.PLACING=4]="PLACING",e[e.REJECTED=5]="REJECTED",e[e.WORKING=6]="WORKING"}(B||(B={})),function(e){e[e.ALL=0]="ALL",e[e.CANCELED=1]="CANCELED",e[e.FILLED=2]="FILLED",e[e.INACTIVE=3]="INACTIVE",e[e.REJECTED=5]="REJECTED",e[e.WORKING=6]="WORKING"}(N||(N={})),exports.OrderStatus=void 0,(U=exports.OrderStatus||(exports.OrderStatus={}))[U.Canceled=1]="Canceled",U[U.Filled=2]="Filled",U[U.Inactive=3]="Inactive",U[U.Placing=4]="Placing",U[U.Rejected=5]="Rejected",U[U.Working=6]="Working",exports.OrderStatusFilter=void 0,(H=exports.OrderStatusFilter||(exports.OrderStatusFilter={}))[H.All=0]="All",H[H.Canceled=1]="Canceled",H[H.Filled=2]="Filled",H[H.Inactive=3]="Inactive",H[H.Rejected=5]="Rejected",H[H.Working=6]="Working",function(e){e[e.Order=1]="Order",e[e.Position=2]="Position"}(j||(j={})),function(e){e[e.ORDER=1]="ORDER",e[e.POSITION=2]="POSITION"}(z||(z={})),exports.ParentType=void 0,(G=exports.ParentType||(exports.ParentType={}))[G.Order=1]="Order",G[G.Position=2]="Position",G[G.IndividualPosition=3]="IndividualPosition",function(e){e[e.StopLoss=0]="StopLoss",e[e.TakeProfit=1]="TakeProfit",e[e.TrailingStop=2]="TrailingStop",e[e.GuaranteedStop=3]="GuaranteedStop"}($||($={})),function(e){e[e.LIMITPRICE=1]="LIMITPRICE",e[e.STOPPRICE=2]="STOPPRICE",e[e.TAKEPROFIT=3]="TAKEPROFIT",e[e.STOPLOSS=4]="STOPLOSS"}(J||(J={})),exports.OrderTicketFocusControl=void 0,(K=exports.OrderTicketFocusControl||(exports.OrderTicketFocusControl={}))[K.LimitPrice=1]="LimitPrice",K[K.StopPrice=2]="StopPrice",K[K.TakeProfit=3]="TakeProfit",K[K.StopLoss=4]="StopLoss",K[K.Quantity=5]="Quantity",function(e){e[e.ERROR=0]="ERROR",e[e.SUCCESS=1]="SUCCESS"}(q||(q={})),exports.NotificationType=void 0,(Z=exports.NotificationType||(exports.NotificationType={}))[Z.Error=0]="Error",Z[Z.Success=1]="Success",function(e){e[e.Demo=1]="Demo",e[e.Real=0]="Real"}(Q||(Q={})),exports.OrderOrPositionMessageType=void 0,(Y=exports.OrderOrPositionMessageType||(exports.OrderOrPositionMessageType={})).Information="information",Y.Warning="warning",Y.Error="error",function(e){e.Demo="demo",e.Live="live"}(X||(X={})),function(e){e[e.LogOut=0]="LogOut",e[e.FailedRestoring=1]="FailedRestoring",e[e.Offline=2]="Offline",e[e.APIError=3]="APIError",e[e.TwoFactorRequired=4]="TwoFactorRequired",e[e.CancelAuthorization=5]="CancelAuthorization",e[e.TimeOutForAuthorization=6]="TimeOutForAuthorization",e[e.OauthError=7]="OauthError",e[e.BrokenConnection=8]="BrokenConnection",e[e.Reconnect=9]="Reconnect",e[e.FailedSignIn=10]="FailedSignIn"}(ee||(ee={})),function(e){e[e.None=0]="None",e[e.Pips=1]="Pips",e[e.Ticks=2]="Ticks"}(te||(te={})),function(e){e.Halted="HALTED",e.NotShortable="NOT-SHORTABLE",e.HardToBorrow="HARD-TO-BORROW"}(ie||(ie={})),function(e){e[e.Limit=1]="Limit",e[e.Stop=2]="Stop"}(oe||(oe={})),function(e){e.Disallowed="disallowed",e.Allowed="allowed",e.AllowedWithWarning="allowed_with_warning"}(re||(re={})),function(e){e.PlaceOrder="place_order",e.ModifyOrder="modify_order",e.CancelOrder="cancel_order",e.CancelMultipleOrders="cancel_multiple_orders",e.ModifyPosition="modify_position",e.ClosePosition="close_position",e.ModifyIndividualPosition="modify_individual_position",e.CloseIndividualPosition="close_individual_position",e.CloseNetPosition="close_net_position"}(ne||(ne={})),exports.StandardFormatterName=void 0,(ae=exports.StandardFormatterName||(exports.StandardFormatterName={})).Date="date",ae.DateOrDateTime="dateOrDateTime",ae.Default="default",ae.Fixed="fixed",ae.FixedInCurrency="fixedInCurrency",ae.VariablePrecision="variablePrecision",ae.FormatQuantity="formatQuantity",ae.FormatPrice="formatPrice",ae.FormatPriceForexSup="formatPriceForexSup",ae.FormatPriceInCurrency="formatPriceInCurrency",ae.IntegerSeparated="integerSeparated",ae.LocalDate="localDate",ae.LocalDateOrDateTime="localDateOrDateTime",ae.Percentage="percentage",ae.Pips="pips",ae.Profit="profit",ae.ProfitInInstrumentCurrency="profitInInstrumentCurrency",ae.ProfitInPercent="profitInPercent",ae.Side="side",ae.PositionSide="positionSide",ae.Status="status",ae.Symbol="symbol",ae.Text="text",ae.Type="type",ae.MarginPercent="marginPercent",ae.Empty="empty",exports.OverridePriceAxisLastValueMode=void 0,(se=exports.OverridePriceAxisLastValueMode||(exports.OverridePriceAxisLastValueMode={}))[se.LastPriceAndPercentageValue=0]="LastPriceAndPercentageValue",se[se.LastValueAccordingToScale=1]="LastValueAccordingToScale",exports.OverrideLineStyle=void 0,(le=exports.OverrideLineStyle||(exports.OverrideLineStyle={}))[le.Solid=0]="Solid",le[le.Dotted=1]="Dotted",le[le.Dashed=2]="Dashed",function(e){e[e.Offline=0]="Offline",e[e.Resolving=1]="Resolving",e[e.Loading=2]="Loading",e[e.Ready=3]="Ready",e[e.InvalidSymbol=4]="InvalidSymbol",e[e.Snapshot=5]="Snapshot",e[e.EOD=6]="EOD",e[e.Pulse=7]="Pulse",e[e.Delayed=8]="Delayed",e[e.DelayedSteaming=9]="DelayedSteaming",e[e.NoBars=10]="NoBars",e[e.Replay=11]="Replay",e[e.Error=12]="Error",e[e.CalculationError=13]="CalculationError",e[e.UnsupportedResolution=14]="UnsupportedResolution"}(de||(de={})),function(e){e[e.Markers=0]="Markers",e[e.Stepline=1]="Stepline",e[e.Simple=2]="Simple"}(ce||(ce={})),exports.ChartStyle=void 0,(he=exports.ChartStyle||(exports.ChartStyle={}))[he.Bar=0]="Bar",he[he.Candle=1]="Candle",he[he.Line=2]="Line",he[he.Area=3]="Area",he[he.Renko=4]="Renko",he[he.Kagi=5]="Kagi",he[he.PnF=6]="PnF",he[he.LineBreak=7]="LineBreak",he[he.HeikinAshi=8]="HeikinAshi",he[he.HollowCandle=9]="HollowCandle",he[he.Baseline=10]="Baseline",he[he.Range=11]="Range",he[he.HiLo=12]="HiLo",he[he.Column=13]="Column",he[he.LineWithMarkers=14]="LineWithMarkers",he[he.Stepline=15]="Stepline",he[he.HLCArea=16]="HLCArea",he[he.VolFootprint=17]="VolFootprint",he[he.TPO=18]="TPO",he[he.VolCandle=19]="VolCandle",he[he.SVP=20]="SVP",he[he.HLCBars=21]="HLCBars",exports.TimeHoursFormat=void 0,(ge=exports.TimeHoursFormat||(exports.TimeHoursFormat={})).TwentyFourHours="24-hours",ge.TwelveHours="12-hours",function(e){e[e.Initial=2]="Initial",e[e.SeriesZOrderIsAlwaysZero=3]="SeriesZOrderIsAlwaysZero",e[e.Current=3]="Current"}(ue||(ue={})),exports.PlDisplay=void 0,(Ce=exports.PlDisplay||(exports.PlDisplay={}))[Ce.Money=0]="Money",Ce[Ce.Pips=1]="Pips",Ce[Ce.Percentage=2]="Percentage",exports.TradedGroupHorizontalAlignment=void 0,(pe=exports.TradedGroupHorizontalAlignment||(exports.TradedGroupHorizontalAlignment={}))[pe.Left=0]="Left",pe[pe.Center=1]="Center",pe[pe.Right=2]="Right",exports.PlDisplay.Money,exports.PlDisplay.Money,exports.TradedGroupHorizontalAlignment.Right,function(e){e[e.Background=0]="Background",e[e.Foreground=1]="Foreground",e[e.Topmost=2]="Topmost"}(Se||(Se={})),function(e){e[e.Unavailable=0]="Unavailable",e[e.AvailableReadonlyAlwaysDisabled=1]="AvailableReadonlyAlwaysDisabled",e[e.AvailableReadonlyAlwaysEnabled=2]="AvailableReadonlyAlwaysEnabled",e[e.Available=3]="Available"}(me||(me={})),function(e){e[e.ViewportChangeUserAction=0]="ViewportChangeUserAction",e[e.DataUpdate=1]="DataUpdate",e[e.SeriesRestart=2]="SeriesRestart",e[e.SeriesCompleted=3]="SeriesCompleted",e[e.StudyCreation=4]="StudyCreation"}(ye||(ye={})),function(e){e[e.Chart=0]="Chart"}(Te||(Te={})),exports.VisibilityType=void 0,(_e=exports.VisibilityType||(exports.VisibilityType={})).AlwaysOn="alwaysOn",_e.VisibleOnMouseOver="visibleOnMouseOver",_e.AlwaysOff="alwaysOff",exports.PriceScaleMode=void 0,(be=exports.PriceScaleMode||(exports.PriceScaleMode={}))[be.Normal=0]="Normal",be[be.Log=1]="Log",be[be.Percentage=2]="Percentage",be[be.IndexedTo100=3]="IndexedTo100",exports.SeriesType=void 0,(Pe=exports.SeriesType||(exports.SeriesType={}))[Pe.Bars=0]="Bars",Pe[Pe.Candles=1]="Candles",Pe[Pe.Line=2]="Line",Pe[Pe.Area=3]="Area",Pe[Pe.HeikenAshi=8]="HeikenAshi",Pe[Pe.HollowCandles=9]="HollowCandles",Pe[Pe.Baseline=10]="Baseline",Pe[Pe.HiLo=12]="HiLo",Pe[Pe.Column=13]="Column",Pe[Pe.LineWithMarkers=14]="LineWithMarkers",Pe[Pe.Stepline=15]="Stepline",Pe[Pe.HLCArea=16]="HLCArea",Pe[Pe.VolCandle=19]="VolCandle",Pe[Pe.HLCBars=21]="HLCBars",Pe[Pe.Renko=4]="Renko",Pe[Pe.Kagi=5]="Kagi",Pe[Pe.PointAndFigure=6]="PointAndFigure",Pe[Pe.LineBreak=7]="LineBreak",function(e){e.Value="_seriesId"}(Le||(Le={})),function(e){e[e.InvalidSymbol=0]="InvalidSymbol",e[e.ReplayUnsupported=1]="ReplayUnsupported",e[e.UnsupportedDepth=2]="UnsupportedDepth",e[e.UnsupportedIntradyReplay=3]="UnsupportedIntradyReplay"}(we||(we={})),exports.HHistDirection=void 0,(Ae=exports.HHistDirection||(exports.HHistDirection={})).LeftToRight="left_to_right",Ae.RightToLeft="right_to_left",function(e){e.Relative="relative",e.Absolute="absolute"}(fe||(fe={})),function(e){e.UpDown="Up/Down",e.Total="Total",e.Delta="Delta"}(ve||(ve={})),exports.MarkLocation=void 0,(Ie=exports.MarkLocation||(exports.MarkLocation={})).AboveBar="AboveBar",Ie.BelowBar="BelowBar",Ie.Top="Top",Ie.Bottom="Bottom",Ie.Right="Right",Ie.Left="Left",Ie.Absolute="Absolute",Ie.AbsoluteUp="AbsoluteUp",Ie.AbsoluteDown="AbsoluteDown",function(e){e.Left="left",e.Center="center",e.Right="right"}(Oe||(Oe={})),function(e){e.Top="top",e.Middle="middle",e.Bottom="bottom"}(Re||(Re={})),exports.LineStyle=void 0,(De=exports.LineStyle||(exports.LineStyle={}))[De.Solid=0]="Solid",De[De.Dotted=1]="Dotted",De[De.Dashed=2]="Dashed";const ke={width:800,height:500,interval:"1D",timezone:"Etc/UTC",container:"",library_path:"",locale:"en",widgetbar:{details:!1,watchlist:!1,news:!1,datawindow:!1,watchlist_settings:{default_symbols:[]}},overrides:{"mainSeriesProperties.showCountdown":!1},studies_overrides:{},trading_customization:{position:{},order:{}},brokerConfig:{configFlags:{}},fullscreen:!1,autosize:!1,disabled_features:[],enabled_features:[],debug:!1,logo:{},time_frames:[{text:"5y",resolution:"1W"},{text:"1y",resolution:"1W"},{text:"6m",resolution:"120"},{text:"3m",resolution:"60"},{text:"1m",resolution:"30"},{text:"5d",resolution:"5"},{text:"1d",resolution:"1"}],client_id:"0",user_id:"0",charts_storage_api_version:"1.0",favorites:{intervals:[],chartTypes:[],indicators:[],drawingTools:[]}},Ve=JSON.parse('[{"iso":"en","dir":"ltr","language":"en"},{"iso":"en","dir":"ltr","language":"en"},{"iso":"de","dir":"ltr","language":"de"},{"iso":"fr","dir":"ltr","language":"fr"},{"iso":"ca","dir":"ltr","language":"ca_ES"},{"iso":"es","dir":"ltr","language":"es"},{"iso":"it","dir":"ltr","language":"it"},{"iso":"pl","dir":"ltr","language":"pl"},{"iso":"hu","dir":"ltr","language":"hu_HU"},{"iso":"sv","dir":"ltr","language":"sv"},{"iso":"tr","dir":"ltr","language":"tr"},{"iso":"ru","dir":"ltr","language":"ru"},{"iso":"pt","dir":"ltr","language":"pt"},{"iso":"id","dir":"ltr","language":"id_ID"},{"iso":"ms","dir":"ltr","language":"ms_MY"},{"iso":"th","dir":"ltr","language":"th"},{"iso":"vi","dir":"ltr","language":"vi"},{"iso":"ja","dir":"ltr","language":"ja"},{"iso":"ko","dir":"ltr","language":"ko"},{"iso":"zh-Hans","dir":"ltr","language":"zh"},{"iso":"zh-Hant","dir":"ltr","language":"zh_TW"},{"iso":"ar","dir":"rtl","language":"ar"},{"iso":"he","dir":"rtl","language":"he_IL"}]');let Fe=!1;function We(){return"CL v30.1.0 (internal id 7ddbc12fc55af245144286bc26bc6b9d917666c0 @ 2025-11-10T12:32:55.499Z)"}const Ee=class{constructor(e){if(this._id=`tradingview_${(1048576*(1+Math.random())|0).toString(16).substring(1)}`,this._ready=!1,this._readyHandlers=[],this._onWindowResize=this._autoResizeChart.bind(this),!e.datafeed)throw new Error("Datafeed is not defined");e.overrides?.["mainSeriesProperties.priceAxisProperties.lockScale"]&&(console.warn("mainSeriesProperties.priceAxisProperties.lockScale can not be set to true within the widget constructor"),delete e.overrides["mainSeriesProperties.priceAxisProperties.lockScale"]),this._options=xe(ke,e);"dark"===(this._options.theme||"light").toLowerCase()&&void 0===this._options.loading_screen&&(this._options.loading_screen={backgroundColor:"#131722"}),(this._options.debug||this._options.debug_broker)&&(Fe||(Fe=!0,console.log("Using CL v30.1.0 (internal id 7ddbc12fc55af245144286bc26bc6b9d917666c0 @ 2025-11-10T12:32:55.499Z)"))),this._innerWindowLoaded=new Promise((e=>{this._innerWindowResolver=e})),this._create()}setDebugMode(e){this._innerAPI().setDebugMode(e)}onChartReady(e){this._ready?e.call(this):this._readyHandlers.push(e)}headerReady(){return this._innerWindowLoaded.then((()=>this._innerWindow().headerReady()))}onGrayedObjectClicked(e){this._doWhenInnerApiLoaded((t=>{t.onGrayedObjectClicked(e)}))}onShortcut(e,t){this._doWhenInnerWindowLoaded((i=>{i.createShortcutAction(e,t)}))}subscribe(e,t){this._doWhenInnerApiLoaded((i=>{i.subscribe(e,t)}))}unsubscribe(e,t){this._doWhenInnerApiLoaded((i=>{i.unsubscribe(e,t)}))}chart(e){return this._innerAPI().chart(e)}getLanguage(){return this._options.locale}setSymbol(e,t,i){this._innerAPI().changeSymbol(e,t,i)}remove(){window.removeEventListener("resize",this._onWindowResize),this._readyHandlers.splice(0,this._readyHandlers.length),delete window[this._id],this._iFrame.parentNode&&this._iFrame.parentNode.removeChild(this._iFrame)}closePopupsAndDialogs(){this._doWhenInnerApiLoaded((e=>{e.closePopupsAndDialogs()}))}selectLineTool(e,t){return this._innerAPI().selectLineTool(e,t)}selectedLineTool(){return this._innerAPI().selectedLineTool()}save(e,t){this._innerAPI().saveChart(e,t)}async load(e,t){return this._innerAPI().loadChart({json:e,extendedData:t})}getSavedCharts(e){this._innerAPI().getSavedCharts(e)}loadChartFromServer(e){return this._innerAPI().loadChartFromServer(e)}saveChartToServer(e,t,i){this._innerAPI().saveChartToServer(e,t,i)}removeChartFromServer(e,t){this._innerAPI().removeChartFromServer(e,t)}onContextMenu(e){this._doWhenInnerApiLoaded((t=>{t.onContextMenu(e)}))}createButton(e){return this._innerWindow().createButton(e)}removeButton(e){this._innerWindow().removeButton(e)}createDropdown(e){return this._innerWindow().createDropdown(e)}showNoticeDialog(e){this._doWhenInnerApiLoaded((t=>{t.showNoticeDialog(e)}))}showConfirmDialog(e){this._doWhenInnerApiLoaded((t=>{t.showConfirmDialog(e)}))}showLoadChartDialog(){this._innerAPI().showLoadChartDialog()}showSaveAsChartDialog(){this._innerAPI().showSaveAsChartDialog()}symbolInterval(){return this._innerAPI().getSymbolInterval()}mainSeriesPriceFormatter(){return this._innerAPI().mainSeriesPriceFormatter()}getIntervals(){return this._innerAPI().getIntervals()}getStudiesList(){return this._innerAPI().getStudiesList()}getStudyInputs(e){return this._innerAPI().getStudyInputs(e)}getStudyStyles(e){return this._innerAPI().getStudyStyles(e)}addCustomCSSFile(e){this._innerWindow().addCustomCSSFile(e)}applyOverrides(e){this._options=xe(this._options,{overrides:e}),this._doWhenInnerWindowLoaded((t=>{t.applyOverrides(e)}))}applyTradingCustomization(e){return new Promise(((t,i)=>{this._doWhenInnerWindowLoaded((o=>{o.applyTradingCustomization(e).then(t).catch(i)}))}))}applyStudiesOverrides(e){this._doWhenInnerWindowLoaded((t=>{t.applyStudiesOverrides(e)}))}watchList(){return this._innerAPI().watchlist()}news(){return this._innerAPI().news()}widgetbar(){return this._innerAPI().widgetbar()}activeChart(){return this._innerAPI().activeChart()}activeChartIndex(){return this._innerAPI().activeChartIndex()}setActiveChart(e){return this._innerAPI().setActiveChart(e)}chartsCount(){return this._innerAPI().chartsCount()}layout(){return this._innerAPI().layout()}setLayout(e){this._innerAPI().setLayout(e)}layoutName(){return this._innerAPI().layoutName()}resetLayoutSizes(e){this._innerAPI().resetLayoutSizes(e)}setLayoutSizes(e,t){this._innerAPI().setLayoutSizes(e,t)}changeTheme(e,t){return this._innerWindow().changeTheme(e,t)}getTheme(){return this._innerWindow().getTheme()}takeScreenshot(){this._doWhenInnerApiLoaded((e=>{e.takeScreenshot()}))}lockAllDrawingTools(){return this._innerAPI().lockAllDrawingTools()}hideAllDrawingTools(){return this._innerAPI().hideAllDrawingTools()}drawOnAllChartsEnabled(){return this._innerAPI().drawOnAllChartsEnabled()}drawOnAllCharts(e){this._innerAPI().drawOnAllCharts(e)}magnetEnabled(){return this._innerAPI().magnetEnabled()}magnetMode(){return this._innerAPI().magnetMode()}undoRedoState(){return this._innerAPI().undoRedoState()}setIntervalLinkingEnabled(e){this._innerAPI().setIntervalLinkingEnabled(e)}setDateRangeLinkingEnabled(e){this._innerAPI().setDateRangeLinkingEnabled(e)}setTimeFrame(e){this._innerAPI().setTimeFrame(e)}symbolSync(){return this._innerAPI().symbolSync()}intervalSync(){return this._innerAPI().intervalSync()}crosshairSync(){return this._innerAPI().crosshairSync()}timeSync(){return this._innerAPI().timeSync()}dateRangeSync(){return this._innerAPI().dateRangeSync()}setFeatureEnabled(e,t){this._innerAPI().setFeatureEnabled(e,t)}getAllFeatures(){return this._innerWindow().getAllFeatures()}clearUndoHistory(){return this._innerAPI().clearUndoHistory()}undo(){return this._innerAPI().undo()}redo(){return this._innerAPI().redo()}startFullscreen(){this._innerAPI().startFullscreen()}exitFullscreen(){this._innerAPI().exitFullscreen()}takeClientScreenshot(e){return this._innerAPI().takeClientScreenshot(e)}navigationButtonsVisibility(){return this._innerWindow().getNavigationButtonsVisibility()}paneButtonsVisibility(){return this._innerWindow().getPaneButtonsVisibility()}dateFormat(){return this._innerWindow().getDateFormat()}timeHoursFormat(){return this._innerWindow().getTimeHoursFormat()}currencyAndUnitVisibility(){return this._innerWindow().getCurrencyAndUnitVisibility()}supportedChartTypes(){return this._innerAPI().supportedChartTypes()}watermark(){return this._innerAPI().watermark()}customSymbolStatus(){return this._innerWindow().customSymbolStatus()}setCSSCustomProperty(e,t){if(!1===e.startsWith("--"))throw new Error("customPropertyName should begin with a double hyphen");this._innerWindow().document.body.style.setProperty(e,t)}getCSSCustomPropertyValue(e){if(!1===e.startsWith("--"))throw new Error("customPropertyName should begin with a double hyphen");const t=this._innerWindow().document.body,i=t.style.getPropertyValue(e);if(i)return i;return getComputedStyle(t).getPropertyValue(e)}unloadUnusedCharts(){this._innerAPI().unloadUnusedCharts()}async customThemes(){return this._innerWindow().customThemes()}resetCache(){this._innerAPI().resetCache()}linking(){return this._innerAPI().linking}_innerAPI(){return this._innerWindow().tradingViewApi}_innerWindow(){return this._iFrame.contentWindow}_doWhenInnerWindowLoaded(e){this._ready?e(this._innerWindow()):this._innerWindowLoaded.then((()=>{e(this._innerWindow())}))}_doWhenInnerApiLoaded(e){this._doWhenInnerWindowLoaded((t=>{t.doWhenApiIsReady((()=>e(this._innerAPI())))}))}_autoResizeChart(){this._options.fullscreen&&(this._iFrame.style.height=window.innerHeight+"px",Me&&setTimeout((()=>{this._iFrame.style.height=window.innerHeight+"px"}),30))}async _create(){const e=this._options.enabled_features?.includes("iframe_loading_same_origin")??!1,t=e||(this._options.enabled_features?.includes("iframe_loading_compatibility_mode")??!1),i=e&&(this._options.enabled_features?.includes("iframe_loading_root_path")??!1),[o,r]=this._render(!t,e,i),n=this._options.container,a="string"==typeof n?document.getElementById(n):n;if(null===a)throw new Error(`There is no such element - #${this._options.container}`);a.innerHTML=o,this._iFrame=a.querySelector(`#${this._id}`);const s=this._iFrame;e&&await this._innerWindowEvent("sameOriginLoad"),t&&(s.contentWindow?(s.contentWindow.document.open(),s.contentWindow.document.write(r),s.contentWindow.document.close()):console.warn("Unable to locate contentWindow for the created iframe. Please try disabling the `iframe_loading_compatibility_mode` featureset.")),this._innerWindow().addEventListener("innerWindowLoad",(e=>{e.detail.received=!0,function(e,t){if(void 0===e)throw new Error(`${t} is undefined`);return e}(this._innerWindowResolver,"_innerWindowResolver")()}),{once:!0}),(this._options.autosize||this._options.fullscreen)&&(s.style.width="100%",this._options.fullscreen||(s.style.height="100%")),window.addEventListener("resize",this._onWindowResize),this._onWindowResize(),this._innerWindowLoaded.then((()=>{try{this._innerWindow().widgetReady((()=>{this._ready=!0;for(const e of this._readyHandlers)try{e.call(this)}catch(e){console.error(e)}this._innerWindow().initializationFinished()}))}catch(e){if(e instanceof Error&&/widgetReady is not a function/.test(e.message))throw new Error(`There was an error when loading the library. Usually this error means the library failed to load its static files. Check that the library files are available at ${window.location.host}/${this._options.library_path||""} or correct the library_path option.`)}}))}_innerWindowEvent(e){return new Promise((t=>{this._innerWindow().addEventListener(e,t,{once:!0})}))}_render(e,t,i){const o=window;if(o[this._id]={datafeed:this._options.datafeed,customFormatters:this._options.custom_formatters,brokerFactory:this._options.broker_factory,overrides:this._options.overrides,studiesOverrides:this._options.studies_overrides,tradingCustomization:this._options.trading_customization,disabledFeatures:this._options.disabled_features,enabledFeatures:this._options.enabled_features,brokerConfig:this._options.broker_config||this._options.brokerConfig,restConfig:this._options.restConfig,favorites:this._options.favorites,logo:this._options.logo,numeric_formatting:this._options.numeric_formatting,rss_news_feed:this._options.rss_news_feed,rss_news_title:this._options.rss_news_title,newsProvider:this._options.news_provider,loadLastChart:this._options.load_last_chart,saveLoadAdapter:this._options.save_load_adapter,loading_screen:this._options.loading_screen,settingsAdapter:this._options.settings_adapter,getCustomIndicators:this._options.custom_indicators_getter,additionalSymbolInfoFields:this._options.additional_symbol_info_fields,headerWidgetButtonsMode:this._options.header_widget_buttons_mode,customTranslateFunction:this._options.custom_translate_function,symbolSearchComplete:this._options.symbol_search_complete,contextMenu:this._options.context_menu,settingsOverrides:this._options.settings_overrides,timeframe:this._options.timeframe,customTimezones:this._options.custom_timezones,customChartDescriptionFunction:this._options.custom_chart_description_function,customThemes:this._options.custom_themes,imageStorageAdapter:this._options.image_storage_adapter},this._options.saved_data)o[this._id].chartContent={json:this._options.saved_data},this._options.saved_data_meta_info&&(o[this._id].chartContentExtendedData=this._options.saved_data_meta_info);else if(!this._options.load_last_chart&&!this._options.symbol)throw new Error("Symbol is not defined: either 'symbol' or 'load_last_chart' option must be set");if(this._options.library_path&&!this._options.library_path.endsWith("/")&&console.warn("library_path option should contain a trailing forward slash"),this._options.locale){const e=encodeURIComponent(this._options.locale);Ve.findIndex((t=>t.language===e))>=0||(console.warn("locale isn't supported. Using default of `en`."),this._options.locale="en")}const r=(this._options.theme||"light").toLowerCase(),n=function(e,t,i){const o=new URL(`${e||""}`,location.href).href,r=JSON.parse('["bundles/runtime.ddf792da21403fea7e07.js","bundles/__LANG__.938.5f20502c9172fdac1c7f.js","bundles/481.7c6283292170510c91f1.css","bundles/8971.352a74bc5eebf8040884.js","bundles/library.668013b6b41ce2feaa5c.js"]'),n=encodeURIComponent(t),a="light"!==i.toLowerCase()?"dark":"light",s=Ve.find((e=>e.language===n))??{iso:"en",dir:"ltr"},l=`lang="${s.iso}" dir="${s.dir}" data-theme="${a}" class="theme-${a}"`,d=`\n${function(e,t,i){if(void 0===e)return"";const o=[],r=[];for(const n of e)n.endsWith(".js")?o.push(`