(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[3005],{97754:(e,t)=>{var r;!function(){"use strict";var n={}.hasOwnProperty;function s(){for(var e=[],t=0;t<arguments.length;t++){var r=arguments[t];if(r){var i=typeof r;if("string"===i||"number"===i)e.push(r);else if(Array.isArray(r)&&r.length){var a=s.apply(null,r);a&&e.push(a)}else if("object"===i)for(var o in r)n.call(r,o)&&r[o]&&e.push(o)}}return e.join(" ")}e.exports?(s.default=s,e.exports=s):void 0===(r=function(){return s}.apply(t,[]))||(e.exports=r)}()},12912:e=>{e.exports={wrap:"wrap-wXGVFOC9",wrapWithArrowsOuting:"wrapWithArrowsOuting-wXGVFOC9",wrapOverflow:"wrapOverflow-wXGVFOC9",scrollWrap:"scrollWrap-wXGVFOC9",noScrollBar:"noScrollBar-wXGVFOC9",icon:"icon-wXGVFOC9",scrollLeft:"scrollLeft-wXGVFOC9",scrollRight:"scrollRight-wXGVFOC9",isVisible:"isVisible-wXGVFOC9",iconWrap:"iconWrap-wXGVFOC9",fadeLeft:"fadeLeft-wXGVFOC9",fadeRight:"fadeRight-wXGVFOC9"}},39416:(e,t,r)=>{"use strict";r.d(t,{useFunctionalRefObject:()=>i});var n=r(50959),s=r(43010);function i(e){const t=(0,n.useMemo)((()=>function(e){const t=r=>{e(r),t.current=r};return t.current=null,t}((e=>{o.current(e)}))),[]),r=(0,n.useRef)(null),i=t=>{if(null===t)return a(r.current,t),void(r.current=null);r.current!==e&&(r.current=e,a(r.current,t))},o=(0,n.useRef)(i);return o.current=i,(0,s.useIsomorphicLayoutEffect)((()=>{if(null!==t.current)return o.current(t.current),()=>o.current(null)}),[e]),t}function a(e,t){null!==e&&("function"==typeof e?e(t):e.current=t)}},43010:(e,t,r)=>{"use strict";r.d(t,{useIsomorphicLayoutEffect:()=>s});var n=r(50959);function s(e,t){("undefined"==typeof window?n.useEffect:n.useLayoutEffect)(e,t)}},67842:(e,t,r)=>{"use strict";r.d(t,{useResizeObserver:()=>a});var n=r(50959),s=r(43010),i=r(39416);function a(e,t=[]){const{callback:r,ref:a=null}=function(e){return"function"==typeof e?{callback:e}:e}(e),o=(0,n.useRef)(null),l=(0,n.useRef)(r);l.current=r;const c=(0,i.useFunctionalRefObject)(a),u=(0,n.useCallback)((e=>{c(e),null!==o.current&&(o.current.disconnect(),null!==e&&o.current.observe(e))}),[c,o]);return(0,s.useIsomorphicLayoutEffect)((()=>(o.current=new ResizeObserver(((e,t)=>{l.current(e,t)})),c.current&&u(c.current),()=>{o.current?.disconnect()})),[c,...t]),u}},9745:(e,t,r)=>{"use strict";r.d(t,{Icon:()=>s});var n=r(50959);const s=n.forwardRef(((e,t)=>{const{icon:r="",title:s,ariaLabel:i,ariaLabelledby:a,ariaHidden:o,...l}=e,c=!!(s||i||a);return n.createElement("span",{role:"img",...l,ref:t,"aria-label":i,"aria-labelledby":a,"aria-hidden":o||!c,title:s,dangerouslySetInnerHTML:{__html:r}})}))},47201:(e,t,r)=>{"use strict";function n(...e){return t=>{for(const r of e)void 0!==r&&r(t)}}r.d(t,{createSafeMulticastEventHandler:()=>n})},42142:(e,t,r)=>{"use strict";r.d(t,{FragmentMap:()=>s});var n=r(50959);function s(e){if(e.map){return n.Children.toArray(e.children).map(e.map)}return e.children}},45601:(e,t,r)=>{"use strict";r.d(t,{Measure:()=>s});var n=r(67842);function s(e){const{children:t,onResize:r}=e;return t((0,
n.useResizeObserver)(r||(()=>{}),[null===r]))}},70412:(e,t,r)=>{"use strict";r.d(t,{hoverMouseEventFilter:()=>a,useAccurateHover:()=>o,useHover:()=>s,useHoverDeprecated:()=>i});var n=r(50959);function s(){const[e,t]=(0,n.useState)(!1);return[e,{onMouseEnter:function(e){t(!0)},onMouseLeave:function(e){t(!1)}}]}function i(){const[e,t]=(0,n.useState)(!1);return[e,{onMouseOver:function(e){a(e)&&t(!0)},onMouseOut:function(e){a(e)&&t(!1)}}]}function a(e){return!e.currentTarget.contains(e.relatedTarget)}function o(e){const[t,r]=(0,n.useState)(!1);return(0,n.useEffect)((()=>{const t=t=>{if(null===e.current)return;const n=e.current.contains(t.target);r(n)};return document.addEventListener("mouseover",t),()=>document.removeEventListener("mouseover",t)}),[]),t}},6132:(e,t,r)=>{"use strict";var n=r(22134);function s(){}function i(){}i.resetWarningCache=s,e.exports=function(){function e(e,t,r,s,i,a){if(a!==n){var o=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 o.name="Invariant Violation",o}}function t(){return e}e.isRequired=e;var r={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:i,resetWarningCache:s};return r.PropTypes=r,r}},19036:(e,t,r)=>{e.exports=r(6132)()},22134:e=>{"use strict";e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},60104:e=>{e.exports={group:"group-MBOVGQRI",separator:"separator-MBOVGQRI",noLeftDecoration:"noLeftDecoration-MBOVGQRI",noRightDecoration:"noRightDecoration-MBOVGQRI",noMinimalWidth:"noMinimalWidth-MBOVGQRI",separatorWrap:"separatorWrap-MBOVGQRI"}},82930:e=>{e.exports={separator:"separator-xVhBjD5m"}},98001:e=>{e.exports={"css-value-header-toolbar-height":"38px",toolbar:"toolbar-qqNP9X6e",isHidden:"isHidden-qqNP9X6e",overflowWrap:"overflowWrap-qqNP9X6e",customButton:"customButton-qqNP9X6e",hover:"hover-qqNP9X6e",clicked:"clicked-qqNP9X6e"}},92568:e=>{e.exports={wrap:"wrap-_psvpUP2",icon:"icon-_psvpUP2"}},38206:e=>{e.exports={"css-value-header-toolbar-height":"38px",innerWrap:"innerWrap-OhqNVIYA",inner:"inner-OhqNVIYA",fake:"fake-OhqNVIYA",fill:"fill-OhqNVIYA",collapse:"collapse-OhqNVIYA",button:"button-OhqNVIYA",iconButton:"iconButton-OhqNVIYA",hidden:"hidden-OhqNVIYA",content:"content-OhqNVIYA",desktopPublish:"desktopPublish-OhqNVIYA",mobilePublish:"mobilePublish-OhqNVIYA"}},33647:(e,t,r)=>{"use strict";var n;function s(e){e.dispatchEvent(new CustomEvent("roving-tabindex:main-element"))}function i(e){e.dispatchEvent(new CustomEvent("roving-tabindex:secondary-element"))}r.d(t,{becomeMainElement:()=>s,becomeSecondaryElement:()=>i}),function(e){e.MainElement="roving-tabindex:main-element",e.SecondaryElement="roving-tabindex:secondary-element"}(n||(n={}))},23908:(e,t,r)=>{"use strict";r.d(t,{INTERVALS:()=>s});var n=r(11542);const s=[{name:"",label:n.t(null,{context:"interval"},r(79930))},{name:"H",label:n.t(null,{
context:"interval"},r(35157))},{name:"D",label:n.t(null,{context:"interval"},r(23970))},{name:"W",label:n.t(null,{context:"interval"},r(7938))},{name:"M",label:n.t(null,{context:"interval"},r(18193))}]},26981:(e,t,r)=>{"use strict";r.d(t,{Toolbar:()=>d});var n=r(50959),s=r(50151),i=r(47201),a=r(3343),o=r(22692),l=r(33647),c=r(39416),u=r(99247);const d=(0,n.forwardRef)((function(e,t){const{onKeyDown:r,orientation:d,blurOnEscKeydown:h=!0,blurOnClick:m=!0,...p}=e,v=(0,c.useFunctionalRefObject)(t);return(0,n.useLayoutEffect)((()=>{const e=(0,s.ensureNotNull)(v.current),t=()=>{const t=(0,o.queryTabbableElements)(e).sort(o.navigationOrderComparator);if(0===t.length){const[t]=(0,o.queryFocusableElements)(e).sort(o.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)}),[]),n.createElement("div",{...u.MouseClickAutoBlurHandler.attributes(m),...p,role:"toolbar","aria-orientation":d,ref:v,onKeyDown:(0,i.createSafeMulticastEventHandler)((function(e){if(e.defaultPrevented)return;if(!(document.activeElement instanceof HTMLElement))return;const t=(0,a.hashFromEvent)(e);if(h&&27===t)return e.preventDefault(),void document.activeElement.blur();if("vertical"!==d&&37!==t&&39!==t)return;if("vertical"===d&&38!==t&&40!==t)return;const r=e.currentTarget,n=(0,o.queryFocusableElements)(r).sort(o.navigationOrderComparator);if(0===n.length)return;const s=n.indexOf(document.activeElement);if(-1===s)return;e.preventDefault();const i=()=>{const e=(s+n.length-1)%n.length;(0,l.becomeSecondaryElement)(n[s]),(0,l.becomeMainElement)(n[e]),n[e].focus()},c=()=>{const e=(s+n.length+1)%n.length;(0,l.becomeSecondaryElement)(n[s]),(0,l.becomeMainElement)(n[e]),n[e].focus()};switch((0,o.mapKeyCodeToDirection)(t)){case"inlinePrev":"vertical"!==d&&i();break;case"inlineNext":"vertical"!==d&&c();break;case"blockPrev":"vertical"===d&&i();break;case"blockNext":"vertical"===d&&c()}}),r),"data-tooltip-show-on-focus":"true"})}))},38254:(e,t,r)=>{"use strict";r.r(t),r.d(t,{HeaderToolbarRenderer:()=>Fe});var n=r(50959),s=r(32227),i=r(50151),a=r(97754),o=r.n(a),l=r(85459),c=r.n(l),u=r(20057),d=r(83873),h=r(63193),m=r(37103),p=r(76422),v=r(19036),f=r(32563),g=r(42142),S=r(82930);function b(e){return n.createElement("div",{className:o()(S.separator,e.className)})}var y=r(60104);function C(e){const{children:t,className:r,noLeftDecoration:s,noRightDecoration:i,noMinimalWidth:o,onClick:l,removeSeparator:c}=e;return n.createElement(n.Fragment,null,!c&&n.createElement("div",{className:y.separatorWrap},n.createElement(b,{className:y.separator})),n.createElement("div",{className:a(r,y.group,{[y.noMinimalWidth]:o,[y.noLeftDecoration]:s,[y.noRightDecoration]:i}),onClick:l},t))}var E=r(45601),_=r(11542),w=r(9745),M=r(92568),R=r(45820);const k={text:_.t(null,void 0,r(48161))};function I(e){return n.createElement("div",{className:M.wrap
},n.createElement(w.Icon,{className:M.icon,icon:R}),k.text)}var V=r(22961),F=r(76662),O=r(24640),W=r(61380),L=r(12912);const T={isVisibleScrollbar:!0,shouldMeasure:!0,hideButtonsFrom:1};function N(e){return n.createElement("div",{className:a(L.fadeLeft,e.className,{[L.isVisible]:e.isVisible})})}function B(e){return n.createElement("div",{className:a(L.fadeRight,e.className,{[L.isVisible]:e.isVisible})})}function A(e){return n.createElement(x,{...e,className:L.scrollLeft})}function D(e){return n.createElement(x,{...e,className:L.scrollRight})}function x(e){return n.createElement("div",{className:a(e.className,{[L.isVisible]:e.isVisible}),onClick:e.onClick},n.createElement("div",{className:L.iconWrap},n.createElement(w.Icon,{icon:W,className:L.icon})))}const P=function(e=A,t=D,r=N,s=B){var o;return(o=class extends n.PureComponent{constructor(e){super(e),this._scroll=n.createRef(),this._handleScrollLeft=()=>{if(this.props.onScrollButtonClick)return void this.props.onScrollButtonClick("left");const e=this.props.scrollStepSize||this.state.widthWrap-50;this.animateTo(Math.max(0,this.currentPosition()-e))},this._handleScrollRight=()=>{if(this.props.onScrollButtonClick)return void this.props.onScrollButtonClick("right");const e=this.props.scrollStepSize||this.state.widthWrap-50;this.animateTo(Math.min((this.state.widthContent||0)-(this.state.widthWrap||0),this.currentPosition()+e))},this._handleResizeWrap=([e])=>{const t=e.target.getBoundingClientRect();this.props.onMeasureWrap&&this.props.onMeasureWrap(t),this.setState({widthWrap:t.width}),this._checkButtonsVisibility()},this._handleResizeContent=([e])=>{const t=e.target.getBoundingClientRect();this.props.onMeasureContent&&this.props.onMeasureContent(t);const{shouldDecreaseWidthContent:r,buttonsWidthIfDecreasedWidthContent:n}=this.props;r&&n?this.setState({widthContent:t.width+2*n}):this.setState({widthContent:t.width})},this._handleScroll=()=>{const{onScroll:e}=this.props;e&&e(this.currentPosition(),this.isAtLeft(),this.isAtRight()),this._checkButtonsVisibility()},this._checkButtonsVisibility=()=>{const{isVisibleLeftButton:e,isVisibleRightButton:t}=this.state,r=this.isAtLeft(),n=this.isAtRight();r||e?r&&e&&this.setState({isVisibleLeftButton:!1}):this.setState({isVisibleLeftButton:!0}),n||t?n&&t&&this.setState({isVisibleRightButton:!1}):this.setState({isVisibleRightButton:!0})},this.state={widthContent:0,widthWrap:0,isVisibleRightButton:!1,isVisibleLeftButton:!1}}componentDidMount(){this._checkButtonsVisibility()}componentDidUpdate(e,t){t.widthWrap===this.state.widthWrap&&t.widthContent===this.state.widthContent||this._handleScroll()}currentPosition(){return this._scroll.current?(0,O.isRtl)()?(0,O.getLTRScrollLeft)(this._scroll.current):this._scroll.current.scrollLeft:0}isAtLeft(){return!this._isOverflowed()||this.currentPosition()<=(0,i.ensureDefined)(this.props.hideButtonsFrom)}isAtRight(){return!this._isOverflowed()||this.currentPosition()+this.state.widthWrap>=this.state.widthContent-(0,i.ensureDefined)(this.props.hideButtonsFrom)}animateTo(e,t=F.dur){
const r=this._scroll.current;r&&((0,O.isRtl)()&&(e=(0,O.getLTRScrollLeftOffset)(r,e)),t<=0?r.scrollLeft=Math.round(e):(0,V.doAnimate)({onStep(e,t){r.scrollLeft=Math.round(t)},from:r.scrollLeft,to:Math.round(e),easing:F.easingFunc.easeInOutCubic,duration:t}))}render(){const{children:i,isVisibleScrollbar:o,isVisibleFade:l,isVisibleButtons:c,shouldMeasure:u,shouldDecreaseWidthContent:d,buttonsWidthIfDecreasedWidthContent:h,onMouseOver:m,onMouseOut:p,scrollWrapClassName:v,fadeClassName:f}=this.props,{isVisibleRightButton:g,isVisibleLeftButton:S}=this.state,b=d&&h;return n.createElement(E.Measure,{onResize:u?this._handleResizeWrap:null},(d=>n.createElement("div",{className:L.wrapOverflow,onMouseOver:m,onMouseOut:p,ref:d},n.createElement("div",{className:a(L.wrap,b?L.wrapWithArrowsOuting:"")},n.createElement("div",{className:a(L.scrollWrap,v,{[L.noScrollBar]:!o}),onScroll:this._handleScroll,ref:this._scroll},n.createElement(E.Measure,{onResize:u?this._handleResizeContent:null},i)),l&&n.createElement(r,{isVisible:S,className:f}),l&&n.createElement(s,{isVisible:g,className:f}),c&&n.createElement(e,{onClick:this._handleScrollLeft,isVisible:S}),c&&n.createElement(t,{onClick:this._handleScrollRight,isVisible:g})))))}_isOverflowed(){const{widthContent:e,widthWrap:t}=this.state;return e>t}}).defaultProps=T,o}(A,D,N,B);var H,q=r(26867);!function(e){e.SymbolSearch="header-toolbar-symbol-search",e.Intervals="header-toolbar-intervals",e.ChartStyles="header-toolbar-chart-styles",e.Compare="header-toolbar-compare",e.Indicators="header-toolbar-indicators",e.StudyTemplates="header-toolbar-study-templates",e.Dropdown="header-toolbar-dropdown",e.Alerts="header-toolbar-alerts",e.Layouts="header-toolbar-layouts",e.SaveLoad="header-toolbar-save-load",e.UndoRedo="header-toolbar-undo-redo",e.Properties="header-toolbar-properties",e.QuickSearch="header-toolbar-quick-search",e.PublishDesktop="header-toolbar-publish-desktop",e.PublishMobile="header-toolbar-publish-mobile",e.Fullscreen="header-toolbar-fullscreen",e.Screenshot="header-toolbar-screenshot",e.TelegramShare="header-toolbar-telegram-share",e.Replay="header-toolbar-replay",e.Financials="header-toolbar-financials"}(H||(H={}));var z=r(70412),G=r(68976),X=r(26981),U=r(38206);const Q=(0,G.registryContextType)(),Y=m.enabled("widget");class j extends n.PureComponent{constructor(e,t){super(e,t),this._handleMouseOver=e=>{(0,z.hoverMouseEventFilter)(e)&&this.setState({isHovered:!0})},this._handleMouseOut=e=>{(0,z.hoverMouseEventFilter)(e)&&this.setState({isHovered:!1})},this._handleInnerResize=([e])=>{const t=e.contentRect.width,{onWidthChange:r}=this.props;r&&r(t)},this._handleMeasureAvailableSpace=e=>{const{onAvailableSpaceChange:t}=this.props;t&&t(e.width)},this._processCustoms=e=>{const{isFake:t,displayMode:r}=this.props,{tools:s}=this.context;return e.map((e=>n.createElement(C,{key:e.id},(e=>{switch(e.type){case"Button":return n.createElement(s.Custom,{...e.params,isFake:t});case"TradingViewStyledButton":return n.createElement(s.CustomTradingViewStyledButton,{...e.params,className:U.button,
displayMode:r});case"Dropdown":return n.createElement(s.Dropdown,{displayMode:r,params:e.params});default:return null}})(e))))},this._fixLastGroup=(e,t,r)=>{if(t===r.length-1&&n.isValidElement(e)&&e.type===C){const t=void 0!==this.context.tools.Publish&&!this.props.readOnly;return n.cloneElement(e,{noRightDecoration:t})}return e},(0,G.validateRegistry)(t,{tools:v.any.isRequired}),this.state={isHovered:!1}}render(){const{tools:e}=this.context,{features:t,displayMode:r,chartSaver:s,studyMarket:i,readOnly:o,saveLoadSyncEmitter:l,leftCustomElements:c,rightCustomElements:u,showScrollbarWhen:d,isFake:h=!1}=this.props,{isHovered:p}=this.state,v=this._processCustoms(c),S=this._processCustoms(u),b=d.includes(r);return n.createElement(X.Toolbar,{className:a(U.inner,{[U.fake]:h}),onContextMenu:q.preventDefaultForContextMenu,"data-is-fake-main-panel":h,"aria-hidden":h},n.createElement(P,{isVisibleFade:f.mobiletouch&&b,isVisibleButtons:!f.mobiletouch&&b&&p,isVisibleScrollbar:!1,shouldMeasure:!h,onMouseOver:this._handleMouseOver,onMouseOut:this._handleMouseOut,onMeasureWrap:this._handleMeasureAvailableSpace},(c=>n.createElement("div",{className:U.content,ref:c,role:"none"},n.createElement(E.Measure,{onResize:h?this._handleInnerResize:null},(c=>n.createElement("div",{className:U.innerWrap,ref:c},n.createElement(g.FragmentMap,{map:this._fixLastGroup},!o&&n.Children.toArray([(e.SymbolSearch||!Y&&e.Compare)&&n.createElement(C,{key:"symbol"},e.SymbolSearch&&n.createElement(e.SymbolSearch,{id:h?void 0:H.SymbolSearch,isActionsVisible:t.allowSymbolSearchSpread}),e.Compare&&n.createElement(e.Compare,{id:h?void 0:H.Compare,className:U.button,displayMode:r})),e.DateRange&&n.createElement(C,{key:"range"},n.createElement(e.DateRange,null)),e.Intervals&&n.createElement(C,{key:"intervals"},n.createElement(e.Intervals,{id:h?void 0:H.Intervals,isShownQuicks:t.allowFavoriting,isFavoritingAllowed:t.allowFavoriting,displayMode:r,isFake:h})),e.Bars&&n.createElement(C,{key:"styles"},n.createElement(e.Bars,{id:h?void 0:H.ChartStyles,isShownQuicks:t.allowFavoriting,isFavoritingAllowed:t.allowFavoriting,displayMode:r,isFake:h})),Y&&e.Compare&&!e.SymbolSearch&&n.createElement(C,{key:"compare"},n.createElement(e.Compare,{id:h?void 0:H.Compare,className:U.button,displayMode:r})),e.Indicators&&n.createElement(C,{key:"indicators"},n.createElement(e.Indicators,{id:h?void 0:H.Indicators,className:U.button,studyMarket:i,displayMode:r}),e.Templates&&n.createElement(e.Templates,{id:h?void 0:H.StudyTemplates,isShownQuicks:t.allowFavoriting,isFavoritingAllowed:t.allowFavoriting,displayMode:r})),e.Alert&&n.createElement(C,{key:"alert"},n.createElement(e.Alert,{id:h?void 0:H.Alerts,className:U.button,displayMode:r}),e.Replay&&n.createElement(e.Replay,{id:h?void 0:H.Replay,className:U.button,displayMode:r})),e.AlertReferral&&!m.enabled("hide_alert_referral_tool")&&n.createElement(C,{key:"alert-referral"},n.createElement(e.AlertReferral,{className:U.button,displayMode:r})),e.ScalePercentage&&n.createElement(C,{key:"percentage"
},n.createElement(e.ScalePercentage,null)),e.ScaleLogarithm&&n.createElement(C,{key:"logarithm"},n.createElement(e.ScaleLogarithm,null)),...v]),function(e){const t=e.findIndex((e=>n.isValidElement(e)&&!!e.key&&-1!==e.key.toString().indexOf("view-only-badge")));return[t].filter((e=>e>=0)).forEach((t=>{e=n.Children.map(e,((e,r)=>{if(n.isValidElement(e)){switch([t-1,t,t+1].indexOf(r)){case 0:const t={noRightDecoration:!0};e=n.cloneElement(e,t);break;case 1:const r={noLeftDecoration:!0,noRightDecoration:!0};e=n.cloneElement(e,r);break;case 2:const s={noLeftDecoration:!0};e=n.cloneElement(e,s)}}return e}))})),e}(n.Children.toArray([o&&n.createElement(C,{key:"view-only-badge",removeSeparator:!0},n.createElement(I,null)),!o&&e.UndoRedo&&n.createElement(C,{key:"undo-redo"},n.createElement(e.UndoRedo,{id:h?void 0:H.UndoRedo})),n.createElement(C,{removeSeparator:!0,key:"gap-1",className:a(U.fill,h&&U.collapse)}),(e.Layout||e.SaveLoad)&&n.createElement(C,{key:"layout",removeSeparator:!0},!o&&e.Layout&&n.createElement(e.Layout,{id:h?void 0:H.Layouts}),e.SaveLoad&&n.createElement(e.SaveLoad,{id:h?void 0:H.SaveLoad,chartSaver:s,isReadOnly:o,displayMode:r,isFake:h,stateSyncEmitter:l})),e.SaveLoadReferral&&n.createElement(C,{key:"save-load-referral"},n.createElement(e.SaveLoadReferral,{isReadOnly:o,displayMode:r})),t.showLaunchInPopupButton&&e.OpenPopup&&!m.enabled("hide_open_popup_button")&&n.createElement(C,{key:"popup"},n.createElement(e.OpenPopup,null)),!o&&(e.Properties||e.Fullscreen||!Y&&e.Screenshot)&&n.createElement(C,{key:"properties"},!o&&e.QuickSearch&&n.createElement(e.QuickSearch,{id:h?void 0:H.QuickSearch,className:U.iconButton}),!o&&e.Properties&&n.createElement(e.Properties,{id:h?void 0:H.Properties,className:U.iconButton}),n.createElement(n.Fragment,null,!o&&e.Fullscreen&&n.createElement(C,{key:"fullscreen",onClick:this._trackFullscreenButtonClick,removeSeparator:!0},n.createElement(e.Fullscreen,{id:h?void 0:H.Fullscreen,clickArea:"top toolbar"})),!Y&&e.Screenshot&&n.createElement(e.Screenshot,{id:h?void 0:H.Screenshot,className:U.iconButton}))),Y&&!o&&e.Fullscreen&&n.createElement(C,{key:"fullscreen",onClick:this._trackFullscreenButtonClick,removeSeparator:!0},n.createElement(e.Fullscreen,{id:h?void 0:H.Fullscreen,clickArea:"top toolbar"})),Y&&e.Screenshot&&n.createElement(C,{key:"screenshot",removeSeparator:!0},n.createElement(e.Screenshot,{id:h?void 0:H.Screenshot,className:U.iconButton})),Y&&!1,!o&&e.Publish&&!m.enabled("hide_publish_button")&&n.createElement(C,{key:"publish",className:U.mobilePublish,removeSeparator:!0},n.createElement(e.Publish,{id:h?void 0:H.PublishMobile})),...S]))))))))),e.Publish&&!o&&!h&&!m.enabled("hide_publish_button")&&n.createElement(e.Publish,{id:H.PublishDesktop,className:U.desktopPublish}))}_trackFullscreenButtonClick(){0}}var K;j.contextType=Q,function(e){e[e.Left=0]="Left",e[e.Self=1]="Self",e[e.Right=2]="Right"}(K||(K={}));var J=r(22613),$=r(67763);class Z extends $.CommonJsonStoreService{constructor(e,t,r=[]){super(e,t,"FAVORITE_CHART_STYLES_CHANGED","StyleWidget.quicks",r)}}
var ee=r(87296),te=r(53470);class re extends $.AbstractJsonStoreService{constructor(e,t,r){super(e,t,"FAVORITE_INTERVALS_CHANGED","IntervalWidget.quicks",r)}_serialize(e){return(0,te.uniq)(e.map(ee.normalizeIntervalString))}_deserialize(e){return(0,te.uniq)((0,ee.convertResolutionsFromSettings)(e).filter(ee.isResolutionMultiplierValid).map(ee.normalizeIntervalString))}}var ne=r(29803),se=r(48096),ie=r(1765),ae=r(21097);class oe extends $.AbstractJsonStoreService{constructor(e,t,r=[]){super(e,t,"CUSTOM_INTERVALS_CHANGED","IntervalWidget.intervals",r)}set(e,t){const r=()=>{super.set(e,t)};e.length,this.get().length,r()}_serialize(e){return(0,te.uniq)(e.map(ee.normalizeIntervalString))}_deserialize(e){return(0,te.uniq)([...(0,ee.convertResolutionsFromSettings)(e).filter(ee.isResolutionMultiplierValid).map(ee.normalizeIntervalString)])}}const le=new oe(ae.TVXWindowEvents,ie);var ce=r(23908);class ue{constructor(e){this._customIntervalsService=le,this._supportedIntervalsMayChange=new se.Delegate,this._fireSupportedIntervalsMayChange=()=>{this._supportedIntervalsMayChange.fire()},this._resolutionGetter=()=>[],this._resolutionGetter=e,ne.linking.supportedResolutions.subscribe(this._fireSupportedIntervalsMayChange),ne.linking.range.subscribe(this._fireSupportedIntervalsMayChange),ne.linking.seconds.subscribe(this._fireSupportedIntervalsMayChange),ne.linking.ticks.subscribe(this._fireSupportedIntervalsMayChange),ne.linking.intraday.subscribe(this._fireSupportedIntervalsMayChange),ne.linking.dataFrequencyResolution.subscribe(this._fireSupportedIntervalsMayChange)}destroy(){ne.linking.supportedResolutions.unsubscribe(this._fireSupportedIntervalsMayChange),ne.linking.range.unsubscribe(this._fireSupportedIntervalsMayChange),ne.linking.seconds.unsubscribe(this._fireSupportedIntervalsMayChange),ne.linking.ticks.unsubscribe(this._fireSupportedIntervalsMayChange),ne.linking.intraday.unsubscribe(this._fireSupportedIntervalsMayChange),ne.linking.dataFrequencyResolution.unsubscribe(this._fireSupportedIntervalsMayChange)}getDefaultIntervals(){return this._resolutionGetter?this._resolutionGetter().map(ee.normalizeIntervalString):[]}getCustomIntervals(){return this._customIntervalsService.get()}add(e,t,r){if(!this.isValidInterval(e,t))return null;const n=(0,ee.normalizeIntervalString)(`${e}${t}`),s=this.getCustomIntervals();return this._isIntervalDefault(n)||s.includes(n)?null:(this._customIntervalsService.set((0,ee.sortResolutions)([...s,n])),n)}remove(e){this._customIntervalsService.set(this.getCustomIntervals().filter((t=>t!==e)))}isValidInterval(e,t){return(0,ee.isResolutionMultiplierValid)(`${e}${t}`)}isSupportedInterval(e){return(0,ee.isAvailable)(e)}supportedIntervalsMayChange(){return this._supportedIntervalsMayChange}getOnChange(){return this._customIntervalsService.getOnChange()}getPossibleIntervals(){return ce.INTERVALS}getResolutionUtils(){return{getMaxResolutionValue:ee.getMaxResolutionValue,getTranslatedResolutionModel:ee.getTranslatedResolutionModel,mergeResolutions:ee.mergeResolutions,sortResolutions:ee.sortResolutions}}
_isIntervalDefault(e){return this.getDefaultIntervals().includes(e)}}var de=r(9753);function he(e){return e.replace(/(@[^-]+-[^-]+).*$/,"$1")}const me={};let pe=null;class ve{constructor(e=ie){this._favorites=[],this._favoritesChanged=new se.Delegate,this._settings=e,ae.TVXWindowEvents.on("StudyFavoritesChanged",(e=>{const t=JSON.parse(e);this._loadFromState(t.favorites||[])})),this._settings.onSync.subscribe(this,this._loadFavs),this._loadFavs()}isFav(e){const t=this.favId(e);return-1!==this._findFavIndex(t)}toggleFavorite(e){this.isFav(e)?this.removeFavorite(e):this.addFavorite(e)}addFavorite(e){const t=this.favId(e);this._favorites.push(ge(t)),this._favoritesChanged.fire(t),this._saveFavs()}removeFavorite(e){const t=this.favId(e),r=this._findFavIndex(t);-1!==r&&(this._favorites.splice(r,1),this._favoritesChanged.fire(t)),this._saveFavs()}favId(e){return he(e)}favorites(){return this._favorites}favoritePineIds(){return this._favorites.filter((e=>"pine"===e.type)).map((e=>e.pineId))}favoritesChanged(){return this._favoritesChanged}static getInstance(){return null===pe&&(pe=new ve),pe}static create(e){return new ve(e)}_loadFavs(){const e=this._settings.getJSON("studyMarket.favorites",[]);this._loadFromState(e)}_saveFavs(){const e=this._stateToSave();this._settings.setJSON("studyMarket.favorites",e,{forceFlush:!0}),ae.TVXWindowEvents.emit("StudyFavoritesChanged",JSON.stringify({favorites:e}))}_stateToSave(){return this._favorites.map(fe)}_loadFromState(e){this._favorites=e.map((e=>ge(function(e){return e in me?me[e]:e}(e)))),this._favoritesChanged.fire()}_findFavIndex(e){return this._favorites.findIndex((t=>e===fe(t)))}}function fe(e){return"java"===e.type?e.studyId:e.pineId}function ge(e){return isPineIdString(e)?{type:"pine",pineId:e}:{type:"java",studyId:e}}var Se=r(46082);const be={[Se.ResolutionKind.Ticks]:!1,[Se.ResolutionKind.Seconds]:!1,[Se.ResolutionKind.Minutes]:!1,[Se.SpecialResolutionKind.Hours]:!1,[Se.ResolutionKind.Days]:!1,[Se.ResolutionKind.Range]:!1};class ye extends $.CommonJsonStoreService{constructor(e,t,r=be){super(e,t,"INTERVALS_MENU_VIEW_STATE_CHANGED","IntervalWidget.menu.viewState",r)}isAllowed(e){return Object.keys(be).includes(e)}}const Ce={Area:3,"HLC area":16,Bars:0,Candles:1,"Heiken Ashi":8,"Hollow Candles":9,Line:2,Renko:4,Kagi:5,"Point & figure":6,"Line Break":7,Baseline:10,LineWithMarkers:14,Stepline:15,Columns:13,"High-low":12},Ee=["1","30","60"];function _e(e=[]){let t=e.map((e=>Ce[e]))||[1,4,5,6];return m.enabled("widget")&&(t=[0,1,3]),t}function we(e=[]){return(0,ee.mergeResolutions)(e,m.enabled("star_some_intervals_by_default")?Ee:[])}new re(ae.TVXWindowEvents,ie,we()),new Z(ae.TVXWindowEvents,ie,_e());const Me={tools:v.any.isRequired,isFundamental:v.any,chartApiInstance:v.any,availableTimeFrames:v.any,chartWidgetCollection:v.any,windowMessageService:v.any,favoriteChartStylesService:v.any,favoriteIntervalsService:v.any,intervalService:v.any,recentStudyTemplatesService:v.any,studyTemplates:v.any,chartChangesWatcher:v.any,saveChartService:v.any,sharingChartService:v.any,
loadChartService:v.any,chartWidget:v.any,favoriteScriptsModel:v.any,intervalsMenuViewStateService:v.any,templatesMenuViewStateService:v.any,openGlobalSearch:v.any,snapshotUrl:v.any};var Re=r(50470),ke=r(98001);const Ie=[];class Ve extends n.PureComponent{constructor(e){super(e),this._saveLoadSyncEmitter=new(c()),this._handleFullWidthChange=e=>{this._fullWidth=e,this.setState({measureValid:!1})},this._handleFavoritesWidthChange=e=>{this._favoritesWidth=e,this.setState({measureValid:!1})},this._handleCollapseWidthChange=e=>{this._collapseWidth=e,this.setState({measureValid:!1})},this._handleMeasure=e=>{this.setState({availableWidth:e,measureValid:!1})};const{tools:t,windowMessageService:r,chartWidgetCollection:n,chartApiInstance:s,availableTimeFrames:a,isFundamental:o,favoriteIntervalsService:l,favoriteChartStylesService:d,recentStudyTemplatesService:h,studyTemplates:p,saveChartService:v,sharingChartService:f,loadChartService:g,snapshotUrl:S,openGlobalSearch:b}=e;this._showScrollbarWhen=(0,i.ensureDefined)(e.allowedModes).slice(-1),this._panelWidthChangeHandlers={full:this._handleFullWidthChange,medium:this._handleFavoritesWidthChange,small:this._handleCollapseWidthChange};const{chartChangesWatcher:y}=e;this._chartChangesWatcher=y;const C=_e(this.props.defaultFavoriteStyles);this._favoriteChartStylesService=d||new Z(ae.TVXWindowEvents,ie,C);const E=we(this.props.defaultFavoriteIntervals);this._favoriteIntervalsService=l||new re(ae.TVXWindowEvents,ie,E),this._intervalsMenuViewStateService=new ye(ae.TVXWindowEvents,ie),this._intervalService=new ue(s.defaultResolutions),this._registry={tools:t,isFundamental:o,chartWidgetCollection:n,windowMessageService:r,chartApiInstance:s,availableTimeFrames:a,recentStudyTemplatesService:h,studyTemplates:p,saveChartService:v,sharingChartService:f,loadChartService:g,intervalsMenuViewStateService:this._intervalsMenuViewStateService,favoriteChartStylesService:this._favoriteChartStylesService,favoriteIntervalsService:this._favoriteIntervalsService,intervalService:this._intervalService,chartChangesWatcher:this._chartChangesWatcher,chartWidget:n.activeChartWidget.value(),favoriteScriptsModel:ve.getInstance(),templatesMenuViewStateService:this._templatesMenuVuewStateService,snapshotUrl:S,openGlobalSearch:b},this.state={isVisible:!0,availableWidth:0,displayMode:"full",measureValid:!1,leftCustomElements:[],rightCustomElements:[]},this._readOnly=n.readOnly(),this._features={allowFavoriting:m.enabled("items_favoriting"),showIdeasButton:Boolean(this.props.ideas),showLaunchInPopupButton:Boolean(this.props.popupButton),allowSymbolSearchSpread:m.enabled("header_symbol_search")&&m.enabled("show_spread_operators"),allowToolbarHiding:m.enabled("collapsible_header")},this._setDisplayMode=(0,u.default)(this._setDisplayMode,100),this._negotiateResizer()}componentDidUpdate(e,t){const{isVisible:r,measureValid:n}=this.state;r!==t.isVisible&&(p.emit("toggle_header",r),this._negotiateResizer()),n||this._setDisplayMode()}render(){
const{resizerBridge:e,allowedModes:t,...r}=this.props,{displayMode:s,isVisible:o,leftCustomElements:l,rightCustomElements:c}=this.state,u={features:this._features,readOnly:this._readOnly,isFake:!1,saveLoadSyncEmitter:this._saveLoadSyncEmitter,leftCustomElements:l,rightCustomElements:c,...r},d={...u,isFake:!0,showScrollbarWhen:Ie},h=(0,i.ensureDefined)(t),m=this.props.tools.PublishButtonManager||n.Fragment;return n.createElement(G.RegistryProvider,{value:this._registry,validation:Me},n.createElement(m,null,n.createElement("div",{className:a(ke.toolbar,{[ke.isHidden]:!o}),onClick:this.props.onClick},n.createElement("div",{className:ke.overflowWrap},h.map((e=>n.createElement(j,{key:e,displayMode:e,onWidthChange:this._panelWidthChangeHandlers[e],...d}))),n.createElement(j,{key:"live",showScrollbarWhen:this._showScrollbarWhen,displayMode:s,onAvailableSpaceChange:this._handleMeasure,...u})))))}addButton(e,t){if(!t.useTradingViewStyle)return this._addCustomHTMLButton(e,t.align);this._addCustomTradingViewStyledButton(e,t)}removeButton(e){const{leftCustomElements:t,rightCustomElements:r}=this.state;if((0,d.default)(e))this._removeCustomElementToState(e);else{const n=t=>"element"in t.params&&t.params.element===e,s=t.find(n)?.id??r.find(n)?.id;(0,h.default)(s)||this._removeCustomElementToState(s)}}addDropdown(e,t){const{leftCustomElements:r,rightCustomElements:n}=this.state,s={type:"Dropdown",id:e,params:t};"left"===t.align?this.setState({leftCustomElements:[...r,s]}):this.setState({rightCustomElements:[...n,s]})}updateDropdown(e,t){const r=t=>"Dropdown"===t.type&&t.id===e,n=this.state.leftCustomElements.find(r)||this.state.rightCustomElements.find(r);void 0!==n&&(n.params={...n.params,...t},this.setState({leftCustomElements:this.state.leftCustomElements.slice(),rightCustomElements:this.state.rightCustomElements.slice()}))}removeDropdown(e){const t=t=>"Dropdown"===t.type&&t.id!==e,r=this.state.leftCustomElements.filter(t),n=this.state.rightCustomElements.filter(t);this.setState({leftCustomElements:r,rightCustomElements:n})}_negotiateResizer(){this.props.resizerBridge.negotiateHeight(this.state.isVisible?de.HEADER_TOOLBAR_HEIGHT_EXPANDED:de.HEADER_TOOLBAR_HEIGHT_COLLAPSED)}_setDisplayMode(){const{availableWidth:e}=this.state,{allowedModes:t}=this.props,r={full:this._fullWidth,medium:this._favoritesWidth,small:this._collapseWidth},n=(0,i.ensureDefined)(t);let s=n.map((e=>r[e])).findIndex((t=>e>=t));-1===s&&(s=n.length-1);const a=n[s];this.setState({measureValid:!0,displayMode:a})}_addCustomHTMLButton(e,t="left"){const r=new J.WatchedValue(0),n=(0,Re.parseHtmlElement)(`<div class="apply-common-tooltip ${ke.customButton}">`),s={type:"Button",id:e,params:{key:Number(new Date),element:n,width:r}};return this._addCustomElementToState(t,s),n}_addCustomTradingViewStyledButton(e,t){const r={type:"TradingViewStyledButton",id:e,params:{key:Number(new Date),text:t.text,title:t.title,onClick:t.onClick}};this._addCustomElementToState(t.align,r)}_addCustomElementToState(e,t){const{leftCustomElements:r,rightCustomElements:n}=this.state
;"left"===e?this.setState({leftCustomElements:[...r,t]}):this.setState({rightCustomElements:[...n,t]})}_removeCustomElementToState(e){this.setState({leftCustomElements:this.state.leftCustomElements.filter((t=>t.id!==e)),rightCustomElements:this.state.rightCustomElements.filter((t=>t.id!==e))})}}Ve.defaultProps={allowedModes:["full","medium"]};class Fe{constructor(e,t){this._component=null,this._handleRef=e=>{this._component=e},this._container=e,s.render(n.createElement(Ve,{...t,ref:this._handleRef}),this._container)}destroy(){s.unmountComponentAtNode(this._container)}getComponent(){return(0,i.ensureNotNull)(this._component)}}},68976:(e,t,r)=>{"use strict";r.d(t,{RegistryProvider:()=>l,registryContextType:()=>c,validateRegistry:()=>o});var n=r(50959),s=r(19036),i=r.n(s);const a=n.createContext({});function o(e,t){i().checkPropTypes(t,e,"context","RegistryContext")}function l(e){const{validation:t,value:r}=e;return o(r,t),n.createElement(a.Provider,{value:r},e.children)}function c(){return a}},61380:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 10" width="20" height="10"><path fill="none" stroke="currentColor" stroke-width="1.5" d="M2 1l8 8 8-8"/></svg>'},45820:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28"><path fill="currentColor" fill-rule="evenodd" d="M4.56 14a10.05 10.05 0 00.52.91c.41.69 1.04 1.6 1.85 2.5C8.58 19.25 10.95 21 14 21c3.05 0 5.42-1.76 7.07-3.58A17.18 17.18 0 0023.44 14a9.47 9.47 0 00-.52-.91c-.41-.69-1.04-1.6-1.85-2.5C19.42 8.75 17.05 7 14 7c-3.05 0-5.42 1.76-7.07 3.58A17.18 17.18 0 004.56 14zM24 14l.45-.21-.01-.03a7.03 7.03 0 00-.16-.32c-.11-.2-.28-.51-.5-.87-.44-.72-1.1-1.69-1.97-2.65C20.08 7.99 17.45 6 14 6c-3.45 0-6.08 2-7.8 3.92a18.18 18.18 0 00-2.64 3.84v.02h-.01L4 14l-.45-.21-.1.21.1.21L4 14l-.45.21.01.03a5.85 5.85 0 00.16.32c.11.2.28.51.5.87.44.72 1.1 1.69 1.97 2.65C7.92 20.01 10.55 22 14 22c3.45 0 6.08-2 7.8-3.92a18.18 18.18 0 002.64-3.84v-.02h.01L24 14zm0 0l.45.21.1-.21-.1-.21L24 14zm-10-3a3 3 0 100 6 3 3 0 000-6zm-4 3a4 4 0 118 0 4 4 0 01-8 0z"/></svg>'}}]);