Files
ai/web/public/charting_library/bundles/chart-bottom-toolbar.6ceb4aef3a79d9831607.js

20 lines
57 KiB
JavaScript

(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[7260],{59142:function(e,t){var n,s,i;s=[t],n=function(e){"use strict";function t(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}Object.defineProperty(e,"__esModule",{value:!0});var n=!1;if("undefined"!=typeof window){var s={get passive(){n=!0}};window.addEventListener("testPassive",null,s),window.removeEventListener("testPassive",null,s)}var i="undefined"!=typeof window&&window.navigator&&window.navigator.platform&&/iP(ad|hone|od)/.test(window.navigator.platform),a=[],o=!1,r=-1,l=void 0,c=void 0,u=function(e){return a.some((function(t){return!(!t.options.allowTouchMove||!t.options.allowTouchMove(e))}))},h=function(e){var t=e||window.event;return!!u(t.target)||1<t.touches.length||(t.preventDefault&&t.preventDefault(),!1)},d=function(){setTimeout((function(){void 0!==c&&(document.body.style.paddingRight=c,c=void 0),void 0!==l&&(document.body.style.overflow=l,l=void 0)}))};e.disableBodyScroll=function(e,s){if(i){if(!e)return void console.error("disableBodyScroll unsuccessful - targetElement must be provided when calling disableBodyScroll on IOS devices.");if(e&&!a.some((function(t){return t.targetElement===e}))){var d={targetElement:e,options:s||{}};a=[].concat(t(a),[d]),e.ontouchstart=function(e){1===e.targetTouches.length&&(r=e.targetTouches[0].clientY)},e.ontouchmove=function(t){var n,s,i,a;1===t.targetTouches.length&&(s=e,a=(n=t).targetTouches[0].clientY-r,!u(n.target)&&(s&&0===s.scrollTop&&0<a||(i=s)&&i.scrollHeight-i.scrollTop<=i.clientHeight&&a<0?h(n):n.stopPropagation()))},o||(document.addEventListener("touchmove",h,n?{passive:!1}:void 0),o=!0)}}else{p=s,setTimeout((function(){if(void 0===c){var e=!!p&&!0===p.reserveScrollBarGap,t=window.innerWidth-document.documentElement.clientWidth;e&&0<t&&(c=document.body.style.paddingRight,document.body.style.paddingRight=t+"px")}void 0===l&&(l=document.body.style.overflow,document.body.style.overflow="hidden")}));var m={targetElement:e,options:s||{}};a=[].concat(t(a),[m])}var p},e.clearAllBodyScrollLocks=function(){i?(a.forEach((function(e){e.targetElement.ontouchstart=null,e.targetElement.ontouchmove=null})),o&&(document.removeEventListener("touchmove",h,n?{passive:!1}:void 0),o=!1),a=[],r=-1):(d(),a=[])},e.enableBodyScroll=function(e){if(i){if(!e)return void console.error("enableBodyScroll unsuccessful - targetElement must be provided when calling enableBodyScroll on IOS devices.");e.ontouchstart=null,e.ontouchmove=null,a=a.filter((function(t){return t.targetElement!==e})),o&&0===a.length&&(document.removeEventListener("touchmove",h,n?{passive:!1}:void 0),o=!1)}else 1===a.length&&a[0].targetElement===e?(d(),a=[]):a=a.filter((function(t){return t.targetElement!==e}))}},void 0===(i="function"==typeof n?n.apply(t,s):n)||(e.exports=i)},97754:(e,t)=>{var n;!function(){"use strict";var s={}.hasOwnProperty;function i(){for(var e=[],t=0;t<arguments.length;t++){var n=arguments[t];if(n){var a=typeof n
;if("string"===a||"number"===a)e.push(n);else if(Array.isArray(n)&&n.length){var o=i.apply(null,n);o&&e.push(o)}else if("object"===a)for(var r in n)s.call(n,r)&&n[r]&&e.push(r)}}return e.join(" ")}e.exports?(i.default=i,e.exports=i):void 0===(n=function(){return i}.apply(t,[]))||(e.exports=n)}()},49107:e=>{e.exports={loader:"loader-UL6iwcBa",static:"static-UL6iwcBa",item:"item-UL6iwcBa","tv-button-loader":"tv-button-loader-UL6iwcBa",medium:"medium-UL6iwcBa",small:"small-UL6iwcBa",black:"black-UL6iwcBa",white:"white-UL6iwcBa",gray:"gray-UL6iwcBa",primary:"primary-UL6iwcBa"}},47429:e=>{e.exports={item:"item-GJX1EXhk",interactive:"interactive-GJX1EXhk",hovered:"hovered-GJX1EXhk",disabled:"disabled-GJX1EXhk",active:"active-GJX1EXhk",shortcut:"shortcut-GJX1EXhk",normal:"normal-GJX1EXhk",big:"big-GJX1EXhk",iconCell:"iconCell-GJX1EXhk",icon:"icon-GJX1EXhk",content:"content-GJX1EXhk",label:"label-GJX1EXhk",checked:"checked-GJX1EXhk",toolbox:"toolbox-GJX1EXhk",showToolboxOnHover:"showToolboxOnHover-GJX1EXhk",arrowIcon:"arrowIcon-GJX1EXhk",subMenu:"subMenu-GJX1EXhk",invisibleHotkey:"invisibleHotkey-GJX1EXhk"}},5264:e=>{e.exports={item:"item-WJDah4zD",emptyIcons:"emptyIcons-WJDah4zD",loading:"loading-WJDah4zD",disabled:"disabled-WJDah4zD",interactive:"interactive-WJDah4zD",hovered:"hovered-WJDah4zD",normal:"normal-WJDah4zD",big:"big-WJDah4zD",icon:"icon-WJDah4zD",label:"label-WJDah4zD",title:"title-WJDah4zD",nested:"nested-WJDah4zD",shortcut:"shortcut-WJDah4zD",remove:"remove-WJDah4zD"}},15015:e=>{e.exports={separator:"separator-Pf4rIzEt"}},40359:e=>{e.exports={separator:"separator-QjUlCDId",small:"small-QjUlCDId",normal:"normal-QjUlCDId",large:"large-QjUlCDId"}},26996:(e,t,n)=>{"use strict";n.d(t,{Loader:()=>c});var s,i=n(50959),a=n(97754),o=n.n(a),r=n(49107),l=n.n(r);function c(e){const{className:t,size:n="medium",staticPosition:s,color:a="black"}=e,r=o()(l().item,l()[a],l()[n]);return i.createElement("span",{className:o()(l().loader,s&&l().static,t)},i.createElement("span",{className:r}),i.createElement("span",{className:r}),i.createElement("span",{className:r}))}!function(e){e.Medium="medium",e.Small="small"}(s||(s={}))},47201:(e,t,n)=>{"use strict";function s(...e){return t=>{for(const n of e)void 0!==n&&n(t)}}n.d(t,{createSafeMulticastEventHandler:()=>s})},42142:(e,t,n)=>{"use strict";n.d(t,{FragmentMap:()=>i});var s=n(50959);function i(e){if(e.map){return s.Children.toArray(e.children).map(e.map)}return e.children}},99025:(e,t,n)=>{"use strict";n.d(t,{Hint:()=>r});var s=n(50959),i=n(97754),a=n.n(i),o=n(47429);function r(e){const{text:t="",className:n}=e;return s.createElement("span",{className:a()(o.shortcut,n)},t)}},23829:(e,t,n)=>{"use strict";n.d(t,{ContextMenuItem:()=>p});var s=n(50959),i=n(97754),a=n.n(i),o=n(9745),r=n(26996),l=n(54627),c=n(99025),u=n(39750),h=n(79978),d=n(60925),m=n(5264);function p(e){
const{className:t,isTitle:n,isLoading:i,isHovered:p,active:g,checkable:v,disabled:b,checked:f,icon:_,iconChecked:y,hint:C,subItems:x,label:S,styledLabel:E,onClick:w,children:M,toolbox:R,jsxLabel:B,size:k="normal"}=e,T=(0,s.useContext)(l.EmptyIconsContext),A=!!x.length;return i?s.createElement("li",{className:a()(t,m.item,m.loading,m[k])},s.createElement(r.Loader,null)):s.createElement("li",{className:a()(t,m.item,m.interactive,n&&m.title,b&&m.disabled,p&&m.hovered,g&&m.active,T&&m.emptyIcons,m[k]),onClick:w},s.createElement(o.Icon,{className:a()(m.icon),icon:function(){if(v&&f)return y||_||u;return _}()}),s.createElement("span",{className:a()(m.label)},!B&&E?E.map((({text:e,...t},n)=>s.createElement("span",{key:n,style:t},e))):B??S),!!R&&s.createElement(o.Icon,{onClick:function(){R&&R.action()},className:m.remove,icon:d}),!A&&C&&s.createElement(c.Hint,{className:m.shortcut,text:C}),A&&s.createElement(o.Icon,{className:m.nested,icon:h}),M)}},54627:(e,t,n)=>{"use strict";n.d(t,{EmptyIconsContext:()=>s});const s=n(50959).createContext(!1)},1109:(e,t,n)=>{"use strict";n.d(t,{Separator:()=>o});var s=n(50959),i=n(97754),a=n(15015);function o(e){return s.createElement("div",{className:i(a.separator,e.className)})}},51613:(e,t,n)=>{"use strict";n.d(t,{PopupMenuSeparator:()=>l});var s,i=n(50959),a=n(97754),o=n.n(a),r=n(40359);function l(e){const{size:t="normal",className:n,ariaHidden:s=!1}=e;return i.createElement("div",{className:o()(r.separator,"small"===t&&r.small,"normal"===t&&r.normal,"large"===t&&r.large,n),role:"separator","aria-hidden":s})}!function(e){e.Small="small",e.Large="large",e.Normal="normal"}(s||(s={}))},40173:(e,t,n)=>{"use strict";function s(e,t,n={}){return Object.assign({},e,function(e,t,n={}){const s=Object.assign({},t);for(const i of Object.keys(t)){const a=n[i]||i;a in e&&(s[i]=[e[a],t[i]].join(" "))}return s}(e,t,n))}n.d(t,{mergeThemes:()=>s})},6132:(e,t,n)=>{"use strict";var s=n(22134);function i(){}function a(){}a.resetWarningCache=i,e.exports=function(){function e(e,t,n,i,a,o){if(o!==s){var r=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw r.name="Invariant Violation",r}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:a,resetWarningCache:i};return n.PropTypes=n,n}},19036:(e,t,n)=>{e.exports=n(6132)()},22134:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},79619:e=>{e.exports={title:"title-u3QJgF_p"}},78748:e=>{e.exports={toolbar:"toolbar-BXXUwft2",dateRangeWrapper:"dateRangeWrapper-BXXUwft2",noranges:"noranges-BXXUwft2",dateRangeExpanded:"dateRangeExpanded-BXXUwft2",separator:"separator-BXXUwft2",seriesControlWrapper:"seriesControlWrapper-BXXUwft2",dateRangeCollapsed:"dateRangeCollapsed-BXXUwft2",item:"item-BXXUwft2",inline:"inline-BXXUwft2",
dateRange:"dateRange-BXXUwft2",fullscreenButton:"fullscreenButton-BXXUwft2",hidden:"hidden-BXXUwft2",collapsed:"collapsed-BXXUwft2",fullscreenBtn:"fullscreenBtn-BXXUwft2"}},85158:e=>{e.exports={button:"button-Hfju7pW_"}},49449:e=>{e.exports={button:"button-uToIfRbZ"}},80071:e=>{e.exports={separator:"separator-yDfG9Ccu"}},84242:e=>{e.exports={headerMenuText:"headerMenuText-AcJrLng7"}},15573:e=>{e.exports={button:"button-x1dCOTP3",disabled:"disabled-x1dCOTP3",hover:"hover-x1dCOTP3",clicked:"clicked-x1dCOTP3",accessible:"accessible-x1dCOTP3"}},97465:e=>{e.exports={wrap:"wrap-k2h4OAz8",item:"item-k2h4OAz8"}},43845:(e,t,n)=>{"use strict";n.d(t,{ToolWidgetMenuSummary:()=>o});var s=n(50959),i=n(97754),a=n(79619);function o(e){return s.createElement("div",{className:i(e.className,a.title)},e.children)}},40610:(e,t,n)=>{"use strict";n.d(t,{DEFAULT_TOOLBAR_BUTTON_THEME:()=>o,ToolbarButton:()=>r});var s=n(50959),i=n(46003),a=n(50238);const o=i.DEFAULT_TOOL_WIDGET_BUTTON_THEME,r=(0,s.forwardRef)((function(e,t){const{tooltip:n,...o}=e,[r,l]=(0,a.useRovingTabindexElement)(t);return s.createElement(i.ToolWidgetButton,{"aria-label":n,...o,tag:"button",ref:r,tabIndex:l,"data-tooltip":n})}))},58169:(e,t,n)=>{"use strict";n.d(t,{ToolbarIconButton:()=>r});var s=n(50959),i=n(50238),a=n(21618);const o=(0,s.forwardRef)((function(e,t){const{tooltip:n,...i}=e;return s.createElement(a.ToolWidgetIconButton,{"aria-label":n,...i,tag:"button",ref:t,"data-tooltip":n,"data-tooltip-show-on-focus":"true"})})),r=(0,s.forwardRef)((function(e,t){const[n,a]=(0,i.useRovingTabindexElement)(t);return s.createElement(o,{...e,ref:n,tabIndex:a})}))},34788:(e,t,n)=>{"use strict";n.d(t,{ToolbarMenuButton:()=>u});var s=n(50959),i=n(39416),a=n(50238),o=n(99247),r=n(54374),l=n(73607);const c=(0,s.forwardRef)((function(e,t){const{tooltip:n,tag:a,buttonRef:o,reference:c,...u}=e,h=(0,i.useFunctionalRefObject)(c??null);return s.createElement(r.ToolWidgetMenu,{"aria-label":n,...u,ref:t,tag:a??"button",reference:o??h,"data-tooltip":n,onMenuKeyDown:l.handleAccessibleMenuKeyDown,onMenuFocus:e=>(0,l.handleAccessibleMenuFocus)(e,o??h)})})),u=(0,s.forwardRef)((function(e,t){const{tooltip:n,menuReference:r=null,...l}=e,[u,h]=(0,a.useRovingTabindexElement)(null),d=(0,i.useFunctionalRefObject)(r);return s.createElement(c,{"aria-label":n,"aria-haspopup":"menu",...o.MouseClickAutoBlurHandler.attributes(),...l,ref:t,tag:"button",buttonRef:u,tabIndex:h,menuReference:d,tooltip:n})}))},26981:(e,t,n)=>{"use strict";n.d(t,{Toolbar:()=>h});var s=n(50959),i=n(50151),a=n(47201),o=n(3343),r=n(22692),l=n(33647),c=n(39416),u=n(99247);const h=(0,s.forwardRef)((function(e,t){const{onKeyDown:n,orientation:h,blurOnEscKeydown:d=!0,blurOnClick:m=!0,...p}=e,g=(0,c.useFunctionalRefObject)(t);return(0,s.useLayoutEffect)((()=>{const e=(0,i.ensureNotNull)(g.current),t=()=>{const t=(0,r.queryTabbableElements)(e).sort(r.navigationOrderComparator);if(0===t.length){const[t]=(0,r.queryFocusableElements)(e).sort(r.navigationOrderComparator);if(void 0===t)return;(0,l.becomeMainElement)(t)}if(t.length>1){
const[,...e]=t;for(const t of e)(0,l.becomeSecondaryElement)(t)}};return window.addEventListener("keyboard-navigation-activation",t),()=>window.removeEventListener("keyboard-navigation-activation",t)}),[]),s.createElement("div",{...u.MouseClickAutoBlurHandler.attributes(m),...p,role:"toolbar","aria-orientation":h,ref:g,onKeyDown:(0,a.createSafeMulticastEventHandler)((function(e){if(e.defaultPrevented)return;if(!(document.activeElement instanceof HTMLElement))return;const t=(0,o.hashFromEvent)(e);if(d&&27===t)return e.preventDefault(),void document.activeElement.blur();if("vertical"!==h&&37!==t&&39!==t)return;if("vertical"===h&&38!==t&&40!==t)return;const n=e.currentTarget,s=(0,r.queryFocusableElements)(n).sort(r.navigationOrderComparator);if(0===s.length)return;const i=s.indexOf(document.activeElement);if(-1===i)return;e.preventDefault();const a=()=>{const e=(i+s.length-1)%s.length;(0,l.becomeSecondaryElement)(s[i]),(0,l.becomeMainElement)(s[e]),s[e].focus()},c=()=>{const e=(i+s.length+1)%s.length;(0,l.becomeSecondaryElement)(s[i]),(0,l.becomeMainElement)(s[e]),s[e].focus()};switch((0,r.mapKeyCodeToDirection)(t)){case"inlinePrev":"vertical"!==h&&a();break;case"inlineNext":"vertical"!==h&&c();break;case"blockPrev":"vertical"===h&&a();break;case"blockNext":"vertical"===h&&c()}}),n),"data-tooltip-show-on-focus":"true"})}))},12062:(e,t,n)=>{"use strict";n.r(t),n.d(t,{BottomToolbarRenderer:()=>Rt});var s=n(50959),i=n(32227),a=n(11542),o=n(19036),r=n(97754),l=n.n(r),c=n(37103),u=n(34788),h=n(78014),d=n(87713),m=n(90692),p=n(90397),g=n(51613),v=n(50151),b=n(51768),f=n(68976),_=n(48096),y=n(95406),C=n(46082);const x=e=>a.t(null,{plural:"{str} minutes",count:e,replace:{str:`${e}`}},n(5926)),S=e=>a.t(null,{plural:"{str} hours",count:e,replace:{str:`${e}`}},n(64963)),E=e=>a.t(null,{plural:"{str} months",count:e,replace:{str:`${e}`}},n(20062)),w=e=>e,M={[w("1")]:{resolution:"1",text:x(1)},[w("3")]:{resolution:"3",text:x(3)},[w("5")]:{resolution:"5",text:x(5)},[w("15")]:{resolution:"15",text:x(15)},[w("30")]:{resolution:"30",text:x(30)},[w("45")]:{resolution:"45",text:x(45)},[w("60")]:{resolution:"60",text:S(1)},[w("120")]:{resolution:"120",text:S(2)},[w("180")]:{resolution:"180",text:S(3)},[w("240")]:{resolution:"240",text:S(4)},[w("1D")]:{resolution:"1D",text:(k=1,a.t(null,{plural:"{str} days",count:k,replace:{str:`${k}`}},n(62368)))},[w("1W")]:{resolution:"1W",text:(B=1,a.t(null,{plural:"{str} weeks",count:B,replace:{str:`${B}`}},n(49306)))},[w("1M")]:{resolution:"1M",text:E(1)},[w("3M")]:{resolution:"3M",text:E(3)},[w("6M")]:{resolution:"6M",text:E(6)},[w("12M")]:{resolution:"12M",text:(R=1,a.t(null,{plural:"{str} years",count:R,replace:{str:`${R}`}},n(91549)))}};var R,B,k;function T(e){const t=function(e){const t=e.value.value,s=C.Interval.parse(t);if(!s.isValid()){if("YTD"===t)return a.t(null,{context:"timeframe_title"},n(19273));if("ALL"===t)return a.t(null,{context:"timeframe_title"},n(1495));if("LASTSESSION"===t)return D(1)}if(s.isMinutes()){const e=s.multiplier();return e%60!=0?A(e):W(e/60)}
if(s.isDays())return D(s.multiplier());if(s.isWeeks())return N(s.multiplier());if(s.isMonths()){const e=s.multiplier();return e%12!=0?z(e):F(e/12)}return e.description||e.text}(e),s=function(e){const t=e.targetResolution,n=C.Interval.parse(t);if(n.isMinutes()){const e=n.multiplier();return e%60!=0?L(e):P(e/60)}if(n.isDays())return I(n.multiplier());if(n.isWeeks())return H(n.multiplier());if(n.isMonths()){const e=n.multiplier();return e%12!=0?O(e):U(e/12)}return M[t].text}(e);return a.t(null,{replace:{timePeriod:t,timeInterval:s},context:"timeframe_title"},n(58426))}const A=e=>a.t(null,{plural:"{str} minutes",count:e,replace:{str:`${e}`},context:"timeframe_title"},n(95484)),W=e=>a.t(null,{plural:"{str} hours",count:e,replace:{str:`${e}`},context:"timeframe_title"},n(72495)),D=e=>a.t(null,{plural:"{str} days",count:e,replace:{str:`${e}`},context:"timeframe_title"},n(63808)),N=e=>a.t(null,{plural:"{str} weeks",count:e,replace:{str:`${e}`},context:"timeframe_title"},n(6088)),z=e=>a.t(null,{plural:"{str} months",count:e,replace:{str:`${e}`},context:"timeframe_title"},n(12752)),F=e=>a.t(null,{plural:"{str} years",count:e,replace:{str:`${e}`},context:"timeframe_title"},n(96325)),L=e=>a.t(null,{plural:"{str} minutes intervals",count:e,replace:{str:`${e}`},context:"timeframe_title"},n(15489)),P=e=>a.t(null,{plural:"{str} hours intervals",count:e,replace:{str:`${e}`},context:"timeframe_title"},n(14887)),I=e=>a.t(null,{plural:"{str} days intervals",count:e,replace:{str:`${e}`},context:"timeframe_title"},n(561)),H=e=>a.t(null,{plural:"{str} weeks intervals",count:e,replace:{str:`${e}`},context:"timeframe_title"},n(60316)),O=e=>a.t(null,{plural:"{str} months intervals",count:e,replace:{str:`${e}`},context:"timeframe_title"},n(48514)),U=e=>a.t(null,{plural:"{str} years intervals",count:e,replace:{str:`${e}`},context:"timeframe_title"},n(78971));class X{constructor(e){this._state={ranges:[]},this._firstBarTime1D=null,this._waitingUpdateAfterSymbolResolved=!0,this._change=new _.Delegate,this._rangeChangedListenerBound=this._onRangeChanged.bind(this);const{chartWidget:t}=this._context=e;t.withModel(null,(()=>{const e=t.model(),n=e.mainSeries();n.onStatusChanged().subscribe(this,this._updateAvailableRanges),n.dataEvents().symbolResolved().subscribe(this,(()=>this._updateRangesByQuotesData())),n.priceScale().properties().childs().lockScale.subscribe(this,(()=>this._updateAvailableRanges()));const s=e.model().appliedTimeFrame();s.subscribe(this._rangeChangedListenerBound),this._rangeChangedListenerBound(s.value()),this._updateRangesByQuotesData()}))}state(){return this._state}onChange(){return this._change}selectRange(e){this._setState({activeRange:e.value.value});const{chartWidgetCollection:t}=this._context,n={val:e.value,res:e.targetResolution};t.setTimeFrame(n)}destroy(){const{chartWidget:e}=this._context;e.withModel(null,(()=>{const t=e.model(),n=t.mainSeries();n.onStatusChanged().unsubscribeAll(this),n.dataEvents().symbolResolved().unsubscribeAll(this),n.quotesProvider().quotesUpdate().unsubscribeAll(this),
n.priceScale().properties().childs().lockScale.unsubscribeAll(this),t.model().appliedTimeFrame().unsubscribe(this._rangeChangedListenerBound)})),this._change.destroy(),this._lastAbortController?.abort()}_setState(e){this._state=Object.assign({},this._state,e),this._change.fire(this._state)}_onRangeChanged(e){let t;null!==e&&"period-back"===e.val.type&&(t=e.val.value),this._setState({activeRange:t})}_updateRangesByQuotesData(){const{chartWidget:e}=this._context;if(!e.hasModel())return;this._lastAbortController?.abort();const t=new AbortController;this._lastAbortController=t;const n=e.model().mainSeries();n.quotesProvider().quotesUpdate().unsubscribeAll(this),this._waitingUpdateAfterSymbolResolved=!0,this._firstBarTime1D=null,Promise.race([(0,y.delay)(null,0),new Promise((e=>{const t=()=>{void 0!==n.quotes()?.open_price&&(n.quotesProvider().quotesUpdate().unsubscribeAll(this),e())};n.quotesProvider().quotesUpdate().subscribe(this,t),t()}))]).then((()=>{t.signal.aborted||(this._waitingUpdateAfterSymbolResolved=!1,this._updateAvailableRanges())}))}_updateAvailableRanges(e){const{availableTimeFrames:t,chartWidget:n}=this._context;if(!n.hasModel())return;const s=n.model().mainSeries(),i=s.symbolInfo(),a=s.status();if(2===a||1===a||this._waitingUpdateAfterSymbolResolved||e&&!i)return;const o=s.quotes()?.first_bar_time_1d??-1/0;if(this._firstBarTime1D===o)return;this._firstBarTime1D=o;const r=t(i,a,o).map((e=>({...e,description:""===e.description?T(e):e.description})));this._setState({ranges:r})}}const j=(0,f.registryContextType)();function V(e){var t;return(t=class extends s.PureComponent{constructor(e,t){super(e,t),this._handleUpdate=e=>{this.setState(e)},this._handleSelectRange=e=>{(0,b.trackEvent)("GUI","Chart Bottom Toolbar",`range ${e.value}`),this.props.onSelectRange?.(e),this._binding.selectRange(e)},(0,f.validateRegistry)(t,{availableTimeFrames:o.any.isRequired,chartWidgetCollection:o.any.isRequired,chartWidget:o.any.isRequired}),q.has(t.chartWidget)||q.set(t.chartWidget,new X(t));const n=this._binding=(0,v.ensureDefined)(q.get(t.chartWidget));this.state=n.state()}componentDidMount(){this._binding.onChange().subscribe(this,this._handleUpdate)}componentWillUnmount(){this._binding.onChange().unsubscribe(this,this._handleUpdate)}render(){return s.createElement(e,{goToDateButton:this.props.goToDateButton,className:this.props.className,ranges:this.state.ranges,activeRange:this.state.activeRange,onSelectRange:this._handleSelectRange})}}).contextType=j,t}const q=new WeakMap;var G=n(92572),J=n(23829),$=n(1109),Z=n(29242),K=n(90752),Q=n(85158);function Y(e){const{ranges:t,activeRange:n,onSelectRange:i}=e;return s.createElement(s.Fragment,null,t.map((e=>s.createElement(J.ContextMenuItem,{key:e.value.value,label:e.description||e.text,active:n===e.value.value,checked:n===e.value.value,checkable:!0,disabled:!1,onClick:a.bind(null,e),doNotCloseOnClick:!1,subItems:[]}))));function a(e){e&&i&&i(e),(0,d.globalCloseMenu)()}}function ee(e){const{onGoToDateClick:t}=e;return s.createElement(s.Fragment,null,s.createElement($.Separator,{
className:Q.separator}),s.createElement(J.ContextMenuItem,{icon:K,label:(0,Z.appendEllipsis)(a.t(null,void 0,n(42432))),onClick:t,active:!1,checked:!1,checkable:!1,disabled:!1,doNotCloseOnClick:!1,subItems:[]}))}const te={title:a.t(null,void 0,n(85444)),goToDate:(0,Z.appendEllipsis)(a.t(null,void 0,n(42432)))},ne=(0,f.registryContextType)();class se extends s.PureComponent{constructor(e,t){super(e,t),this._handleGoToDateClick=()=>{const{chartWidget:e}=this.context;(0,G.showGoToDateDialog)(e),(0,d.globalCloseMenu)()},this._handleRangeSelect=e=>{e&&this.props.onSelectRange&&this.props.onSelectRange(e),(0,d.globalCloseMenu)()},this._renderChildren=e=>{const{ranges:t,activeRange:n,goToDateButton:i}=this.props;return e?s.createElement(s.Fragment,null,s.createElement(Y,{ranges:t,activeRange:n,onSelectRange:this._handleRangeSelect}),i&&s.createElement(ee,{onGoToDateClick:this._handleGoToDateClick})):s.createElement(s.Fragment,null,t.map((e=>s.createElement(p.AccessibleMenuItem,{key:e.value.value,label:e.description||e.text,isActive:n===e.value.value,onClick:this._handleRangeSelect,onClickArg:e}))),i&&t.length>0&&s.createElement(g.PopupMenuSeparator,null),i&&s.createElement(p.AccessibleMenuItem,{label:te.goToDate,onClick:this._handleGoToDateClick}))},(0,f.validateRegistry)(t,{chartWidget:o.any.isRequired})}render(){return s.createElement(m.MatchMedia,{rule:"(max-width: 440px)"},(e=>s.createElement(u.ToolbarMenuButton,{className:l()(Q.button,this.props.className),content:te.title,arrow:!0,verticalAttachEdge:h.VerticalAttachEdge.Top,verticalDropDirection:h.VerticalDropDirection.FromBottomToTop,horizontalMargin:4,"data-name":"date-ranges-menu",isDrawer:e,onClick:this._trackClick},this._renderChildren(e))))}_trackClick(){0}}se.contextType=ne;const ie=V(se);var ae=n(40610),oe=n(97465);const re=V((function(e){const{className:t,ranges:n,activeRange:i,onSelectRange:a}=e;return s.createElement("div",{className:r(oe.wrap,t),"data-name":"date-ranges-tabs"},n.map((e=>s.createElement(ae.ToolbarButton,{key:e.value.value,className:oe.item,"data-name":`date-range-tab-${e.value.value}`,isActive:i===e.value.value,onClick:a&&a.bind(null,e),text:e.text,tooltip:e.description||e.text}))))}));var le=n(61814),ce=n(68335),ue=n(58169),he=n(92574),de=n(49449);const me=(0,le.hotKeySerialize)({keys:[(0,ce.humanReadableModifiers)(ce.Modifiers.Alt,!1),"G"],text:"{0} + {1}"}),pe=(0,f.registryContextType)();class ge extends s.PureComponent{constructor(e,t){super(e,t),this._handleClick=()=>{const{chartWidget:e}=this.context;(0,b.trackEvent)("GUI","Chart Bottom Toolbar","go to"),(0,G.showGoToDateDialog)(e)},(0,f.validateRegistry)(t,{chartWidget:o.any.isRequired})}render(){const{className:e}=this.props;return s.createElement(ue.ToolbarIconButton,{icon:he,onClick:this._handleClick,"data-tooltip-hotkey":me,tooltip:a.t(null,void 0,n(42432)),"data-name":"go-to-date",className:r(de.button,e)})}}ge.contextType=pe;const ve=V(ge);var be=n(76460),fe=n(37236),_e=n(95523),ye=n(82087),Ce=n(41706),xe=n(20512),Se=n(3190),Ee=n(31269),we=n(40173),Me=n(15573);const Re=(0,
we.mergeThemes)(ae.DEFAULT_TOOLBAR_BUTTON_THEME,{isDisabled:Me.disabled,button:Me.button});const Be=(0,f.registryContextType)();class ke extends s.PureComponent{constructor(e,t){super(e,t),this._timeFormatter=new ye.TimeFormatter((0,xe.getHourMinuteSecondFormat)(Se.timeHoursFormatProperty.value())),this._tickInterval=void 0,this._element=null,this._menuShown=!1,this._preventShowingMenu=!1,this._tickClock=()=>{const{chartApiInstance:e}=this.context;if(void 0!==this._timezone){const t=(0,fe.utc_to_cal)(this._timezone,e.serverTime());this.setState({time:this._timeFormatter.format(t)})}},this._getActions=()=>{if(!this.props.withMenu)return[];const{chartWidget:e}=this.context;return function(e){const t=e.actions();return t&&t.applyTimeZone instanceof Ce.Action?t.applyTimeZone.getSubItems():[]}(e)},this._handleRef=e=>{this._element=e},this._onMouseDown=()=>{this._preventShowingMenu=this._menuShown},this._showMenu=e=>{if(this._preventShowingMenu)return void Ee.ContextMenuManager.hideAll();const t=(0,v.ensureNotNull)(this._element),n=this._getActions();if(0===n.length)return;const s=t.getBoundingClientRect();Ee.ContextMenuManager.showMenu(n,{clientX:s.left,clientY:s.top,attachToYBy:"bottom"},{returnFocus:!0,takeFocus:!0,isKeyboardEvent:(0,be.isKeyboardClick)(e)},{menuName:"TimezoneMenuContextMenu"},(()=>{this._menuShown=!1,this.setState({isMenuOpened:!1})})).then((()=>{this._menuShown=!0,this.setState({isMenuOpened:!0})}))},(0,f.validateRegistry)(t,{chartWidget:o.any.isRequired,chartApiInstance:o.any.isRequired}),this.state={time:"",isMenuOpened:!1}}componentDidMount(){const{chartWidget:e}=this.context;this._tickInterval=setInterval(this._tickClock,1e3),e.withModel(null,(()=>{const t=e.model();t.model().mainSeries().dataEvents().symbolResolved().subscribe(this,this.updateTimezonesButton),t.model().properties().childs().timezone.subscribe(this,this.updateTimezonesButton),Se.timeHoursFormatProperty.subscribe(this,this._timeHoursFormatPropertyChanged)}))}componentWillUnmount(){const{chartWidget:e}=this.context;clearInterval(this._tickInterval),e.withModel(null,(()=>{const t=e.model();t.model().mainSeries().dataEvents().symbolResolved().unsubscribe(this,this.updateTimezonesButton),t.model().properties().childs().timezone.unsubscribe(this,this.updateTimezonesButton),Se.timeHoursFormatProperty.unsubscribe(this,this._timeHoursFormatPropertyChanged)}))}render(){const{className:e,withMenu:t}=this.props,{time:i,isMenuOpened:o}=this.state,r=void 0!==this._timezone?(0,_e.parseTzOffset)(this._timezone.name()).string:null;return s.createElement(ae.ToolbarButton,{onMouseDown:this._onMouseDown,ref:this._handleRef,onClick:this._showMenu,isOpened:o,isDisabled:!t,theme:Re,"data-name":"time-zone-menu",tooltip:t?a.t(null,void 0,n(77073)):void 0,className:e,text:i&&r&&`${i} ${r}`})}updateTimezonesButton(){const{chartWidget:e}=this.context;if(!e.hasModel())return;if(null===e.model().mainSeries().symbolInfo())return;const t=(0,v.ensureNotNull)(e.model().model().timezoneExceptExchange().value());this._timezone=(0,fe.get_timezone)(t),
this._tickClock()}_timeHoursFormatPropertyChanged(){this._timeFormatter=new ye.TimeFormatter((0,xe.getHourMinuteSecondFormat)(Se.timeHoursFormatProperty.value())),this.updateTimezonesButton()}}ke.contextType=Be;var Te=n(80071);function Ae(e){return s.createElement("span",{className:r(Te.separator,e.className)})}var We=n(26981),De=n(95804),Ne=n(49483);class ze{constructor(e,t,n){this._highlighted=!1,this._chartWidget=e,this._priceScaleGetter=t,this._owner=n,this._setHighlight=this._setHighlight.bind(this),this._removeHighlight=this._removeHighlight.bind(this)}destroy(){this._highlighted&&this._removeHighlight()}handlers(){const e=Ne.CheckMobile.any();return{onMouseEnter:e?void 0:this._setHighlight,onMouseLeave:e?void 0:this._removeHighlight}}_setHighlight(){if(!this._chartWidget.hasModel())return;const e=this._chartWidget.model().model(),t=e.paneForSource(e.mainSeries()),n=this._priceScaleGetter();if(null===t||null===n)return;const s=this._chartWidget.paneByState(t);if(null!==s){const t=s.rightPriceAxisesContainer().findAxisWidgetForScale(n);let i=null;null!==t&&(i=t.axisInfo());const a=s.leftPriceAxisesContainer().findAxisWidgetForScale(n);if(null!==a&&(i=a.axisInfo()),i){const t=s.highlightedPriceAxises(),n=t.value();n.find((e=>e.axis.label===i.label))||(t.setValue([...n,{owner:this._owner,axis:i}]),e.lightUpdate(),this._highlighted=!0)}}}_removeHighlight(){if(!this._chartWidget.hasModel())return;const e=this._chartWidget.model().model(),t=e.paneForSource(e.mainSeries()),n=this._priceScaleGetter();if(null===t||null===n)return;const s=this._chartWidget.paneByState(t);if(null!==s){const t=s.rightPriceAxisesContainer().findAxisWidgetForScale(n);let i=null;null!==t&&(i=t.axisInfo());const a=s.leftPriceAxisesContainer().findAxisWidgetForScale(n);if(null!==a&&(i=a.axisInfo()),i){const t=s.highlightedPriceAxises(),n=t.value().slice(),a=n.findIndex((e=>i.label===e.axis.label&&e.owner===this._owner));-1!==a&&(n.splice(a,1),t.setValue(n),e.lightUpdate(),this._highlighted=!1)}}}}const Fe=(0,f.registryContextType)(),Le=new De.TranslatedString("toggle log scale",a.t(null,void 0,n(49403)));const Pe=(0,f.registryContextType)(),Ie=new De.TranslatedString("toggle auto scale",a.t(null,void 0,n(42240)));const He=(0,f.registryContextType)(),Oe=new De.TranslatedString("toggle percentage scale",a.t(null,void 0,n(98994)));const Ue=(0,f.registryContextType)();var Xe=n(42142),je=n(26867),Ve=n(3343),qe=n(43845),Ge=n(95772),Je=n(84242);const $e=new De.TranslatedString("change session",a.t(null,void 0,n(87041))),Ze={hint:a.t(null,void 0,n(94031)),headerMenuText:a.t(null,void 0,n(27665))},Ke=(0,le.hotKeySerialize)({keys:[(0,Ve.humanReadableModifiers)(Ve.Modifiers.Alt,!1),(0,Ve.humanReadableModifiers)(Ve.Modifiers.Shift,!1),"E"],text:"{0} + {1} + {2}"}),Qe=(0,f.registryContextType)();class Ye extends s.PureComponent{constructor(e,t){super(e,t),(0,f.validateRegistry)(t,{chartWidget:o.any.isRequired,chartApiInstance:o.any.isRequired}),this.state={availableSessions:[]}}componentDidMount(){const{chartWidget:e}=this.context;e.withModel(null,(()=>{
const t=e.model();t.model().mainSeries().dataEvents().symbolResolved().subscribe(this,this.updateSessionButton),t.model().mainSeries().properties().childs().sessionId.subscribe(this,this.updateSessionButton),this.updateSessionButton()}))}componentWillUnmount(){const{chartWidget:e}=this.context;e.withModel(null,(()=>{const t=e.model();t.model().mainSeries().dataEvents().symbolResolved().unsubscribe(this,this.updateSessionButton),t.model().mainSeries().properties().childs().sessionId.unsubscribe(this,this.updateSessionButton)}))}render(){const{className:e,withMenu:t}=this.props,{sessionName:n,sessionDescription:i}=this.state;return s.createElement(u.ToolbarMenuButton,{arrow:!1,isDisabled:!t,content:n,className:e,closeOnClickOutside:!0,tooltip:t?i:void 0,hotKey:Ke,"data-name":"session-menu",verticalDropDirection:h.VerticalDropDirection.FromBottomToTop,verticalAttachEdge:h.VerticalAttachEdge.Top,onClick:this._trackClick},this._menuItems())}updateSessionButton(){const{chartWidget:e}=this.context;if(!e.model())return;const t=e.model().mainSeries().symbolInfo();if(null===t)return;const n=t.subsession_id,s=t.subsessions?.filter((e=>!e.private))??[],i=s.find((e=>e.id===n));this.setState({sessionId:n,sessionName:(0,Ge.translateSessionShortDescription)(i?.description||""),sessionDescription:(0,Ge.translateSessionDescription)(i?.description||""),availableSessions:s})}_menuItems(){if(!this.props.withMenu)return[];const{chartWidget:e}=this.context,{availableSessions:t}=this.state;if(!e.model())return[];const n=e.model().mainSeries(),i=[s.createElement(qe.ToolWidgetMenuSummary,{key:"header_menu_text",className:Je.headerMenuText},Ze.headerMenuText.toUpperCase())];for(const a of t){const t={category:"SetSession",event:a.id},o=()=>{e.model().setProperty(n.properties().childs().sessionId,a.id,$e)};i.push(s.createElement(p.AccessibleMenuItem,{key:a.id,label:(0,Ge.translateSessionDescription)(a.description),isActive:this.state.sessionId===a.id,trackEventObject:t,onClick:o}))}return i}_trackClick(){0}}Ye.contextType=Qe;var et,tt=n(69830),nt=n(21868),st=n(72026),it=n(51267),at=n(78748);!function(e){e[e.MinSpace=0]="MinSpace"}(et||(et={}));const ot={extLabel:a.t(null,void 0,n(8586)),extHint:a.t(null,void 0,n(92966)),percentageHint:a.t(null,void 0,n(81649)),logLabel:a.t(null,{context:"scale"},n(4161)),logHint:a.t(null,void 0,n(1e4)),autoLabel:a.t(null,{context:"scale"},n(22233)),autoHint:a.t(null,void 0,n(41888)),maximizeChartHint:a.t(null,void 0,n(61206)),restoreChartHint:a.t(null,void 0,n(31142)),adjLabel:a.t(null,{context:"adjustments"},n(94920)),adjHint:a.t(null,void 0,n(93020)),adjForDividendsOnlyHint:a.t(null,void 0,n(2031)),adjForSplitsOnlyHint:a.t(null,void 0,n(95739)),backAdjustLabel:a.t(null,{context:"adjustments"},n(16755)),backAdjustHint:a.t(null,void 0,n(68921)),settlementAsCloseLabel:a.t(null,{context:"adjustments"},n(82631)),settlementAsCloseHint:a.t(null,void 0,n(49545))};var rt,lt;!function(e){e.Separator="separator",e.TimeZones="timeZones",e.SessionId="session",e.Percentage="percentage",e.Logarithm="logarithm",
e.Auto="auto",e.LayoutFullscreen="layoutFullscreen",e.Fullscreen="fullscreen",e.Adj="adj",e.BackAdj="backAdj",e.SettlementAsClose="settlementAsClose",e.PreventPhoneLayout="preventPhoneLayout"}(rt||(rt={})),function(e){e.Expanded="expanded",e.Collapsed="collapsed",e.Hidden="hidden"}(lt||(lt={}));const ct=(ut=e=>s.createElement(ae.ToolbarButton,{text:ot.logLabel,tooltip:ot.logHint,className:e.className,isActive:e.isLogarithm,"aria-pressed":e.isLogarithm,onClick:yt(e.onClick,"log",e.isLogarithm),onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,"data-name":"logarithm"}),(ht=class extends s.PureComponent{constructor(e,t){super(e,t),this._priceScale=null,this._handleSelect=()=>{const e=this.context.chartWidget.model(),t=(0,v.ensureNotNull)(this.state.series),n=t.priceScale(),s=n.mode();t.priceScale().isLockScale()||e.setPriceScaleMode({log:!s.log},n,Le)},(0,f.validateRegistry)(t,{chartWidget:o.any.isRequired}),this.state={isActive:!1,series:null},this._priceAxisHighlighter=new ze(this.context.chartWidget,(()=>this._priceScale),"logarithm")}componentDidMount(){const e=this.context.chartWidget;e.withModel(null,(()=>{const t=e.model().mainSeries(),n=t.priceScale();this._handleMainSeriesPriceScaleChanged(n),t.priceScaleChanged().subscribe(this,this._handleMainSeriesPriceScaleChanged),this._handleModeChanged({},n.mode()),this.setState({isActive:t.priceScale().isLog(),series:t})}))}componentWillUnmount(){const e=this.context.chartWidget;e.withModel(null,(()=>{e.model().mainSeries().priceScaleChanged().unsubscribe(this,this._handleMainSeriesPriceScaleChanged)})),null!==this._priceScale&&(this._priceScale.modeChanged().unsubscribeAll(this),this._priceScale=null),this._priceAxisHighlighter.destroy()}render(){const{className:e}=this.props,{isActive:t,series:n}=this.state;return s.createElement(ut,{...this._priceAxisHighlighter.handlers(),className:e,isLogarithm:t,isDisabled:null===n,onClick:this._handleSelect})}_handleMainSeriesPriceScaleChanged(e){null!==this._priceScale&&this._priceScale.modeChanged().unsubscribe(this,this._handleModeChanged),this._priceScale=e,this._priceScale.modeChanged().subscribe(this,this._handleModeChanged),this._handleModeChanged({},e.mode())}_handleModeChanged(e,t){Boolean(t.log)!==this.state.isActive&&this.setState({isActive:Boolean(t.log)})}}).contextType=Fe,ht);var ut,ht;const dt=function(e){var t;return(t=class extends s.PureComponent{constructor(e,t){super(e,t),this._priceScale=null,this._handleSelect=()=>{const e=this.context.chartWidget.model(),t=(0,v.ensureNotNull)(this.state.series).priceScale(),n=t.mode();e.setPriceScaleMode({autoScale:!n.autoScale},t,Ie)},(0,f.validateRegistry)(t,{chartWidget:o.any.isRequired}),this.state={isActive:!1,series:null},this._priceAxisHighlighter=new ze(this.context.chartWidget,(()=>this._priceScale),"auto")}componentDidMount(){const e=this.context.chartWidget;e.withModel(null,(()=>{const t=e.model().mainSeries(),n=t.priceScale();this._handleMainSeriesPriceScaleChanged(n),t.priceScaleChanged().subscribe(this,this._handleMainSeriesPriceScaleChanged),
this._handleModeChanged({},n.mode()),this.setState({isActive:t.priceScale().isAutoScale(),series:t})}))}componentWillUnmount(){const e=this.context.chartWidget;e.withModel(null,(()=>{e.model().mainSeries().priceScaleChanged().unsubscribe(this,this._handleMainSeriesPriceScaleChanged)})),null!==this._priceScale&&(this._priceScale.modeChanged().unsubscribeAll(this),this._priceScale=null),this._priceAxisHighlighter.destroy()}render(){const{className:t}=this.props,{isActive:n,series:i}=this.state;return s.createElement(e,{...this._priceAxisHighlighter.handlers(),className:t,isAuto:n,isDisabled:null===i,onClick:this._handleSelect})}_handleMainSeriesPriceScaleChanged(e){null!==this._priceScale&&this._priceScale.modeChanged().unsubscribe(this,this._handleModeChanged),this._priceScale=e,this._priceScale.modeChanged().subscribe(this,this._handleModeChanged),this._handleModeChanged({},e.mode())}_handleModeChanged(e,t){Boolean(t.autoScale)!==this.state.isActive&&this.setState({isActive:Boolean(t.autoScale)})}}).contextType=Pe,t}((e=>s.createElement(ae.ToolbarButton,{text:ot.autoLabel,tooltip:ot.autoHint,className:e.className,isActive:e.isAuto,"aria-pressed":e.isAuto,onClick:yt(e.onClick,"auto",e.isAuto),onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,"data-name":"auto"}))),mt=function(e){var t;return(t=class extends s.PureComponent{constructor(e,t){super(e,t),this._priceScale=null,this._handleSelect=()=>{const e=this.context.chartWidget.model(),t=(0,v.ensureNotNull)(this.state.series),n=t.priceScale(),s=n.mode();t.priceScale().isLockScale()||e.setPriceScaleMode({percentage:!s.percentage},n,Oe)},(0,f.validateRegistry)(t,{chartWidget:o.any.isRequired}),this.state={isActive:!1,series:null},this._priceAxisHighlighter=new ze(this.context.chartWidget,(()=>this._priceScale),"percentage")}componentDidMount(){const e=this.context.chartWidget;e.withModel(null,(()=>{const t=e.model().mainSeries(),n=t.priceScale();this._handleMainSeriesPriceScaleChanged(n),t.priceScaleChanged().subscribe(this,this._handleMainSeriesPriceScaleChanged),this._handleScaleChange({},n.mode()),this.setState({isActive:t.priceScale().isPercentage(),series:t})}))}componentWillUnmount(){const e=this.context.chartWidget;e.withModel(null,(()=>{e.model().mainSeries().priceScaleChanged().unsubscribe(this,this._handleMainSeriesPriceScaleChanged)})),null!==this._priceScale&&(this._priceScale.modeChanged().unsubscribeAll(this),this._priceScale=null),this._priceAxisHighlighter.destroy()}render(){const{className:t}=this.props,{isActive:n,series:i}=this.state;return s.createElement(e,{...this._priceAxisHighlighter.handlers(),className:t,isPercentage:n,isDisabled:null===i,onClick:this._handleSelect})}_handleMainSeriesPriceScaleChanged(e){null!==this._priceScale&&this._priceScale.modeChanged().unsubscribe(this,this._handleScaleChange),this._priceScale=e,this._priceScale.modeChanged().subscribe(this,this._handleScaleChange),this._handleScaleChange({},e.mode())}_handleScaleChange(e,t){Boolean(t.percentage)!==this.state.isActive&&this.setState({isActive:Boolean(t.percentage)
})}}).contextType=He,t}((e=>s.createElement(ae.ToolbarButton,{icon:nt,tooltip:ot.percentageHint,className:e.className,isActive:e.isPercentage,"aria-pressed":e.isPercentage,isDisabled:e.isDisabled,onClick:yt(e.onClick,"percent",e.isPercentage),onMouseEnter:e.onMouseEnter,onMouseLeave:e.onMouseLeave,"data-name":"percentage"})));const pt=(0,le.hotKeySerialize)({keys:[(0,ce.humanReadableModifiers)(ce.Modifiers.Alt,!1),"Enter"],text:"{0} + {1}"}),gt=function(e){var t;return(t=class extends s.PureComponent{constructor(e,t){super(e,t),this._handleClick=e=>{const{resizerDetacher:t,chartWidgetCollection:n}=this.context;e.shiftKey&&t.detachable.value()?t.detach():this.state.isFullscreen?t.exitFullscreen():t.requestFullscreen()},this._handleLayoutChange=e=>{this.setState({isFullscreen:e})},this._handlePhoneSize=()=>{0},(0,f.validateRegistry)(t,{chartWidgetCollection:o.any.isRequired,resizerDetacher:o.any.isRequired});const{resizerDetacher:n}=t;this.state={isFullscreen:n.fullscreen.value(),isChangeLayoutButton:this._isChangeLayoutButton()}}componentDidMount(){const{resizerDetacher:e,chartWidgetCollection:t}=this.context,{mobileChangeLayoutEnabled:n}=this.props;e.fullscreen.subscribe(this._handleLayoutChange)}componentWillUnmount(){const{resizerDetacher:e,chartWidgetCollection:t}=this.context,{mobileChangeLayoutEnabled:n}=this.props;e.fullscreen.unsubscribe(this._handleLayoutChange)}render(){const{className:t}=this.props,{isFullscreen:n,isChangeLayoutButton:i}=this.state;return s.createElement(e,{className:t,isFullscreen:n,onClick:this._handleClick})}_isChangeLayoutButton(){return!1}}).contextType=Ue,t}((e=>s.createElement(ae.ToolbarButton,{icon:e.isFullscreen?it:st,tooltip:e.isFullscreen?ot.restoreChartHint:ot.maximizeChartHint,className:r(e.className,at.fullscreenButton),isActive:e.isFullscreen,onClick:yt(e.onClick,"maximize chart",e.isFullscreen),"data-tooltip-hotkey":pt,"data-name":"layoutFullscreen"}))),vt={layoutFullscreen:!0,preventPhoneLayout:!0},bt={layoutFullscreen:Number.MIN_SAFE_INTEGER,preventPhoneLayout:Number.MIN_SAFE_INTEGER,fullscreen:Number.MIN_SAFE_INTEGER,separator:-2,timeZones:-1,auto:0,logarithm:1,percentage:2,session:3,adj:4,backAdj:5,settlementAsClose:6},ft=(()=>{const e=new Map;return e.set(ct,"logarithm"),e.set(mt,"percentage"),e.set(dt,"auto"),e.set(Ye,"session"),e.set(gt,"layoutFullscreen"),Ne.CheckMobile.any()&&e.set(tt.ToolWidgetFullscreen,"fullscreen"),e})();function _t(e){0}function yt(e,t,n){return t=>{e(t)}}const Ct={dateRangeMode:"hidden",noRanges:!1,separator:!0,timeZones:!0,layoutFullscreen:!0,preventPhoneLayout:!0,auto:!0,logarithm:!0,percentage:!0,session:!0,adj:!0,backAdj:!0,settlementAsClose:!0,fullscreen:!0},xt=(0,f.registryContextType)();class St extends s.PureComponent{constructor(e,t){var n,a;super(e,t),this._timezoneButtonRef=null,this._layout=Object.assign({},Ct),this._raf=null,this._toolbar=null,this._rangeExpanded=null,this._rangeCollapsed=null,this._seriesComponents={},this._resizeObserver=null,this._injector=(n=()=>this._layout,a=(e,t)=>this._seriesComponents[t]=e,(e,t,i)=>{
if(s.isValidElement(e)&&"string"!=typeof e.type){const{props:t}=e;if("string"==typeof t.className){const i={className:t.className},o=n(),l=(0,v.ensureDefined)(ft.get(e.type));return s.createElement("div",{key:null===e.key?void 0:e.key,className:r(at.inline,o[l]&&at.collapsed),ref:e=>a(e,l),onClick:()=>_t()},s.cloneElement(e,i))}}return e}),this._onSymbolSourceCollectionChanged=()=>{this._updateButtonsVisibilityImp(!0)},this._updateButtonsVisibility=()=>{this._updateButtonsVisibilityImp()},this._updateButtonsVisibilityImp=e=>{const{chartWidget:t}=this.context,n=t.model().model(),s=n.mainSeries(),i=s.symbolInfo(),a=!s.isDWMProperty().value();if(s.symbolResolvingActive().value())return void this._setStateWithResize({intervalAllowsSessionButton:a},e);const o=(i?.subsessions||[]).filter((e=>!e.private)).length>1;this._setStateWithResize({intervalAllowsSessionButton:a,symbolAllowsSessionButton:o},e)},this._handleFullscreenChange=()=>{this.setState({isFullscreen:this.context.chartWidgetCollection.fullscreen().value()})},this._resizeByRaf=()=>{null===this._raf&&(this._raf=requestAnimationFrame((()=>{this._resizeHandler(),this._raf=null})))},this._resizeHandler=()=>{const e=this._layout,t=(0,v.ensureNotNull)(this._toolbar),n=(0,v.ensureNotNull)(this._rangeExpanded),s=(a=function(e){const t={};return Object.keys(e).forEach((n=>{const s=e[n];if(null!==s){const e=i.findDOMNode(s);null!==e&&(t[n]=e)}})),t}(this._seriesComponents),Object.keys(a).map((e=>({name:e,width:a[e].offsetWidth}))).sort(((e,t)=>bt[e.name]-bt[t.name])));var a;const o=t.offsetWidth,r=s.reduce(((e,t)=>e+t.width),0),l=n.offsetWidth,c=!Boolean(n.textContent),u=o-r-l<=0?"collapsed":"expanded";if(Object.assign(e,{dateRangeMode:u,noRanges:c}),"expanded"!==u){const t=o-(0,v.ensureNotNull)(this._rangeCollapsed).offsetWidth-0;let n=0,i=0;for(const a of s)n+=a.width,a.name in vt?(i+=a.width,Object.assign(e,{[a.name]:!1})):Object.assign(e,{[a.name]:t<=n});t<=i&&Object.assign(e,{dateRangeMode:"hidden"})}else Object.assign(e,{separator:!1,timeZones:!1,layoutFullscreen:!1,preventPhoneLayout:!1,auto:!1,logarithm:!1,percentage:!1,session:!1,adj:!1,settlementAsClose:!1,backAdj:!1,fullscreen:!1});this._applyResizing()},this._handleTimezoneButtonRef=e=>{this._timezoneButtonRef=e},this._handleMeasure=()=>{null!==this._toolbar&&this.resizeUI()},this._handleLayoutFullscreenableChange=e=>{this._setStateWithResize({isLayoutFullscreenable:e})},this._handlePreventPhoneLayoutButtonVisibility=()=>{0},this._handleToolbarRef=e=>this._toolbar=e,this._handleRangeCollapsedRef=e=>this._rangeCollapsed=e,this._handleRangeExpandedRef=e=>{this._updateResizeObserver(this._rangeExpanded,e),this._rangeExpanded=e},this._handleTimeZonesRef=e=>{this._updateResizeObserver(this._seriesComponents.timeZones,e),this._seriesComponents.timeZones=e},this._handleSessionsRef=e=>{this._updateResizeObserver(this._seriesComponents.session,e),this._seriesComponents.session=e},this._handleSeparatorRef=e=>{this._seriesComponents.separator=e},this._updateResizeObserver=(e,t)=>{
this._resizeObserver&&e!==t&&(e&&this._resizeObserver.unobserve(e),t&&this._resizeObserver.observe(t))},(0,f.validateRegistry)(t,{onContentBoxChanged:o.any.isRequired,chartApiInstance:o.any.isRequired,chartWidget:o.any.isRequired,chartWidgetCollection:o.any.isRequired,resizerDetacher:o.any.isRequired});const{resizerDetacher:l}=this.context;this.state={isLayoutFullscreenable:l.fullscreenable.value(),isPreventPhoneLayoutButton:this._isPreventPhoneLayoutButton(),isFullscreen:this.context.chartWidgetCollection.fullscreen().value()},this._resizeObserver=new ResizeObserver(this._handleMeasure)}componentDidMount(){const{onContentBoxChanged:e,resizerDetacher:t,chartWidgetCollection:n,chartWidget:s}=this.context;e.subscribe(this,this._resizeByRaf),n.fullscreen().subscribe(this._handleFullscreenChange),t.fullscreenable.subscribe(this._handleLayoutFullscreenableChange),s.withModel(null,(()=>{const e=s.model(),t=e.model();e.mainSeries().isDWMProperty().subscribe(this,this._updateButtonsVisibility),t.symbolSourceResolvingActive().subscribe(this._updateButtonsVisibility),t.symbolSourceCollectionChanged().subscribe(this,this._onSymbolSourceCollectionChanged),this._updateButtonsVisibility()})),this.updateTimezonesButton(),this.resizeUI()}componentWillUnmount(){const{onContentBoxChanged:e,resizerDetacher:t,chartWidgetCollection:n,chartWidget:s}=this.context;n.fullscreen().unsubscribe(this._handleFullscreenChange),e.unsubscribe(this,this._resizeByRaf),t.fullscreenable.unsubscribe(this._handleLayoutFullscreenableChange),this._resizeObserver?.disconnect(),s.withModel(null,(()=>{const e=s.model(),t=e.model();e.mainSeries().isDWMProperty().unsubscribe(this,this._updateButtonsVisibility),e.mainSeries().isBackAdjustmentForbiddenProperty().unsubscribe(this,this._updateButtonsVisibility),e.mainSeries().isSettlementAsCloseForbiddenProperty().unsubscribe(this,this._updateButtonsVisibility),t.symbolSourceCollectionChanged().unsubscribe(this,this._onSymbolSourceCollectionChanged),t.symbolSourceResolvingActive().unsubscribe(this._updateButtonsVisibility)})),null!==this._raf&&(cancelAnimationFrame(this._raf),this._raf=null)}render(){const e=this._layout,{timeFramesWidgetEnabled:t,timeWidgetEnabled:n,percentageScaleButtonEnabled:i,logScaleButtonEnabled:a,autoScaleButtonEnabled:o,layoutFullscreenButtonEnabled:l}=this.props;return s.createElement(We.Toolbar,{className:at.toolbar,onContextMenu:je.preventDefault,ref:this._handleToolbarRef},t&&s.createElement(Xe.FragmentMap,null,s.createElement("div",{className:r(at.dateRangeWrapper,"collapsed"!==e.dateRangeMode&&at.collapsed),ref:this._handleRangeCollapsedRef},s.createElement("div",{className:r(at.dateRangeCollapsed)},s.createElement(ie,{goToDateButton:this.props.goToDateEnabled,className:at.dateRange}))),s.createElement("div",{className:r(at.dateRangeWrapper,"expanded"!==e.dateRangeMode&&at.collapsed,e.noRanges&&at.noranges),ref:this._handleRangeExpandedRef},s.createElement("div",{className:r(at.dateRangeExpanded)},s.createElement(re,{onSelectRange:this._trackRangeButtonClick,className:at.dateRange
}),this.props.goToDateEnabled&&s.createElement(Ae,{className:r(at.separator)}),this.props.goToDateEnabled&&s.createElement(ve,null)))),s.createElement("div",{className:at.seriesControlWrapper},n&&s.createElement("div",{className:r(at.inline,e.timeZones&&at.collapsed),ref:this._handleTimeZonesRef},s.createElement("div",{className:at.inline,onClick:this._trackTimezonesButtonClick},s.createElement(ke,{className:at.item,withMenu:this.props.timezoneMenuEnabled,ref:this._handleTimezoneButtonRef}))),this.props.sessionIdButtonEnabled&&this.state.symbolAllowsSessionButton&&this.state.intervalAllowsSessionButton&&s.createElement("div",{className:r(at.inline,e.session&&at.collapsed),ref:this._handleSessionsRef},s.createElement("div",{className:at.inline},s.createElement(Ye,{className:at.item,withMenu:this.props.sessionIdButtonEnabled}))),s.createElement("div",{ref:this._handleSeparatorRef,className:r(at.inline,e.separator&&at.collapsed)},s.createElement(Ae,null)),s.createElement(Xe.FragmentMap,{map:this._injector},!1,!1,!1,i&&!c.enabled("fundamental_widget")&&s.createElement(mt,{className:at.item}),a&&s.createElement(ct,{className:at.item}),o&&s.createElement(dt,{className:at.item}),l&&this.state.isLayoutFullscreenable&&s.createElement(gt,{className:at.item,mobileChangeLayoutEnabled:this.props.mobileChangeLayoutEnabled}),!1,Ne.CheckMobile.any()&&this.state.isFullscreen&&s.createElement(tt.ToolWidgetFullscreen,{id:"bottom-toolbar-fullscreen",clickArea:"bottom toolbar",isActive:!0,className:at.fullscreenBtn}))))}updateTimezonesButton(){null!==this._timezoneButtonRef&&this._timezoneButtonRef.updateTimezonesButton()}resizeUI(){this._resizeByRaf()}_trackRangeButtonClick(e){0}_trackTimezonesButtonClick(){_t()}_setStateWithResize(e,t){Object.assign(this._layout,Ct),this._applyResizing(),t?(this.setState(e),this._resizeHandler()):this.setState(e,(()=>this._resizeByRaf()))}_applyResizing(){const{dateRangeMode:e,noRanges:t,...n}=this._layout;this._rangeExpanded&&(this._rangeExpanded.classList.toggle(at.collapsed,"expanded"!==e),this._rangeExpanded.classList.toggle(at.noranges,t)),this._rangeCollapsed&&this._rangeCollapsed.classList.toggle(at.collapsed,"collapsed"!==e);let s=!1,i=!1;Object.keys(n).forEach((e=>{const t=e;if("separator"!==t){const e=this._seriesComponents[t],a=!0===n[t];e&&("timeZones"===t||"session"===t?s=s||!a:i=i||!a,e.classList.toggle(at.collapsed,a))}}));const a=this._seriesComponents.separator;if(a){const e=!s||!i||!0===n.separator;a.classList.toggle(at.collapsed,e)}}_isPreventPhoneLayoutButton(){return!1}}St.contextType=xt;const Et={onContentBoxChanged:o.any,computeContentBox:o.any,chartWidget:o.any,chartApiInstance:o.any,chartWidgetCollection:o.any,resizerDetacher:o.any,availableTimeFrames:o.any};class wt extends s.PureComponent{constructor(e){super(e),this._setActiveChart=e=>{this._defineRegistry(e),this.setState({chartWidget:e})};const t=this.props.chartWidgetCollection.activeChartWidget.value();this.state={chartWidget:t},this._defineRegistry(t)}componentDidMount(){
this.props.chartWidgetCollection.activeChartWidget.subscribe(this._setActiveChart)}componentWillUnmount(){this.props.chartWidgetCollection.activeChartWidget.unsubscribe(this._setActiveChart)}render(){const{chartWidget:e}=this.state;if(!e)return null;const{options:t}=this.props,n={timeFramesWidgetEnabled:t.timeFramesWidgetEnabled,goToDateEnabled:t.timeFramesWidget.goToDateEnabled,timeWidgetEnabled:t.timeWidgetEnabled,timezoneMenuEnabled:t.timeWidget&&t.timeWidget.timezoneMenuEnabled,sessionIdButtonEnabled:t.sessionIdButtonEnabled,backAdjustmentButtonEnabled:t.backAdjustmentButtonEnabled,settlementAsCloseButtonEnabled:t.settlementAsCloseButtonEnabled,adjustForDividendsButtonEnabled:t.adjustForDividendsButtonEnabled,logScaleButtonEnabled:t.logScaleButtonEnabled,percentageScaleButtonEnabled:t.percentageScaleButtonEnabled,autoScaleButtonEnabled:t.autoScaleButtonEnabled,layoutFullscreenButtonEnabled:t.layoutFullscreenButtonEnabled,mobileChangeLayoutEnabled:t.mobileChangeLayoutEnabled};return s.createElement(f.RegistryProvider,{validation:Et,value:this._registry},s.createElement(St,{key:e.id(),...n}))}_defineRegistry(e){const{onContentBoxChanged:t,computeContentBox:n,chartApiInstance:s,chartWidgetCollection:i,options:{timeFramesWidgetEnabled:a,timeFramesWidget:o}}=this.props,r=a?o.availableTimeFrames:void 0;this._registry={onContentBoxChanged:t,computeContentBox:n,chartWidget:e,availableTimeFrames:r,chartApiInstance:s,chartWidgetCollection:i,resizerDetacher:e.getResizerDetacher()}}}var Mt;!function(e){e.InitializedAttribute="data-initialized"}(Mt||(Mt={}));class Rt{constructor(e,t,n,a,o,r,l){this._container=e;const c=s.createElement(wt,{onContentBoxChanged:t,computeContentBox:n,chartWidgetCollection:a,chartApiInstance:o,chartWidgetOptions:r,options:l});i.render(c,e),e.setAttribute("data-initialized","true")}destroy(){i.unmountComponentAtNode(this._container),this._container.removeAttribute("data-initialized")}}},69830:(e,t,n)=>{"use strict";n.d(t,{ToolWidgetFullscreen:()=>g});var s=n(50959),i=n(19036),a=n(97754),o=n(11542),r=n(58169),l=n(68976),c=n(61814),u=n(68335),h=n(97268),d=n(36992);const m=(0,c.hotKeySerialize)({keys:[(0,u.humanReadableModifiers)(u.Modifiers.Shift,!1),"F"],text:"{0} + {1}"}),p=(0,l.registryContextType)();class g extends s.PureComponent{constructor(e,t){super(e,t),this._updateState=()=>{this.setState({isFullscreen:this.context.chartWidgetCollection.fullscreen().value()})},this._handleClick=()=>{const{chartWidgetCollection:e}=this.context,{clickArea:t}=this.props;e.fullscreen().value()?e.exitFullscreen():e.startFullscreen()},(0,l.validateRegistry)(t,{chartWidgetCollection:i.any.isRequired}),this.state={isFullscreen:this.context.chartWidgetCollection.fullscreen().value()},this._subscribe()}render(){const{className:e,id:t,isActive:i}=this.props,{isFullscreen:l}=this.state;return s.createElement(r.ToolbarIconButton,{id:t,icon:l?d:h,onClick:this._handleClick,className:a(e),tooltip:o.t(null,void 0,n(67092)),"data-tooltip-hotkey":m,isActive:i})}componentWillUnmount(){this._unsubscribe()}_subscribe(){
this.context.chartWidgetCollection.fullscreen().subscribe(this._updateState)}_unsubscribe(){this.context.chartWidgetCollection.fullscreen().unsubscribe(this._updateState)}}g.contextType=p},68976:(e,t,n)=>{"use strict";n.d(t,{RegistryProvider:()=>l,registryContextType:()=>c,validateRegistry:()=>r});var s=n(50959),i=n(19036),a=n.n(i);const o=s.createContext({});function r(e,t){a().checkPropTypes(t,e,"context","RegistryContext")}function l(e){const{validation:t,value:n}=e;return r(n,t),s.createElement(o.Provider,{value:n},e.children)}function c(){return o}},72026:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path fill="currentColor" d="M15 8V3h-5V2h6v6h-1ZM3 10v5h5v1H2v-6h1Z"/></svg>'},51267:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path fill="currentColor" d="M11 2v5h5v1h-6V2h1ZM7 16v-5H2v-1h6v6H7Z"/></svg>'},97268:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path fill="currentColor" d="M8.5 6A2.5 2.5 0 0 0 6 8.5V11h1V8.5C7 7.67 7.67 7 8.5 7H11V6H8.5zM6 17v2.5A2.5 2.5 0 0 0 8.5 22H11v-1H8.5A1.5 1.5 0 0 1 7 19.5V17H6zM19.5 7H17V6h2.5A2.5 2.5 0 0 1 22 8.5V11h-1V8.5c0-.83-.67-1.5-1.5-1.5zM22 19.5V17h-1v2.5c0 .83-.67 1.5-1.5 1.5H17v1h2.5a2.5 2.5 0 0 0 2.5-2.5z"/></svg>'},36992:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path fill="currentColor" d="M17 6v2.5a2.5 2.5 0 0 0 2.5 2.5H22v-1h-2.5A1.5 1.5 0 0 1 18 8.5V6h-1zm2.5 11a2.5 2.5 0 0 0-2.5 2.5V22h1v-2.5c0-.83.67-1.5 1.5-1.5H22v-1h-2.5zm-11 1H6v-1h2.5a2.5 2.5 0 0 1 2.5 2.5V22h-1v-2.5c0-.83-.67-1.5-1.5-1.5zM11 8.5V6h-1v2.5c0 .83-.67 1.5-1.5 1.5H6v1h2.5A2.5 2.5 0 0 0 11 8.5z"/></svg>'},92574:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path fill="currentColor" fill-rule="evenodd" d="M11 4h-1v2H7.5A2.5 2.5 0 0 0 5 8.5V13h1v-2h16v8.5c0 .83-.67 1.5-1.5 1.5H14v1h6.5a2.5 2.5 0 0 0 2.5-2.5v-11A2.5 2.5 0 0 0 20.5 6H18V4h-1v2h-6V4Zm6 4V7h-6v1h-1V7H7.5C6.67 7 6 7.67 6 8.5V10h16V8.5c0-.83-.67-1.5-1.5-1.5H18v1h-1Zm-5.15 10.15-3.5-3.5-.7.7L10.29 18H4v1h6.3l-2.65 2.65.7.7 3.5-3.5.36-.35-.36-.35Z"/></svg>'},79978:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18" fill="none"><path stroke="currentColor" d="M8 5l3.5 3.5L8 12"/></svg>'},21868:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14"><g fill="none" stroke="currentColor"><circle cx="3.5" cy="3.5" r="2"/><circle cx="10.5" cy="10.5" r="2"/><path stroke-linecap="square" d="M9.5 1.5l-5 11"/></g></svg>'},39750:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28" fill="none"><path stroke="currentColor" stroke-linecap="round" stroke-width="1.5" d="M7 15l5 5L23 9"/></svg>'},90752:e=>{
e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28" fill="none"><path stroke="currentColor" d="M5.5 13v-2.5m8.5 11h6.5a2 2 0 0 0 2-2v-9m-17 0v-2c0-1.1.9-2 2-2h13a2 2 0 0 1 2 2v2m-17 0h17"/><path fill="currentColor" d="M10 4h1v4h-1V4zM17 4h1v4h-1V4z"/><path stroke="currentColor" d="M4 18.5h7.5m0 0L8 22m3.5-3.5L8 15"/></svg>'},25931:(e,t,n)=>{"use strict";n.d(t,{nanoid:()=>s});let s=(e=21)=>crypto.getRandomValues(new Uint8Array(e)).reduce(((e,t)=>e+=(t&=63)<36?t.toString(36):t<62?(t-26).toString(36).toUpperCase():t>62?"-":"_"),"")}}]);