6 lines
16 KiB
JavaScript
6 lines
16 KiB
JavaScript
(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[5132],{12139:e=>{e.exports={menuWrap:"menuWrap-Kq3ruQo8",isMeasuring:"isMeasuring-Kq3ruQo8",scrollWrap:"scrollWrap-Kq3ruQo8",momentumBased:"momentumBased-Kq3ruQo8",menuBox:"menuBox-Kq3ruQo8",isHidden:"isHidden-Kq3ruQo8"}},69947:(e,t,n)=>{"use strict";n.d(t,{useIsomorphicLayoutEffect:()=>r});var s=n(79474);function r(e,t){("undefined"==typeof window?s.useEffect:s.useLayoutEffect)(e,t)}},50534:(e,t,n)=>{"use strict";function s(e,t,n,s,r){function i(r){if(e>r.timeStamp)return;const i=r.target;void 0!==n&&null!==t&&null!==i&&i.ownerDocument===s&&(t.contains(i)||n(r))}return r.click&&s.addEventListener("click",i,!1),r.mouseDown&&s.addEventListener("mousedown",i,!1),r.touchEnd&&s.addEventListener("touchend",i,!1),r.touchStart&&s.addEventListener("touchstart",i,!1),()=>{s.removeEventListener("click",i,!1),s.removeEventListener("mousedown",i,!1),s.removeEventListener("touchend",i,!1),s.removeEventListener("touchstart",i,!1)}}n.d(t,{addOutsideEventListener:()=>s})},4138:(e,t,n)=>{"use strict";n.d(t,{useOutsideEvent:()=>o});var s=n(79474),r=n(69947),i=n(50534);function o(e){const{click:t,mouseDown:n,touchEnd:o,touchStart:a,handler:l,reference:u}=e,c=(0,s.useRef)(null),d=(0,s.useRef)("undefined"==typeof window?0:new window.CustomEvent("timestamp").timeStamp);return(0,r.useIsomorphicLayoutEffect)((()=>{const e={click:t,mouseDown:n,touchEnd:o,touchStart:a},s=u?u.current:c.current;return(0,i.addOutsideEventListener)(d.current,s,l,document,e)}),[t,n,o,a,l]),u||c}},73457:(e,t,n)=>{"use strict";n.d(t,{Icon:()=>r});var s=n(79474);const r=s.forwardRef(((e,t)=>{const{icon:n="",title:r,ariaLabel:i,ariaLabelledby:o,ariaHidden:a,...l}=e,u=!!(r||i||o);return s.createElement("span",{role:"img",...l,ref:t,"aria-label":i,"aria-labelledby":o,"aria-hidden":a||!u,title:r,dangerouslySetInnerHTML:{__html:n}})}))},66334:(e,t,n)=>{"use strict";n.d(t,{Icon:()=>s.Icon});var s=n(73457)},78972:(e,t,n)=>{"use strict";n.d(t,{SubmenuContext:()=>r,SubmenuHandler:()=>i});var s=n(79474);const r=s.createContext(null);function i(e){const[t,n]=(0,s.useState)(null),i=(0,s.useRef)(null),o=(0,s.useRef)(new Map);return(0,s.useEffect)((()=>()=>{null!==i.current&&clearTimeout(i.current)}),[]),s.createElement(r.Provider,{value:{current:t,setCurrent:function(e){null!==i.current&&(clearTimeout(i.current),i.current=null);null===t?n(e):i.current=setTimeout((()=>{i.current=null,n(e)}),100)},registerSubmenu:function(e,t){return o.current.set(e,t),()=>{o.current.delete(e)}},isSubmenuNode:function(e){return Array.from(o.current.values()).some((t=>t(e)))}}},e.children)}},52885:(e,t,n)=>{"use strict";n.d(t,{Portal:()=>u,PortalContext:()=>c});var s=n(79474),r=n(29365),i=n(56770),o=n(46765),a=n(70014),l=n(99286);class u extends s.PureComponent{constructor(){super(...arguments),this._uuid=(0,i.nanoid)()}componentWillUnmount(){this._manager().removeWindow(this._uuid)}render(){const e=this._manager().ensureWindow(this._uuid,this.props.layerOptions);e.style.top=this.props.top||"",
|
|
e.style.bottom=this.props.bottom||"",e.style.left=this.props.left||"",e.style.right=this.props.right||"",e.style.pointerEvents=this.props.pointerEvents||"";const t=this.props.className;return t&&("string"==typeof t?e.classList.add(t):e.classList.add(...t)),this.props.shouldTrapFocus&&!e.hasAttribute(a.FOCUS_TRAP_DATA_ATTRIBUTE)&&e.setAttribute(a.FOCUS_TRAP_DATA_ATTRIBUTE,"true"),this.props["aria-hidden"]&&e.setAttribute("aria-hidden","true"),r.createPortal(s.createElement(c.Provider,{value:this},this.props.children),e)}moveToTop(){this._manager().moveToTop(this._uuid)}_manager(){return null===this.context?(0,o.getRootOverlapManager)():this.context}}u.contextType=l.SlotContext;const c=s.createContext(null)},99286:(e,t,n)=>{"use strict";n.d(t,{Slot:()=>r,SlotContext:()=>i});var s=n(79474);class r extends s.Component{shouldComponentUpdate(){return!1}render(){return s.createElement("div",{style:{position:"fixed",zIndex:150,left:0,top:0},ref:this.props.reference})}}const i=s.createContext(null)},40197:(e,t,n)=>{"use strict";function s(e){return i(e,o)}function r(e){return i(e,a)}function i(e,t){const n=Object.entries(e).filter(t),s={};for(const[e,t]of n)s[e]=t;return s}function o(e){const[t,n]=e;return 0===t.indexOf("data-")&&"string"==typeof n}function a(e){return 0===e[0].indexOf("aria-")}function l(e,t){const n=s(e);return t&&(n["data-qa-id"]=t),n}n.d(t,{filterAriaProps:()=>r,filterCheckedDataProps:()=>l,filterDataProps:()=>s,filterProps:()=>i,isAriaAttribute:()=>a,isDataAttribute:()=>o})},46765:(e,t,n)=>{"use strict";n.d(t,{OverlapManager:()=>o,getRootOverlapManager:()=>l});var s=n(85842),r=n(70014);class i{constructor(){this._storage=[]}add(e){this._storage.push(e)}remove(e){this._storage=this._storage.filter((t=>e!==t))}has(e){return this._storage.includes(e)}getItems(){return this._storage}}class o{constructor(e=document){this._storage=new i,this._windows=new Map,this._index=0,this._document=e,this._container=e.createDocumentFragment()}setContainer(e){const t=this._container,n=null===e?this._document.createDocumentFragment():e;!function(e,t){Array.from(e.childNodes).forEach((e=>{e.nodeType===Node.ELEMENT_NODE&&t.appendChild(e)}))}(t,n),this._container=n}registerWindow(e){this._storage.has(e)||this._storage.add(e)}ensureWindow(e,t={position:"fixed",direction:"normal"}){const n=this._windows.get(e);if(void 0!==n)return n;this.registerWindow(e);const s=this._document.createElement("div");if(s.style.position=t.position,s.style.zIndex=this._index.toString(),s.dataset.id=e,void 0!==t.index){const e=this._container.childNodes.length;if(t.index>=e)this._container.appendChild(s);else if(t.index<=0)this._container.insertBefore(s,this._container.firstChild);else{const e=this._container.childNodes[t.index];this._container.insertBefore(s,e)}}else"reverse"===t.direction?this._container.insertBefore(s,this._container.firstChild):this._container.appendChild(s);return this._windows.set(e,s),++this._index,s}unregisterWindow(e){this._storage.remove(e);const t=this._windows.get(e)
|
|
;void 0!==t&&(null!==t.parentElement&&t.parentElement.removeChild(t),this._windows.delete(e))}getZindex(e){const t=this.ensureWindow(e);return parseInt(t.style.zIndex||"0")}moveLastWindowToTop(){const e=this._storage.getItems(),t=e[e.length-1];t&&this.moveToTop(t)}moveToTop(e){if(this.getZindex(e)!==this._index){const t=this.ensureWindow(e);this._windows.forEach(((e,n)=>{e.hasAttribute(r.FOCUS_TRAP_DATA_ATTRIBUTE)&&e.setAttribute(r.FOCUS_TRAP_DATA_ATTRIBUTE,e===t?"true":"false")})),t.style.zIndex=(++this._index).toString()}}removeWindow(e){this.unregisterWindow(e)}}const a=new WeakMap;function l(e=document){const t=e.getElementById("overlap-manager-root");if(null!==t)return(0,s.ensureDefined)(a.get(t));{const t=new o(e),n=function(e){const t=e.createElement("div");return t.style.position="absolute",t.style.zIndex=150..toString(),t.style.top="0px",t.style.left="0px",t.id="overlap-manager-root",t.dataset.qaId="overlap-manager-root",t}(e);return a.set(n,t),t.setContainer(n),e.body.appendChild(n),t}}var u;!function(e){e[e.BaseZindex=150]="BaseZindex"}(u||(u={}))},11288:(e,t,n)=>{"use strict";n.d(t,{setFixedBodyState:()=>u});const s=(()=>{let e;return()=>{if(void 0===e){const t=document.createElement("div"),n=t.style;n.visibility="hidden",n.width="100px",n.msOverflowStyle="scrollbar",document.body.appendChild(t);const s=t.offsetWidth;t.style.overflow="scroll";const r=document.createElement("div");r.style.width="100%",t.appendChild(r);const i=r.offsetWidth;t.parentNode?.removeChild(t),e=s-i}return e}})();function r(e,t,n){null!==e&&e.style.setProperty(t,n)}function i(e,t){return getComputedStyle(e,null).getPropertyValue(t)}function o(e,t){return parseInt(i(e,t))}let a=0,l=!1;function u(e){const{body:t}=document,n=t.querySelector(".widgetbar-wrap");if(e&&1==++a){const e=i(t,"overflow"),a=o(t,"padding-right");"hidden"!==e.toLowerCase()&&t.scrollHeight>t.offsetHeight&&(r(n,"right",`${s()}px`),t.style.paddingRight=`${a+s()}px`,l=!0),t.classList.add("i-no-scroll")}else if(!e&&a>0&&0==--a&&(t.classList.remove("i-no-scroll"),l)){r(n,"right","0px");let e=0;0,t.scrollHeight<=t.clientHeight&&(e-=s()),t.style.paddingRight=(e<0?0:e)+"px",l=!1}}},54466:(e,t,n)=>{"use strict";n.d(t,{MatchMedia:()=>r});var s=n(79474);class r extends s.PureComponent{constructor(e){super(e),this._handleChange=()=>{this.forceUpdate()},this.state={query:window.matchMedia(this.props.rule)}}componentDidMount(){this._subscribe(this.state.query)}componentDidUpdate(e,t){this.state.query!==t.query&&(this._unsubscribe(t.query),this._subscribe(this.state.query))}componentWillUnmount(){this._unsubscribe(this.state.query)}render(){return this.props.children(this.state.query.matches)}static getDerivedStateFromProps(e,t){return e.rule!==t.query.media?{query:window.matchMedia(e.rule)}:null}_subscribe(e){e.addEventListener("change",this._handleChange)}_unsubscribe(e){e.removeEventListener("change",this._handleChange)}}},98124:(e,t,n)=>{"use strict";n.d(t,{MenuContext:()=>s});const s=n(79474).createContext(null)},86738:(e,t,n)=>{"use strict";n.d(t,{
|
|
DEFAULT_MENU_THEME:()=>_,Menu:()=>v});var s=n(79474),r=n(14487),i=n.n(r),o=n(85842),a=n(85728),l=n(63484),u=n(16780),c=n(11463),d=n(46765),h=n(19960),p=n(78972),m=n(98124),f=n(12139);const _=f;var g;!function(e){e[e.IndentFromWindow=0]="IndentFromWindow"}(g||(g={}));class v extends s.PureComponent{constructor(e){super(e),this._containerRef=null,this._scrollWrapRef=null,this._raf=null,this._scrollRaf=null,this._scrollTimeout=void 0,this._manager=new d.OverlapManager,this._hotkeys=null,this._scroll=0,this._handleContainerRef=e=>{this._containerRef=e,this.props.reference&&("function"==typeof this.props.reference&&this.props.reference(e),"object"==typeof this.props.reference&&(this.props.reference.current=e))},this._handleScrollWrapRef=e=>{this._scrollWrapRef=e,"function"==typeof this.props.scrollWrapReference&&this.props.scrollWrapReference(e),"object"==typeof this.props.scrollWrapReference&&(this.props.scrollWrapReference.current=e)},this._handleCustomRemeasureDelegate=()=>{this._resizeForced(),this._handleMeasure()},this._handleMeasure=({callback:e,forceRecalcPosition:t}={})=>{if(this.state.isMeasureValid&&!t)return;const{position:n}=this.props,s=(0,o.ensureNotNull)(this._containerRef);let r=s.getBoundingClientRect();const i=document.documentElement.clientHeight,l=document.documentElement.clientWidth,u=this.props.closeOnScrollOutsideOffset??0;let c=i-0-u;const d=r.height>c;if(d){(0,o.ensureNotNull)(this._scrollWrapRef).style.overflowY="scroll",r=s.getBoundingClientRect()}const{width:h,height:p}=r,m="function"==typeof n?n({contentWidth:h,contentHeight:p,availableWidth:l,availableHeight:i}):n,f=m?.indentFromWindow?.left??0,_=l-(m.overrideWidth??h)-(m?.indentFromWindow?.right??0),g=(0,a.clamp)(m.x,f,Math.max(f,_)),v=(m?.indentFromWindow?.top??0)+u,y=i-(m.overrideHeight??p)-(m?.indentFromWindow?.bottom??0);let b=(0,a.clamp)(m.y,v,Math.max(v,y));if(m.forbidCorrectYCoord&&b<m.y&&(c-=m.y-b,b=m.y),t&&void 0!==this.props.closeOnScrollOutsideOffset&&m.y<=this.props.closeOnScrollOutsideOffset)return void this._handleGlobalClose(!0);const w=m.overrideHeight??(d?c:void 0);this.setState({appearingMenuHeight:t?this.state.appearingMenuHeight:w,appearingMenuWidth:t?this.state.appearingMenuWidth:m.overrideWidth,appearingPosition:{x:g,y:b},isMeasureValid:!0},(()=>{this.props.doNotRestorePosition||this._restoreScrollPosition(),e&&e()}))},this._restoreScrollPosition=()=>{const e=document.activeElement,t=(0,o.ensureNotNull)(this._containerRef);if(null!==e&&t.contains(e))try{e.scrollIntoView()}catch(e){}else(0,o.ensureNotNull)(this._scrollWrapRef).scrollTop=this._scroll},this._resizeForced=()=>{this.setState({appearingMenuHeight:void 0,appearingMenuWidth:void 0,appearingPosition:void 0,isMeasureValid:void 0})},this._resize=()=>{null===this._raf&&(this._raf=requestAnimationFrame((()=>{this.setState({appearingMenuHeight:void 0,appearingMenuWidth:void 0,appearingPosition:void 0,isMeasureValid:void 0}),this._raf=null})))},this._handleGlobalClose=e=>{this.props.onClose(e)},this._handleSlot=e=>{this._manager.setContainer(e)},
|
|
this._handleScroll=()=>{this._scroll=(0,o.ensureNotNull)(this._scrollWrapRef).scrollTop},this._handleScrollOutsideEnd=()=>{clearTimeout(this._scrollTimeout),this._scrollTimeout=setTimeout((()=>{this._handleMeasure({forceRecalcPosition:!0})}),80)},this._handleScrollOutside=e=>{e.target!==this._scrollWrapRef&&(this._handleScrollOutsideEnd(),null===this._scrollRaf&&(this._scrollRaf=requestAnimationFrame((()=>{this._handleMeasure({forceRecalcPosition:!0}),this._scrollRaf=null}))))},this.state={}}componentDidMount(){this._handleMeasure({callback:this.props.onOpen});const{customCloseDelegate:e=c.globalCloseDelegate,customRemeasureDelegate:t}=this.props;e.subscribe(this,this._handleGlobalClose),t?.subscribe(null,this._handleCustomRemeasureDelegate),window.addEventListener("resize",this._resize);const n=null!==this.context;this._hotkeys||n||(this._hotkeys=h.createGroup({desc:"Popup menu"}),this._hotkeys.add({desc:"Close",hotkey:27,handler:()=>{this.props.onKeyboardClose&&this.props.onKeyboardClose(),this._handleGlobalClose()}})),this.props.repositionOnScroll&&window.addEventListener("scroll",this._handleScrollOutside,{capture:!0})}componentDidUpdate(){this._handleMeasure()}componentWillUnmount(){const{customCloseDelegate:e=c.globalCloseDelegate,customRemeasureDelegate:t}=this.props;e.unsubscribe(this,this._handleGlobalClose),t?.unsubscribe(null,this._handleCustomRemeasureDelegate),window.removeEventListener("resize",this._resize),window.removeEventListener("scroll",this._handleScrollOutside,{capture:!0}),this._hotkeys&&(this._hotkeys.destroy(),this._hotkeys=null),null!==this._raf&&(cancelAnimationFrame(this._raf),this._raf=null),null!==this._scrollRaf&&(cancelAnimationFrame(this._scrollRaf),this._scrollRaf=null),this._scrollTimeout&&clearTimeout(this._scrollTimeout)}render(){const{id:e,role:t,"aria-label":n,"aria-labelledby":r,"aria-activedescendant":o,"aria-hidden":a,"aria-describedby":c,"aria-invalid":d,children:h,minWidth:_,theme:g=f,className:v,maxHeight:b,onMouseOver:w,onMouseOut:x,onKeyDown:C,onFocus:E,onBlur:S}=this.props,{appearingMenuHeight:R,appearingMenuWidth:M,appearingPosition:W,isMeasureValid:T}=this.state,O={"--ui-kit-menu-max-width":`${W&&W.x}px`,maxWidth:"calc(100vw - var(--ui-kit-menu-max-width) - 6px)"};return s.createElement(m.MenuContext.Provider,{value:this},s.createElement(p.SubmenuHandler,null,s.createElement(u.SlotContext.Provider,{value:this._manager},s.createElement("div",{id:e,role:t,"aria-label":n,"aria-labelledby":r,"aria-activedescendant":o,"aria-hidden":a,"aria-describedby":c,"aria-invalid":d,className:i()(v,g.menuWrap,!T&&g.isMeasuring),style:{height:R,left:W&&W.x,minWidth:_,position:"fixed",top:W&&W.y,width:M,...this.props.limitMaxWidth&&O},"data-name":this.props["data-name"],"data-qa-id":this.props.dataQaId,"data-tooltip-show-on-focus":this.props["data-tooltip-show-on-focus"],ref:this._handleContainerRef,onScrollCapture:this.props.onScroll,onContextMenu:l.preventDefaultForContextMenu,tabIndex:this.props.tabIndex,onMouseOver:w,onMouseOut:x,onKeyDown:C,onFocus:E,onBlur:S
|
|
},s.createElement("div",{className:i()(g.scrollWrap,!this.props.noMomentumBasedScroll&&g.momentumBased),style:{overflowY:void 0!==R?"scroll":"auto",maxHeight:b},onScrollCapture:this._handleScroll,ref:this._handleScrollWrapRef},s.createElement(y,{className:g.menuBox},h)))),s.createElement(u.Slot,{reference:this._handleSlot})))}update(e){e?this._resizeForced():this._resize()}focus(e){this._containerRef?.focus(e)}blur(){this._containerRef?.blur()}}function y(e){const t=(0,o.ensureNotNull)((0,s.useContext)(p.SubmenuContext)),n=s.useRef(null);return s.createElement("div",{ref:n,className:e.className,onMouseOver:function(e){if(!(null!==t.current&&e.target instanceof Node&&(s=e.target,n.current?.contains(s))))return;var s;t.isSubmenuNode(e.target)||t.setCurrent(null)},"data-qa-id":"menu-inner"},e.children)}v.contextType=p.SubmenuContext},11508:(e,t,n)=>{"use strict";n.d(t,{CloseDelegateContext:()=>i});var s=n(79474),r=n(11463);const i=s.createContext(r.globalCloseDelegate)},64888:(e,t,n)=>{"use strict";n.d(t,{Portal:()=>s.Portal,PortalContext:()=>s.PortalContext});var s=n(52885)},16780:(e,t,n)=>{"use strict";n.d(t,{Slot:()=>s.Slot,SlotContext:()=>s.SlotContext});var s=n(99286)}}]); |