(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[5093],{11985:e=>{e.exports={pills:"pills-PVWoXu5j",primary:"primary-PVWoXu5j",gray:"gray-PVWoXu5j",selected:"selected-PVWoXu5j",grouped:"grouped-PVWoXu5j",active:"active-PVWoXu5j",disableActiveOnTouch:"disableActiveOnTouch-PVWoXu5j",disableActiveStateStyles:"disableActiveStateStyles-PVWoXu5j",withGrouped:"withGrouped-PVWoXu5j","quiet-primary":"quiet-primary-PVWoXu5j",green:"green-PVWoXu5j",red:"red-PVWoXu5j",blue:"blue-PVWoXu5j",secondary:"secondary-PVWoXu5j",ghost:"ghost-PVWoXu5j"}},78457:e=>{e.exports={lightButton:"lightButton-bYDQcOkp",link:"link-bYDQcOkp",ltr:"ltr-bYDQcOkp",rtl:"rtl-bYDQcOkp","typography-regular16px":"typography-regular16px-bYDQcOkp","typography-medium16px":"typography-medium16px-bYDQcOkp","typography-regular14px":"typography-regular14px-bYDQcOkp","typography-semibold14px":"typography-semibold14px-bYDQcOkp","typography-semibold16px":"typography-semibold16px-bYDQcOkp",content:"content-bYDQcOkp",visuallyHidden:"visuallyHidden-bYDQcOkp",nowrap:"nowrap-bYDQcOkp",ellipsisContainer:"ellipsisContainer-bYDQcOkp",textWrapContainer:"textWrapContainer-bYDQcOkp",textWrapWithEllipsis:"textWrapWithEllipsis-bYDQcOkp",slot:"slot-bYDQcOkp",caret:"caret-bYDQcOkp",activeCaret:"activeCaret-bYDQcOkp",xsmall:"xsmall-bYDQcOkp",withStartSlot:"withStartSlot-bYDQcOkp",withEndSlot:"withEndSlot-bYDQcOkp",noContent:"noContent-bYDQcOkp",wrap:"wrap-bYDQcOkp",small:"small-bYDQcOkp",medium:"medium-bYDQcOkp"}},70168:e=>{e.exports={button:"button-D4RPB3ZC",iconOnly:"iconOnly-D4RPB3ZC",withStartSlot:"withStartSlot-D4RPB3ZC",withEndSlot:"withEndSlot-D4RPB3ZC",startSlotWrap:"startSlotWrap-D4RPB3ZC",endSlotWrap:"endSlotWrap-D4RPB3ZC",xsmall:"xsmall-D4RPB3ZC",small:"small-D4RPB3ZC",medium:"medium-D4RPB3ZC",large:"large-D4RPB3ZC",xlarge:"xlarge-D4RPB3ZC",content:"content-D4RPB3ZC",link:"link-D4RPB3ZC",blue:"blue-D4RPB3ZC",primary:"primary-D4RPB3ZC",secondary:"secondary-D4RPB3ZC",gray:"gray-D4RPB3ZC",green:"green-D4RPB3ZC",red:"red-D4RPB3ZC",black:"black-D4RPB3ZC",slot:"slot-D4RPB3ZC",stretch:"stretch-D4RPB3ZC",grouped:"grouped-D4RPB3ZC",adjustPosition:"adjustPosition-D4RPB3ZC",firstRow:"firstRow-D4RPB3ZC",firstCol:"firstCol-D4RPB3ZC","no-corner-top-left":"no-corner-top-left-D4RPB3ZC","no-corner-top-right":"no-corner-top-right-D4RPB3ZC","no-corner-bottom-right":"no-corner-bottom-right-D4RPB3ZC","no-corner-bottom-left":"no-corner-bottom-left-D4RPB3ZC",textWrap:"textWrap-D4RPB3ZC",multilineContent:"multilineContent-D4RPB3ZC",primaryText:"primaryText-D4RPB3ZC",secondaryText:"secondaryText-D4RPB3ZC"}},37643:e=>{e.exports={pair:"pair-ocURKVwI",xxceptionallysmalldonotusebrv1023:"xxceptionallysmalldonotusebrv1023-ocURKVwI",xxxxsmall:"xxxxsmall-ocURKVwI",xxxsmall:"xxxsmall-ocURKVwI",xxsmall:"xxsmall-ocURKVwI",xsmall:"xsmall-ocURKVwI",small:"small-ocURKVwI",medium:"medium-ocURKVwI",large:"large-ocURKVwI",xlarge:"xlarge-ocURKVwI",xxlarge:"xxlarge-ocURKVwI",xxxlarge:"xxxlarge-ocURKVwI",logo:"logo-ocURKVwI",skeleton:"skeleton-ocURKVwI",empty:"empty-ocURKVwI"}},57554:e=>{ e.exports={logo:"logo-PsAlMQQF",hidden:"hidden-PsAlMQQF",xxceptionallysmalldonotusebrv1023:"xxceptionallysmalldonotusebrv1023-PsAlMQQF",xxxsmall:"xxxsmall-PsAlMQQF",xxsmall:"xxsmall-PsAlMQQF",xsmall:"xsmall-PsAlMQQF",small:"small-PsAlMQQF",medium:"medium-PsAlMQQF",large:"large-PsAlMQQF",xlarge:"xlarge-PsAlMQQF",xxlarge:"xxlarge-PsAlMQQF",xxxlarge:"xxxlarge-PsAlMQQF",skeleton:"skeleton-PsAlMQQF",letter:"letter-PsAlMQQF"}},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"}},77565:e=>{e.exports={crop:"crop-KgzMMF6Z",flex:"flex-KgzMMF6Z",mobileStretch:"mobileStretch-KgzMMF6Z",allowShrinkWidth:"allowShrinkWidth-KgzMMF6Z",notAllowShrinkWidth:"notAllowShrinkWidth-KgzMMF6Z",fixedHeader:"fixedHeader-KgzMMF6Z",fixedFooter:"fixedFooter-KgzMMF6Z",mainScrollWrapper:"mainScrollWrapper-KgzMMF6Z",fixedHeaderContent:"fixedHeaderContent-KgzMMF6Z",fixedFooterContent:"fixedFooterContent-KgzMMF6Z",noScroll:"noScroll-KgzMMF6Z",main:"main-KgzMMF6Z",mainContent:"mainContent-KgzMMF6Z",scrollContainer:"scrollContainer-KgzMMF6Z"}},26995:e=>{e.exports={mobileContext:"mobileContext-x9awd7HO",anchorContext:"anchorContext-x9awd7HO"}},60855:e=>{e.exports={contentDefaultAppearanceMobile:"contentDefaultAppearanceMobile-ODkmI6nR",contentDefaultAppearance:"contentDefaultAppearance-ODkmI6nR",begin:"begin-ODkmI6nR",end:"end-ODkmI6nR",top:"top-ODkmI6nR",bottom:"bottom-ODkmI6nR"}},61790:e=>{e.exports={content:"content-sCtoIJXr",stretch:"stretch-sCtoIJXr",begin:"begin-sCtoIJXr",end:"end-sCtoIJXr",top:"top-sCtoIJXr",bottom:"bottom-sCtoIJXr",backdrop:"backdrop-sCtoIJXr"}},94030:e=>{e.exports={scrollTrap:"scrollTrap-cUlsSss_",scrollTrapContent:"scrollTrapContent-cUlsSss_"}},16313:e=>{e.exports={wrapper:"wrapper-TJ9ObuLF",animated:"animated-TJ9ObuLF",pulsation:"pulsation-TJ9ObuLF"}},42177:e=>{e.exports={bodyNoScroll:"bodyNoScroll-bUGsvF2L"}},27011:(e,t,s)=>{"use strict";function i(e,t){return t||null==e||("string"==typeof e||Array.isArray(e))&&0===e.length}s.d(t,{isIconOnly:()=>i})},8025:(e,t,s)=>{"use strict";s.d(t,{useLightButtonClasses:()=>u});var i=s(50959),l=s(97754),o=s.n(l),a=s(17946),n=s(27011),r=s(86332);const d=i.createContext({isInButtonGroup:!1,isGroupPrimary:!1}),u=(e,t,s)=>{const l=(0,i.useContext)(a.CustomBehaviourContext),{className:u,isSelected:c,children:h,showCaret:p,forceDirection:_,iconOnly:m,color:g="gray",variant:b="primary",size:v="medium",enableActiveStateStyles:S=l.enableActiveStateStyles,typography:w,isLink:y=!1,textWrap:f,isPills:C,isActive:M,startSlot:E,endSlot:V}=t,x=e[`typography-${((e,t,s)=>{if(s){const e=s.replace(/^\D+/g,"");return t?`semibold${e}`:s}switch(e){case"xsmall":return t?"semibold14px":"regular14px";case"small":case"medium":return t?"semibold16px":"regular16px";default:return""}})(v,c||C,w||void 0)}`],W=(0,i.useContext)(r.ControlGroupContext),{isInButtonGroup:L,isGroupPrimary:A}=(0, i.useContext)(d);return o()(u,e.lightButton,y&&e.link,M&&e.active,c&&e.selected,(0,n.isIconOnly)(h,m)&&e.noContent,!!E&&e.withStartSlot,(p||!!V)&&e.withEndSlot,s&&e.withGrouped,_&&e[_],e[A?"primary":b],e[A?"gray":g],e[v],x,!S&&e.disableActiveStateStyles,W.isGrouped&&e.grouped,f&&e.wrap,L&&e.disableActiveOnTouch,C&&e.pills)}},66860:(e,t,s)=>{"use strict";s.d(t,{LightButtonContent:()=>_});var i=s(50959),l=s(97754),o=s.n(l),a=s(34094),n=s(27011),r=s(9745),d=s(2948),u=s.n(d),c=s(78457),h=s.n(c);const p=e=>i.createElement(r.Icon,{className:o()(h().caret,e&&h().activeCaret),icon:u()});function _(e){const{showCaret:t,iconOnly:s,ellipsis:l=!0,textWrap:r,tooltipText:d,children:u,endSlot:c,startSlot:_,isActiveCaret:m}=e;[c,t].filter((e=>!!e));return i.createElement(i.Fragment,null,_&&i.createElement("span",{className:o()(h().slot,h().startSlot)},_),!(0,n.isIconOnly)(u,s)&&i.createElement("span",{className:o()(h().content,!r&&h().nowrap,"apply-overflow-tooltip","apply-overflow-tooltip--check-children-recursively","apply-overflow-tooltip--allow-text"),"data-overflow-tooltip-text":d??(0,a.getTextForTooltip)(u)},r||l?i.createElement(i.Fragment,null,i.createElement("span",{className:o()(!r&&l&&h().ellipsisContainer,r&&h().textWrapContainer,r&&l&&h().textWrapWithEllipsis)},u),i.createElement("span",{className:h().visuallyHidden,"aria-hidden":!0},u)):i.createElement(i.Fragment,null,u,i.createElement("span",{className:h().visuallyHidden,"aria-hidden":!0},u))),c&&i.createElement("span",{className:o()(h().slot,h().endSlot)},c),t&&p(m))}},15893:(e,t,s)=>{"use strict";s.d(t,{LightButton:()=>c});var i=s(50959),l=s(86332),o=s(8025),a=s(66860),n=s(78457),r=s.n(n),d=s(11985),u=s.n(d);function c(e){const{isGrouped:t}=i.useContext(l.ControlGroupContext),{reference:s,className:n,isSelected:d,children:c,iconOnly:h,ellipsis:p,showCaret:_,forceDirection:m,endSlot:g,startSlot:b,color:v,variant:S,size:w,enableActiveStateStyles:y,typography:f,textWrap:C=!1,maxLines:M,style:E={},isPills:V,isActive:x,tooltipText:W,role:L,...A}=e,k=C?M??2:1,T=k>0?{...E,"--ui-lib-light-button-content-max-lines":k}:E;return i.createElement("button",{...A,className:(0,o.useLightButtonClasses)({...u(),...r()},{className:n,isSelected:d,children:c,iconOnly:h,showCaret:_,forceDirection:m,endSlot:g,startSlot:b,color:v,variant:S,size:w,enableActiveStateStyles:y,typography:f,textWrap:C,isPills:V,isActive:x},t),ref:s,style:T,role:L},i.createElement(a.LightButtonContent,{showCaret:_,isActiveCaret:_&&(V||x||d),iconOnly:h,ellipsis:p,textWrap:C,tooltipText:W,endSlot:g,startSlot:b},c))}},43814:(e,t,s)=>{"use strict";s.d(t,{SquareButton:()=>b});var i=s(50959),l=s(97754),o=s.n(l),a=s(95604),n=s(70168),r=s.n(n);const d="apply-overflow-tooltip apply-overflow-tooltip--check-children-recursively apply-overflow-tooltip--allow-text apply-common-tooltip";function u(e){ const{size:t="medium",variant:s="primary",color:i="brand",stretch:l=!1,startSlot:n,endSlot:u,iconOnly:c=!1,className:h,isGrouped:p,cellState:_,disablePositionAdjustment:m=!1,primaryText:g,secondaryText:b,isAnchor:v=!1}=e,S="brand"===i?"black":i,w=function(e){let t="";return 0!==e&&(1&e&&(t=o()(t,r()["no-corner-top-left"])),2&e&&(t=o()(t,r()["no-corner-top-right"])),4&e&&(t=o()(t,r()["no-corner-bottom-right"])),8&e&&(t=o()(t,r()["no-corner-bottom-left"]))),t}((0,a.getGroupCellRemoveRoundBorders)(_)),y=c&&(n||u);return o()(h,r().button,r()[t],r()[S],r()[s],l&&r().stretch,n&&r().withStartIcon,u&&r().withEndIcon,y&&r().iconOnly,w,p&&r().grouped,p&&!m&&r().adjustPosition,p&&_.isTop&&r().firstRow,p&&_.isLeft&&r().firstCol,g&&b&&r().multilineContent,v&&r().link,d)}function c(e){const{startSlot:t,iconOnly:s,children:l,endSlot:a,primaryText:n,secondaryText:u}=e;if(t&&a&&s)return i.createElement("span",{className:o()(r().slot,r().startSlotWrap)},t);const c=s&&(t??a),h=!t&&!a&&!s&&!l&&n&&u;return i.createElement(i.Fragment,null,t&&i.createElement("span",{className:o()(r().slot,r().startSlotWrap)},t),l&&!c&&i.createElement("span",{className:r().content},l),a&&i.createElement("span",{className:o()(r().slot,r().endSlotWrap)},a),h&&!c&&function(e){return e.primaryText&&e.secondaryText&&i.createElement("div",{className:o()(r().textWrap,d)},i.createElement("span",{className:r().primaryText}," ",e.primaryText," "),"string"==typeof e.secondaryText?i.createElement("span",{className:r().secondaryText}," ",e.secondaryText," "):i.createElement("span",{className:r().secondaryText},i.createElement("span",null,e.secondaryText.firstLine),i.createElement("span",null,e.secondaryText.secondLine)))}(e))}var h=s(34094),p=s(86332),_=s(90186);function m(e,t){return s=>{if(t)return s.preventDefault(),void s.stopPropagation();e?.(s)}}function g(e){const{className:t,color:s,variant:i,size:l,stretch:o,iconOnly:a,startSlot:n,endSlot:r,primaryText:d,secondaryText:u,...c}=e;return{...c,...(0,_.filterDataProps)(e),...(0,_.filterAriaProps)(e)}}function b(e){const{reference:t,tooltipText:s,disabled:l,onClick:o,onMouseOver:a,onMouseOut:n,onMouseDown:r,onMouseEnter:d,"aria-disabled":_,...b}=e,{isGrouped:v,cellState:S,disablePositionAdjustment:w}=(0,i.useContext)(p.ControlGroupContext),y=u({...b,isGrouped:v,cellState:S,disablePositionAdjustment:w}),f=s??(e.primaryText?[e.primaryText,e.secondaryText].join(" "):(0,h.getTextForTooltip)(e.children));return i.createElement("button",{...g(b),"aria-disabled":l||_,tabIndex:e.tabIndex??(l?-1:0),className:y,ref:t,onClick:m(o,l),onMouseDown:m(r,l),onMouseOver:m(a,l),onMouseOut:m(n,l),onMouseEnter:m(d,l),"data-overflow-tooltip-text":f},i.createElement(c,{...b}))}s(49406)},49406:(e,t,s)=>{"use strict";var i,l,o,a;!function(e){e.Primary="primary",e.QuietPrimary="quiet-primary",e.Secondary="secondary",e.Ghost="ghost"}(i||(i={})),function(e){e.XXSmall="xxsmall",e.XSmall="xsmall",e.Small="small",e.Medium="medium",e.Large="large",e.XLarge="xlarge",e.XXLarge="xxlarge"}(l||(l={})),function(e){e.Brand="brand",e.Blue="blue", e.Gray="gray",e.LightGray="light-gray",e.Green="green",e.Red="red",e.Black="black",e.Gradient="gradient",e.BlackFriday="black-friday",e.CyberMonday="cyber-monday",e.Coupon="coupon",e.Offer="offer",e.Space="space"}(o||(o={})),function(e){e.Semibold18px="semibold18px",e.Semibold16px="semibold16px",e.Semibold14px="semibold14px",e.Medium16px="medium16px",e.Regular16px="regular16px",e.Regular14px="regular14px",e.Regular12px="regular12px"}(a||(a={}))},53885:(e,t,s)=>{"use strict";s.d(t,{getStyleClasses:()=>r,isCircleLogoWithUrlProps:()=>d});var i=s(97754),l=s.n(i),o=s(52292),a=s(57554),n=s.n(a);function r(e,t=2,s){return l()(n().logo,n()[e],s,0===t||1===t?l()(o.skeletonTheme.wrapper,n().skeleton):n().letter,1===t&&o.skeletonTheme.animated)}function d(e){return"logoUrl"in e&&null!==e.logoUrl&&void 0!==e.logoUrl&&0!==e.logoUrl.length}},86332:(e,t,s)=>{"use strict";s.d(t,{ControlGroupContext:()=>i});const i=s(50959).createContext({isGrouped:!1,cellState:{isTop:!0,isRight:!0,isBottom:!0,isLeft:!0}})},95604:(e,t,s)=>{"use strict";function i(e){let t=0;return e.isTop&&e.isLeft||(t+=1),e.isTop&&e.isRight||(t+=2),e.isBottom&&e.isLeft||(t+=8),e.isBottom&&e.isRight||(t+=4),t}s.d(t,{getGroupCellRemoveRoundBorders:()=>i})},86866:(e,t,s)=>{"use strict";s.d(t,{useIsNonFirstRender:()=>l});var i=s(50959);function l(){return!function(){const[e,t]=(0,i.useState)(!0);return(0,i.useEffect)((()=>{t(!1)}),[]),e}()}},39416:(e,t,s)=>{"use strict";s.d(t,{useFunctionalRefObject:()=>o});var i=s(50959),l=s(43010);function o(e){const t=(0,i.useMemo)((()=>function(e){const t=s=>{e(s),t.current=s};return t.current=null,t}((e=>{n.current(e)}))),[]),s=(0,i.useRef)(null),o=t=>{if(null===t)return a(s.current,t),void(s.current=null);s.current!==e&&(s.current=e,a(s.current,t))},n=(0,i.useRef)(o);return n.current=o,(0,l.useIsomorphicLayoutEffect)((()=>{if(null!==t.current)return n.current(t.current),()=>n.current(null)}),[e]),t}function a(e,t){null!==e&&("function"==typeof e?e(t):e.current=t)}},86781:(e,t,s)=>{"use strict";s.d(t,{useMatchMedia:()=>o,useSafeMatchMedia:()=>l});var i=s(50959);function l(e,t=!1){const[s,l]=(0,i.useState)(t);return(0,i.useEffect)((()=>{const t=window.matchMedia(e);function s(){l(t.matches)}return s(),t.addEventListener("change",s),()=>{t.removeEventListener("change",s)}}),[e]),s}function o(e){const t=(0,i.useMemo)((()=>window.matchMedia(e).matches),[]);return l(e,t)}},38528:(e,t,s)=>{"use strict";s.d(t,{useMergedRefs:()=>o});var i=s(50959),l=s(53017);function o(e){return(0,i.useCallback)((0,l.mergeRefs)(e),e)}},67842:(e,t,s)=>{"use strict";s.d(t,{useResizeObserver:()=>a});var i=s(50959),l=s(43010),o=s(39416);function a(e,t=[]){const{callback:s,ref:a=null}=function(e){return"function"==typeof e?{callback:e}:e}(e),n=(0,i.useRef)(null),r=(0,i.useRef)(s);r.current=s;const d=(0,o.useFunctionalRefObject)(a),u=(0,i.useCallback)((e=>{d(e),null!==n.current&&(n.current.disconnect(),null!==e&&n.current.observe(e))}),[d,n]);return(0,l.useIsomorphicLayoutEffect)((()=>(n.current=new ResizeObserver(((e,t)=>{r.current(e,t)})), d.current&&u(d.current),()=>{n.current?.disconnect()})),[d,...t]),u}},26996:(e,t,s)=>{"use strict";s.d(t,{Loader:()=>d});var i,l=s(50959),o=s(97754),a=s.n(o),n=s(49107),r=s.n(n);function d(e){const{className:t,size:s="medium",staticPosition:i,color:o="black"}=e,n=a()(r().item,r()[o],r()[s]);return l.createElement("span",{className:a()(r().loader,i&&r().static,t)},l.createElement("span",{className:n}),l.createElement("span",{className:n}),l.createElement("span",{className:n}))}!function(e){e.Medium="medium",e.Small="small"}(i||(i={}))},52292:(e,t,s)=>{"use strict";s.d(t,{skeletonTheme:()=>l});var i=s(16313);const l=s.n(i)()},34094:(e,t,s)=>{"use strict";s.d(t,{getTextForTooltip:()=>a});var i=s(50959);const l=e=>(0,i.isValidElement)(e)&&Boolean(e.props.children),o=(e,t=!0)=>null==e||"boolean"==typeof e||"{}"===JSON.stringify(e)?"":e.toString()+(t?" ":""),a=e=>Array.isArray(e)||(0,i.isValidElement)(e)?i.Children.toArray(e).reduce(((e,t)=>{let s="";return s=(0,i.isValidElement)(t)&&l(t)?a(t.props.children):(0,i.isValidElement)(t)&&!l(t)?"":o(t),e.concat(s)}),"").trim():o(e,!1)},53017:(e,t,s)=>{"use strict";function i(e){return t=>{e.forEach((e=>{"function"==typeof e?e(t):null!=e&&(e.current=t)}))}}function l(e){return i([e])}s.d(t,{isomorphicRef:()=>l,mergeRefs:()=>i})},43576:(e,t,s)=>{"use strict";s.d(t,{usePromise:()=>o});var i=s(50959),l=s(95406);function o(e,t,s){const[o,a]=(0,i.useState)(null);return(0,i.useEffect)((()=>{const s=new AbortController;let i=null;return(0,l.respectAbort)(s.signal,e()).then((e=>a(i=e))).catch(l.skipAbortError),()=>{s.abort(),i&&t&&t(i)}}),s?[...s]:void 0),o}},26559:(e,t,s)=>{"use strict";s.d(t,{useWatchedValueReadonly:()=>i.useWatchedValueReadonly});var i=s(77975)},82708:(e,t,s)=>{"use strict";s.d(t,{safeShortName:()=>l});var i=s(59149);function l(e){try{return(0,i.shortName)(e)}catch(t){return e}}},618:(e,t,s)=>{"use strict";s.d(t,{removeUsdFromCryptoPairLogos:()=>a,resolveLogoUrls:()=>o});var i=s(36279);const l=(0,i.getLogoUrlResolver)();function o(e,t=i.LogoSize.Medium){const s=e.logoid,o=e["base-currency-logoid"],a=e["currency-logoid"],n=s&&l.getSymbolLogoUrl(s,t);if(n)return[n];const r=o&&l.getSymbolLogoUrl(o,t),d=a&&l.getSymbolLogoUrl(a,t);return r&&d?[r,d]:r?[r]:d?[d]:[]}function a(e){return 2!==e.length?e:function(e){return e.some((e=>n(e)))}(e)&&!function(e){return e.some((e=>e.includes("country")&&!n(e)))}(e)?e.filter((e=>!n(e))):e}function n(e){return!1}},39330:(e,t,s)=>{"use strict";s.d(t,{getBlockStyleClasses:()=>r,getLogoStyleClasses:()=>d});var i=s(97754),l=s.n(i),o=s(52292),a=s(37643),n=s.n(a);function r(e,t){return l()(n().pair,n()[e],t)}function d(e,t=2,s=!0){return l()(n().logo,n()[e],n().skeleton,o.skeletonTheme.wrapper,!s&&n().empty,1===t&&l()(o.skeletonTheme.animated))}},59695:(e,t,s)=>{"use strict";s.d(t,{CircleLogo:()=>n,hiddenCircleLogoClass:()=>a});var i=s(50959),l=s(53885),o=s(57554);const a=s.n(o)().hidden;function n(e){const t=(0,l.isCircleLogoWithUrlProps)(e),[s,o]=(0,i.useState)(0),a=(0,i.useRef)(null),n=(0, l.getStyleClasses)(e.size,s,e.className),r=e.alt??e.title??"",d=t?r[0]:e.placeholderLetter;return(0,i.useEffect)((()=>o(a.current?.complete??!t?2:1)),[t]),t&&3!==s?i.createElement("img",{ref:a,className:n,crossOrigin:"",src:e.logoUrl,alt:r,title:e.title,loading:e.loading,onLoad:()=>o(2),onError:()=>o(3),"aria-label":e["aria-label"],"aria-hidden":e["aria-hidden"]}):i.createElement("span",{className:n,title:e.title,"aria-label":e["aria-label"],"aria-hidden":e["aria-hidden"]},d)}},58492:(e,t,s)=>{"use strict";s.d(t,{getStyleClasses:()=>i.getStyleClasses});var i=s(53885)},40173:(e,t,s)=>{"use strict";function i(e,t,s={}){return Object.assign({},e,function(e,t,s={}){const i=Object.assign({},t);for(const l of Object.keys(t)){const o=s[l]||l;o in e&&(i[l]=[e[o],t[l]].join(" "))}return i}(e,t,s))}s.d(t,{mergeThemes:()=>i})},34359:e=>{e.exports={}},72206:e=>{e.exports={marginlegendhoriz:"4px",legend:"legend-l31H9iuA",legend_withHiddenActions:"legend_withHiddenActions-l31H9iuA",item:"item-l31H9iuA",hideInvisibleHover:"hideInvisibleHover-l31H9iuA",button:"button-l31H9iuA",buttons:"buttons-l31H9iuA",withAction:"withAction-l31H9iuA",selected:"selected-l31H9iuA",last:"last-l31H9iuA",statusesWrapper:"statusesWrapper-l31H9iuA",statusesWrapper__statuses:"statusesWrapper__statuses-l31H9iuA",text:"text-l31H9iuA",noWrapWrapper:"noWrapWrapper-l31H9iuA",noWrap:"noWrap-l31H9iuA",series:"series-l31H9iuA",valuesAdditionalWrapper:"valuesAdditionalWrapper-l31H9iuA",valueItem:"valueItem-l31H9iuA",valueTitle:"valueTitle-l31H9iuA",valueValue:"valueValue-l31H9iuA",hideUniportantValueItems:"hideUniportantValueItems-l31H9iuA",unimportant:"unimportant-l31H9iuA",valuesWrapper:"valuesWrapper-l31H9iuA",wrappable:"wrappable-l31H9iuA",directionColumn:"directionColumn-l31H9iuA",titlesWrapper:"titlesWrapper-l31H9iuA",logoWrapper:"logoWrapper-l31H9iuA",buttonsWrapper:"buttonsWrapper-l31H9iuA",pairContainer:"pairContainer-l31H9iuA",logo:"logo-l31H9iuA",hidden:"hidden-l31H9iuA",noActions:"noActions-l31H9iuA",titlesGroupWrapper:"titlesGroupWrapper-l31H9iuA",titleWrapper:"titleWrapper-l31H9iuA",title:"title-l31H9iuA",withDot:"withDot-l31H9iuA",accessible:"accessible-l31H9iuA",disabled:"disabled-l31H9iuA",disabledOnInterval:"disabledOnInterval-l31H9iuA",withCustomTextColor:"withCustomTextColor-l31H9iuA",study:"study-l31H9iuA",mainTitle:"mainTitle-l31H9iuA",inputTitle:"inputTitle-l31H9iuA",hideValues:"hideValues-l31H9iuA",has5Buttons:"has5Buttons-l31H9iuA",stayInHoveredMode:"stayInHoveredMode-l31H9iuA",withTail:"withTail-l31H9iuA",loader:"loader-l31H9iuA",descTitle:"descTitle-l31H9iuA",intervalTitle:"intervalTitle-l31H9iuA",providerTitle:"providerTitle-l31H9iuA",exchangeTitle:"exchangeTitle-l31H9iuA",styleTitle:"styleTitle-l31H9iuA",priceSourceTitle:"priceSourceTitle-l31H9iuA",flagged:"flagged-l31H9iuA",medium:"medium-l31H9iuA",minimized:"minimized-l31H9iuA",micro:"micro-l31H9iuA",linked:"linked-l31H9iuA",onlyOneButtonCanBeStick:"onlyOneButtonCanBeStick-l31H9iuA",touchMode:"touchMode-l31H9iuA",buttonIcon:"buttonIcon-l31H9iuA",flag:"flag-l31H9iuA", eye:"eye-l31H9iuA",eyeLoading:"eyeLoading-l31H9iuA","eye-animation":"eye-animation-l31H9iuA",linking:"linking-l31H9iuA",intervalEye:"intervalEye-l31H9iuA",markerContainer:"markerContainer-l31H9iuA",flagWrapper:"flagWrapper-l31H9iuA",sourcesWrapper:"sourcesWrapper-l31H9iuA",legendMainSourceWrapper:"legendMainSourceWrapper-l31H9iuA",sources:"sources-l31H9iuA",togglerWrapper:"togglerWrapper-l31H9iuA",toggler:"toggler-l31H9iuA pane-button-e6PF69Df",onlyOneSourceShown:"onlyOneSourceShown-l31H9iuA",counter:"counter-l31H9iuA",iconArrow:"iconArrow-l31H9iuA",objectTree:"objectTree-l31H9iuA",closed:"closed-l31H9iuA",saveArrowWidth:"saveArrowWidth-l31H9iuA",objectsTreeCanBeShown:"objectsTreeCanBeShown-l31H9iuA"}},44784:e=>{e.exports={"css-value-pane-controls-padding":"4px",css_value_pane_controls_margin_top:"4",css_value_pane_controls_button_size:"22",css_value_pane_controls_button_touch_size:"22",paneControls:"paneControls-JQv8nO8e",paneControls_hidden:"paneControls_hidden-JQv8nO8e",paneControls_forceHidden:"paneControls_forceHidden-JQv8nO8e",buttons:"buttons-JQv8nO8e",button:"button-JQv8nO8e",button_activated:"button_activated-JQv8nO8e",touchMode:"touchMode-JQv8nO8e",maximize:"maximize-JQv8nO8e",collapse:"collapse-JQv8nO8e","maximize-animation-up-bracket":"maximize-animation-up-bracket-JQv8nO8e","maximize-animation-down-bracket":"maximize-animation-down-bracket-JQv8nO8e",minimize:"minimize-JQv8nO8e",restore:"restore-JQv8nO8e","minimize-animation-up-bracket":"minimize-animation-up-bracket-JQv8nO8e","minimize-animation-down-bracket":"minimize-animation-down-bracket-JQv8nO8e",up:"up-JQv8nO8e",buttonIcon:"buttonIcon-JQv8nO8e","up-animation":"up-animation-JQv8nO8e",down:"down-JQv8nO8e","down-animation":"down-animation-JQv8nO8e"}},33465:e=>{e.exports={blockHidden:"blockHidden-e6PF69Df","pane-button":"pane-button-e6PF69Df"}},4254:e=>{e.exports={"css-value-small-size":"18px","css-value-medium-size":"22px","css-value-large-size":"28px","css-value-border-radius-small-size":"9px","css-value-border-radius-medium-size":"11px","css-value-border-radius-large-size":"8px","css-value-vertical-padding-size":"16px","css-value-horizontal-padding-size":"16px","css-value-vertical-padding-size-first":"11px","css-value-vertical-padding-size-last":"10px",popupWidgetWrapper:"popupWidgetWrapper-Wu2pIo3E",popupWidgetWidth:"popupWidgetWidth-Wu2pIo3E",popupWidget:"popupWidget-Wu2pIo3E",large:"large-Wu2pIo3E",mobile:"mobile-Wu2pIo3E",desc:"desc-Wu2pIo3E",icon:"icon-Wu2pIo3E",small:"small-Wu2pIo3E",medium:"medium-Wu2pIo3E",title:"title-Wu2pIo3E",text:"text-Wu2pIo3E",item:"item-Wu2pIo3E",boldItem:"boldItem-Wu2pIo3E",action:"action-Wu2pIo3E",actionBtn:"actionBtn-Wu2pIo3E",additionalWidget:"additionalWidget-Wu2pIo3E"}},99241:e=>{e.exports={"css-value-small-size":"18px","css-value-medium-size":"22px","css-value-large-size":"28px","css-value-border-radius-small-size":"9px","css-value-border-radius-medium-size":"11px","css-value-border-radius-large-size":"8px",statusesWrap:"statusesWrap-Lgtz1OtS",statuses:"statuses-Lgtz1OtS",statusItem:"statusItem-Lgtz1OtS", statuses_hidden:"statuses_hidden-Lgtz1OtS",small:"small-Lgtz1OtS",medium:"medium-Lgtz1OtS",large:"large-Lgtz1OtS",blinking:"blinking-Lgtz1OtS","blinking-animation":"blinking-animation-Lgtz1OtS",marketStatusOpen:"marketStatusOpen-Lgtz1OtS",marketStatusClose:"marketStatusClose-Lgtz1OtS",marketStatusPre:"marketStatusPre-Lgtz1OtS",marketStatusPost:"marketStatusPost-Lgtz1OtS",marketStatusHoliday:"marketStatusHoliday-Lgtz1OtS",marketStatusDelisted:"marketStatusDelisted-Lgtz1OtS",marketStatusExpired:"marketStatusExpired-Lgtz1OtS",marketStatusCustom:"marketStatusCustom-Lgtz1OtS",invalidSymbol:"invalidSymbol-Lgtz1OtS",activeStrategy:"activeStrategy-Lgtz1OtS",alert:"alert-Lgtz1OtS",alertItemsContainer:"alertItemsContainer-Lgtz1OtS",alertItem:"alertItem-Lgtz1OtS",replayModeAutoPlay:"replayModeAutoPlay-Lgtz1OtS",replayModePause:"replayModePause-Lgtz1OtS",replayModePointSelect:"replayModePointSelect-Lgtz1OtS","blinking-animation-custom":"blinking-animation-custom-Lgtz1OtS",notAccurate:"notAccurate-Lgtz1OtS",openedInPineEditor:"openedInPineEditor-Lgtz1OtS",openedInDetachedPineEditor:"openedInDetachedPineEditor-Lgtz1OtS",delay:"delay-Lgtz1OtS",eod:"eod-Lgtz1OtS",dataProblemHigh:"dataProblemHigh-Lgtz1OtS",dataProblemLow:"dataProblemLow-Lgtz1OtS",hasError:"hasError-Lgtz1OtS",updateAvailable:"updateAvailable-Lgtz1OtS"}},33647:(e,t,s)=>{"use strict";var i;function l(e){e.dispatchEvent(new CustomEvent("roving-tabindex:main-element"))}function o(e){e.dispatchEvent(new CustomEvent("roving-tabindex:secondary-element"))}s.d(t,{becomeMainElement:()=>l,becomeSecondaryElement:()=>o}),function(e){e.MainElement="roving-tabindex:main-element",e.SecondaryElement="roving-tabindex:secondary-element"}(i||(i={}))},30854:(e,t,s)=>{"use strict";s.r(t),s.d(t,{ControlBarNavigation:()=>J});var i=s(50151),l=s(11542),o=s(32563),a=s(37103),n=s(48943),r=s(23714),d=s(24640),u=s(50470),c=s(18712),h=s(61814),p=s(49483),_=s(68335),m=s(95059),g=(s(51768),s(23317)),b=s(89612),v=s(77576),S=s(93724),w=s(91986),y=s(76996),f=s(78529),C=s(50119),M=s(62884),E=s(50662),V=s(42205);s(34359);const x=(0,_.humanReadableModifiers)(_.Modifiers.Alt,!1),W=(0,_.humanReadableModifiers)(_.Modifiers.Shift,!1),L=(0,_.humanReadableModifiers)(_.Modifiers.Mod,!1),A=(0,h.hotKeySerialize)({keys:[x,"R"],text:"{0} + {1}"}),k=(0,h.hotKeySerialize)({keys:[x,"Click",x,"Enter"],text:"{0} + {1}, {2} + {3}"}),T=(0,h.hotKeySerialize)({keys:[C],text:"{0}"}),B=(0,h.hotKeySerialize)({keys:[M],text:"{0}"}),H=(0,h.hotKeySerialize)({keys:[L,E],text:"{0} + {1}"}),P=(0,h.hotKeySerialize)({keys:[L,V],text:"{0} + {1}"}),D=(0,h.hotKeySerialize)({keys:[x,W,M],text:"{0} + {1} + {2}"}),I=l.t(null,void 0,s(88710)),R=l.t(null,void 0,s(97038)),O=l.t(null,void 0,s(61206)),N=l.t(null,void 0,s(31142)),z=l.t(null,void 0,s(90761)),F=l.t(null,void 0,s(25131)),U=l.t(null,void 0,s(75246)),G=l.t(null,void 0,s(83040));var Z,j;!function(e){e[e.BarVisibleDistance=100]="BarVisibleDistance",e[e.BackButtonRightMargin=14]="BackButtonRightMargin",e[e.SingleButtonWidth=36]="SingleButtonWidth",e[e.GroupMargins=14]="GroupMargins", e[e.GoToRealtimeButtonWidth=50]="GoToRealtimeButtonWidth",e[e.LeftMargin=50]="LeftMargin",e[e.TimeAxisMainPaneMargin=27]="TimeAxisMainPaneMargin",e[e.PaneControlsHeight=28]="PaneControlsHeight"}(Z||(Z={})),function(e){e.ScrollLeftRight="js-btn-group-scroll",e.ZoomInZoomOut="js-btn-group-zoom",e.Maximize="js-btn-group-maximize",e.ResetScale="js-btn-group-reset-scale"}(j||(j={}));const Q=`
\n\t
\n\t\t
\n\t\t\t
\n\t\t\t\t${g}\n\t\t\t
\n\t\t\t
\n\t\t\t\t${v}\n\t\t\t
\n\t\t
\n\t\t
\n\t\t\t
\n\t\t\t\t${w}\n\t\t\t
\n\t\t\t
\n\t\t\t\t${y}\n\t\t\t
\n\t\t
\n\t\t
\n\t\t\t
\n\t\t\t\t${b}\n\t\t\t
\n\t\t\t
\n\t\t\t\t${b}\n\t\t\t
\n\t\t
\n\t\t
\n\t\t\t
\n\t\t\t\t${S}\n\t\t\t
\n\t\t
\n\t
\n
`,$=`
\n\t
\n\t\t${f}\n\t
\n
`,K=p.CheckMobile.any(),X="control-bar__btn--btn-hidden",q={zoomInOut:!0,maximize:!0,scrollLeftRight:!0,resetScale:!0,goToRealtime:!0};class J{constructor(e,t,s){this._widget=(0,i.ensureNotNull)((0,u.parseHtml)(Q).querySelector(".control-bar-wrapper")),this._controlBar=(0,i.ensureNotNull)(this._widget.querySelector(".control-bar")),this._back=(0,i.ensureNotNull)((0,u.parseHtml)($).querySelector(".control-bar-wrapper")),this._btnGroups=Array.from(this._controlBar.querySelectorAll(".js-btn-group")),this._targetPaneWidget=null,this._backButtonVisible=!1,this._backButtonCanBeVisible=!1,this._boundMouseHandler=null,this._chartModel=null,this._controlBarVisible=!1,this._priceAxisChanged=null,this._resetScalesAvailable=null,this._priceAxisName="right",this._rafId=null,this._visibilityTypeProperty=null, this._boundUpdateMaximizeButtonsVisibility=this._updateMaximizeButtonsVisibility.bind(this),this._boundToggleFullscreenButtons=this._toggleFullscreenButtons.bind(this),this._paneWidth=0,this._leftPriceScaleWidth=0,this._rightPriceScaleWidth=0,this._onVisibilityTypeChange=e=>{"alwaysOn"===e||"alwaysOff"===e?(this._controlBarVisible="alwaysOn"===e,this._parent.removeEventListener("mousemove",this._controlsBarVisibilityHandler,!1),this._parent.removeEventListener("mouseleave",this._controlsBarVisibilityHandler,!1)):(this._controlBarVisible=!1,this._parent.addEventListener("mousemove",this._controlsBarVisibilityHandler),this._parent.addEventListener("mouseleave",this._controlsBarVisibilityHandler)),this._configureBackButtonVisibility(e),this._updateControlBarVisibility()},this._visibilityBackButtonHandler=e=>{const t=this._checkIsPointerNearBox(e,this._back.getBoundingClientRect());void 0!==t&&this._backButtonCanBeVisible!==t&&(this._backButtonCanBeVisible=t,this._setRAF())},this._controlsBarVisibilityHandler=e=>{const t=this._checkIsPointerNearBox(e,this._controlBar.getBoundingClientRect());void 0!==t&&this._controlBarVisible!==t&&(this._controlBarVisible=t,this._setRAF())},this._updateControlBarVisibility=()=>{this._controlBar.classList.toggle("control-bar--hidden",!this._controlBarVisible)},this._chart=e,this._parent=t,this._options=Object.assign({},q,s),this._visibilityPrioritizedGroups=this._initGroupDescriptions(),this._init(),this._initHandlers(),this.updatePosition()}destroy(){null!==this._visibilityTypeProperty&&(this._visibilityTypeProperty.destroy(),this._visibilityTypeProperty=null),null!==this._boundMouseHandler&&(this._parent.removeEventListener("mousemove",this._boundMouseHandler,!1),this._parent.removeEventListener("mouseleave",this._boundMouseHandler,!1),this._boundMouseHandler=null),null!==this._priceAxisChanged&&(this._priceAxisChanged.unsubscribe(this,this._updateBackBtnPosition),this._priceAxisChanged=null),clearInterval(this._checkIntervalId),this._resetScalesAvailable?.destroy();const e=this._chart.getResizerDetacher();e.fullscreenable.unsubscribe(this._boundUpdateMaximizeButtonsVisibility),e.fullscreen.unsubscribe(this._boundToggleFullscreenButtons),this._chart=null}updatePosition(){const e=this._targetPaneWidget=this._getTargetPaneWidget();if(null===e)return;const t=e.getElement().querySelector(".chart-markup-table .pane");if(null===t)return;this._paneWidth=e.width(),this._leftPriceScaleWidth=this._chart.getPriceAxisMaxWidthByName("left"),this._rightPriceScaleWidth=this._chart.getPriceAxisMaxWidthByName("right");const s=this._parent.getBoundingClientRect().bottom-t.getBoundingClientRect().bottom+this._bottomMargin(e);this._widget.style.bottom=`${s}px`,this._back.style.bottom=`${s}px`,this._updateBtnGroupVisibility()}_getTargetPaneWidget(){const e=this._chart.maximizedPaneWidget();if(e)return e;const t=[...this._chart.paneWidgets()].reverse();for(const e of t)if(e.height()>=this._widget.clientHeight+28+this._bottomMargin(e))return e;return null}_bottomMargin(e){return e.containsMainSeries()?27:0} _init(){if(p.CheckMobile.any())for(const e of this._btnGroups)e.classList.add("js-hidden");this._buttons={zoomIn:this._widget.querySelector(".control-bar__btn--zoom-in"),zoomOut:this._widget.querySelector(".control-bar__btn--zoom-out"),moveLeft:this._widget.querySelector(".control-bar__btn--move-left"),moveRight:this._widget.querySelector(".control-bar__btn--move-right"),turn:this._widget.querySelector(".control-bar__btn--turn-button"),maximize:this._widget.querySelector(".control-bar__btn--maximize"),minimize:this._widget.querySelector(".control-bar__btn--minimize")},this._parent.appendChild(this._widget),this._parent.appendChild(this._back),this._priceAxisName=(0,d.isRtl)()?"left":"right",this._chart.withModel(this,(()=>{this._chartModel=this._chart.model(),this._initVisibility(),this._priceAxisChanged=this._chart.getPriceAxisWidthChangedByName(this._priceAxisName),this._priceAxisChanged.subscribe(this,this._updateBackBtnPosition),this._resetScalesAvailable=this._chartModel.model().resetScalesAvailable().spawn(),this._resetScalesAvailable.subscribe(this._updateResetScalesButtonVisibility.bind(this),{callWithLast:!0});const e=this._chart.getResizerDetacher();e.fullscreenable.subscribe(this._boundUpdateMaximizeButtonsVisibility),e.fullscreen.subscribe(this._boundToggleFullscreenButtons),this._updateMaximizeButtonsVisibility(),this._updateBackBtnPosition(),this._back.querySelector(".control-bar__btn")?.addEventListener("click",(()=>{this._chart.scrollHelper().scrollToRealtime(!0,(()=>this._checkBackButtonVisibility()))}))}))}_initHandlers(){const e=o.mobiletouch?"touchstart":"mousedown",t=o.mobiletouch?["touchend"]:["mouseup","mouseout"];this._buttons.moveLeft.addEventListener(e,(e=>{e.preventDefault(),this._chart.scrollHelper().moveByBar(1),this._trackEvent("Move Left")})),this._buttons.moveRight.addEventListener(e,(e=>{e.preventDefault(),this._chart.scrollHelper().moveByBar(-1),this._trackEvent("Move Right")}));for(const e of t)this._buttons.moveLeft.addEventListener(e,(()=>this._chart.scrollHelper().stopMove())),this._buttons.moveRight.addEventListener(e,(()=>this._chart.scrollHelper().stopMove()));this._buttons.turn.addEventListener("click",(e=>{e.preventDefault(),this._chart.GUIResetScales(),this._trackEvent("Reset to Default Settings")})),this._buttons.zoomOut.addEventListener("click",(e=>{e.preventDefault(),null!==this._chartModel&&this._chartModel.zoomOut(),this._trackEvent("Zoom Out")})),this._buttons.zoomIn.addEventListener("click",(e=>{e.preventDefault(),null!==this._chartModel&&this._chartModel.zoomIn(),this._trackEvent("Zoom In")})),this._buttons.maximize.addEventListener("click",(e=>{e.preventDefault(),this._chart.setActive(!0),this._chart.getResizerDetacher().requestFullscreen(),this._trackEvent(" Maximize Chart")})),this._buttons.minimize.addEventListener("click",(e=>{e.preventDefault(),this._chart.getResizerDetacher().exitFullscreen(),this._trackEvent(" Restore Chart")}));const s=e=>e.addEventListener("contextmenu",(e=>e.preventDefault()));s(this._buttons.moveLeft),s(this._buttons.moveRight), s(this._buttons.turn),s(this._buttons.zoomOut),s(this._buttons.zoomIn),s(this._buttons.minimize),s(this._buttons.maximize)}_initGroupDescriptions(){return[{shouldBeHiddenOnMobile:!1,available:this._isMaximizeButtonAvailable.bind(this),className:"js-btn-group-maximize",element:this._getBtnGroup("js-btn-group-maximize"),totalWidth:50},{shouldBeHiddenOnMobile:!1,available:()=>this._options.resetScale,className:"js-btn-group-reset-scale",element:this._getBtnGroup("js-btn-group-reset-scale"),totalWidth:50},{shouldBeHiddenOnMobile:!a.enabled("show_zoom_and_move_buttons_on_touch"),available:()=>this._options.zoomInOut,className:"js-btn-group-zoom",element:this._getBtnGroup("js-btn-group-zoom"),totalWidth:86},{shouldBeHiddenOnMobile:!a.enabled("show_zoom_and_move_buttons_on_touch"),available:()=>this._options.scrollLeftRight,className:"js-btn-group-scroll",element:this._getBtnGroup("js-btn-group-scroll"),totalWidth:86}]}_checkBackButtonVisibility(){if(null===this._chartModel||!this._options.goToRealtime)return;const e=this._backButtonCanBeVisible&&this._chartModel.timeScale().rightOffset()<0;e!==this._backButtonVisible&&(this._backButtonVisible=e,this._back.querySelector(".control-bar__btn")?.classList.toggle(X,!this._backButtonVisible))}_initVisibility(){this._visibilityTypeProperty=(0,n.combine)(((e,t)=>null!==t?"alwaysOff":e),(0,c.convertPropertyToWatchedValue)((0,r.actualBehavior)()).ownership(),(0,m.getSeriesDisplayErrorWV)((0,i.ensureNotNull)(this._chartModel).mainSeries()).ownership()),this._visibilityTypeProperty.subscribe(this._onVisibilityTypeChange,{callWithLast:!0})}_configureBackButtonVisibility(e){"alwaysOff"===e?(clearInterval(this._checkIntervalId),this._checkIntervalId=void 0):this._checkIntervalId=this._checkIntervalId??setInterval((()=>this._checkBackButtonVisibility()),1e3),p.CheckMobile.any()?this._backButtonCanBeVisible="alwaysOff"!==e:"alwaysOn"===e||"alwaysOff"===e?(this._backButtonCanBeVisible="alwaysOn"===e,this._parent.removeEventListener("mousemove",this._visibilityBackButtonHandler,!1),this._parent.removeEventListener("mouseleave",this._visibilityBackButtonHandler,!1)):(this._backButtonCanBeVisible=!1,this._parent.addEventListener("mousemove",this._visibilityBackButtonHandler),this._parent.addEventListener("mouseleave",this._visibilityBackButtonHandler)),this._checkBackButtonVisibility()}_checkIsPointerNearBox(e,t){if(!(e.buttons||null!==this._chartModel&&this._chartModel.lineBeingCreated())){if("mousemove"===e.type){const s=100-(this._targetPaneWidget?this._bottomMargin(this._targetPaneWidget):0);return e.clientX>=t.left-100&&e.clientX<=t.right+100&&e.clientY>=t.top-s&&e.clientY<=t.bottom+100}return!1}}_setRAF(){null===this._rafId&&(this._rafId=this._widget.ownerDocument.defaultView.requestAnimationFrame((()=>{this._checkBackButtonVisibility(),this._updateControlBarVisibility(),this._rafId=null})))}_updateBackBtnPosition(){if("left"===this._priceAxisName||"right"===this._priceAxisName){const e=this._chart.getPriceAxisMaxWidthByName(this._priceAxisName)+14 ;e&&(this._back.style.marginRight=`${e}px`)}}_updateBtnGroupVisibility(){const e=this._leftPriceScaleWidth+this._paneWidth,t=(e+this._rightPriceScaleWidth)/2;let s=2*Math.min(e-t,t-this._leftPriceScaleWidth)-50-50,i=!1;for(const e of this._visibilityPrioritizedGroups){e.enoughSpaceForGroup=!1;e.available()&&(!K||!e.shouldBeHiddenOnMobile)&&(s-=e.totalWidth,e.enoughSpaceForGroup=s>=0&&!i,i=i||!e.enoughSpaceForGroup),!e.enoughSpaceForGroup!==e.element.classList.contains("js-hidden")&&e.element.classList.toggle("js-hidden",!e.enoughSpaceForGroup)}this._updateControlBarPosition()}_getBtnGroup(e){return(0,i.ensureDefined)(this._btnGroups.find((t=>t.classList.contains(e))))}_updateControlBarPosition(){const e=this._visibilityPrioritizedGroups.reduce(((e,t)=>e+(t.enoughSpaceForGroup?t.totalWidth:0)),0),t=(this._paneWidth+this._leftPriceScaleWidth+this._rightPriceScaleWidth)/2-Math.ceil(e/2);this._widget.style.left=`${t}px`}_updateResetScalesButtonVisibility(){if(null===this._chartModel)return;const e=this._chartModel.model().resetScalesAvailable().value();this._buttons.turn.classList.toggle(X,!e)}_updateMaximizeButtonsVisibility(){this._updateBtnGroupVisibility()}_toggleFullscreenButtons(){const e=this._chart.inFullscreen();this._buttons.maximize.classList.toggle("js-hidden",e),this._buttons.minimize.classList.toggle("js-hidden",!e)}_isMaximizeButtonAvailable(){return this._options.maximize,!1}_trackEvent(e){0}}},6639:(e,t,s)=>{"use strict";s.r(t),s.d(t,{LegendWidget:()=>Za});var i=s(27714),l=s(20057),o=s(50151),a=s(48943),n=s(48096),r=s(22613),d=s(87465),u=s(24377),c=s(3343),h=s(27267),p=s(37103),_=s(49483);function m(e,t){null===e.firstChild?e.textContent=t:e.firstChild.nodeValue=t}var g=s(33647),b=s(22692),v=s(51037),S=s(38780),w=s(50959),y=s(32227),f=s(97754),C=s.n(f),M=s(26559),E=s(51768),V=s(4226),x=s(40173),W=s(9745),L=s(77975),A=s(99241);function k(e){const{visible:t,icon:s,className:i,size:l="small",isBlinking:o,turnOffBlinking:a,customColor:n,datasetName:r,datasetEntityId:d}=e,u=(0,L.useWatchedValueReadonly)({watchedValue:t}),c=(0,L.useWatchedValueReadonly)({watchedValue:s}),h=(0,L.useWatchedValueReadonly)({watchedValue:i}),p=(0,L.useWatchedValueReadonly)({watchedValue:n}),_=!!o&&(0,L.useWatchedValueReadonly)({watchedValue:o}),m=d?(0,L.useWatchedValueReadonly)({watchedValue:d}):void 0;if(!u||!c)return null;const g={...r?{"data-name":r}:{},...m?{"data-entity-id":m}:{}};return w.createElement(W.Icon,{className:C()(A.statusItem,A[l],h,{[A.blinking]:_}),onClick:a,style:p?{"--custom-status-color":p}:void 0,...g,icon:c})}var T=s(86781);function B(e,t){return t.x<=e.x&&e.x<=t.x+t.width&&t.y<=e.y&&e.y<=t.y+t.height}const H=new Map;let P=0;function D(e){const t=(0,w.useCallback)((()=>{const t=(0,o.ensure)(e);return"current"in t?t.current:t()}),[e]);if(e)return t}function I(e,t){const s=D(e),i=D(t);(0,w.useEffect)((()=>{if(s&&i)return function(e,t){const s=P++;return H.set(s,[e,t]),()=>{H.delete(s)}}(s,i)}),[s,i])}function R(e,t,s){if(function(e,t,s){return B({x:t,y:s},e.getBoundingClientRect())}(e,t,s))return!0 ;for(const i of H.values()){const l=i[0](),o=i[1]();if(l&&o&&e.contains(l)&&R(o,t,s))return!0}return!1}function O(e,t){if(e.contains(t))return!0;for(const s of H.values()){const i=s[0](),l=s[1]();if(i&&l&&e.contains(i)&&O(l,t))return!0}return!1}var N=s(19250),z=s(540),F=s(39416),U=s(38528),G=s(75774),Z=s(42177),j=s.n(Z);function Q(e=!0){const t=window.innerWidth-document.body.clientWidth;var s,i;if(e||!G.isSafari||0===t)return document.body.style.setProperty("--ui-lib-private-scrollTrap-scroll-width",`${t}px`),s=document.body,i=j().bodyNoScroll,s.className=[s.className,i].join(" "),()=>{!function(e,t){const s=e.className.replace(t,""),i=s.split(" ").filter(Boolean).join(" ");e.className=i}(document.body,j().bodyNoScroll),document.body.classList.contains(j().bodyNoScroll)||document.body.style.removeProperty("--ui-lib-private-scrollTrap-scroll-width")}}var $=s(94030),K=s.n($);const X=e=>{e&&q(e)};function q(e){e.scrollTop=5e3,e.scrollLeft=5e3}const J=(0,l.default)((e=>{q(e.currentTarget)}),100);function Y(e){const{reference:t,disableSafariScrollbars:s=!0}=e,i=(0,U.useMergedRefs)([X,t]);return(0,w.useLayoutEffect)((()=>Q(s)),[s]),w.createElement("div",{className:K().scrollTrap,ref:i,onScroll:J},e.children,w.createElement("div",{className:K().scrollTrapContent}))}var ee,te=s(61790),se=s.n(te);function ie(e){const t=(0,w.useRef)(null),{isOpen:s,onClose:i,children:l,cardAppearanceClassname:o,anchoredAt:a,refToContentWrapperElement:n=t,side:r="bottom",idOfContentWrapperElement:d,ariaLabelledby:u,ariaMultiselectable:c,role:h,stretch:p,..._}=e,m=_,g=(0,F.useFunctionalRefObject)(n);return I(a,g),s?w.createElement(N.Portal,null,w.createElement(Y,{reference:g,disableSafariScrollbars:!1},w.createElement("div",{...(0,z.contentProps)(d,u,c,h),...m,className:C()(se().content,se()[r],o,p&&se().stretch)},l),w.createElement("div",{role:"presentation",className:se().backdrop,onClick:()=>{i(!1)},onPointerDown:e=>{e.stopPropagation()}}))):null}!function(e){e.SideBegin="begin",e.SideEnd="end",e.Top="top",e.Bottom="bottom"}(ee||(ee={}));var le=s(62764);const oe={x:0,y:0,width:0,height:0};function ae(e){return function(e){if(!e)return oe;const{x:t,y:s,width:i,height:l}=e.getBoundingClientRect();return{x:t,y:s,width:i,height:l}}(e.current)}function ne(e){const t=(0,w.useRef)(null),{anchoredAt:s,isOpen:i,refObjectToContentWrapperElement:l=t,width:o,height:a,isRtl:n,placementRules:r,ifNonePlacementRuleMatched:d,anchorPositionerCardAppearanceClassname:u,children:c,role:h,ariaLabelledby:p,ariaMultiselectable:_,idOfContentWrapperElement:m,onPlacementRuleSelected:g,getRootRect:b,repositionTriggers:v,...S}=e,y=S,f=function(e,t,s=[]){const[i,l]=(0,w.useState)(oe);return(0,w.useEffect)((()=>{const t=()=>{l(ae(e))};return function(...e){return(...t)=>{e.forEach((e=>e?.(...t)))}}(...s.map((e=>(e.subscribe(t),()=>e.unsubscribe(t)))))}),[...s,e]),(0,w.useLayoutEffect)((()=>{t&&l(ae(e))}),[e,t]),i}(s,i,v);return I(s,l),w.createElement(le.RectanglePositioner,{width:o,height:a,isRtl:n,isOpen:i,placementRules:r,ifNonePlacementRuleMatched:d, anchorPositionerCardAppearanceClassname:u,children:c,role:h,ariaLabelledby:p,ariaMultiselectable:_,idOfContentWrapperElement:m,refObjectToContentWrapperElement:l,anchoredAt:f,onPlacementRuleSelected:g,getRootRect:b,...y})}function re(e){const t=(0,w.useRef)(null),{anchored:s,placementRules:i,ifNonePlacementRuleMatched:l,width:o,height:a,isOpen:n,isRtl:r,anchorPositionerCardAppearanceClassname:d,refToContentWrapperElement:u=t,idOfContentWrapperElement:c,ariaLabelledby:h,ariaMultiselectable:p,role:_,children:m,getRootRect:g,repositionTriggers:b,...v}=e,S=v,y=(0,F.useFunctionalRefObject)(u);switch(s.type){case"element":return w.createElement(ne,{placementRules:i,ifNonePlacementRuleMatched:l,width:o,height:a,isOpen:n,isRtl:r,anchorPositionerCardAppearanceClassname:d,refObjectToContentWrapperElement:y,idOfContentWrapperElement:c,ariaLabelledby:h,ariaMultiselectable:p,role:_,children:m,anchoredAt:s.at,getRootRect:g,repositionTriggers:b,...S});case"rectangle":return w.createElement(le.RectanglePositioner,{placementRules:i,ifNonePlacementRuleMatched:l,width:o,height:a,isOpen:n,isRtl:r,anchorPositionerCardAppearanceClassname:d,refObjectToContentWrapperElement:y,idOfContentWrapperElement:c,ariaLabelledby:h,ariaMultiselectable:p,role:_,children:m,anchoredAt:s.at,getRootRect:g,...S})}}var de=s(26995),ue=s.n(de);const ce=(0,w.createContext)({isAnchorPositioner:!1,isMobilePositioner:!1,closePopover:()=>{},isRtl:!1,isInPopover:!1});var he;function pe(e){const{positioner:t,onClose:s,isRtl:i,children:l}=e,o=(0,w.useMemo)((()=>({isAnchorPositioner:"anchor"===t,isMobilePositioner:"mobile"===t,closePopover:s,isRtl:i,isInPopover:!0})),[t,s,i]);return w.createElement(ce.Provider,{value:o},w.createElement("div",{className:"mobile"===t?ue().mobileContext:ue().anchorContext},l))}function _e(){return(0,w.useContext)(ce)}!function(e){e.Anchor="anchor",e.Mobile="mobile"}(he||(he={}));var me=s(86866);var ge=s(11670);const be=s(86240)["media-show-drawer"];var ve=s(60855),Se=s.n(ve);const we=(ye=function(e){const{isRtl:t}=_e(),{isOpen:s,onClose:i,mobilePositionerSide:l="bottom",mobilePositionerCardAppearanceClassname:o=C()(Se().contentDefaultAppearanceMobile,Se()[l]),refToContentWrapperElement:a,isRtl:n=t,children:r,anchorPositionerCardAppearanceClassname:d=Se().contentDefaultAppearance,role:u,ariaLabelledby:c,ariaMultiselectable:h,idOfContentWrapperElement:p,placementRules:_,ifNonePlacementRuleMatched:m,width:g,height:b,anchored:v,mobilePositionerStretch:S,repositionTriggers:y,mobileBreakpoint:f,...M}=e,E=M,{isInPopover:V,isMobilePositioner:x}=_e(),W=(0,T.useMatchMedia)(f??be);return(void 0===f&&V?x:W)?w.createElement(ie,{isOpen:s,onClose:i,cardAppearanceClassname:o,refToContentWrapperElement:a,idOfContentWrapperElement:p,anchoredAt:"element"===v.type?v.at:void 0,children:w.createElement(pe,{positioner:"mobile",onClose:i,isRtl:n},r),role:u,ariaLabelledby:c,ariaMultiselectable:h,side:l,stretch:S,...E}):w.createElement(re,{anchored:v,isRtl:n,isOpen:s,anchorPositionerCardAppearanceClassname:d,role:u,ariaLabelledby:c,ariaMultiselectable:h, idOfContentWrapperElement:p,refToContentWrapperElement:a,placementRules:_,ifNonePlacementRuleMatched:(0,ge.ifNonePlacementRuleMatchedToImpl)(m),width:g,height:b,children:w.createElement(pe,{positioner:"anchor",onClose:i,isRtl:n},r),repositionTriggers:y,...E})},e=>(0,me.useIsNonFirstRender)()?w.createElement(ye,{...e}):null);var ye;var fe,Ce=s(67842),Me=s(77565),Ee=s.n(Me);function Ve(e){const{isAnchorPositioner:t}=_e(),{children:s,fixedHeader:i,fixedFooter:l,contentResize:o=14,onScroll:a,scrollRef:n,mobileStretch:r}=e,d=t?o:12,u=!!(1&d),c=!!(2&d),h=!!(4&o),p=!!(8&o),{onContentResized:_}=(0,w.useContext)(le.RectanglePositionerContext),[m,g]=(0,w.useState)(void 0),[b,v]=(0,w.useState)(void 0),[S,y]=(0,w.useState)(void 0),[f,M]=(0,w.useState)(void 0),[E,V]=(0,w.useState)(void 0),[x,W]=(0,w.useState)(void 0),L=xe({setHeight:g,setWidth:M}),A=xe({setHeight:v,setWidth:V}),k=xe({setHeight:y,setWidth:W}),T=(0,w.useRef)(-1),B=(0,w.useRef)(-1);(0,w.useLayoutEffect)((()=>{if(void 0===f||void 0===m||void 0===E||void 0===b||void 0===x||void 0===S)return;const e=T.current,t=B.current;function s(e,t,s,i){if(-1===e)return t;let l=t;return s||(l=Math.max(e,l)),i||(l=Math.min(e,l)),l}const i=s(e,Math.max(f,E,x),u,c),l=s(t,m+b+S,h,p);_(i,l),T.current=i,B.current=l}),[m,b,S,_,f,E,x,u,c,h,p]);const[H,P]=(0,w.useState)(void 0),D=void 0!==H?`-${H}px`:void 0;return w.createElement(w.Fragment,null,w.createElement("div",{className:Ee().crop},w.createElement("div",{className:C()(Ee().flex,u?Ee().allowShrinkWidth:Ee().notAllowShrinkWidth,r&&Ee().mobileStretch)},w.createElement("div",{className:C()(Ee().fixedHeader,i&&Ee().fixedHeaderContent),ref:L},i),w.createElement("div",{className:C()(Ee().mainScrollWrapper,void 0===H&&Ee().noScroll),onScroll:a,ref:n,style:{"--ui-lib-popover-content-vertical-scroll-compensation":D}},w.createElement("div",{className:C()(Ee().main,s&&Ee().mainContent),ref:A},s)),w.createElement("div",{className:C()(Ee().fixedFooter,l&&Ee().fixedFooterContent),ref:k},l))),w.createElement("div",{className:Ee().scrollContainer,ref:e=>{e&&P((t=>t||e.offsetWidth-e.clientWidth))}}))}function xe(e){return(0,Ce.useResizeObserver)((([t])=>{requestAnimationFrame((()=>{e.setHeight?.(t.borderBoxSize[0].blockSize),e.setWidth?.(t.borderBoxSize[0].inlineSize)}))}))}!function(e){e[e.AllowHorizontalShrink=1]="AllowHorizontalShrink",e[e.AllowHorizontalGrow=2]="AllowHorizontalGrow",e[e.AllowVerticalShrink=4]="AllowVerticalShrink",e[e.AllowVerticalGrow=8]="AllowVerticalGrow"}(fe||(fe={}));var We,Le=s(60179);function Ae(e,t,s){(0,w.useEffect)((()=>{if(e)return t()}),[...s,e])}function ke(e){return(t,s)=>(window.addEventListener(e,t,s),()=>{window.removeEventListener(e,t,s)})}!function(e){e[e.None=0]="None",e[e.Horizontal=1]="Horizontal",e[e.Vertical=2]="Vertical",e[e.Both=3]="Both"}(We||(We={}));const Te=ke("scroll");function Be(e,t,s){const i=(0,w.useMemo)((()=>function(){const e=new Set;return{subscribe:t=>{e.add(t)},unsubscribe:t=>{e.delete(t)},fire:()=>{e.forEach((e=>e()))}}}()),[]);return Ae(e,(()=>(window.addEventListener(t,i.fire,s),()=>{ window.removeEventListener(t,i.fire,s)})),[i]),i}function He(e,t,s){const i=((e=!0)=>Be(e,"resize",!0))(e),l=((e=!0)=>Be(e,"scroll",!0))(!s.closeOnScrollOutside&&e);return function(e,t,s){const i=(0,w.useRef)({clientWidth:void 0,clientHeight:void 0}),l=(0,w.useMemo)((()=>function(e){const t=[];return 1&e&&t.push("clientWidth"),2&e&&t.push("clientHeight"),t}(s)),[s]);Ae(e&&0!==s,(()=>{const e=()=>{l.forEach((e=>{const s=document.documentElement[e];void 0!==i.current[e]?i.current[e]!==s&&(t(!0,"currentLevel"),i.current[e]=s):i.current[e]=s}))};return e(),window.addEventListener("resize",e,!0),()=>{window.removeEventListener("resize",e,!0),i.current={clientWidth:void 0,clientHeight:void 0}}}),[t,l])}(!!s.closeOnResizeWindow&&e,t,3),function(e,t,s){Ae(e,(()=>Te((e=>{const i=s.current;if(!i)return;const l=e.target;l&&(O(i,l)||O(l,i)&&t(!1,"currentLevel"))}),!0)),[t,s])}(!!s.closeOnScrollOutside&&e,t,s.ref),[i,l]}Le.PLACEMENT_BOTTOM_ALIGN_LEFT,Le.PLACEMENT_TOP_ALIGN_LEFT,Le.PLACEMENT_BOTTOM_ALIGN_RIGHT,Le.PLACEMENT_TOP_ALIGN_RIGHT;const Pe=!0,De="pointerdown",Ie=!0,Re=!0,Oe=!0;function Ne(e,t,s,i,l){const o="boolean"==typeof i?De:i;Ae(!!e,(()=>ke(o)((e=>{const i={x:e.clientX,y:e.clientY},o=s.current,a=function(e,t){if(!t)return!1;const s="current"in t?t.current?.getBoundingClientRect():t;return!!s&&B(e,s)}(i,l);a||o&&R(o,i.x,i.y)||t(!1,"currentLevel")}))),[t,l,s,o])}const ze=ke("keydown");function Fe(e){const t=(0,w.useRef)(null),{onClose:s,isOpen:i,refToContentWrapperElement:l=t,closeOnClickAway:o=De,closeOnEscape:a=Pe,closeOnScrollOutside:n=Ie,closeOnResizeWindow:r=Re,closeOnTab:d=Oe,excludeArea:u}=e;let h=(0,F.useFunctionalRefObject)(l);const p=He(i,s,{closeOnResizeWindow:r,closeOnScrollOutside:n,ref:h});return h=function(e,t,s){const i=(0,w.useCallback)((i=>{e&&i&&i.addEventListener("keydown",(e=>{if(27!==(0,c.hashFromEvent)(e))return;const i=s.current;if(!i)return;const l=e.target;l instanceof HTMLElement&&i.contains(l)&&(e.preventDefault(),e.stopPropagation(),t(!0,"currentLevel"))}))}),[e]);return(0,F.useFunctionalRefObject)((0,U.useMergedRefs)([s,i]))}(a&&i,s,h),function(e,t,s){Ae(!!e,(()=>ze((e=>{const s=(0,c.hashFromEvent)(e);9!==s&&s!==9+c.Modifiers.Shift||t(!0,"currentLevel")}),!0)),[t,s])}(d&&i,s,h),Ne(o&&i,s,h,o,u),{repositionTriggers:p,refToContentWrapperElement:h}}var Ue=s(43814),Ge=s(15893),Ze=s(43576),je=s(4254);const Qe=new WeakMap,$e=new WeakMap;function Ke(e){const t=(0,L.useWatchedValueReadonly)({watchedValue:e.info}),s=(0,Ze.usePromise)((()=>e.preliminaryJob??Promise.resolve()));if(null===t||null===s)return null;const i=t.map((t=>{const{title:s,titleColor:i,icon:l,iconClassName:a,html:n,action:r,size:u,solutionId:c}=t,h=r?.color||"gray",p=["gray","green","red","blue"].includes(h)?Ge.LightButton:Ue.SquareButton;Qe.has(t)||Qe.set(t,(0,V.randomHash)());let _=[];return void 0!==e.additionalWidgets&&(_=e.additionalWidgets.map((t=>($e.has(t)||$e.set(t,(0,V.randomHash)()),t.renderer((0,o.ensureDefined)($e.get(t)),je.additionalWidget,e.onClose))))),w.createElement("div",{key:Qe.get(t), className:f(je.popupWidget,je[u],e.isMobile&&je.mobile),"data-qa-id":t.dataQaId,tabIndex:0,ref:e=>{e?.focus()}},w.createElement(W.Icon,{className:f(je.icon,a,A[u],je[u]),style:{"--custom-status-color":i||void 0},icon:l||void 0}),w.createElement("div",{className:je.desc},w.createElement("span",{style:{color:i||void 0},className:f(je.title,je[u])},w.createElement("span",null,s),!1),n&&w.createElement("p",{className:f(je.text,je[u])},n.map(((e,t)=>{let s,i;return(0,d.isObject)(e)?(s=e.text,i=e.bold):s=e,w.createElement("span",{key:`html_item_${t}`,className:f(je.item,i&&je.boldItem),dangerouslySetInnerHTML:{__html:s}})}))),r&&w.createElement(p,{className:f(je.actionBtn,r.className),onClick:()=>{e.onClose(),r?.onClick()},color:h,size:"xsmall",tooltipText:r.tooltip},r.text),_))}));return w.createElement(w.Fragment,null,i)}function Xe(e){const{anchored:t,offsetPosition:s,statuses:i,isOpen:l,onClose:o,ifNonePlacementRuleMatched:a,mobileBreakpoint:n="all and (max-width: 440px)"}=e,r=(0,M.useWatchedValueReadonly)({watchedValue:i}),d=(0,w.useRef)(null),u=Fe({isOpen:l,onClose:o,excludeArea:t.at,closeOnEscape:!0,closeOnClickAway:!0,closeOnScrollOutside:!0,closeOnResizeWindow:!0,closeOnTab:!0,refToContentWrapperElement:d}),c=(0,T.useMatchMedia)(n);return w.createElement(we,{isOpen:l,onClose:o,anchored:t,width:{by:"content"},height:{by:"content"},placementRules:[{...Le.PLACEMENT_BOTTOM_ALIGN_LEFT,offset:s}],ifNonePlacementRuleMatched:a??{pickRule:{by:"smallest-overlap",criteria:"area"},vertical:"cropSlideToFit",horizontal:"slideToFit"},mobileBreakpoint:n,mobilePositionerStretch:!1,anchorPositionerCardAppearanceClassname:je.popupWidgetWrapper,mobilePositionerCardAppearanceClassname:je.popupWidgetWrapper,"data-qa-id":"chart-statuses-popup",...u},w.createElement(Ve,null,r.map(((e,t)=>w.createElement(Ke,{key:`FullTooltipWidget${t}`,info:e.model.fullInfo(),additionalWidgets:e.additionalWidgets,preliminaryJob:e.preliminaryJob,onClose:()=>o(!1),isMobile:c})))))}const qe=A,Je=new WeakMap,Ye=v.trackingModeIsAvailable?"medium":"small";function et(e){const{statuses:t,tooltip:s,theme:i=A}=e,[l,o]=(0,w.useState)(!1),a=(0,M.useWatchedValueReadonly)({watchedValue:t}),n=(0,M.useWatchedValueReadonly)({watchedValue:s}),r=(0,w.useMemo)((()=>(0,x.mergeThemes)(qe,i)),[i]),d=(0,w.useRef)(null);return 0===a.length?null:w.createElement("div",{className:r.statusesWrap},w.createElement("div",{ref:d,className:C()(r.statuses,"apply-common-tooltip","common-tooltip-wide",r[Ye]),onClick:function(e){e.preventDefault(),a.forEach((e=>{e.model.turnOffBlinkingMode?.()})),u(),l&&(t=n,(0,E.trackEvent)("GUI","Statuses widget's action",t));var t},title:n,"data-name":"legend-source-item-status"},a.map((e=>(Je.has(e)||Je.set(e,(0,V.randomHash)()),w.createElement(k,{key:Je.get(e),visible:e.visible,icon:e.model.icon(),className:e.model.className(),size:e.model.size()??"small",isBlinking:e.model.isBlinkingMode,turnOffBlinking:e.model.turnOffBlinkingMode,customColor:e.model.customColor(),datasetName:e.iconDatasetName,datasetEntityId:e.iconDatasetEntityId }))))),w.createElement(Xe,{statuses:t,anchored:{type:"element",at:d},isOpen:l,onClose:function(){o(!1)},offsetPosition:{x:-15,y:4}}));function u(){o((e=>!e))}}function tt(e){const{container:t,...s}=e;return y.render(w.createElement(et,{...s}),t),()=>{y.unmountComponentAtNode(t)}}var st=s(62153);const it=v.trackingModeIsAvailable?44:28;var lt=s(52499),ot=s(26880),at=s(80007),nt=s(59998),rt=s(76460),dt=s(30551),ut=s(52859),ct=s(11542),ht=s(95804);function pt(e){(0,E.trackEvent)("GUI","Legend action",e)}var _t,mt,gt=s(24640),bt=s(36313);function vt(e){return(0,dt.isObject)(e)&&"items"in e}function St(e){return void 0!==e?ut.resetTransparency(e):e}function wt(e){return e.hasOwnProperty("touches")}!function(e){e[e.SeriesTitle=0]="SeriesTitle",e[e.SeriesDescription=1]="SeriesDescription",e[e.SeriesInterval=2]="SeriesInterval",e[e.SeriesProvider=3]="SeriesProvider",e[e.SeriesExchange=4]="SeriesExchange",e[e.SeriesStyle=5]="SeriesStyle",e[e.SeriesPriceSource=6]="SeriesPriceSource",e[e.DataSourceTitle=7]="DataSourceTitle",e[e.DataSourceSymbolTitle=8]="DataSourceSymbolTitle",e[e.DataSourceInput=9]="DataSourceInput"}(_t||(_t={})),function(e){e.Small="small",e.Large="large"}(mt||(mt={}));const yt=new ht.TranslatedString("show {title}",ct.t(null,void 0,s(51382))),ft=new ht.TranslatedString("hide {title}",ct.t(null,void 0,s(13017))),Ct=ct.t(null,void 0,s(98334)),Mt=ct.t(null,void 0,s(27298));class Et{constructor(e,t,s,i,l){this._titles=new nt.WatchedObject([]),this._values=new r.WatchedValue([]),this._actions=[],this._loading=new r.WatchedValue(!1),this._symbolLogoViewModel=new r.WatchedValue(null),this._destroyed=!1,this._moreActionCM=null,this._updateLoadingStatus=()=>{this._loading.setValue(this._source.isLoading())},this._model=e,this._source=t,this._options=s,this._callbacks=i,this._contextMenuOptions=l,this._disabled=new r.WatchedValue(this._getDisabledState()),this._disabledOnInterval=new r.WatchedValue(this._getDisabledOnIntervalState()),this._selected=new r.WatchedValue(!1),this._isTitleHidden=new r.WatchedValue(this._getTitleHiddenValue()),this._isValuesHidden=new r.WatchedValue(this._getValuesHiddenValue()),this._isRowHidden=new r.WatchedValue(this._getRowHiddenValue()),this._isEditable=new r.WatchedValue(this._getIsEditable()),(0,a.combine)(((e,t,s)=>({})),this._isTitleHidden.weakReference(),this._isValuesHidden.weakReference(),this._disabled.weakReference()).subscribe(this._updateRowVisibilities.bind(this)),this._values.subscribe((()=>{this._isValuesHidden.setValue(this._getValuesHiddenValue())}))}destroy(){this._symbolLogoViewModel.value()?.destroy(),this._destroyed=!0}titles(){return this._titles.readonly()}values(){return this._values.readonly()}actions(){return this._actions}disabled(){return this._disabled.readonly()}disabledOnInterval(){return this._disabledOnInterval.readonly()}selected(){return this._selected.readonly()}loading(){return this._loading.readonly()}isTitleHidden(){return this._isTitleHidden.readonly()}isRowHidden(){return this._isRowHidden.readonly()}isEditable(){return this._isEditable.readonly() }symbolLogoViewModel(){return this._symbolLogoViewModel}update(){this._updateTitles(),this._updateValues(),this._updateStates(),this.symbolLogoViewModel()?.value()?.update()}onToggleDisabled(){const e=this._source.properties().childs().visible,t=!e.value();this._model.setProperty(e,t,(t?yt:ft).format({title:new ht.TranslatedString(this._source.name(),this._source.title(bt.TitleDisplayTarget.StatusLine))})),pt((t?"Show":"Hide")+" source")}onShowSettings(e){this._source.userEditEnabled()&&(this.setSourceSelected(),this._callbacks.showChartPropertiesForSource(this._source,e),pt("Settings for source"))}onShowMoreActions(e){return this._options.readOnlyMode?Promise.resolve(null):(pt("Show source context menu"),this._callbacks.showContextMenuForSources([this._source],this._calcNewPosition(e),{...this._contextMenuOptions,isKeyboardEvent:!wt(e)&&(0,rt.isKeyboardClick)(e)},{origin:"LegendPropertiesContextMenu"}))}setSourceSelected(){this._model.selectionMacro((e=>{e.clearSelection(),e.addSourceToSelection(this._source)}))}_moreActionHandler(e){e.preventDefault(),null!==this._moreActionCM&&this._moreActionCM.isShown()?this._moreActionCM=null:(this.setSourceSelected(),this.onShowMoreActions(e).then((e=>{this._moreActionCM=e})))}_updateStates(){this._disabled.setValue(this._getDisabledState()),this._disabledOnInterval.setValue(this._getDisabledOnIntervalState()),this._selected.setValue(this._model.selection().isSelected(this._source)),this._isEditable.setValue(this._getIsEditable()),this._updateLoadingStatus()}_hasValues(){return this._values.value().length>0}_getEyeTitle(){return this._disabled.value()?Ct:Mt}_getIsEditable(){return this._source.userEditEnabled()}_getDisabledState(){return!this._source.properties().visible.value()}_updateRowVisibilities(){this._isRowHidden.setValue(this._getRowHiddenValue())}_getRowHiddenValue(){return this._options.readOnlyMode&&this._disabled.value()||this._isTitleHidden.value()&&(this._isValuesHidden.value()||this._disabled.value())}_calcNewPosition(e){let t={};if(wt(e)&&e.touches.length>0)t={clientX:e.touches[0].clientX,clientY:e.touches[0].clientY};else if(null!==e.target){const s=e.target.getBoundingClientRect();t={clientX:(0,gt.isRtl)()?s.right:s.left,clientY:s.top+s.height+3}}else{const s=e;t={clientX:s.clientX,clientY:s.clientY}}return t}}var Vt=s(26996),xt=s(4237),Wt=s(33465);const Lt=(At=Vt.Loader,kt={staticPosition:!0,size:"small"},(e,t)=>function(e,t,s,i){const l=document.createElement("span"),o=(0,xt.createRoot)(l);n(!1);const{className:a}=i??{};return a&&l.classList.add(a),o.render((0,w.createElement)(t,s)),e&&r(e),{toggleVisibility:n,destroy:function(){o.unmount()},mountTo:r};function n(e){l.classList.toggle(Wt.blockHidden,!e)}function r(e){e.appendChild(l)}}(e,At,kt,t));var At,kt,Tt=s(50279),Bt=s(39330),Ht=s(58492),Pt=s(82708),Dt=s(64971),It=s(59695),Rt=s(72206);class Ot{constructor(e){this._lastDrawnLogos=[],this._logoWrapper=null,this._pairContainer=null,this._primaryLogo=null,this._secondaryLogo=null,this._logoContainer=null,this._symbolLetterContainer=null, this._updateLogoVisibility=e=>{this._logoWrapper&&this._logoWrapper.classList.toggle(Rt.hidden,!e)},this._updateSymbolLogo=async e=>{if(null===this._logoWrapper&&this._renderSymbolLogo(),0!==this._lastDrawnLogos.length&&0!==e.length&&(0,Tt.default)(this._lastDrawnLogos,e))return;const t=await(s=e,Promise.all(s.map((e=>(0,Dt.getImage)(`symbol_logo_${e}`,e,zt).then((e=>e.cloneNode())))))).catch((()=>[]));var s;switch(t.length){case 0:this._pairContainer?.classList.add(Rt.hidden),this._logoContainer?.classList.add(It.hiddenCircleLogoClass),this._updateSymbolLetter(),this._symbolLetterContainer?.classList.remove(It.hiddenCircleLogoClass),this._lastDrawnLogos=e;break;case 1:Nt(this._logoContainer,t[0]),this._pairContainer?.classList.add(Rt.hidden),this._logoContainer?.classList.remove(It.hiddenCircleLogoClass),this._symbolLetterContainer?.classList.add(It.hiddenCircleLogoClass),this._lastDrawnLogos=e;break;case 2:Nt(this._primaryLogo,t[0]),Nt(this._secondaryLogo,t[1]),this._pairContainer?.classList.remove(Rt.hidden),this._logoContainer?.classList.add(It.hiddenCircleLogoClass),this._symbolLetterContainer?.classList.add(It.hiddenCircleLogoClass),this._lastDrawnLogos=e}},this._model=e,this._renderSymbolLogo(),this._logoUrls=e.symbolLogoUrls().spawn(),this._logoUrls.subscribe(this._updateSymbolLogo,{callWithLast:!0}),this._isLogoVisible=e.isSymbolLogoVisible().spawn(),this._isLogoVisible.subscribe(this._updateLogoVisibility,{callWithLast:!0})}destroy(){this._logoWrapper?.remove(),this._logoWrapper=null,this._pairContainer=null,this._primaryLogo=null,this._secondaryLogo=null,this._logoContainer=null,this._symbolLetterContainer=null,this._logoUrls.destroy(),this._isLogoVisible.destroy()}getElement(){return this._logoWrapper}_renderSymbolLogo(){if(!this._logoWrapper){const e=this._logoWrapper=document.createElement("div");e.classList.add(Rt.logoWrapper);const t=this._pairContainer=e.appendChild(document.createElement("span"));t.classList.add(Rt.pairContainer,Rt.hidden);const s=t.appendChild(document.createElement("span"));s.className=(0,Bt.getBlockStyleClasses)("xxxsmall");(this._secondaryLogo=s.appendChild(document.createElement("span"))).className=C()((0,Bt.getLogoStyleClasses)("xxxsmall"),Rt.logo);(this._primaryLogo=s.appendChild(document.createElement("span"))).className=C()((0,Bt.getLogoStyleClasses)("xxxsmall"),Rt.logo);(this._logoContainer=e.appendChild(document.createElement("span"))).className=C()((0,Ht.getStyleClasses)("xxxsmall"),Rt.logo,It.hiddenCircleLogoClass);(this._symbolLetterContainer=e.appendChild(document.createElement("span"))).className=C()((0,Ht.getStyleClasses)("xxxsmall"),Rt.logo),this._updateSymbolLetter()}}_updateSymbolLetter(){if(this._symbolLetterContainer){const e=(0,Pt.safeShortName)(this._model.symbol()??"")[0];m(this._symbolLetterContainer,e)}}}function Nt(e,t){e&&e.replaceChildren(t)}function zt(e){e.crossOrigin="",e.decoding="async"}const Ft=_.CheckMobile.any();var Ut,Gt;!function(e){e[e.Tiny=1]="Tiny",e[e.Small=2]="Small",e[e.Medium=3]="Medium",e[e.Large=4]="Large"}(Ut||(Ut={})),function(e){ e[e.NoIntervalForMultiChart=1]="NoIntervalForMultiChart",e[e.NoExchangeProviderAndInterval=2]="NoExchangeProviderAndInterval",e[e.AllVisible=3]="AllVisible"}(Gt||(Gt={}));function Zt(e,t){e.dataset.status=t?"loading":void 0}const jt=(0,x.mergeThemes)(qe,{statusesWrap:Rt.statusesWrapper__statuses});class Qt{constructor(e,t,s){this._el=null,this._firstBlockWrapper=null,this._titlesWrapperEl=null,this._titleContainers=[],this._titleElements=[],this._valuesElements=[],this._actionsParentEl=null,this._actionAdditionalWrapperEl=null,this._actionElements=[],this._accessibleTitleButtons=[],this._accessibleActionButtons=[],this._rowMode=4,this._titlesMode=3,this._statusesWrapper=null,this._statusesWidgetState=null,this._loader=null,this._valuesParentEl=null,this._valuesAdditionalWrapperEl=null,this._symbolLogoRenderer=null,this._resizeObserver=null,this._hideInvisibleHover=null,this._hideValues=null,this._allButtonsWidth=null,this._lastStatusesWrapperWidth=null,this._lastActionsWrapperWidth=null,this._showActionsHandler=null,this._hideActionsHandler=null,this._selectedSourceHandler=null,this._mouseEventHandlers=[],this._disableTimeout=null,this._toggleHiddenActions=null,this._updateDisabledState=(e=this._disabled.value())=>{null!==this._el&&(this._el.classList.toggle(Rt.disabled,e),this._updateLoadingState(),this._updateStatusWidgetVisibility(e),this._updateTitleMaxWidth())},this._updateLoadingState=(e=this._loading.value())=>{if(null!==this._el){this._el.classList.toggle(Rt.eyeLoading,e&&!this._disabled.value()),Zt(this._el,e)}null!==this._loader&&this._loader.toggleVisibility(e),this._updateShowValues()},this._updateSymbolLogoRenderer=e=>{if(this._symbolLogoRenderer?.destroy(),e){this._symbolLogoRenderer=new Ot(e);const t=this._titlesStatesSpawn.value().findIndex((e=>this._isTitleWithSymbolLogo(e)));if(-1!==t){const e=this._titleContainers[t];if(e){const t=this._symbolLogoRenderer.getElement();t&&e.insertBefore(t,e.firstChild)}}}else this._symbolLogoRenderer=null},this._model=e,this._parentEl=t,this._disabled=this._model.disabled().spawn(),this._disabled.subscribe(this._updateDisabledState),this._disabledOnInterval=this._model.disabledOnInterval().spawn(),this._disabledOnInterval.subscribe(this._updateDisabledOnIntervalState.bind(this)),this._selected=this._model.selected().spawn(),this._selected.subscribe(this._updateSelectedState.bind(this)),this._loading=this._model.loading().spawn(),this._loading.subscribe(function(e,t){let s=0;return i=>{clearTimeout(s),i?e():s=setTimeout(e,t)}}(this._updateLoadingState,700)),this._isTitleHidden=this._model.isTitleHidden().spawn(),this._isRowHidden=this._model.isRowHidden().spawn(),this._isTitleHidden.subscribe(this._updateShowTitles.bind(this)),this._isRowHidden.subscribe(this._updateShowLine.bind(this)),this._titlesStatesSpawn=this._model.titles().spawn(),this._titlesStatesSpawn.subscribe(this._titlesCollectionChanged.bind(this)),this._values=this._model.values().spawn(),this._values.subscribe(this._updateValues.bind(this)),this._createValuesSpawns(), this._addValuesSpawnsSubscriptions(),e.symbolLogoViewModel().subscribe(this._updateSymbolLogoRenderer),this._updateSymbolLogoRenderer(e.symbolLogoViewModel().value()),this._actionsSpawnArray=this._model.actions().map((e=>({visible:e.visible.spawn(),title:void 0===e.title?null:e.title.spawn()})));for(let e=0;e{e.preventDefault(),e.stopPropagation()}))))}destroy(){if(this._toggleHiddenActions=null,this._disabled.destroy(),this._disabledOnInterval.destroy(),this._selected.destroy(),this._loading.destroy(),this._isTitleHidden.destroy(),this._isRowHidden.destroy(),this._customTextColor.destroy(),this._loader?.destroy(),this._isMultipleLayout.destroy(),this._model.symbolLogoViewModel().unsubscribe(this._updateSymbolLogoRenderer),this._symbolLogoRenderer?.destroy(),null!==this._disableTimeout&&clearTimeout(this._disableTimeout),this._accessibleTitleButtons=[],this._accessibleActionButtons=[],this._statusesWidgetDestroy?.(),this._titlesStatesSpawn.destroy(),null!==this._titlesWrapperEl){for(const e of this._mouseEventHandlers)e.destroy();this._titleContainers=[],this._titleElements=[],this._withActions&&null!==this._selectedSourceHandler&&null!==this._showActionsHandler&&null!==this._hideActionsHandler&&(Ft||(this._titlesWrapperEl.removeEventListener("mouseenter",this._showActionsHandler), this._titlesWrapperEl.removeEventListener("mouseleave",this._hideActionsHandler))),this._titlesWrapperEl=null}for(const e of this._actionsSpawnArray){e.visible.destroy();const t=e.title;null!==t&&t.destroy()}if(this._actionElements=[],null!==this._actionAdditionalWrapperEl&&(this._withActions&&null!==this._showActionsHandler&&null!==this._hideActionsHandler&&!Ft&&(this._actionAdditionalWrapperEl.removeEventListener("mouseenter",this._showActionsHandler),this._actionAdditionalWrapperEl.removeEventListener("mouseleave",this._hideActionsHandler)),this._actionAdditionalWrapperEl=null),this._actionsParentEl=null,this._removeValuesSpawnsSubscriptions(),this._values.destroy(),null!==this._valuesParentEl&&(this._valuesElements=[],this._valuesParentEl=null),this._hideInvisibleHover?.destroy(),this._hideValues?.destroy(),null!==this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null),null!==this._el){const e=this._el.parentNode;e?.removeChild(this._el),this._el=null}}getElement(){return this._el}getHeight(){return null===this._el?null:24}updateMode(e,t){this._rowMode===e&&this._titlesMode===t&&null!==this._allButtonsWidth||(this._rowMode!==e&&(this._rowMode=e,this._updateActionsVisibilitiesByMode()),this._titlesMode!==t&&(this._titlesMode=t,this._updateTitlesVisibilitiesByMode()),this._updateAllButtonsWidth())}accessibleButtons(){return this._isRowHidden.value()?[]:[...this._accessibleTitleButtons,...this._accessibleActionButtons].filter((e=>!e.classList.contains(Wt.blockHidden)))}showActions(){null===this._el||this._el.classList.contains(Rt.withAction)||this._showActions()}hideActions(){null!==this._el&&this._el.classList.contains(Rt.withAction)&&this._hideActions()}_updateActionsVisibilitiesByMode(){}_updateTitlesVisibilitiesByMode(){}_render(){this._renderTitles(),this._renderActions(),this._renderValues();const e=this._customTextColor.value()||"";this._el=document.createElement("div"),this._el.classList.toggle(Rt.withCustomTextColor,Boolean(e)),Zt(this._el,this._loading.value()),this._firstBlockWrapper=document.createElement("div"),this._firstBlockWrapper.classList.add(Rt.noWrapWrapper),this._firstBlockWrapper.appendChild((0,o.ensureNotNull)(this._titlesWrapperEl)),null!==this._actionsParentEl&&this._firstBlockWrapper.appendChild(this._actionsParentEl),this._el.appendChild(this._firstBlockWrapper),this._el.appendChild((0,o.ensureNotNull)(this._valuesParentEl)),this._parentEl.append(this._el)}_renderTitles(){null===this._titlesWrapperEl&&(this._titlesWrapperEl=document.createElement("div"),this._titlesWrapperEl.classList.add(Rt.titlesWrapper));for(const e of this._titlesStatesSpawn.value())vt(e)?this._renderTitlesGroup(e):this._renderSimpleTitle(e)}_renderTitlesGroup(e){const t=document.createElement("div");t.classList.add(Rt.titlesGroupWrapper),e.items.forEach((e=>this._renderSimpleTitle(e,t))),(0,o.ensureNotNull)(this._titlesWrapperEl).appendChild(t)}_renderSimpleTitle(e,t){ const{title:s,tooltip:i,onClick:l}=e,a=l,n=this._getAttributesForTitleState(e),r=s??"",d=this._customTextColor.value()||"",u=document.createElement("div");u.classList.add(Rt.titleWrapper,Rt.withDot),u.style.color=d,n?.className&&u.classList.add(n.className),n?.titleId&&(u.dataset.name=n.titleId),void 0!==i&&(u.classList.add("apply-common-tooltip"),u.setAttribute("title",i));const c=document.createElement(a?"button":"div");if(c.classList.add(Rt.title),void 0!==l){u.classList.add(Rt.withAction);const e=e=>{this._selectedSourceHandler?.(e),l(),a&&c.blur()};this._mouseEventHandlers.push(new st.MouseEventHandler(u,{mouseClickEvent:e,tapEvent:_.CheckMobile.any()?void 0:e},{ignoreClickAndTapOnDblClickOrDblTap:!0}))}if(a){const e=c;this._makeItemAccessible(e,l,i??""),this._accessibleTitleButtons.push(e)}if(r.length>0?c.appendChild(document.createTextNode(r)):(u.classList.add(Wt.blockHidden),c.classList.add(Wt.blockHidden)),u.appendChild(c),this._isTitleWithSymbolLogo(e)){const e=this._symbolLogoRenderer?.getElement();e&&u.insertBefore(e,u.firstChild)}(t??(0,o.ensureNotNull)(this._titlesWrapperEl)).appendChild(u),this._titleContainers.push(u),this._titleElements.push(c)}_makeItemAccessible(e,t,s){""!==s&&e.setAttribute("aria-label",s),e.type="button",e.classList.add(Rt.accessible),e.tabIndex=-1;const i=t=>{switch(t.type){case"roving-tabindex:main-element":e.tabIndex=0;break;case"roving-tabindex:secondary-element":e.tabIndex=-1}};e.addEventListener("roving-tabindex:main-element",i),e.addEventListener("roving-tabindex:secondary-element",i),e.addEventListener("keydown",(e=>{const s=(0,c.hashFromEvent)(e);13!==s&&32!==s||(e.preventDefault(),t(e))}))}_renderActions(){if(!this._withActions)return;null===this._actionsParentEl&&(this._actionsParentEl=document.createElement("div"),this._actionsParentEl.classList.add(Rt.buttonsWrapper),this._actionsParentEl.dataset.name="actions",this._parentEl.append(this._actionsParentEl),this._actionAdditionalWrapperEl=document.createElement("div"),this._actionAdditionalWrapperEl.classList.add(Rt.buttons),this._actionsParentEl.appendChild(this._actionAdditionalWrapperEl));const e=(0,o.ensureNotNull)(this._actionAdditionalWrapperEl);this._model.actions().forEach((t=>{const s=void 0===t.disableAccessibility,i={iconSize:v.trackingModeIsAvailable?"large":"small",tag:s?"button":"div",buttonClassName:Rt.button,wrapIconClassName:Rt.buttonIcon,hiddenClassName:Wt.blockHidden,blurOnClick:!!s||void 0},l=(0,ot.createActionElement)(t,i);if(s){const e=l;this._makeItemAccessible(e,(e=>{t.action(e)}),t.title?.value()??""),this._accessibleActionButtons.push(e)}this._actionElements.push(l),e.appendChild(l)}))}_initWrappersIfNotInitialized(){return null===this._valuesParentEl&&(this._valuesParentEl=document.createElement("div"),this._valuesParentEl.classList.add(Rt.valuesWrapper),this._valuesAdditionalWrapperEl=document.createElement("div"),this._valuesAdditionalWrapperEl.classList.add(Rt.valuesAdditionalWrapper),this._valuesParentEl.appendChild(this._valuesAdditionalWrapperEl)),(0, o.ensureNotNull)(this._valuesAdditionalWrapperEl)}_isWidthButtonsMode(){return null!==this._el&&(this._el.classList.contains(Rt.withAction)||this._disabled.value()||this._selected.value())}_isTitleHiddenByMode(e){return!1}_updateStates(e){this._updateDisabledState(),this._updateDisabledOnIntervalState(),this._updateSelectedState(),this._updateLoadingState(),e&&this._clearDisableState()}_updateValuesHTMLElHandler(e,t){m((0,o.ensure)(this._valuesElements[e].value),t),this._updateShowValues()}_updateValueColorHandler(e,t=""){(0,o.ensure)(this._valuesElements[e].value).style.color=t}_updateValueVisibleHandler(e,t){const s=(0,o.ensure)(this._valuesElements[e].value).closest(`.${Rt.valueItem}`);null!==s&&s.classList.toggle(Wt.blockHidden,!t),this._updateShowValues()}_updateShowLine(){null!==this._el&&this._el.classList.toggle(Wt.blockHidden,this._isRowHidden.value())}_titlesCollectionChanged(){null!==this._titlesWrapperEl&&(this._titlesWrapperEl.innerHTML=""),this._accessibleTitleButtons=[],this._titleContainers=[],this._titleElements=[],this._renderTitles(),this._updateTitlesVisibilitiesByMode()}_createValuesSpawns(){this._valuesSpawnArray=this._values.value().map((e=>({value:e.value.spawn(),color:e.color.spawn(),visible:e.visible.spawn(),title:e.title.spawn()})))}_removeValuesSpawnsSubscriptions(){for(const e of this._valuesSpawnArray)e.value.destroy(),e.color.destroy(),e.visible.destroy(),e.title.destroy();this._valuesSpawnArray=[]}_addValuesSpawnsSubscriptions(){for(let e=0;ee.classList.contains(Wt.blockHidden)));e.classList.toggle(Wt.blockHidden,t)}e(this._valuesAdditionalWrapperEl),e(this._valuesParentEl)}_addStatusesWidget(e){this._hideInvisibleHover=e.visibility().spawn(),this._hideInvisibleHover.subscribe(this._updateHideInvisibleHoverMode.bind(this),{callWithLast:!0}),this._hideValues=(0,a.combine)(((e,t)=>e||t),e.dataSourceErrorStatusShown.weakReference(),e.isSymbolInvalidStatusShown.weakReference()),this._hideValues.subscribe(this._updateHideValuesMode.bind(this),{callWithLast:!0}),this._statusesWrapper=document.createElement("div"),this._statusesWrapper.classList.add(Rt.statusesWrapper),this._statusesWidgetState=e,this._disabled.value()?this._statusesWidgetDestroy=tt({container:this._statusesWrapper,statuses:e.visibleModels(),tooltip:e.tooltip(),theme:jt}):(this._statusesWidgetDestroy?.(),this._statusesWidgetDestroy=void 0),(0,o.ensureNotNull)(this._firstBlockWrapper).appendChild(this._statusesWrapper),this._updateStatusWidgetVisibility(this._disabled.value()),this._resizeObserver=new ResizeObserver(this._handlerRestrictTitleWidth.bind(this)), null!==this._actionsParentEl&&this._resizeObserver.observe(this._actionsParentEl),this._resizeObserver.observe(this._statusesWrapper)}_updateTitleMaxWidth(){if(null===this._firstBlockWrapper)return;const e=this._allButtonsWidth||0,t=(this._lastActionsWrapperWidth||0)+(this._lastStatusesWrapperWidth||0);this._isWidthButtonsMode()?this._firstBlockWrapper.style.maxWidth=`calc(100% - ${Math.max(e,t)}px)`:this._firstBlockWrapper.style.maxWidth=t>0?`calc(100% - ${t}px)`:""}_updateAllButtonsWidth(){this._allButtonsWidth=this._getButtonsCount()*it+1,this._updateTitleMaxWidth()}_updateHideInvisibleHoverMode(e){null!==this._el&&this._el.classList.toggle(Rt.hideInvisibleHover,e)}_updateHideValuesMode(e){null!==this._el&&this._el.classList.toggle(Rt.hideValues,e)}_showActions(){if(null===this._el||!this._withActions)return;this._el.classList.add(Rt.withAction),this._toggleHiddenActions?.(!0);const e=this._valuesParentEl?.offsetTop===this._titlesWrapperEl?.offsetTop;this._el.classList.toggle(Rt.withTail,e),this._updateTitleMaxWidth()}_hideActions(){null!==this._el&&this._withActions&&(this._el.classList.remove(Rt.withAction),this._toggleHiddenActions?.(!1),null!==this._valuesParentEl&&this._valuesParentEl.classList.remove(Rt.withTail),this._updateTitleMaxWidth())}_handlerRestrictTitleWidth(e){if(null===this._actionsParentEl||null===this._firstBlockWrapper)return;let t=null,s=null;for(const i of e)i.target===this._statusesWrapper&&(t=i.contentRect.width),i.target===this._actionsParentEl&&(s=i.contentRect.width);t===this._lastStatusesWrapperWidth&&s===this._lastActionsWrapperWidth||(null!==t&&(this._lastStatusesWrapperWidth=t),null!==s&&(this._lastActionsWrapperWidth=s),this._updateTitleMaxWidth())}_clearDisableState(){null!==this._el&&(this._el.classList.remove(Rt.eyeLoading),this._el.classList.remove(Rt.disabled),this._updateStatusWidgetVisibility(this._disabled.value()),this._updateTitleMaxWidth())}_updateDisabledOnIntervalState(){this._el?.classList.toggle(Rt.disabledOnInterval,this._disabledOnInterval.value())}_updateSelectedState(){null!==this._el&&this._withActions&&this._el.classList.toggle(Rt.selected,this._selected.value())}_updateShowTitles(){null!==this._titlesWrapperEl&&(this._titlesWrapperEl.classList.toggle(Wt.blockHidden,this._isTitleHidden.value()),null!==this._actionsParentEl&&this._actionsParentEl.classList.toggle(Wt.blockHidden,this._isTitleHidden.value()))}_updateValues(){this._removeValuesSpawnsSubscriptions(),this._createValuesSpawns(),null!==this._valuesParentEl&&null!==this._valuesAdditionalWrapperEl&&(this._valuesElements=[],this._valuesAdditionalWrapperEl.innerHTML=""),this._renderValues(),this._addValuesSpawnsSubscriptions(),this._updateShowValues()}_updateActionVisibilities(e){null!==this._actionsParentEl&&this._actionsParentEl.querySelectorAll(`.${Rt.button}`)[e].classList.toggle(Wt.blockHidden,!this._actionsSpawnArray[e].visible.value())}_updateActionTitle(e){const t=this._actionsSpawnArray[e].title;if(null===this._actionsParentEl||null===t)return ;const s=this._actionsParentEl.querySelectorAll(`.${Rt.button}`)[e];s.setAttribute("title",t.value()),s.hasAttribute("aria-label")&&s.setAttribute("aria-label",t.value()),s.dispatchEvent(new CustomEvent("common-tooltip-update"))}_updateCustomTextColor(){const e=this._customTextColor.value()||"";for(const t of this._titleContainers)null!==t&&(t.style.color=e);const t=(0,o.ensureNotNull)(this._valuesParentEl).querySelectorAll(`.${Rt.valueTitle}`);for(let s=0;se.classList.toggle(Wt.blockHidden,!0))),t.forEach((e=>e.classList.toggle(Wt.blockHidden,!1)))}_updateShowLine(){if(null===this._el||!this._canUpdateRowVisibility)return;const e=!this._globalRowVisibility.value();e?this._el.classList.toggle(Wt.blockHidden,e):super._updateShowLine()}_getButtonsCount(){switch(this._rowMode){case 4:return this._has5Buttons.value()?5:4;case 3:return 3;default:return 2}}_render(){super._render() ;const e=(0,o.ensureNotNull)(this._el);e.classList.add(Rt.item,Rt.study),e.dataset.name="legend-source-item",e.dataset.entityId=this._model.getSource().id(),e.setAttribute("role","toolbar")}_getAttributesForTitleState(e){return 7===e.id||8===e.id?{titleId:"legend-source-title",className:Rt.mainTitle}:9===e.id?{titleId:"legend-source-description",className:Rt.inputTitle}:null}_renderValues(){const e=this._initWrappersIfNotInitialized(),t=this._values.value();for(const s of t){const t=document.createElement("div");t.dataset.testIdValueTitle=s.title.value(),t.classList.add(Rt.valueItem),t.classList.toggle(Wt.blockHidden,!s.visible.value());const i=document.createElement("div");i.classList.add(Rt.valueValue),i.style.color=s.color.value()||"",i.appendChild(document.createTextNode(s.value.value()));const l=s.title.value();void 0!==l&&(i.classList.add("apply-common-tooltip"),i.title=l),t.appendChild(i),this._valuesElements.push({value:i}),e.appendChild(t)}}_updateValuesTitleHTMLElHandler(e,t=""){const s=(0,o.ensure)(this._valuesElements[e].value);s.classList.toggle("apply-common-tooltip",0!==t.length),s.title=t}_update5ButtonsStyles(e){null!==this._el&&(this._el.classList.toggle(Rt.has5Buttons,e),this._updateAllButtonsWidth())}_onWheelClicked(e){1===e.button&&this._model.onRemoveSource()}}class Xt extends Qt{constructor(e,t,s){super(e,t,s),this._clientHeight=null,this._updateLinkedState=void 0,this._flagged=this._model.flagged().spawn(),this._flagged.subscribe(this._updateFlaggedState.bind(this)),this._updateStates(),s.statusesWidgetState&&this._addStatusesWidget(s.statusesWidgetState),this._selected.subscribe(this._updateTitleMaxWidth.bind(this))}destroy(){super.destroy(),this._flagged?.destroy()}getHeight(){return null===this._el?null:(null===this._clientHeight&&(this._clientHeight=this._el.clientHeight,0===this._clientHeight&&(this._clientHeight=null)),this._clientHeight)}_updateActionsVisibilitiesByMode(){if(!this._withActions)return;const e=[];let t=[];const s=this._model.actions();if(1===this._rowMode)s[this._actionElements.length-1].visible.value()&&e.push(this._actionElements[this._actionElements.length-1]),t=this._actionElements.slice(0,this._actionElements.length-1);else for(let t=0;te.classList.toggle(Wt.blockHidden,!0))),e.forEach((e=>e.classList.toggle(Wt.blockHidden,!1)))}_updateTitlesVisibilitiesByMode(){}_isTitleHiddenByMode(e){const t=e.id;return 2!==t&&3!==t&&4!==t?super._isTitleHiddenByMode(e):2===t&&this._isMultipleLayout.value()?1===this._titlesMode:3!==this._titlesMode}_hideTitleAndItsContainerIfRequired(e){const t=this._getTitleIndexByDataName(e);if(-1===t)return;const s=this._titlesStatesSpawn.value()[t],i=this._titleContainers[t],l=this._titleElements[t],o=this._isTitleHiddenByMode(s);i?.classList.toggle(Wt.blockHidden,o),l?.classList.toggle(Wt.blockHidden,o)}_getButtonsCount(){return 1===this._rowMode?1:3}_render(){super._render();const e=(0,o.ensureNotNull)(this._el) ;e.classList.add(Rt.item,Rt.series),e.classList.toggle(Rt.onlyOneButtonCanBeStick,this._model.isOneButtonCanBeStick()),e.dataset.name="legend-series-item",e.setAttribute("role","toolbar")}_updateStates(){super._updateStates(),this._updateFlaggedState()}_renderValues(){const e=this._initWrappersIfNotInitialized(),t=this._values.value();for(const s of t){const t=document.createElement("div");t.dataset.testIdValueTitle=s.title.value(),t.classList.add(Rt.valueItem),t.classList.toggle(Wt.blockHidden,!s.visible.value()),t.classList.toggle(Rt.unimportant,s.unimportant.value());const i=document.createElement("div"),l=s.title.value()||"",o=this._customTextColor.value()||"";i.classList.add(Rt.valueTitle),i.classList.toggle(Wt.blockHidden,0===l.length),i.appendChild(document.createTextNode(l)),i.style.color=o,t.appendChild(i);const a=document.createElement("div");a.classList.add(Rt.valueValue),a.style.color=s.color.value()||"",a.appendChild(document.createTextNode(s.value.value())),t.appendChild(a),this._valuesElements.push({title:i,value:a}),e.appendChild(t)}}_getAttributesForTitleState(e){switch(e.id){case 0:return{titleId:"legend-source-title",className:Rt.mainTitle};case 1:return{titleId:"legend-source-description",className:Rt.descTitle};case 2:return{titleId:"legend-source-interval",className:Rt.intervalTitle};case 3:return{titleId:"legend-source-provider",className:Rt.providerTitle};case 4:return{titleId:"legend-source-exchange",className:Rt.exchangeTitle};case 5:return{titleId:"legend-source-style",className:Rt.styleTitle};case 6:return{titleId:"legend-source-price-source",className:Rt.priceSourceTitle}}return null}_updateValuesTitleHTMLElHandler(e,t=""){const s=(0,o.ensure)(this._valuesElements[e].title);m(s,t),s.classList.toggle(Wt.blockHidden,0===t.length),this._updateShowValues()}_isWidthButtonsMode(){return null!==this._el&&(void 0!==this._flagged&&Boolean(this._flagged.value())||this._linked?.value()||super._isWidthButtonsMode())}_updateFlaggedState(){if(void 0===this._flagged)return;(0,o.ensureNotNull)(this._el).classList.toggle(Rt.flagged,Boolean(this._flagged.value())),this._updateTitleMaxWidth()}_getTitleIndexByDataName(e){return this._titlesStatesSpawn.value().findIndex((t=>t.id===e))}}var qt,Jt=s(47036),Yt=s(62920),es=s(65300),ts=s(36885);!function(e){e[e.Default=0]="Default",e[e.Micro=1]="Micro"}(qt||(qt={}));const ss=(0,x.mergeThemes)(qe,{statusesWrap:Rt.statusesWrapper__statuses});class is{constructor(e,t,s){this._wrapperTogger=null,this._el=null,this._counterEl=null,this._arrowIconEL=null,this._objectTreeEl=null,this._loader=Lt(null),this._mode=0,this._accessibleButtons=[],this._parentEl=e,this._themedColor=t.spawn(),this._themedColor.subscribe(this._updateThemedColor.bind(this)),this._showCollapserWithOneIndicator=s.showCollapserWithOneIndicator.spawn(),this._showCollapserWithOneIndicator.subscribe(this._updateVisibility.bind(this)),this._sourceCount=s.visibleDataSourceCount.spawn(),this._sourceCount.subscribe((()=>{this._updateSourceCount(),this._updateVisibility()})), this._isStateOpen=s.isDataSourcesCollapsed.spawn(),this._isStateOpen.subscribe((()=>{this._updateState(),this._updateVisibility()})),this._isMainPane=s.isMainPane.spawn(),this._isMainPane.subscribe(this._updateObjectTreeVisibility.bind(this)),this._isPaneCollapsed=s.isPaneCollapsed.spawn(),this._isPaneCollapsed.subscribe(this._updateVisibility.bind(this)),this._combinedStatusWidgetEl=document.createElement("div"),this._combinedStatusesWidgetState=s.combinedStatusesWidgetState,this._combinedStatusesWidgetVisibility=this._combinedStatusesWidgetState.visibility().spawn(),this._combinedStatusesWidgetVisibility.subscribe(this._updateVisibility.bind(this)),this._render(),this._updateState(),this._updateVisibility(),this._updateThemedColor(this._themedColor.value()),this._updateObjectTreeVisibility(this._isMainPane.value()),this._isLoaderVisible=(0,a.combine)(((e,t)=>!e&&t[0]),this._isStateOpen.weakReference(),s.hasLoadingDataSources.weakReference()),this._isLoaderVisible.subscribe(this._loader.toggleVisibility,{callWithLast:!0}),this._toggleStateHandler=e=>{null!==this._el&&(e.cancelable&&e.preventDefault(),e instanceof KeyboardEvent||this._el?.blur(),1!==this._mode?s.onCollapseDataSources():s.onShowObjectsTreeDialog())},null!==this._el&&(this._el.addEventListener("touchend",this._toggleStateHandler),this._el.addEventListener("click",this._toggleStateHandler),this._el.addEventListener("contextmenu",(e=>{e.preventDefault(),e.stopPropagation()}))),this._updateSourceCount()}destroy(){this._isLoaderVisible.destroy(),this._loader.destroy(),this._isPaneCollapsed.destroy(),this._sourceCount.destroy(),this._isStateOpen.destroy(),this._showCollapserWithOneIndicator.destroy(),this._combinedStatusesWidgetVisibility.destroy(),this._combinedStatusesWidgetDestroy?.(),null!==this._objectTreeEl&&(this._objectTreeEl=null),this._arrowIconEL=null,this._counterEl=null,null!==this._el&&(this._el.removeEventListener("touchend",this._toggleStateHandler),this._el.removeEventListener("click",this._toggleStateHandler),this._el.innerHTML="",this._el=null)}accessibleButtons(){return null===this._el||this._el.classList.contains(Rt.onlyOneSourceShown)&&1!==this._mode?[]:this._accessibleButtons}setMode(e){this._mode=e?1:0,this._updateTooltip()}_render(){this._wrapperTogger=document.createElement("div"),this._wrapperTogger.classList.add(Rt.togglerWrapper),this._el=document.createElement("button"),this._el.className=`${Rt.toggler} apply-common-tooltip`;const e=this._el;e.type="button",e.classList.add(Rt.accessible),e.tabIndex=-1;const t=t=>{if(null!==e)switch(t.type){case"roving-tabindex:main-element":e.tabIndex=0;break;case"roving-tabindex:secondary-element":e.tabIndex=-1}};e.addEventListener("roving-tabindex:main-element",t),e.addEventListener("roving-tabindex:secondary-element",t),e.addEventListener("keydown",(e=>{const t=(0,c.hashFromEvent)(e);13!==t&&32!==t||(e.preventDefault(),this._toggleStateHandler(e))})),this._accessibleButtons.push(e),this._arrowIconEL=document.createElement("div"),this._arrowIconEL.classList.add(Rt.iconArrow), this._arrowIconEL.innerHTML=v.trackingModeIsAvailable?Yt:Jt,this._el.appendChild(this._arrowIconEL),this._objectTreeEl=document.createElement("div"),this._objectTreeEl.classList.add(Rt.objectTree),this._objectTreeEl.innerHTML=v.trackingModeIsAvailable?ts:es,this._el.appendChild(this._objectTreeEl),this._counterEl=document.createElement("div"),this._counterEl.classList.add(Rt.counter),this._counterEl.appendChild(document.createTextNode(String(this._sourceCount.value()))),this._el.appendChild(this._counterEl),this._wrapperTogger.appendChild(this._el),this._combinedStatusWidgetEl.classList.add(Rt.statusesWrapper),this._wrapperTogger.appendChild(this._combinedStatusWidgetEl),!this._isStateOpen.value()&&this._combinedStatusesWidgetVisibility.value()?this._combinedStatusesWidgetDestroy=tt({container:this._combinedStatusWidgetEl,statuses:this._combinedStatusesWidgetState.visibleModels(),tooltip:this._combinedStatusesWidgetState.tooltip(),theme:ss}):(this._combinedStatusesWidgetDestroy?.(),this._combinedStatusesWidgetDestroy=void 0),this._parentEl.appendChild(this._wrapperTogger),this._loader.mountTo(this._wrapperTogger)}_updateThemedColor(e){if(null!==this._el)if(e.length>0){const[t,s,i]=(0,u.parseRgb)(e);this._el.style.backgroundColor=(0,u.rgbaToString)([t,s,i,(0,u.normalizeAlphaComponent)(.8)])}else this._el.style.removeProperty("background-color")}_updateSourceCount(){const e=this._sourceCount.value(),t=(0,o.ensureNotNull)(this._counterEl);m(t,String(e)),t.classList.toggle(Wt.blockHidden,e<=1),this._parentEl.classList.toggle(Rt.saveArrowWidth,e<=1)}_updateVisibility(){const e=this._sourceCount.value(),t=(0,o.ensureNotNull)(this._el),s=1===e&&!this._showCollapserWithOneIndicator.value()&&(this._isStateOpen.value()||!this._combinedStatusesWidgetVisibility.value()),i=e<1||this._isPaneCollapsed.value()&&(this._isMainPane.value()||this._isStateOpen.value());t.classList.toggle(Wt.blockHidden,!!i),t.classList.toggle(Rt.onlyOneSourceShown,s),(0,o.ensureNotNull)(this._wrapperTogger).classList.toggle(Wt.blockHidden,s),!this._isStateOpen.value()&&this._combinedStatusesWidgetVisibility.value()?this._combinedStatusesWidgetDestroy=tt({container:this._combinedStatusWidgetEl,statuses:this._combinedStatusesWidgetState.visibleModels(),tooltip:this._combinedStatusesWidgetState.tooltip(),theme:ss}):(this._combinedStatusesWidgetDestroy?.(),this._combinedStatusesWidgetDestroy=void 0)}_updateState(){const e=!this._isStateOpen.value();this._parentEl.classList.toggle(Rt.closed,e),this._updateTooltip(),pt((e?"Hide":"Show")+" not main sources")}_tooltip(){if(1===this._mode)return ct.t(null,void 0,s(85786));const e=this._sourceCount.value(),t=ct.t(null,{plural:"Hide indicators legend",count:e},s(46960)),i=ct.t(null,{plural:"Show indicators legend",count:e},s(36553));return this._isStateOpen.value()?t:i}_updateTooltip(){if(null!==this._el){const e=this._tooltip();this._el.setAttribute("title",e),this._el.setAttribute("aria-label",e),this._el.dispatchEvent(new CustomEvent("common-tooltip-update"))}}_updateObjectTreeVisibility(e){(0, o.ensureNotNull)(this._el).classList.toggle(Rt.objectsTreeCanBeShown,e)}}var ls;!function(e){e[e.Medium=222]="Medium",e[e.Small=205]="Small",e[e.Tiny=133]="Tiny",e[e.HideUnimportantValues=272]="HideUnimportantValues",e[e.SeriesDirectionColumn=542]="SeriesDirectionColumn",e[e.HideExchangeIntevalProvider=442]="HideExchangeIntevalProvider",e[e.HideIntervalMultiChart=192]="HideIntervalMultiChart"}(ls||(ls={}));const os=p.enabled("object_tree_legend_mode"),as=[27,9,37,39,38,40],ns=(0,x.mergeThemes)(qe,{statusesWrap:Rt.statusesWrapper__statuses});class rs{constructor(e,t){this._mode=4,this._renderToggler=null,this._mainDataSourceRenderer=null,this._dataSourceRenderers=[],this._parentEl=document.createElement("div"),this._mainDataSourceEl=null,this._dataSourcesEl=null,this._dataSourcesAdditionalWrapperEl=null,this._collapsedDataSourcesWrapperEl=null,this._collapsedDataSourcesEl=null,this._outsideEventForCollapsedTooltip=null,this._onKeyboardNavigationActivationBound=this._onKeyboardNavigationActivation.bind(this),this._onIsDataSourcesCollapsedBound=this._onIsDataSourcesCollapsed.bind(this),this._focusEventAbortController=null,this._toggleHiddenActionsTimoutID=null,this._loader=Lt(null),this._toggleHiddenActions=e=>{this._toggleHiddenActionsTimoutID&&(clearTimeout(this._toggleHiddenActionsTimoutID),this._toggleHiddenActionsTimoutID=null),e?this._parentEl.classList.toggle(Rt.legend_withHiddenActions,e):this._toggleHiddenActionsTimoutID=setTimeout((()=>this._parentEl.classList.toggle(Rt.legend_withHiddenActions,e)),100)},this._options=e,this._togglerOptions=t,this._isStudiesLegendHidden=e.isStudiesLegendHidden.spawn(),this._isStudiesLegendHidden.subscribe(this._updateLegendVisibility.bind(this)),this._isAllLegendHidden=e.isAllLegendHidden.spawn(),this._isAllLegendHidden.subscribe(this._updateLegendVisibility.bind(this)),this._updateLegendVisibility(),this._hideAllExceptFirstLine=e.hideAllExceptFirstLine.spawn(),this._hideAllExceptFirstLine.subscribe(this._updateAllHiddenExeptFirstLine.bind(this)),this._themedColor=e.themedColor.spawn(),this._themedColor.subscribe(this._setCustomBg.bind(this)),this._showBackground=e.showBackground.spawn(),this._showBackground.subscribe(this._setCustomBg.bind(this)),this._backgroundTransparency=e.backgroundTransparency.spawn(),this._backgroundTransparency.subscribe(this._setCustomBg.bind(this)),this._collapsedDataSourcesCountSpawn=e.collapsedDataSourcesCount.spawn(),this._collapsedDataSourcesCountSpawn.subscribe(this._updateCollapsedSourcesCount.bind(this)),this._collapsedDataSourcesStatusWidgetElement=document.createElement("div"),this._collapsedStatusesWidgetState=e.combinedStatusesWidgetState,this._collapsedStatusesWidgetVisibility=this._collapsedStatusesWidgetState.visibility().spawn(),this._collapsedStatusesWidgetVisibility.subscribe((()=>this._updateCollapsedSourcesCount(this._collapsedDataSourcesCountSpawn.value()))),this._showCollapsedDataSourcesTooltipHandler=this._showCollapsedDataSourcesTooltip.bind(this),this._parentEl.classList.add(Rt.legend), this._parentEl.classList.toggle(Rt.noWrap,!v.trackingModeIsAvailable),this._parentEl.classList.toggle(Rt.noActions,!this._options.withActions),this._parentEl.classList.toggle(Rt.touchMode,v.trackingModeIsAvailable),this._parentEl.classList.toggle(Rt.wrappable,!this._hideAllExceptFirstLine.value()),this._parentEl.dataset.name="legend",this._parentEl.setAttribute("data-tooltip-show-on-focus","true"),this._parentEl.style.setProperty("--legend-source-item-button-width",`${it}px`);const s=t=>{t.preventDefault(),e.showLegendWidgetContextMenu(t)};this._mouseEventHandler=new st.MouseEventHandler(this._parentEl,{contextMenuEvent:s,touchContextMenuEvent:s}),window.addEventListener("keyboard-navigation-activation",this._onKeyboardNavigationActivationBound),this._parentEl.addEventListener("keydown",this._handleKeyDown.bind(this)),this._options.onLayoutChanged.subscribe(this,this._onLayoutChanged),this._isLoaderVisible=(0,a.combine)((e=>e[1]),e.hasLoadingDataSources.weakReference()),this._isLoaderVisible.subscribe(this._loader.toggleVisibility,{callWithLast:!0})}destroy(){this._isLoaderVisible.destroy(),this._loader.destroy(),this._focusEventAbortController?.abort();const e=document.activeElement;let t=-1;if(rs._wasKeyboardNavigationActivated&&e instanceof HTMLButtonElement){null!==this._getRowRendererByChild(e)&&(t=(0,b.queryTabbableElements)(document.body).indexOf(e))}if(this._collapsedStatusesWidgetDestroy?.(),this._isStudiesLegendHidden.destroy(),this._isAllLegendHidden.destroy(),this._hideAllExceptFirstLine.destroy(),this._themedColor.destroy(),this._showBackground.destroy(),this._backgroundTransparency.destroy(),this._collapsedDataSourcesCountSpawn.destroy(),this._collapsedStatusesWidgetVisibility.destroy(),v.trackingModeIsAvailable&&null!==this._collapsedDataSourcesWrapperEl&&this._collapsedDataSourcesWrapperEl.removeEventListener("touchend",this._showCollapsedDataSourcesTooltipHandler),this._outsideEventForCollapsedTooltip&&this._outsideEventForCollapsedTooltip(),null!==this._dataSourcesAdditionalWrapperEl&&(this._dataSourcesAdditionalWrapperEl.innerHTML="",this._dataSourcesAdditionalWrapperEl=null),null!==this._dataSourcesEl&&(this._dataSourcesEl.innerHTML="",this._dataSourcesEl=null),this._togglerOptions.isDataSourcesCollapsed.unsubscribe(this._onIsDataSourcesCollapsedBound),null!==this._renderToggler&&(this._renderToggler.destroy(),this._renderToggler=null),null!==this._mainDataSourceRenderer&&(this._mainDataSourceRenderer.destroy(),this._mainDataSourceRenderer=null),0!==this._dataSourceRenderers.length){for(const e of this._dataSourceRenderers)e.destroy();this._dataSourceRenderers=[]}if(this._mouseEventHandler.destroy(),this._parentEl.innerHTML="",delete this._parentEl,window.removeEventListener("keyboard-navigation-activation",this._onKeyboardNavigationActivationBound),-1!==t){let e;window.dispatchEvent(new CustomEvent("keyboard-navigation-activation",{bubbles:!0}));const s=(0,b.queryTabbableElements)(document.body);e=t===s.length?s[0]:s[t],e&&e.focus()}}addCustomWidget(e,t){if(0===t.block){ this._renderMainDataSourceEl();const s=(0,o.ensureNotNull)(this._mainDataSourceEl);1===t.position&&e.renderTo(s,s.firstChild),0===t.position&&e.renderTo(s)}if(1===t.block){this._renderDataSourcesEl();const s=(0,o.ensureNotNull)(this._dataSourcesAdditionalWrapperEl);1===t.position&&e.renderTo(s,s.firstChild),0===t.position&&e.renderTo(s)}}firstTitle(){return this._parentEl.firstElementChild}getElement(){return this._parentEl}updateMode(e){const t=os&&e<133?1:e<205?2:e<222?3:4,s=e<192?1:e<442?2:3;this._mode=t,null!==this._mainDataSourceRenderer&&this._mainDataSourceRenderer.updateMode(t,s);for(const e of this._dataSourceRenderers)e.updateMode(t,s);this._parentEl.classList.toggle(Rt.medium,3===t),this._parentEl.classList.toggle(Rt.minimized,2===t),this._parentEl.classList.toggle(Rt.micro,1===t),null!==this._renderToggler&&this._renderToggler.setMode(1===t);const i=!this._hideAllExceptFirstLine.value()&&(v.trackingModeIsAvailable||e<542);this._parentEl.classList.toggle(Rt.directionColumn,i),this._parentEl.classList.toggle(Rt.hideUniportantValueItems,!_.CheckMobile.any()&&e<=272)}getMainSourceHeight(){return null===this._mainDataSourceRenderer?0:this._mainDataSourceRenderer.getHeight()}getDataSourceHeight(){return 0===this._dataSourceRenderers.length?0:this._dataSourceRenderers[0].getHeight()}_renderMainDataSourceEl(){null===this._mainDataSourceEl&&(this._mainDataSourceEl=document.createElement("div"),this._mainDataSourceEl.classList.add(Rt.legendMainSourceWrapper),this._parentEl.insertBefore(this._mainDataSourceEl,this._dataSourcesEl))}_renderDataSourcesEl(){null===this._dataSourcesEl&&(this._dataSourcesEl=document.createElement("div"),this._dataSourcesEl.classList.add(Rt.sourcesWrapper),this._renderToggle(this._dataSourcesEl),this._dataSourcesAdditionalWrapperEl=document.createElement("div"),this._dataSourcesAdditionalWrapperEl.classList.add(Rt.sources),this._dataSourcesEl.appendChild(this._dataSourcesAdditionalWrapperEl),this._renderCollapsedCounter(this._dataSourcesAdditionalWrapperEl),this._parentEl.appendChild(this._dataSourcesEl))}_renderToggle(e){this._options.showToggleButton&&(this._renderToggler=new is(e,this._options.themedColor,this._togglerOptions))}_onIsDataSourcesCollapsed(e){if(e){const e=this._getAllAccessibleButtons();if(0===e.filter((e=>e.tabIndex>=0)).length){const t=this._getRowRendererByChild(e[0]);t&&this._makeRowElementTheMainOne(e[0],t)}return}if(0!==(this._mainDataSourceRenderer?.accessibleButtons()||[]).filter((e=>e.tabIndex>=0)).length)return;const t=[];this._dataSourceRenderers.forEach((e=>t.push(...e.accessibleButtons())));const s=t.filter((e=>e.tabIndex>=0));if(0!==s.length){this._focusEventAbortController&&this._focusEventAbortController.abort(),s.forEach((e=>(0,g.becomeSecondaryElement)(e)));let e=null,t=null;if(this._mainDataSourceRenderer){const s=this._mainDataSourceRenderer.accessibleButtons();s.length>0&&(e=s[0],t=this._mainDataSourceRenderer)}null===e&&this._renderToggler&&(e=this._renderToggler.accessibleButtons()[0],t=this._renderToggler),e&&t&&this._makeRowElementTheMainOne(e,t)} }_renderCollapsedCounter(e){this._collapsedDataSourcesWrapperEl=document.createElement("div"),this._collapsedDataSourcesWrapperEl.className=`${Rt.item} ${Rt.last}`,this._collapsedDataSourcesEl=document.createElement("span"),this._collapsedDataSourcesEl.className=`${Rt.text} apply-common-tooltip`,this._collapsedDataSourcesWrapperEl.append(this._collapsedDataSourcesEl),this._collapsedDataSourcesStatusWidgetElement.classList.add(Rt.statusesWrapper),this._collapsedDataSourcesWrapperEl.appendChild(this._collapsedDataSourcesStatusWidgetElement),e.append(this._collapsedDataSourcesWrapperEl),v.trackingModeIsAvailable&&this._collapsedDataSourcesWrapperEl.addEventListener("touchend",this._showCollapsedDataSourcesTooltipHandler);const t=this._collapsedDataSourcesCountSpawn.value();this._updateCollapsedSourcesCount(t),this._loader.mountTo(this._collapsedDataSourcesWrapperEl)}_showCollapsedDataSourcesTooltip(){(0,S.showOnElement)(this._collapsedDataSourcesEl,{text:this._options.collapsedDataSourcesTitle.value()}),this._addOutsideEventForHideTooltip()}_addOutsideEventForHideTooltip(){null!==this._outsideEventForCollapsedTooltip&&this._outsideEventForCollapsedTooltip(),this._outsideEventForCollapsedTooltip=(0,h.addOutsideEventListener)(new CustomEvent("timestamp").timeStamp,this._collapsedDataSourcesWrapperEl,(()=>{null!==this._outsideEventForCollapsedTooltip&&this._outsideEventForCollapsedTooltip(),(0,S.hide)()}),window.document,{touchEnd:!0})}_updateCollapsedSourcesCount(e){if(null===this._collapsedDataSourcesWrapperEl||null===this._collapsedDataSourcesEl)return;const t=0===e;this._collapsedDataSourcesWrapperEl.classList.toggle(Wt.blockHidden,t),!t&&this._collapsedStatusesWidgetVisibility.value()?this._collapsedStatusesWidgetDestroy=tt({container:this._collapsedDataSourcesStatusWidgetElement,statuses:this._collapsedStatusesWidgetState.visibleModels(),tooltip:this._collapsedStatusesWidgetState.tooltip(),theme:ns}):(this._collapsedStatusesWidgetDestroy?.(),this._collapsedStatusesWidgetDestroy=void 0),t||(m(this._collapsedDataSourcesEl,`+${e}`),this._collapsedDataSourcesEl.setAttribute("title",this._options.collapsedDataSourcesTitle.value()))}_updateLegendVisibility(){let e;const t=rs._wasKeyboardNavigationActivated&&(this._isAllLegendHidden.value()||this._isStudiesLegendHidden.value());if(t){e=this._getAllAccessibleButtons().filter((e=>e.tabIndex>=0))[0]}if(this._parentEl.classList.toggle(Wt.blockHidden,this._isAllLegendHidden.value()),null!==this._dataSourcesEl&&this._dataSourcesEl.classList.toggle(Wt.blockHidden,this._isStudiesLegendHidden.value()),t){const t=this._getAllAccessibleButtons();if(e&&t.includes(e))return;if(e&&(0,g.becomeSecondaryElement)(e),0!==t.length){const e=this._getRowRendererByChild(t[0]);e&&this._makeRowElementTheMainOne(t[0],e)}}}_updateAllHiddenExeptFirstLine(){this._parentEl.classList.toggle(Rt.wrappable,!this._hideAllExceptFirstLine.value())}_setCustomBg(){const e=this._showBackground.value(),t=this._themedColor.value(),s=this._backgroundTransparency.value();let i="";if(e){const[e,l,o]=(0,u.parseRgb)(t) ;i=(0,u.rgbaToString)([e,l,o,(0,u.normalizeAlphaComponent)(1-s/100)])}this._parentEl.style.color=i}_onLayoutChanged(e){const{newMainSource:t,removedDataSources:s,addedDataSources:i,movedDataSources:l}=e,o=document.activeElement;let a=-1,n=-1;const r=null===this._mainDataSourceRenderer&&0===this._dataSourceRenderers.length;if(rs._wasKeyboardNavigationActivated&&o instanceof HTMLButtonElement){const e=this._getRowRenderers(),l=e.find((e=>e.accessibleButtons().includes(o)));if(void 0!==l){const r=l===this._mainDataSourceRenderer&&null===t,d=l instanceof Kt&&s.includes(this._dataSourceRenderers.indexOf(l));if(r||d){a=e.indexOf(l);const r=(0,b.queryTabbableElements)(document.body).indexOf(o);n=0!==i.length||(void 0!==t||null!==this._mainDataSourceRenderer)&&null!==t||s.length!==this._dataSourceRenderers.length&&0!==this._dataSourceRenderers.length?r+1:r}}}void 0!==t&&(null!==t?this._addMainDataSource(t.model,t.statusesWidgetState):(this._mainDataSourceRenderer?.destroy(),this._mainDataSourceRenderer=null));const d=[];if(l.forEach((e=>{d.push({renderer:this._dataSourceRenderers[e.oldIndex],newIndex:e.newIndex})})),d.sort(((e,t)=>e.newIndex-t.newIndex)),s.forEach((e=>{this._dataSourceRenderers.splice(e,1)[0].destroy()})),0!==i.length&&(this._renderDataSourcesEl(),i.forEach((e=>{this._addDataSource(e.model,e.statusesWidgetState,e.index)}))),0!==d.length&&(this._renderDataSourcesEl(),d.forEach((e=>{this._moveDataSource(e.renderer,e.newIndex)}))),rs._wasKeyboardNavigationActivated&&r&&(null!==this._mainDataSourceRenderer||this._dataSourceRenderers.length)&&window.dispatchEvent(new CustomEvent("keyboard-navigation-activation",{bubbles:!0})),-1!==a){let e,t;const s=this._getRowRenderers();for(;a0){e=l[0],t=i;break}a++}if(e&&t)this._changeFocusElement(e,t);else if(-1!==n){window.dispatchEvent(new CustomEvent("keyboard-navigation-activation",{bubbles:!0}));const t=(0,b.queryTabbableElements)(document.body);e=n===t.length?t[0]:t[n],e&&(o&&(0,g.becomeSecondaryElement)(o),e.focus())}}}_addMainDataSource(e,t){this._renderMainDataSourceEl(),this._mainDataSourceRenderer=new Xt(e,(0,o.ensureNotNull)(this._mainDataSourceEl),{withActions:this._options.withActions,customTextColor:this._options.customTextColor,statusesWidgetState:t,isMultipleLayout:this._options.isMultipleLayout,toggleHiddenActions:this._toggleHiddenActions}),this._updateLegendVisibility()}_addDataSource(e,t,s){const i=(0,o.ensureNotNull)(this._dataSourcesAdditionalWrapperEl),l=new Kt(e,i,{withActions:this._options.withActions,customTextColor:this._options.customTextColor,statusesWidgetState:t,isMultipleLayout:this._options.isMultipleLayout,toggleHiddenActions:this._toggleHiddenActions}),a=(0,o.ensureNotNull)(l.getElement());if(null!==a){let e=this._dataSourceRenderers[s];void 0!==e?i.insertBefore(a,e.getElement()):(e=this._dataSourceRenderers[s-1],void 0!==e&&i.insertBefore(a,(0,o.ensureNotNull)(e.getElement()).nextSibling))}this._dataSourceRenderers.splice(s,0,l),this._updateLegendVisibility()} _moveDataSource(e,t){const s=this._dataSourceRenderers.indexOf(e);if(-1===s||t===s)return;const i=(0,o.ensureNotNull)(this._dataSourcesAdditionalWrapperEl),l=(0,o.ensureNotNull)(e.getElement());let a=this._dataSourceRenderers[t];void 0!==a?i.insertBefore(l,a.getElement()):(a=this._dataSourceRenderers[t-1],void 0!==a&&i.insertBefore(l,(0,o.ensureNotNull)(a.getElement()).nextSibling)),this._dataSourceRenderers.splice(s,1),this._dataSourceRenderers.splice(t,0,e)}_onKeyboardNavigationActivation(){rs._wasKeyboardNavigationActivated=!0,this._togglerOptions.isDataSourcesCollapsed.unsubscribe(this._onIsDataSourcesCollapsedBound),this._togglerOptions.isDataSourcesCollapsed.subscribe(this._onIsDataSourcesCollapsedBound);const e=this._getAllAccessibleButtons(),t=e.filter((e=>e.tabIndex>=0));if(0===t.length){const[t]=e.filter((e=>e.hasAttribute("tabIndex")));if(void 0===t)return;const s=this._getRowRendererByChild(t);if(null===s)return;this._makeRowElementTheMainOne(t,s)}if(t.length>1){const[,...e]=t;for(const t of e)(0,g.becomeSecondaryElement)(t)}}_handleKeyDown(e){if(e.defaultPrevented)return;const t=(0,c.hashFromEvent)(e);if(!as.includes(t))return;const s=document.activeElement;if(!(s instanceof HTMLButtonElement))return;const i=this._getRowRendererByChild(s);if(null===i)return;if(27===t)return void s.blur();const l=i.accessibleButtons(),o=l.indexOf(s);if(0===l.length||-1===o)return;const a=t=>{e.preventDefault();const s=this._getRowRenderers(),l=s.indexOf(i);let o,a,n="blockNext"===t?l+1:l-1;for(;n>=0&&n{this._focusEventAbortController=new AbortController,e.addEventListener("focusout",(s=>{const i=s.relatedTarget;null!==i&&i instanceof HTMLButtonElement&&t.accessibleButtons().includes(i)||(this._subscribeElementToFocusEvents(e,t),t instanceof is||t.hideActions())}),{once:!0,signal:this._focusEventAbortController.signal}),this._options.onLegendRowFocused(),t instanceof is||t.showActions()}),{once:!0,signal:this._focusEventAbortController.signal})}_makeRowElementTheMainOne(e,t){this._subscribeElementToFocusEvents(e,t),(0,g.becomeMainElement)(e)}_changeFocusElement(e,t){document.activeElement&&(0,g.becomeSecondaryElement)(document.activeElement),this._makeRowElementTheMainOne(e,t),e.focus()}_getRowRenderers(){let e=[];return this._mainDataSourceRenderer&&e.push(this._mainDataSourceRenderer),this._dataSourcesEl&&!this._dataSourcesEl.classList.contains(Wt.blockHidden)&&(this._togglerOptions.isDataSourcesCollapsed.value()&&1!==this._mode&&(e=e.concat(this._dataSourceRenderers)), this._renderToggler&&0!==this._dataSourceRenderers.length&&e.push(this._renderToggler)),e}_getAllAccessibleButtons(){const e=[];return this._getRowRenderers().forEach((t=>{e.push(...t.accessibleButtons())})),e}_getRowRendererByChild(e){return this._getRowRenderers().find((t=>t.accessibleButtons().includes(e)))??null}}rs._wasKeyboardNavigationActivated=!1;var ds=s(89323),us=s(67455),cs=s(18712),hs=s(59613),ps=s(96937),_s=s(618),ms=s(36279),gs=s(8811),bs=s(16659);const vs=p.enabled("show_symbol_logos")&&p.enabled("show_symbol_logo_in_legend"),Ss=new bs.CircularCacheBuffer(100);class ws{constructor(e,t){this._symbolLogoUrls=new r.WatchedValue([]),this._quoteDataForLogos=null,this._logoDataUpdated=()=>{const e=this.symbol(),t=this._logoData.value();t&&e&&Ss.set(e,t);const s=Ss.get(e);this._quoteDataForLogos=(0,d.merge)(s??{},this._logoData.value()??{}),this._symbolLogoUrls.setValue((0,_s.removeUsdFromCryptoPairLogos)((0,_s.resolveLogoUrls)(this._quoteDataForLogos,ms.LogoSize.Medium)))},this._logoModel=e,this._isLogoVisible=(0,gs.createWVFromGetterAndSubscription)((()=>t.showLogo.value()),t.showLogo),this._logoData=this._logoModel.logoData().spawn(),this._logoData.subscribe(this._logoDataUpdated,{callWithLast:!0})}destroy(){this._isLogoVisible.destroy(),this._logoModel.destroy()}isSymbolLogoVisible(){return this._isLogoVisible}symbolLogoUrls(){return this._symbolLogoUrls}symbol(){return this._logoModel.symbol()}update(){this._logoModel.update()}}function ys(e,t){return vs?new ws(e,t):null}var fs=s(70002),Cs=s(9343);const Ms=(0,Cs.getLogger)("Chart.LegendWidget");function Es(e){const t={};for(const s of["logoid","currency-logoid","base-currency-logoid"])if(s in e){const i=s;t[i]=e[i]}return t}class Vs{constructor(e){this._logoData=new r.WatchedValue(null),this._prevSymbol="",this._source=e,this._source.symbolResolved().subscribe(this,this._onSourceSymbolResolved),this.update()}destroy(){this._source.symbolResolved().unsubscribeAll(this)}symbol(){return this._source.symbol()}logoData(){return this._logoData}update(){const e=this.symbol();this._prevSymbol!==e&&(this._prevSymbol=e,this._onSourceSymbolResolved())}_onQuoteSymbolDataUpdated(e,t){const s=t.values;!this._source.symbolSameAsCurrent(e.values.pro_name)||void 0===s.logoid&&void 0===s["currency-logoid"]&&void 0===s["base-currency-logoid"]||this._logoData.setValue(Es(s))}async _onSourceSymbolChange(){const e=this.symbol();let t=null;try{this._logoData.setValue(null),t=await this._source.quotesProvider().quotesSnapshot(e)}catch(e){Ms.logError(`Quote snapshot error: ${e}`)}finally{this.symbol()===e&&(null===t?this._logoData.setValue(null,!0):this._logoData.setValue(Es(t)))}}_onSourceSymbolResolved(){{const e=this._source.symbolInfo(),t=e?.logo_urls||[];if(1===t.length)return void this._logoData.setValue({logoid:t[0]});if(2===t.length)return void this._logoData.setValue({"base-currency-logoid":t[0],"currency-logoid":t[1]});this._logoData.setValue(null,!0)}}}var xs=s(54336),Ws=s(41674),Ls=s(87258),As=s(45534) ;const ks=ct.t(null,void 0,s(37117)),Ts=ct.t(null,void 0,s(44454)),Bs=ct.t(null,void 0,s(13865)),Hs=ct.t(null,void 0,s(63245)),Ps=ct.t(null,void 0,s(2569)),Ds=p.enabled("legend_inplace_edit"),Is=p.enabled("show_hide_button_in_legend"),Rs=p.enabled("hide_resolution_in_legend");class Os extends Et{constructor(e,t,s,i,l){super(e,t,s,i,l),this._symbolMarker=null,this._symbolMarkerIcon=null,this._flagged=new r.WatchedValue(null),this._symbolAction=null,this._symbolForMarker=null,this._isOneButtonCanBeStick=!1,this._layoutChartSyncLegendRenderer=null,this._isChartLinked=new r.WatchedValue(!1).readonly().spawn(),this._createActions(),this._updateSymbolMarker();const o=this._model.model().properties().childs().paneProperties.childs().legendProperties.childs();this._symbolLogoViewModel.setValue(ys(new Vs(t),o)),o.showSeriesTitle.subscribe(this,(()=>{this._isTitleHidden.setValue(this._getTitleHiddenValue())})),this._isPriceSourceHidden=(0,us.createWVFromGetterAndSubscription)((()=>!o.showPriceSource.value()),o.showPriceSource),this._valuesVisibleProperty=(0,us.combineProperty)(((e,t,s,i)=>`${e}:${t}:${s}:${i}`),o.showSeriesOHLC.weakReference(),o.showBarChange.weakReference(),o.showVolume.weakReference(),o.showLastDayChange.weakReference()),this._valuesVisibleProperty.subscribe(null,(()=>{this.update(),this._isValuesHidden.setValue(this._getValuesHiddenValue())})),this.update(),this._source.statusWV().subscribe(this._updateLoadingStatus)}destroy(){super.destroy(),this._model.model().properties().childs().paneProperties.childs().legendProperties.childs().showSeriesTitle.unsubscribeAll(this),this._source.statusWV().unsubscribe(this._updateLoadingStatus),this._valuesVisibleProperty.destroy(),this._isPriceSourceHidden.destroy(),this._symbolMarker?.destroy()}flagged(){return this._flagged}linked(){return this._isChartLinked}onShowSettings(){this._source.userEditEnabled()&&this._callbacks.showGeneralChartProperties(fs.TabNames.symbol)}isOneButtonCanBeStick(){return this._isOneButtonCanBeStick}_updateTitles(){const e=(0,o.ensureNotNull)(this._source.statusView()).getSplitTitle(),t=[],s=this._getChangeSymbolCallback();let i=null;""!==(0,ds.clean)(e.title,!0)&&(i={title:(0,ds.clean)(e.title,!0),id:0,tooltip:s?Hs:void 0,onClick:s},t.push(i));const l=(0,ds.clean)(e.description,!0);""!==l&&t.push({title:l,id:1,tooltip:s?Hs:void 0,onClick:s});const a=(0,ds.clean)(e.interval,!0);if(""!==a&&!Rs){const e=this._getChangeResolutionCallback();t.push({title:a,id:2,tooltip:e?Ps:void 0,onClick:e})}const n=(0,ds.clean)(e.provider,!0);""!==n&&t.push({title:n,id:3});const r=(0,ds.clean)(e.listedExchange,!0);""!==r&&t.push({title:r,id:4});const d=(0,ds.clean)(e.chartStyle,!0);""!==d&&t.push({title:d,id:5});const u=this._isPriceSourceHidden.value()?"":(0,ds.clean)(e.priceSource,!0);""!==u&&t.push({title:u,id:6}),this._titles.setValue(t)}_updateValues(){const e=this._source.legendView(),t=this._values.value(),s=e.marketTitle(),i=e.marketTitle().length>0,l=e.items();if(0===t.length||t.length!==l.length+1){const e={value:new r.WatchedValue(""), color:new r.WatchedValue(""),visible:new r.WatchedValue(i),title:new r.WatchedValue(s),unimportant:new r.WatchedValue(!1)},t=l.map((e=>({value:new r.WatchedValue(e.value()),color:new r.WatchedValue(St(e.color())),visible:new r.WatchedValue(e.visible()),title:new r.WatchedValue(e.title()),unimportant:new r.WatchedValue(e.unimportant())})));this._values.setValue([e].concat(t))}else{t[0].title.setValue(s),t[0].visible.setValue(i);for(let e=0;e"true"===e))}_getChangeSymbolCallback(){if(Ds&&!p.enabled("disable_legend_inplace_symbol_change"))return void 0===this._changeSymbolCallback&&(this._changeSymbolCallback=async()=>{const e=this._model.mainSeries(),t=e.symbol(),s=e.properties().childs().shortName.value(),i="option"===e.symbolInfo()?.type,l=e.symbolInfo()?.pro_name;let o=e.isSpread()?t:s||t||"";if(p.enabled("symbol_search_option_chain_selector")&&i&&l){const e=await resolveUnderlyingSymbol(l);e&&(o={type:"option",value:l,underlying:e})}(0,ps.showDialog)({defaultValue:o,enableOptionsChain:p.enabled("symbol_search_option_chain_selector")})}),this._changeSymbolCallback}_getChangeResolutionCallback(){if(Ds&&!p.enabled("disable_legend_inplace_resolution_change"))return void 0===this._changeResolutionCallback&&(this._changeResolutionCallback=()=>{(0,hs.showChangeIntervalDialogAsync)({initVal:this._model.mainSeries().interval(),selectOnInit:!0})}),this._changeResolutionCallback}_createActions(){if(Is){const e=(0,cs.convertPropertyToWatchedValue)((0,us.combineProperty)((e=>!e),this._source.properties().childs().visible.weakReference())),t={icon:new Map([["large",Ws],["small",xs]]),action:(0,at.wrapHandlerWithPreventEvent)(this.onToggleDisabled.bind(this)),visible:e,className:Rt.eye,title:new r.WatchedValue(this._getEyeTitle()),dataset:{name:"legend-show-hide-action"}};this._actions.push(t),this._disabled.subscribe((()=>{t.title?.setValue(this._getEyeTitle())}))}this._actions.push({icon:new Map([["large",As],["small",Ls]]),action:this._moreActionHandler.bind(this),visible:new r.WatchedValue(!0),title:new r.WatchedValue(ks),dataset:{name:"legend-more-action"}})}_getMarkerTitle(){return null!==this._symbolMarker?this._symbolMarker.isMarked()?Bs:Ts:""}_symbolActionHandler(e){(0,at.preventDefault)(e),null!==this._symbolMarker&&(this._updateSymbolMarker(),e instanceof KeyboardEvent&&this._symbolMarker.toggle(e),pt("Change flag state"))}_updateSymbolMarker(){this._isOneButtonCanBeStick=!0}} var Ns=s(2088),zs=s(31237),Fs=s(32823),Us=s(22455),Gs=s(8686),Zs=s(48961),js=s(83637),Qs=s(36791),$s=s(34882),Ks=s(37073),Xs=s(30556),qs=s(91104);(0,Cs.getLogger)("Chart.LegendWidget");const Js=ct.t(null,void 0,s(32514)),Ys=ct.t(null,void 0,s(87142)),ei=ct.t(null,void 0,s(67410)),ti=ct.t(null,void 0,s(37117)),si=ct.t(null,void 0,s(74759)),ii=ct.t(null,void 0,s(63245)),li=(p.enabled("study_buttons_in_legend"),p.enabled("show_hide_button_in_legend")),oi=p.enabled("property_pages"),ai=p.enabled("format_button_in_legend"),ni=p.enabled("delete_button_in_legend"),ri=p.enabled("legend_inplace_edit");class di extends Et{constructor(e,t,s,i,l){super(e,t,s,i,l),this._error=new r.WatchedValue(!1),this._isAbleShowSourceCode=new r.WatchedValue(!1),this._isAbleShowSourceCodeInner=new r.WatchedValue(!1).spawn(),this._pineAction=null,this._pineActionVisible=null,this._globalVisibility=new r.WatchedValue(!0),this._updateSymbolLogoModel(),this._createActions();const o=this._model.model().properties().childs().paneProperties.childs().legendProperties.childs(),a=[o.showSeriesTitle,o.showStudyTitles];for(const e of a)e.subscribe(this,(()=>{this._isTitleHidden.setValue(this._getTitleHiddenValue())}));const n=[o.showSeriesOHLC,o.showBarChange,o.showStudyValues,o.showLastDayChange,o.showSeriesLegendCloseOnMobile];for(const e of n)e.subscribe(this,(()=>{this._isValuesHidden.setValue(this._getValuesHiddenValue())}));this.update()}destroy(){super.destroy();const e=this._model.model().properties().childs().paneProperties.childs().legendProperties.childs();e.showSeriesTitle.unsubscribeAll(this),e.showStudyTitles.unsubscribeAll(this),e.showSeriesOHLC.unsubscribeAll(this),e.showBarChange.unsubscribeAll(this),e.showStudyValues.unsubscribeAll(this),e.showLastDayChange.unsubscribeAll(this),e.showSeriesLegendCloseOnMobile.unsubscribeAll(this),this._isAbleShowSourceCodeInner.destroy()}error(){return this._error.readonly()}isAbleShowSourceCode(){return this._isAbleShowSourceCode}onRemoveSource(){if(this._source.isUserDeletable()){if((0,Ns.isStudy)(this._source)&&this._source.hasChildren()){const e=this._source.getAllChildren().map((e=>e.name(!0)));(0,zs.showDeleteStudyTreeConfirm)(e,this._model.removeSource.bind(this._model,this._source,!1))}else this._model.removeSource(this._source,!1);pt("Remove sources")}}async onShowSourceCode(){0}setGlobalVisibility(e){this._globalVisibility.setValue(e)}globalVisibility(){return this._globalVisibility.readonly()}getFullTitle(){return this._titles.value().map((e=>vt(e)?e.items.map((e=>e.title)).join(" "):e.title)).join(" ")}getSource(){return this._source}_updateTitles(){const e=(0,o.ensureNotNull)(this._source.statusView()),t=e.getSplitTitle(),s=[],i=(0,ds.clean)(t[0],!0);if(""!==i){const t=this._getChangeSymbolCallback();s.push({title:i,id:t?8:7,tooltip:t?ii:e.titleTooltip(),onClick:t})}const l=[];(e.getInputsTitles()??[]).forEach((e=>{const t=(0,ds.clean)(e.value,!0);""!==t&&l.push({title:t,tooltip:e.title,id:9})})),0!==l.length&&s.push({id:9,items:l}),this._titles.setValue(s)}_updateValues(){ const e=this._source.legendView();if(null===e)return;if(0===e.items().length)return;const t=this._values.value();if(0===t.length){const t=e.items().map((e=>({value:new r.WatchedValue(e.value()),color:new r.WatchedValue(St(e.color())),visible:new r.WatchedValue(e.visible()),unimportant:new r.WatchedValue(e.unimportant()),title:new r.WatchedValue(e.title())})));this._values.setValue(t)}else{const s=e.items();for(let e=0;e{let t=null;const s=t=(0,Gs.loadNewSymbolSearch)().then((async i=>{if(s!==t)return;const l=e.symbol(),o=p.enabled("use_symbol_name_for_header_toolbar")?e.symbolInfo()?.name??(0,Pt.safeShortName)(l):(0,Pt.safeShortName)(l),a="spread"===e.symbolInfo()?.type,n="option"===e.symbolInfo()?.type,r=e.symbolInfo()?.pro_name;let d=a?l:o||l||"";if(p.enabled("symbol_search_option_chain_selector")&&n&&r){const e=await resolveUnderlyingSymbol(r);e&&(d={type:"option",value:r,underlying:e})}const u=(0,Zs.getSymbolSearchCompleteOverrideFunction)();i.showSymbolSearchItemsDialog({onSearchComplete:t=>{u(t[0].symbol,t[0].result).then((t=>{this._model.setSymbol(e,t.symbol)}))},dialogTitle:ii,defaultValue:d,enableOptionsChain:p.enabled("symbol_search_option_chain_selector"),showSpreadActions:p.enabled("show_spread_operators")&&p.enabled("studies_symbol_search_spread_operators")})}))}),this._changeSymbolCallback}async _updateAbleShowSourceCode(){0}_updateVisibilityPineAction(e){null!==this._pineActionVisible&&(this._pineActionVisible.setValue(e),this._isAbleShowSourceCode.setValue(e))}_createActions(){if(!this._options.readOnlyMode){if(this._pineActionVisible=new r.WatchedValue(!1),this._pineAction={icon:new Map([["large",Ks],["small",$s]]),action:(0,at.wrapHandlerWithPreventEvent)(this.onShowSourceCode.bind(this)),disableAccessibility:!0,visible:this._pineActionVisible.readonly(),title:new r.WatchedValue(Ys),dataset:{name:"legend-pine-action"}},li){ const e=new r.WatchedValue(!this._getDisabledOnIntervalState()),t={icon:new Map([["large",Ws],["small",xs]]),action:(0,at.wrapHandlerWithPreventEvent)(this.onToggleDisabled.bind(this)),visible:e.readonly(),className:Rt.eye,title:new r.WatchedValue(this._getEyeTitle()),dataset:{name:"legend-show-hide-action"}};this._actions.push(t),this._disabled.subscribe((()=>{t.title?.setValue(this._getEyeTitle())}));const s=new r.WatchedValue(this._getDisabledOnIntervalState()),i={icon:new Map([["large",Ws],["small",xs]]),action:(0,at.wrapHandlerWithPreventEvent)(this.onShowSettings.bind(this,fs.TabNames.visibility)),visible:s.readonly(),className:Rt.intervalEye,title:new r.WatchedValue(si),dataset:{name:"legend-interval-show-hide-action"}};this._actions.push(i),this._disabledOnInterval.subscribe((t=>{s.setValue(t),e.setValue(!t)}))}if(oi&&ai&&(!(0,Ns.isStudy)(this._source)||new Fs.MetaInfoHelper(this._source.metaInfo()).hasUserEditableOptions())){const e=new r.WatchedValue(this._getIsEditable()),t={icon:new Map([["large",Qs],["small",js]]),action:(0,at.wrapHandlerWithPreventEvent)((()=>this.onShowSettings())),visible:e.readonly(),title:new r.WatchedValue(Js),dataset:{name:"legend-settings-action"}};this._actions.push(t),this._isEditable.subscribe((t=>{e.setValue(t)}))}if(ni){const e=new r.WatchedValue(this._getIsEditable()),t={icon:new Map([["large",qs],["small",Xs]]),action:(0,at.wrapHandlerWithPreventEvent)(this.onRemoveSource.bind(this)),visible:e.readonly(),title:new r.WatchedValue(ei),dataset:{name:"legend-delete-action"}};this._actions.push(t),this._isEditable.subscribe((t=>{e.setValue(t)}))}this._actions.push({icon:new Map([["large",As],["small",Ls]]),action:this._moreActionHandler.bind(this),visible:this._isEditable.spawn(),title:new r.WatchedValue(ti),dataset:{name:"legend-more-action"}})}}_updateSymbolLogoModel(){if(this._symbolLogoViewModel.value()?.destroy(),p.enabled("show_symbol_logo_for_compare_studies")&&(0,Us.isSymbolSourceWithQuotesProvider)(this._source)){const e=this._model.model().properties().childs().paneProperties.childs().legendProperties.childs(),t=ys(new Vs(this._source),e);this._symbolLogoViewModel.setValue(t)}else this._symbolLogoViewModel.setValue(null)}}var ui=s(41706),ci=s(31269),hi=s(95059),pi=s(87911),_i=s(29242),mi=s(17161),gi=s(14429);function bi(e,t,s){e.setProperty(t,!t.value(),s)} const vi=new ht.TranslatedString("change symbol description visibility",ct.t(null,void 0,s(88167))),Si=new ht.TranslatedString("change open market status visibility",ct.t(null,void 0,s(96227))),wi=new ht.TranslatedString("change chart values visibility",ct.t(null,void 0,s(79637))),yi=new ht.TranslatedString("change last day change visibility",ct.t(null,void 0,s(66307))),fi=new ht.TranslatedString("change bar change visibility",ct.t(null,void 0,s(27426))),Ci=new ht.TranslatedString("change indicator titles visibility",ct.t(null,void 0,s(63050))),Mi=new ht.TranslatedString("change indicator inputs visibility",ct.t(null,void 0,s(75663))),Ei=new ht.TranslatedString("change indicator values visibility",ct.t(null,void 0,s(49583))),Vi=new ht.TranslatedString("change volume values visibility",ct.t(null,void 0,s(96201))),xi=new ht.TranslatedString("change symbol field visibility",ct.t(null,void 0,s(12050))),Wi=ct.t(null,void 0,s(14771)),Li=ct.t(null,void 0,s(25765)),Ai=ct.t(null,void 0,s(45639)),ki=ct.t(null,void 0,s(72423)),Ti=ct.t(null,void 0,s(10842)),Bi=ct.t(null,void 0,s(37644)),Hi=ct.t(null,void 0,s(7511)),Pi=ct.t(null,void 0,s(33828)),Di=ct.t(null,void 0,s(51353)),Ii=ct.t(null,void 0,s(23079)),Ri=(0,_i.appendEllipsis)(ct.t(null,void 0,s(32514))),Oi=p.enabled("symbol_info_price_source"),Ni=(e,t)=>e?e.dataset[t]?e.dataset[t]:e.parentElement?Ni(e.parentElement,t):null:null;s(88145);var zi=s(22166),Fi=s(1445);class Ui{constructor(e){this._source=e,this._fullSessionScheduleViewModel=new zi.FullSessionScheduleViewModel(e)}destroy(){this._fullSessionScheduleViewModel.destroy()}renderer(e,t){const s=this._source.marketStatusModel()?.status().value();return"expired"===s||"delisted"===s?null:(0,w.createElement)(Fi.FullSessionScheduleRenderer,{key:e,className:t,showAllDays:void 0,sessionDays:this._fullSessionScheduleViewModel.sessionsDays,now:this._fullSessionScheduleViewModel.currentTimeValue(),timezone:this._fullSessionScheduleViewModel.timezone()})}updateSource(e){this._source=e,this._fullSessionScheduleViewModel.destroy(),this._fullSessionScheduleViewModel=new zi.FullSessionScheduleViewModel(e)}}var Gi=s(58978),Zi=s(91682),ji=s(55014);class Qi{constructor(e){this.isBlinkingMode=new r.WatchedValue(!1),this._status=new r.WatchedValue(null),this._fullTooltip=new r.WatchedValue(null),this._iconClassNames=new r.WatchedValue(null),this._visible=new r.WatchedValue(!1),this._destroyed=!1,this._tooltip=new r.WatchedValue(null),this._icon=new r.WatchedValue(null),this._className=new r.WatchedValue(null),this._customColor=new r.WatchedValue(null),this._infoMaps=e,this._size=e.size||"small",this._status.subscribe(this._updateByStatus.bind(this),{callWithLast:!0})}destroy(){this._destroyed=!0}turnOffBlinkingMode(){}status(){return this._status}tooltip(){return this._tooltip}icon(){return this._icon}className(){return this._className}visible(){return this._visible}size(){return this._size}fullInfo(){return this._fullTooltip}customColor(){return this._customColor}_getTooltip(e){return this._infoMaps.tooltipMap?.get(e)??null}_getIcon(e){ let t;const s=this._infoMaps.iconMap.get(e);return void 0!==s&&(t=s.get(this._size)),t||null}_getClassName(e){return this._infoMaps.classNameMap.get(e)||null}_getFullTooltipIconClassNames(e){const t=this._getClassName(e);return t?[A.statusItem,t]:[]}_getTitle(e){return this._infoMaps.titleMap?.get(e)??null}_getTitleColor(e){return this._infoMaps.titleColorMap?.get(e)??null}_getAction(e){return this._infoMaps.actionMap?.get(e)??null}_getHTML(e){return this._infoMaps.htmlMap?.get(e)?.map(Zi.htmlEscape)??[]}async _updateFullTooltip(){const e=this._status.value();null!==e?this._fullTooltip.setValue([{icon:this._getIcon(e),iconClassName:this._getFullTooltipIconClassNames(e),title:this._getTitle(e),titleColor:this._getTitleColor(e),html:this._getHTML(e),size:this._size,action:this._getAction(e),dataQaId:this._dataQaId()??void 0}]):this._fullTooltip.setValue(null)}_dataQaId(){return null}_updateByStatus(e){if(null===e||this._shouldBeHiddenByStatus(e))return this._icon.setValue(null),this._tooltip.setValue(null),void this._visible.setValue(!1);this._icon.setValue(this._getIcon(e)),this._className.setValue(this._getClassName(e)),this._tooltip.setValue(this._getTooltip(e)),this._visible.setValue(!0),this._updateFullTooltip()}_shouldBeHiddenByStatus(e){return!1}}var $i=s(12646),Ki=s(31233),Xi=s(55593),qi=s(69410),Ji=s(52828),Yi=s(91665),el=s(39379),tl=s(38373),sl=s(79304),il=s(21672),ll=s(92315);const ol=new Map([["small",$i],["medium",Ki],["large",Ki]]),al=new Map([["small",Xi],["medium",qi],["large",qi]]),nl=new Map([["small",Ji],["medium",Yi],["large",Yi]]),rl=(new Map([["small",el],["medium",el],["large",el]]),new Map([["small",""],["medium",""],["large",""]]),new Map([["small",""],["medium",""],["large",""]]),new Map([["small",tl],["medium",sl],["large",sl]]),new Map([["small",""],["medium",""],["large",""]]),new Map([["small",il],["medium",ll],["large",ll]]),new Map([["small",""],["medium",""],["large",""]]),new Map([["small",""],["medium",""],["large",""]]),new Map([["small",""],["medium",""],["large",""]]),Gi.colorsPalette["color-delay-mode"]),dl=Gi.colorsPalette["color-eod-mode"],ul=Gi.colorsPalette["color-notaccurate-mode"],cl=(Gi.colorsPalette["color-primary-symbol"],Gi.colorsPalette["color-halal"],Gi.colorsPalette["color-continuous"],Gi.colorsPalette["color-data-problem"],Gi.colorsPalette["color-data-problem"],Gi.colorsPalette["color-market-expired"],Gi.colorsPalette["color-grapes-purple-400"],Gi.colorsPalette["color-ripe-red-600"],Gi.colorsPalette["color-container-fill-primary-neutral-heavy"],ct.t(null,void 0,s(43348))),hl=ct.t(null,void 0,s(5805)),pl=ct.t(null,void 0,s(91006)),_l=(ct.t(null,void 0,s(58796)),ct.t(null,void 0,s(55154))),ml=(ct.t(null,void 0,s(44138)),ct.t(null,void 0,s(94972)),ct.t(null,void 0,s(95246)),ct.t(null,void 0,s(50035)),ct.t(null,void 0,s(19481)),ct.t(null,void 0,s(75119)),ct.t(null,void 0,s(67607)),ct.t(null,void 0,s(84484)),(e,t)=>(0,Zi.htmlEscape)(ct.t(null,{plural:"{symbolName} data is delayed by {time} minutes because of exchange requirements.",count:t,replace:{symbolName:e, time:t.toString()}},s(81227)))),gl=(0,Zi.htmlEscape)(ct.t(null,void 0,s(51211))),bl=(0,Zi.htmlEscape)(ct.t(null,void 0,s(7281))),vl=(0,Zi.htmlEscape)(ct.t(null,void 0,s(20987))),Sl=(0,Zi.htmlEscape)(ct.t(null,void 0,s(65370))),wl=(0,Zi.htmlEscape)(ct.t(null,void 0,s(38368))),yl=(0,Zi.htmlEscape)(ct.t(null,void 0,s(33039))),fl=(0,Zi.htmlEscape)(ct.t(null,void 0,s(23998))),Cl=(0,Zi.htmlEscape)(ct.t(null,void 0,s(97555))),Ml=ct.t(null,void 0,s(31539)),El=(ct.t(null,{context:'Part of: "Real-time data for {symbolName} is provided by {exchange} exchange."'},s(48473)),ct.t(null,{context:'Part of: "Real-time data for {symbolName} is provided by {exchange} exchange."'},s(84455)),ct.t(null,void 0,s(24669))),Vl=ct.t(null,void 0,s(52668)),xl=ct.t(null,void 0,s(44492)),Wl=(ct.t(null,void 0,s(40225)),ct.t(null,void 0,s(71847)),ct.t(null,void 0,s(39664)),ct.t(null,void 0,s(72723)),ct.t(null,void 0,s(25608)),ct.t(null,void 0,s(33161)),ct.t(null,void 0,s(99452)),ct.t(null,void 0,s(90589)),ct.t(null,void 0,s(43383)),ct.t(null,void 0,s(14181)),ct.t(null,void 0,s(36236)),ct.t(null,void 0,s(84937)),ct.t(null,void 0,s(34987)),ct.t(null,void 0,s(59269)),ct.t(null,void 0,s(1356)),ct.t(null,void 0,s(96341)),ct.t(null,void 0,s(42457))),Ll=ct.t(null,void 0,s(50277));ct.t(null,void 0,s(5888));var Al=s(50888),kl=s(1765);const Tl="tv.alreadyBlinkedStatuses",Bl=[];function Hl(){return kl.getJSON(Tl,Bl)}const Pl=new r.WatchedValue(Hl());function Dl(e){const t=kl.getJSON(Tl,Bl);t.includes(e)||(t.push(e),kl.setJSON(Tl,t),Pl.setValue(Hl()))}kl.onSync.subscribe(null,(()=>Pl.setValue(Hl())));const Il=Pl;var Rl=s(39058);const Ol=(0, Cs.getLogger)("Chart.LegendWidget"),Nl=["TFEXDelayForGuest","MILDelayForGuest","NGMDelayForGuest","DEForGuest","ICESGDelayForGuest","TAIFEXDelayForGuest","TURQUOISEDelayForGuest","ADXDelayForGuest","TRADEGATEDelayForGuest","LUXSEDelayForGuest","NSENGDelayForGuest","FINRADelayForGuest","AQUISDelayForGuest"],zl=new Map([["DelayToRealtime",ol],["DelayNoRealtime",ol],["TFEXDelayForGuest",ol],["MILDelayForGuest",ol],["NGMDelayForGuest",ol],["ICESGDelayForGuest",ol],["TAIFEXDelayForGuest",ol],["TURQUOISEDelayForGuest",ol],["ADXDelayForGuest",ol],["TRADEGATEDelayForGuest",ol],["LUXSEDelayForGuest",ol],["NSENGDelayForGuest",ol],["FINRADelayForGuest",ol],["AQUISDelayForGuest",ol],["DEForGuest",ol],["EOD",al],["TickByTick",nl],["BATSToRealtime",nl],["OvernightQuotes",nl],["DelayWithoutMarketAgreement",ol]]),Fl=new Map([["DelayToRealtime",A.delay],["DelayNoRealtime",A.delay],["TFEXDelayForGuest",A.delay],["MILDelayForGuest",A.delay],["NGMDelayForGuest",A.delay],["ICESGDelayForGuest",A.delay],["TAIFEXDelayForGuest",A.delay],["TURQUOISEDelayForGuest",A.delay],["ADXDelayForGuest",A.delay],["TRADEGATEDelayForGuest",A.delay],["LUXSEDelayForGuest",A.delay],["NSENGDelayForGuest",A.delay],["FINRADelayForGuest",A.delay],["AQUISDelayForGuest",A.delay],["DEForGuest",A.delay],["EOD",A.eod],["TickByTick",A.notAccurate],["BATSToRealtime",A.notAccurate],["OvernightQuotes",A.notAccurate],["DelayWithoutMarketAgreement",A.delay]]),Ul=new Map([["DelayToRealtime",rl],["DelayNoRealtime",rl],["TFEXDelayForGuest",rl],["MILDelayForGuest",rl],["NGMDelayForGuest",rl],["ICESGDelayForGuest",rl],["TAIFEXDelayForGuest",rl],["TURQUOISEDelayForGuest",rl],["ADXDelayForGuest",rl],["TRADEGATEDelayForGuest",rl],["LUXSEDelayForGuest",rl],["NSENGDelayForGuest",rl],["FINRADelayForGuest",rl],["AQUISDelayForGuest",rl],["DEForGuest",rl],["EOD",dl],["TickByTick",ul],["BATSToRealtime",ul],["OvernightQuotes",ul],["DelayWithoutMarketAgreement",rl]]),Gl=(ct.t(null,void 0,s(28214)),ct.t(null,void 0,s(27741)));(0,Zi.htmlEscape)(ct.t(null,void 0,s(5447)));var Zl;!function(e){e.TooltipSeparator=" · "}(Zl||(Zl={}));class jl extends Qi{constructor(e,t,s){super({iconMap:zl,classNameMap:Fl,titleColorMap:Ul,size:t}),this._dataUpdatedInfo=new r.WatchedValue(null).spawn(),this._onMarketStatusChanged=()=>{this._updateByStatus(this.status().value())},this._options=s,this._model=e,this._dataModeBlinkingStatuses=Il.spawn(),this._dataModeBlinkingStatuses.subscribe(this._updateBlinkingMode.bind(this)),this._options.marketStatus?.subscribe(this._onMarketStatusChanged),this.turnOffBlinkingMode=this._turnOffBlinking.bind(this),this.setModel(e)}destroy(){this._dataUpdatedInfo.destroy(),this._dataModeBlinkingStatuses.destroy(),this._options.marketStatus?.unsubscribe(this._onMarketStatusChanged),this._options.marketStatus?.release(),super.destroy()}setModel(e){if(this._dataUpdatedInfo.destroy(),null===e)return this._model=e,void(this._dataUpdatedInfo=new r.WatchedValue(null).spawn());this._dataUpdatedInfo=e.status().spawn(),this._dataUpdatedInfo.subscribe(this._updateStatus.bind(this),{ callWithLast:!0})}_shouldBeHiddenByStatus(e){const t=this._options.marketStatus?.value();return"expired"===t||"delisted"===t||(!("BATSToRealtime"!==e||!this._model?.isSpread())||super._shouldBeHiddenByStatus(e))}_getTooltip(){const e=this._getShortTexts();return null===e?null:Object.values(e).join(" · ")}async _updateFullTooltip(){const e=this._dataUpdatedInfo.value(),t=this._status.value();if(null===e||null===t)return void this._fullTooltip.setValue(null);const s=this._getShortTexts(),[i,l]=await Promise.all([this._getHtmls(),this._getActions()]);if(e!==this._dataUpdatedInfo.value())return;const o=[];for(const t of e){const e=t.mode;"BATSToRealtime"===e&&this._model?.isSpread()||o.push({icon:this._getIcon(e),iconClassName:this._getFullTooltipIconClassNames(e),title:s&&s[e],titleColor:this._getTitleColor(e),html:i&&i[e],size:this._size,action:l&&l[e]})}this._fullTooltip.setValue(o)}_updateStatus(e){const t=null!==e?e[0].mode:null;this._status.setValue(t??null,!0),this._updateBlinkingMode()}async _getHtmls(){const e=this._dataUpdatedInfo.value();if(null===e||null===this._model)return Promise.resolve(null);const t={},i=this._model.symbolName();let l=null;const o=this._model.listedExchange(),a=this._model.tradedExchange();try{l=await this._model.description()}catch(e){Ol.logError(`Can't get exchange description, reason: ${(0,Rl.errorToString)(e)}`)}for(const n of e){const e=n.mode;if(t[e]=[],["DelayToRealtime","DelayNoRealtime","DelayWithoutMarketAgreement",...Nl].includes(e)&&(t[e].push(ml(i,this._model.time())),this._options.subscriptionFullInfo&&null!==l&&"DelayToRealtime"===e&&t[e].push(bl.format({description:`${l}`})),"DelayNoRealtime"===e&&t[e].push(vl),"DelayWithoutMarketAgreement"===e&&t[e].push(Cl.format({listedExchange:o})),this._options.subscriptionFullInfo&&Nl.includes(e)&&t[e].push(gl.format({listedExchange:o}))),"EOD"===e&&(t[e]=[Sl]),"TickByTick"===e){const i=void 0===n.updatePeriod?wl:(0,Zi.htmlEscape)(ct.t(null,{count:n.updatePeriod,replace:{amount:(n.updatePeriod??1).toString()},plural:"Data on our Basic plan is updated once every {amount} seconds, even if there are more updates on the market."},s(83978))),l=void 0===n.updatePeriod?yl:(0,Zi.htmlEscape)(ct.t(null,{count:n.updatePeriod,replace:{amount:(n.updatePeriod??1).toString()},plural:"Data is updated once every {amount} seconds, even if there are more updates on the market."},s(51931)));t[e].push(this._options.subscriptionFullInfo?i:l),this._options.subscriptionFullInfo&&t[e].push(fl)}if(o!==a&&"BATSToRealtime"===e){const s=(0,Al.isAmexToCboeMigratedSymbol)(o,this._model.proPerm());Al.CRUCIAL_REALTIME_BATS.includes(a)||s?t[e].push(xl.format({exchange:s?"NYSE Arca":o,originalExchange:a})):t[e].push(Ml.format({symbolName:i,exchange:a}),""!==o?(0,Zi.htmlEscape)(Vl).format({exchange:o}):(0,Zi.htmlEscape)(El))}"OvernightQuotes"===e&&t[e].push(Ll)}return Object.keys(t).length>0?t:null}async _getActions(){if(null===this._dataUpdatedInfo.value()||null===this._model)return null;const e={};return Object.keys(e).length>0?e:null} _showSupportDialogForUpdateMode(e){}_getShortTexts(){const e=this._dataUpdatedInfo.value();if(null===e||null===this._model)return null;const t={};for(const i of e){const e=i.mode;if(["DelayToRealtime","DelayNoRealtime",...Nl,"DelayWithoutMarketAgreement"].includes(e)&&(t[e]=cl),"EOD"===e&&(t[e]=hl),"TickByTick"===e){const l=void 0===i.updatePeriod?pl:(0,Zi.htmlEscape)(ct.t(null,{plural:"One update every {amount} seconds",count:i.updatePeriod,replace:{amount:(i.updatePeriod??1).toString()}},s(36050)));t[e]=l}if("BATSToRealtime"===e){const s=this._model.tradedExchange(),i=this._model.listedExchange();t[e]=s!==i?_l.format({exchange:i,originalExchange:s}):s}"OvernightQuotes"===e&&(t[e]=Wl)}return Object.keys(t).length>0?t:null}_updateBlinkingMode(){const e=this._dataUpdatedInfo.value();if(null===e)return;const t=this._dataModeBlinkingStatuses.value();for(const s of e)if(!t.includes(s.mode))return void this.isBlinkingMode.setValue(!0);this.isBlinkingMode.setValue(!1)}_turnOffBlinking(){const e=this._dataUpdatedInfo.value();if(null!==e)for(const t of e)Dl(t.mode)}_goProDialogAction(e,t={},i){return{text:Gl,onClick:()=>{null!==this._model&&createGoProDialog({forceUpgradeBtn:!0,goOnMarkets:!0,customParams:t,upgradeMessage:i||ct.t(null,void 0,s(70032)),feature:e}).then((()=>{trackEvent("Data Warning","Full description visible",e)}))}}}}const Ql=ct.t(null,void 0,s(86158)),$l=new Map([[!0,new Map([["small",tl],["medium",sl],["large",sl]])],[!1,new Map([["small",""],["medium",""],["large",""]])]]),Kl=new Map([[!0,A.dataProblemLow],[!1,null]]),Xl=new Map([[!0,Ql],[!1,null]]),ql=new Map([[!0,Ql],[!1,null]]),Jl=new Map([[!0,Gi.colorsPalette["color-data-problem"]],[!1,null]]);class Yl extends Qi{constructor(e,t,s){super({iconMap:$l,classNameMap:Kl,tooltipMap:Xl,titleMap:ql,titleColorMap:Jl,size:t}),this._dataSourceErrorStatus=new r.WatchedValue(null).spawn(),this._lastError=null,this._options=s,this.setSource(e)}destroy(){this._dataSourceErrorStatus.destroy(),super.destroy()}setSource(e){this._dataSourceErrorStatus.destroy(),this._dataSourceErrorStatus=e.errorStatus().spawn(),this._dataSourceErrorStatus.subscribe(this._updateStatus.bind(this),{callWithLast:!0})}_getTooltip(e){return(e?this._getDataSourceErrorStatusCustomTitle():null)??super._getTooltip(e)}_getTitle(e){return(e?this._getDataSourceErrorStatusCustomTitle():null)??super._getTitle(e)}async _updateFullTooltip(){const e=this._status.value(),t=this._dataSourceErrorStatus.value();null!==e&&null!==t?this._fullTooltip.setValue([{icon:this._getIcon(e),iconClassName:this._getFullTooltipIconClassNames(e),title:this._getTitle(e),titleColor:this._getTitleColor(e),html:void 0===t.stackTrace?[(0,ji.formatStudyError)((0,Zi.htmlEscape)(t.error))]:null,size:this._size,action:this._getAction(e),solutionId:this._options.errorSolution?this._dataSourceErrorStatus.value()?.solutionId:void 0,dataQaId:this._dataQaId()??void 0}]):this._fullTooltip.setValue(null)}_dataQaId(){return"data-source-error-status"}_getAction(e){return null}_updateStatus(e){const t=this._status.value() ;null!==e?(this._status.setValue(!0),t&&this._lastError!==e.error&&this._updateByStatus(!0),this._lastError=e.error):(this._status.setValue(null),this._lastError=null)}_getDataSourceErrorStatusCustomTitle(){return this._dataSourceErrorStatus.value()?.title||null}}const eo=ct.t(null,void 0,s(78992)),to=new Map([["high",new Map([["small",tl],["medium",sl],["large",sl]])],["low",new Map([["small",tl],["medium",sl],["large",sl]])]]),so=new Map([["high",A.dataProblemHigh],["low",A.dataProblemLow]]),io=new Map([["high",eo],["low",eo]]),lo=new Map([["high",Gi.colorsPalette["color-data-problem"]],["low",Gi.colorsPalette["color-data-problem"]]]);class oo extends Qi{constructor(e,t){super({tooltipMap:io,iconMap:to,classNameMap:so,titleMap:io,titleColorMap:lo,size:t}),this._dataProblems=new r.WatchedValue([]).spawn(),this._isDataProblemCritical=new r.WatchedValue(!1),this.setModel(e)}destroy(){this._dataProblems.destroy(),super.destroy()}isDataProblemCritical(){return this._isDataProblemCritical}setModel(e){this._dataProblems.destroy(),null!==e?(this._dataProblems=e.dataProblems().spawn(),this._dataProblems.subscribe(this._updateStatus.bind(this),{callWithLast:!0})):this._dataProblems=new r.WatchedValue([]).spawn()}async _updateFullTooltip(){const e=this.status().value(),t=this._dataProblems.value();if(null===e||0===t.length)return void this._fullTooltip.setValue(null);const s=t.map(((t,s)=>({icon:this._getIcon(e),iconClassName:this._getFullTooltipIconClassNames(e),title:t.title??(0===s?this._getTitle(e):null),titleColor:this._getTitleColor(e),html:[(0,Zi.htmlEscape)(t.text)],size:this._size,action:this._getAction(e)})));this._fullTooltip.setValue(s)}_getTooltip(e){return this._getDataProblemCustomTitle()??super._getTooltip(e)}_getTitle(e){return this._getDataProblemCustomTitle()??super._getTitle(e)}_updateStatus(e){const t=e[0]?.severity??null,s=this._status.value()!==t;this._status.setValue(t),this._isDataProblemCritical.setValue(function(e){return"high"===e}(t)),s||this._updateFullTooltip()}_getDataProblemCustomTitle(){return this._dataProblems.value()?.[0]?.title||null}}class ao extends Qi{constructor(e,t){super(t),this._booleanStatus=new r.WatchedValue(!1).spawn(),this.updateStatus(e)}destroy(){this._booleanStatus.destroy(),super.destroy()}updateStatus(e){this._booleanStatus.destroy(),this._booleanStatus=e.spawn(),this._booleanStatus.subscribe(this._updateStatus.bind(this),{callWithLast:!0})}_updateStatus(e){e?this._status.setValue(!0):this._status.setValue(null)}}const no=ct.t(null,void 0,s(52969)),ro=ct.t(null,void 0,s(53272)),uo=new Map([[!0,new Map([["small",tl],["medium",sl],["large",sl]])],[!1,new Map([["small",""],["medium",""],["large",""]])]]),co=new Map([[!0,A.invalidSymbol],[!1,null]]),ho=new Map([[!0,no],[!1,null]]),po=new Map([[!0,no],[!1,null]]),_o=new Map([[!0,Gi.colorsPalette["color-invalid-symbol"]],[!1,null]]),mo=new Map([[!0,[ro]],[!1,null]]),go=new Map([[!0,null],[!1,null]]);class bo{constructor(e,t){this.isBlinkingMode=new r.WatchedValue(!1),this._status=new r.WatchedValue(null),this._size="small", this._fullInfo=new r.WatchedValue(null),this._className=new r.WatchedValue(A.marketStatusCustom),this._symbolModel=null,this._symbol=null,this._tooltip=new r.WatchedValue(null),this._icon=new r.WatchedValue(null),this._visible=new r.WatchedValue(!1),this._color=new r.WatchedValue(null),this._updateVisibleCallback=this._updateVisible.bind(this),this._updateColorCallback=this._updateColor.bind(this),this._updateIconCallback=this._updateIcon.bind(this),this._updateTooltipCallback=this._updateTooltip.bind(this),this._updateFullInfoCallback=this._updateFullInfo.bind(this),this._model=e,this._size=t}turnOffBlinkingMode(){}destroy(){}setModel(e){this._model=e}setSymbol(e){e!==this._symbol&&(this._unSyncModel(),this._symbol=e,e?(this._symbolModel=this._model.getSymbolCustomStatus(e),this._syncModel()):this._symbolModel=null)}status(){return this._status.spawn()}tooltip(){return this._tooltip.spawn()}icon(){return this._icon.spawn()}className(){return this._className.spawn()}visible(){return this._visible.spawn()}size(){return this._size}fullInfo(){return this._fullInfo.spawn()}customColor(){return this._color.spawn()}_updateFullInfo(e){if(null===e)return void this._fullInfo.setValue(null);const t=e.map((e=>({icon:e.icon??this.icon().value(),iconClassName:[A.marketStatusCustom],title:e.title,titleColor:e.color??this.customColor().value(),html:e.content,size:this.size(),action:this._buildAction(e.action)})));this._fullInfo.setValue(t)}_buildAction(e){return e&&e.onClick?{text:e.text??"",tooltip:e.tooltip,onClick:e.onClick}:null}_unSyncModel(){this._symbolModel&&(this._symbolModel.visible().unsubscribe(this._updateVisibleCallback),this._symbolModel.color().unsubscribe(this._updateColorCallback),this._symbolModel.icon().unsubscribe(this._updateIconCallback),this._symbolModel.tooltip().unsubscribe(this._updateTooltipCallback),this._symbolModel.tooltipContent().unsubscribe(this._updateFullInfoCallback))}_syncModel(){this._visible.setValue(this._symbolModel?.visible().value()??!1),this._color.setValue(this._symbolModel?.color().value()??null),this._icon.setValue(this._symbolModel?.icon().value()??null),this._tooltip.setValue(this._symbolModel?.tooltip().value()??null),this._updateFullInfo(this._symbolModel?.tooltipContent().value()??null),this._symbolModel&&(this._symbolModel.visible().subscribe(this._updateVisibleCallback),this._symbolModel.color().subscribe(this._updateColorCallback),this._symbolModel.icon().subscribe(this._updateIconCallback),this._symbolModel.tooltip().subscribe(this._updateTooltipCallback),this._symbolModel.tooltipContent().subscribe(this._updateFullInfoCallback))}_updateVisible(e){this._visible.setValue(e)}_updateColor(e){this._color.setValue(e)}_updateIcon(e){this._icon.setValue(e)}_updateTooltip(e){this._tooltip.setValue(e)}}var vo=s(68028),So=s(53218),wo=s(32140),yo=s(62998),fo=s(25230),Co=s(15507),Mo=s(43401),Eo=s(85290),Vo=s(12462) ;const xo=ct.t(null,void 0,s(80086)),Wo=ct.t(null,void 0,s(36018)),Lo=ct.t(null,void 0,s(73897)),Ao=ct.t(null,void 0,s(62464)),ko=ct.t(null,void 0,s(87845)),To=ct.t(null,void 0,s(29938)),Bo=ct.t(null,void 0,s(65420)),Ho=ct.t(null,void 0,s(23302)),Po=ct.t(null,void 0,s(52176)),Do=ct.t(null,void 0,s(41392)),Io=ct.t(null,void 0,s(59938)),Ro=ct.t(null,void 0,s(99822)),Oo=ct.t(null,void 0,s(66595)),No=ct.t(null,void 0,s(43094)),zo=ct.t(null,void 0,s(81509)),Fo=ct.t(null,void 0,s(58470)),Uo=new Map([["market",new Map([["small",wo],["medium",yo],["large",yo]])],["pre_market",new Map([["small",Eo],["medium",Vo],["large",Vo]])],["post_market",new Map([["small",Co],["medium",Mo],["large",Mo]])],["out_of_session",new Map([["small",So],["medium",So],["large",So]])],["holiday",new Map([["small",fo],["medium",fo],["large",fo]])]]),Go=new Map([["market",A.marketStatusOpen],["pre_market",A.marketStatusPre],["post_market",A.marketStatusPost],["out_of_session",A.marketStatusClose],["holiday",A.marketStatusHoliday]]),Zo=new Map([["market",xo],["pre_market",Wo],["post_market",Lo],["out_of_session",Ao],["holiday",ko]]),jo=new Map([["market",xo],["pre_market",Wo],["post_market",Lo],["out_of_session",Ao],["holiday",ko]]),Qo=new Map([["market",Gi.colorsPalette["color-market-open"]],["pre_market",Gi.colorsPalette["color-pre-market"]],["post_market",Gi.colorsPalette["color-post-market"]],["out_of_session",Gi.colorsPalette["color-market-closed"]],["holiday",Gi.colorsPalette["color-market-holiday"]]]),$o=new Map([["market",To],["pre_market",Bo],["post_market",Ho],["out_of_session",Po],["holiday",Do]]);const Ko=Uo,Xo=Go,qo=Zo,Jo=jo,Yo=Qo,ea=$o;function ta(e){const t=Math.floor(e/86400),i=Math.floor((e-86400*t)/3600),l=Math.floor((e-86400*t-3600*i)/60);if(0===t&&0===i&&0===l)return Io;if(t>0){const e=ct.t(null,{plural:"{number} days",count:t,replace:{number:`${t}`},context:"Market opens in n days and n hours"},s(62218)),l=ct.t(null,{plural:"{number} hours",count:i,replace:{number:`${i}`},context:"Market opens in n days and n hours"},s(65463));return ct.t(null,{replace:{days:e,hours:l}},s(51320))}if(i>0){const e=ct.t(null,{plural:"{number} hours",count:i,replace:{number:`${i}`},context:"Market opens in n hours and n minutes"},s(28993)),t=ct.t(null,{plural:"{number} minutes",count:l,replace:{number:`${l}`},context:"Market opens in n hours and n minutes"},s(82796));return ct.t(null,{replace:{hours:e,minutes:t}},s(90549))}return ct.t(null,{plural:"{number} minutes",count:l,replace:{number:`${l}`,context:"Market opens in n minutes"}},s(32547))}const sa={market:e=>("post_market"===e.status?zo:No).format({remainingTime:ta(e.remainingSeconds)}),pre_market:e=>Oo.format({remainingTime:ta(e.remainingSeconds)}),post_market:e=>No.format({remainingTime:ta(e.remainingSeconds)}),out_of_session:e=>("pre_market"===e.status?Fo:Ro).format({remainingTime:ta(e.remainingSeconds)}),holiday:e=>("pre_market"===e.status?Fo:Ro).format({remainingTime:ta(e.remainingSeconds)}),delisted:e=>"",expired:e=>"" },ia=new Map([["market",null],["pre_market",null],["post_market",null],["out_of_session",null],["holiday",null],["delisted",null]]);class la extends Qi{constructor(e,t,s=!1){super({tooltipMap:qo,iconMap:Ko,classNameMap:Xo,titleMap:Jo,titleColorMap:Yo,actionMap:ia,size:t}),this._model=null,this._expiredStatus=null,this._marketStatus=new r.WatchedValue(null).spawn(),this._sessionEdge=new r.WatchedValue(null).spawn(),this._ignoreHideStatusSettings=s,this.setModel(e),pi.showMarketOpenStatusProperty.subscribe(this,this._showMarketOpenStatusPropertyChanged)}destroy(){this._marketStatus.destroy(),this._sessionEdge.destroy(),this._model=null,pi.showMarketOpenStatusProperty.unsubscribeAll(this),super.destroy()}setModel(e){if(this._marketStatus.destroy(),this._sessionEdge.destroy(),this._expiredStatus?.destroy(),null===e)return this._marketStatus=new r.WatchedValue(null).spawn(),this._sessionEdge=new r.WatchedValue(null).spawn(),void(this._expiredStatus=null);this._model=e;const t=e.futuresContractExpirationTime();t&&(this._expiredStatus=t.expired().spawn(),this._expiredStatus.subscribe((e=>{e&&this._updateByStatus(this._marketStatus.value())}))),this._marketStatus=e.status().spawn(),this._marketStatus.subscribe(this._updateStatus.bind(this),{callWithLast:!0}),this._sessionEdge=e.nextSessionEdge().spawn(),this._sessionEdge.subscribe(this._updateTooltip.bind(this)),this._updateTooltip()}async _updateFullTooltip(){const e=this.status().value();if(null===e)return void this._fullTooltip.setValue(null);const t=[],s=ea.get(e);s&&t.push((0,Zi.htmlEscape)(s));const i=this._marketStatus.value();if(null!==this._model&&null!==i&&"expired"!==i&&"delisted"!==i){const s=this._model.nextSessionEdge().value();null!==s&&t.push({text:sa[e](s),bold:!0})}this._fullTooltip.setValue([{icon:this._getIcon(e),iconClassName:this._getFullTooltipIconClassNames(e),title:this._getTitle(e),titleColor:this._getTitleColor(e),html:t,size:this._size,action:this._getAction(e)}])}_shouldBeHiddenByStatus(e){return!this._ignoreHideStatusSettings&&!pi.showMarketOpenStatusProperty.value()&&"market"===e}_updateStatus(e){this._status.setValue(e)}_updateTooltip(){this._updateFullTooltip()}_showMarketOpenStatusPropertyChanged(){this._updateByStatus(this._status.value())}}var oa;!function(e){e.TooltipSeparator=" · "}(oa||(oa={}));class aa{constructor(e){this._size=v.trackingModeIsAvailable?"medium":"small",this._statusViewModelsInfosWV=new lt.WatchedValue([]),this._visibility=new lt.WatchedValue(!1),this._options=e;const t=(0,a.combine)((e=>e.map((e=>(0,a.combine)(((e,t,s)=>e&&t&&Boolean(s)),e.visible.weakReference(),e.model.visible().weakReference(),e.model.icon().weakReference()).ownership()))),this._statusViewModelsInfosWV.weakReference());this._visibleModels=(0,a.accumulate)(((e,t)=>t?this._statusViewModelsInfosWV.value().filter(((t,s)=>e[s]&&t||null)).filter(d.notNull).slice(0,3):[]),t.ownership(),this._visibility.weakReference(),this._statusViewModelsInfosWV.weakReference()),this._visibleModels.subscribe((()=>this._updateVisibility())),this._tooltip=(0, a.accumulate)((e=>e.filter(d.notNull).join(" · ")),(0,a.combine)((e=>e.map((e=>e.model.tooltip().weakReference()))),this._visibleModels.weakReference()).ownership())}destroy(){this._visibility.unsubscribe();for(const e of this._statusViewModelsInfosWV.value()){if(e.additionalWidgets)for(const t of e.additionalWidgets)t.destroy();e.model.destroy(),e.visible.destroy()}this._visibleModels.destroy(),this._tooltip.destroy()}visibility(){return this._visibility.readonly()}visibleModels(){return this._visibleModels}tooltip(){return this._tooltip}_addStatusViewModelsInfos(e){this._statusViewModelsInfosWV.setValue([...this._statusViewModelsInfosWV.value(),e])}}class na extends aa{constructor(e,t,s){super(s),this.dataSourceErrorStatusShown=new r.WatchedValue(!1),this.dataUpdatedModeShown=new r.WatchedValue(!1),this.isSymbolInvalidStatusShown=new r.WatchedValue(!1),this._symbolInvalidViewModel=null,this._dataSourceErrorStatusViewModel=null,this._marketStatusViewModel=null,this._dataUpdatedModeViewModel=null,this._dataProblemViewModel=null,this._updateAvailableViewModel=null,this._alertStatusViewModel=null,this._pineEditorStateViewModel=null,this._activeStrategySourceViewModel=null,this._customStatusViewModel=null,this._sessionWidget=null,this._errorWidget=null,this._updateAvailableWidget=null,this._dataSourceHasErrorVisible=null,this._dataSourceErrorCanBeShown=new r.WatchedValue(!1),this._marketStatusCanBeShown=new r.WatchedValue(!1),this._dataUpdatedAvailableVisible=null,this._dataUpdatedModeCanBeShown=new r.WatchedValue(!1),this._dataProblemCanBeShown=new r.WatchedValue(!1),this._updateAvailableCanBeShown=new r.WatchedValue(!1),this._isDataProblemCritical=null,this._updateVisibility=()=>{const e=this._statusProviderHidden.value()&&0===this.visibleModels().value().length;this._visibility.setValue(!e)},this._source=e,this._symbol=e.symbol()?.spawn()??null,this._options=s,this._undoModel=t,this._statusProviderHidden=e.hidden().spawn(),this._statusProviderHidden.subscribe(this._updateVisibility,{callWithLast:!0}),this._createStatusesWidgetStates(),this._addSubscriptionForSymbolInvalid(),null!==this._dataSourceHasErrorVisible&&(this._dataSourceHasErrorVisible.subscribe(this._updateStatusWidgetsVisibilities.bind(this)),this._dataSourceHasErrorVisible.subscribe(this._updateErrorWidgetIsShown.bind(this))),null!==this._dataUpdatedAvailableVisible&&this._dataUpdatedAvailableVisible.subscribe(this._updateDataUpdatedWidgetIsShown.bind(this)),this._options.dataProblemEnabled&&null!==this._isDataProblemCritical&&this._isDataProblemCritical.subscribe(this._updateStatusWidgetsVisibilities.bind(this)),this._updateErrorWidgetIsShown(),this._updateIsSymbolInvalidStatusShown(),this._updateStatusWidgetsVisibilities()}destroy(){this._statusProviderHidden.destroy(),this._visibility.unsubscribe(),this._symbol?.destroy(),this._isDataProblemCritical?.destroy(),super.destroy()}_updateStatusWidgetsVisibilities(){const e=this._isForceStatusActive();this._dataSourceErrorCanBeShown.setValue(!e),this._marketStatusCanBeShown.setValue(!e), this._dataUpdatedModeCanBeShown.setValue(!e),this._updateAvailableCanBeShown.setValue(!e),this._dataProblemCanBeShown.setValue(!this._isPrimaryWidgetShown())}_isPrimaryWidgetShown(){return this._source.isSymbolInvalid()?.value()??!1}_isForceStatusActive(){return this._isPrimaryWidgetShown()||(this._isDataProblemCritical?.value()??!1)}_createStatusesWidgetStates(){this._options.sourceStatusesEnabled&&this._createSymbolInvalidStatus(),this._options.marketStatusEnabled&&this._createMarketStatus(),this._options.dataUpdateModeEnabled&&this._createDataUpdatedModeStatus(),this._options.dataProblemEnabled&&this._createDataProblemStatus(),this._options.sourceStatusesEnabled&&this._createErrorStatus(),this._options.pineSourceStatusEnabled&&this._createScriptUpdate(),this._options.alertStatusEnabled&&this._createAlertAlertStatus(),this._options.pineSourceStatusEnabled&&this._createActiveStrategyStatus(),this._options.pineSourceStatusEnabled&&this._createPineEditorStatus(),this._createCustomMarketStatus()}_createSymbolInvalidStatus(){const e=this._source.isSymbolInvalid();null!==e&&(this._symbolInvalidViewModel=new ao(e,{tooltipMap:ho,iconMap:uo,classNameMap:co,titleMap:po,titleColorMap:_o,htmlMap:mo,actionMap:go,size:this._size}),this._addStatusViewModelsInfos({visible:this._symbolInvalidViewModel.visible().spawn(),model:this._symbolInvalidViewModel}))}_createMarketStatus(){const e=this._source.marketStatusModel();this._marketStatusViewModel=new la(e,this._size);const t={visible:(0,a.combine)(((e,t,s)=>e&&t&&!(0,hi.isEconomicSymbol)(s)&&!(0,hi.isSpreadSymbolWithManyLegs)(s)),this._marketStatusCanBeShown.weakReference(),this._marketStatusViewModel.visible().weakReference(),this._source.symbolInfo().weakReference()),model:this._marketStatusViewModel};null!==e&&(this._sessionWidget=new Ui(this._source),t.additionalWidgets=[this._sessionWidget]),this._addStatusViewModelsInfos(t)}_createDataUpdatedModeStatus(){const e=this._source.dataUpdatedModeModel(),t={...this._options.dataUpdateMode,marketStatus:this._source.marketStatusModel()?.status().spawnOwnership()};this._dataUpdatedModeViewModel=new jl(e,this._size,t);const s=(0,a.combine)(((e,t,s)=>e&&t&&!(0,hi.isEconomicSymbol)(s)),this._dataUpdatedModeCanBeShown.weakReference(),this._dataUpdatedModeViewModel.visible().weakReference(),this._source.symbolInfo().weakReference());this._addStatusViewModelsInfos({visible:s,model:this._dataUpdatedModeViewModel})}_createDataProblemStatus(){const e=this._source.dataProblemModel();this._dataProblemViewModel=new oo(e,this._size),this._isDataProblemCritical=this._dataProblemViewModel.isDataProblemCritical().spawn();const t=(0,a.combine)(((e,t)=>e&&t),this._dataProblemCanBeShown.weakReference(),this._dataProblemViewModel.visible().weakReference());this._addStatusViewModelsInfos({visible:t,model:this._dataProblemViewModel})}_createScriptUpdate(){}_createAlertAlertStatus(){}_createErrorStatus(){this._dataSourceErrorStatusViewModel=new Yl(this._source,this._size,this._options.sourceStatuses),this._dataSourceHasErrorVisible=(0, a.combine)(((e,t,s)=>e&&t&&!s),this._dataSourceErrorCanBeShown.weakReference(),this._dataSourceErrorStatusViewModel.visible().weakReference(),this._source.hidden().weakReference());this._addStatusViewModelsInfos({visible:this._dataSourceHasErrorVisible,model:this._dataSourceErrorStatusViewModel,additionalWidgets:[]})}_createActiveStrategyStatus(){}_createPineEditorStatus(){}_createCustomMarketStatus(){if(this._source.isMainSeries?.()??!1){const e=vo.CustomStatusModel.getInstance(),t=this._symbol?.value()??null;this._customStatusViewModel=new bo(e,this._size),this._customStatusViewModel.setSymbol(t);const s=this._customStatusViewModel.visible().spawn();this._addStatusViewModelsInfos({visible:s,model:this._customStatusViewModel})}}_addSubscriptionForSymbolInvalid(){const e=this._source.isSymbolInvalid();this._options.sourceStatusesEnabled&&null!==e&&(e.subscribe(this._updateStatusWidgetsVisibilities.bind(this)),e.subscribe(this._updateIsSymbolInvalidStatusShown.bind(this),{callWithLast:!0}))}_updateErrorWidgetIsShown(){const e=this._dataSourceHasErrorVisible?.value()??!1;this.dataSourceErrorStatusShown.setValue(e)}_updateDataUpdatedWidgetIsShown(){const e=this._dataUpdatedAvailableVisible?.value()??!1;this.dataUpdatedModeShown.setValue(e)}_updateIsSymbolInvalidStatusShown(){const e=this._source.isSymbolInvalid()?.value()??!1;this.isSymbolInvalidStatusShown.setValue(e)}}class ra extends na{constructor(e,t,s){super(e,t,s),this._isInReplay=new lt.WatchedValue(!1).readonly().spawn(),this._isInReplayCanBeShown=null,this._inited=!1,this._halalCanBeShown=new lt.WatchedValue(!1),this._tvCalculatedPairCanBeShown=new lt.WatchedValue(!1),this._hkexCommentCanBeShown=new lt.WatchedValue(!1),this._defaultedBondCanBeShown=new lt.WatchedValue(!1);t.model()}destroy(){super.destroy()}_updateStatusWidgetsVisibilities(){super._updateStatusWidgetsVisibilities()}_isPrimaryWidgetShown(){return super._isPrimaryWidgetShown()||this._inited&&this._isInReplay.value()}_crateHalalStatus(){}_createDefaultedBondStatus(){}_createTVCalculatedPairStatus(){}_createHKEXCommentStatus(){}_createLetItSnowStatus(){}_createHalalTypeReleasable(){return new lt.WatchedValue(null).readonly().ownership()}_createDefaultedBondReleasable(){return new lt.WatchedValue(null).readonly().ownership()}_createTvCalculatedPairReleasable(){return new lt.WatchedValue(null).readonly().ownership()}_createHkexCommentReleasable(){return new lt.WatchedValue(null).readonly().ownership()}}var da,ua=s(35107);!function(e){e[e.ForceDisableHiddenStateTimeoutMs=3500]="ForceDisableHiddenStateTimeoutMs"}(da||(da={}));class ca{constructor(e,t){this._hidden=new r.WatchedValue(!1),this._symbol=null,this._isSymbolInvalid=null,this._visibilityCombiner=null,this._symbolInfo=new r.WatchedValue(null).spawn(),this._source=e,e.properties().hasChild("symbol")&&(this._symbol=(0,us.createWVFromGetterAndSubscription)((()=>e.properties().symbol.value()),e.properties().symbol.listeners()));const s=[];if((0,ua.isStudyLineTool)(e))s.push(e.onStatusChanged());else if((0,Ns.isStudy)(e)||(0, Ns.isStudyStub)(e))s.push(e.onStatusChanged(),e.onIsActualIntervalChange()),this._isSymbolInvalid=(0,us.createWVFromGetterAndSubscriptions)((()=>e.isSymbolInvalid()&&e.isActualInterval()),s),(0,Ns.isStudy)(e)?(this._visibilityCombiner=(0,a.combine)(((e,t)=>!e||!t),(0,us.createWVFromGetterAndSubscription)((()=>e.isVisible()),e.properties().childs().visible).ownership(),(0,us.createWVFromGetterAndSubscription)((()=>e.isActualInterval()),e.onIsActualIntervalChange()).ownership()),this._visibilityCombiner.subscribe((e=>this._hidden.setValue(e)),{callWithLast:!0})):this._hidden.setValue(!e.isVisible()||!e.isActualInterval());else{(0,o.assert)(e===t.mainSeries());const i=t.mainSeries();s.push(i.onStatusChanged()),this._isSymbolInvalid=(0,us.createWVFromGetterAndSubscriptions)((()=>i.isSymbolInvalid()),s),this._symbolInfo=(0,us.createWVFromGetterAndSubscription)(i.symbolInfo.bind(i),i.dataEvents().symbolResolved())}this._dataSourceErrorStatus=(0,us.createWVFromGetterAndSubscriptions)((()=>this._source.statusProvider({}).errorStatus()),s)}destroy(){this._symbol?.destroy(),this._isSymbolInvalid?.destroy(),this._dataSourceErrorStatus.destroy(),this._symbolInfo.destroy(),this._visibilityCombiner?.destroy()}entityId(){return this._source.id()}symbol(){return this._symbol}isSymbolInvalid(){return this._isSymbolInvalid}errorStatus(){return this._dataSourceErrorStatus}symbolInfo(){return this._symbolInfo}hidden(){return this._hidden.readonly()}marketStatusModel(){return this._source.marketStatusModel()}dataProblemModel(){return this._source.dataProblemModel()}dataUpdatedModeModel(){return this._source.dataUpdatedModeModel()}async pineSourceCodeModel(){return null}alertSourceModel(){return this._source.alertSourceModel()}isMainSeries(){return this._source.isMainSeries?.()??!1}}class ha extends ca{constructor(e,t){super(e,t),this._quotesData=new r.WatchedValue(null),this._forceDisableHiddenState=new r.WatchedValue(!0),this._forceDisableHiddenStateTimeout=null,this._series=e,this._marketStatus=e.marketStatusModel().status().spawn(),this._marketStatus.subscribe((e=>{null===e&&(null!==this._forceDisableHiddenStateTimeout&&clearTimeout(this._forceDisableHiddenStateTimeout),this._forceDisableHiddenState.setValue(!1),this._forceDisableHiddenStateTimeout=setTimeout((()=>{this._forceDisableHiddenStateTimeout=null,this._forceDisableHiddenState.setValue(!0)}),3500))}),{callWithLast:!0}),this._dataProblems=this._series.dataProblemModel().dataProblems().spawn(),this._marketStatus.subscribe(this._updateHiddenValue.bind(this)),this._dataProblems.subscribe(this._updateHiddenValue.bind(this)),this._forceDisableHiddenState.subscribe(this._updateHiddenValue.bind(this)),e.onStatusChanged().subscribe(this,this._updateHiddenValue),this._updateHiddenValue()}quotesData(){return this._quotesData.readonly().spawn()}destroy(){this._marketStatus.destroy(),this._dataProblems.destroy(),this._series.onStatusChanged().unsubscribeAll(this),null!==this._forceDisableHiddenStateTimeout&&clearTimeout(this._forceDisableHiddenStateTimeout),super.destroy()} _updateHiddenValue(){const e=this._series.status(),t=this._forceDisableHiddenState.value()||12===e||4===e||null!==this._marketStatus.value()&&2!==e&&1!==e||this._dataProblems.value().some((e=>"high"===e.severity));this._hidden.setValue(!t)}}const pa=ct.t(null,void 0,s(10319)),_a=ct.t(null,void 0,s(7681)),ma=ct.t(null,void 0,s(64730)),ga=new Map([[!0,new Map([["small",tl],["medium",sl],["large",sl]])],[!1,new Map([["small",""],["medium",""],["large",""]])]]),ba=new Map([[!0,A.hasError],[!1,null]]),va=new Map([[!0,pa],[!1,null]]),Sa=new Map([[!0,pa],[!1,null]]),wa=new Map([[!0,Gi.colorsPalette["color-invalid-symbol"]],[!1,null]]),ya=new Map([[!0,[_a]],[!1,null]]),fa=new Map([[!0,[ma]],[!1,null]]);function Ca(e){switch(e){case 0:return ya;case 1:return fa;default:throw new Error("Unknown CombinedStatusWidgetType")}}var Ma=s(2588),Ea=s(57979);const Va=ct.t(null,void 0,s(48758)),xa=ct.t(null,void 0,s(89181)),Wa=ct.t(null,void 0,s(92663)),La=new Map([[!0,new Map([["small",Ma],["medium",Ea],["large",Ea]])],[!1,new Map([["small",""],["medium",""],["large",""]])]]),Aa=new Map([[!0,A.updateAvailable],[!1,null]]),ka=new Map([[!0,Va],[!1,null]]),Ta=new Map([[!0,Va],[!1,null]]),Ba=new Map([[!0,Gi.colorsPalette["color-deep-blue-a400"]],[!1,null]]),Ha=new Map([[!0,[xa]],[!1,null]]),Pa=new Map([[!0,[Wa]],[!1,null]]);function Da(e){switch(e){case 0:return Ha;case 1:return Pa;default:throw new Error("Unknown CombinedStatusWidgetType")}}var Ia;!function(e){e[e.Legend=0]="Legend",e[e.Items=1]="Items"}(Ia||(Ia={}));class Ra extends aa{constructor(e,t){super(t),this._dataSourceStatusWidgets=[],this._hasErrorStatus=null,this._hasUpdateStatus=null,this._hasErrorViewModel=null,this._hasUpdateViewModel=null,this._updateVisibility=()=>{const e=0===this.visibleModels().value().length;this._visibility.setValue(!e)},this._type=e}destroy(){this._hasErrorViewModel?.destroy(),this._hasUpdateViewModel?.destroy(),super.destroy()}addStatusWidget(e){this._dataSourceStatusWidgets.push(e),this._recreateHasErrorStatus(),this._recreateHasUpdateStatus(),this._createStatusesWidgetStates()}clear(){this._dataSourceStatusWidgets=[],this._hasErrorStatus?.destroy(),this._hasErrorStatus=null,this._hasUpdateStatus?.destroy(),this._hasUpdateStatus=null}async _createStatusesWidgetStates(){const e=this._hasErrorStatus;null!==e&&(null===this._hasErrorViewModel?(this._hasErrorViewModel=new ao(e,{classNameMap:ba,htmlMap:Ca(this._type),iconMap:ga,size:this._size,titleColorMap:wa,titleMap:Sa,tooltipMap:va}),this._addStatusViewModelsInfos({visible:this._hasErrorViewModel.visible().spawn(),model:this._hasErrorViewModel})):this._hasErrorViewModel.updateStatus(e));const t=this._hasUpdateStatus;null!==t&&(null===this._hasUpdateViewModel?(this._hasUpdateViewModel=new ao(t,{classNameMap:Aa,htmlMap:Da(this._type),iconMap:La,size:this._size,titleColorMap:Ba,titleMap:Ta,tooltipMap:ka}),this._addStatusViewModelsInfos({visible:this._hasUpdateViewModel.visible().spawn(),model:this._hasUpdateViewModel})):this._hasUpdateViewModel.updateStatus(t))}_recreateHasErrorStatus(){ this._hasErrorStatus?.destroy();const e=(0,a.combine)((e=>this._dataSourceStatusWidgets.map((e=>e.dataSourceErrorStatusShown.weakReference()))),new lt.WatchedValue(this._dataSourceStatusWidgets).weakReference());this._hasErrorStatus=(0,a.accumulate)((e=>e.some((e=>e))),e.ownership())}_recreateHasUpdateStatus(){this._hasUpdateStatus?.destroy();const e=(0,a.combine)((e=>this._dataSourceStatusWidgets.map((e=>e.dataUpdatedModeShown.weakReference()))),new lt.WatchedValue(this._dataSourceStatusWidgets).weakReference());this._hasUpdateStatus=(0,a.accumulate)((e=>e.some((e=>e))),e.ownership())}}var Oa=s(22489);const Na={readOnlyMode:!1,contextMenu:{settings:!0,mainSeries:!0,studies:!0,showOpenMarketStatus:!1},symbolMarkerEnabled:!1,showToggleButton:!0,canShowSourceCode:!1,statusesWidgets:{sourceStatusesEnabled:!1,sourceStatuses:{errorSolution:!0},marketStatusEnabled:!1,marketStatus:{preMarketSolution:!0,postMarketSolution:!0},dataUpdateModeEnabled:!1,dataUpdateMode:{subscriptionFullInfo:!0},dataProblemEnabled:!1}};var za;!function(e){e.TogglerStateSettingsKey="legend.isVisibilityToggled",e[e.TextSourceIsAlwaysTickerMaxSize=132]="TextSourceIsAlwaysTickerMaxSize"}(za||(za={}));p.enabled("hide_legend_by_default");const Fa=p.enabled("fundamental_widget"),Ua=p.enabled("legend_context_menu"),Ga=2*parseInt(Rt.marginlegendhoriz);class Za{constructor(e,t,s,i,o,u,c,h){this._mainSeriesViewModel=null,this._dataSourceViewModels=[],this._sourcesIds=[],this._visibleDataSourceCount=new r.WatchedValue(0),this._themedColor=new r.WatchedValue(""),this._mainSeriesRowHidden=null,this._dataSourceRowsHidden=[],this._customWidgetsVisibilities=[],this._allLegendHidden=new r.WatchedValue(!1),this._studiesLegendHidden=new r.WatchedValue(!1),this._showCollapserWithOneIndicator=new r.WatchedValue(!1),this._dataSourcesLoadingStatuses=new r.WatchedValue([]),this._customWidgetsHeights=[],this._onLegendVisibilityToggled=null,this._availableHeight=0,this._collapsedDataSourcesCount=new r.WatchedValue(0),this._collapsedDataSourcesTitle=new r.WatchedValue(""),this._mainSeriesStatusesWidgetState=null,this._dataSourceStatusesWidgetStates=[],this._statusProviders=new Map,this._size=null,this._customLegendWidgetsFactoriesMap=new Map,this._customLegendWidgetsMap=new Map,this._margin=0,this._layoutChanged=new n.Delegate,this._model=e,this._paneWidget=t,this._options=(0,d.merge)((0,d.clone)(Na),c),this._callbacks=h,this._mainSeriesViewModelsOptions={readOnlyMode:this._options.readOnlyMode,symbolMarkerEnabled:this._options.symbolMarkerEnabled},this._dataSourceViewModelsOptions={...this._mainSeriesViewModelsOptions,canShowSourceCode:this._options.canShowSourceCode},this._backgroundThemeName=s;const p=this._showLegendCalculatedProperty();this._isDataSourcesCollapsed=new r.WatchedValue(p.value()),p.subscribe(this,(()=>{this._isDataSourcesCollapsed.setValue(p.value())}));const _=new r.WatchedValue(this._getCustomTextColorValue()),m=this._model.model().properties().childs();m.scalesProperties.childs().textColor.subscribe(this,(()=>{ _.setValue(this._getCustomTextColorValue())}));const g=m.paneProperties.childs().legendProperties.childs().showBackground,b=new r.WatchedValue(g.value());g.subscribe(this,(()=>{b.setValue(g.value())}));const v=m.paneProperties.childs().legendProperties.childs().backgroundTransparency,S=new r.WatchedValue(v.value());v.subscribe(this,(()=>{S.setValue(v.value())})),this._hideNotMainSources=i,this._hideNotMainSources.subscribe(this._updateLegendVisibilities.bind(this)),this._hideAllExceptFirstLine=o,this._hideAllExceptFirstLine.subscribe(this._updateCollapsedSourcesMode.bind(this)),this._hideWholeLegend=u,this._hideWholeLegend.subscribe(this._updateLegendVisibilities.bind(this)),this._isPaneMain=new r.WatchedValue(this._getIsPaneMainValue()),this._updateCollapsedSourcesModeThrottle=(0,l.default)(this._updateCollapsedSourcesMode.bind(this),100),this._isPaneMain.subscribe((e=>this._showCollapserWithOneIndicator.setValue(e)),{callWithLast:!0}),this._collapsedStatusesWidgetState=new Ra(1,this._options.statusesWidgets),this._toggledStatusesWidgetState=new Ra(0,this._options.statusesWidgets),this._hasLoadingDataSources=(0,a.accumulate)(((e,t)=>{const s=e.some(Boolean);return[s,!!s&&e.includes(!0,-t)]}),this._dataSourcesLoadingStatuses.weakReference(),this._collapsedDataSourcesCount.weakReference()),this._renderer=new rs({isMultipleLayout:this._model.isMultipleLayout(),withActions:!this._options.readOnlyMode,showToggleButton:this._options.showToggleButton,isStudiesLegendHidden:this._studiesLegendHidden.readonly(),isAllLegendHidden:this._allLegendHidden.readonly(),customTextColor:_.readonly(),themedColor:this._themedColor.readonly(),showBackground:b.readonly(),backgroundTransparency:S.readonly(),collapsedDataSourcesCount:this._collapsedDataSourcesCount.readonly(),collapsedDataSourcesTitle:this._collapsedDataSourcesTitle.readonly(),combinedStatusesWidgetState:this._collapsedStatusesWidgetState,showLegendWidgetContextMenu:this.onShowLegendWidgetContextMenu.bind(this),hideAllExceptFirstLine:this._hideAllExceptFirstLine,onLegendRowFocused:this._callbacks.onLegendRowFocused,onLayoutChanged:this._layoutChanged,hasLoadingDataSources:this._hasLoadingDataSources},{showCollapserWithOneIndicator:this._showCollapserWithOneIndicator.readonly(),visibleDataSourceCount:this._visibleDataSourceCount.readonly(),isDataSourcesCollapsed:this._isDataSourcesCollapsed.readonly(),hasLoadingDataSources:this._hasLoadingDataSources,isMainPane:this._isPaneMain.readonly(),onCollapseDataSources:this.onCollapseDataSources.bind(this),onShowObjectsTreeDialog:this._callbacks.showObjectsTreeDialog,isPaneCollapsed:this._paneWidget.visuallyCollapsed(),combinedStatusesWidgetState:this._toggledStatusesWidgetState})}destroy(){this._hasLoadingDataSources.destroy(),this._backgroundThemeName.release(),this._hideNotMainSources.release(),this._hideAllExceptFirstLine.release(),this._hideWholeLegend.release(),this._sourcesIds=[],null!==this._mainSeriesViewModel&&this._destroyMainDataSource();for(const[,e]of this._statusProviders)e.destroy() ;for(const e of this._dataSourceViewModels)e.destroy();this._dataSourceViewModels=[],this._collapsedStatusesWidgetState.destroy(),this._toggledStatusesWidgetState.destroy();for(const e of this._dataSourceStatusesWidgetStates)e.destroy();this._dataSourceStatusesWidgetStates=[],this._clearSubscriptions();for(const e of Array.from(this._customLegendWidgetsMap.keys()))this._destroyCustomWidgetFromLayerBlock(e);this._customLegendWidgetsMap.clear(),this._renderer.destroy(),delete this._renderer,this._showLegendCalculatedProperty().unsubscribeAll(this),this._showLegendOriginalProperty().unsubscribeAll(this);const e=this._model.model().properties().childs();e.scalesProperties.childs().textColor.unsubscribeAll(this),e.paneProperties.childs().legendProperties.childs().showBackground.unsubscribeAll(this),e.paneProperties.childs().legendProperties.childs().backgroundTransparency.unsubscribeAll(this),this._dataSourcesLoadingStatuses.setValue([])}addCustomWidgetToLegend(e,t){const s=this._customLegendWidgetsFactoriesMap.get(t.block)||new Map,i=s.get(t.position)||[];i.push(e),s.set(t.position,i),this._customLegendWidgetsFactoriesMap.set(t.block,s),this.updateLayout(),this._updateCustomWidgetModeBySize()}onShowLegendWidgetContextMenu(e,t){if(this._options.readOnlyMode||!Ua)return Promise.resolve();pt("Show legend context menu");const s=new Map;for(const e of Array.from(this._customLegendWidgetsMap.keys())){const t=(0,o.ensureDefined)(this._customLegendWidgetsMap.get(e)),i=new Map;for(const e of Array.from(t.keys())){const s=(0,o.ensureDefined)(t.get(e)),l=i.get(e)||[];for(const e of s)l.push(...e.contextMenuActions());i.set(e,l)}s.set(e,i)}return function(e,t,s,i,l,o){const a=[],n=i.get(0);if(void 0!==n){const e=n.get(1);void 0!==e&&e.length>0&&(a.push(...e),a.push(new ui.Separator))}const r=e.model().properties().childs().paneProperties.childs().legendProperties.childs(),d=Oi&&e.model().symbolSources().some((e=>void 0!==e.symbolInfo()?.price_source_id));a.push(new ui.Action({actionId:"Chart.Legend.ToggleSymbolVisibility",options:{checkable:!0,checked:r.showSeriesTitle.value(),label:Wi,statName:"Show/Hide Symbol",onExecute:()=>bi(e,r.showSeriesTitle,vi)}})),t.showOpenMarketStatus&&"market"===e.mainSeries().marketStatusModel().status().value()&&!(0,hi.isEconomicSymbol)(e.mainSeries().symbolInfo())&&a.push(new ui.Action({actionId:"Chart.Legend.ToggleOpenMarketStatusVisibility",options:{checkable:!0,checked:pi.showMarketOpenStatusProperty.value(),label:Li,statName:"Show/Hide Open market status",onExecute:()=>bi(e,pi.showMarketOpenStatusProperty,Si)}})),a.push(new ui.Action({actionId:"Chart.Legend.ToggleOhlcValuesVisibility",options:{checkable:!0,checked:r.showSeriesOHLC.value(),label:Ai,statName:"Show/Hide chart values",onExecute:()=>bi(e,r.showSeriesOHLC,wi)}}));const u=e.mainSeries().style(),c=12!==u&&20!==u;if(c&&!mi.alwaysShowLastPriceAndLastDayChange&&a.push(new ui.Action({actionId:"Chart.Legend.ToggleBarChangeValuesVisibility",options:{checkable:!0,checked:r.showBarChange.value(),label:Ti,statName:"Show/Hide Bar Change Values", onExecute:()=>bi(e,r.showBarChange,fi)}})),20!==u&&a.push(new ui.Action({actionId:"Chart.Legend.ToggleVolumeVisibility",options:{checkable:!0,checked:r.showVolume.value(),label:Bi,statName:"Show/Hide Volume",onExecute:()=>bi(e,r.showVolume,Vi)}})),c&&(mi.lastDayChangeAvailable||mi.alwaysShowLastPriceAndLastDayChange)){const t=mi.alwaysShowLastPriceAndLastDayChange?r.showBarChange:r.showLastDayChange;a.push(new ui.Action({actionId:"Chart.Legend.ToggleLastDayChangeValuesVisibility",options:{checkable:!0,checked:t.value(),label:ki,statName:"Show/Hide Last day change values",onExecute:()=>bi(e,t,yi)}}))}if(d&&a.push(new ui.Action({actionId:"Chart.Legend.TogglePriceSourceVisibility",options:{checkable:!0,checked:r.showPriceSource.value(),label:Ii,statName:"Show/Hide Price Source",onExecute:()=>bi(e,r.showPriceSource,xi)}})),a.push(new ui.Separator),void 0!==n){const e=n.get(0);void 0!==e&&e.length>0&&(a.push(...e),a.push(new ui.Separator))}const h=i.get(1);if(void 0!==h){const e=h.get(1);void 0!==e&&e.length>0&&(a.push(...e),a.push(new ui.Separator))}if(e.model().priceDataSources().some((e=>!(0,Us.isActingAsSymbolSource)(e)&&e.showInObjectTree()))&&(a.push(new ui.Action({actionId:"Chart.Legend.ToggleIndicatorTitlesVisibility",options:{checkable:!0,checked:r.showStudyTitles.value(),label:Hi,statName:"Show/Hide Indicator Titles",onExecute:()=>bi(e,r.showStudyTitles,Ci)}})),a.push(new ui.Action({actionId:"Chart.Legend.ToggleIndicatorArgumentsVisibility",options:{checkable:!0,checked:r.showStudyArguments.value(),label:Pi,statName:"Show/Hide Indicator Arguments",onExecute:()=>bi(e,r.showStudyArguments,Mi)}})),a.push(new ui.Action({actionId:"Chart.Legend.ToggleIndicatorValuesVisibility",options:{checkable:!0,checked:r.showStudyValues.value(),label:Di,statName:"Show/Hide Indicator Values",onExecute:()=>bi(e,r.showStudyValues,Ei)}}))),void 0!==h){const e=h.get(0);void 0!==e&&e.length>0&&(a.push(...e),a.push(new ui.Separator))}t.settings&&(a[a.length-1]instanceof ui.Separator||a.push(new ui.Separator),a.push(new gi.ActionWithStandardIcon({actionId:"Chart.Dialogs.ShowGeneralSettings.LegendTab",options:{label:Ri,iconId:"Settings",statName:"Settings...",onExecute:()=>s(fs.TabNames.legend)}})));const p=Ni(l.target,"entityId"),_={menuName:"LegendPropertiesContextMenu",detail:{type:p?"study":"series",id:p??"_seriesId"}};return ci.ContextMenuManager.showMenu(a,l,{statName:"LegendContextMenu"},_,o)}(this._model,this._options.contextMenu,this._callbacks.showGeneralChartProperties,s,e,t)}onCollapseDataSources(){const e=this._showLegendOriginalProperty();e.setValue(!e.value())}updateLayout(){const e=this._paneWidget.state().sourcesByGroup().legendViewSources().filter((e=>null!==e.statusView()&&e.isDisplayedInLegend())).reverse(),t=this._sourcesIds,s=this._model.mainSeries(),i=e.indexOf(s);let l;if(-1!==i){if(e.splice(i,1),!Fa&&null===this._mainSeriesViewModel){const e=new Os(this._model,s,this._mainSeriesViewModelsOptions,this._callbacks,this._options.contextMenu);this._mainSeriesViewModel=e ;const t=new ra(this._statusSourceAdapter(s),this._model,this._options.statusesWidgets);this._mainSeriesStatusesWidgetState=t,l={model:e,statusesWidgetState:t}}}else null!==this._mainSeriesViewModel&&(l=null,this._destroyMainDataSource(),this._destroyCustomWidgetFromLayerBlock(0));const a=e.map((e=>e.instanceId()));this._sourcesIds=a;const n=[],r=new Map,d=[],u=[],c=this._dataSourceViewModels,h=this._dataSourceStatusesWidgetStates;let p=t.length-1;for(;p>=0;){const e=t[p],s=a.indexOf(e);if(-1===s){n.push(p),c[p].destroy(),h[p].destroy();const t=this._statusProviders.get(e);t&&(t.destroy(),this._statusProviders.delete(e))}else p!==s&&(r.set(e,{model:c[p],statusesWidgetState:h[p]}),d.push({oldIndex:p,newIndex:s}));p--}const _=[],m=[];for(let s=0;s0&&this._addCustomWidgetForLayerBlock(1),this._updateWidgetModeBySize(),g){this._updateCollapsedSourcesMode(),this._toggledStatusesWidgetState.clear();for(const e of this._dataSourceStatusesWidgetStates)this._toggledStatusesWidgetState.addStatusWidget(e)}}update(){null!==this._mainSeriesViewModel&&this._mainSeriesViewModel.update();for(const e of this._dataSourceViewModels)e.update()}updateThemedColors(e){null===e&&(e=(0,Oa.getStdThemedValue)("chartProperties.paneProperties.background",this._backgroundThemeName.value())),this._themedColor.setValue(e||"")}firstTitle(){return this._renderer.firstTitle()}getElement(){return this._renderer.getElement()}addMargin(e){if(this._margin===e)return;this._margin=e;this._renderer.getElement().style.maxWidth=0===this._margin?"":`calc(100% - ${this._margin+Ga}px)`,this._updateWidgetModeBySize()}updateWidgetModeBySize(e){this._size=e,this._updateWidgetModeBySize()}_statusSourceAdapter(e){const t=e.instanceId();let s=this._statusProviders.get(t);return void 0===s&&(s=e!==this._model.mainSeries()?new ca(e,this._model.model()):new ha(this._model.mainSeries(),this._model.model()),this._statusProviders.set(t,s)),s}_updateWidgetModeBySize(){this._updateWidgetModeByWidth(),this._updateWidgetModeByHeight(),this._updateCustomWidgetModeBySize()}_updateWidgetModeByWidth(){ if(null===this._size)return;const e=this._availableWidth();this._renderer.updateMode(e),this._paneWidget.hasState()&&this._paneWidget.state().containsMainSeries()&&this._model.mainSeries().setTextSourceIsAlwaysTickerRestrictionEnabled(e<=132)}_updateWidgetModeByHeight(){null!==this._size&&(this._availableHeight=.8*this._size.height,this._updateCollapsedSourcesModeThrottle())}_updateCustomWidgetModeBySize(){if(null===this._size)return;const e=(0,i.size)({width:this._availableWidth(),height:this._size.height});for(const t of Array.from(this._customLegendWidgetsMap.values()))for(const s of Array.from(t.values()))for(const t of s)t.updateWidgetModeBySize(e)}_destroyMainDataSource(){(0,o.ensureNotNull)(this._mainSeriesStatusesWidgetState).destroy(),this._mainSeriesStatusesWidgetState=null;(0,o.ensureNotNull)(this._mainSeriesViewModel).destroy(),this._mainSeriesViewModel=null}_updateCollapsedSourcesMode(){const e=this._dataSourceViewModels.length,t=this._hideAllExceptFirstLine.value(),s=null!==this._mainSeriesViewModel;if(this._collapsedStatusesWidgetState.clear(),this._availableHeight>0&&e>2){const i=Number(this._renderer.getMainSourceHeight()),l=this._renderer.getDataSourceHeight(),o=this._getCustomWidgetsHeight();if(null!==l){const a=Math.floor((this._availableHeight-i-o)/l),n=Math.max(a,2)-1;if(e>n+1){let i="";for(let l=0;le.loading().weakReference())))}_updateLegendVisibilities(){if(this._hideWholeLegend.value())return void this._allLegendHidden.setValue(!0);const e=0!==this._dataSourceRowsHidden.length&&this._dataSourceRowsHidden.every((e=>e.value())),t=this._hideNotMainSources.value()||e;this._studiesLegendHidden.setValue(t);const s=null===this._mainSeriesRowHidden||this._mainSeriesRowHidden.value(),i=this._customWidgetsVisibilities.some((e=>e.value()));this._allLegendHidden.setValue(e&&s&&!i)}_updateVisibleDataSourceCount(){const e=this._dataSourceRowsHidden.filter((e=>!e.value())).length;this._visibleDataSourceCount.setValue(e)}_setLegendVisibilityToggled(){0}_getIsPaneMainValue(){return this._paneWidget.containsMainSeries()}_showLegendCalculatedProperty(){return this._model.model().showLegend()}_showLegendOriginalProperty(){return this._model.model().properties().childs().paneProperties.childs().legendProperties.childs().showLegend}_addCustomWidgetForLayerBlock(e){const t=this._customLegendWidgetsFactoriesMap.get(e);if(void 0===t)return;const s=this._customLegendWidgetsMap.get(e)||new Map;let i=!1;for(const l of Array.from(t.keys())){const o=s.get(l)||[],a=t.get(l)||[];for(let t=o.length;t{"use strict";s.r(t),s.d(t,{PaneControlsWidget:()=>X});var i,l=s(51768),o=s(11542),a=s(68335),n=s(48943),r=s(61786),d=s(2088),u=s(50151),c=s(24377),h=s(26880),p=s(32563),_=s(51037),m=s(44784),g=s(33465);!function(e){e[e.ContextMenuModeWidthPt=666.65]="ContextMenuModeWidthPt",e[e.VisibleModeMinWidth=356]="VisibleModeMinWidth"}(i||(i={}));class b{constructor(e,t,s){this._parentEl=document.createElement("div"),this._listActionsWrapperEl=null,this._listActionsElements={},this._actionsSpawns={},this._onMouseEnterLeaveEventHandler=null,this._mouseOverWidget=!1,this._wrapEl=e, this._onMouseEnterLeaveEventHandler=this._onMouseEnterLeaveEvent.bind(this),this._wrapEl.addEventListener("mouseenter",this._onMouseEnterLeaveEventHandler),this._wrapEl.addEventListener("mouseleave",this._onMouseEnterLeaveEventHandler),this._actions=t,this._globalVisibility=s.globalVisibility.spawn(),this._globalVisibility.subscribe(this._updatePaneControlsWidgetVisibility.bind(this)),this._visibilityType=s.visibilityType.spawn(),this._visibilityType.subscribe(this._updatePaneControlsWidgetVisibility.bind(this)),this._separatorSelected=s.separatorSelected.spawn(),this._separatorSelected.subscribe(this._updatePaneControlsWidgetVisibility.bind(this)),this._maximized=s.maximized.spawn(),this._maximized.subscribe(this._updatePaneControlsWidgetVisibility.bind(this)),this._doNotSwitchToContextMenuMode=s.doNotSwitchToContextMenuMode,this._themedColor=s.themedColor.spawn(),this._themedColor.subscribe(this._updateThemedColor.bind(this));for(const[e,t]of Object.entries(this._actions)){const s=e;this._actionsSpawns[s]={visible:t.visible.spawn(),title:void 0===t.title?null:t.title.spawn()},this._actionsSpawns[s].visible.subscribe(this._updateActionVisibilities.bind(this,s));const i=this._actionsSpawns[s].title;null!==i&&i.subscribe(this._updateActionTitle.bind(this,s))}this._render(),this._updatePaneControlsWidgetVisibility(),this._updateThemedColor(this._themedColor.value()),this._parentEl.classList.toggle(m.touchMode,_.trackingModeIsAvailable),this._parentEl.addEventListener("contextmenu",(e=>e.preventDefault())),this._parentEl.setAttribute("aria-hidden","true"),this._wrapEl.matches(":hover")&&this._onMouseEnterLeaveEvent({type:"mouseenter"})}destroy(){this._visibilityType.destroy(),this._themedColor.destroy(),this._separatorSelected.destroy();for(const e of Object.keys(this._actionsSpawns)){const t=e;this._actionsSpawns[t].visible.destroy();const s=this._actionsSpawns[t].title;null!==s&&s.destroy()}null!==this._onMouseEnterLeaveEventHandler&&(this._wrapEl.removeEventListener("mouseenter",this._onMouseEnterLeaveEventHandler),this._wrapEl.removeEventListener("mouseleave",this._onMouseEnterLeaveEventHandler),this._onMouseEnterLeaveEventHandler=null),this._parentEl.remove(),this._parentEl.innerHTML="",delete this._parentEl}getElement(){return this._parentEl}bottomWithMargin(){const e=this._parentEl.classList.contains(m.touchMode)?Number(m.css_value_pane_controls_button_touch_size):Number(m.css_value_pane_controls_button_size);return 2*Number(m.css_value_pane_controls_margin_top)+e}updateWidgetModeByWidth(e){const t=!this._doNotSwitchToContextMenuMode.value()&&e<356,s=!this._doNotSwitchToContextMenuMode.value()&&e<666.65,i=(0,u.ensureNotNull)(this._listActionsWrapperEl),l=(0,u.ensureNotNull)(this._listActionsElements.more);i.classList.toggle(g.blockHidden,t||s),l.classList.toggle(g.blockHidden,t||!s||!this._actions.more.visible.value())}_render(){this._renderActions(),this._parentEl.classList.add(m.paneControls),this._wrapEl.append(this._parentEl)}_renderActions(){ null===this._listActionsWrapperEl&&(this._listActionsWrapperEl=document.createElement("div"),this._listActionsWrapperEl.classList.add(m.buttons),this._parentEl.append(this._listActionsWrapperEl));const e={tag:"div",buttonClassName:m.button,wrapIconClassName:m.buttonIcon,hiddenClassName:g.blockHidden};this._listActionsElements.up=(0,h.createActionElement)(this._actions.up,e),this._listActionsElements.down=(0,h.createActionElement)(this._actions.down,e),this._listActionsElements.collapse=(0,h.createActionElement)(this._actions.collapse,e),this._listActionsElements.restore=(0,h.createActionElement)(this._actions.restore,e),this._listActionsElements.close=(0,h.createActionElement)(this._actions.close,e),this._listActionsElements.maximize=(0,h.createActionElement)(this._actions.maximize,e),this._listActionsElements.minimize=(0,h.createActionElement)(this._actions.minimize,e),this._listActionsElements.restore.classList.add(m.button_activated),this._listActionsElements.minimize.classList.add(m.button_activated),this._listActionsWrapperEl.append(this._listActionsElements.up,this._listActionsElements.down,this._listActionsElements.close,this._listActionsElements.collapse,this._listActionsElements.restore,this._listActionsElements.maximize,this._listActionsElements.minimize),this._listActionsElements.more=(0,h.createActionElement)(this._actions.more,e),this._parentEl.append(this._listActionsElements.more)}_updateActionVisibilities(e,t){(0,u.ensureNotNull)(this._listActionsElements[e]).classList.toggle(g.blockHidden,!t)}_updateActionTitle(e,t){(0,u.ensureNotNull)(this._listActionsElements[e]).setAttribute("title",t)}_onMouseEnterLeaveEvent(e){this._mouseOverWidget="mouseenter"===e.type,"visibleOnMouseOver"===this._visibilityType.value()&&this._updatePaneControlsWidgetVisibility()}_updatePaneControlsWidgetVisibility(){let e,t=!1;switch(this._visibilityType.value()){case"alwaysOff":e=!1,t=!0;break;case"alwaysOn":e=this._globalVisibility.value();break;case"visibleOnMouseOver":case"visibleOnTapSelection":e=this._globalVisibility.value()&&this._mouseOverWidget}this._separatorSelected.value()&&"visibleOnTapSelection"===this._visibilityType.value()&&(e=!0),this._maximized.value()&&p.mobiletouch&&(e=!0),this._parentEl.classList.toggle(m.paneControls_hidden,!e),this._parentEl.classList.toggle(m.paneControls_forceHidden,!this._globalVisibility.value()||t)}_updateThemedColor(e){if(e.length>0){const[t,s,i]=(0,c.parseRgb)(e);this._parentEl.style.color=(0,c.rgbaToString)([t,s,i,(0,c.normalizeAlphaComponent)(.8)])}else this._parentEl.style.removeProperty("color")}}var v=s(41706),S=s(31269),w=s(30426),y=s(72899),f=s(48344),C=s(99539),M=s(20465),E=s(34763);const V=o.t(null,void 0,s(13930)),x=V,W=(0,a.humanReadableModifiers)(a.Modifiers.Mod)+V;var L=s(22613),A=s(22489),k=s(61814),T=s(37896),B=s(81020),H=s(3515),P=s(79526),D=s(82847),I=s(14604),R=s(42930) ;const O=o.t(null,void 0,s(66260)),N=o.t(null,void 0,s(7310)),z=o.t(null,void 0,s(74079)),F=o.t(null,void 0,s(90165)),U=o.t(null,void 0,s(12486)),G=o.t(null,void 0,s(65495)),Z=o.t(null,void 0,s(75018)),j=o.t(null,void 0,s(13930));var Q;!function(e){e.PaneCloseButton="pane-button-close",e.PaneUpButton="pane-button-up",e.PaneDownButton="pane-button-down",e.PaneMaximizeButton="pane-button-maximize",e.PaneMinimizeButton="pane-button-minimize",e.PaneCollapseButton="pane-button-collapse",e.PaneRestoreButton="pane-button-restore",e.PaneMoreButton="pane-button-more"}(Q||(Q={}));const $=(0,k.hotKeySerialize)({keys:[""],text:j}),K=(0,k.hotKeySerialize)({keys:[(0,a.humanReadableModifiers)(a.Modifiers.Mod,!1)],text:`{0} + ${j}`});class X{constructor(e,t,s,i){this._actions={},this._moreCMShown=!1,this._themedColor=new L.WatchedValue(""),this._model=e,this._pane=t,this._closeButtonVisibility=new L.WatchedValue(this._getCloseButtonVisibility()),this._upButtonVisibility=new L.WatchedValue(this._getUpButtonVisibility()),this._downButtonVisibility=new L.WatchedValue(this._getDownButtonVisibility()),this._maximizeButtonVisibility=new L.WatchedValue(this._getMaximizeButtonVisibility()),this._minimizeButtonVisibility=new L.WatchedValue(this._getMinimizeButtonVisibility()),this._collapseButtonVisibility=(0,n.combine)(((e,t,s)=>!e&&!t&&s),t.maximized().weakReference(),t.collapsed().weakReference(),t.collapsingAvailable().weakReference()),this._restoreButtonVisibility=(0,n.combine)(((e,t)=>!e&&t),t.maximized().weakReference(),t.collapsed().weakReference()),this._createActions(),this._visibilityTypeProperty=(0,r.actualBehavior)(),this._visibilityTypeProperty.subscribe(this,(e=>{this._visibilityType.setValue(e.value())})),this._visibilityType=new L.WatchedValue(this._visibilityTypeProperty.value()),this._isPaneMaximize=new L.WatchedValue(this._getIsPaneMaximizeValue()),this._isWidgetShow=new L.WatchedValue(this._getIsWidgetShow()),this._backgroundThemeName=s.backgroundThemeName,this._renderer=new b(i,this._actions,{visibilityType:this._visibilityType.readonly(),globalVisibility:this._isWidgetShow.readonly(),doNotSwitchToContextMenuMode:this._isPaneMaximize.readonly(),themedColor:this._themedColor.readonly(),separatorSelected:s.anySeparatorSelected,maximized:this._isPaneMaximize.readonly()})}destroy(){this._visibilityTypeProperty.unsubscribeAll(this),this._collapseButtonVisibility.destroy(),this._restoreButtonVisibility.destroy(),this._renderer.destroy()}getElement(){return this._renderer.getElement()}bottomWithMargin(){return this._renderer.bottomWithMargin()}action(){return this._actions}update(){this._updateButtonsVisibility(),this._isPaneMaximize.setValue(this._getIsPaneMaximizeValue()),this._isWidgetShow.setValue(this._getIsWidgetShow())}updateWidgetModeByWidth(e){this._renderer.updateWidgetModeByWidth(e)}updateThemedColors(e){null===e&&(e=(0,A.getStdThemedValue)("chartProperties.paneProperties.background",this._backgroundThemeName.value())),this._themedColor.setValue(e||"")}_updateButtonsVisibility(){ this._closeButtonVisibility.setValue(this._getCloseButtonVisibility()),this._upButtonVisibility.setValue(this._getUpButtonVisibility()),this._downButtonVisibility.setValue(this._getDownButtonVisibility()),this._maximizeButtonVisibility.setValue(this._getMaximizeButtonVisibility()),this._minimizeButtonVisibility.setValue(this._getMinimizeButtonVisibility())}_createActions(){this._actions.up={icon:B,action:this._onUpDownButton.bind(this,"up"),visible:this._upButtonVisibility,title:new L.WatchedValue(N),className:m.up,dataset:{name:"pane-button-up"}},this._actions.down={icon:H,action:this._onUpDownButton.bind(this,"down"),visible:this._downButtonVisibility,title:new L.WatchedValue(z),className:m.down,dataset:{name:"pane-button-down"}},this._actions.close={icon:T,action:this._onCloseButton.bind(this),visible:this._closeButtonVisibility,title:new L.WatchedValue(O),dataset:{name:"pane-button-close"}},this._actions.maximize={icon:P,action:this._onToggleMaximizeButton.bind(this,"Maximize pane"),visible:this._maximizeButtonVisibility,title:new L.WatchedValue(F),hotKeyTitle:$,className:m.maximize,dataset:{name:"pane-button-maximize"}},this._actions.minimize={icon:P,action:this._onToggleMaximizeButton.bind(this,"Minimize pane"),visible:this._minimizeButtonVisibility,title:new L.WatchedValue(U),hotKeyTitle:$,className:m.minimize,dataset:{name:"pane-button-minimize"}},this._actions.collapse={icon:I,action:this._onToggleCollapseButton.bind(this,"Collapse pane"),visible:this._collapseButtonVisibility,title:new L.WatchedValue(G),hotKeyTitle:K,className:m.collapse,dataset:{name:"pane-button-collapse"}},this._actions.restore={icon:R,action:this._onToggleCollapseButton.bind(this,"Restore pane"),visible:this._restoreButtonVisibility,title:new L.WatchedValue(U),hotKeyTitle:K,className:m.restore,dataset:{name:"pane-button-restore"}},this._actions.more={icon:D,action:this._showButtonsInContextMenu.bind(this),visible:new L.WatchedValue(!0),title:new L.WatchedValue(Z),dataset:{name:"pane-button-more"}}}_getCloseButtonVisibility(){let e=!1;return this._pane.containsMainSeries()||this._pane.maximized().value()||(e=this._pane.dataSources().some((e=>(0,d.isStudy)(e)))),e}_onCloseButton(){this._trackEvent("Delete pane");const e=this._model.model().panes().indexOf(this._pane);this._model.removePane(e)}_getUpButtonVisibility(){const e=this._pane,t=this._model.model().panes().indexOf(e);return this._model.model().canMovePaneUp(t)}_getDownButtonVisibility(){const e=this._model.model().panes().indexOf(this._pane);return this._model.model().canMovePaneDown(e)}_onUpDownButton(e){this._trackEvent(`Move pane ${e}`);const t=this._model.model().panes().indexOf(this._pane);this._model.rearrangePanes(t,e)}_getMaximizeButtonVisibility(){return this._model.model().panes().length>1&&!this._pane.maximized().value()}_getMinimizeButtonVisibility(){return this._model.model().panes().length>1&&this._pane.maximized().value()}_onToggleMaximizeButton(e){this._trackEvent(e),this._model.toggleMaximizedPane(this._pane)}_onToggleCollapseButton(e){this._trackEvent(e), this._model.toggleCollapsedPane(this._pane)}_showButtonsInContextMenu(e){e.preventDefault(),this._moreCMShown||function(e,t,s){const i=[];if(e.maximize.visible.value()){const t=(0,u.ensure)(e.maximize.title),s=(0,u.ensureNotNull)(e.maximize.action);i.push(new v.Action({actionId:"Chart.PaneControls.MaximizePane",options:{icon:C,label:t.value(),statName:"Maximize Pane",shortcutHint:x,onExecute:()=>s()}}))}else if(e.minimize.visible.value()){const t=(0,u.ensure)(e.minimize.title),s=(0,u.ensureNotNull)(e.minimize.action);i.push(new v.Action({actionId:"Chart.PaneControls.MinimizePane",options:{icon:C,label:t.value(),statName:"Minimize Pane",shortcutHint:x,onExecute:()=>s()}}))}if(e.collapse.visible.value()){const t=(0,u.ensure)(e.collapse.title),s=(0,u.ensureNotNull)(e.collapse.action);i.push(new v.Action({actionId:"Chart.PaneControls.CollapsePane",options:{icon:M,label:t.value(),statName:"Collapse pane",shortcutHint:W,onExecute:()=>s()}}))}if(e.restore.visible.value()){const t=(0,u.ensure)(e.restore.title),s=(0,u.ensureNotNull)(e.restore.action);i.push(new v.Action({actionId:"Chart.PaneControls.RestorePane",options:{icon:E,label:t.value(),statName:"Restore pane",shortcutHint:W,onExecute:()=>s()}}))}if(e.up.visible.value()){const t=(0,u.ensure)(e.up.title),s=(0,u.ensureNotNull)(e.up.action);i.push(new v.Action({actionId:"Chart.PaneControls.MovePaneUp",options:{icon:y,label:t.value(),statName:"Move pane up",onExecute:()=>s()}}))}if(e.down.visible.value()){const t=(0,u.ensure)(e.down.title),s=(0,u.ensureNotNull)(e.down.action);i.push(new v.Action({actionId:"Chart.PaneControls.MovePaneDown",options:{icon:f,label:t.value(),statName:"Move pane down",onExecute:()=>s()}}))}if(e.close.visible.value()){const t=(0,u.ensure)(e.close.title),s=(0,u.ensureNotNull)(e.close.action);i.push(new v.Action({actionId:"Chart.PaneControls.DeletePane",options:{icon:w,label:t.value(),statName:"Delete pane",onExecute:()=>s()}}))}const l=(0,u.ensureNotNull)(t.currentTarget).getBoundingClientRect();return S.ContextMenuManager.showMenu(i,{clientX:l.right,clientY:l.top+l.height+3,attachToXBy:"right"},void 0,void 0,s)}(this._actions,e,(()=>{this._moreCMShown=!1})).then((()=>{this._moreCMShown=!0}))}_getIsPaneMaximizeValue(){return this._pane.maximized().value()}_getIsWidgetShow(){return this._model.model().panes().length>1}_trackEvent(e){(0,l.trackEvent)("GUI","Pane action",e)}}},26880:(e,t,s)=>{"use strict";s.d(t,{createActionElement:()=>n});var i=s(43888),l=s(50151),o=s(87465),a=s(80007);function n(e,t){const{buttonClassName:s,wrapIconClassName:n,hiddenClassName:r,iconSize:d,blurOnClick:u}=t,c=document.createElement(t.tag);c.className=s,c.classList.toggle(r,!e.visible.value()),Object.assign(c.dataset,e.dataset),void 0!==e.className&&c.classList.add(e.className),void 0!==e.title&&(c.classList.add("apply-common-tooltip"),c.setAttribute("title",e.title.value()),void 0!==e.hotKeyTitle&&(c.dataset.tooltipHotkey=e.hotKeyTitle)),c.addEventListener("touchend",(0,a.wrapHandlerWithPreventEvent)(e.action)),c.addEventListener("mousedown",(t=>{ 0===t.button&&(e.action(t),u&&c.blur())}));const h=document.createElement("div");let p;return h.classList.add(n),p=(0,i.default)(e.icon)?e.icon.get((0,l.ensureDefined)(d))||"":e.icon,(0,o.isString)(p)?h.innerHTML=p:h.appendChild(p),c.appendChild(h),c}},48282:(e,t,s)=>{"use strict";s.d(t,{isCustomStudy:()=>l});const i={VbPFixed:!0,PivotPointsStandard:!0,VbPVisible:!0,VbPAnchored:!0};function l(e){return e in i}},32823:(e,t,s)=>{"use strict";s.d(t,{MetaInfoHelper:()=>h});var i=s(50151),l=s(9343),o=s(19844),a=s(4359),n=s(87465),r=s(69422);function d(e){return!e.groupId&&!e.isHidden&&e.id!==r.RangeDependentStudyInputNames.FirstBar&&e.id!==r.RangeDependentStudyInputNames.LastBar}var u=s(48282);const c=(0,l.getLogger)("Platform.GUI.PropertyDialog.Indicators.MetaInfo");class h{constructor(e){this._metaInfo=e}hasUserEditableInputs(){return this._metaInfo.inputs.some(d)}getUserEditableInputs(){return this._metaInfo.inputs.filter(d)}hasUserEditableProperties(){return o.StudyMetaInfo.isScriptStrategy(this._metaInfo)}hasUserEditableStyles(){const e=this._metaInfo;return e.plots.length>0||void 0!==e.bands||void 0!==e.filledAreas||(0,u.isCustomStudy)(e.shortId)||o.StudyMetaInfo.isScriptStrategy(this._metaInfo)||Object.values(e.graphics).some((e=>void 0!==e))}getUserEditablePlots(){const e=new Set,t=this._metaInfo;return t.plots.filter((s=>{if((0,a.isColorerPlot)(s)||(0,a.isTextColorerPlot)(s)||(0,a.isDataOffsetPlot)(s)||(0,a.isOhlcColorerPlot)(s)||(0,a.isAlertConditionPlot)(s)||(0,a.isDataPlot)(s))return!1;if((0,a.isOhlcPlot)(s)){const l=s.target;if(e.has(l))return!1;e.add(l);const o=(0,i.ensureDefined)(t.ohlcPlots);return!(0,i.ensureDefined)(o[l]).isHidden}{const e=t.styles?t.styles[s.id]:void 0;return void 0===e||!e.isHidden}}))}hasUserEditableOptions(){return this.hasUserEditableInputs()||this.hasUserEditableProperties()||this.hasUserEditableStyles()}getStrategyProperties(){const e=this._metaInfo,t=e.inputs.filter(_),s={...p};for(const i of t){const t=i.internalID;s[t]=i,p.hasOwnProperty(t)||c.logWarn(`Unknown strategy input internal id ${t} in ${e.fullId}`)}return(0,n.clone)(s)}}const p={currency:void 0,backtest_fill_limits_assumption:void 0,calc_on_every_tick:void 0,calc_on_order_fills:void 0,commission_value:void 0,commission_type:void 0,initial_capital:void 0,pyramiding:void 0,slippage:void 0,default_qty_type:void 0,default_qty_value:void 0,margin_long:void 0,margin_short:void 0,use_bar_magnifier:void 0,process_orders_on_close:void 0,fill_orders_on_standard_ohlc:void 0};function _(e){return"strategy_props"===e.groupId}},51037:(e,t,s)=>{"use strict";s.d(t,{trackingModeIsAvailable:()=>i});const i=s(49483).CheckMobile.any()},89323:(e,t,s)=>{"use strict";function i(e,t){return l(e,t,t?["&"]:["&"])}function l(e,t,s){const i=[["&","&"],["<","<"],[">",">"],['"',"""],["'","'"],["'","'"]];t&&i.forEach((e=>e.reverse()));let l=e;if(!e||!e.replace)return l;for(const e of i){const[t,i]=e;s&&-1!==s.indexOf(t)||(l=l.replace(new RegExp(t,"g"),i))}return l}s.d(t,{clean:()=>l,cleanButAmpersand:()=>i})},89612:e=>{ e.exports=''},23317:e=>{e.exports=''},77576:e=>{e.exports=''},91986:e=>{e.exports=''},76996:e=>{e.exports=''},78529:e=>{e.exports=''},93724:e=>{e.exports=''},79304:e=>{e.exports=''},38373:e=>{e.exports=''},31233:e=>{e.exports=''},12646:e=>{e.exports=''},21672:e=>{ e.exports=''},69410:e=>{e.exports=''},55593:e=>{e.exports=''},53218:e=>{e.exports=''},62998:e=>{e.exports=''},32140:e=>{e.exports=''},25230:e=>{e.exports=''},43401:e=>{e.exports=''},15507:e=>{e.exports=''},12462:e=>{e.exports=''},85290:e=>{e.exports=''},91665:e=>{ e.exports=''},52828:e=>{e.exports=''},39379:e=>{e.exports=''},57979:e=>{e.exports=''},2588:e=>{e.exports=''},41674:e=>{ e.exports=''},54336:e=>{e.exports=''},45534:e=>{ e.exports=''},87258:e=>{e.exports=''},36885:e=>{e.exports=''},65300:e=>{e.exports=''},37073:e=>{e.exports=''},34882:e=>{ e.exports=''},36791:e=>{e.exports=''},83637:e=>{e.exports=''},91104:e=>{e.exports=''},30556:e=>{e.exports=''},14604:e=>{e.exports=''},20465:e=>{e.exports=''},48344:e=>{e.exports=''},99539:e=>{ e.exports=''},34763:e=>{e.exports=''},30426:e=>{e.exports=''},72899:e=>{e.exports=''},82847:e=>{e.exports=''},3515:e=>{e.exports=''},79526:e=>{e.exports=''},42930:e=>{e.exports=''},37896:e=>{e.exports=''},81020:e=>{ e.exports=''},62920:e=>{e.exports=''},47036:e=>{e.exports=''},42205:e=>{e.exports=''},50119:e=>{e.exports=''},62884:e=>{e.exports=''},50662:e=>{e.exports=''},86240:e=>{"use strict";e.exports=JSON.parse('{"size-header-height":"64px","media-phone-vertical":"all and (max-width: 479px)","media-show-drawer":"all and (max-width: 567px)","media-mf-phone-landscape":"all and (min-width: 568px)"}')}}]);