(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[1297],{62168:e=>{e.exports={}},83135:e=>{e.exports={"tv-spinner__container-rotate":"tv-spinner__container-rotate-aLqboHuu"}},24899:e=>{e.exports={container:"container-B8mkOfAH",inner:"inner-B8mkOfAH","border-left":"border-left-B8mkOfAH","border-right":"border-right-B8mkOfAH","border-top":"border-top-B8mkOfAH","border-bottom":"border-bottom-B8mkOfAH","top-right-radius":"top-right-radius-B8mkOfAH","top-left-radius":"top-left-radius-B8mkOfAH","bottom-right-radius":"bottom-right-radius-B8mkOfAH","bottom-left-radius":"bottom-left-radius-B8mkOfAH"}},54355:e=>{e.exports={screen:"screen-otjoFNF2",fade:"fade-otjoFNF2",screenfade:"screenfade-otjoFNF2"}},84516:e=>{e.exports={}},60682:e=>{e.exports={css_value_currency_label_radius:"4",css_wrapper_margin:"4",css_row_left_right_padding:"3",css_fade_height:"10","price-axis-currency-label-wrapper":"price-axis-currency-label-wrapper-y5H41VPj",hidden:"hidden-y5H41VPj","price-axis-currency-label":"price-axis-currency-label-y5H41VPj",row:"row-y5H41VPj",expanded:"expanded-y5H41VPj","price-axis-currency-label-arrow-down":"price-axis-currency-label-arrow-down-y5H41VPj","price-axis-currency-label-text":"price-axis-currency-label-text-y5H41VPj"}},49668:e=>{e.exports={labelwidth:"19px",labelheight:"19px",bordersize:"2px",bottommargin:"5px",gearheight:"13px",gearwidth:"15px","price-axis-stub":"price-axis-stub-t9vjEPyG",wrapper:"wrapper-t9vjEPyG",label:"label-t9vjEPyG",symbol:"symbol-t9vjEPyG",gear:"gear-t9vjEPyG","fixed-gear":"fixed-gear-t9vjEPyG","fixed-symbol":"fixed-symbol-t9vjEPyG"}},47184:e=>{e.exports={}},658:e=>{e.exports={}},77825:e=>{e.exports={"css-value-chart-controls-bar-height-with-border":"39px","css-value-chart-controls-bar-border":"1px"}},37218:e=>{e.exports={}},77275:e=>{e.exports={}},68477:e=>{e.exports={"common-tooltip":"common-tooltip-EJBD96zX","common-tooltip--hidden":"common-tooltip--hidden-EJBD96zX","common-tooltip--horizontal":"common-tooltip--horizontal-EJBD96zX","common-tooltip--farther":"common-tooltip--farther-EJBD96zX","common-tooltip--vertical":"common-tooltip--vertical-EJBD96zX","common-tooltip-farther":"common-tooltip-farther-EJBD96zX","common-tooltip--direction_normal":"common-tooltip--direction_normal-EJBD96zX","common-tooltip__body":"common-tooltip__body-EJBD96zX","common-tooltip__button-container":"common-tooltip__button-container-EJBD96zX","common-tooltip__body--no-buttons":"common-tooltip__body--no-buttons-EJBD96zX","common-tooltip__button":"common-tooltip__button-EJBD96zX","common-tooltip--direction_reversed":"common-tooltip--direction_reversed-EJBD96zX","common-tooltip__ear-holder":"common-tooltip__ear-holder-EJBD96zX","common-tooltip__ear-holder--below":"common-tooltip__ear-holder--below-EJBD96zX","common-tooltip__ear-holder--above":"common-tooltip__ear-holder--above-EJBD96zX","common-tooltip__ear-holder--before":"common-tooltip__ear-holder--before-EJBD96zX","common-tooltip__ear-holder--after":"common-tooltip__ear-holder--after-EJBD96zX",
"common-tooltip__body--with-hotkey":"common-tooltip__body--with-hotkey-EJBD96zX","common-tooltip__body--width_wide":"common-tooltip__body--width_wide-EJBD96zX","common-tooltip__body--width_narrow":"common-tooltip__body--width_narrow-EJBD96zX","common-tooltip__body--no-padding":"common-tooltip__body--no-padding-EJBD96zX","common-tooltip__hotkey-block":"common-tooltip__hotkey-block-EJBD96zX","common-tooltip__hotkey-block--divider":"common-tooltip__hotkey-block--divider-EJBD96zX","common-tooltip__hotkey-text":"common-tooltip__hotkey-text-EJBD96zX","common-tooltip__hotkey-button":"common-tooltip__hotkey-button-EJBD96zX","common-tooltip__plus-sign":"common-tooltip__plus-sign-EJBD96zX"}},3343:(e,t,i)=>{"use strict";i.d(t,{Modifiers:()=>n,hashFromEvent:()=>a,hashShiftPlusEnter:()=>l,humanReadableHash:()=>d,humanReadableModifiers:()=>c,isMacKeyboard:()=>r,modifiersFromEvent:()=>o});var s=i(5325);const r=s.isMac||s.isIOS;var n;function o(e){let t=0;return e.shiftKey&&(t+=1024),e.altKey&&(t+=512),e.ctrlKey&&(t+=256),e.metaKey&&(t+=2048),t}function a(e){return o(e)|e.keyCode}!function(e){e[e.None=0]="None",e[e.Alt=512]="Alt",e[e.Shift=1024]="Shift",e[e.Mod=r?2048:256]="Mod",e[e.Control=256]="Control",e[e.Meta=2048]="Meta"}(n||(n={}));const l=1037;function c(e,t=!r){let i="";return 256&e&&(i+=u(r?"^":"Ctrl",t)),512&e&&(i+=u(r?"⌥":"Alt",t)),1024&e&&(i+=u(r?"⇧":"Shift",t)),2048&e&&(i+=u(r?"⌘":"Win",t)),i}const h={9:"⇥",13:"↵",27:"Esc",8:r?"⌫":"Backspace",32:"Space",35:"End",36:"Home",37:"←",38:"↑",39:"→",40:"↓",45:"Ins",46:"Del",188:",",191:"/"};for(let e=1;e<=16;e++)h[e+111]=`F${e}`;function d(e){let t=c(e);const i=255&e;return t+=i in h?h[i]:String.fromCharCode(i),t}function u(e,t){return`${e}${t?" + ":r?" ":""}`}},54717:(e,t,i)=>{"use strict";i.d(t,{isNativeUIInteraction:()=>n,isTextEditingField:()=>r});var s=i(3343);function r(e){if("INPUT"===e.tagName){const t=e.type;return"text"===t||"email"===t||"number"===t||"password"===t||"search"===t||"tel"===t||"url"===t}return"TEXTAREA"===e.tagName||e.isContentEditable}function n(e,t){if(!t)return!1;const i=255&e;if(27===i||i>>>4==7)return!1;switch(e^i){case s.Modifiers.Alt:return(38===i||40===i)&&"SELECT"===t.tagName||r(t);case s.Modifiers.Alt+s.Modifiers.Shift:return r(t);case s.Modifiers.Mod:if(67===i||!s.isMacKeyboard&&45===i){const e=t.ownerDocument&&t.ownerDocument.getSelection();if(e&&!e.isCollapsed)return!0}return r(t);case s.Modifiers.Mod+s.Modifiers.Shift:return i>=33&&i<=40&&r(t);case s.Modifiers.Shift:case 0:return 9===i?!(!t.ownerDocument||t===t.ownerDocument.body||t===t.ownerDocument.documentElement):(!function(e){if("BUTTON"===e.tagName)return!0;if("INPUT"===e.tagName){const t=e.type;if("submit"===t||"button"===t||"reset"===t||"checkbox"===t||"radio"===t)return!0}return!1}(t)||13===i||32===i||9===i)&&("form"in t||t.isContentEditable)}return!1}},5325:(e,t,i)=>{"use strict";i.d(t,{isAndroid:()=>_,isAnyMobile:()=>S,isBlackBerry:()=>m,isChrome:()=>a,isEdge:()=>c,isFF:()=>l,isIOS:()=>g,isIPad:()=>v,isLinux:()=>p,isMac:()=>d,isOperaMini:()=>f,isSafari:()=>h,isWindows:()=>u,
mobiletouch:()=>n,touch:()=>o});const s="undefined"!=typeof window&&"undefined"!=typeof navigator,r=s&&"ontouchstart"in window,n=s&&r&&"onorientationchange"in window,o=s&&(r||!!navigator.maxTouchPoints),a=s&&window.chrome&&window.chrome.runtime,l=s&&window.navigator.userAgent.toLowerCase().indexOf("firefox")>-1,c=s&&/\sEdge\/\d\d\b/.test(navigator.userAgent),h=s&&Boolean(navigator.vendor)&&navigator.vendor.indexOf("Apple")>-1&&-1===navigator.userAgent.indexOf("CriOS")&&-1===navigator.userAgent.indexOf("FxiOS"),d=s&&/mac/i.test(navigator.platform),u=s&&/Win32|Win64/i.test(navigator.platform),p=s&&/Linux/i.test(navigator.platform),_=s&&/Android/i.test(navigator.userAgent),m=s&&/BlackBerry/i.test(navigator.userAgent),g=s&&/iPhone|iPad|iPod/.test(navigator.platform),f=s&&/Opera Mini/i.test(navigator.userAgent),v=s&&("MacIntel"===navigator.platform&&navigator.maxTouchPoints>1||/iPad/.test(navigator.platform)),S=_||m||g||f},13273:(e,t,i)=>{"use strict";i.d(t,{t:()=>s});const s=i.tf},33013:(e,t,i)=>{"use strict";i.r(t),i.d(t,{colorsPalette:()=>d,findHexColorByName:()=>h,getHexColorByName:()=>u})
;const s=JSON.parse('{"color-white":"#ffffff","color-black":"#000000","color-transparent":"#00000000","color-cold-gray-50":"#F8F9FD","color-cold-gray-100":"#F0F3FA","color-cold-gray-150":"#E0E3EB","color-cold-gray-200":"#D1D4DC","color-cold-gray-250":"#C1C4CD","color-cold-gray-300":"#B2B5BE","color-cold-gray-350":"#A3A6AF","color-cold-gray-400":"#9598A1","color-cold-gray-450":"#868993","color-cold-gray-500":"#787B86","color-cold-gray-550":"#6A6D78","color-cold-gray-600":"#5D606B","color-cold-gray-650":"#50535E","color-cold-gray-700":"#434651","color-cold-gray-750":"#363A45","color-cold-gray-800":"#2A2E39","color-cold-gray-850":"#1E222D","color-cold-gray-900":"#131722","color-cold-gray-950":"#0C0E15","color-ripe-red-50":"#FFEBEC","color-ripe-red-100":"#FCCBCD","color-ripe-red-200":"#FAA1A4","color-ripe-red-300":"#F77C80","color-ripe-red-400":"#F7525F","color-ripe-red-500":"#F23645","color-ripe-red-600":"#CC2F3C","color-ripe-red-700":"#B22833","color-ripe-red-800":"#991F29","color-ripe-red-900":"#801922","color-ripe-red-a100":"#FF8080","color-ripe-red-a200":"#FF5252","color-ripe-red-a400":"#FF3333","color-ripe-red-a600":"#CC2929","color-ripe-red-a700":"#802028","color-ripe-red-a800":"#4D191D","color-ripe-red-a900":"#331F20","color-tan-orange-50":"#FFF3E0","color-tan-orange-100":"#FFE0B2","color-tan-orange-200":"#FFCC80","color-tan-orange-300":"#ffb74d","color-tan-orange-400":"#FFA726","color-tan-orange-500":"#FF9800","color-tan-orange-600":"#FB8C00","color-tan-orange-700":"#F57C00","color-tan-orange-800":"#EF6C00","color-tan-orange-900":"#e65100","color-tan-orange-a200":"#ffab40","color-tan-orange-a400":"#FF9100","color-tan-orange-a600":"#CC7014","color-tan-orange-a700":"#8C541C","color-tan-orange-a800":"#593A1B","color-tan-orange-a900":"#33261A","color-iguana-green-100":"#C8E6C9","color-iguana-green-200":"#A5D6A7","color-iguana-green-300":"#81c784","color-iguana-green-400":"#66BB6A","color-iguana-green-500":"#4caf50","color-iguana-green-600":"#43a047","color-iguana-green-700":"#388e3c","color-iguana-green-800":"#2E7D32","color-iguana-green-900":"#1B5E20","color-iguana-green-a700":"#00c853","color-banana-yellow-100":"#FFF9C4","color-banana-yellow-200":"#FFF59D","color-banana-yellow-300":"#FFF176","color-banana-yellow-400":"#ffee58","color-banana-yellow-500":"#ffeb3b","color-banana-yellow-600":"#fdd835","color-banana-yellow-700":"#fbc02d","color-banana-yellow-800":"#f9a825","color-banana-yellow-900":"#F57F17","color-banana-yellow-a400":"#ffea00","color-banana-yellow-a700":"#EEDA01","color-tv-blue-50":"#E3EFFD","color-tv-blue-100":"#BBD9FB","color-tv-blue-200":"#90BFF9","color-tv-blue-300":"#5B9CF6","color-tv-blue-400":"#3179F5","color-tv-blue-500":"#2962FF","color-tv-blue-600":"#1E53E5","color-tv-blue-700":"#1848CC","color-tv-blue-800":"#143EB3","color-tv-blue-900":"#0C3299","color-tv-blue-a100":"#82b1ff","color-tv-blue-a200":"#448aff","color-tv-blue-a400":"#2979ff","color-tv-blue-a600":"#2962FF","color-tv-blue-a700":"#143A87","color-tv-blue-a800":"#142E61","color-tv-blue-a900":"#132042","color-deep-blue-50":"#EDE7F6","color-deep-blue-100":"#D1C4E9","color-deep-blue-200":"#B39DDB","color-deep-blue-300":"#9575cd","color-deep-blue-400":"#7e57c2","color-deep-blue-500":"#673ab7","color-deep-blue-700":"#512da8","color-deep-blue-800":"#4527A0","color-deep-blue-900":"#311B92","color-deep-blue-a100":"#b388ff","color-deep-blue-a200":"#7C4DFF","color-deep-blue-a400":"#651FFF","color-deep-blue-a700":"#6200EA","color-minty-green-50":"#DAF2EE","color-minty-green-100":"#ACE5DC","color-minty-green-200":"#70CCBD","color-minty-green-300":"#42BDA8","color-minty-green-400":"#22AB94","color-minty-green-500":"#089981","color-minty-green-600":"#06806B","color-minty-green-700":"#056656","color-minty-green-800":"#004D40","color-minty-green-900":"#00332A","color-minty-green-a400":"#2BD9BC","color-minty-green-a600":"#24B29B","color-minty-green-a700":"#1B7667","color-minty-green-a800":"#10443B","color-minty-green-a900":"#082621","color-grapes-purple-50":"#F3E5F5","color-grapes-purple-100":"#E1BEE7","color-grapes-purple-200":"#CE93D8","color-grapes-purple-300":"#ba68c8","color-grapes-purple-400":"#ab47bc","color-grapes-purple-500":"#9c27b0","color-grapes-purple-600":"#8e24aa","color-grapes-purple-700":"#7b1fa2","color-grapes-purple-800":"#6A1B9A","color-grapes-purple-900":"#4A148C","color-grapes-purple-a100":"#EA80FC","color-grapes-purple-a200":"#E040FB","color-grapes-purple-a400":"#D500F9","color-grapes-purple-a700":"#aa00ff","color-berry-pink-100":"#F8BBD0","color-berry-pink-200":"#f48fb1","color-berry-pink-300":"#f06292","color-berry-pink-400":"#ec407a","color-berry-pink-500":"#e91e63","color-berry-pink-600":"#D81B60","color-berry-pink-700":"#C2185B","color-berry-pink-800":"#AD1457","color-berry-pink-900":"#880E4F","color-berry-pink-a100":"#ff80ab","color-berry-pink-a200":"#ff4081","color-berry-pink-a400":"#f50057","color-sky-blue-100":"#B2EBF2","color-sky-blue-200":"#80DEEA","color-sky-blue-300":"#4dd0e1","color-sky-blue-400":"#26c6da","color-sky-blue-500":"#00bcd4","color-sky-blue-600":"#00acc1","color-sky-blue-700":"#0097A7","color-sky-blue-800":"#00838F","color-sky-blue-900":"#006064","color-sky-blue-a400":"#00e5ff","color-sky-blue-a700":"#00B8D4","color-deep-blue-600":"#5E35B1","color-forest-green-50":"#DAF2E6","color-forest-green-100":"#ACE5C9","color-forest-green-200":"#70CC9E","color-forest-green-300":"#42BD7F","color-forest-green-400":"#22AB67","color-forest-green-500":"#089950","color-forest-green-600":"#068043","color-forest-green-700":"#056636","color-forest-green-800":"#004D27","color-forest-green-900":"#1A3326","color-facebook":"#1877F2","color-deep-facebook":"#1564CA","color-twitter":"#1DA1F2","color-deep-twitter":"#188CD3","color-youtube":"#FF0000","color-linkedin":"#007BB5","color-seeking-alpha-brand":"#ff7200"}'),r=JSON.parse('{"color-header-bg":"color-white","color-body-bg":"color-white","color-body-secondary-bg":"color-cold-gray-100","color-bg-primary":"color-white","color-bg-primary-hover":"color-cold-gray-100","color-bg-secondary":"color-white","color-bg-highlight":"color-cold-gray-50","color-bg-scroll-buttons":"color-cold-gray-100","color-legacy-bg-scroll-buttons":"color-cold-gray-850","color-legacy-bg-widget":"color-white","color-text-primary":"color-cold-gray-900","color-text-secondary":"color-cold-gray-550","color-text-tertiary":"color-cold-gray-400","color-text-disabled":"color-cold-gray-300","color-accent-content":"color-cold-gray-900","color-box-shadow":"color-cold-gray-300","color-divider":"color-cold-gray-150","color-divider-hover":"color-cold-gray-100","color-divider-secondary":"color-cold-gray-100","color-active-hover-text":"color-cold-gray-900","color-alert-text":"color-cold-gray-900","color-border-table":"color-cold-gray-100","color-brand":"color-tv-blue-500","color-brand-active":"color-tv-blue-700","color-brand-hover":"color-tv-blue-600","color-chart-page-bg":"color-cold-gray-150","color-common-tooltip-bg":"color-cold-gray-800","color-danger":"color-ripe-red-400","color-danger-hover":"color-ripe-red-500","color-danger-active":"color-ripe-red-600","color-depthrenderer-stroke-style":"color-cold-gray-100","color-halal":"color-iguana-green-400","color-continuous":"color-cold-gray-500","color-highlight-new":"color-tan-orange-50","color-input-bg":"color-white","color-input-publish-bg":"color-white","color-link":"color-tv-blue-500","color-link-hover":"color-tv-blue-600","color-link-active":"color-tv-blue-700","color-list-nth-child-bg":"color-cold-gray-50","color-pane-bg":"color-white","color-pane-secondary-bg":"color-cold-gray-100","color-popup-menu-item-hover-bg":"color-cold-gray-100","color-popup-menu-separator":"color-cold-gray-150","color-primary-symbol":"color-sky-blue-500","color-screener-description":"color-cold-gray-650","color-success":"color-minty-green-500","color-success-hover":"color-minty-green-600","color-success-active":"color-minty-green-700","color-toolbar-button-text":"color-cold-gray-900","color-toolbar-button-text-hover":"color-cold-gray-900","color-toolbar-button-text-active":"color-tv-blue-500","color-toolbar-button-text-active-hover":"color-tv-blue-600","color-toolbar-button-background-hover":"color-cold-gray-100","color-toolbar-button-background-secondary-hover":"color-cold-gray-150","color-toolbar-button-background-active":"color-tv-blue-50","color-toolbar-button-background-active-hover":"color-tv-blue-100","color-toolbar-toggle-button-background-active":"color-tv-blue-500","color-toolbar-toggle-button-background-active-hover":"color-tv-blue-600","color-toolbar-toggle-button-icon":"color-cold-gray-200","color-toolbar-interactive-element-text-normal":"color-cold-gray-900","color-toolbar-opened-element-bg":"color-cold-gray-100","color-toolbar-divider-background":"color-cold-gray-150","color-popup-background":"color-white","color-popup-element-text":"color-cold-gray-900","color-popup-element-text-hover":"color-cold-gray-900","color-popup-element-background-hover":"color-cold-gray-100","color-popup-element-secondary-text":"color-cold-gray-500","color-popup-element-hint-text":"color-cold-gray-400","color-popup-element-text-active":"color-white","color-popup-element-background-active":"color-tv-blue-500","color-popup-element-toolbox-text":"color-cold-gray-500","color-popup-element-toolbox-text-hover":"color-cold-gray-900","color-popup-element-toolbox-text-active-hover":"color-tv-blue-200","color-popup-element-toolbox-background-hover":"color-cold-gray-150","color-popup-element-toolbox-background-active-hover":"color-tv-blue-700","color-tooltip-bg":"color-cold-gray-800","color-tv-dialog-caption":"color-cold-gray-650","color-tv-dropdown-item-hover-bg":"color-cold-gray-100","color-underlined-text":"color-cold-gray-550","color-widget-pages-bg":"color-white","color-warning":"color-tan-orange-500","color-growing":"color-minty-green-500","color-falling":"color-ripe-red-500","color-forex-icon":"color-cold-gray-750","color-list-item-active-bg":"color-tv-blue-400","color-list-item-hover-bg":"color-tv-blue-50","color-list-item-text":"color-cold-gray-800","color-price-axis-label-back":"color-cold-gray-150","color-price-axis-label-text":"color-cold-gray-650","color-price-axis-gear":"color-cold-gray-900","color-price-axis-gear-hover":"color-black","color-price-axis-highlight":"color-cold-gray-150","color-bid":"color-tv-blue-500","color-border":"color-cold-gray-150","color-border-chat-fields":"color-cold-gray-250","color-border-hover":"color-cold-gray-250","color-button-hover-bg":"color-cold-gray-150","color-depthrenderer-fill-style":"color-cold-gray-650","color-disabled-border-and-color":"color-cold-gray-150","color-disabled-input":"color-cold-gray-150","color-empty-container-message":"color-cold-gray-550","color-icons":"color-cold-gray-550","color-input-textarea-readonly":"color-cold-gray-650","color-input-placeholder-text":"color-cold-gray-350","color-item-active-blue":"color-tv-blue-50","color-item-hover-active-bg":"color-tv-blue-100","color-item-hover-bg":"color-tv-blue-100","color-item-hover-blue":"color-tv-blue-100","color-item-selected-blue":"color-tv-blue-50","color-item-active-text":"color-white","color-item-active-bg":"color-tv-blue-500","color-list-item":"color-cold-gray-550","color-news-highlight":"color-tv-blue-100","color-placeholder":"color-cold-gray-350","color-row-hover-active-bg":"color-cold-gray-100","color-sb-scrollbar-body-bg":"color-cold-gray-200","color-section-separator-border":"color-cold-gray-300","color-separator-table-chat":"color-cold-gray-150","color-tag-active-bg":"color-cold-gray-200","color-tag-hover-bg":"color-cold-gray-150","color-text-regular":"color-cold-gray-700","color-tv-button-checked":"color-cold-gray-550","color-scroll-bg":"color-cold-gray-400","color-scroll-border":"color-cold-gray-100","color-widget-border":"color-cold-gray-100","color-scroll-buttons-arrow":"color-white","color-control-intent-default":"color-cold-gray-200","color-control-intent-success":"color-minty-green-500","color-control-intent-primary":"color-tv-blue-500","color-control-intent-warning":"color-tan-orange-500","color-control-intent-danger":"color-ripe-red-500","color-goto-label-background":"color-cold-gray-800","color-pre-market":"color-tan-orange-600","color-pre-market-bg":"color-tan-orange-400","color-post-market":"color-tv-blue-500","color-post-market-bg":"color-tv-blue-400","color-market-open":"color-minty-green-500","color-market-open-bg":"color-minty-green-400","color-market-closed":"color-cold-gray-400","color-market-holiday":"color-cold-gray-400","color-market-expired":"color-ripe-red-500","color-invalid-symbol":"color-ripe-red-400","color-invalid-symbol-hover":"color-ripe-red-700","color-replay-mode":"color-tv-blue-500","color-replay-mode-point-select":"color-cold-gray-350","color-replay-mode-icon":"color-white","color-replay-mode-hover":"color-tv-blue-600","color-notaccurate-mode":"color-berry-pink-600","color-delay-mode":"color-tan-orange-700","color-delay-mode-bg":"color-tan-orange-400","color-eod-mode":"color-grapes-purple-700","color-eod-mode-bg":"color-grapes-purple-400","color-data-problem":"color-ripe-red-600","color-data-problem-bg":"color-ripe-red-400","color-data-problem-hover":"color-ripe-red-700","color-list-item-bg-highlighted":"color-tv-blue-50","color-list-item-bg-selected":"color-tv-blue-100","color-list-item-bg-highlighted-hover":"color-tv-blue-100","color-list-item-bg-selected-hover":"color-tv-blue-200","color-screener-header-bg":"color-white","color-screener-header-bg-hover":"color-cold-gray-100","color-marker-flagged":"color-ripe-red-400","color-marker-flagged-hovered":"color-ripe-red-600","color-ask":"color-ripe-red-400","color-sell":"color-ripe-red-400","color-buy":"color-tv-blue-500","color-neutral":"color-cold-gray-550","color-pro":"color-minty-green-400","color-pro-hover":"color-minty-green-600","color-pro-plus":"color-tv-blue-500","color-pro-plus-hover":"color-tv-blue-600","color-pro-premium":"color-tan-orange-500","color-pro-premium-hover":"color-tan-orange-700","color-trial":"color-cold-gray-550","color-trial-hover":"color-cold-gray-550","color-mod":"color-ripe-red-400","color-mod-hover":"color-ripe-red-600","color-ad":"color-tan-orange-500","color-broker-featured":"color-minty-green-400","color-broker-featured-hover":"color-minty-green-600","color-alert-status-active":"color-minty-green-400","color-alert-status-stopped":"color-ripe-red-500","color-alert-status-triggered":"color-tan-orange-500","color-overlay":"color-cold-gray-400","color-search-button-hover":"color-cold-gray-150","color-boost-button-content-selected":"color-tv-blue-600","color-boost-button-content-hover":"color-cold-gray-900","color-boost-button-bg-hover":"color-cold-gray-150","color-boost-button-border-hover":"color-cold-gray-150","color-boost-button-border-default":"color-cold-gray-150","color-common-tooltip-text":"color-cold-gray-100","color-replay-data-mode":"color-ripe-red-400","color-legacy-success":"color-minty-green-300","color-collapse-tabs-border":"color-cold-gray-100","color-site-widget-hover":"color-cold-gray-50","color-attention":"color-banana-yellow-700","color-x-twitter-content":"color-cold-gray-900","color-card-border":"color-cold-gray-150","color-card-border-hover":"color-cold-gray-300","color-background-special-primary":"color-white","color-stroke-special-primary":"color-cold-gray-150","color-selection-bg":"color-tv-blue-100","color-default-gray":"color-cold-gray-550","color-featured-broker-badge-bg":"color-cold-gray-900","color-featured-broker-badge-bg-hover":"color-cold-gray-800","color-featured-broker-badge-text":"color-white"}')
;var n=i(50151);const o={...s,...r},a={},l=Object.keys(o).length,c=/^#(([a-f0-9]{2}){2,4}|[a-f0-9]{3})$/i;function h(e,t=[],i=o){const s=i[e];if(!s)return null;if(c.test(s))return s;const r=s;return t.push(e),-1!==t.indexOf(r)?(console.warn("Colors definitions cycled"),s):t.length>l?(console.warn("Too many variables-link in HEX-color search: "+t[0]),null):h(r,t,i)}Object.keys(o).forEach((e=>{const t=h(e);a[e]=(0,n.ensureNotNull)(t)}));const d=a;function u(e,t=d){const i=t[e];if(!i)throw new Error("No such color "+e);return i}},74991:(e,t,i)=>{"use strict";i.d(t,{CubicBezier:()=>n,dur:()=>s,easingFunc:()=>r});const s=350,r={linear:e=>e,easeInQuad:e=>e*e,easeOutQuad:e=>e*(2-e),easeInOutQuad:e=>e<.5?2*e*e:(4-2*e)*e-1,easeInCubic:e=>e*e*e,easeOutCubic:e=>--e*e*e+1,easeInOutCubic:e=>e<.5?4*e*e*e:(e-1)*(2*e-2)*(2*e-2)+1,easeInQuart:e=>e*e*e*e,easeOutQuart:e=>1- --e*e*e*e,easeInOutQuart:e=>e<.5?8*e*e*e*e:1-8*--e*e*e*e,easeInQuint:e=>e*e*e*e*e,easeOutQuint:e=>1+--e*e*e*e*e,easeInOutQuint:e=>e<.5?16*e*e*e*e*e:1+16*--e*e*e*e*e};class n{constructor(e,t,i,s){this._mX1=e,this._mY1=t,this._mX2=i,this._mY2=s}easingFunc(e){return this._mX1===this._mY1&&this._mX2===this._mY2?e:this._calcBezier(this._getTForX(e))}_a(e,t){return 1-3*t+3*e}_b(e,t){return 3*t-6*e}_c(e){return 3*e}_calcBezier(e){return((this._a(this._mY1,this._mY2)*e+this._b(this._mY1,this._mY2))*e+this._c(this._mY1))*e}_getSlope(e){return 3*this._a(this._mX1,this._mX2)*e*e+2*this._b(this._mX1,this._mX2)*e+this._c(this._mX1)}_getTForX(e){let t=e;for(let i=0;i<4;++i){const i=this._getSlope(t);if(0===i)return t;t-=(this._calcBezier(t)-e)/i}return t}}},58096:(e,t,i)=>{"use strict";i.d(t,{DEFAULT_SIZE:()=>s,spinnerSizeMap:()=>r});const s="large",r={mini:"xsmall",xxsmall:"xxsmall",xsmall:"xsmall",small:"small",medium:"medium",large:"large"}},94194:(e,t,i)=>{"use strict";i.d(t,{getTooltipData:()=>r,setTooltipData:()=>n});const s=new WeakMap;function r(e,t){const i=s.get(e);return i instanceof Function?i(t):i&&i[t]}function n(e,t,i){if(i instanceof Function)return void s.set(e,i);const r=s.get(e),n=void 0===r||r instanceof Function?{}:r;n[t]=i,s.set(e,n)}},61814:(e,t,i)=>{"use strict";i.d(t,{hotKeyDeserialize:()=>n,hotKeySerialize:()=>r});var s=i(54358);function r(e){return(0,s.clean)(JSON.stringify(e))}function n(e){return JSON.parse((0,s.clean)(e,!0))}},38780:(e,t,i)=>{"use strict";i.d(t,{hide:()=>$,show:()=>U,showOnElement:()=>z,tooltipClickHandler:()=>j});var s=i(32563);let r=0,n=0,o=0;function a(){clearTimeout(r),clearTimeout(n),clearTimeout(o)}function l(e,t){r=setTimeout(e,t)}const c="tooltip-root-element";let h;function d(){const e=document.getElementById(c);e?h=e:(h=document.createElement("div"),h.id=c,document.body.appendChild(h))}function u(){h&&(h.innerHTML="")}"interactive"===document.readyState?d():document.addEventListener("DOMContentLoaded",d);var p=i(50151);const _={default:"",white:"theme-white",chart:"theme-chart","round-shadow":"theme-round-shadow"},m=Object.keys(_);var g=i(94194),f=i(61814),v=i(70027),S=i(38223),y=(i(42053),
i(21861)),b=i(37160),w=i(49483),C=i(68477);function P(e){const t=function(e){const t=e.hasAttribute("data-tooltip")?e.getAttribute("data-tooltip"):e.getAttribute("title");return t&&((0,g.setTooltipData)(e,"text",t),e.removeAttribute("title")),(0,g.getTooltipData)(e,"text")||""}(e),i=e.getBoundingClientRect(),s={h:i.height,w:i.width,x:i.left,y:i.top},r=e.getAttribute("data-color-theme")||"",n=e.classList.contains("common-tooltip-html"),o=parseInt(e.getAttribute("data-tooltip-delay")||""),a=parseInt(e.getAttribute("data-tooltip-debounce")||"");let l={type:"none"};return t&&(l={type:n?"html":"text",data:t}),{above:e.classList.contains("common-tooltip-above"),below:e.classList.contains("common-tooltip-below"),otl:e.classList.contains("common-tooltip-otl"),otr:e.classList.contains("common-tooltip-otr"),vertical:e.classList.contains("common-tooltip-vertical"),hotkey:e.getAttribute("data-tooltip-hotkey"),narrow:e.classList.contains("common-tooltip-narrow"),wide:e.classList.contains("common-tooltip-wide"),colorTheme:r,tooltipDelay:o,tooltipDebounce:a,rect:s,content:l,target:e}}function x(e){const t=D.cloneNode(!0),i=B(t),{content:s}=e;switch(s.type){case"element":i.innerHTML="",i.appendChild(s.data);break;case"html":i.innerHTML=s.data;break;case"text":if(e.hotkey){const e=V.cloneNode(!0);e.innerText=s.data,i.appendChild(e)}else i.innerText=s.data}if(e.hotkey){const t="none"!==s.type,r=E.cloneNode(!0),n=(0,f.hotKeyDeserialize)(e.hotkey),o=n.keys.map((e=>`${e}`));r.innerHTML=function(e,t){const i=/{\d}|{hotkey_\d}/gi;return e.replace(i,(e=>{const i=Number(e.match(/\d/));return t[i]}))}(n.text,o).replace(/\s\+\s/g,`+`),i.classList.add(C["common-tooltip__body--with-hotkey"]),t&&r.classList.add(C["common-tooltip__hotkey-block--divider"]),i.appendChild(r)}return t.addEventListener("contextmenu",y.preventDefault),t}function T(e,t){const i=t.rect;if(!i)return;!function(e,t){const i=m.includes(t)?_[t]:"";e.classList.remove(...m.map((e=>_[e])).filter((e=>!!e))),i&&!e.classList.contains(i)&&e.classList.add(i)}(e,t.colorTheme||"default"),t.addClass&&e.classList.add(t.addClass);const s=B(e),r=e.querySelector(`.${C["common-tooltip__button-container"]}`);s.classList.toggle(C["common-tooltip__body--width_wide"],Boolean(t.wide)),s.classList.toggle(C["common-tooltip__body--no-padding"],Boolean(t.noPadding)),s.classList.toggle(C["common-tooltip__body--width_narrow"],Boolean(t.narrow)),s.classList.toggle(C["common-tooltip__body--no-buttons"],!0),s.style.left=M(0),s.style.width=M(s.clientWidth+(Boolean(t.noPadding)?0:2));const n=document.body.clientWidth,o=w.CheckMobile.iOS()||w.CheckMobile.Android()||(0,w.supportTouch)()&&(0,w.isMac)()?window.innerHeight:document.body.clientHeight,a=t.vertical,l=t.extendMargin||a&&i.w<20||!a&&i.h<20;e.classList.toggle(C["common-tooltip--farther"],l),e.classList.toggle(C["common-tooltip--vertical"],a),e.classList.toggle(C["common-tooltip--horizontal"],!a);const c=function(e){
return e.querySelector(`.${C["common-tooltip__ear-holder"]}`)}(e),h=e.offsetHeight;if(a){const a=10,l=o-10,d=12,u=a+d,p=l-d,_=(0,b.clamp)(i.y+i.h/2,u,p)-h/2,m=_+h;e.style.left=M(i.x+i.w),e.style.top=M(_),_l&&(s.style.top=r.style.top=M(l-m));const{right:g}=(e.querySelector(":last-child")||s).getBoundingClientRect(),f=g+10>n;e.classList.toggle(C["common-tooltip--direction_reversed"],f),e.classList.toggle(C["common-tooltip--direction_normal"],!f);let v=f?"after":"before";(0,S.isRtl)()?(v=t.otr?"after":v,v=t.otl?"before":v):(v=t.otr?"before":v,v=t.otl?"after":v),c.classList.toggle(C["common-tooltip__ear-holder--before"],"before"===v),c.classList.toggle(C["common-tooltip__ear-holder--after"],"after"===v),"after"===v&&(e.style.left="auto",e.style.right=M(n-i.x))}else{const a=i.x-(s.offsetWidth-i.w)/2,l=n-10-e.offsetWidth,d=Math.max(10,Math.min(a,l));e.style.left=M(d);const u=l\n\t\t\n\t\t\n\t\n`,L=`\n\t\n`,k=`\n\t\n`,D=(0,v.parseHtmlElement)(A),E=(0,v.parseHtmlElement)(L),V=(0,v.parseHtmlElement)(k);function B(e){return e.querySelector(`.${C["common-tooltip__body"]}`)}function R(e,t){return 10+e{W&&(W.destroy(),W=null)};for(const t of r){if("buttons"in e){if(1&e.buttons)continue}else if(1===e.which)continue;const i=()=>z(t);if(i()){const e=e=>s(null,!0),s=(r,o=!1)=>{t.removeEventListener("common-tooltip-update",i),t.removeEventListener("mouseleave",s),t.removeEventListener("mousedown",s),
document.removeEventListener("scroll",e,{capture:!0}),n(),$(o)};t.addEventListener("common-tooltip-update",i),t.addEventListener("mouseleave",s),t.addEventListener("mousedown",s),document.addEventListener("scroll",e,{capture:!0}),null===W&&(W=(0,N.createGroup)({desc:"Tooltip"}),W.add({desc:"Hide",hotkey:27,handler:s}));break}}}),!0);const H=new MutationObserver((()=>{if(F&&F.options.target){let e;e="isConnected"in F.options.target?F.options.target.isConnected:document.body.contains(F.options.target),e||$()}})),z=(e,t={})=>{const{content:i,...s}=Z(t),r=P(e),n=Object.assign(r,s);return"none"!==i.type&&(n.content=i),!("none"===n.content.type&&!n.hotkey)&&(n.target=e,U(n),!0)},U=e=>{const t=Z(e),i=x(t);var s;if(F={options:t,element:i},s=i,u(),h&&h.appendChild(s),a(),!O)return I(i),void l((()=>Y(i)),function(e){return"number"!=typeof e.tooltipDelay||isNaN(e.tooltipDelay)?500:e.tooltipDelay}(t));const{tooltipDebounce:r}=e;"number"!=typeof r||isNaN(r)?Y(i):l((()=>Y(i)),r)};function j(e){var t;s.mobiletouch&&(z(e.currentTarget,{tooltipDelay:0}),document.addEventListener("scroll",G),document.addEventListener("touchstart",G),window.addEventListener("orientationchange",G),null===(t=window.screen.orientation)||void 0===t||t.addEventListener("change",G))}function G(){var e;document.removeEventListener("scroll",G),document.removeEventListener("touchstart",G),window.removeEventListener("orientationchange",G),null===(e=window.screen.orientation)||void 0===e||e.removeEventListener("change",G),$()}function q(){u(),O=!1,F=null}const $=e=>{if(a(),H.disconnect(),!F)return;if(!e&&!O)return;const{element:t,options:i}=F,s=()=>{t.removeEventListener("mouseleave",s),I(t),e?q():o=setTimeout((()=>{q()}),250)};var r,l;i.tooltipHideDelay?(r=()=>{t.querySelector(":hover")?t.addEventListener("mouseleave",s):s()},l=i.tooltipHideDelay,n=setTimeout(r,l)):s()};function Y(e){const{options:t}=(0,p.ensureNotNull)(F);if(T(e,t),function(e){e.classList.toggle(C["common-tooltip--hidden"],!1)}(e),H.observe(document,{childList:!0,subtree:!0}),O=!0,t.forceHideOnMove){const e=()=>{document.removeEventListener("mousemove",e),document.removeEventListener("touchmove",e),$()};document.addEventListener("mousemove",e),document.addEventListener("touchmove",e)}}function K(e){return e&&(e.nodeType===Node.ELEMENT_NODE?e:null)}function Z(e){if(function(e){return"content"in e}(e))return e;const{inner:t,html:i,text:s,...r}=e;let n={type:"none"};return t&&(n={type:"element",data:t}),s&&(n={type:i?"html":"text",data:s}),{content:n,...r}}},31940:(e,t,i)=>{"use strict";i.d(t,{ResizerDetacherState:()=>n});var s=i(50151),r=i(97145);class n{constructor(e){this._alive=new r.WatchedValue,this._container=new r.WatchedValue,this._width=new r.WatchedValue,this._height=new r.WatchedValue,this._fullscreen=new r.WatchedValue,this._detachable=new r.WatchedValue,this._fullscreenable=new r.WatchedValue,this._visible=new r.WatchedValue,this._availWidth=new r.WatchedValue,this._availHeight=new r.WatchedValue,this._owner=new r.WatchedValue,this._ownersStack=[],this.owner=this._owner.readonly(),
this._bridge={alive:this._alive.readonly(),container:this._container.readonly(),width:this._width.readonly(),height:this._height.readonly(),fullscreen:this._fullscreen.readonly(),detachable:this._detachable.readonly(),fullscreenable:this._fullscreenable.readonly(),visible:this._visible.readonly(),availWidth:this._availWidth.readonly(),availHeight:this._availHeight.readonly(),remove:()=>{const e=this._owner.value();e&&e.remove&&e.remove()},negotiateWidth:e=>{const t=this._owner.value();t&&t.negotiateWidth&&t.negotiateWidth(e)},negotiateHeight:e=>{const t=this._owner.value();t&&t.negotiateHeight&&t.negotiateHeight(e)},requestFullscreen:()=>{const e=this._owner.value();e&&e.requestFullscreen&&e.requestFullscreen()},exitFullscreen:()=>{const e=this._owner.value();e&&e.exitFullscreen&&e.exitFullscreen()},detach:e=>{const t=this._owner.value();t&&t.detach&&t.detach(e)},attach:()=>{const e=this._owner.value();e&&e.attach&&e.attach()}},e&&this.pushOwner(e)}bridge(){return this._bridge}pushOwner(e){if(!e.alive.value())return;for(const e of this._ownersStack)this._unsubscribeOwner(e);const t={owner:e};this._ownersStack.push(t),this._subscribeOwner(t)}_subscribeOwner(e){const t=e.owner;if(e.deathWatcher||(this._alive.setValue(!0),e.deathWatcher=t.alive.spawn(),e.deathWatcher.subscribe((t=>{t||this._deadHandler(e)}))),this._owner.setValue(t),!e.subscriptions){const i=e.subscriptions=[];this._visible.setValue(!1);const s=(e,t)=>{if(e){const s=e.spawn();i.push(s),s.subscribe((e=>{t.setValue(e)}),{callWithLast:!0})}else t.deleteValue()};s(t.container,this._container),s(t.width,this._width),s(t.height,this._height),s(t.fullscreen,this._fullscreen),s(t.detachable,this._detachable),s(t.fullscreenable,this._fullscreenable),s(t.availWidth,this._availWidth),s(t.availHeight,this._availHeight),s(t.visible,this._visible)}}_unsubscribeOwner(e,t){if(e.subscriptions){for(const t of e.subscriptions)t.unsubscribe();e.subscriptions=null}t&&e.deathWatcher&&(e.deathWatcher.unsubscribe(),e.deathWatcher=null)}_deadHandler(e){const t=this._ownersStack.indexOf(e);(0,s.assert)(-1!==t,"sanitized owner should be in stack");for(let e=this._ownersStack.length-1;e>=t;e--)this._unsubscribeOwner(this._ownersStack[e],!0);this._ownersStack.length=t,t>0?this._subscribeOwner(this._ownersStack[t-1]):(this._alive.setValue(!1),this._owner.deleteValue())}}},45973:(e,t,i)=>{"use strict";i.r(t),i.d(t,{entityForDataSource:()=>c,lineToolEntityInfo:()=>o,seriesEntityInfo:()=>l,studyEntityInfo:()=>a});var s=i(28853),r=i(88913),n=i(92249);function o(e){return{id:e.id(),name:(t=e.toolname,Object.keys(r.supportedLineTools).find((e=>r.supportedLineTools[e].name===t))||null)};var t}function a(e){return{id:e.id(),name:e.metaInfo().description}}function l(e){return{id:e.id(),name:"Main Series"}}function c(e,t){return t===e.mainSeries()?l(e.mainSeries()):(0,s.isStudy)(t)?a(t):(0,n.isLineTool)(t)?o(t):null}},68582:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LineDataSourceApi:()=>c,isLineToolRiskReward:()=>a});var s=i(50151),r=i(1722)
;const n=new Map([["LineToolBezierQuadro",3],["LineToolBezierCubic",4]]);function o(e){const t=n.get(e.toolname);if(void 0!==t)return t;const i=e.pointsCount();return-1===i?e.points().length:i}function a(e){return"LineToolRiskRewardLong"===e||"LineToolRiskRewardShort"===e}const l=["alwaysShowStats","entryPrice","inputs.first bar time","inputs.last bar time","interval","linesWidths","points","snapTo45Degrees","stopPrice","symbol","symbolStateVersion","currencyId","unitId","targetPrice","zOrderVersion"];class c{constructor(e,t,i){this._source=e,this._undoModel=t,this._model=t.model(),this._pointsConverter=i}isSelectionEnabled(){return this._source.isSelectionEnabled()}setSelectionEnabled(e){this._source.setSelectionEnabled(e)}isSavingEnabled(){return this._source.isSavedInChart()}setSavingEnabled(e){this._source.setSavingInChartEnabled(e)}isShowInObjectsTreeEnabled(){return this._source.showInObjectTree()}setShowInObjectsTreeEnabled(e){this._source.setShowInObjectsTreeEnabled(e)}isUserEditEnabled(){return this._source.userEditEnabled()}setUserEditEnabled(e){this._source.setUserEditEnabled(e)}bringToFront(){this._model.bringToFront([this._source])}sendToBack(){this._model.sendToBack([this._source])}getProperties(){return this._source.properties().state(l,!0)}setProperties(e){this._setProps(this._source.properties(),e,"")}getPoints(){let e=this._source.points();const t=o(this._source);return e.length>t&&((0,s.assert)(a(this._source.toolname)),e=e.slice(0,t)),this._pointsConverter.dataSourcePointsToPriced(e)}setPoints(e){if(this._source.isFixed())return;const t=o(this._source);if(t!==e.length)throw new Error(`Wrong points count. Required: ${t}, provided: ${e.length}`);const i=this._pointsConverter.apiPointsToDataSource(e);this._model.startChangingLinetool(this._source),this._model.changeLinePoints(this._source,i),this._model.endChangingLinetool(!0),this._source.createServerPoints()}getAnchoredPosition(){return this._source.positionPercents()}setAnchoredPosition(e){const t=this._source.fixedPoint(),i=this._source.linkKey().value(),s=void 0===t?null:this._source.screenPointToPoint(t);if(!this._source.isFixed()||void 0===t||null===i||null===s)return;const r={logical:s,screen:t},n=new Map;n.set(i,e),this._model.startMovingSources([this._source],r,null,new Map),this._model.moveSources(r,n),this._model.endMovingSources(!0)}ownerSourceId(){return(0,s.ensureNotNull)(this._source.ownerSource()).id()}changePoint(e,t){if(this._source.isFixed())return;const i=this._pointsConverter.apiPointsToDataSource([e])[0];this._model.startChangingLinetool(this._source,{...i},t),this._model.changeLinePoint({...i}),this._model.endChangingLinetool(!1),this._source.createServerPoints()}isHidden(){return this._source.isSourceHidden()}getRawPoints(){return this._source.points()}setRawPoint(e,t){this._model.startChangingLinetool(this._source,{...t},e),this._model.changeLinePoint({...t}),this._model.endChangingLinetool(!1)}move(e,t){this._model.startMovingSources([this._source],{logical:e},null,new Map),this._model.moveSources({logical:t},new Map),
this._model.endMovingSources(!1)}dataAndViewsReady(){return this._source.dataAndViewsReady()}zorder(){return this._source.zorder()}symbol(){return this._source.properties().symbol.value()}currency(){return this._source.properties().currencyId.value()}unit(){return this._source.properties().unitId.value()}share(e){this._undoModel.shareLineTools([this._source],e)}setVisible(e,t=!1){this._undoModel.setProperty(this._source.properties().visible,e,null,t)}sharingMode(){return this._source.sharingMode().value()}_setProps(e,t,i){for(const s in t){if(!t.hasOwnProperty(s))continue;const n=0===i.length?s:`${i}.${s}`;if(e.hasOwnProperty(s)){const i=t[s];(0,r.isHashObject)(i)?this._setProps(e[s],i,n):e[s].setValue(i)}else console.warn(`Unknown property "${n}"`)}}}},32112:(e,t,i)=>{"use strict";function s(e,t){const i=e.dataSourceForId(t);if(null===i)throw new Error(`Chart has no study or shape with id "${t}"`);return i}i.d(t,{SelectionApi:()=>r});class r{constructor(e){this._model=e}add(e){Array.isArray(e)?this._model.selectionMacro((t=>{e.map(s.bind(null,this._model)).forEach((e=>t.addSourceToSelection(e)))})):this.add([e])}canBeAddedToSelection(e){const t=s(this._model,e);return this._model.selection().canBeAddedToSelection(t)}set(e){Array.isArray(e)?this._model.selectionMacro((t=>{t.clearSelection(),e.map(s.bind(null,this._model)).forEach((e=>t.addSourceToSelection(e)))})):this.set([e])}remove(e){Array.isArray(e)?this._model.selectionMacro((t=>{e.map(s.bind(null,this._model)).forEach((e=>t.removeSourceFromSelection(e)))})):this.remove([e])}contains(e){const t=s(this._model,e);return this._model.selection().isSelected(t)}allSources(){return this._model.selection().dataSources().map((e=>e.id()))}isEmpty(){return this._model.selection().isEmpty()}clear(){this._model.selectionMacro((e=>{e.clearSelection()}))}onChanged(){return this._model.onSelectedSourceChanged()}}},152:(e,t,i)=>{"use strict";i.d(t,{getStudyInputsInfo:()=>r});var s=i(11542);function r(e){return void 0===e.inputs?[]:e.inputs.map((e=>({...e,id:e.id,localizedName:void 0!==e.name?s.t(e.name,{context:"input"},i(88601)):""})))}},70120:(e,t,i)=>{"use strict";i.d(t,{getStudyStylesInfo:()=>r});var s=i(27788);function r(e){const t={};if(e.defaults){const i=(0,s.default)(e.defaults);t.defaults=i}return void 0!==e.plots&&(t.plots=(0,s.default)(e.plots)),void 0!==e.styles&&(t.styles=(0,s.default)(e.styles)),void 0!==e.bands&&(t.bands=(0,s.default)(e.bands)),void 0!==e.filledAreas&&(t.filledAreas=(0,s.default)(e.filledAreas)),void 0!==e.palettes&&(t.palettes=(0,s.default)(e.palettes)),t}},23024:(e,t,i)=>{"use strict";i.d(t,{getChartStorage:()=>n});var s=i(58844);let r=null;async function n(){const e=(0,s.getCustomAdapter)();if(null===r)if(null!==e){const{ChartStorageExternalAdapter:t}=await i.e(8313).then(i.bind(i,33047));r=new t(e)}else{const{ChartStorageHttpLibrary:e}=await i.e(6124).then(i.bind(i,96445));r=new e}return null===r&&(r=new ChartStorageHttp),r}},38881:(e,t,i)=>{"use strict";i.d(t,{ChunkLoader:()=>r});var s=i(45884);class r{constructor(){this._retries=5,
this._cache=null,this._tryLoad=(e,t)=>{this._retries=this._retries-1;this._startLoading(e).then(t,0!==this._retries?i=>{(0,s.isAbortError)(i)||setTimeout((()=>this._tryLoad(e,t)),3e3)}:void 0)}}load(e){return this._cache||(this._cache=new Promise(this._tryLoad.bind(this,null!=e?e:null))),this._cache}}},65446:(e,t,i)=>{"use strict";i.d(t,{copyToClipboard:()=>r,writeImpl:()=>n,writePromiseUsingApi:()=>a});var s=i(93352);function r(e){return n(e,null)}function n(e,t){const i=e.files&&e.files.length>0;if(!i&&t&&t.eventPhase>0)return o(t,e),Promise.resolve();if(!i){let t=!1;const i=i=>{i.stopImmediatePropagation(),o(i,e),t=!0};try{document.addEventListener("copy",i,!0),document.execCommand("copy")}finally{document.removeEventListener("copy",i,!0)}if(t)return Promise.resolve()}return async function(e){const t=(0,s.getClipboard)();if(!t||!t.write||!window.ClipboardItem)throw new DOMException("ClipboardApi is not supported","NotSupportedError");const i={};for(const t of e.files||[])i[t.type]=t;e.text&&(i["text/plain"]=e.text);e.html&&(i["text/html"]=e.html);return t.write([new window.ClipboardItem(i)])}(e)}function o(e,t){e.preventDefault();const i=e.clipboardData;t.text&&i.setData("text/plain",t.text),t.html&&i.setData("text/html",t.html)}async function a(e,t){const i=(0,s.getClipboard)();if("text/plain"===t&&!i.write){const t=await e;return i.writeText(await t.text())}if(!i||!i.write||!window.ClipboardItem)throw new DOMException("ClipboardApi is not supported","NotSupportedError");let r=null;try{r=new window.ClipboardItem({[t]:e})}catch(i){r=new window.ClipboardItem({[t]:await e})}if(r)return i.write([r]);throw new Error("ClipboardApi is not supported")}},5370:(e,t,i)=>{"use strict";function s(e){if(void 0===e)return null;const t=e.match(/(delayed_streaming)_([\d]{1,4})/);return null===t?null:{mode:t[1],interval:parseInt(t[2])}}function r(e){const t=s(e.update_mode);return null===t||(e.update_mode=t.mode,e.update_mode_seconds=t.interval),e}i.r(t),i.d(t,{normalizeUpdateMode:()=>r,parseUpdateMode:()=>s})},84917:(e,t,i)=>{"use strict";var s,r;i.r(t),i.d(t,{Months:()=>r,WeekDays:()=>s}),function(e){e[e.SUNDAY=1]="SUNDAY",e[e.MONDAY=2]="MONDAY",e[e.TUESDAY=3]="TUESDAY",e[e.WEDNESDAY=4]="WEDNESDAY",e[e.THURSDAY=5]="THURSDAY",e[e.FRIDAY=6]="FRIDAY",e[e.SATURDAY=7]="SATURDAY"}(s||(s={})),function(e){e[e.JANUARY=0]="JANUARY",e[e.FEBRUARY=1]="FEBRUARY",e[e.MARCH=2]="MARCH",e[e.APRIL=3]="APRIL",e[e.MAY=4]="MAY",e[e.JUNE=5]="JUNE",e[e.JULY=6]="JULY",e[e.AUGUST=7]="AUGUST",e[e.SEPTEMBER=8]="SEPTEMBER",e[e.OCTOBER=9]="OCTOBER",e[e.NOVEMBER=10]="NOVEMBER",e[e.DECEMBER=11]="DECEMBER"}(r||(r={}))},76861:(e,t,i)=>{"use strict";function s(e=location.host){
return-1!==["i18n.tradingview.com","partial.tradingview.com","www.tradingview.com","wwwcn.tradingview.com"].indexOf(e)||-1!==["d33t3vvu2t2yu5.cloudfront.net","dwq4do82y8xi7.cloudfront.net","s.tradingview.com","s3.tradingview.com"].indexOf(e)||e.match(/^[a-z]{2}\.tradingview\.com/)||e.match(/prod-[^.]+.tradingview.com/)?"battle":e.includes("tradingview.com")||e.includes("staging")?"staging":e.match(/webcharts/)?"staging_local":(e.match(/^localhost(:\d+)?$/),"local")}function r(){return"local"===s()}function n(){return"battle"===s()}function o(){return!n()}i.r(t),i.d(t,{environment:()=>s,isDebug:()=>o,isLocal:()=>r,isProd:()=>n})},80007:(e,t,i)=>{"use strict";i.d(t,{preventDefault:()=>r,preventScrollByWheelClick:()=>o,wrapHandlerWithPreventEvent:()=>n});var s=i(49483);function r(e){e.cancelable&&e.preventDefault()}function n(e){return t=>{r(t),e()}}function o(e){s.isChrome&&e.addEventListener("mousedown",(e=>{if(1===e.button)return e.preventDefault(),!1}))}},93352:(e,t,i)=>{"use strict";function s(){return navigator.clipboard}i.d(t,{getClipboard:()=>s})},56186:(e,t,i)=>{"use strict";function s(e){if(e instanceof Error)return e.stack||e.message;try{return e.outerHTML.slice(0,1024)}catch(e){}try{if(void 0!==e)return JSON.stringify(e).slice(0,1024)}catch(e){}return String(e)}function r(){window.__tv_js_errors||(window.__tv_js_errors=[]),window.addEventListener("error",(e=>{const t=(new Date).toISOString();window.__tv_js_errors.push(`${t} ${e.message||"JS error"}. ${e.filename||""}, line ${e.lineno}, col ${e.colno}.\nError: ${s(e.error)}`)}),!1),window.addEventListener("unhandledrejection",(e=>{const t=(new Date).toISOString();window.__tv_js_errors.push(`${t} Unhandled rejection.\nReason: ${s(e.reason)}`)}),!1),document.addEventListener("securitypolicyviolation",(e=>{if(String(e.sourceFile).startsWith("https://securepubads.g.doubleclick.net")&&String(e.blockedURI).startsWith("https://adservice.google."))return;const t=(new Date).toISOString(),i="report"===e.disposition?"CSP report-only":"CSP violation";window.__tv_js_errors.push(`${t} ${i}: ${e.violatedDirective||e.effectiveDirective}. ${e.sourceFile||""}, line ${e.lineNumber}, col ${e.columnNumber}.\nBlocked URI: ${e.blockedURI}\nSample: ${e.sample}\nTarget: ${s(e.target)}`)}),!1)}i.d(t,{install:()=>r})},76422:(e,t,i)=>{"use strict";i.r(t),i.d(t,{emit:()=>d,emitOnce:()=>u,on:()=>l,subscribe:()=>c,subscribeToAll:()=>h,unsubscribe:()=>a});var s=i(57898);const r={},n=[],o={};function a(e,t,i){r[e].unsubscribe(i,t)}function l(e,t,i){c(e,t,i)}function c(e,t,i,n){r.hasOwnProperty(e)||(r[e]=new s.Delegate),o[e]?t.call(i):r[e].subscribe(i,t,n)}function h(e){n.push(e)}function d(e,...t){const i=[e].concat(t);n.forEach((e=>{e.apply(null,i)})),r.hasOwnProperty(e)&&r[e].fire.apply(r[e],t)}function u(e){o[e]&&console.warn(`Something went wrong: emitOnce called multiple times with same event (${e})`),o[e]=!0,d.apply(null,arguments)}},4741:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Modifiers:()=>r.Modifiers,createGroup:()=>p,keyboardPressedKeysState:()=>u,
pressedKeys:()=>d,registerWindow:()=>_,unregisterWindow:()=>m});var s=i(91679),r=i(3343),n=i(54717);class o{constructor(e,t){this.modifiers=e,this.code=t}altOrOptionCode(){return"AltLeft"===this.code||"AltRight"===this.code}controlOrMetaCode(){return r.isMacKeyboard?"MetaLeft"===this.code||"MetaRight"===this.code||"OSLeft"===this.code||"OSRight"===this.code:"ControlLeft"===this.code||"ControlRight"===this.code}}class a extends s.WatchedValue{setValue(e,t){const i=this.value();(t||void 0===i||i.code!==e.code||i.modifiers!==e.modifiers)&&super.setValue(e)}}class l{constructor(e,t){this._group=e;const{hotkey:i,handler:s,desc:r,isDisabled:n,element:o=null,isRepeatAccepted:a=!1}=t;this.hotkey=i,this.handler=s,this.desc=r,this.element=o,this.isRepeatAccepted=a,this.isDisabled=n?"function"==typeof n?n:()=>!0:()=>!1}destroy(){this._group&&(this._group.remove(this),this._group=null)}}class c{constructor(e,t){this._actions=new Map,this._manager=e,this.modal=!(!t||!t.modal),t&&(this.desc=t.desc),t&&t.isDisabled?"function"==typeof t.isDisabled?this.isDisabled=t.isDisabled:this.isDisabled=()=>!0:this.isDisabled=()=>!1,this._manager.registerGroup(this)}add(e){let t=this._actions.get(e.hotkey);t||(t=[],this._actions.set(e.hotkey,t));const i=new l(this,e);return t.push(i),i}remove(e){const t=this._actions.get(e.hotkey);if(!t)return;const i=t.findIndex((t=>t===e));i>=0&&(1===t.length?this._actions.delete(e.hotkey):t.splice(i,1))}handleHotkey(e,t){const i=this._actions.get(e);if(!i)return!1;for(const s of i)if((!s.element||t.target&&s.element.contains(t.target))&&!s.isDisabled())return t.repeat&&!s.isRepeatAccepted||(s.handler(t),this._callMatchedHotkeyHandler(e)),t.preventDefault(),!0;return!1}promote(){this._manager.promoteGroup(this)}destroy(){this._actions.clear(),this._manager.unregisterGroup(this)}static setMatchedHotkeyHandler(e){c._matchedHotkeyHandler=e}_callMatchedHotkeyHandler(e){c._matchedHotkeyHandler&&c._matchedHotkeyHandler(e)}}const h=new class{constructor(){this._groups=[],this._pressedKeys=new s.WatchedValue(0),this._keyboardPressedKeysState=new a(new o(0)),this._keyDownListener=e=>{if(e.defaultPrevented)return;const t=(0,r.hashFromEvent)(e);if(this._pressedKeys.setValue(t),this._keyboardPressedKeysState.setValue(new o((0,r.modifiersFromEvent)(e),e.code)),!(0,n.isNativeUIInteraction)(t,e.target))for(let i=this._groups.length;i-- >0;){const s=this._groups[i];if(!s.isDisabled()){if(s.handleHotkey(t,e))return;if(s.modal)return}}},this._keyUpListener=e=>{const t=(0,r.hashFromEvent)(e);this._pressedKeys.setValue(t),this._keyboardPressedKeysState.setValue(new o((0,r.modifiersFromEvent)(e),""))},this._blurEvent=()=>{this._pressedKeys.setValue(0),this._keyboardPressedKeysState.setValue(new o(0,""))},this._mouseEvent=e=>{var t;const i=(0,r.modifiersFromEvent)(e),s=255&(null!==(t=this._pressedKeys.value())&&void 0!==t?t:0);this._pressedKeys.setValue(i|s)}}listen(e){e.addEventListener("keydown",this._keyDownListener),e.addEventListener("keyup",this._keyUpListener),e.addEventListener("blur",this._blurEvent),
e.addEventListener("mousemove",this._mouseEvent)}unlisten(e){e.removeEventListener("keydown",this._keyDownListener),e.removeEventListener("keyup",this._keyUpListener),e.removeEventListener("blur",this._blurEvent),e.removeEventListener("mousemove",this._mouseEvent)}registerGroup(e){this._groups.push(e)}unregisterGroup(e){for(let t=this._groups.length;t--;)this._groups[t]===e&&this._groups.splice(t,1)}promoteGroup(e){let t=this._groups.length-1;for(let i=this._groups.length;i--;){if(this._groups[i]===e)return void(i!==t&&(this._groups.splice(i,1),this._groups.splice(t,0,e)));this._groups[i].modal&&(t=i-1)}}pressedKeys(){return this._pressedKeys.readonly()}keyboardPressedKeysState(){return this._keyboardPressedKeysState.readonly()}},d=h.pressedKeys(),u=h.keyboardPressedKeysState();function p(e){return new c(h,e)}function _(e){h.listen(e)}function m(e){h.unlisten(e)}var g=i(51768);_(window),c.setMatchedHotkeyHandler((e=>{(0,g.trackEvent)("Keyboard Shortcuts",(0,r.humanReadableHash)(e))}))},68335:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Modifiers:()=>s.Modifiers,hashFromEvent:()=>s.hashFromEvent,hashShiftPlusEnter:()=>s.hashShiftPlusEnter,humanReadableHash:()=>s.humanReadableHash,humanReadableModifiers:()=>s.humanReadableModifiers,isMacKeyboard:()=>s.isMacKeyboard,modifiersFromEvent:()=>s.modifiersFromEvent});var s=i(3343)},35749:(e,t,i)=>{"use strict";i.d(t,{isNativeUIInteraction:()=>s.isNativeUIInteraction,isTextEditingField:()=>s.isTextEditingField});var s=i(54717)},82992:(e,t,i)=>{"use strict";i.d(t,{linking:()=>p});var s=i(12481),r=i(50151),n=i(97145),o=(i(14483),i(36274)),a=i(42960),l=i(59224),c=i(16410),h=i(69109);const d=(0,l.getLogger)("Linking");class u{constructor(e,t,i){this.watchedSymbol=new n.WatchedValue,this.seriesShortSymbol=new n.WatchedValue,this.proSymbol=new n.WatchedValue,this.ensuredProSymbol=new n.WatchedValue,this.watchedInterval=new n.WatchedValue,this.watchedIntraday=new n.WatchedValue,this.watchedSeconds=new n.WatchedValue,this.watchedTicks=new n.WatchedValue,this.watchedDataFrequencyResolution=new n.WatchedValue,this.watchedRange=new n.WatchedValue,this.watchedSupportedResolutions=new n.WatchedValue,this.watchedSupportedChartStyles=new n.WatchedValue,this.symbolNamesList=new n.WatchedValue,this._chartWidgetCollection=null,this._chartWidgetBindingState=0,this._activeChartWidget=null,this._linkingGroupCharts=null,this._boundChartWidget=null,this._watchedSymbolListenerBound=this._watchedSymbolListener.bind(this),this._watchedIntervalListenerBound=this._watchedIntervalListener.bind(this),this._muted=!1,this.updateBoundChartWidget=()=>{const e=this._chartToBind();e!==this._boundChartWidget&&(null===e?this.unbindFromChartWidget():this.bindToChartWidget(e))},this._updateAllGroupChartWidgets=()=>{var e;null===(e=this._destroySymbolIntervalPropertySubscriptions)||void 0===e||e.call(this);const t=(0,r.ensureNotNull)(this._linkingGroupCharts).value(),i=[],s=[];for(const e of t){const t=e.symbolWV().spawn(),r=e.resolutionWV().spawn();t.subscribe(this._updateSymbolByProperty.bind(this,e)),
r.subscribe(this._updateIntervalByProperty.bind(this,e)),i.push(t),s.push(r)}this._destroySymbolIntervalPropertySubscriptions=()=>{i.forEach((e=>e.destroy())),s.forEach((e=>e.destroy())),this._destroySymbolIntervalPropertySubscriptions=void 0};const n=this.watchedSymbol.value();t.length>1&&this._needApplySymbol(n)&&!this._muted&&this._setGroupSymbol(n);const o=this.watchedInterval.value();t.length>1&&this._needApplyInterval(o)&&!this._muted&&this._setGroupInterval(o),this.updateBoundChartWidget()},this._groupIndex=e;const s=(e,t)=>{e.subscribe((e=>{i()===this&&t.setValue(e)}),{callWithLast:!0})};s(this.watchedSymbol,t.watchedSymbol),s(this.seriesShortSymbol,t.seriesShortSymbol),s(this.proSymbol,t.proSymbol),s(this.ensuredProSymbol,t.ensuredProSymbol),s(this.watchedInterval,t.watchedInterval),s(this.watchedIntraday,t.watchedIntraday),s(this.watchedSeconds,t.watchedSeconds),s(this.watchedTicks,t.watchedTicks),s(this.watchedDataFrequencyResolution,t.watchedDataFrequencyResolution),s(this.watchedRange,t.watchedRange),s(this.watchedSupportedResolutions,t.watchedSupportedResolutions),s(this.watchedSupportedChartStyles,t.watchedSupportedChartStyles),s(this.symbolNamesList,t.symbolNamesList),this.watchedSymbol.subscribe((e=>{this._boundChartWidget&&this._boundChartWidget.hasModel()&&this._mainSeries().symbolSameAsCurrent(e)||this.proSymbol.setValue(e)}),{callWithLast:!0})}mute(e){this._muted=e}bindToChartWidgetCollection(e){this.unbindFromChartWidgetCollection(),this._chartWidgetCollection=e,this._activeChartWidget=e.activeChartWidget.spawn(),this._activeChartWidget.subscribe(this.updateBoundChartWidget),this._linkingGroupCharts=e.linkingGroupsCharts(this._groupIndex).spawn(),this._linkingGroupCharts.subscribe(this._updateAllGroupChartWidgets),this.updateBoundChartWidget(),this._updateAllGroupChartWidgets()}unbindFromChartWidgetCollection(){var e,t,i;this.unbindFromChartWidget(),this._chartWidgetCollection=null,null===(e=this._activeChartWidget)||void 0===e||e.destroy(),this._activeChartWidget=null,null===(t=this._linkingGroupCharts)||void 0===t||t.destroy(),this._linkingGroupCharts=null,null===(i=this._destroySymbolIntervalPropertySubscriptions)||void 0===i||i.call(this)}bindToChartWidget(e){if(this.unbindFromChartWidget(),this._boundChartWidget=e,e.hasModel())return void this._onChartModelCreated(e.model());e.modelCreated().subscribe(this,this._onChartModelCreated,!0),this._chartWidgetBindingState=1;const t=e.properties().childs().mainSeriesProperties.childs();this.watchedSymbol.setValue(t.symbol.value()),this.watchedInterval.setValue(t.interval.value()),this._boundChartWidget.linkingGroupIndex().subscribe(this.updateBoundChartWidget)}unbindFromChartWidget(){const e=this._boundChartWidget;if(null!==e){switch(this._chartWidgetBindingState){case 1:e.modelCreated().unsubscribeAll(this);break;case 2:this.watchedSymbol.unsubscribe(this._watchedSymbolListenerBound);const t=this._mainSeries().dataEvents();t.symbolResolved().unsubscribeAll(this),t.symbolError().unsubscribeAll(this),
this.watchedInterval.unsubscribe(this._watchedIntervalListenerBound),delete this.watchedSymbol.writeLock}e.linkingGroupIndex().unsubscribe(this.updateBoundChartWidget),this._boundChartWidget=null,this._chartWidgetBindingState=0}}boundChartWidget(){return this._boundChartWidget}_mainSeries(){if(!this._boundChartWidget)throw new Error("ChartWidget is undefined");return this._boundChartWidget.model().mainSeries()}_watchedSymbolListener(e){this._needApplySymbol(e)&&!this._muted&&this._setGroupSymbol(e)}_updateSymbolByProperty(e,t){const i=this._symbolLock();i&&this._needApplySymbol(t)&&!this._muted&&this._setGroupSymbol(t),(i||e===this._boundChartWidget)&&this.watchedSymbol.setValue(t)}_watchedIntervalListener(e){const t=o.Interval.normalize(e);t&&this._needApplyInterval(t)&&!this._muted&&this._setGroupInterval(t)}_updateIntervalByProperty(e,t){const i=this._intervalLock(),s=o.Interval.normalize(t);i&&s&&this._needApplyInterval(s)&&!this._muted&&this._setGroupInterval(s),(i||e===this._boundChartWidget)&&this.watchedInterval.setValue(null!=s?s:t)}_sendSnowplowAnalytics(){if(!window.user.do_not_track)throw new Error("unsupported")}_updateSeriesSymbolInfo(){this.seriesShortSymbol.setValue((0,r.ensureNotNull)(this._boundChartWidget).getSymbol(!0));const e=this._mainSeries().symbolInfo();if(e){const t=e.pro_name||!1;this.proSymbol.setValue(t||this.watchedSymbol.value()),this.ensuredProSymbol.setValue(this.proSymbol.value()),e.aliases&&this.symbolNamesList.setValue(e.aliases);{const t=e.supported_resolutions;t?this.watchedSupportedResolutions.setValue(t):this.watchedSupportedResolutions.setValue(void 0)}let i=(0,c.allChartStyles)();(0,a.isCloseBasedSymbol)(e)&&(i=i.filter((e=>(0,a.isSingleValueBasedStyle)(e)))),this.watchedSupportedChartStyles.setValue(i),this.watchedIntraday.setValue(!!e.has_intraday),this.watchedSeconds.setValue(!!e.has_seconds),this.watchedTicks.setValue(!(0,a.isCloseBasedSymbol)(e)&&!!e["is-tickbars-available"]),this.watchedRange.setValue(!(0,a.isCloseBasedSymbol)(e));const s=e.data_frequency?e.data_frequency:void 0;this.watchedDataFrequencyResolution.setValue(s)}else this.watchedIntraday.setValue(!1),this.watchedSeconds.setValue(!1),this.watchedTicks.setValue(!1),this.watchedRange.setValue(!1),this._mainSeries().isFailed()&&this.ensuredProSymbol.setValue(this.proSymbol.value())}_onChartModelCreated(e){if(!this._boundChartWidget)throw new Error("ChartWidget is undefined");this._chartWidgetBindingState=2,this.watchedSymbol.setValue(this._boundChartWidget.symbolWV().value()),this.watchedSymbol.subscribe(this._watchedSymbolListenerBound);const t=e.mainSeries().dataEvents();t.symbolResolved().subscribe(this,this._updateSeriesSymbolInfo),t.symbolError().subscribe(this,this._updateSeriesSymbolInfo),this._updateSeriesSymbolInfo(),this.watchedInterval.setValue(this._boundChartWidget.resolutionWV().value()),this.watchedInterval.subscribe(this._watchedIntervalListenerBound),this._boundChartWidget.readOnly()&&(this.watchedSymbol.writeLock=!0)}_chartToBind(){const e=this._chartWidgetCollection
;return null===e?null:e.activeChartWidget.value()}_symbolLock(){var e;return!!(null===(e=this._chartWidgetCollection)||void 0===e?void 0:e.lock.symbol.value())}_intervalLock(){var e;return!!(null===(e=this._chartWidgetCollection)||void 0===e?void 0:e.lock.interval.value())}_chartsForLock(e){return(0===e?this._symbolLock():this._intervalLock())?(0,r.ensureNotNull)(this._linkingGroupCharts).value():this._boundChartWidget?[this._boundChartWidget]:[]}_setGroupSymbol(e){this.mute(!0),this._symbolLock()?(0,r.ensureNotNull)(this._chartWidgetCollection).setSymbol(e,this._groupIndex):(0,r.ensureNotNull)(this._boundChartWidget).setSymbol(e),this.mute(!1)}_needApplySymbol(e){const t=this._chartsForLock(0),i=t.find((t=>t.hasModel()&&t.model().mainSeries().symbolInfo()&&t.model().mainSeries().symbolSameAsResolved(e)));if(i){const e=i.model().mainSeries();if(t.every((t=>e.symbolSameAsResolved(t.symbolWV().value()))))return!1}return t.some((t=>t.symbolWV().value()!==e))}_setGroupInterval(e){this.mute(!0),this._intervalLock()?(0,r.ensureNotNull)(this._chartWidgetCollection).setResolution(e,this._groupIndex):(0,r.ensureNotNull)(this._boundChartWidget).setResolution(e),this.mute(!1)}_needApplyInterval(e){return this._chartsForLock(1).some((t=>!o.Interval.isEqual(t.resolutionWV().value(),e)))}}const p=new class{constructor(){this._watchedSymbol=new n.WatchedValue,this._seriesShortSymbol=new n.WatchedValue,this._proSymbol=new n.WatchedValue,this._ensuredProSymbol=new n.WatchedValue,this._watchedInterval=new n.WatchedValue,this._watchedIntraday=new n.WatchedValue,this._watchedSeconds=new n.WatchedValue,this._watchedTicks=new n.WatchedValue,this._watchedDataFrequencyResolution=new n.WatchedValue,this._watchedRange=new n.WatchedValue,this._watchedSupportedResolutions=new n.WatchedValue,this._watchedSupportedChartStyles=new n.WatchedValue([]),this._symbolNamesList=new n.WatchedValue,this._chartWidgetCollection=null,this._onSymbolLinkBound=this._onSymbolLink.bind(this),this._searchCharts=null,this._searchChartsLoadDebounced=null,this._selfEmit=!1,this._preventFeedBySymbol=!1,this._feedBySymbolDebounceCounter=0,this._linkingGroups=new Map,this._activeLinkingGroup=new n.WatchedValue,this._activeLinkingGroupIndex=null,this._updateLinkingGroups=()=>{(0,r.ensureNotNull)(this._chartWidgetCollection).allLinkingGroups().value().forEach((e=>this._linkingGroup(e))),this._linkingGroups.forEach((e=>e.updateBoundChartWidget()))},this._activeLinkingGroup.setValue(this._linkingGroup(null));const e=(e,t)=>{e.subscribe((e=>t().setValue(e)),{callWithLast:!0})};e(this._watchedSymbol,(()=>this._activeLinkingGroup.value().watchedSymbol)),e(this._seriesShortSymbol,(()=>this._activeLinkingGroup.value().seriesShortSymbol)),e(this._proSymbol,(()=>this._activeLinkingGroup.value().proSymbol)),e(this._ensuredProSymbol,(()=>this._activeLinkingGroup.value().ensuredProSymbol)),e(this._watchedInterval,(()=>this._activeLinkingGroup.value().watchedInterval)),e(this._watchedIntraday,(()=>this._activeLinkingGroup.value().watchedIntraday)),
e(this._watchedSeconds,(()=>this._activeLinkingGroup.value().watchedSeconds)),e(this._watchedTicks,(()=>this._activeLinkingGroup.value().watchedTicks)),e(this._watchedDataFrequencyResolution,(()=>this._activeLinkingGroup.value().watchedDataFrequencyResolution)),e(this._watchedRange,(()=>this._activeLinkingGroup.value().watchedRange)),e(this._watchedSupportedResolutions,(()=>this._activeLinkingGroup.value().watchedSupportedResolutions)),e(this._watchedSupportedChartStyles,(()=>this._activeLinkingGroup.value().watchedSupportedChartStyles)),e(this._symbolNamesList,(()=>this._activeLinkingGroup.value().symbolNamesList));const t=e=>{this._watchedSymbol.setValue(e.watchedSymbol.value()),this._seriesShortSymbol.setValue(e.seriesShortSymbol.value()),this._proSymbol.setValue(e.proSymbol.value()),this._ensuredProSymbol.setValue(e.ensuredProSymbol.value()),this._watchedInterval.setValue(e.watchedInterval.value()),this._watchedIntraday.setValue(e.watchedIntraday.value()),this._watchedSeconds.setValue(e.watchedSeconds.value()),this._watchedTicks.setValue(e.watchedTicks.value()),this._watchedDataFrequencyResolution.setValue(e.watchedDataFrequencyResolution.value()),this._watchedRange.setValue(e.watchedRange.value()),this._watchedSupportedResolutions.setValue(e.watchedSupportedResolutions.value()),this._watchedSupportedChartStyles.setValue(e.watchedSupportedChartStyles.value()),this._symbolNamesList.setValue(e.symbolNamesList.value())};this._activeLinkingGroup.subscribe(t),t(this._activeLinkingGroup.value()),(0,h.setMuteLinkingGroup)(((e,t)=>{this._linkingGroup(e).mute(t)}))}get symbol(){return this._watchedSymbol}get proSymbol(){return this._proSymbol.readonly()}get ensuredProSymbol(){return this._ensuredProSymbol.readonly()}get symbolNamesList(){return this._symbolNamesList.readonly()}get seriesShortSymbol(){return this._seriesShortSymbol.readonly()}get interval(){return this._watchedInterval}get intraday(){return this._watchedIntraday.readonly()}get seconds(){return this._watchedSeconds.readonly()}get ticks(){return this._watchedTicks.readonly()}get range(){return this._watchedRange.readonly()}get supportedResolutions(){return this._watchedSupportedResolutions.readonly()}get supportedChartStyles(){return this._watchedSupportedChartStyles.readonly()}get preventFeedBySymbol(){return this._preventFeedBySymbol}get dataFrequencyResolution(){return this._watchedDataFrequencyResolution.readonly()}activeLinkingGroup(){return this._activeLinkingGroup.readonly()}getChartWidget(){return this.activeLinkingGroup().value().boundChartWidget()}bindToChartWidgetCollection(e){var t;null===(t=this._chartWidgetCollection)||void 0===t||t.onAboutToBeDestroyed.unsubscribeAll(this),this._unbindFromChartWidgetCollection(),this._chartWidgetCollection=e,this._chartWidgetCollection.onAboutToBeDestroyed.subscribe(this,this._unbindFromChartWidgetCollection),this._chartWidgetCollection.allLinkingGroups().subscribe(this._updateLinkingGroups),this._updateLinkingGroups(),this._activeLinkingGroupIndex=e.activeLinkingGroup().spawn(),
this._activeLinkingGroupIndex.subscribe((e=>{this._activeLinkingGroup.setValue(this._linkingGroup(e))}),{callWithLast:!0}),this._linkingGroups.forEach((t=>t.bindToChartWidgetCollection(e)))}bindToSearchCharts(e){this.unbindFromSearchCharts(),this._searchCharts=e,e.onSearchBySymbol.subscribe(this,this._onSearchBySymbol),e.loadingSymbol.subscribe((e=>{!1===e&&(this._feedBySymbolDebounceCounter=0)})),this._watchedSymbol.subscribe(this._onSymbolLinkBound)}unbindFromSearchCharts(){this._searchCharts&&(this._searchCharts.onSearchBySymbol.unsubscribe(this,this._onSearchBySymbol),this._watchedSymbol.unsubscribe(this._onSymbolLinkBound),this._searchCharts=null)}setPreventFeedBySymbol(e){this._preventFeedBySymbol=e}setSymbolAndLogInitiator(e,t,i){(this.symbol.value()!==e||i)&&(d.logInfo(`Change linking symbol to ${e}, initiator: ${t}`),this.symbol.setValue(e,i))}_onSearchBySymbol(e){if(!e.resolved_symbol)throw new Error("no resolved_symbol");this._selfEmit=!0,this._watchedSymbol.setValue(e.resolved_symbol),this._selfEmit=!1}_onSymbolLink(e){if(!this._selfEmit){if(!this._searchCharts){const e="No search charts defined";throw d.logError(e),new Error(e)}this._preventFeedBySymbol||this._loadSearchCharts(e)}}_loadSearchCharts(e){if(!this._searchCharts){const e="No search charts defined";throw d.logError(e),new Error(e)}if(this._searchChartsLoadDebounced)return void(this._feedBySymbolDebounceCounter<100&&(this._feedBySymbolDebounceCounter++,this._searchChartsLoadDebounced(e)));const t=e=>this._searchCharts?(!0===this._searchCharts.loadingSymbol.value()?this._feedBySymbolDebounceCounter<100&&(this._feedBySymbolDebounceCounter++,this._searchChartsLoadDebounced=(0,s.default)(t,2e3),this._searchChartsLoadDebounced(e)):this._searchChartsLoadDebounced=null,this._searchCharts.feedBySymbol.call(this._searchCharts,e)):()=>{};!0===this._searchCharts.loadingSymbol.value()?this._feedBySymbolDebounceCounter<100&&(this._feedBySymbolDebounceCounter++,this._searchChartsLoadDebounced=(0,s.default)(t,2e3),this._searchChartsLoadDebounced(e)):this._searchCharts.feedBySymbol(e)}_linkingGroup(e){e=null;let t=this._linkingGroups.get(e);if(void 0===t){const i={watchedSymbol:this._watchedSymbol,seriesShortSymbol:this._seriesShortSymbol,proSymbol:this._proSymbol,ensuredProSymbol:this._ensuredProSymbol,watchedInterval:this._watchedInterval,watchedIntraday:this._watchedIntraday,watchedSeconds:this._watchedSeconds,watchedTicks:this._watchedTicks,watchedDataFrequencyResolution:this._watchedDataFrequencyResolution,watchedRange:this._watchedRange,watchedSupportedResolutions:this._watchedSupportedResolutions,watchedSupportedChartStyles:this._watchedSupportedChartStyles,symbolNamesList:this._symbolNamesList};t=new u(e,i,(()=>this._activeLinkingGroup.value())),this._linkingGroups.set(e,t),this._chartWidgetCollection&&t.bindToChartWidgetCollection(this._chartWidgetCollection)}return t}_unbindFromChartWidgetCollection(){var e;null!==this._chartWidgetCollection&&(null===(e=this._activeLinkingGroupIndex)||void 0===e||e.destroy(),this._activeLinkingGroupIndex=null,
this._linkingGroups.forEach((e=>e.unbindFromChartWidgetCollection())),this._chartWidgetCollection.allLinkingGroups().unsubscribe(this._updateLinkingGroups),this._chartWidgetCollection=null)}};window.TradingViewApi||(window.TradingViewApi={linking:p})},11417:(e,t,i)=>{"use strict";const{getLogger:s}=i(59224),r=s("TVLocalStorage");var n=function(){try{this.isAvailable=!0,this.localStorage=window.localStorage,this.localStorage.setItem("tvlocalstorage.available","true")}catch(e){delete this.isAvailable,delete this.localStorage}this._updateLength();try{this._report()}catch(e){}};n.prototype._report=function(){if(this.isAvailable){const e=10,t=[];for(let e=0;et.length-e.length));const i=t.slice(0,e);t.sort(((e,t)=>t.key.length-e.key.length));const s=t.slice(0,e);r.logNormal(`Total amount of keys in Local Storage: ${this.length}`),r.logNormal(`Top ${e} keys with longest values: ${JSON.stringify(i)}`),r.logNormal(`Top ${e} longest key names: ${JSON.stringify(s)}`);try{navigator.storage.estimate().then((e=>{r.logNormal(`Storage estimate: ${JSON.stringify(e)}`)}))}catch(e){}}},n.prototype.length=0,n.prototype.isAvailable=!1,n.prototype.localStorage={"tvlocalstorage.available":"false"},n.prototype._updateLength=function(){if(this.isAvailable)this.length=this.localStorage.length;else{var e,t=0;for(e in this.localStorage)this.localStorage.hasOwnProperty(e)&&t++;this.length=t}},n.prototype.key=function(e){return this.isAvailable?this.localStorage.key(e):Object.keys(this.localStorage)[e]},n.prototype.getItem=function(e){return this.isAvailable?this.localStorage.getItem(e):void 0===this.localStorage[e]?null:this.localStorage[e]},n.prototype.setItem=function(e,t){this.isAvailable?this.localStorage.setItem(e,t):this.localStorage[e]=t,this._updateLength()},n.prototype.removeItem=function(e){this.isAvailable?this.localStorage.removeItem(e):delete this.localStorage[e],this._updateLength()},n.prototype.clear=function(){this.isAvailable?this.localStorage.clear():this.localStorage={},this._updateLength()};var o=function(e){this.storage=e};o.prototype.getItem=function(e){return Promise.resolve(this.storage.getItem(e))},o.prototype.setItem=function(e,t){return Promise.resolve(this.storage.setItem(e,t))},window.TVLocalStorage=new n,window.TVLocalStorageAsync=new o(window.TVLocalStorage),e.exports={TVLocalStorage:window.TVLocalStorage,TVLocalStorageAsync:window.TVLocalStorageAsync}},84015:(e,t,i)=>{"use strict";function s(e,t=!1){return!1}function r(e,t=!1){return e}i.d(t,{isOnMobileAppPage:()=>s,urlWithMobileAppParams:()=>r})},69109:(e,t,i)=>{"use strict";let s;function r(e,t){null==s||s(e,t)}function n(e){s=e}i.d(t,{muteLinkingGroup:()=>r,setMuteLinkingGroup:()=>n})},19334:(e,t,i)=>{"use strict";i.d(t,{addPerfMark:()=>c,perfMeasureOperation:()=>h});var s=i(36174);function r(){}
const n=console.timeStamp?console.timeStamp.bind(console):r,o=window.performance&&performance.mark?performance.mark.bind(performance):r,a=window.performance&&performance.measure?performance.measure.bind(performance):r,l=window.performance&&performance.clearMarks?performance.clearMarks.bind(performance):r;function c(e){n(e),o(e)}async function h(e,t){const i=`measure-${e}-${(0,s.randomHash)()}`;o(i);try{return await t()}finally{a(e,i),l(i)}}},14905:(e,t,i)=>{"use strict";function s(e){return e===r(e)}function r(e){const t=e.indexOf("$"),i=e.indexOf("@");return t<0&&i>=0?null:e.substring(Math.max(t+1,0),i>=0?i:e.length)}i.d(t,{extractPineId:()=>r,isPineIdString:()=>s})},16216:(e,t,i)=>{"use strict";i.d(t,{hasService:()=>o,registerService:()=>n,service:()=>a});const s={},r=new Map;function n(e,t){if(o(e))throw new Error("Service already registered");s[e.id]=t;const i=r.get(e.id);void 0!==i&&(r.delete(e.id),i.resolve(t))}function o(e){return void 0!==s[e.id]}function a(e){const t=s[e.id];if(void 0===t)throw new Error("ServiceLocator: Service "+e.id+" not found");return t}},56840:(e,t,i)=>{"use strict";e=i.nmd(e),i(49483);i(69798).fetch;var s=i(52157).regExpEscape,r=i(21097).TVXWindowEvents,n=i(11417).TVLocalStorage,o=i(57898).Delegate,a=i(14483),l=["s.tradingview.com","betacdn.tradingview.com"],c=a.enabled("use_localstorage_for_settings"),h=window.TVSettings=function(){var e=!1,t=null;function i(){return!t&&c}try{e=!TradingView.onWidget()&&parent&&parent!==window&&!!parent.IS_DEMO_PAGE}catch(e){}if(e){var d={"widgetbar.layout-settings":{widgets:{},settings:{minimized:!0}},notShowMainWizard:!0},u=function(e,t,i){var s=d[e];return null==s?t:s},p=function(){};return{loaded:!1,loadedModel:!1,getValue:u,getJSON:u,getBool:u,getFloat:u,getInt:u,setValue:p,setJSON:p,remove:p,keys:function(){return Object.keys(d)},keysMask:function(){return[]},sync:p,onSync:{subscribe:function(){}}}}window.environment;var _,m=TradingView.onWidget()?"tradingview-widget":"tradingview",g=m+".",f={},v=[/^widgetbar\.widget\.watchlist.+/,/.+quicks$/,/^widgetbar\.layout-settings$/,/^ChartSideToolbarWidget\.visible$/,/^onwidget\.watchlist$/,/^chart\.favoriteDrawings$/,/^chart\.favoriteDrawingsPosition$/,/^chart\.favoriteLibraryIndicators$/,/^loadChartDialog.favorites$/,/^ChartFavoriteDrawingToolbarWidget\.visible/,/^trading\.chart\.proterty$/,/^trading_floating_toolbar\.position$/,/^trading\.orderWidgetMode\./,/^symbolWatermark$/,/^pinereference\.size$/,/^pinereference\.position$/,/^hint\.+/,/^ChartDrawingToolbarWidget\.visible/];function S(e){return g+e}function y(e){return e.substring(g.length)}function b(e,t){var i=f[e];return null==i?t:i}function w(e,t,i){i=i||{};var s=""+t;return f[e]!==s&&(f[e]=s,P(e)),i.forceFlush&&!_&&(_=setTimeout((function(){_=void 0,x()}),10)),h}function C(e,t){return t=t||{},null!=f[e]&&(delete f[e],P(e)),t.forceFlush&&x(),h}function P(e){if(t)null==f[e]?t.removeValue(e):t.setValue(e,f[e]);else if(i())try{null==f[e]?n.removeItem(S(e)):n.setItem(S(e),f[e])}catch(e){}else 0;r.emit("settings",JSON.stringify({key:e,value:f[e]}))}
function x(e){}function T(){return Object.keys(f)}function I(e){for(var t=0;t=0;n--)e.test(i[n])&&r.push(i[n]),e.lastIndex=0;return r},sync:function(e){null!==e?(t?A(t.initialSettings||{}):i()?(function(){if(TradingView.onWidget()&&l.includes(window.location.host))for(var e="tradingview.",t=n.length;t--;){var i=n.key(t);if(0===i.indexOf(e)){var s=i.replace(e,m+".");n.setItem(s,n.getItem(i)),n.removeItem(i)}}}(),function(){f={};for(var e=!a.enabled("save_chart_properties_to_local_storage"),t=n.length;t--;){var i=n.key(t);if(i&&M(i)){var s=i.substring(g.length);e&&!I(s)||(f[s]=n.getItem(i))}}}()):A(e||{}),L.fire()):!0},onSync:L,setSettingsAdapter:function(e){t=e}}}();e&&e.exports&&(e.exports=h)},88145:(e,t,i)=>{"use strict";function s(e){return void 0!==e&&e.includes("crypto")}function r(e){var t;return Boolean(null===(t=e.typespecs)||void 0===t?void 0:t.includes("yield"))}i.d(t,{hasCryptoTypespec:()=>s,isYield:()=>r})},26843:(e,t,i)=>{"use strict";i.d(t,{StdTheme:()=>a.StdTheme,getStdChartTheme:()=>h,getStdThemeNames:()=>c,isStdTheme:()=>u,translateThemeName:()=>d});var s=i(11542),r=i(24377)
;const n=JSON.parse('{"content":{"chartProperties":{"scalesProperties":{"textColor":"#131722","lineColor":"rgba(42, 46, 57, 0)","backgroundColor":"#ffffff"},"paneProperties":{"vertGridProperties":{"color":"rgba(42, 46, 57, 0.06)"},"horzGridProperties":{"color":"rgba(42, 46, 57, 0.06)"},"crossHairProperties":{"color":"#9598A1"},"background":"#ffffff","backgroundGradientStartColor":"#ffffff","backgroundGradientEndColor":"#ffffff","separatorColor":"#E0E3EB"}},"sessions":{"graphics":{"backgrounds":{"outOfSession":{"color":"#2962FF","transparency":92},"preMarket":{"color":"#FF9800","transparency":92},"postMarket":{"color":"#2962FF","transparency":92}},"vertlines":{"sessBreaks":{"color":"#4985e7","style":2,"width":1}}}},"mainSourceProperties":{"baseLineColor":"#B2B5BE","candleStyle":{"borderColor":"#378658","upColor":"#089981","wickColor":"#737375","wickUpColor":"#089981","wickDownColor":"#F23645","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645"},"haStyle":{"borderColor":"#378658","upColor":"#089981","wickColor":"#737375","wickUpColor":"#089981","wickDownColor":"#F23645","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645"},"barStyle":{"downColor":"#F23645","upColor":"#089981"},"pnfStyle":{"downColor":"#F23645","upColor":"#089981","upColorProjection":"#a9dcc3","downColorProjection":"#f5a6ae"},"baselineStyle":{"baselineColor":"#758696","topFillColor1":"rgba(8, 153, 129, 0.28)","topFillColor2":"rgba(8, 153, 129, 0.05)","bottomFillColor1":"rgba(242, 54, 69, 0.05)","bottomFillColor2":"rgba(242, 54, 69, 0.28)","topLineColor":"#089981","bottomLineColor":"#F23645"},"areaStyle":{"transparency":100,"color1":"rgba(41, 98, 255, 0.28)","color2":"#2962FF","linecolor":"#2962FF","linewidth":2,"linestyle":0},"hiloStyle":{"color":"#2962FF","borderColor":"#2962FF","labelColor":"#2962FF"},"columnStyle":{"upColor":"rgba(8, 153, 129, 0.5)","downColor":"rgba(242, 54, 69, 0.5)","priceSource":"close"},"renkoStyle":{"upColor":"#089981","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645","upColorProjection":"#a9dcc3","downColorProjection":"#f5a6ae","borderUpColorProjection":"#a9dcc3","borderDownColorProjection":"#f5a6ae","wickUpColor":"#089981","wickDownColor":"#F23645"},"lineStyle":{"color":"#2962FF","linewidth":2,"linestyle":0},"lineWithMarkersStyle":{"color":"#2962FF","linewidth":2,"linestyle":0},"steplineStyle":{"color":"#2962FF","linewidth":2,"linestyle":0},"kagiStyle":{"downColor":"#F23645","upColor":"#089981","upColorProjection":"#a9dcc3","downColorProjection":"#f5a6ae"},"pbStyle":{"upColor":"#089981","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645","upColorProjection":"#a9dcc3","downColorProjection":"#f5a6ae","borderUpColorProjection":"#a9dcc3","borderDownColorProjection":"#f5a6ae"},"rangeStyle":{"upColor":"#089981","downColor":"#F23645","upColorProjection":"#a9dcc3","downColorProjection":"#f5a6ae"}}}}'),o=JSON.parse('{"content":{"chartProperties":{"scalesProperties":{"textColor":"#B2B5BE","lineColor":"rgba(240, 243, 250, 0)","backgroundColor":"#ffffff"},"paneProperties":{"vertGridProperties":{"color":"rgba(240, 243, 250, 0.06)"},"horzGridProperties":{"color":"rgba(240, 243, 250, 0.06)"},"crossHairProperties":{"color":"#9598A1"},"background":"#131722","backgroundGradientStartColor":"#181C27","backgroundGradientEndColor":"#131722","backgroundType":"gradient","separatorColor":"#2A2E39"}},"sessions":{"graphics":{"backgrounds":{"outOfSession":{"color":"#2962FF","transparency":92},"preMarket":{"color":"#FF9800","transparency":92},"postMarket":{"color":"#2962FF","transparency":92}},"vertlines":{"sessBreaks":{"color":"#4985e7","style":2,"width":1}}}},"mainSourceProperties":{"baseLineColor":"#5d606b","candleStyle":{"borderColor":"#378658","upColor":"#089981","wickColor":"#B5B5B8","wickUpColor":"#089981","wickDownColor":"#F23645","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645"},"haStyle":{"borderColor":"#378658","upColor":"#089981","wickColor":"#B5B5B8","wickUpColor":"#089981","wickDownColor":"#F23645","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645"},"barStyle":{"downColor":"#F23645","upColor":"#089981"},"pnfStyle":{"downColor":"#F23645","upColor":"#089981","upColorProjection":"#336854","downColorProjection":"#7f323f"},"baselineStyle":{"baselineColor":"#758696","topFillColor1":"rgba(8, 153, 129, 0.28)","topFillColor2":"rgba(8, 153, 129, 0.05)","bottomFillColor1":"rgba(242, 54, 69, 0.05)","bottomFillColor2":"rgba(242, 54, 69, 0.28)","topLineColor":"#089981","bottomLineColor":"#F23645"},"areaStyle":{"transparency":100,"color1":"rgba(41, 98, 255, 0.28)","color2":"#2962FF","linecolor":"#2962FF","linewidth":2,"linestyle":0},"hiloStyle":{"color":"#2962FF","borderColor":"#2962FF","labelColor":"#2962FF"},"columnStyle":{"upColor":"rgba(8, 153, 129, 0.5)","downColor":"rgba(242, 54, 69, 0.5)","priceSource":"close"},"renkoStyle":{"upColor":"#089981","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645","upColorProjection":"#336854","downColorProjection":"#7f323f","borderUpColorProjection":"#336854","borderDownColorProjection":"#7f323f","wickUpColor":"#089981","wickDownColor":"#F23645"},"lineStyle":{"color":"#2962FF","linewidth":2,"linestyle":0},"lineWithMarkersStyle":{"color":"#2962FF","linewidth":2,"linestyle":0},"steplineStyle":{"color":"#2962FF","linewidth":2,"linestyle":0},"kagiStyle":{"downColor":"#F23645","upColor":"#089981","upColorProjection":"#336854","downColorProjection":"#7f323f"},"pbStyle":{"upColor":"#089981","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645","upColorProjection":"#336854","downColorProjection":"#7f323f","borderUpColorProjection":"#336854","borderDownColorProjection":"#7f323f"},"rangeStyle":{"upColor":"#089981","downColor":"#F23645","upColorProjection":"#336854","downColorProjection":"#7f323f"}}}}')
;var a=i(24633);function l(){return{[a.StdTheme.Light]:JSON.parse(JSON.stringify(n)),[a.StdTheme.Dark]:JSON.parse(JSON.stringify(o))}}function c(){return[a.StdTheme.Light,a.StdTheme.Dark]}function h(e){return l()[e]}function d(e){return{[a.StdTheme.Light]:s.t(null,{context:"colorThemeName"},i(69841)),[a.StdTheme.Dark]:s.t(null,{context:"colorThemeName"},i(14642))}[e]||e}function u(e){const t=l();return c().some((i=>p(t[i],e)))}function p(e,t){let i=e.content===t.content;return function(e={},t){try{_(e,[],t)}catch(e){return}}(e.content,((e,s)=>{const n=function(e,t={}){let i=t;for(let t=0;t{"use strict";var s;i.d(t,{StdTheme:()=>s}),function(e){e.Light="light",e.Dark="dark"}(s||(s={}))},11014:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DEFAULT_THEME:()=>h,extractThemeFromModel:()=>V,getCurrentTheme:()=>g,getStdTheme:()=>T,getStdThemeNames:()=>P,getStdThemedValue:()=>I,getTheme:()=>w,getThemeNames:()=>C,getThemedColor:()=>f,isPublicTheme:()=>m,isStdTheme:()=>E,isStdThemeName:()=>x,isStdThemedDefaultValue:()=>M,isThemeExist:()=>k,loadTheme:()=>v,removeTheme:()=>L,restoreTheme:()=>S,saveTheme:()=>A,savedThemeName:()=>y,syncTheme:()=>b,themes:()=>_,translateStdThemeName:()=>D});var s=i(24377),r=i(85804),n=i(56840);function o(){return(0,n.getValue)("current_theme.name")||null}const a=i(58844);var l=i(26843),c=i(45345);const h="light";var d=i(11542)
;const u=JSON.parse('{"color-header-bg":"color-black","color-body-bg":"color-black","color-body-secondary-bg":"color-cold-gray-900","color-bg-primary":"color-cold-gray-850","color-bg-primary-hover":"color-cold-gray-800","color-bg-secondary":"color-cold-gray-900","color-bg-highlight":"color-cold-gray-900","color-bg-scroll-buttons":"color-cold-gray-800","color-legacy-bg-scroll-buttons":"color-cold-gray-550","color-legacy-bg-widget":"color-cold-gray-900","color-text-primary":"color-cold-gray-200","color-text-secondary":"color-cold-gray-450","color-text-tertiary":"color-cold-gray-400","color-text-disabled":"color-cold-gray-650","color-accent-content":"color-white","color-divider":"color-cold-gray-700","color-divider-hover":"color-cold-gray-800","color-divider-secondary":"color-cold-gray-800","color-box-shadow":"color-cold-gray-900","color-active-hover-text":"color-cold-gray-200","color-alert-text":"color-cold-gray-200","color-border":"color-cold-gray-750","color-border-chat-fields":"color-cold-gray-750","color-border-hover":"color-cold-gray-650","color-border-table":"color-cold-gray-800","color-brand":"color-tv-blue-500","color-brand-hover":"color-tv-blue-600","color-brand-active":"color-tv-blue-700","color-button-hover-bg":"color-cold-gray-850","color-chart-page-bg":"color-cold-gray-800","color-common-tooltip-bg":"color-cold-gray-750","color-danger":"color-ripe-red-600","color-danger-hover":"color-ripe-red-500","color-danger-active":"color-ripe-red-400","color-depthrenderer-fill-style":"color-cold-gray-150","color-depthrenderer-stroke-style":"color-cold-gray-650","color-disabled-border-and-color":"color-cold-gray-800","color-disabled-input":"color-cold-gray-750","color-empty-container-message":"color-cold-gray-450","color-halal":"color-iguana-green-400","color-continuous":"color-cold-gray-500","color-highlight-new":"color-tv-blue-a800","color-icons":"color-cold-gray-450","color-input-bg":"color-cold-gray-800","color-input-textarea-readonly":"color-cold-gray-650","color-input-placeholder-text":"color-cold-gray-700","color-input-publish-bg":"color-cold-gray-900","color-item-active-blue":"color-tv-blue-a900","color-item-hover-active-bg":"color-cold-gray-800","color-item-hover-bg":"color-cold-gray-800","color-item-hover-blue":"color-tv-blue-a800","color-item-selected-blue":"color-tv-blue-a800","color-item-active-text":"color-cold-gray-200","color-item-active-bg":"color-tv-blue-500","color-link":"color-tv-blue-500","color-link-hover":"color-tv-blue-600","color-link-active":"color-tv-blue-700","color-list-item":"color-cold-gray-450","color-list-nth-child-bg":"color-cold-gray-850","color-news-highlight":"color-cold-gray-800","color-pane-bg":"color-cold-gray-900","color-pane-secondary-bg":"color-cold-gray-850","color-placeholder":"color-cold-gray-650","color-popup-menu-item-hover-bg":"color-cold-gray-800","color-popup-menu-separator":"color-cold-gray-700","color-primary-symbol":"color-sky-blue-500","color-row-hover-active-bg":"color-cold-gray-800","color-sb-scrollbar-body-bg":"color-cold-gray-650","color-screener-description":"color-cold-gray-200","color-section-separator-border":"color-cold-gray-750","color-search-button-hover":"color-cold-gray-700","color-separator-table-chat":"color-cold-gray-750","color-success":"color-minty-green-700","color-success-hover":"color-minty-green-600","color-success-active":"color-minty-green-500","color-tag-active-bg":"color-cold-gray-750","color-tag-hover-bg":"color-cold-gray-800","color-text-regular":"color-cold-gray-200","color-toolbar-button-text":"color-cold-gray-200","color-toolbar-button-text-hover":"color-cold-gray-200","color-toolbar-button-text-active":"color-tv-blue-500","color-toolbar-button-text-active-hover":"color-tv-blue-600","color-toolbar-button-background-hover":"color-cold-gray-800","color-toolbar-button-background-secondary-hover":"color-cold-gray-750","color-toolbar-button-background-active":"color-tv-blue-a900","color-toolbar-button-background-active-hover":"color-tv-blue-a800","color-toolbar-toggle-button-background-active":"color-tv-blue-500","color-toolbar-toggle-button-background-active-hover":"color-tv-blue-600","color-toolbar-toggle-button-icon":"color-cold-gray-650","color-toolbar-interactive-element-text-normal":"color-cold-gray-200","color-toolbar-opened-element-bg":"color-cold-gray-800","color-toolbar-divider-background":"color-cold-gray-700","color-popup-background":"color-cold-gray-850","color-popup-element-text":"color-cold-gray-200","color-popup-element-text-hover":"color-cold-gray-250","color-popup-element-background-hover":"color-cold-gray-800","color-popup-element-secondary-text":"color-cold-gray-500","color-popup-element-hint-text":"color-cold-gray-600","color-popup-element-text-active":"color-cold-gray-200","color-popup-element-background-active":"color-tv-blue-500","color-popup-element-toolbox-text":"color-cold-gray-500","color-popup-element-toolbox-text-hover":"color-cold-gray-200","color-popup-element-toolbox-text-active-hover":"color-tv-blue-200","color-popup-element-toolbox-background-hover":"color-cold-gray-750","color-popup-element-toolbox-background-active-hover":"color-tv-blue-700","color-tooltip-bg":"color-cold-gray-750","color-tv-button-checked":"color-cold-gray-450","color-tv-dialog-caption":"color-cold-gray-50","color-tv-dropdown-item-hover-bg":"color-cold-gray-800","color-underlined-text":"color-cold-gray-450","color-widget-pages-bg":"color-cold-gray-900","color-warning":"color-tan-orange-700","color-forex-icon":"color-white","color-list-item-active-bg":"color-tv-blue-500","color-list-item-hover-bg":"color-cold-gray-800","color-list-item-text":"color-cold-gray-200","color-price-axis-label-back":"color-cold-gray-800","color-price-axis-label-text":"color-cold-gray-500","color-price-axis-gear":"color-cold-gray-200","color-price-axis-gear-hover":"color-cold-gray-400","color-price-axis-highlight":"color-cold-gray-800","color-bid":"color-tv-blue-500","color-scroll-bg":"color-cold-gray-750","color-scroll-border":"color-cold-gray-850","color-widget-border":"color-cold-gray-800","color-scroll-buttons-arrow":"color-white","color-control-intent-default":"color-cold-gray-650","color-control-intent-success":"color-minty-green-500","color-control-intent-primary":"color-tv-blue-500","color-control-intent-warning":"color-tan-orange-500","color-control-intent-danger":"color-ripe-red-500","color-growing":"color-minty-green-500","color-falling":"color-ripe-red-500","color-goto-label-background":"color-cold-gray-650","color-pre-market":"color-tan-orange-600","color-pre-market-bg":"color-tan-orange-400","color-post-market":"color-tv-blue-500","color-post-market-bg":"color-tv-blue-400","color-market-open":"color-minty-green-500","color-market-open-bg":"color-minty-green-400","color-market-closed":"color-cold-gray-400","color-market-holiday":"color-cold-gray-400","color-market-expired":"color-ripe-red-500","color-invalid-symbol":"color-ripe-red-400","color-invalid-symbol-hover":"color-ripe-red-500","color-replay-mode":"color-tv-blue-500","color-replay-mode-point-select":"color-cold-gray-250","color-replay-mode-icon":"color-tv-blue-50","color-replay-mode-hover":"color-tv-blue-600","color-notaccurate-mode":"color-berry-pink-600","color-delay-mode":"color-tan-orange-700","color-delay-mode-bg":"color-tan-orange-400","color-eod-mode":"color-grapes-purple-700","color-eod-mode-bg":"color-grapes-purple-400","color-data-problem":"color-ripe-red-600","color-data-problem-bg":"color-ripe-red-400","color-data-problem-hover":"color-ripe-red-500","color-list-item-bg-highlighted":"color-tv-blue-a900","color-list-item-bg-selected":"color-tv-blue-a800","color-list-item-bg-highlighted-hover":"color-tv-blue-a800","color-list-item-bg-selected-hover":"color-tv-blue-a700","color-screener-header-bg":"color-cold-gray-850","color-screener-header-bg-hover":"color-cold-gray-800","color-overlay":"color-cold-gray-950","color-boost-button-content-selected":"color-tv-blue-100","color-boost-button-content-hover":"color-white","color-boost-button-bg-hover":"color-cold-gray-750","color-boost-button-border-hover":"color-cold-gray-750","color-boost-button-border-default":"color-cold-gray-700","color-x-twitter-content":"color-white","color-card-border":"color-cold-gray-700","color-card-border-hover":"color-cold-gray-600","color-background-special-primary":"color-black","color-stroke-special-primary":"color-cold-gray-800","color-selection-bg":"color-tv-blue-a700","color-default-gray":"color-cold-gray-450","color-featured-broker-badge-bg":"color-white","color-featured-broker-badge-bg-hover":"color-cold-gray-100","color-featured-broker-badge-text":"color-cold-gray-900"}')
;var p=i(33013);const _={[l.StdTheme.Light]:{name:l.StdTheme.Light,label:()=>d.t(null,{context:"colorThemeName"},i(69841)),order:2,getThemedColor:e=>(0,p.getHexColorByName)(e)},[l.StdTheme.Dark]:{name:l.StdTheme.Dark,label:()=>d.t(null,{context:"colorThemeName"},i(14642)),order:1,getThemedColor:e=>{const t=u[e]||e;return(0,p.getHexColorByName)(t)}}};function m(e){return!e.isPrivate}function g(){return _[c.watchedTheme.value()]||_[h]}function f(e){return g().getThemedColor(e)}async function v(e,t){const{themeName:i,standardTheme:s,syncState:n=!0,noUndo:o=!1,applyOverrides:a=!1,onlyActiveChart:l=!1}=t,c=await(s?Promise.resolve(T(i)):w(i)),h=!s;if(void 0!==c.content){const t=!s||l;a&&(void 0!==(d=c.content).chartProperties&&(0,r.applyDefaultsOverrides)(d.chartProperties),void 0!==d.mainSourceProperties&&(0,r.applyDefaultsOverrides)(d.mainSourceProperties,void 0,!0,"mainSeriesProperties")),await e.applyTheme({theme:c.content,onlyActiveChart:t,restoreNonThemeDefaults:h,themeName:i,standardTheme:s,syncState:n,noUndo:o})}var d;return c}function S(){(0,c.setTheme)(o()||h)}function y(){return o()}function b(){var e;e=g().name,(0,n.setValue)("current_theme.name",e,{forceFlush:!0})}function w(e){return a.loadTheme(e)}function C(){return a.loadThemes()}function P(){return l.getStdThemeNames()}function x(e){return P().includes(e)}function T(e){return l.getStdChartTheme(e)||{content:void 0}}function I(e,t){const i=t||g().name,s=l.getStdChartTheme(i),r=0!==e.length&&e.split(".");return s&&s.content&&r?r.reduce(((e,t)=>e[t]),s.content):null}function M(e,t,i){const r=I(e,i);return null!==r&&(0,s.areEqualRgba)((0,s.parseRgba)(r),(0,s.parseRgba)(String(t)))}function A(e,t){return a.saveTheme(e,t)}function L(e){return a.removeTheme(e)}function k(e){return a.isThemeExist(e)}function D(e){return l.translateThemeName(e)}function E(e){return l.isStdTheme(e)}function V(e){return{content:{chartProperties:{paneProperties:e.model().properties().childs().paneProperties.state(),scalesProperties:e.model().properties().childs().scalesProperties.state()},sessions:e.model().sessions().properties().state(),mainSourceProperties:e.model().mainSeries().properties().state(),version:e.model().version()}}}},45345:(e,t,i)=>{"use strict";i.d(t,{setTheme:()=>r,watchedTheme:()=>s});const s=new(i(97145).WatchedValue);function r(e){s.setValue(e)}s.subscribe((e=>{!function(e,t=window){const i="theme-"+e,s=t.document.documentElement.classList;for(const e of Array.from(s))e.startsWith("theme-")&&e!==i&&s.remove(e);s.add(i)}(e,window)}))},51768:(e,t,i)=>{"use strict";i.d(t,{disableTrackingEvents:()=>c,trackEvent:()=>l});var s=i(76422),r=i(14483);const n=(0,i(59224).getLogger)("Common.TrackEvent"),o=[/Study_(Drawing)_(.*)/,/(Study)_(.*)@tv-basicstudies/,/(Study)_(.*)/,/(Chart Style) (.*)/];let a=!1;const l=(e,t,i)=>{if(a)return;if(r.enabled("charting_library_base"))return void((e,t,i)=>{t=t||e||i||"";let r="";for(let e=0;e{"use strict";i.d(t,{TVXWindowEvents:()=>o});i(42053);var s=i(59224),r=i(11417);const n=(0,s.getLogger)("XWindowEvents");var o;!function(e){const t="tvxwevents.",i={};let s;window.BroadcastChannel?(s=new BroadcastChannel("tvxwevents"),s.addEventListener("message",(function(e){const{data:{event:t,value:s}}=e;i[t]&&i[t].forEach((e=>{e(s)}))})),function(){const e=[],i=performance.now();for(let i=0;i{t(e.newValue)}));r.TVLocalStorage.removeItem(n)})),e.on=function(e,t){i[e]||(i[e]=[]),i[e].push(t)},e.off=function(e,t){if(!i[e])return;const s=i[e].indexOf(t);-1!==s&&(1===i[e].length?delete i[e]:i[e].splice(s,1))},e.emit=function(e,i=Date.now()){try{s?s.postMessage({event:e,value:i}):r.TVLocalStorage.setItem(t+e,i.toString())}catch(e){n.logError(e.message)}}}(o||(o={}))},82723:(e,t,i)=>{"use strict";i.d(t,{activateKeyPressHandler:()=>m,showDialog:()=>g});const s=[];let r=null;function n(e){for(let t=0;t=0&&!0!==s[t].func(e);t--);}window.addEventListener("keypress",o,!1);var a=i(31330),l=i(14483),c=i(54270),h=i(43960),d=i(13702),u=i(51768);let p=null;function _(e){if(!(0,a.globalKeypressMatches)(e))return!1;e.preventDefault();const t=String.fromCharCode(e.charCode);return l.enabled("show_interval_dialog_on_key_press")&&function(e){return/[1-9]/.test(e)}(t)?(0,c.showChangeIntervalDialogAsync)({initVal:t}):l.enabled("symbol_search_hot_key")&&(g({defaultValue:t,selectSearchOnInit:!1,source:"keyboard",trackResultsOptions:{trackResults:!1,emptySearchType:"empty_result__supercharts"}}),(0,u.trackEvent)("GUI","SS","hotkey")),!0}function m(){(0,h.loadChangeIntervalDialog)(),function(e,t){const i={name:e,func:t},r=n(i.name);r>-1&&s.splice(r,1),s.unshift(i)}("symbolEdit",_)}function g(e){const t=p=(0,d.loadNewSymbolSearch)().then((i=>{t===p&&i.showDefaultSearchDialog(e)}));return t}},78136:(e,t,i)=>{"use strict";let s;function r(){return s}function n(e){s=e}i.d(t,{getSearchRequestDelay:()=>r,setSearchRequestDelay:()=>n})},52092:(e,t,i)=>{"use strict";i.d(t,{
CLOSE_POPUPS_AND_DIALOGS_COMMAND:()=>s});const s="CLOSE_POPUPS_AND_DIALOGS_COMMAND"},42120:(e,t,i)=>{"use strict";i.d(t,{CompareDialogRenderer:()=>n});var s=i(85067);var r=i(76422);class n extends s.DialogRenderer{constructor(e){super(),this._dialog=null,this._subscribe=e=>{this._setVisibility(e)},this._chartWidgetCollection=e}show(e){this._load().then((t=>{var i,s;null===(i=this._dialog)||void 0===i||i.hide(),null===(s=this._dialog)||void 0===s||s.visible().unsubscribe(this._subscribe),this._dialog=t,t.visible().subscribe(this._subscribe),t.show(e),r.emit("compare_add")}))}hide(){var e;null===(e=this._dialog)||void 0===e||e.hide()}_load(){return Promise.all([i.e(7271).then(i.bind(i,56217)),Promise.all([i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(5145),i.e(855),i.e(6),i.e(5649),i.e(8056),i.e(5993),i.e(2587),i.e(2639),i.e(3502),i.e(9842),i.e(7807),i.e(3353),i.e(6949),i.e(5163),i.e(962),i.e(1740),i.e(6408),i.e(5057),i.e(750),i.e(731)]).then(i.bind(i,14283))]).then((([e,t])=>{const i=new e.CompareModel(this._chartWidgetCollection);return t.getCompareDialogRenderer(i)}))}}},3615:(e,t,i)=>{"use strict";async function s(e,t){const s=await Promise.all([i.e(2666),i.e(956),i.e(6),i.e(2191),i.e(6221),i.e(6639),i.e(3610),i.e(3717),i.e(962),i.e(6408),i.e(7550),i.e(8890)]).then(i.bind(i,70493));return s.showSimpleDialog(e,s.renameModule,t)}async function r(e,t){const s=await Promise.all([i.e(2666),i.e(956),i.e(6),i.e(2191),i.e(6221),i.e(6639),i.e(3610),i.e(3717),i.e(962),i.e(6408),i.e(7550),i.e(8890)]).then(i.bind(i,70493));return s.showSimpleDialog(e,s.confirmModule,t)}async function n(e,t){const s=await Promise.all([i.e(2666),i.e(956),i.e(6),i.e(2191),i.e(6221),i.e(6639),i.e(3610),i.e(3717),i.e(962),i.e(6408),i.e(7550),i.e(8890)]).then(i.bind(i,70493));return s.showSimpleDialog(e,s.warningModule,t)}i.d(t,{showConfirm:()=>r,showRename:()=>s,showWarning:()=>n})},14881:(e,t,i)=>{"use strict";i.d(t,{hideStateChange:()=>s});const s=new(i(57898).Delegate)},90995:(e,t,i)=>{"use strict";i.d(t,{getHideModeStateValue:()=>u,getHideOptions:()=>h,getSavedHideMode:()=>p,toggleHideMode:()=>d});var s=i(50151),r=i(11542),n=i(56840),o=i(40493),a=i(88348),l=i(14881);let c=null;function h(){if(null!==c)return c;const e=(0,o.tradingService)();return c=new Map([["drawings",{label:r.t(null,void 0,i(13277)),dataName:"hide-drawing-tools",tooltip:{active:r.t(null,void 0,i(98116)),inactive:r.t(null,void 0,i(95551))},getBoxedValue:()=>(0,a.hideAllDrawings)(),trackLabel:"hide drawings"}],["indicators",{label:r.t(null,void 0,i(44177)),dataName:"hide-indicators",tooltip:{active:r.t(null,void 0,i(49982)),inactive:r.t(null,void 0,i(86306))},getBoxedValue:()=>(0,a.hideAllIndicators)(),trackLabel:"hide indicators"}],["positions",{label:r.t(null,void 0,i(90540)),dataName:"hide-positions-and-orders",tooltip:{active:r.t(null,void 0,i(62632)),inactive:r.t(null,void 0,i(70803))},getBoxedValue:()=>(0,s.ensureNotNull)(e).showTradedSources,inverted:!0,trackLabel:"hide positions"}],["all",{label:r.t(null,void 0,i(33911)),dataName:"hide-all",tooltip:{
active:e?r.t(null,void 0,i(38293)):r.t(null,void 0,i(39046)),inactive:e?r.t(null,void 0,i(67927)):r.t(null,void 0,i(44312))},trackLabel:"hide all"}]]),e||c.delete("positions"),c}function d(e){e?n.setValue("ChartToolsHideMode",e):e=p();const t=_();let i=!t;return"all"===e?(m(((e,t,s)=>{e.setValue(s?!i:i)})),l.hideStateChange.fire({hideMode:e,isActive:i}),i):(m(((s,r,n)=>{if(r===e){const e=t?!n:!s.value();s.setValue(e),i=n?!e:e}else s.setValue(Boolean(n))})),l.hideStateChange.fire({hideMode:e,isActive:i}),i)}function u(e){if("all"===e)return _();const t=(0,s.ensureDefined)(h().get(e)),i=(0,s.ensureDefined)(t.getBoxedValue)().value();return t.inverted?!i:i}function p(){const e=n.getValue("ChartToolsHideMode","drawings");return h().has(e)?e:"drawings"}function _(){let e=!0;return m(((t,i,s)=>{const r=t.value();e=e&&(s?!r:r)})),e}function m(e){h().forEach(((t,i)=>{var s;const r=null===(s=t.getBoxedValue)||void 0===s?void 0:s.call(t);r&&e(r,i,t.inverted)}))}},13323:(e,t,i)=>{"use strict";i.d(t,{GeneralChartPropertiesRenderer:()=>r});var s=i(85067);class r extends s.DialogRenderer{constructor(e){super(),this._dialog=null,this._subscribe=e=>{this._setVisibility(e)},this._chartWidgetCollection=e}show(e){const t=this._chartWidgetCollection,s=t.activeChartWidget.value();return s.generalPropertiesDefinitions().then((r=>Promise.all([i.e(5362),i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(6),i.e(5649),i.e(8056),i.e(5993),i.e(2191),i.e(6221),i.e(2587),i.e(2639),i.e(3502),i.e(8149),i.e(9842),i.e(7807),i.e(3353),i.e(4215),i.e(6036),i.e(9327),i.e(6625),i.e(7194),i.e(6884),i.e(5940),i.e(3980),i.e(5166),i.e(826),i.e(7350),i.e(524),i.e(7871),i.e(962),i.e(1740),i.e(750),i.e(4403),i.e(4713),i.e(7051),i.e(5664),i.e(4648),i.e(7078)]).then(i.bind(i,56080)).then((i=>{var n,o;const a=new i.GeneralChartPropertiesDialogRenderer({chartWidgetCollection:t,propertyPages:r,activePageId:this._activePageId,model:s.model()});return null===(n=this._dialog)||void 0===n||n.hide(),null===(o=this._dialog)||void 0===o||o.visible().unsubscribe(this._subscribe),this._dialog=a,a.visible().subscribe(this._subscribe),a.show(e),this._activePageId=void 0,a}))))}hide(){var e;null===(e=this._dialog)||void 0===e||e.hide()}isVisible(){return this.visible().value()}focusOnText(){}setActivePage(e){this._activePageId=e}}},25812:(e,t,i)=>{"use strict";var s;i.d(t,{ToolboxType:()=>s}),function(e){e[e.Delete=0]="Delete"}(s||(s={}))},59064:(e,t,i)=>{"use strict";i.d(t,{globalCloseDelegate:()=>s,globalCloseMenu:()=>r});const s=new(i(57898).Delegate);function r(){s.fire()}},62995:e=>{e.exports={"css-value-header-toolbar-height":"38px"}},81501:e=>{e.exports={chartsSplitter:"chartsSplitter-L0xapso5",hovered:"hovered-L0xapso5","i-active":"i-active-L0xapso5"}},71332:e=>{e.exports={"css-value-pane-controls-padding-left":"1px","css-value-pane-controls-padding-right":"4px"}},30383:e=>{e.exports={paneSeparator:"paneSeparator-uqBaC1Ki",handle:"handle-uqBaC1Ki",hovered:"hovered-uqBaC1Ki",active:"active-uqBaC1Ki"}},58035:e=>{e.exports={
priceScaleModeButtons:"priceScaleModeButtons-PEm49B2T",priceScaleModeButtons__button:"priceScaleModeButtons__button-PEm49B2T",priceScaleModeButtons__button_activated:"priceScaleModeButtons__button_activated-PEm49B2T"}},37292:(e,t,i)=>{"use strict";i.d(t,{getLineToolsSynchronizerClass:()=>o,loadLineToolsSynchronizer:()=>n});var s=i(14483);let r=null;async function n(){if(s.enabled("saveload_separate_drawings_storage")){const e=await i.e(7129).then(i.bind(i,16879));return r=e.LineToolsSynchronizer,!0}return!1}function o(){if(!r)throw new Error("LineToolsSynchronizer Class not loaded");return r}},18792:(e,t,i)=>{"use strict";var s=i(1722).declareClassAsPureInterface;function r(){}TradingView.WEB_SOCKET_WAS_CONNECTED=!1,r.prototype.defaultResolutions=function(){},r.prototype.availableCurrencies=function(){},r.prototype.availableUnits=function(){},r.prototype.supportedSymbolsTypes=function(){},r.prototype.symbolsGrouping=function(){},r.prototype.quoteCreateSession=function(e){},r.prototype.quoteDeleteSession=function(e){},r.prototype.quoteSetFields=function(e,t){},r.prototype.quoteAddSymbols=function(e,t){},r.prototype.quoteRemoveSymbols=function(e,t){},r.prototype.quoteFastSymbols=function(e,t){},r.prototype.depthCreateSession=function(e,t,i){},r.prototype.depthDeleteSession=function(e){},r.prototype.depthSetSymbol=function(e,t){},r.prototype.depthClearSymbol=function(e){},r.prototype.depthSetScale=function(e,t){},r.prototype.chartCreateSession=function(e,t){},r.prototype.chartDeleteSession=function(e){},r.prototype.createSession=function(e,t){},r.prototype.removeSession=function(e){},r.prototype.connected=function(){},r.prototype.connect=function(){},r.prototype.disconnect=function(){},r.prototype.switchTimezone=function(e,t){},r.prototype.resolveSymbol=function(e,t,i,s){},r.prototype.createSeries=function(e,t,i,s,r,n,o,a){},r.prototype.removeSeries=function(e,t,i){},r.prototype.modifySeries=function(e,t,i,s,r,n,o){},r.prototype.requestMoreData=function(e,t,i,s){},r.prototype.requestMetadata=function(e){},r.prototype.canCreateStudy=function(e,t){},r.prototype.createStudy=function(e,t,i,s,r,n,o){},r.prototype.getStudyCounter=function(){},r.prototype.rebindStudy=function(e,t,i,s,r,n,o,a){},r.prototype.removeStudy=function(e,t,i){},r.prototype.modifyStudy=function(e,t,i,s,r){},r.prototype.createPointset=function(e,t,i,s,r,n,o){},r.prototype.modifyPointset=function(e,t,i,s,r){},r.prototype.removePointset=function(e,t,i){},r.prototype.requestMoreTickmarks=function(e,t,i,s){},r.prototype.requestFirstBarTime=function(e,t,i,s){},r.prototype._invokeHandler=function(e,t){},r.prototype._sendRequest=function(e,t){},r.prototype._onMessage=function(e){},r.prototype._dispatchNotification=function(e){},r.prototype._invokeNotificationHandler=function(e,t,i){},r.prototype._notifySessions=function(e){},r.prototype.unpack=function(e){},r.prototype.searchSymbols=function(e,t,i,s,r,n,o,a,l,c){},r.prototype.getMarks=function(e,t,i,s,r){},r.prototype.getTimescaleMarks=function(e,t,i,s,r){},s(r,"ChartApiInterface"),e.exports.ChartApiInterface=r
},58844:(e,t,i)=>{"use strict";i.r(t),i.d(t,{getChartContent:()=>C,getCharts:()=>y,getChartsCount:()=>S,getCustomAdapter:()=>g,getDrawingTemplates:()=>B,getStandardStudyTemplateContentById:()=>k,getStorageURL:()=>_,getStudyTemplateContent:()=>T,getStudyTemplateContentById:()=>L,getStudyTemplatesList:()=>M,initialize:()=>f,invalidateStudyTemplatesList:()=>A,isThemeExist:()=>U,loadChart:()=>P,loadDrawingTemplate:()=>R,loadTheme:()=>F,loadThemes:()=>W,removeChart:()=>b,removeDrawingTemplate:()=>N,removeStudyTemplate:()=>x,removeStudyTemplateById:()=>D,removeTheme:()=>z,renameStudyTemplate:()=>E,replaceStudyTemplate:()=>V,saveChart:()=>w,saveDrawingTemplate:()=>O,saveStudyTemplate:()=>I,saveTheme:()=>H,setCustomAdapter:()=>m,updateUser:()=>v});var s=i(76422),r=i(59224),n=i(93544);const o=(0,r.getLogger)("Chart.SaveloadAdapter.Library"),a={error:""};let l,c,h,d,u=null,p=null;function _(e){return`${h}/${encodeURIComponent(d)}/${e}?client=${encodeURIComponent(l)}&user=${encodeURIComponent(c)}`}function m(e){u=e}function g(){return u}function f(e,t,i,s){l=e,c=t,h=i,d=s}function v(e){c=e}function S(e,t){throw new Error("Not implemented")}async function y(){const e=e=>e.map((e=>({id:e.id,name:e.name,image_url:String(e.id),modified_iso:e.timestamp,short_symbol:e.symbol,interval:e.resolution})));if(u)return u.getAllCharts().then(e);try{const t=await fetch(`${_("charts")}`,{credentials:"same-origin"});if(!t.ok)throw new Error(`Getting chart content response was not OK. Status: ${t.status}.`);const i=await t.json();if("ok"!==i.status)throw new Error("Get chart content request failed: "+i.message);return e(i.data)}catch(e){throw o.logWarn((0,n.errorToString)(e)),e}}async function b(e){if(u)return u.removeChart(e);try{const t=await fetch(`${_("charts")}&chart=${encodeURIComponent(e)}`,{method:"DELETE",credentials:"same-origin"});if(!t.ok)throw new Error(`Remove chart response was not OK. Status: ${t.status}.`);const i=await t.json();if("ok"!==i.status)throw new Error("Remove drawing template request failed: "+i.message)}catch(e){throw o.logWarn((0,n.errorToString)(e)),e}}async function w(e,t,i,s,r){var a;const l=r.id.value(),c={name:e,content:JSON.stringify(s),symbol:t,resolution:i};if(u)return u.saveChart({...c,id:l});try{const e=new FormData;for(const t in c)e.append(t,c[t]);let t=_("charts");null!=l&&(t+=`&chart=${encodeURIComponent(l)}`);const i=await fetch(t,{credentials:"same-origin",method:"POST",body:e});if(!i.ok)throw new Error(`Saving chart content response was not OK. Status: ${i.status}.`);const s=await i.json();if("ok"!==s.status)throw new Error("Saving chart content request failed: "+s.message);return(null!==(a=s.id)&&void 0!==a?a:l).toString()}catch(e){throw o.logWarn((0,n.errorToString)(e)),e}}async function C(e){const t=t=>{const i=JSON.parse(t);return i.uid=e.id,i};if(u)return u.getChartContent(e.id).then((e=>t(e)));try{const i=await fetch(`${_("charts")}&chart=${encodeURIComponent(e.id)}`,{credentials:"same-origin"});if(!i.ok)throw new Error(`Getting chart content response was not OK. Status: ${i.status}.`)
;const s=await i.json();if("ok"!==s.status)throw new Error("Get chart content request failed: "+s.message);return t(s.data.content)}catch(e){throw o.logWarn((0,n.errorToString)(e)),e}}function P(e){C(e).then((e=>{s.emit("chart_load_requested",e)}),(()=>{o.logWarn("Error loading chart")}))}async function x(e){try{if(u)return u.removeStudyTemplate({name:e});const t=await fetch(`${_("study_templates")}&template=${encodeURIComponent(e)}`,{method:"DELETE",credentials:"same-origin"});if(!t.ok)throw new Error(`Remove study template response was not OK. Status: ${t.status}.`);const i=await t.json();if("ok"!==i.status)throw new Error("Remove study template request failed: "+i.message)}catch(e){throw o.logWarn((0,n.errorToString)(e)),e}}async function T(e){try{if(u){return{content:await u.getStudyTemplateContent({name:e})}}const t=await fetch(`${_("study_templates")}&template=${encodeURIComponent(e)}`,{credentials:"same-origin"});if(!t.ok)throw new Error(`Get study template response was not OK. Status: ${t.status}.`);const i=await t.json();if("ok"!==i.status)throw new Error("Get study template request failed: "+i.message);return i.data}catch(e){throw o.logWarn((0,n.errorToString)(e)),e}}async function I(e){try{if(u)return u.saveStudyTemplate(e).then((()=>({error:""}))).catch((e=>({error:null!=e?(0,n.errorToString)(e):"error"})));const t=new FormData;t.append("name",e.name),t.append("content",e.content);const i=await fetch(_("study_templates"),{method:"POST",body:t,credentials:"same-origin"});if(!i.ok)throw new Error(`Save study template response was not OK. Status: ${i.status}.`);const s=await i.json();return{error:"ok"===s.status?"":s.status}}catch(e){throw o.logWarn((0,n.errorToString)(e)),e}}async function M(){try{if(p)return p;p=[];const e=e=>(p=e.map((e=>({is_default:!1,name:e.name}))),p);if(u)return u.getAllStudyTemplates().then(e);const t=await fetch(_("study_templates"),{method:"GET",credentials:"same-origin"});if(!t.ok)throw new Error(`Study templates list response was not OK. Status: ${t.status}.`);const i=await t.json();if("ok"!==i.status)throw new Error("Study templates list request failed: "+i.message);return e(i.data)}catch(e){throw o.logWarn((0,n.errorToString)(e)),e}}function A(){p=null}function L(e,t){throw new Error("Not implemented")}function k(e,t){throw new Error("Not implemented")}function D(e,t){throw new Error("Not implemented")}function E(e,t,i){throw new Error("Not implemented")}function V(e,t,i){throw new Error("Not implemented")}async function B(e){throw new Error("Not implemented")}async function R(e,t){throw new Error("Not implemented")}async function N(e,t){throw new Error("Not implemented")}async function O(e,t,i){throw new Error("Not implemented")}function F(e){if(null!==u)return u.getChartTemplateContent(e);throw new Error("Not implemented")}function W(){return null!==u?u.getAllChartTemplates():Promise.resolve([])}async function H(e,t){if(null!==u)try{return await u.saveChartTemplate(e,t),a}catch(e){return console.error(e),{error:e instanceof Error?e.message:e.toString()}}
throw new Error("Not implemented")}async function z(e){if(null!==u)try{return await u.removeChartTemplate(e),a}catch(e){return console.error(e),{error:e instanceof Error?e.message:e.toString()}}throw new Error("Not implemented")}function U(e){return F(e).then((e=>Boolean(e.content)))}},2269:(e,t,i)=>{"use strict";var s=i(50151).ensureNotNull,r=i(60156),n=i(36274).Interval,o=i(94141),a=i(60325),l=i(18792).ChartApiInterface,c=i(47327).HandlerInfo,h=i(1722).requireFullInterfaceImplementation,d=i(59224).getLogger("Chart.ChartApiLocal"),u=i(17133).TIMEFRAMETYPE,p=i(77475).createDwmAligner;TradingView.STUDY_COUNT_LIMIT=210;JSServer.ChartApi=function(e){this._notificationHandlers={},this._sessions={},this.studyCounter=0,this._metadataRequestNextNumber=1,this._connected=!1,this._enabled=!1,this._studyEngine=new o(e),this._callbacks={},this._serverTimeOffset=0;var t=this;this._studyEngine.on("configuration_received",(function(){t._fireEvent("configuration_received")})),this._studyEngine.on("realtime_tick",(function(e){var i={time:e.value[0]/1e3,open:e.value[1],high:e.value[2],low:e.value[3],close:e.value[4],volume:e.value[5]};t._fireEvent("realtime_tick",i,!0)})),this._setVisibleRangeTimeout={}},JSServer.ChartApi.prototype.destroy=function(){this._studyEngine.destroy(),this._studyEngine=null},JSServer.ChartApi.prototype.purgeCache=function(e){this._studyEngine.purgeCache(),this._studyEngine.purgeDataCache()},JSServer.ChartApi.prototype.defaultResolutions=function(){return this._studyEngine.supportedResolutions()||["1","3","5","15","30","45","60","120","180","240","1D","1W","1M"]},JSServer.ChartApi.prototype.availableCurrencies=function(){var e=this._studyEngine.supportedCurrencies().map((function(e){return"string"==typeof e?{id:e,code:e}:e}));return Promise.resolve(e)},JSServer.ChartApi.prototype.availableUnits=function(){return Promise.resolve(this._studyEngine.supportedUnits())},JSServer.ChartApi.prototype.availablePriceSources=function(e){return this._studyEngine.supportedPriceSources(e)},JSServer.ChartApi.prototype.supportedSymbolsTypes=function(){return this._studyEngine.supportedSymbolsTypes()},JSServer.ChartApi.prototype.symbolsGrouping=function(){return this._studyEngine.symbolsGrouping()},JSServer.ChartApi.prototype.start=function(){this._enabled=!0,this._fireEvent("start_enabled")},JSServer.ChartApi.prototype.unsubscribe=function(e,t){var i=this._callbacks[e];i&&i.splice(i.indexOf(t),1)},JSServer.ChartApi.prototype.on=function(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this},JSServer.ChartApi.prototype._fireEvent=function(e,t,i){if(this._callbacks.hasOwnProperty(e)){var s=this._callbacks[e].slice(0);i||(this._callbacks[e]=[]);for(var r=0;rn||(TradingView.ChartapiMessagerInstances[e].onSeriesTimeframeUpdate(t,i,m,n,a,c),l&&setTimeout(l,0))}}}if(this._studyEngine.isTimeScaleExtendedTo(e,1e3*r))m();else{var g=TradingView.ChartapiMessagerInstances[e].beforeSeriesCompleted,f=TradingView.ChartapiMessagerInstances[e].seriesError;void 0!==this._setVisibleRangeTimeout[e]&&clearTimeout(this._setVisibleRangeTimeout[e]),this._setVisibleRangeTimeout[e]=setTimeout(function(){delete this._setVisibleRangeTimeout[e],g.subscribe(null,v,!0),
f.subscribe(null,S,!0),this._studyEngine.ensureExtendedTo(t,e,1e3*r)}.bind(this),0)}function v(e,s){e===t&&s===i&&(g.unsubscribe(null,v),f.unsubscribe(null,S),m())}function S(e,s){e===t&&s===i&&g.unsubscribe(null,v)}},JSServer.ChartApi.prototype._applyTimeFrame=function(e,t,i,s,o){var a,l,c={},h=!0;if(o.type===u.PeriodBack){var d=this._studyEngine.getSeriesLastBarTime(e,i);if(null===d)return;l=d/1e3;var _=n.parse(o.value),m=this._studyEngine.getSeriesSymbolInfo(e,i);a=r.alignPeriodsBackForVisibleRange(m.session,m.session_holidays,m.corrections,_.letter(),_.multiplier(),1,d)/1e3;var g=p(this._studyEngine.getSeriesInterval(e,i),m);null!==g&&(l=g.timeToExchangeTradingDay(1e3*l)/1e3,a=g.timeToExchangeTradingDay(1e3*a)/1e3),c={applyDefaultRightMargin:!0},h=!1}else a=o.from,l=o.to;this.setVisibleTimeRange(e,i,s,a,l,h,c,void 0,o)},JSServer.ChartApi.prototype.modifySeries=function(e,t,i,s,r,n,o,a){var l=this;this._notificationHandlers[e][t]=new c((function(r){"series_completed"===r.method&&null!==o&&(l._applyTimeFrame(e,s,t,i,o),o=null),a(r)}),t),this._studyEngine.modifySeries(e,t,s,r,i,n)},JSServer.ChartApi.prototype.requestMoreData=function(e,t){this._studyEngine.extendSeriesRange(e,t)},JSServer.ChartApi.prototype.setStudiesAccessController=function(e){this.studiesAccessController=e},JSServer.ChartApi.prototype.allStudiesMetadata=function(){return this._studyEngine.studiesMetadata()},JSServer.ChartApi.prototype.requestMetadata=function(){return new Promise(((e,t)=>{const i=this.studiesAccessController.getEnabledTools();e({method:"studies_metadata",params:[this._makeNextRequestId(),{errors:[],hash:"",metainfo:i,migrations:[]}]})}))},JSServer.ChartApi.prototype._makeNextRequestId=function(){return"metadata_"+this._metadataRequestNextNumber++},JSServer.ChartApi.prototype.canCreateStudy=function(){return this.studyCounter{"use strict";var s=i(57898).Delegate,r=function(e,t){this._server=e,this._session=t,this.beforeSeriesCompleted=new s,this.seriesError=new s};r.prototype.onSymbolResolved=function(e,t){this._server.receiveLocalResponse({method:"symbol_resolved",params:[this._session,e,t]})},r.prototype.onSymbolError=function(e,t){this._server.receiveLocalResponse({method:"symbol_error",params:[this._session,e,t]})},r.prototype.onStudyError=function(e,t,i){this._server.receiveLocalResponse({method:"study_error",params:[this._session,e,t,i]})},r.prototype.onSeriesLoading=function(e,t){this._server.receiveLocalResponse({method:"series_loading",params:[this._session,e,t]})},r.prototype.onSeriesCompleted=function(e,t,i){this.beforeSeriesCompleted.fire(e,t),
this._server.receiveLocalResponse({method:"series_completed",params:[this._session,e,i,t]})},r.prototype.onSeriesError=function(e,t,i){this._server.receiveLocalResponse({method:"series_error",params:[this._session,e,t,i]}),this.seriesError.fire(e,t)},r.prototype.onStudyCompleted=function(e,t){this._server.receiveLocalResponse({method:"study_completed",params:[this._session,e,t]})},r.prototype.onStudyLoading=function(e,t){this._server.receiveLocalResponse({method:"study_loading",params:[this._session,e,t]})},r.prototype.onTickmarksUpdated=function(e,t){var i={method:"tickmark_update",params:[this._session,{index:e,zoffset:0,changes:[],marks:t,index_diff:[]}]};this._server.receiveLocalResponse(i)},r.prototype.onTimescaleUpdate=function(e,t){var i={method:"timescale_update",params:[this._session,this._prepareDataUpdateObjects(t),{index:e.pointsIndex,zoffset:0,changes:e.points,marks:e.marks,index_diff:e.indexChange,baseIndex:e.baseIndex}]};this._server.receiveLocalResponse(i)},r.prototype.onTimescaleCompleted=function(e){this._server.receiveLocalResponse({method:"timescale_completed",params:[this._session,e]})},r.prototype.onSeriesTimeframeUpdate=function(e,t,i,s,r,n){var o={method:"series_timeframe",params:[this._session,e,t,i,s,n||null,!0,r]};this._server.receiveLocalResponse(o)},r.prototype.onPointsetDataUpdate=function(e,t,i){this.onDataUpdate(e,t,i,null)},r.prototype._prepareDataUpdateObjects=function(e){var t={};return e.forEach((function(e){t[e.objId]={series:e.data,turnaround:e.turnaround},e.nonSeriesData&&(e.nonSeriesData.data?t[e.objId].nonseries={d:JSON.stringify(e.nonSeriesData.data),indexes:e.nonSeriesData.indexes}:t[e.objId].nonseries={d:"",indexes:[]})})),t},r.prototype.onDataUpdate=function(e,t,i,s){var r={method:"data_update",params:[this._session,this._prepareDataUpdateObjects([{objId:e,turnaround:t,data:i,nonSeriesData:s}])]};this._server.receiveLocalResponse(r)},r.prototype.onQuotesData=function(e){this._server.receiveLocalResponse({method:"quote_symbol_data",params:e})},r.prototype.onDepthData=function(e){this._server.receiveLocalResponse({method:"dd",params:e})},r.prototype.onDepthUpdate=function(e){this._server.receiveLocalResponse({method:"dpu",params:e})},r.prototype.onClearData=function(e){this._server.receiveLocalResponse({method:"clear_data",params:[this._session,e]})},TradingView.ChartapiMessagerInstances=[],e.exports=r},79850:(e,t,i)=>{"use strict";i.d(t,{DatafeedRequestsCachedProcessor:()=>_});var s=i(50151),r=i(36274),n=i(78071),o=i(74649),a=i(14483),l=i(60156),c=i(77475),h=i(57333);i(42053);function d(e,t){return e.ticker+(e.currency_code?"_#_"+e.currency_code:"")+(e.unit_id?"_#_"+e.unit_id:"")+(e.subsession_id?"_#_"+e.subsession_id:"")+"_#_"+t}function u(e){return new Date(e).toISOString()}class p{constructor(e,t,i,s,n,o){this._cache={bars:[]},this._nextSubscriptionId=0,this._pendingSubscribers=[],this._subscribers=[],this._requesting=!1,this._leftDate=null,this._nextTime=null,this._realtimeOn=!1,this._endOfData=!1,this._resetCacheTimeout=null,this._errorMessage=null,this._destroyed=!1,
this._emptyResponsesCount=0,this._firstDataRequest=!0,this._datafeed=e,this._symbolInfo=t,this._interval=r.Interval.parse(i),this._resolution=this._interval.value(),this._dwmAligner=n,this._serverTimeOffsetGetter=s,this._resetCacheTimePeriod=void 0===o?1e4:o,this._sessionSpec=new h.SessionSpec(t.timezone,t.session,t.session_holidays,t.corrections),this._updateDatesFromExpirationDate()}destroy(){0!==this._subscribers.length&&console.warn("Destroying with not-empty state"),this._clearResetCacheTimeout(),this._unsubscribeRealtime(),this._purgeCache(),delete this._datafeed,this._destroyed=!0}addSubscription(e,t,i){const s=this._getNextSubscriptionId();this._pendingSubscribers.push({key:s,range:e,onHistoryCallback:t,onErrorCallback:i}),r.Interval.isDWM(this._resolution)&&void 0!==e.to&&null!==this._dwmAligner&&e.to%864e5&&console.warn(`${this._logMessagePrefix()}Internal error: invalid date for DWM resolution ${u(e.to)}, expected time without a time part`),this._clearResetCacheTimeout();return setTimeout((()=>{this._destroyed||this._processPendingSubscribers()}),0),s}removeSubscription(e){const t=this._pendingSubscribers.find((t=>t.key===e));if(t)return void this._pendingSubscribers.splice(this._pendingSubscribers.indexOf(t),1);const i=this._subscribers.find((t=>t.key===e));if(i)return this._subscribers.splice(this._subscribers.indexOf(i),1),void(this._subscribers.length||(this._resetCacheTimeout=setTimeout((()=>{this._resetCacheTimeout=null,this._purgeCache(),this._unsubscribeRealtime()}),this._resetCacheTimePeriod)));console.warn("Unknown subscription symbol={0}, resolution={1}, key={2}".format(this._symbolInfo.name,this._resolution,e))}_logMessage(e,t){(a.enabled("charting_library_debug_mode")||t)&&console.log(`${this._logMessagePrefix()}${e}`)}_logMessagePrefix(){const e=this._symbolInfo.currency_code,t=this._symbolInfo.unit_id;return`FEED [${this._symbolInfo.name}|${this._resolution}${e?"|"+e:""}${t?"|"+t:""}]: `}_clearResetCacheTimeout(){null!==this._resetCacheTimeout&&(clearTimeout(this._resetCacheTimeout),this._resetCacheTimeout=null)}_purgeCache(){this._logMessage("Reset cache"),this._cache={bars:[]},this._errorMessage=null,this._leftDate=null,this._endOfData=!1,this._firstDataRequest=!0,this._updateDatesFromExpirationDate()}_updateDatesFromExpirationDate(){void 0!==this._symbolInfo.expiration_date&&(this._nextTime=1e3*this._symbolInfo.expiration_date,this._leftDate=1e3*(this._symbolInfo.expiration_date+1))}_dealignTime(e){return null===this._dwmAligner?e:this._dwmAligner.timeToExchangeTradingDay(e)}_normalizeRange(e){const t=void 0!==e.to?e.to:this._dealignTime(this._now());if(0===this._cache.bars.length||void 0!==e.to&&t<=(0,s.ensureNotNull)(this._leftDate))return{countBack:e.countBack,to:t};const i=null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(t):t,r=(0,n.lowerbound)(this._cache.bars,i,((e,t)=>e.time{e.onErrorCallback(t)}))}let t=this._normalizeRange(e[0].range);for(const i of e.map((e=>this._normalizeRange(e.range))))(i.tot.countBack)&&(t=i);this._logMessage(`Leftmost subscriber requires ${t.countBack} bars prior ${u(t.to)}`);!(null===this._leftDate||t.to{const t=this._moveSubscriberToRealtime(e);this._returnHistoryDataToSubscriber(e,t)})),this._subscribeRealtimeIfNeeded()):this._ensureRequestedTo(t)}_moveSubscriberToRealtime(e){const t={key:e.key,onHistoryCallback:e.onHistoryCallback,barset:null};return this._subscribers.push(t),t}_isSymbolExpired(){return this._symbolInfo.expired||void 0!==this._symbolInfo.expiration_date}_subscribeRealtimeIfNeeded(){!this._subscribers.length||this._realtimeOn||this._isSymbolExpired()||this._subscribeRealtime()}_subscribeRealtime(){if(this._symbolInfo.expired||this._realtimeOn)return;this._realtimeOn=!0,this._datafeed.subscribeBars(this._symbolInfo,this._resolution,(e=>{null!==this._dwmAligner&&(e.time=this._dwmAligner.timeToSessionStart(e.time)),this._putToCacheNewBar(e),this._subscribers.forEach((t=>{const i=t.barset;if(null===i)throw new Error("subscriber.barset is null");i.add(e),t.onHistoryCallback(i)}))}),d(this._symbolInfo,this._resolution),(()=>{this._unsubscribeRealtime();const e=this._leftDate;this._purgeCache(),null===e||a.enabled("request_only_visible_range_on_reset")||this._ensureRequestedTo({to:e,countBack:0})})),this._logMessage("Subscribed to realtime")}_unsubscribeRealtime(){!this._isSymbolExpired()&&this._realtimeOn&&(this._datafeed.unsubscribeBars(d(this._symbolInfo,this._resolution)),this._logMessage("Unsubscribed from realtime"),this._realtimeOn=!1)}_returnHistoryDataToSubscriber(e,t){const i=this._normalizeRange(e.range),s=this._createBarsetForRange(i);s.count()>0?this._logMessage("Bars to return for request {0}: total {1} bars in [{2} ... {3}] ".format(e.key,s.count(),u(s.bars[0].time),u(s.bars[s.count()-1].time))):this._logMessage("Request {0}. Nothing to return.".format(e.key)),t.barset=s,this._endOfData&&null!==this._leftDate&&i.to<=this._leftDate&&(s.endOfData=!0),e.onHistoryCallback(s)}_createBarsetForRange(e){const t=null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(e.to):e.to,i=(0,n.lowerbound)(this._cache.bars,t,((e,t)=>e.time{if(!this._destroyed)if(a)this._logMessage("getBars callback is already called before",!0);else{if(a=!0,e.length>0){const t=` [${u(e[0].time)} ... ${u(e[e.length-1].time)}]`;this._logMessage(`Receiving bars: total ${e.length} bars in ${t}, requested range: ${o}`)}else this._logMessage(`Receiving bars: barset is empty, requested range: ${o}`);this._requesting=!1,this._processBars(e,t)}}),(e=>{this._destroyed||(a?this._logMessage("getBars callback is already called before",!0):(a=!0,this._requesting=!1,this._errorMessage=e||null,this._processPendingSubscribers()))}))}_processBars(e,t){this._checkBars(e),this._alignBarsTime(e),e.length>0?(this._emptyResponsesCount=0,this._processFullBarset(e,t)):(this._emptyResponsesCount+=1,this._processEmptyBarset(t)),this._processPendingSubscribers()}_processEmptyBarset(e){e&&e.nextTime?(this._logMessage("Next time received: `{0}`".format(u(1e3*e.nextTime))),this._nextTime=1e3*e.nextTime):e&&e.noData?(this._logMessage("EOD received"),this._setEndOfData()):this._logMessage("nextTime or noData should present in metainfo when empty barset is returned"),50===this._emptyResponsesCount&&(this._logMessage("EOD detected due 50 empty responses in a row"),this._setEndOfData())}
_setEndOfData(){this._endOfData=!0,this._cache.bars.length&&(this._leftDate=this._dealignTime(this._cache.bars[0].time))}_processFullBarset(e,t){this._putToCache(e)?null!==this._leftDate&&0!==this._cache.bars.length&&(this._interval.isTicks()?this._leftDate=this._dealignTime(this._cache.bars[0].time):this._leftDate=Math.min(this._leftDate,this._dealignTime(this._cache.bars[0].time))):this._logMessage("Incremental update failed. Starting full update. Returned data should be in the requested range.",!0),t&&t.nextTime?console.warn(`${this._logMessagePrefix()}nextTime should be set when there is no data in the requested period only`):t&&t.noData&&console.warn(`${this._logMessagePrefix()}noData should be set when there is no data in the requested period and earlier only`)}_getNextSubscriptionId(){return this._nextSubscriptionId++}_checkBars(e,t=!1){if(a.enabled("charting_library_debug_mode"))for(let i=1;i"number"!=typeof e[i][t]||!isFinite(e[i][t])))&&console.error(`${this._logMessagePrefix()}Wrong bars values: all OHLC values should be numbers`)}}_putToCache(e){if(0===e.length)return!0;if(this._cache.bars.length===e.length&&this._cache.bars[0].time===e[0].time&&this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time)return this._logMessage("Time range of received data is the same as cached one. Skip the update."),!0;if(0!==this._cache.bars.length&&e[e.length-1].time===this._cache.bars[0].time&&this._cache.bars.splice(0,1),0!==this._cache.bars.length&&e[e.length-1].time>=this._cache.bars[0].time){const t=this._cache.bars[this._cache.bars.length-1].time===e[e.length-1].time;if(this._cache.bars=[],!t)return this._leftDate=null,!1;this._logMessage("Received history up to now instead of incremental update. Return exactly what is requested.")}return this._cache.bars=[...e,...this._cache.bars],this._checkBars(this._cache.bars,!0),!0}_putToCacheNewBar(e){const t=this._cache.bars.length,i=e.time,s=0===t?NaN:this._cache.bars[t-1].time;0===t||st.destroy())),this._threads={},delete this._datafeed}purgeCache(){this._forEachThread(((e,t)=>t.destroy())),this._threads={}}
subscribe(e,t,i,s,r){const n=d(e,t);this._threads[n]||(this._threads[n]=this._createThread(e,t));return n+'"'+this._threads[n].addSubscription(i,s,r)}unsubscribe(e){const t=e.split('"');if(2!==t.length)return void console.warn("Wrong guid format");const i=t[0],s=parseInt(t[1]);this._threads.hasOwnProperty(i)?this._threads[i].removeSubscription(s):console.warn("Data thread doesnt exist: "+e)}_createThread(e,t){return new p(this._datafeed,e,t,this._serverTimeOffsetGetter,(0,c.createDwmAligner)(t,e),this._resetCacheTimePeriod)}_forEachThread(e){Object.keys(this._threads).forEach((t=>e(t,this._threads[t])))}}},13041:(e,t,i)=>{"use strict";i.d(t,{barTimeToEndOfPeriod:()=>r,endOfPeriodToBarTime:()=>n});var s=i(60062);function r(e,t,i){if(i.isDays())return t;if(e.moveTo(1e3*t),i.isIntraday()){const i=e.indexOfBar(1e3*t);if(i<0)throw new Error(`${t} is out of the instrument session `);return e.endOfBar(i)/1e3}return e.startOfBar(s.SessionStage.LASTBAR_SESSION)/1e3}function n(e,t,i){if(i.isDays())return t;const s=1e3*t-1;if(e.moveTo(s),i.isIntraday()){const i=e.indexOfBar(s);if(i<0)throw new Error(`${t} is out of the instrument session `);return e.startOfBar(i)/1e3}return t=e.startOfBar(0)/1e3}},48739:(e,t,i)=>{"use strict";i.d(t,{replaceGraphicsTimesWithTimePointIndexIndex:()=>n});const s=new Map([["horizlines",e=>[e.startIndex,e.endIndex]],["hhists",e=>[e.firstBarTime,e.firstBarTime]],["vertlines",e=>[e.index]],["polygons",e=>e.points.map((e=>e.index))],["horizlines",e=>[e.startIndex,e.endIndex]],["hhists",e=>[e.firstBarTime,e.firstBarTime]],["vertlines",e=>[e.index]],["polygons",e=>e.points.map((e=>e.index))],["backgrounds",e=>[e.start,e.stop]]]),r=new Map([["horizlines",(e,t)=>{const i=e;i.startIndex=t.get(i.startIndex),i.endIndex=t.get(i.endIndex)}],["hhists",(e,t)=>{const i=e;i.firstBarTime=t.get(i.firstBarTime),i.lastBarTime=t.get(i.lastBarTime)}],["vertlines",(e,t)=>{const i=e;i.index=t.get(i.index)}],["polygons",(e,t)=>{const i=e;for(const e of i.points)e.index=t.get(e.index)}],["backgrounds",(e,t)=>{const i=e;i.start=t.get(i.start),i.stop=t.get(i.stop)}]]);function n(e){const t=e.data&&e.data.graphicsCmds&&e.data.graphicsCmds.create;if(!t)return[];const i=new Map,n=new Set;s.forEach(((e,s)=>{const r=t[s];if(r)for(const t of r)for(const s of t.data){const t=e(s);for(const e of t)i.set(e,-1),n.add(e)}}));const o=Array.from(n).sort(((e,t)=>e-t));return o.forEach(((e,t)=>i.set(e,t))),r.forEach(((e,s)=>{const r=t[s];if(r)for(const t of r)for(const s of t.data)e(s,i)})),o}},26665:(e,t,i)=>{"use strict";var s=i(14483);window.onload=function(){location.hostname.indexOf(".")>=0&&!function(){try{return/^(192|172|10)\.[0-9][0-9][0-9]\.[0-9][0-9][0-9]\.[0-9][0-9][0-9]/.test(location.hostname)||/^.*((?:\.local)|localhost)$/.test(location.hostname)}catch(e){return!1}}()&&setTimeout((function(){try{var e=function(){var e=0;return JSON.parse(urlParams.logo).image&&(e="C",s.enabled("link_to_tradingview")||(e="D")),e}();window.ga&&(0!==e&&window.ga("send","event","s",e),urlParams.utm||window.ga("send","event","l"))}catch(e){}}),3e4)}
},3035:(e,t,i)=>{"use strict";var s,r=i(60156),n={};e.exports=function(e,t,i){var o,a,l,c,h={},d=n[i]||"out_of_session",u=!1,p=i,_=t,m=null,g=null;function f(){var e={};e.symbolname=p,e.status="ok",e.values={},e.values.current_session=d,n[p]=d,TradingView.ChartapiMessagerInstances[_].onQuotesData([_].concat([e]))}function v(){if(o)if(c)d="out_of_session";else{var e=(new Date).getTime(),t=r.isTradingNow(e,o)?"market":"out_of_session";a&&r.isTradingNow(e,a)?t="pre_market":l&&r.isTradingNow(e,l)&&(t="post_market"),t!==d&&(d=t)}}return e(i,null,(function(e){u||function(e){o=new r.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),c=e.expired,e.subsession_id&&e.subsessions?e.subsessions.forEach((t=>{switch(t.id){case"premarket":a=new r.SessionInfo(e.timezone,t.session,e.session_holidays,e["session-premarket-correction"]||e.corrections);break;case"postmarket":l=new r.SessionInfo(e.timezone,t.session,e.session_holidays,e["session-postmarket-correction"]||e.corrections)}})):(a=void 0,l=void 0);const t=60-new Date(Date.now()).getSeconds();s&&s?.ticker===e.ticker||(s={ticker:e.ticker,timer:t},clearTimeout(s.timeout)),g=setTimeout((()=>{m=setInterval((()=>{v(),f()}),6e4),v(),f()}),1e3*s.timer),s&&void 0!==s?.timeout||(s.timeout=g),v(),f()}(e)}),(function(){})),h.stop=function(){u=!0,m&&clearInterval(m),g&&clearInterval(g)},h.marketStatus=function(){return d},h}},36454:(e,t,i)=>{"use strict";i.d(t,{getChartStyleStudy:()=>n});var s=i(81337);class r{main(e){const t=e.new_var(s.Std.open(e)),i=e.new_var(s.Std.close(e)),r=t.get(1),n=i.get(1),o=s.Std.ohlc4(e),a=s.Std.na(t.get(1))?(s.Std.open(e)+s.Std.close(e))/2:(r+n)/2;t.set(a),i.set(o);const l=s.Std.max(s.Std.high(e),s.Std.max(a,o)),c=s.Std.min(s.Std.low(e),s.Std.min(a,o)),h=s.Std.volume(e),d=e.symbol;return[d.time,a,l,c,o,h,d.updatetime,d.isBarClosed]}}function n(e){if(0===e.type.indexOf("BarSetHeikenAshi@tv-basicstudies-"))return new r;const t=`unknown builder type: ${e.type}`;throw console.error(t),new Error(t)}},61476:(e,t,i)=>{"use strict";var s=i(36274).Interval,r=i(77475).isAlignmentEnabled,n=i(36454).getChartStyleStudy,o=i(27856).decodeExtendedSymbol,a=i(47609).findSuitableResolutionToBuildFrom,l=i(66846).SubsessionId,c=function(){var e=i(74649),t=e.StudyEngine,c=e.BarBuilder,h=e.BarSet;function d(e){this.host=e,this.cache={}}function u(t){console.error(t),e.Std.error(t)}d.prototype.getCache=function(e){return this.cache[e]},d.prototype.putCache=function(e,t){this.cache[e]=t},d.prototype.subscribe=function(e,t,i,s,r,n,o,a,l,c,h){var d=l(o),u=function(e,t,i,s,r,n,o,a,l){var c=r.has_empty_bars?"_":"";return n+e+s+(t||"")+(i||"")+(l||"")+c+"_"+o.countBack+"_"+o.to+"_"+Boolean(a)}(e,t,i,s,o,a,d,c,h),p=this.getCache(u);return p||(p=this.createItem(e,t,i,s,o,d,a,c,h),this.putCache(u,p)),p.listeners.addListener(r,n),{key:u,listener:r}},d.prototype.unsubscribe=function(e){var t=this.getCache(e.key);t&&t.listeners.removeListener(e.listener)},d.prototype.removeUnused=function(){var e=[];for(var t in this.cache){
if(this.cache[t])0===this.cache[t].listeners.listenersCount()&&e.push(t)}if(0!==e.length){for(var i=0;i{"use strict";i.d(t,{findSuitableResolutionToBuildFrom:()=>o});var s=i(36274);function r(e,t){const i=t.multiplier();for(let s=e.length-1;s>=0;s--){const r=Number(e[s]);if(i%r==0)return{error:!1,resolution:`${r}${t.letter()}`}}return{error:!0,errorMessage:n(t.value())}}function n(e){return`Misconfiguration error: it is trying to request ${e} but we cannot build it from lower resolution`}function o(e,t){const i=s.Interval.parse(e);if((i.isWeeks()||i.isMonths())&&t.has_weekly_and_monthly){let e=["1"];i.isWeeks()&&void 0!==t.weekly_multipliers&&(e=t.weekly_multipliers),i.isMonths()&&void 0!==t.monthly_multipliers&&(e=t.monthly_multipliers);const s=r(e,i);if(!s.error)return s}if(i.isDWM()&&(void 0===t.has_daily||t.has_daily))return i.isDays()&&void 0!==t.daily_multipliers?r(t.daily_multipliers,i):void 0===t.daily_multipliers||t.daily_multipliers.includes("1")?{error:!1,resolution:"1D"}:{error:!0,errorMessage:"Misconfiguration error: it is trying to request a resolution but symbol does not support it"};if(i.isDWM())return{error:!0,errorMessage:n(i.value())};if(i.isMinutes()&&!t.has_intraday)return{error:!0,errorMessage:"Misconfiguration error: it is trying to request intraday resolution but symbol does not support it"};if(i.isSeconds()&&!t.has_seconds)return{error:!0,errorMessage:"Misconfiguration error: it is trying to request seconds resolution but symbol does not support it"};if(i.isTicks())return!t["is-tickbars-available"]||i.multiplier()>1?{error:!0,
errorMessage:`Misconfiguration error: it is trying to request ${i.multiplier()} ticks resolution but symbol does not support it`}:{error:!1,resolution:"1T"};const o=i.isSeconds()?t.seconds_multipliers:t.intraday_multipliers;return void 0===o?{error:!1,resolution:i.value()}:r(o,i)}},74649:(e,t,i)=>{"use strict";var s,r=i(36274).Interval,n=i(77475).createDwmAligner,o=i(77475).createTimeToBarTimeAligner,a=i(81337).Std,l=i(37040).Series,c=i(97651).Script,h=i(15294).SymbolInstrument,d=i(60156),u=i(94421).extrapolateBarsFrontToTime;class p{constructor(e){this.symbols=[],this.barsets=[],this.subscription=[],this.host=e,this.isRecalculated=!1,this.isStarted=!1,this.start()}add_sym(e,t,i,s,r,n,o){var a=new h(e,t,i,s,r,n,o);return this.symbols.push(a),a}get_sym(e){return this.symbols[e]}out(e,t){if(this.nonseriesUpdate){var i=Object.assign({},this.nonseriesUpdate);t.splice(0,0,e.time),i.lastBar=t,this.host.nonseriesOut(e,i)}else this.host.out(e,t)}start(){this.isStarted=!0;var e=this.host;this._script=new c(e.tickerid,e.period,e.currencyCode,e.unitId,this,e.body,this.out.bind(this),e.input,e.nonseriesOut,e.symbolInfo,e.subsessionId);var t=this,i=[],s=this.symbols,a=Object.assign({},e.dataRange,{countBack:e.dataRange.countBack+t._script.maxAdditionalDepth()}),l=s[0];function h(t,s,r){i.push(p.feed.subscribe(t.tickerid,t.currencyCode,t.unitId,t.period,r,e.onErrorCallback,e.symbolInfo,e.sessionId,s,e.forceAlignBars,t.subsessionId))}function d(i,s){"series"===(s.nonseries?"nonseries":"series")?t.update(i,s):s.lastBar?(t.nonseriesUpdate=s,s.lastBar.isLastBar=!0,t.symbols[0].lastbar(s.lastBar),t.nonseriesUpdate=null):e.nonseriesOut(m,s)}function u(){return a}h(l,u,(function(e){!e.nonseries&&Number.isFinite(e.firstLoadedTimeMs)&&function(e){function i(i,s){var r=o(i,s)(e),a=n(i,s);return null!==a&&(r=a.timeToExchangeTradingDay(r)),{to:r,countBack:t._script.maxAdditionalDepth()}}for(var a=1;a=0;i--)for(var s=e[i],r=this.barsets[i],n=r.count(),o=0;oe.endOfData));l&&this.host.setNoMoreData(),
this.host.recalc(this,{endOfData:l,firstLoadedTimeMs:this.barsets[0].firstLoadedTimeMs,emptyBarCount:this.barsets[0].emptyBarCount()})}catch(e){if(!e.studyError)throw e;this.host.onErrorCallback(e.message)}}}p.feed={subscribe:function(e,t,i,s,r){console.error("must be initialized with setupFeed")},unsubscribe:function(e){console.error("must be initialized with setupFeed")}};e.exports.Std=a,e.exports.Series=l,e.exports.Symbol=h,e.exports.StudyEngine=class{constructor(e){this.runner=new p(e)}stop(){this.runner.stop()}isStarted(){return this.runner.isStarted}},e.exports.BarSet=class{constructor(e,t){this.info=e,this.bars=t||[],this.isBarClosed=!0,this.firstLoadedTimeMs=0!==this.bars.length?this.bars[0].time:1/0,this._emptyBarCount=0,this._lastBarIsEmpty=!1}symbolinfo(){return this.info}isLastBarClosed(){return this.isBarClosed}setLastBarClosed(e){this.isBarClosed=e}bar(e){return this.bars[e]}count(){return this.bars.length}emptyBarCount(){return this._emptyBarCount}add(e,t,i){void 0===i&&(i=!1);var s=e,r=this.bars,n=r.length,o=s.time,a=0===n?NaN:r[n-1].time;0===n||a{"use strict";i.d(t,{Script:()=>o});var s=i(37040),r=i(81337);class n{constructor(e){this.minimumAdditionalDepth=null,this._vars=[],this._varsIndex=0,this._ctx=[],this._ctxIndex=0,this.symbol=e}new_sym(e,t,i,s,r){return this.symbol.script.add_sym(e,t,i,s,r)}select_sym(e){const t=this.symbol.script.get_sym(e)
;null==t&&r.Std.error(`Attempted to select symbol at index ${e} but there is no such symbol`),this.symbol=t}is_main_symbol(e){return void 0!==e&&e===this.symbol.script.get_sym(0)}new_var(e){const t=this._vars;t.length<=this._varsIndex&&t.push(new s.Series(this.symbol));const i=t[this._varsIndex++];return arguments.length>0&&void 0!==e&&i.set(e),i}new_unlimited_var(e){const t=this._vars;t.length<=this._varsIndex&&t.push(new s.UnlimitedSeries(this.symbol));const i=t[this._varsIndex++];return arguments.length>0&&i.set(e),i}new_ctx(){return this._ctx.length<=this._ctxIndex&&this._ctx.push(new n(this.symbol)),this._ctx[this._ctxIndex++]}prepare(e){this._ctxIndex=0,this._varsIndex=0;for(let t=0;te&&(e=i)}return e}stop(){this.symbol=null,this._vars=null}setMinimumAdditionalDepth(e){this.minimumAdditionalDepth=e}}class o{constructor(e,t,i,s,r,o,a,l,c,h,d){this._body=o,this._symbols=[],this._runner=r,this._inputCallback=l,this._out=a,this._nonseriesOut=c,this._ctx=new n(this.add_sym(e,t,i,s,h,d)),this.init()}calc(e){const t=this._ctx,i=this._body;t.prepare(e);const s=i.main(t,this._inputCallback,e);if(s&&"composite"===s.type)for(let e=0;e1&&this._runner.host.enableDwmAligning&&o.enable_dwm_aligning(this._symbols[0].session,o.session),o}maxAdditionalDepth(){return this._symbols[0].isAdditionalDepthAllowed?this._ctx.maxAdditionalDepth():0}stop(){var e;this._symbols=null,null===(e=this._ctx)||void 0===e||e.stop(),this._ctx=null}get_sym(e){return this._symbols[e]}_processResult(e){const t=this._ctx;this._out&&e&&(!isNaN(t.symbol.time)||e.nonseries)&&(e.nonseries?("projection"===e.type&&(e.projectionTime=t.symbol.time),this._nonseriesOut(t.symbol,e)):e.bars?e.bars.forEach((e=>{this._out(t.symbol,e)})):this._out(t.symbol,e))}}},37040:(e,t,i)=>{"use strict";i.d(t,{Series:()=>n,UnlimitedSeries:()=>o});var s=i(78071),r=i(81337);class n{constructor(e){this.mindepth=0,this.original=NaN,this.modified=!1,this._hist=null,this._histPos=0,this.symbol=e}valueOf(){return this.get(0)}get(e){return isNaN(e)&&(e=0),e=e||0,this._hist?e>=this._hist.length?(console.error("not enough depth: "+this),NaN):this._get(e):(this.mindepth=r.Std.max(this.mindepth,e),NaN)}set(e){this._hist&&(this._hist[this._histPos]=e,this.modified=!0)}prepare(e){e===this.symbol&&(e.isNewBar?(this.original=this.get(0),!this.modified&&this._hist||this.add_hist()):this.set(this.original),this.modified=!1)}add_hist(){if(!this._hist){
let e=r.Std.na(this.mindepth)?r.Std.max_series_default_size:r.Std.max(this.mindepth+1,1);e=Math.round(e);const t=new Array(e);for(let i=0;i{"use strict";const s=i(14483),r=i(33013).getHexColorByName;var n=i(74649);i(24172);var o=i(82808).pivotPointsStandardStudyItem,a=i(72365).volumeProfileVisibleRangeStudyItem,l=i(82597).volumeProfileFixedRangeVbPStudyItem,c=i(82597).volumeProfileFixedRangeBSStudyItem,h=i(39944).spreadStudyItem,d=i(81821).ratioStudyItem,u=i(65097).regressionTrendStudyItem,p=i(53130).anchoredVWAPStudyItem;const _=r("color-ripe-red-400"),m=r("color-minty-green-400"),g=s.enabled("secondary_series_extend_time_scale");JSServer.studyLibrary=JSServer.studyLibrary.concat([{name:"Compare",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!0,defaults:{styles:{compare:{linestyle:0,linewidth:2,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#9C27B0"}},inputs:{source:"close",symbol:""}},plots:[{id:"compare",type:"line"}],styles:{compare:{title:"Plot",histogramBase:0}},description:"Compare",shortDescription:"Compare",is_price_study:!0,inputs:[{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"text"},{id:"symbol",name:"Symbol",type:"symbol",isHidden:!0}],id:"Compare@tv-basicstudies-1",format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._context.new_sym(t(1),n.Std.period(this._context))},this.main=function(e,t){this._context=e;var i=this._context.new_unlimited_var(this._context.symbol.time);this._context.select_sym(1);var s=this._context.new_unlimited_var(this._context.symbol.time),r=n.Std[t(0)](this._context),o=this._context.new_unlimited_var(r);return this._context.select_sym(0),[o.adopt(s,i,0)]}}},{name:"Overlay",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!0,defaults:{styles:{},inputs:{symbol:"",extendTimeScale:!1}},plots:[{id:"open",type:"line"},{id:"high",type:"line"},{
id:"low",type:"line"},{id:"close",type:"line"}],styles:{open:{title:"Open"},high:{title:"High"},low:{title:"Low"},close:{title:"Close"}},description:"Overlay",shortDescription:"Overlay",is_price_study:!1,inputs:[{id:"symbol",name:"symbol",defval:"",type:"symbol",isHidden:!0},{id:"extendTimeScale",name:"extendTimeScale",defval:!1,type:"boolean",isHidden:!0}],id:"Overlay@tv-basicstudies-1",format:{type:"price",precision:4},canExtendTimeScale:!0},constructor:function(){this.init=function(e,t){this._context=e,this._context.new_sym(t(0),n.Std.period(this._context))},this.main=function(e,t){this._context=e;var i=!g||!0!==t(1),s=this._context.new_unlimited_var(this._context.symbol.time);this._context.select_sym(1);var r=this._context.new_unlimited_var(this._context.symbol.time),o=this._context.new_unlimited_var(n.Std.open(this._context)),a=this._context.new_unlimited_var(n.Std.high(this._context)),l=this._context.new_unlimited_var(n.Std.low(this._context)),c=this._context.new_unlimited_var(n.Std.close(this._context));return i?(this._context.select_sym(0),[o.adopt(r,s,1),a.adopt(r,s,1),l.adopt(r,s,1),c.adopt(r,s,1)]):[o.get(0),a.get(0),l.get(0),c.get(0)]}}},{name:"Volume",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{vol:{linestyle:0,linewidth:1,plottype:5,trackPrice:!1,transparency:50,visible:!0,color:"#000080"},vol_ma:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1,color:"#2196F3"}},palettes:{volumePalette:{colors:{0:{color:_,width:1,style:0},1:{color:m,width:1,style:0}}}},inputs:{showMA:!1,length:20,col_prev_close:!1,symbol:"",smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"vol",type:"line"},{id:"volumePalette",palette:"volumePalette",target:"vol",type:"colorer"},{id:"vol_ma",type:"line"},{id:"smoothedMA",type:"line"}],styles:{vol:{title:"Volume",histogramBase:0},vol_ma:{title:"Volume MA",histogramBase:0},smoothedMA:{title:"Smoothed MA",histogramBase:0}},description:"Volume",shortDescription:"Volume",is_price_study:!1,palettes:{volumePalette:{colors:{0:{name:"Falling"},1:{name:"Growing"}}}},inputs:[{id:"symbol",name:"Other Symbol",defval:"",type:"symbol",optional:!0,isHidden:!1},{id:"showMA",name:"show MA",defval:!1,type:"bool",isHidden:!0},{id:"length",name:"MA Length",defval:20,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["vol_ma"]},{defval:!1,id:"col_prev_close",name:"Color based on previous close",type:"bool"},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"Volume@tv-basicstudies-1",format:{type:"volume"}},constructor:function(){this.init=function(e,t){this._context=e,""!==t(0)&&this._context.new_sym(t(0),n.Std.period(this._context))},this.f_0=function(e,t){return n.Std.gt(e,t)?0:1},this.main=function(e,t){this._context=e,
this._input=t;var i=n.Std.volume(this._context),s=n.Std.open(this._context),r=n.Std.close(this._context),o=this._context.new_var(this._context.symbol.time),a=this._input(4),l=this._input(5);if(this._context.setMinimumAdditionalDepth(this._input(2)+l),""!==this._input(0)){this._context.select_sym(1);var c=this._context.new_var(this._context.symbol.time),h=this._context.new_var(n.Std.volume(this._context)),d=this._context.new_var(n.Std.open(this._context)),u=this._context.new_var(n.Std.close(this._context));i=h.adopt(c,o,1),s=d.adopt(c,o,1),r=u.adopt(c,o,1),this._context.select_sym(0)}var p,_,m=this._context.new_var(i),g=n.Std.sma(m,this._input(2),this._context),f=this._context.new_var(g),v=this._context.new_var(r);return p=v.get(1)&&this._input(3)?this.f_0(v.get(1),r):this.f_0(s,r),"EMA"===a?_=n.Std.ema(f,l,this._context):"WMA"===a?_=n.Std.wma(f,l,this._context):"SMA"===a&&(_=n.Std.sma(f,l,this._context)),[i,p,g,_]}}},{name:"ZigZag",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:2,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:5,in_1:10}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",target:"plot_0",type:"dataoffset"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Zig Zag",shortDescription:"ZigZag",is_price_study:!0,classId:"ScriptWithDataOffset",inputs:[{id:"in_0",name:"deviation",defval:5,type:"float",min:.001,max:100},{id:"in_1",name:"depth",defval:10,type:"integer",min:2,max:1e3}],id:"ZigZag@tv-basicstudies-1",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),r=i/100,o=Math.ceil(s/2);return[n.Std.zigzag(r,o,this._context),n.Std.zigzagbars(r,o,this._context)]}}},{name:"Sessions",metainfo:{_metainfoVersion:52,defaults:{graphics:{vertlines:{sessBreaks:{color:"#4985e7",style:2,visible:!1,width:1}},backgrounds:{preMarket:{color:"#FF9800",transparency:92,visible:!0},postMarket:{color:"#2196F3",transparency:92,visible:!0}}},linkedToSeries:!0},description:"Sessions",graphics:{vertlines:{sessBreaks:{name:"Session Break",halign:"left"}},backgrounds:{preMarket:{name:"Pre market"},postMarket:{name:"Post market"}}},id:"Sessions@tv-basicstudies-1",inputs:[],is_hidden_study:!0,is_price_study:!0,name:"Sessions@tv-basicstudies",palettes:{},plots:[],shortDescription:"Sessions",format:{type:"inherit"}},constructor:function(){function e(e,t){return{id:e,index:e,extendBottom:!0,extendTop:!0}}function t(e){return{id:e.start,start:e.start,stop:e.stop}}this.init=function(){this._times=[]},this._getVerticalLineData=function(t){return n.Std.selectSessionBreaks(t,this._times).map(e)},this._getPreAndPostMarketBackgroundsData=function(e){const i=n.Std.selectPreAndPostMarketTimes(e,this._times);return{preMarket:i.preMarket.map(t),postMarket:i.postMarket.map(t)}},this.main=function(e,t){if(n.Std.isdwm(e))return null;var i=n.Std.time(e);if(isNaN(i))return null;var s=this._times.length
;if(0!==s&&this._times[s-1]===i||this._times.push(i),!e.symbol.isLastBar||!e.symbol.isNewBar)return null;var r=this._getVerticalLineData(e),o=this._getPreAndPostMarketBackgroundsData(e);return 0===r.length&&0===o.preMarket.length&&0===o.postMarket?null:{nonseries:!0,type:"study_graphics",data:{graphicsCmds:{create:{vertlines:[{styleId:"sessBreaks",data:r}],backgrounds:[{styleId:"preMarket",data:o.preMarket},{styleId:"postMarket",data:o.postMarket}]},erase:[{action:"all"}]}}}}}},{name:"SuperTrend",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:3,plottype:0,trackPrice:!1,transparency:35,visible:!0,color:"#000080"},plot_2:{linestyle:0,linewidth:3,plottype:"shape_arrow_up",trackPrice:!1,location:"BelowBar",transparency:35,visible:!0,color:"#00FF00"},plot_3:{linestyle:0,linewidth:3,plottype:"shape_arrow_down",trackPrice:!1,location:"AboveBar",transparency:35,visible:!0,color:"#FF0000"}},palettes:{palette_0:{colors:{0:{color:"#008000",width:3,style:0},1:{color:"#800000",width:3,style:0}}}},inputs:{in_0:10,in_1:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"},{id:"plot_2",type:"shapes"},{id:"plot_3",type:"shapes"}],styles:{plot_0:{title:"SuperTrend",histogramBase:0,joinPoints:!1,isHidden:!1},plot_2:{title:"Up Arrow",histogramBase:0,joinPoints:!1,isHidden:!1},plot_3:{title:"Down Arrow",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"SuperTrend",shortDescription:"SuperTrend",is_price_study:!0,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}},valToIndex:{0:0,1:1}}},inputs:[{id:"in_0",name:"Length",defval:10,type:"integer",min:1,max:100},{id:"in_1",name:"Factor",defval:3,type:"float",min:1,max:100}],id:"SuperTrend@tv-basicstudies-1",scriptIdPart:"",name:"SuperTrend",isCustomIndicator:!0,format:{type:"inherit"}},constructor:function(){this.main=function(e,t){var i=t(0),s=t(1),[r,o]=n.Std.supertrend(s,i,e),a=e.new_var(o).get(1);return[r,-1===o?0:1,-1===o&&a!==o?1:NaN,1===o&&a!==o?1:NaN]}}},o,a,l,c,h,d,u,p])},81337:(e,t,i)=>{"use strict";i.d(t,{Std:()=>h});var s=i(60156),r=i(41249);class n{constructor(e,t,i){var s,r;this._timezone=e,this._preMarketSessionEntries=null!==(s=null==t?void 0:t.entries())&&void 0!==s?s:[],this._postMarketSessionEntries=null!==(r=null==i?void 0:i.entries())&&void 0!==r?r:[]}getPreAndPostMarketTimes(e){if(0===e.length)return{preMarket:[],postMarket:[]};const t=[],i=[];let s=null,n=null,o=e[0],a=(0,r.utc_to_cal)(this._timezone,o);this._isInPreMarketSession(a)&&(n=o),this._isInPostMarketSession(a)&&(s=o);for(let l=1;le?1:0,h={};function d(e,t,i,s,r){let n=r,o=0;if(isNaN(e.get(t-1)))return{index:NaN,value:NaN};for(let i=0;ie.symbol.index+1,h.nz=(e,t=0)=>isFinite(e)?e:t,h.na=function(e){return 0===arguments.length?NaN:isNaN(e)?1:0},h.isZero=e=>Math.abs(e)<=1e-10?1:0,h.toBool=e=>isFinite(e)&&!h.isZero(e),h.eq=(e,t)=>h.isZero(e-t),h.neq=(e,t)=>c(!h.eq(e,t)),h.ge=(e,t)=>c(h.isZero(e-t)||e>t),h.gt=(e,t)=>c(!h.isZero(e-t)&&e>t),h.lt=(e,t)=>c(!h.isZero(e-t)&&ec(h.isZero(e-t)||eisNaN(e)||isNaN(t)?NaN:h.isZero(e)||h.isZero(t)?0:1,h.or=(e,t)=>isNaN(e)||isNaN(t)?NaN:h.isZero(e)&&h.isZero(t)?0:1,h.not=e=>isNaN(e)?NaN:h.isZero(e)?1:0,h.eps=()=>l,h.greaterOrEqual=(e,t,i)=>t-e<(i||l),h.lessOrEqual=(e,t,i)=>e-t<(i||l),h.equal=(e,t,i)=>Math.abs(e-t)<(i||l),h.greater=(e,t,i)=>e-t>(i||l),h.less=(e,t,i)=>t-e>(i||l),h.compare=(e,t,i)=>h.equal(e,t,i)?0:h.greater(e,t,i)?1:-1,h.max=Math.max,h.min=Math.min,h.pow=Math.pow,h.abs=Math.abs,h.log=Math.log,h.log10=e=>Math.log(e)/Math.LN10,h.sqrt=Math.sqrt,h.sign=e=>isNaN(e)?NaN:h.isZero(e)?0:e>0?1:-1,h.exp=Math.exp,h.sin=Math.sin,h.cos=Math.cos,h.tan=Math.tan,h.asin=Math.asin,h.acos=Math.acos,h.atan=Math.atan,h.floor=Math.floor,h.ceil=Math.ceil,h.round=Math.round,h.avg=(...e)=>{if(2===e.length)return(e[0]+e[1])/2;let t=0;for(let i=0;ie.symbol.open,h.high=e=>e.symbol.high,h.low=e=>e.symbol.low,h.close=e=>e.symbol.close,h.hl2=e=>(e.symbol.high+e.symbol.low)/2,h.hlc3=e=>(e.symbol.high+e.symbol.low+e.symbol.close)/3,h.ohlc4=e=>(e.symbol.open+e.symbol.high+e.symbol.low+e.symbol.close)/4,h.volume=e=>e.symbol.volume,h.updatetime=e=>e.symbol.updatetime,h.time=e=>e.symbol.bartime(),h.period=e=>e.symbol.period,h.tickerid=e=>e.symbol.tickerid,h.currencyCode=e=>e.symbol.currencyCode,h.unitId=e=>e.symbol.unitId,h.ticker=e=>e.symbol.ticker,h.interval=e=>e.symbol.interval,h.isdwm=e=>e.symbol.isdwm(),h.isintraday=e=>!e.symbol.isdwm(),h.isdaily=e=>"D"===e.symbol.resolution,h.isweekly=e=>"W"===e.symbol.resolution,h.ismonthly=e=>"M"===e.symbol.resolution,h.year=(e,t)=>h.timepart(e.symbol,r.YEAR,t),h.month=(e,t)=>h.timepart(e.symbol,r.MONTH,t),h.weekofyear=(e,t)=>h.timepart(e.symbol,r.WEEK_OF_YEAR,t),h.dayofmonth=(e,t)=>h.timepart(e.symbol,r.DAY_OF_MONTH,t),h.dayofweek=(e,t)=>h.timepart(e.symbol,r.DAY_OF_WEEK,t),h.hour=(e,t)=>h.timepart(e.symbol,r.HOUR_OF_DAY,t),h.minute=(e,t)=>h.timepart(e.symbol,r.MINUTE,t),h.second=(e,t)=>h.timepart(e.symbol,r.SECOND,t),
h.add_days_considering_dst=(e,t,i)=>r.add_days_considering_dst(r.get_timezone(e),t,i),h.add_years_considering_dst=(e,t,i)=>r.add_years_considering_dst(r.get_timezone(e),t,i),h.selectSessionBreaks=(e,t)=>{if(h.isdwm(e)||void 0===e.symbol.session.timezone)return[];const i=(0,s.newBarBuilder)(e.symbol.period,e.symbol.session,null),r=[],n=t.length;if(i.moveTo(t[n-1]),1===n&&i.startOfBar(0)===t[0])r.push(t[0]);else{for(let e=n-2;e>=0;--e){const s=t[e];if(s>=i.startOfBar(0))continue;i.moveTo(s);const n=t[e+1];r.push(n)}r.reverse()}return r},h.selectPreAndPostMarketTimes=(e,t)=>{var i,s;if(h.isdwm(e)||void 0===e.symbol.session.timezone)return{preMarket:[],postMarket:[]};return new n(e.symbol.session.timezone,null!==(i=e.symbol.preMarketSubsession)&&void 0!==i?i:null,null!==(s=e.symbol.postMarketSubsession)&&void 0!==s?s:null).getPreAndPostMarketTimes(t)},h.iff=(e,t,i)=>h.not(e)?i:t,h.rising=(e,t)=>{for(let i=1;ie.get(0))return 0;return 1},h.falling=(e,t)=>{for(let i=1;i{const s=r.utc_to_cal(e.session.timezone,i||e.bartime());return r.get_part(s,t)},h.rsi=(e,t)=>h.isZero(t)?100:h.isZero(e)?0:100-100/(1+e/t),h.sum=(e,t,i)=>{const s=i.new_var(),r=h.nz(e.get())+h.nz(s.get(1))-h.nz(e.get(t));return s.set(r),r},h.sma=(e,t,i)=>{const s=h.sum(e,t,i);return h.na(e.get(t-1))?NaN:s/t},h.smma=(e,t,i)=>{const s=i.new_var(e),r=h.sma(s,t,i),n=i.new_var(),o=(n.get(1)*(t-1)+e)/t;return n.set(h.na(n.get(1))?r:o),n.get(0)},h.rma=(e,t,i)=>{const s=h.sum(e,t,i),r=t-1,n=e.get(r),o=i.new_var(),a=o.get(1),l=e.get(),c=h.na(n)?NaN:h.na(a)?s/t:(l+a*r)/t;return o.set(c),c},h.fixnan=(e,t)=>{const i=t.new_var();return isNaN(e)?i.get(1):(i.set(e),e)},h.tr=(e,t)=>{let i=t.new_var(h.close(t)).get(1);return e&&isNaN(i)&&(i=h.close(t)),h.max(h.max(h.high(t)-h.low(t),h.abs(h.high(t)-i)),h.abs(h.low(t)-i))},h.atr=(e,t)=>{const i=t.new_var(h.tr(void 0,t));return h.rma(i,e,t)},h.ema=(e,t,i)=>{const s=h.sum(e,t,i),r=i.new_var(),n=e.get(0),o=e.get(t-1),a=r.get(1),l=h.na(o)?NaN:h.na(a)?s/t:2*(n-a)/(t+1)+a;return r.set(l),l},h.wma=(e,t,i)=>{let s=0;for(let i=t=Math.round(t);i>=0;i--){s+=(t-i)*e.get(i)}return 2*s/(t*(t+1))},h.vwma=(e,t,i)=>{const s=i.new_var(h.volume(i)),r=i.new_var(e.get(0)*h.volume(i));return h.sma(r,t,i)/h.sma(s,t,i)},h.swma=(e,t)=>(e.get(0)+2*e.get(1)+2*e.get(2)+e.get(3))/6,h.supertrend=(e,t,i)=>{const s=h.atr(t,i),r=i.new_var(s).get(1),n=h.hl2(i);let o=n+s*e,a=n-s*e;const l=h.close(i),c=i.new_var(l).get(1),d=i.new_var(),u=h.nz(d.get(1)),p=i.new_var(),_=h.nz(p.get(1));a=h.gt(a,u)||h.lt(c,u)?a:u,d.set(a),o=h.lt(o,_)||h.gt(c,_)?o:_,p.set(o);let m=h.na();const g=i.new_var(),f=g.get(1);m=h.na(r)?1:f===_?l>o?-1:1:l-d(e,t,0,((e,t)=>h.lt(e,t)),Number.MAX_VALUE).index,h.lowest=(e,t,i)=>d(e,t,0,((e,t)=>h.lt(e,t)),Number.MAX_VALUE).value,h.highestbars=(e,t,i)=>-d(e,t,0,((e,t)=>h.gt(e,t)),Number.MIN_VALUE).index,
h.highest=(e,t,i)=>d(e,t,0,((e,t)=>h.gt(e,t)),Number.MIN_VALUE).value,h.cum=(e,t)=>{const i=t.new_var(),s=h.nz(i.get(1))+e;return i.set(s),s},h.accdist=e=>{const t=h.high(e),i=h.low(e),s=h.close(e),r=h.volume(e);return h.cum(s===t&&s===i||t===i?0:r*(2*s-i-t)/(t-i),e)},h.correlation=(e,t,i,s)=>{const r=h.sma(e,i,s),n=h.sma(t,i,s),o=s.new_var(e.get()*t.get());return(h.sma(o,i,s)-r*n)/Math.sqrt(h.variance2(e,r,i)*h.variance2(t,n,i))},h.stoch=(e,t,i,s,r)=>{const n=h.highest(t,s,r),o=h.lowest(i,s,r);return h.fixnan(100*(e.get()-o)/(n-o),r)},h.tsi=(e,t,i,s)=>{const r=s.new_var(h.change(e)),n=s.new_var(h.abs(h.change(e))),o=s.new_var(h.ema(r,i,s)),a=s.new_var(h.ema(n,i,s));return h.ema(o,t,s)/h.ema(a,t,s)},h.cross=(e,t,i)=>{if(isNaN(e)||isNaN(t))return!1;const s=i.new_var((r=e-t)<0?-1:0===r?0:1);var r;return!isNaN(s.get(1))&&s.get(1)!==s.get()},h.linreg=(e,t,i)=>{let s=0,r=0,n=0,o=0;for(let i=0;i{const r=s.new_var(),n=s.new_var(),o=s.new_var(),a=h.high(s),l=h.low(s),c=h.close(s),d=s.new_var(a),u=s.new_var(l),p=s.new_var(c),_=s.new_var();let m=_.get(1),g=n.get(1),f=o.get(1);n.set(g),o.set(f);let v=!1;const S=u.get(1),y=u.get(2),b=d.get(1),w=d.get(2),C=p.get(),P=p.get(1);2===h.n(s)&&(h.greater(C,P)?(r.set(1),o.set(d.get()),m=S,f=d.get()):(r.set(-1),o.set(u.get()),m=b,f=u.get()),v=!0,n.set(e),g=e);let x=m+g*(f-m);return 1===r.get()?h.greater(x,u.get())&&(v=!0,r.set(-1),x=Math.max(d.get(),o.get()),o.set(u.get()),n.set(e)):h.less(x,d.get())&&(v=!0,r.set(1),x=Math.min(u.get(),o.get()),o.set(d.get()),n.set(e)),v||(1===r.get()?h.greater(d.get(),o.get())&&(o.set(d.get()),n.set(Math.min(n.get()+t,i))):h.less(u.get(),o.get())&&(o.set(u.get()),n.set(Math.min(n.get()+t,i)))),1===r.get()?(x=Math.min(x,S),h.n(s)>2&&(x=Math.min(x,y))):(x=Math.max(x,b),h.n(s)>2&&(x=Math.max(x,w))),_.set(x),x},h.alma=(e,t,i,s)=>{const r=Math.floor(i*(t-1)),n=t/s*(t/s),o=[];let a=0;for(let e=0;ee.get()-e.get(1),h.roc=(e,t)=>{const i=e.get(t);return 100*(e.get()-i)/i},h.dev=(e,t,i)=>{const s=h.sma(e,t,i);return h.dev2(e,t,s)},h.dev2=(e,t,i)=>{let s=0;for(let r=0;r{const s=h.variance(e,t,i);return h.sqrt(s)},h.variance=(e,t,i)=>{const s=h.sma(e,t,i);return h.variance2(e,s,t)},h.variance2=(e,t,i)=>{let s=0;for(let r=0;r{if(h.na(e.get(t-1)))return NaN;let i=0;const s=e.get();for(let r=1;r{if(void 0===e.symbol.session.timezone)return()=>!1;const t=(0,s.newBarBuilder)(e.symbol.period,e.symbol.session,null);return e=>t.indexOfBar(e)===o.SessionStage.POST_SESSION&&(t.moveTo(e),!0)},h.error=e=>{throw new a(e)},h.dmi=(e,t,i)=>{
const s=i.new_var(h.high(i)),r=i.new_var(h.low(i)),n=h.change(s),o=-h.change(r),a=i.new_var(h.na(n)||h.na(o)?h.na():h.and(h.gt(n,o),h.gt(n,0))?n:0),l=i.new_var(h.na(o)?h.na():h.and(h.gt(o,n),h.gt(o,0))?o:0),c=h.atr(e,i),d=h.fixnan(100*h.rma(a,e,i)/c,i),u=h.fixnan(100*h.rma(l,e,i)/c,i);let p=d+u;h.isZero(p)&&(p+=1);const _=Math.abs(d-u)/p*100,m=i.new_var(_),g=h.rma(m,t,i),f=i.new_var(g);return[d,u,_,g,(f.get(0)+f.get(e-1))/2]},h.zigzag=(e,t,i)=>new m(e,t,i).lastPrice(),h.zigzagbars=(e,t,i)=>{const s=new m(e,t,i);return-1===s.lastIndex()?NaN:s.lastIndex()-h.n(i)};const u=0,p=1;class _{constructor(e,t,i,s,r){this._areaRight=e,this._areaLeft=t,this._pivotType=i,this._series=s,this._currentIndex=r.new_var(0),this._currentValue=r.new_var(NaN),this._pivotIndex=r.new_var(-1),this._index=h.n(r),this._isNewBar=r.symbol.isNewBar;const n=this._currentIndex.get(1),o=this._currentValue.get(1),a=this._pivotIndex.get(1);this._index>1&&(this._currentIndex.set(n),this._currentValue.set(o),this._pivotIndex.set(a))}isPivotFound(){return-1!==this._pivotIndex.get()}pivotIndex(){return this._pivotIndex.get()}currentValue(){return this._currentValue.get()}pivotType(){return this._pivotType}reset(){this._currentValue.set(NaN),this._currentIndex.set(0),this._pivotIndex.set(-1)}isRightSideOk(e){return e-this._currentIndex.get()===this._areaRight}isViolate(e,t){if(e<1||isNaN(this._currentValue.get()))return!0;const i=this._series.get(this._index-e);return!!isNaN(i)||(i===this._currentValue.get()?t:this._pivotType===p?i>this._currentValue.get():ithis._areaRight}update(){if(this._isNewBar&&this.isPivotFound()&&this.reset(),this.processPoint(this._index),this.isRightSideOk(this._index)){if(-1===this._pivotIndex.get()){let e=!0;for(let t=0;t1&&this.addPivot(n,o,a),this.processPivot(this._pivotHigh),this.processPivot(this._pivotLow)}addPivot(e,t,i){this._lastIndex.set(e),this._lastVal.set(t),this._lastType.set(i)}updatePivot(e,t){this._lastIndex.set(e),this._lastVal.set(t)}lastPrice(){return this._lastVal.get()}lastIndex(){return this._lastIndex.get()}addPoint(e,t,i){
if(isNaN(this._lastVal.get()))return void this.addPivot(e,t,i);const s=this._lastVal.get();if(this._lastType.get()===i){return void((i===p?t>s:tthis._deviation&&this.addPivot(e,t,i)}processPivot(e){e.update(),this._isBarClosed&&e.isPivotFound()&&this.addPoint(e.pivotIndex(),e.currentValue(),e.pivotType())}}},53130:(e,t,i)=>{"use strict";i.d(t,{anchoredVWAPStudyItem:()=>n});var s=i(50151),r=i(81337);const n={name:"Anchored VWAP",metainfo:{_metainfoVersion:51,description:"Anchored VWAP",shortDescription:"Anchored VWAP",format:{type:"inherit"},id:"AnchoredVWAP@tv-basicstudies-1",is_hidden_study:!0,is_price_study:!0,defaults:{inputs:{start_time:0,source:"hlc3"},styles:{VWAP:{color:"#1e88e5",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,display:15}}},inputs:[{defval:0,id:"start_time",isHidden:!0,max:253370764800,min:-253370764800,name:"Start time",type:"time"},{defval:"hlc3",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"source"}],plots:[{id:"VWAP",type:"line"}],styles:{VWAP:{histogramBase:0,title:"VWAP"}}},constructor:class{constructor(){this._isNewSession=null,this._firstBarTime=0}init(e,t){this._firstBarTime=t(0),this._isNewSession=null}main(e,t,i){if(void 0===i)return[NaN];(0,s.assert)(e.symbol.time===i.time);const n=i.time;if(n&&n{"use strict";i.d(t,{pivotPointsStandardStudyItem:()=>d});var s=i(36274),r=i(47609),n=i(81337);class o{constructor(){this.p=NaN,this.r1=NaN,this.s1=NaN,this.r2=NaN,this.s2=NaN,this.r3=NaN,this.s3=NaN,this.r4=NaN,this.s4=NaN,this.r5=NaN,this.s5=NaN,this.startIndex__t=NaN,this.endIndex__t=NaN}}class a{constructor(){this.pivots=[]}}function l(e,t){e.setUTCMonth(e.getUTCMonth()+t)}function c(e,t){if(n.Std.ismonthly(e)){let i=new Date(t);return i.getUTCDay()=1&&t.multiplier()<=15?"1D":"1W";case s.ResolutionKind.Seconds:case s.ResolutionKind.Ticks:return"1D"}throw new Error("Unexpected resolution type: "+e.symbol.resolution)}(e);case"Daily":
return"1D";case"Weekly":return"1W";case"Monthly":return"1M";case"Yearly":return"12M";default:throw new Error("No such pivTimeFrame: "+t)}}const d={name:"Pivot Points Standard",metainfo:{_metainfoVersion:44,defaults:{inputs:{kind:"Traditional",lookBack:15,pivTimeFrame:"Auto",showHistoricalPivots:!0},precision:"4"},description:"Pivot Points Standard",id:"PivotPointsStandard@tv-basicstudies-80",inputs:[{defval:"Traditional",id:"kind",name:"Type",options:["Traditional","Fibonacci","Woodie","Classic","DeMark","Camarilla","Floor"],type:"text"},{defval:!0,id:"showHistoricalPivots",name:"Show historical pivots",type:"bool"},{defval:"Auto",id:"pivTimeFrame",name:"Pivots Timeframe",options:["Auto","Daily","Weekly","Monthly","Yearly"],type:"text"},{defval:15,id:"lookBack",max:5e3,min:1,name:"Number of Pivots Back",type:"integer"}],is_price_study:!0,linkedToSeries:!0,shortDescription:"Pivots",format:{type:"price",precision:4}},constructor:class{constructor(){this._secondaryRes="1D",this._firstMainSeriesBarTime=NaN}init(e,t){const i=t(0),s=t(1),o=t(2),l=t(3);this._data=new a,this._firstMainSeriesBarTime=NaN,this._kindPP=function(e){switch(e){case"Traditional":return 0;case"Fibonacci":return 1;case"Woodie":return 2;case"Classic":return 3;case"DeMark":return 4;case"Camarilla":return 5;case"Floor":return 6;default:throw new Error("Unknown kind "+e)}}(i),this._showHistoricalPivots=s,this._historicalPivotsToKeep=l,this._pivTimeFrame=o,this._isValidResolution=function(e,t){return!(n.Std.isdaily(e)&&"Daily"===t||n.Std.isweekly(e)&&("Daily"===t||"Weekly"===t)||n.Std.ismonthly(e)&&("Daily"===t||"Weekly"===t||"Monthly"===t))}(e,this._pivTimeFrame),this._isValidResolution||n.Std.error("You cannot see this pivot timeframe on this resolution"),this._isValidResolution&&(this._secondaryRes=h(e,this._pivTimeFrame),void 0!==e.symbol.info&&(0,r.findSuitableResolutionToBuildFrom)(this._secondaryRes,e.symbol.info).error&&(this._isValidResolution=!1,n.Std.error(`Resolution ${this._secondaryRes} is not supported for this symbol`))),e.new_sym(e.symbol.tickerid,this._secondaryRes)}main(e,t,i){if(!this._isValidResolution)return null;if(e.is_main_symbol(i))return isNaN(this._firstMainSeriesBarTime)&&(this._firstMainSeriesBarTime=e.symbol.time,this._removeUnusedPivots()),e.symbol.isLastBar&&e.symbol.isNewBar?this._createResponse():null;e.select_sym(1);const s=e.new_var(n.Std.open(e)),r=e.new_var(n.Std.high(e)),a=e.new_var(n.Std.low(e)),l=e.new_var(n.Std.close(e)),h=e.new_var(n.Std.time(e)),d=this._data,u=s.get(0),p=h.get(0),_=s.get(1),m=r.get(1),g=a.get(1),f=l.get(1),v=e.symbol.isLastBar;if(0!==d.pivots.length&&e.symbol.isNewBar){const e=d.pivots[d.pivots.length-1];e.endIndex__t!==p&&(e.endIndex__t=p)}if(0===e.symbol.index||!e.symbol.isNewBar)return e.select_sym(0),null;const S=function(e,t,i,s,r,a,l,c){const h=new o;let d=NaN;const u=i-s;switch(c){case 0:d=(i+s+r)/3,h.p=d,h.r1=2*d-s,h.s1=2*d-i,h.r2=d+(i-s),h.s2=d-(i-s),h.r3=2*d+(i-2*s),h.s3=2*d-(2*i-s),h.r4=3*d+(i-3*s),h.s4=3*d-(3*i-s),h.r5=4*d+(i-4*s),h.s5=4*d-(4*i-s);break;case 1:d=(i+s+r)/3,h.p=d,
h.r1=d+.382*u,h.s1=d-.382*u,h.r2=d+.618*u,h.s2=d-.618*u,h.r3=d+u,h.s3=d-u;break;case 2:d=(i+s+2*e)/4,h.p=d,h.r1=2*d-s,h.s1=2*d-i,h.r2=d+u,h.s2=d-u,h.r3=i+2*(d-s),h.s3=s-2*(i-d),h.r4=h.r3+u,h.s4=h.s3-u;break;case 3:d=(i+s+r)/3,h.p=d,h.r1=2*d-s,h.s1=2*d-i,h.r2=d+u,h.s2=d-u,h.r3=d+2*u,h.s3=d-2*u,h.r4=d+3*u,h.s4=d-3*u;break;case 4:let o=NaN;o=n.Std.equal(t,r)?i+s+2*r:n.Std.greater(r,t)?2*i+s+r:2*s+i+r,d=o/4,h.p=d,h.r1=o/2-s,h.s1=o/2-i;break;case 5:d=(i+s+r)/3,h.p=d,h.r1=r+1.1*u/12,h.s1=r-1.1*u/12,h.r2=r+1.1*u/6,h.s2=r-1.1*u/6,h.r3=r+1.1*u/4,h.s3=r-1.1*u/4,h.r4=r+1.1*u/2,h.s4=r-1.1*u/2;break;case 6:d=(i+s+r)/3,h.p=d,h.r1=2*d-s,h.s1=2*d-i,h.r2=d+(i-s),h.s2=d-(i-s),h.r3=d-h.s1+h.r2,h.s3=2*d-(2*i-s);break;default:throw new Error("Unknown kind")}return h.startIndex__t=a,h.endIndex__t=l,h}(u,_,m,g,f,p,c(e,p),this._kindPP);return e.select_sym(0),this._showHistoricalPivots||(d.pivots=[]),d.pivots.push(S),d.pivots.length>this._historicalPivotsToKeep&&d.pivots.shift(),v?this._createResponse():null}_createResponse(){return 0===this._data.pivots.length?null:{nonseries:!0,type:"non_series_data",data:{data:this._data}}}_removeUnusedPivots(){const e=Math.max(this._data.pivots.findIndex((e=>e.startIndex__t>this._firstMainSeriesBarTime))-1,0);e>0&&this._data.pivots.splice(0,e)}}}},81821:(e,t,i)=>{"use strict";i.d(t,{ratioStudyItem:()=>n});var s=i(87302);class r extends s.SpreadRatioBase{_doCalculation(e,t,i,s){return e*t/(i*s)}}const n={name:"Ratio",metainfo:{_metainfoVersion:15,defaults:s.spreadRatioDefaults,plots:s.spreadRatioPlots,styles:s.spreadRatioStyles,description:"Ratio",shortDescription:"Ratio",is_price_study:!1,inputs:s.spreadRatioInputs,id:"Ratio@tv-basicstudies-1",format:{type:"price",precision:2}},constructor:r}},65097:(e,t,i)=>{"use strict";i.d(t,{regressionTrendStudyItem:()=>n});var s=i(81337);function r(e,t,i){const r={slope:NaN,average:NaN,intercept:NaN,stdDev:NaN,upDev:NaN,downDev:NaN,pearsons:NaN};return 0===e.length||(function(e,t){let i=0,s=0,r=0,n=0;for(let t=0;tn&&(n=u),u=d-i[s],u>o&&(o=u),u=e[s];const _=u-r.average,m=d-p;u-=d,a+=u*u,l+=_*_,c+=m*m,h+=_*m,d+=r.slope}r.stdDev=Math.sqrt(a/(0===u?1:u)),r.pearsons=s.Std.isZero(l)||s.Std.isZero(c)?0:h/Math.sqrt(l*c),r.upDev=n,r.downDev=o}(e,t,i,r)),r}const n={name:"Regression Trend",metainfo:{_metainfoVersion:51,description:"Regression Trend",format:{type:"inherit"},id:"RegressionTrend@tv-basicstudies-144",is_hidden_study:!0,is_price_study:!0,shortDescription:"Reg Trend",defaults:{inputs:{"first bar time":0,"last bar time":0,"lower diviation":-2,source:"close","upper diviation":2,"use lower diviation":!0,"use upper diviation":!0},styles:{}},inputs:[{defval:2,id:"upper diviation",max:500,min:-500,name:"Upper Deviation",type:"float"},{defval:-2,
id:"lower diviation",max:500,min:-500,name:"Lower Deviation",type:"float"},{defval:!0,id:"use upper diviation",name:"Use Upper Deviation",type:"bool"},{defval:!0,id:"use lower diviation",name:"Use Lower Deviation",type:"bool"},{defval:0,id:"first bar time",isHidden:!0,max:253370764800,min:-253370764800,name:"First bar time",type:"time"},{defval:0,id:"last bar time",isHidden:!0,max:253370764800,min:-253370764800,name:"Last bar time",type:"time"},{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"source"}],plots:[]},constructor:class{constructor(){this._resultSent=!1}init(e,t){this._resultSent=!1,this._data={baseLine:{startPrice:NaN,endPrice:NaN},upLine:{startPrice:NaN,endPrice:NaN},downLine:{startPrice:NaN,endPrice:NaN},pearsons:NaN,startIndex__t:NaN,endIndex__t:NaN}}main(e,t){const i=t(6),n=e.new_unlimited_var(s.Std.time(e)),o=e.new_unlimited_var(s.Std.high(e)),a=e.new_unlimited_var(s.Std.low(e)),l=e.new_unlimited_var(s.Std[i](e));if(!e.symbol.isLastBar)return null;if(this._resultSent)return null;const c=t(0),h=t(1),d=t(2),u=t(3),p=t(4),_=t(5),m=n.indexOf(p),g=n.indexOf(_),f=[],v=[],S=[],y=[];for(let e=m;e>=g;--e)f.push(n.get(e)),v.push(o.get(e)),S.push(a.get(e)),y.push(l.get(e));return this._updateData(f,d,c,u,h,p,_,r(y,v,S)),this._resultSent=!0,{type:"non_series_data",nonseries:!0,data:{data:this._data}}}_updateData(e,t,i,s,r,n,o,a){const l=e.length-1;this._data.baseLine.startPrice=a.intercept,this._data.baseLine.endPrice=a.intercept+a.slope*l;const c=a.intercept+(t?a.stdDev*i:a.upDev);this._data.upLine.startPrice=c,this._data.upLine.endPrice=c+a.slope*l;const h=a.intercept+(s?a.stdDev*r:-a.downDev);this._data.downLine.startPrice=h,this._data.downLine.endPrice=h+a.slope*l,this._data.pearsons=a.pearsons,this._data.startIndex__t=n,this._data.endIndex__t=o}}}},87302:(e,t,i)=>{"use strict";i.d(t,{SpreadRatioBase:()=>r,spreadRatioDefaults:()=>n,spreadRatioInputs:()=>o,spreadRatioPlots:()=>a,spreadRatioStyles:()=>l});var s=i(81337);class r{init(e,t){e.new_sym(t(1),s.Std.period(e)),this._source=t(0),this._scaleFactor1=1,this._scaleFactor2=1}main(e,t){const i=e.symbol.time,r=s.Std[this._source](e);e.select_sym(1);const n=s.Std[this._source](e),o=e.new_unlimited_var(n),a=e.new_unlimited_var(e.symbol.time);if(e.select_sym(0),isNaN(i))return null;let l=a.indexOf(i);-1!==l&&a.get(l)!==i&&(l=-1);const c=l<0?NaN:o.get(l);return[this._doCalculation(this._scaleFactor1,r,this._scaleFactor2,c)]}}const n={styles:{plot1:{linestyle:0,linewidth:2,plottype:0,trackPrice:!1,transparency:35,color:"#800080",display:15}},precision:2,inputs:{source:"close",symbol2:""}},o=[{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"text"},{id:"symbol2",name:"Symbol",type:"symbol",confirm:!0}],a=[{id:"plot1",type:"line"}],l={plot1:{title:"Plot",histogramBase:0}}},39944:(e,t,i)=>{"use strict";i.d(t,{spreadStudyItem:()=>n});var s=i(87302);class r extends s.SpreadRatioBase{_doCalculation(e,t,i,s){return e*t-i*s}}const n={name:"Spread",metainfo:{
_metainfoVersion:15,defaults:s.spreadRatioDefaults,plots:s.spreadRatioPlots,styles:s.spreadRatioStyles,description:"Spread",shortDescription:"Spread",is_price_study:!1,inputs:s.spreadRatioInputs,id:"Spread@tv-basicstudies-1",format:{type:"price",precision:2}},constructor:r}},56437:(e,t,i)=>{"use strict";i.d(t,{VbPCheckHaveVolumeExpr:()=>r});var s=i(81337);class r{constructor(e){this._haveAnyVolume=!1,this._isDisabled=!1,this._seriesGetter=e}update(e,t){if(this._haveAnyVolume||this._isDisabled)return;const i=this._seriesGetter.volume().get(e);0!==i&&Number.isFinite(i)&&(this._haveAnyVolume=!0),t&&(this._haveAnyVolume||s.Std.error("The data vendor doesn't provide volume data for this symbol."),this._isDisabled=!0)}}},89529:(e,t,i)=>{"use strict";i.d(t,{VolumeByPriceExpr:()=>_});var s=i(50151),r=i(37160),n=i(36274),o=i(29779);class a extends o.GraphicsObj{constructor(e,t,i,r,n,o){super(e),(0,s.assert)(t({index:e.index,offset:e.offset,level:e.level})))}}}class u extends o.GraphicsObj{constructor(e,t,i,s,r=!1,n=!1){super(e),this._endIndex=this._mixinJSONObject.createTimeField(i,"endIndex"),this._extendLeft=this._mixinJSONObject.createField(r,"extendLeft"),this._extendRight=this._mixinJSONObject.createField(n,"extendRight"),this._level=this._mixinJSONObject.createDoubleField(s,"level"),this._startIndex=this._mixinJSONObject.createTimeField(t,"startIndex")}isNaN(){return super.isNaN()||Number.isNaN(this._level.get())||this._startIndex.get()<0||this._endIndex.get()<0||this._startIndex.get()===this._endIndex.get()&&!this._extendLeft.get()&&!this._extendRight.get()}jsonName(){return"horizlines"}primitiveData(){return{id:this.id(),startIndex:this._startIndex.get(),endIndex:this._endIndex.get(),extendLeft:this._extendLeft.get(),extendRight:this._extendRight.get(),level:this._level.get()}}startIndex(){return this._startIndex.get()}setStartIndex(e){this._startIndex.set(e)&&this._processObjUpdate()}endIndex(){return this._endIndex.get()}setEndIndex(e){this._endIndex.set(e)&&this._processObjUpdate()}level(){return this._level.get()}setLevel(e){this._level.set(e)&&this._processObjUpdate()}isExtendLeft(){return this._extendLeft.get()}setExtendLeft(e){this._extendLeft.set(e)&&this._processObjUpdate()}extendLeft(){return this.isExtendLeft()}isExtendRight(){return this._extendRight.get()}setExtendRight(e){this._extendRight.set(e)&&this._processObjUpdate()}extendRight(){return this.isExtendRight()}}class p{constructor(){this._map=new Map}get(e){const t=this._innerMap(e.start);return t&&t.get(e.end)}set(e,t){this._innerMap(e.start,!0).set(e.end,t)}clear(){this._map.clear()}size(){let e=0;return this._map.forEach((t=>e+=t.size)),e}_innerMap(e,t){let i=this._map.get(e);return void 0===i&&t&&(i=new Map,this._map.set(e,i)),i}}class _{constructor(e,t,i,r,n,o,a,c,h,d,u,_,m,g,f){this._freezedBoxes=new l.GraphicsList,this._freezedHists=new l.GraphicsList,this._freezedPocs=new l.GraphicsList,this._freezedVAHists=new l.GraphicsList,this._currentHistsGr=new l.GraphicsList,this._currentVAHistsGr=new l.GraphicsList,this._currentHists=[],this._currentHistsMap=new p,this._currentBox=null,this._currentPoc=null,this._historyBarSet=[],this._prevRtBar=null,this._minPrice=Number.POSITIVE_INFINITY,this._maxPrice=Number.NEGATIVE_INFINITY,this._leftBoxTime=null,this._rightBoxTime=null,this._actualRightBoxTime=null,this._needRecalc=!1,this._largestHistItem=null,this._rowsLayout=null,this._currentVAStart=0,this._currentVAEnd=0,this._previousVAStart=0,this._previousVAEnd=0,this._idsGenerator=null,(0,s.assert)(1===e||2===e),
this._numOfSubHists=e,this._outHists=r,this._outBoxLines=n,this._outPocLines=o,this._extendPocLeftRight=a,this._outVAHists=c,this._vaVolumePercent=h,this._rowsLayoutSupplier=d,this._outHists.addStable(this._freezedHists),this._outVAHists.addStable(this._freezedVAHists),this._maxHHistItems=u,this._layoutIsAutoselected=g,this._leftBoxTimeMutable=_,this._rightBoxTimeMutable=m,this._actualRightBoxTime=null!=f?f:m,this._ctx=t,this._seriesGetter=i}update(e){this._supplyRowsLayout(this._ctx),null===this._currentBox&&this._initCurrentBox(),null===this._currentPoc&&this._initCurrentPoc();const t=this._timeScale().get(e);this._leftBoxTime=this._leftBoxTimeMutable,this._rightBoxTime=this._rightBoxTimeMutable,this._ctx.symbol.isLastBar&&!Number.isNaN(this._rightBoxTime)&&(this._rightBoxTime=Math.min(t+n.Interval.parse(this._ctx.symbol.interval+this._ctx.symbol.resolution).inMilliseconds(t)-1,this._rightBoxTime));const i=c.Std.greaterOrEqual(this._seriesClose().get(e),this._seriesOpen().get(e)),s={high:this._seriesHigh().get(e),low:this._seriesLow().get(e),volume:this._seriesVol().get(e),isUp:i,time:t};this._updateCurrentHistogram(s),this._currentHists.length>0&&(this._largestHistItem=this._getLargestHistItem(),this._updateCurrentPoc(),this._seriesGetter.developingPoc().set(this._currentPoc.level()),this._updateValueArea(),this._vaVolumePercent>0&&(this._seriesGetter.developingVAHigh().set(this._currentHists[this._currentVAEnd].priceHigh()),this._seriesGetter.developingVALow().set(this._currentHists[this._currentVAStart].priceLow()))),this._updateCurrentBox(),this._rebuildOutData()}setIdsGeneratorProxy(e){this._idsGenerator=e}nextGraphicsObjId(){return(0,s.ensureNotNull)(this._idsGenerator).nextGraphicsObjId()}pushEraseObjCmd(e,t){(0,s.ensureNotNull)(this._idsGenerator).pushEraseObjCmd(e,t)}popEraseCmds(){return(0,s.ensureNotNull)(this._idsGenerator).popEraseCmds()}_timeScale(){return this._seriesGetter.time()}_seriesLow(){return this._seriesGetter.low()}_seriesHigh(){return this._seriesGetter.high()}_seriesVol(){return this._seriesGetter.volume()}_seriesOpen(){return this._seriesGetter.open()}_seriesClose(){return this._seriesGetter.close()}_freezeCurrentHistogramAndCleanup(){null!==this._currentBox&&this._freezedBoxes.add(this._currentBox),c.Std.greater(this._getVolume(this._currentHists),0)&&(this._freezedHists.addAll(this._currentHistsGr),this._freezedVAHists.addAll(this._currentVAHistsGr),null!==this._currentPoc&&this._freezedPocs.add(this._currentPoc)),this._currentHists=[],this._currentHistsGr.clear(),this._currentHistsMap.clear(),this._initCurrentBox(),this._initCurrentPoc(),this._currentVAHistsGr.clear(),this._historyBarSet=[],this._minPrice=Number.POSITIVE_INFINITY,this._maxPrice=Number.NEGATIVE_INFINITY,this._prevRtBar=null,this._leftBoxTime=null,this._rightBoxTime=null}_supplyRowsLayout(e){null===this._rowsLayout&&e.symbol.isFirstBar&&e.symbol.isNewBar&&(this._rowsLayout=this._rowsLayoutSupplier())}_updateCurrentHistogram(e){if(this._needRecalc=!1,c.Std.greater(this._minPrice,e.low)&&(this._minPrice=e.low,
this._needRecalc=!0),c.Std.less(this._maxPrice,e.high)&&(this._maxPrice=e.high,this._needRecalc=!0),this._ctx.symbol.isBarClosed&&this._historyBarSet.length>0){const t=this._historyBarSet[this._historyBarSet.length-1];t.time===e.time&&(this._prevRtBar=t,this._historyBarSet.pop())}this._needRecalc&&0===(0,s.ensureNotNull)(this._rowsLayout).type()?(this._recalculateCurrentResultsOnHistoryBarSet(),this._applyUpdateToCurrentResults(e,!1)):this._applyUpdateToCurrentResults(e,!0),this._ctx.symbol.isBarClosed?((0,s.assert)(null===this._prevRtBar||e.time===this._prevRtBar.time),this._historyBarSet.push(e),this._prevRtBar=null):this._prevRtBar=e}_getMidLevel(e){return(e.priceHigh()+e.priceLow())/2}_getMidLevelFromList(e){return e.length%2==0?e[e.length/2].priceLow():this._getMidLevel(e[Math.floor(e.length/2)])}_getLargestHistItem(){let e=[],t=this._currentHists[0];for(const i of this._currentHists)c.Std.greater(i.ratesSum(),t.ratesSum())?(t=i,e=[t]):c.Std.equal(i.ratesSum(),t.ratesSum())&&e.push(i);if(e.length>1){const i=this._getMidLevelFromList(this._currentHists);t=e[e.length-1];for(let s=e.length-2;s>=0;s--){const r=e[s];c.Std.lessOrEqual(Math.abs(this._getMidLevel(r)-i),Math.abs(this._getMidLevel(t)-i))&&(t=r)}}return t}_initCurrentPoc(){this._currentPoc=new u(this,0,0,0)}_updateCurrentPoc(){const e=(0,s.ensureNotNull)(this._currentPoc);e.setStartIndex((0,s.ensureNotNull)(this._leftBoxTime)),e.setEndIndex((0,s.ensureNotNull)(this._actualRightBoxTime)),e.setExtendLeft(this._extendPocLeftRight),e.setExtendRight(this._extendPocLeftRight);const t=this._getMidLevel((0,s.ensureNotNull)(this._largestHistItem));e.setLevel(t)}_getVolume(e){let t=0;for(const i of e)t+=i.ratesSum();return t}_getPocHistItemIndex(){for(let e=0;e=0,`ERROR - PocHistItemIndex == ${e}`),this._currentVAStart=e-1,this._currentVAEnd=e+1;const t=this._getVolume(this._currentHists)*this._vaVolumePercent*.01;let i=this._currentHists[e].ratesSum(),r=0,n=null;for(;c.Std.lessOrEqual(i+r,t)&&(i+=r,0===n?--this._currentVAStart:1===n&&++this._currentVAEnd,-1!==this._currentVAStart||this._currentVAEnd!==this._currentHists.length);){let t,i;if(this._currentVAStart>-1)if(t=this._currentHists[this._currentVAStart].ratesSum(),this._currentVAEndthis._getMidLevel(this._currentHists[this._currentVAStart])&&e.priceLow()0&&(e=this._currentHists[0].priceLow(),t=this._currentHists[this._currentHists.length-1].priceHigh());const i=[],r=(0,s.ensureNotNull)(this._leftBoxTime),n=(0,s.ensureNotNull)(this._actualRightBoxTime);i.push(new h(r,e)),i.push(new h(r,t)),i.push(new h(n,t)),i.push(new h(n,e)),(0,s.ensureNotNull)(this._currentBox).setPoints(i)}_recalculateCurrentResultsOnHistoryBarSet(){for(let e=0;e0&&(this._largestHistItem=this._getLargestHistItem(),this._updateCurrentPoc()),this._updateCurrentBox()}_applyUpdateToCurrentResults(e,t){t&&null!==this._prevRtBar&&this._addHistoryBarToHistogram(this._prevRtBar,this._historyBarSet.length-1,this._currentHists,this._currentHistsMap,-1),this._addHistoryBarToHistogram(e,this._historyBarSet.length-1,this._currentHists,this._currentHistsMap,1),this._updateLastBarTimeInHistogram(this._currentHists)}_addHistoryBarToHistogram(e,t,i,r,n){(0,s.assert)(-1===n||1===n,"Please set sign argument either +1 or -1");const o=e.low,a=e.high,l=isNaN(e.volume)?0:e.volume,h=e.isUp,d=(0,s.ensureNotNull)(this._rowsLayout);d.init(this._ctx.symbol.minTick,this._minPrice,this._maxPrice,o,a);const u=d.rowWidth();if(!c.Std.greater(u,0))return;d.calculate();const p=d.getIndexLowVbP(),_=d.getIndexHighVbP(),m=d.getStartPrice();if(p===_){const e=p*u+m,t=(p+1)*u+m;this._updateResult({start:e,end:t},n*l,h,i,r)}else{let e=0;for(let t=p;t<=_;t++){const s=t*u+m,c=(t+1)*u+m,d=this._rowCoeff(s,c,o,a),p=d*l;e+=d,this._updateResult({start:s,end:c},n*p,h,i,r)}(0,s.assert)(c.Std.equal(e,1,.05),`totalCoeff not equal 1! totalConf = ${e}`)}}_updateResult(e,t,i,r,n){const o=this._createRates(i,t);(0,
s.assert)(null!==this._leftBoxTime,"leftBoxTime is not set (equals null)"),(0,s.assert)(null!==this._rightBoxTime,"rightBoxTime is not set (equals null)");const l=(0,s.ensureNotNull)(this._leftBoxTime),h=(0,s.ensureNotNull)(this._actualRightBoxTime);let d=n.get(e);if(void 0===d)d=new a(this,e.start,e.end,o,l,h),n.set(e,d),this._verifyHistogramSizeIsNotTooLarge(n.size()),this._currentHistsGr.add(d),_._addInOrder(d,r,0,r.length,((e,t)=>{let i=c.Std.compare(e.firstBarTime(),t.firstBarTime());return 0!==i?i:(i=c.Std.compare(e.priceLow(),t.priceLow()),0!==i?i:c.Std.compare(e.priceHigh(),t.priceHigh()))}));else{const e=[];for(let t=0;t0?_._addInOrder(e,t,o+1,s,n):t.splice(o,0,e)}}},19762:(e,t,i)=>{"use strict";i.d(t,{VolumeProfileBase:()=>u,maxHHistItems:()=>h,numOfSubHists:()=>d});var s=i(74649),r=i(36274);class n{constructor(e,t){this._minTick=NaN,this._minPrice=NaN,this._maxPrice=NaN,this._low=NaN,this._high=NaN,this._startPrice=NaN,this._indexLowVbP=NaN,this._indexHighVbP=NaN,this._rowSize=e,this._type=t}init(e,t,i,s,r){this._minTick=e,this._minPrice=t,this._maxPrice=i,this._low=s,this._high=r}getStartPrice(){return this._startPrice}setStartPrice(e){this._startPrice=e}getIndexLowVbP(){return this._indexLowVbP}setIndexLowVbP(e){this._indexLowVbP=e}getIndexHighVbP(){return this._indexHighVbP}setIndexHighVbP(e){this._indexHighVbP=e}type(){
return this._type}}class o extends n{constructor(e){super(e,0)}calculate(){this.setStartPrice(this._minPrice);const e=this.rowWidth();let t=Math.floor((this._low-this._minPrice)/e),i=Math.ceil((this._high-this._minPrice)/e)-1;t=Math.max(t,0),i=Math.max(i,0),i=Math.min(i,this._rowSize-1),t=Math.min(t,i),this.setIndexLowVbP(t),this.setIndexHighVbP(i)}rowWidth(){return Math.max((this._maxPrice-this._minPrice)/this._rowSize,this._minTick)}}class a extends n{constructor(e){super(e,1)}calculate(){this.setStartPrice(0);const e=this.rowWidth();let t=Math.floor(this._low/e);const i=Math.ceil(this._high/e)-1;t=Math.min(t,i),this.setIndexLowVbP(t),this.setIndexHighVbP(i)}rowWidth(){return this._minTick*this._rowSize}}var l=i(14483),c=i(81337);function h(){return 6e3}function d(e){switch(e){case"Delta":case"Up/Down":return 2;case"Total":return 1;default:c.Std.error(`Invalid study argument value: ${e}`)}}class u{findBasicResolutionForFromTo(e,t,i,n){const o=(0,s.getVolumeProfileResolutionForPeriod)(e.value(),t,i,n),a=r.Interval.parse(o);return l.enabled("charting_library_debug_mode")&&console.log(`Selected resolution ${a.value()} for (${e.value()}, ${t}, ${i})`),a}verifyRowSizeInput(e,t){"Number Of Rows"===t&&e>6e3&&c.Std.error('Histogram is too large, please reduce "Row Size" input.')}_getRowsLayout(e,t){return"Number Of Rows"===e?new o(t):new a(t)}}},82597:(e,t,i)=>{"use strict";i.d(t,{volumeProfileFixedRangeBSStudyItem:()=>w,volumeProfileFixedRangeVbPStudyItem:()=>b});var s=i(50151),r=i(19762),n=i(72877),o=i(90164),a=i(36274),l=i(79999),c=i(748),h=i(43945),d=i(31584),u=i(1386),p=i(56437),_=i(95586),m=i(89529);class g extends m.VolumeByPriceExpr{constructor(e,t,i,s,r,n,o,a,l,c,h,d,u){super(e,t,i,n,o,a,!1,l,c,(()=>h),d,s,r,!1,u),this._firstBarTime=s,this._lastBarTime=r}update(e){this._supplyRowsLayout(this._ctx),this.timeInRequestedRange(e)&&super.update(e)}timeInRequestedRange(e){const t=this._timeScale().get(e);return this._firstBarTime<=t&&t=this._firstBarTime){const e=this._developingPocSeries.getLeftOrEqual(n),t=this._developingVAHighSeries.getLeftOrEqual(n),i=this._developingVALowSeries.getLeftOrEqual(n);r.data.push([e,t,i])}else r.data.push([NaN,NaN,NaN])}return r}time(){return this._timeSeries}open(){return this._openSeries}high(){
return this._highSeries}low(){return this._lowSeries}close(){return this._closeSeries}volume(){return this._volumeSeries}developingPoc(){return this._developingPocSeries}developingVAHigh(){return this._developingVAHighSeries}developingVALow(){return this._developingVALowSeries}}function y(e){return{constructor:S,name:e.description,metainfo:{_metainfoVersion:51,shortDescription:"VPFR",format:{type:"volume"},is_price_study:!0,defaults:{graphics:{hhists:{histBars2:{colors:["#1592e6","#fbc123"],direction:o.HHistDirection.LeftToRight,percentWidth:30,showValues:!1,transparencies:[76,76],valuesColor:"#424242",visible:!0},histBarsVA:{colors:["#1592e6","#fbc123"],direction:o.HHistDirection.LeftToRight,percentWidth:30,showValues:!1,transparencies:[30,30],valuesColor:"#424242",visible:!0}},horizlines:{pocLines:{color:"#ff0000",style:_.LineStyle.Solid,visible:!0,width:2}},polygons:{histBoxBg:{color:"#37a6ef",transparency:94}}},inputs:{first_bar_time:0,last_bar_time:0,rows:24,rowsLayout:"Number Of Rows",subscribeRealtime:!0,vaVolume:70,volume:"Up/Down"},styles:{developingPoc:{color:"#ff0000",linestyle:_.LineStyle.Solid,linewidth:1,plottype:n.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,display:0},developingVAHigh:{color:"#0000ff",linestyle:_.LineStyle.Solid,linewidth:1,plottype:n.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,display:0},developingVALow:{color:"#0000ff",linestyle:_.LineStyle.Solid,linewidth:1,plottype:n.LineStudyPlotStyle.StepLine,trackPrice:!1,transparency:0,display:0}}},graphics:{hhists:{histBars2:{location:o.HHistLocation.Absolute,title:"Volume Profile",titles:["Up Volume","Down Volume"]},histBarsVA:{location:o.HHistLocation.Absolute,title:"Value Area",titles:["Value Area Up","Value Area Down"]}},horizlines:{pocLines:{name:"POC",showPrice:!0}},polygons:{histBoxBg:{mouseTouchable:!1,name:"Histogram Box",showBorder:!1}}},inputs:[{defval:"Number Of Rows",id:"rowsLayout",name:"Rows Layout",options:["Number Of Rows","Ticks Per Row"],type:"text"},{defval:24,id:"rows",max:1e6,min:1,name:"Row Size",type:"integer"},{defval:"Up/Down",id:"volume",name:"Volume",options:["Up/Down","Total","Delta"],type:"text"},{defval:0,id:"first_bar_time",isHidden:!0,max:253370764800,min:-253370764800,name:"First Bar Time",type:"time"},{defval:0,id:"last_bar_time",isHidden:!0,max:253370764800,min:-253370764800,name:"Last Bar Time",type:"time"},{defval:70,id:"vaVolume",max:100,min:0,name:"Value Area Volume",type:"integer"},{defval:!0,id:"subscribeRealtime",isHidden:!0,name:"SubscribeRealtime",type:"bool"}],plots:[{id:"developingPoc",type:"line"},{id:"developingVAHigh",type:"line"},{id:"developingVALow",type:"line"}],styles:{developingPoc:{histogramBase:0,title:"Developing Poc"},developingVAHigh:{histogramBase:0,title:"Developing VA High"},developingVALow:{histogramBase:0,title:"Developing VA Low"}},...e}}}const b=y({id:"VbPFixed@tv-volumebyprice-57",description:"Volume Profile Fixed Range"}),w=y({id:"VbPFixed@tv-basicstudies-152",description:"Fixed Range",is_hidden_study:!0})},19999:(e,t,i)=>{"use strict";i.d(t,{
VolumeProfileOutputSeries:()=>n});var s=i(50151),r=i(78071);class n{constructor(){this._histPos=-1,this._hist=new Float64Array(2e3),this._times=new Float64Array(2e3)}addHist(e){if(this._histPos>=0){const t=this._times[this._histPos];(0,s.assert)(t<=e,"History order violation"),this._histPos+=t===e?0:1}else this._histPos+=1;if(this._histPos===this._hist.length){const e=new Float64Array(2*this._hist.length);e.set(this._hist),this._hist=e;const t=new Float64Array(this._hist.length);t.set(this._times),this._times=t}this._hist[this._histPos]=NaN,this._times[this._histPos]=e}removeLastIfNaN(){Number.isNaN(this.get(0))&&(this._histPos-=1)}get(e){(0,s.assert)(0===e);const t=this._histPos-e;return this._hist[t]}getLeftOrEqual(e){const t=(0,r.upperbound)(this._times,e,((e,t)=>e{"use strict";i.d(t,{volumeProfileVisibleRangeStudyItem:()=>v});var s=i(50151),r=i(19762),n=i(90164),o=i(36274),a=i(79999),l=i(89529),c=i(31584);class h extends l.VolumeByPriceExpr{constructor(e,t,i,s,r,n,o,a,l,h,d){super(e,t,i,n,new c.GraphicsList,o,!0,a,l,(()=>h),d,s,r,!1),this._firstBarTime=s,this._lastBarTime=r}update(e){this._supplyRowsLayout(this._ctx),this.timeInRequestedRange(e)&&super.update(e)}timeInRequestedRange(e){const t=this._timeScale().get(e);return this._firstBarTime<=t&&t=this._firstBarTime){const e=this._developingPocSeries.getLeftOrEqual(n),t=this._developingVAHighSeries.getLeftOrEqual(n),i=this._developingVALowSeries.getLeftOrEqual(n);r.data.push([e,t,i])}else r.data.push([NaN,NaN,NaN])}return r}time(){return this._timeSeries}open(){return this._openSeries}high(){return this._highSeries}low(){return this._lowSeries}close(){return this._closeSeries}volume(){return this._volumeSeries}developingPoc(){return this._developingPocSeries}developingVAHigh(){return this._developingVAHighSeries}developingVALow(){return this._developingVALowSeries}}const v={constructor:f,name:"Volume Profile Visible Range",metainfo:{_metainfoVersion:51,id:"VbPVisible@tv-basicstudies-49",description:"Volume Profile Visible Range",shortDescription:"VPVR",format:{type:"volume"},is_price_study:!0,linkedToSeries:!0,palettes:{},inputs:[{id:"rowsLayout",
name:"Rows Layout",defval:"Number Of Rows",options:["Number Of Rows","Ticks Per Row"],type:"text"},{id:"rows",name:"Row Size",defval:24,max:1e6,min:1,type:"integer"},{id:"volume",name:"Volume",defval:"Up/Down",options:["Up/Down","Total","Delta"],type:"text"},{id:"first_visible_bar_time",name:"First Visible Bar Time",defval:0,isHidden:!0,max:253370764800,min:-253370764800,type:"time"},{id:"last_visible_bar_time",name:"Last Visible Bar Time",defval:0,isHidden:!0,max:253370764800,min:-253370764800,type:"time"},{id:"vaVolume",name:"Value Area Volume",defval:70,max:100,min:0,type:"integer"}],plots:[{id:"developingPoc",type:"line"},{id:"developingVAHigh",type:"line"},{id:"developingVALow",type:"line"}],graphics:{hhists:{histBars2:{location:n.HHistLocation.Relative,title:"Volume Profile",titles:["Up Volume","Down Volume"]},histBarsVA:{location:n.HHistLocation.Relative,title:"Value Area",titles:["Value Area Up","Value Area Down"]}},horizlines:{pocLines:{name:"POC",showPrice:!0}}},defaults:{graphics:{hhists:{histBars2:{colors:["#1592e6","#fbc123"],direction:n.HHistDirection.RightToLeft,percentWidth:30,showValues:!1,transparencies:[76,76],valuesColor:"#424242",visible:!0},histBarsVA:{colors:["#1592e6","#fbc123"],direction:n.HHistDirection.RightToLeft,percentWidth:30,showValues:!1,transparencies:[30,30],valuesColor:"#424242",visible:!0}},horizlines:{pocLines:{color:"#ff0000",style:0,visible:!0,width:2}}},inputs:{first_visible_bar_time:0,last_visible_bar_time:0,rows:24,rowsLayout:"Number Of Rows",vaVolume:70,volume:"Up/Down"},styles:{developingPoc:{color:"#ff0000",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,display:0},developingVAHigh:{color:"#0000ff",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,display:0},developingVALow:{color:"#0000ff",linestyle:0,linewidth:1,plottype:9,trackPrice:!1,transparency:0,display:0}}},styles:{developingPoc:{histogramBase:0,title:"Developing Poc"},developingVAHigh:{histogramBase:0,title:"Developing VA High"},developingVALow:{histogramBase:0,title:"Developing VA Low"}}}}},43945:(e,t,i)=>{"use strict";i.d(t,{EraseAll:()=>r,EraseObj:()=>s,GraphicsCmds:()=>n});class s{constructor(e,t){this.id=e,this.type=t}primitiveData(){return{action:"one",id:this.id,type:this.type}}}class r{primitiveData(){return{action:"all"}}}class n{constructor(){this.erase=[],this.create=null,this._modified=!1}primitiveData(e){if(this.isNaN())return null;const t={},i=this.create&&this.create.primitiveData(e);return null!==i&&(t.create=i),null!==this.erase&&this.erase.length>0&&(t.erase=this.erase.map((e=>e.primitiveData()))),void 0===t.create&&void 0===t.erase?null:t}setCreate(e){this.create=e,this.create.forEachList((e=>e.setOwner(this)))}isNaN(){return(null===this.erase||0===this.erase.length)&&null===this.create}isModified(){return this._modified}setModified(e){this._modified=e}dirty(){this._modified=!0}setOwner(e){throw new Error("Unsupported")}}},79999:(e,t,i)=>{"use strict";i.d(t,{GraphicsListColl:()=>s});class s{constructor(){this._stable=[],this._variable=null,this._owner=null}
addStable(e){e.setOwner(this),this._stable.push(e)}setVariable(e){this._variable=e,null!==this._variable&&this._variable.setOwner(this)}primitivesData(e){const t=[];return this._forEach((i=>t.push(...i.primitivesData(e)))),t}deleteErasedItems(){this._forEach((e=>e.deleteErasedItems()))}markPostedItems(){this._forEach((e=>e.markPostedItems()))}isNaN(){return this._all((e=>e.isNaN()))}dirty(){null!==this._owner&&this._owner.dirty()}setOwner(e){this._owner=e}_forEach(e){for(const t of this._stable)e(t);null!==this._variable&&e(this._variable)}_all(e){for(const t of this._stable)if(!e(t))return!1;return null===this._variable||e(this._variable)}}},31584:(e,t,i)=>{"use strict";i.d(t,{GraphicsList:()=>n});var s=i(29779),r=i(76958);class n{constructor(){this._items=[],this._owner=null}primitivesData(e){const t=[];for(const i of this._items)e.isIgnoredObj(i)||t.push(i.primitiveData());return t}get(e){return this._items[e]}set(e,t){return this.dirty(),t.setOwner(this),this._items[e]=t,t}addAtIndex(e,t){this.dirty(),t.setOwner(this),this._items[e]=t}clear(){this._unsetOwner(this._items),this._items=[],this.dirty()}addAllFromNumber(e,t){this.setOwner(t),this._items.splice(e,0,...t._items);return this._setCachedDataValid(!1),true}addAll(e){this.setOwner(e),this._items.push(...e._items);return this._setCachedDataValid(!1),true}remove(e){const t=this._items[e];return this._items.splice(e,1),t.unsetOwner(this),this.dirty(),t}getItems(){return this._items}size(){return this._items.length}add(e){e.setOwner(this),this._items.push(e);return this._setCachedDataValid(!1),true}deleteErasedItems(){this._items=this._items.filter((e=>!e.isErased()))}markPostedItems(){for(const e of this._items)e.markAsPosted()}isNaN(){if(0===this._items.length)return!0;for(const e of this._items){if(!(0,r.isNaNable)(e))return!1;if(!e.isNaN())return!1}return!0}setOwner(e){this._owner=e}dirty(){null!==this._owner&&this._owner.dirty()}_unsetOwner(e){for(const t of e)t instanceof s.GraphicsObj&&t.unsetOwner(this)}_setCachedDataValid(e){e||this.dirty()}}},29779:(e,t,i)=>{"use strict";i.d(t,{GraphicsObj:()=>l});var s=i(81337);class r{constructor(e,t,i,s){this._value=e,this._name=t,this._owner=i,this._comparer=void 0!==s?s:(e,t)=>null==e?null!=t:e===t}getName(){return this._name}set(e){const t=this._comparer(this._value,e);return t&&this._owner.dirty(),this._value=e,t}get(){return this._value}}class n{constructor(e,t,i){this._owner=null,this._value=e,this._name=t,this._owner=i}getName(){return this._name}set(e){return this._value!==e&&(this._value=e,null!==this._owner&&this._owner.dirty(),!0)}get(){return this._value}}class o extends r{constructor(e,t,i,s){super(e,t,i,s)}}class a{constructor(e){this._owner=e}createField(e,t){return new r(e,t,this)}createDoubleField(e,t){return new r(e,t,this,((e,t)=>!s.Std.equal(e,t)))}createDoubleArrayField(e,t){return new o(e,t,this,((e,t)=>{if(e===t)return!1;const i=e.length;if(t.length!==i)return!0;for(let r=0;r{"use strict";function s(e){return Boolean(e.isNaN)}i.d(t,{isNaNable:()=>s})},1386:(e,t,i)=>{"use strict";i.d(t,{JStudyDataUpdate:()=>d});var s=i(43945);class r{constructor(){this.isUpdate=!1,this.graphicsCmds=new s.GraphicsCmds,this._offsetsChanged=!1,this._disableGraphicsAndData=!1}isNaN(){return this.graphicsCmds.isNaN()}primitiveData(e){const t={};if(!this._disableGraphicsAndData){const i=this.graphicsCmds.primitiveData(e);null!==i&&(t.graphicsCmds=i)}return this.isUpdate&&(t.isUpdate=!0),void 0===t.graphicsCmds?void 0:t}disable(){this._disableGraphicsAndData=!0}checkForChangeAndResetChangedState(e){const t=this._offsetsChanged,i=this.graphicsCmds.isModified();this.graphicsCmds.setModified(!1),this._offsetsChanged=!1;return i||t||0!==e.length}}var n=i(1722),o=i(76958);function a(e){return Boolean(e.isPosted)}class l{isIgnoredObj(e,t){return l.isIgnoredObjDefault(e,t)}static isIgnoredObjDefault(e,t){if(void 0===t)return l.isIgnoredObjNaNable(e);const i=e[t];return l.isIgnoredByGeneralRules(e,t)||l.isIgnoredObjNaNable(i)||l.isIgnoredObjListOfNaNables(i)}static isIgnoredObjNaNable(e){return(0,o.isNaNable)(e)&&e.isNaN()}static isIgnoredObjListOfNaNables(e){if(!(0,n.isArray)(e))return!1;let t=!0;for(const i of e)if(!(0,o.isNaNable)(i)||!i.isNaN()){t=!1;break}return t}static isIgnoredObjPosted(e){return a(e)&&e.isPosted()}static isIgnoredObjErased(e){return a(e)&&e.isErased()}static isIgnoredByGeneralRules(e,t){const i=e[t];return(0,n.isArray)(i)&&0===i.length}}class c{isIgnoredObj(e,t){if(void 0===t)return l.isIgnoredObjDefault(e)||l.isIgnoredObjErased(e);const i=e[t];return l.isIgnoredObjDefault(e,t)||l.isIgnoredObjErased(i)}}class h{isIgnoredObj(e,t){if(void 0===t)return l.isIgnoredObjDefault(e)||l.isIgnoredObjErased(e)||l.isIgnoredObjPosted(e);const i=e[t];return l.isIgnoredObjDefault(e,t)||l.isIgnoredObjErased(i)||l.isIgnoredObjPosted(i)}}class d extends class extends class{constructor(e){this._dataObj=new r,this._isDirty=!1,this._eraseCmds=[],this._enableCmdDataStudy=e}init(e){this._dataObj.graphicsCmds.setCreate(e),this.update(!0)}dataObj(){return this._dataObj}setEraseCmds(e){this._eraseCmds=e}resetDirtyState(){this._isDirty=!1}disable(){
this._dataObj.disable()}}{constructor(e){super(e),this._snapshotPredicate=new c,this._dataSnapShot={}}getData(){return this._dataSnapShot}getUpdate(){return this._isDirty?this._dataSnapShot:{}}update(e){(this._dataObj.checkForChangeAndResetChangedState(this._eraseCmds)||e)&&(null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.create.deleteErasedObjs(),this._dataObj.graphicsCmds.erase=[new s.EraseAll]),this._makeSnapshot(),this._isDirty=!0)}_makeSnapshot(){this._json=this._dataObj.primitiveData(this._snapshotPredicate),this._dataSnapShot={json:this._json}}}{constructor(e){super(e),this._updatePredicate=new h,this._sendShapshotOnly=!0,this._isFirstNotForcedUpdate=!0}update(e){(this._dataObj.checkForChangeAndResetChangedState(this._eraseCmds)||e)&&(null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.erase=[new s.EraseAll]),this._dataObj.isUpdate=!0,this._makeSnapshot(),null!==this._dataObj.graphicsCmds.create&&(this._dataObj.graphicsCmds.erase=this._eraseCmds),this._dataObj.isUpdate=!0,this._jsonUpdate=this._dataObj.primitiveData(this._updatePredicate),null!==this._dataObj.graphicsCmds.create&&this._dataObj.graphicsCmds.create.deleteErasedAndMarkPostedObjs(),this._sendShapshotOnly=e||this._isFirstNotForcedUpdate,this._isFirstNotForcedUpdate=Boolean(e),this._isDirty=!0)}getUpdate(){return this._isDirty?this._enableCmdDataStudy?{json:this._sendShapshotOnly?this._json:void 0,jsonUpdate:this._sendShapshotOnly?void 0:this._jsonUpdate}:{json:this._json,jsonUpdate:this._sendShapshotOnly?void 0:this._jsonUpdate}:{}}}},748:(e,t,i)=>{"use strict";i.d(t,{Container:()=>n,StudyGraphicsData:()=>r});var s=i(50151);class r{constructor(){this._horizlines=[],this._hhists=[],this._polygons=[],this._vertlines=[],this._containersCache=[],this._containerNamesCache=[],this._containersMapCache=new Map,this._addToCache("horizlines",this._horizlines),this._addToCache("hhists",this._hhists),this._addToCache("polygons",this._polygons),this._addToCache("vertlines",this._vertlines)}primitiveData(e){const t={};let i=!1;for(const s of this._containerNamesCache){const r=[],n=this.getObjsContainer(s);for(const t of n){if(t.isNaN())continue;const i=t.primitiveData(e);i.data.length>0&&r.push(i)}r.length>0&&(t[s]=r,i=!0)}return i?t:null}deleteErasedAndMarkPostedObjs(){this.forEachList((e=>{e.deleteErasedItems(),e.markPostedItems()}))}deleteErasedObjs(){this.forEachList((e=>e.deleteErasedItems()))}getObjsContainer(e){return(0,s.ensureDefined)(this._containersMapCache.get(e))}forEachList(e){for(const t of this._containersCache)for(const i of t)e(i.data)}_addToCache(e,t){this._containersCache.push(t),this._containerNamesCache.push(e),this._containersMapCache.set(e,t)}}class n{constructor(e,t){this.styleId=e,this.data=t}isNaN(){return this.data.isNaN()}primitiveData(e){return{styleId:this.styleId,data:this.data.primitivesData(e)}}}},24172:(e,t,i)=>{"use strict";const s=i(33013).getHexColorByName;var r=i(74649)
;const n=s("color-ripe-red-100"),o=s("color-ripe-red-200"),a=s("color-ripe-red-500"),l=s("color-ripe-red-900"),c=s("color-ripe-red-a200"),h=s("color-minty-green-100"),d=s("color-minty-green-400"),u=s("color-minty-green-500");JSServer.studyLibrary=[{name:"Accumulation/Distribution",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Accumulation/Distribution",shortDescription:"Accum/Dist",is_price_study:!1,inputs:[],id:"Accumulation/Distribution@tv-basicstudies-1",scriptIdPart:"",name:"Accumulation/Distribution",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i,s){return r.Std.or(r.Std.and(r.Std.eq(e,t),r.Std.eq(e,i)),r.Std.eq(t,i))?0:(2*e-i-t)/(t-i)*s},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0(r.Std.close(this._context),r.Std.high(this._context),r.Std.low(this._context),r.Std.volume(this._context));return[r.Std.cum(i,this._context)]}}},{name:"Accumulative Swing Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"ASI",histogramBase:0,joinPoints:!1}},description:"Accumulative Swing Index",shortDescription:"ASI",is_price_study:!1,inputs:[{id:"in_0",name:"Limit Move Value",defval:10,type:"float",min:.1,max:1e5}],id:"Accumulative Swing Index@tv-basicstudies-1",scriptIdPart:"",name:"Accumulative Swing Index",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t){var i=t.new_var(r.Std.open(t)),s=t.new_var(r.Std.high(t)),n=t.new_var(r.Std.low(t)),o=t.new_var(r.Std.close(t)),a=r.Std.abs(s-o.get(1)),l=r.Std.abs(n-o.get(1)),c=r.Std.abs(s-n),h=r.Std.abs(o.get(1)-i.get(1)),d=r.Std.max(a,l),u=r.Std.iff(a>=r.Std.max(l,c),a-.5*l+.25*h,r.Std.iff(l>=r.Std.max(a,c),l-.5*a+.25*h,c+.25*h));return r.Std.iff(0===u,0,(o-o.get(1)+.5*(o-i)+.25*(o.get(1)-i.get(1)))/u*d/e*50)},this.f_1=function(e,t){var i=this.f_0(e,t);return r.Std.cum(i,t)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);return[this.f_1(i,this._context)]}}},{name:"Advance/Decline",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Advance/Decline",shortDescription:"AD",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:2e3}],id:"Advance/Decline@tv-basicstudies-1",scriptIdPart:"",name:"Advance/Decline",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t){
return r.Std.gt(e,t)},this.f_1=function(e,t){return r.Std.lt(e,t)},this.f_2=function(e,t){return 0===t?e:e/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(r.Std.close(this._context),r.Std.open(this._context)),n=this._context.new_var(s),o=r.Std.sum(n,i,this._context),a=this.f_1(r.Std.close(this._context),r.Std.open(this._context)),l=this._context.new_var(a),c=r.Std.sum(l,i,this._context);return[this.f_2(o,c)]}}},{name:"Arnaud Legoux Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:.85,in_2:6}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Arnaud Legoux Moving Average",shortDescription:"ALMA",is_price_study:!0,inputs:[{id:"in_0",name:"Window Size",defval:9,type:"integer",min:0,max:5e3},{id:"in_1",name:"Offset",defval:.85,type:"float",min:-1e12,max:1e12},{id:"in_2",name:"Sigma",defval:6,type:"float",min:-1e12,max:1e12}],id:"Arnaud Legoux Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Arnaud Legoux Moving Average",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._input(2),a=this._context.new_var(i);return[r.Std.alma(a,s,n,o)]}}},{name:"Aroon",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FB8C00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Upper",histogramBase:0,joinPoints:!1},plot_1:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Aroon",shortDescription:"Aroon",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Aroon@tv-basicstudies-1",scriptIdPart:"",name:"Aroon",format:{precision:2,type:"percent"}},constructor:function(){this.f_0=function(e,t){return 100*(e+t)/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.Std.high(this._context),n=i+1,o=this._context.new_var(s),a=r.Std.highestbars(o,n,this._context),l=this.f_0(a,i),c=r.Std.low(this._context),h=this._context.new_var(c),d=r.Std.lowestbars(h,n,this._context);return[l,this.f_0(d,i)]}}},{name:"Average Price",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"AveragePrice@tv-basicstudies-1",scriptIdPart:"",name:"Average Price",description:"Average Price",shortDescription:"Average Price",is_price_study:!0,plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{}},styles:{plot_0:{title:"Plot"}},inputs:[],format:{type:"inherit"}},
constructor:function(){this.main=function(e,t){return this._context=e,this._input=t,[r.Std.ohlc4(this._context)]}}},{name:"Average Directional Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:c}},inputs:{in_0:14,in_1:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"ADX",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Average Directional Index",shortDescription:"ADX",is_price_study:!1,inputs:[{id:"in_0",name:"ADX Smoothing",defval:14,type:"integer",min:-1e12,max:1e12},{id:"in_1",name:"DI Length",defval:14,type:"integer",min:-1e12,max:1e12}],id:"average_directional_Index@tv-basicstudies-1",scriptIdPart:"",name:"Average Directional Index",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e){var t=this._context.new_var(r.Std.high(this._context)),i=r.Std.change(t),s=this._context.new_var(r.Std.low(this._context)),n=-r.Std.change(s),o=this._context.new_var(r.Std.tr(void 0,this._context)),a=r.Std.rma(o,e,this._context),l=this._context.new_var(r.Std.and(r.Std.gt(i,n),r.Std.gt(i,0))?i:0),c=r.Std.fixnan(100*r.Std.rma(l,e,this._context)/a,this._context),h=this._context.new_var(r.Std.and(r.Std.gt(n,i),r.Std.gt(n,0))?n:0);return[c,r.Std.fixnan(100*r.Std.rma(h,e,this._context)/a,this._context)]},this.f_1=function(e,t){var i=this.f_0(e),s=i[0],n=i[1],o=s+n,a=this._context.new_var(r.Std.abs(s-n)/(r.Std.eq(o,0)?1:o));return[100*r.Std.rma(a,t,this._context)]},this.main=function(e,t){return this._context=e,this._input=t,this._context.setMinimumAdditionalDepth(this._input(0)+this._input(1)),this.f_1(this._input(1),this._input(0))}}},{name:"Average True Range",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:l}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Average True Range",shortDescription:"ATR",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Average True Range@tv-basicstudies-1",scriptIdPart:"",name:"Average True Range",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){var i=t(0);return[r.Std.atr(i,e)]}}},{name:"Awesome Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:0,visible:!0,color:"#000080"}},palettes:{palette_0:{colors:{0:{color:a,width:1,style:0},1:{color:u,width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Awesome Oscillator",shortDescription:"AO",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}}}},inputs:[],
id:"Awesome Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Awesome Oscillator",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e){return r.Std.le(e,0)?0:1},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.hl2(this._context),s=this._context.new_var(i),n=r.Std.sma(s,5,this._context),o=this._context.new_var(i),a=r.Std.sma(o,34,this._context),l=this.f_0(n,a),c=l,h=this._context.new_var(l),d=r.Std.change(h);return[c,this.f_1(d)]}}},{name:"Accelerator Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:0,visible:!0,color:"#000080"}},palettes:{palette_0:{colors:{0:{color:a,width:1,style:0},1:{color:u,width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Accelerator Oscillator",shortDescription:"AO",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}}}},inputs:[],id:"Accelerator Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Accelerator Oscillator",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e){return r.Std.le(e,0)?0:1},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.hl2(this._context),s=this._context.new_var(i),n=r.Std.sma(s,5,this._context),o=this._context.new_var(i),a=r.Std.sma(o,34,this._context),l=this.f_0(n,a),c=this._context.new_var(l),h=r.Std.sma(c,5,this._context),d=this.f_0(l,h),u=this._context.new_var(d),p=r.Std.change(u);return[d,this.f_1(p)]}}},{name:"Balance of Power",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:c}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Balance of Power",shortDescription:"Balance of Power",is_price_study:!1,inputs:[],id:"Balance of Power@tv-basicstudies-1",scriptIdPart:"",name:"Balance of Power",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t,i,s){return(e-t)/(i-s)},this.main=function(e,t){return this._context=e,this._input=t,[this.f_0(r.Std.close(this._context),r.Std.open(this._context),r.Std.high(this._context),r.Std.low(this._context))]}}},{name:"Bollinger Bands",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:95,visible:!0}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"
},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Median",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Bollinger Bands",shortDescription:"BB",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50}],id:"Bollinger Bands@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-t},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.Std.sma(o,s,this._context),l=this._context.new_var(i),c=r.Std.stdev(l,s,this._context),h=this.f_0(n,c);return[a,this.f_1(a,h),this.f_2(a,h)]}}},{name:"Bollinger Bands %B",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:d}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:1},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],filledAreasStyle:{fill_0:{color:"#26A69A",transparency:90,visible:!0}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Bollinger Bands %B",shortDescription:"BB %B",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50}],id:"Bollinger Bands %B@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands %B",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-t},this.f_3=function(e,t,i){return(e-t)/(i-t)},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.Std.sma(o,s,this._context),l=this._context.new_var(i),c=r.Std.stdev(l,s,this._context),h=this.f_0(n,c),d=this.f_1(a,h),u=this.f_2(a,h);return[this.f_3(i,u,d)]}}},{name:"Bollinger Bands Width",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},inputs:{in_0:20,in_1:2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Bollinger Bands Width",shortDescription:"BBW",
is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"mult",defval:2,type:"float",min:.001,max:50}],id:"Bollinger Bands Width@tv-basicstudies-1",scriptIdPart:"",name:"Bollinger Bands Width",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t){return e*t},this.f_1=function(e,t){return e+t},this.f_2=function(e,t){return e-t},this.f_3=function(e,t,i){return(e-t)/i},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.Std.sma(o,s,this._context),l=this._context.new_var(i),c=r.Std.stdev(l,s,this._context),h=this.f_0(n,c),d=this.f_1(a,h),u=this.f_2(a,h);return[this.f_3(d,u,a)]}}},{name:"Chaikin Money Flow",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Chaikin Money Flow",shortDescription:"CMF",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:2e3}],id:"Chaikin Money Flow@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Money Flow",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i,s){return r.Std.or(r.Std.and(r.Std.eq(e,t),r.Std.eq(e,i)),r.Std.eq(t,i))?0:(2*e-i-t)/(t-i)*s},this.f_1=function(e,t){return e/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(r.Std.close(this._context),r.Std.high(this._context),r.Std.low(this._context),r.Std.volume(this._context)),n=this._context.new_var(s),o=r.Std.sum(n,i,this._context),a=r.Std.volume(this._context),l=this._context.new_var(a),c=r.Std.sum(l,i,this._context);return[this.f_1(o,c)]}}},{name:"Chaikin Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#EC407A"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:3,in_1:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Chaikin Oscillator",shortDescription:"Chaikin Osc",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"short",defval:3,type:"integer",min:1,max:2e3},{id:"in_1",name:"long",defval:10,type:"integer",min:1,max:2e3}],id:"Chaikin Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Oscillator",format:{type:"volume"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return e-t},this.main=function(e,t){this._context=e,this._input=t
;var i=this._input(0),s=this._input(1),n=r.Std.accdist(this._context),o=this._context.new_var(n),a=r.Std.ema(o,i,this._context),l=this._context.new_var(n),c=r.Std.ema(l,s,this._context);return[this.f_0(a,c)]}}},{name:"Chaikin Volatility",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Chaikin Volatility@tv-basicstudies-1",scriptIdPart:"",name:"Chaikin Volatility",description:"Chaikin Volatility",shortDescription:"Chaikin Volatility",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#AB47BC"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{periods:10,rocLookback:10}},styles:{plot_0:{title:"Plot",zorder:1}},bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"periods",type:"integer",name:"Periods"},{id:"rocLookback",type:"integer",name:"Rate of Change Lookback"}],format:{type:"volume"},usePlotsZOrder:!0},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.rocLookback=this._input(1)},this.main=function(e,t){this._context=e,this._input=t,this._context.setMinimumAdditionalDepth(this.period+this.rocLookback);var i=this._context.new_var(r.Std.high(this._context)-r.Std.low(this._context)),s=this._context.new_var(r.Std.ema(i,this.period,this._context));return[r.Std.roc(s,this.rocLookback)]}}},{name:"Chande Kroll Stop",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},inputs:{in_0:10,in_1:1,in_2:9}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Long",histogramBase:0,joinPoints:!1},plot_1:{title:"Short",histogramBase:0,joinPoints:!1}},description:"Chande Kroll Stop",shortDescription:"Chande Kroll Stop",is_price_study:!0,inputs:[{id:"in_0",name:"p",defval:10,type:"integer",min:1,max:4999},{id:"in_1",name:"x",defval:1,type:"integer",min:1,max:1e12},{id:"in_2",name:"q",defval:9,type:"integer",min:1,max:1e12}],id:"Chande Kroll Stop@tv-basicstudies-1",scriptIdPart:"",name:"Chande Kroll Stop",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t,i){return e-t*i},this.f_1=function(e,t,i){return e+t*i},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2),o=r.Std.high(this._context),a=this._context.new_var(o),l=r.Std.highest(a,i,this._context),c=r.Std.atr(i,this._context),h=this.f_0(l,s,c),d=this._context.new_var(o),u=r.Std.lowest(d,i,this._context),p=this.f_1(u,s,c),_=this._context.new_var(h),m=r.Std.highest(_,n,this._context),g=this._context.new_var(p);return[r.Std.lowest(g,n,this._context),m]}}},{name:"Chande Momentum Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,
linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Chande Momentum Oscillator",shortDescription:"ChandeMO",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:2e3}],id:"Chande Momentum Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Chande Momentum Oscillator",format:{type:"price",precision:2}},constructor:function(){this.f_0=function(e){return r.Std.ge(e,0)?e:0},this.f_1=function(e){return r.Std.ge(e,0)?0:-e},this.f_2=function(e,t){return 100*e/t},this.f_3=function(e,t){return this.f_2(e-t,e+t)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.Std.close(this._context),n=this._context.new_var(s),o=r.Std.change(n),a=this.f_0(o),l=this.f_1(o),c=this._context.new_var(a),h=r.Std.sum(c,i,this._context),d=this._context.new_var(l),u=r.Std.sum(d,i,this._context);return[this.f_3(h,u)]}}},{name:"Chop Zone",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:5,trackPrice:!1,transparency:0,visible:!0,color:"#000080"}},palettes:{palette_0:{colors:{0:{color:"#26C6DA",width:1,style:0},1:{color:"#43A047",width:1,style:0},2:{color:"#A5D6A7",width:1,style:0},3:{color:u,width:1,style:0},4:{color:"#D50000",width:1,style:0},5:{color:"#E91E63",width:1,style:0},6:{color:"#FF6D00",width:1,style:0},7:{color:"#FFB74D",width:1,style:0},8:{color:"#FDD835",width:1,style:0}}}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Chop Zone",shortDescription:"Chop Zone",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"},2:{name:"Color 2"},3:{name:"Color 3"},4:{name:"Color 4"},5:{name:"Color 5"},6:{name:"Color 6"},7:{name:"Color 7"},8:{name:"Color 8"}},valToIndex:{0:0,1:1,2:2,3:3,4:4,5:5,6:6,7:7,8:8}}},inputs:[],id:"chop_zone@tv-basicstudies-1",scriptIdPart:"",name:"Chop Zone",format:{precision:0,type:"price"}},constructor:function(){this.f_0=function(){var e=r.Std.close(this._context),t=r.Std.hlc3(this._context),i=this._context.new_var(r.Std.high(this._context)),s=r.Std.highest(i,30,this._context),n=r.Std.lowest(i,30,this._context),o=25/(s-n)*n,a=this._context.new_var(e),l=this._context.new_var(r.Std.ema(a,34,this._context)),c=(l.get(1)-l.get(0))/t*o,h=r.Std.sqrt(1+c*c),d=r.Std.round(180*r.Std.acos(1/h)/3.141592653589793),u=r.Std.iff(r.Std.gt(c,0),-d,d),p=r.Std.and(r.Std.gt(u,-2.14),r.Std.le(u,-.71))?7:8,_=r.Std.and(r.Std.gt(u,-3.57),r.Std.le(u,-2.14))?6:p,m=r.Std.and(r.Std.gt(u,-5),r.Std.le(u,-3.57))?5:_,g=r.Std.le(u,-5)?4:m,f=r.Std.and(r.Std.lt(u,2.14),r.Std.ge(u,.71))?3:g,v=r.Std.and(r.Std.lt(u,3.57),r.Std.ge(u,2.14))?2:f,S=r.Std.and(r.Std.lt(u,5),r.Std.ge(u,3.57))?1:v;return[1,r.Std.ge(u,5)?0:S]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()
}}},{name:"Choppiness Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:61.8},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:38.2}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Choppiness Index",shortDescription:"CHOP",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Choppiness Index@tv-basicstudies-1",scriptIdPart:"",name:"Choppiness Index",format:{type:"price",precision:2},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i,s){return 100*r.Std.log10(e/(t-i))/s},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.Std.atr(1,this._context),n=this._context.new_var(s),o=r.Std.sum(n,i,this._context),a=r.Std.high(this._context),l=this._context.new_var(a),c=r.Std.highest(l,i,this._context),h=r.Std.low(this._context),d=this._context.new_var(h),u=r.Std.lowest(d,i,this._context),p=r.Std.log10(i);return[this.f_0(o,c,u,p)]}}},{name:"Commodity Channel Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:100},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-100}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:20,smoothingLine:"SMA",smoothingLength:20}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:2},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1,zorder:1}},description:"Commodity Channel Index",shortDescription:"CCI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:2e3},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:20,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"Commodity Channel Index@tv-basicstudies-1",scriptIdPart:"",name:"Commodity Channel Index",format:{precision:2,type:"price"},
usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i){return(e-t)/(.015*i)},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.hlc3(this._context),s=this._input(0),n=this._input(1),o=this._input(2);this._context.setMinimumAdditionalDepth(s+o);var a,l=this._context.new_var(i),c=r.Std.sma(l,s,this._context),h=this._context.new_var(i),d=r.Std.dev(h,s,this._context),u=this.f_0(i,c,d),p=this._context.new_var(u);return"EMA"===n?a=r.Std.ema(p,o,this._context):"WMA"===n?a=r.Std.wma(p,o,this._context):"SMA"===n&&(a=r.Std.sma(p,o,this._context)),[u,a]}}},{name:"Connors RSI",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:70},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:30}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:3,in_1:2,in_2:100}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"CRSI",histogramBase:0,joinPoints:!1,zorder:1}},description:"Connors RSI",shortDescription:"CRSI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"RSI Length",defval:3,type:"integer",min:1},{id:"in_1",name:"UpDown Length",defval:2,type:"integer",min:1},{id:"in_2",name:"ROC Length",defval:100,type:"integer",min:1}],id:"Connors RSI@tv-basicstudies-1",scriptIdPart:"",name:"Connors RSI",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){var e;this.f_1=function(e,t,i){var s=i.new_var(r.Std.max(r.Std.change(e),0));return r.Std.rma(s,t,i)},this.f_2=function(e,t,i){var s=i.new_var(-r.Std.min(r.Std.change(e),0));return r.Std.rma(s,t,i)},this.f_3=(e=0,function(t){var i=t.get(0),s=t.get(1);return e=i===s?0:i>s?r.Std.nz(e)<=0?1:r.Std.nz(e)+1:r.Std.nz(e)>=0?-1:r.Std.nz(e)-1,this._context.new_var(e)}),this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._context.new_var(i),n=this._input(0),o=this._input(1),a=this._input(2);this._context.setMinimumAdditionalDepth(a);var l=r.Std.rsi(this.f_1(s,n,this._context),this.f_2(s,n,this._context)),c=this.f_3(s),h=r.Std.rsi(this.f_1(c,o,this._context),this.f_2(c,o,this._context)),d=this._context.new_var(r.Std.roc(s,1)),u=r.Std.percentrank(d,a);return[r.Std.avg(l,h,u)]}}},{name:"Coppock Curve",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:10,in_1:14,in_2:11}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Coppock Curve",shortDescription:"Coppock Curve",is_price_study:!1,inputs:[{id:"in_0",name:"WMA Length",defval:10,
type:"integer",min:-1e12,max:5e3},{id:"in_1",name:"Long RoC Length",defval:14,type:"integer",min:1,max:4999},{id:"in_2",name:"Short RoC Length",defval:11,type:"integer",min:1,max:4999}],id:"Coppock Curve@tv-basicstudies-1",scriptIdPart:"",name:"Coppock Curve",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e+t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);this._context.setMinimumAdditionalDepth(i+Math.max(s,n));var o=r.Std.close(this._context),a=this._context.new_var(o),l=r.Std.roc(a,s),c=this._context.new_var(o),h=r.Std.roc(c,n),d=this.f_0(l,h),u=this._context.new_var(d);return[r.Std.wma(u,i,this._context)]}}},{name:"Correlation Coeff",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:4,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:"",in_1:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Correlation Coefficient",shortDescription:"CC",is_price_study:!1,inputs:[{id:"in_0",name:"sym",defval:"",type:"symbol"},{id:"in_1",name:"length",defval:20,type:"integer",min:1,max:2e3}],id:"Correlation Coeff@tv-basicstudies-1",scriptIdPart:"",name:"Correlation Coeff",format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._context.new_sym(this._input(0),r.Std.period(this._context))},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_unlimited_var(this._context.symbol.time),s=(this._input(0),r.Std.period(this._context),r.Std.close(this._context)),n=this._input(1);this._context.select_sym(1);var o=this._context.new_unlimited_var(this._context.symbol.time),a=r.Std.close(this._context),l=this._context.new_unlimited_var(a);this._context.select_sym(0);var c=l.adopt(o,i,0),h=this._context.new_var(s),d=this._context.new_var(c);return[r.Std.correlation(h,d,n,this._context)]}}},{name:"Correlation - Log",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Correlation - Log@tv-basicstudies-1",scriptIdPart:"",name:"Correlation - Log",description:"Correlation - Log",shortDescription:"Correlation - Log",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{instrument:"",instrument2:"",periods:25}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"instrument",name:"Instrument 1",type:"symbol",defval:"",confirm:!0},{id:"instrument2",name:"Instrument 2",type:"symbol",defval:"",confirm:!0},{id:"periods",name:"Periods",type:"integer",defval:25}],format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._context.new_sym(this._input(0),r.Std.period(this._context)),this._context.new_sym(this._input(1),r.Std.period(this._context)),this.period=this._input(2)},
this.correlationLog=function(e,t,i,s){var n=r.Std.sma(e,i,s),o=r.Std.sma(t,i,s),a=s.new_var(e.get()*t.get());return(r.Std.sma(a,i,s)-n*o)/Math.sqrt(r.Std.variance2(e,n,i)*r.Std.variance2(t,o,i))},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(this._context.symbol.time);this._context.select_sym(2);var s=this._context.new_var(r.Std.close(this._context)),n=this._context.new_var(r.Std.log(s.get()/s.get(1))),o=this._context.new_var(this._context.symbol.time);this._context.select_sym(1);var a=this._context.new_var(this._context.symbol.time),l=this._context.new_var(r.Std.close(this._context)),c=this._context.new_var(r.Std.log(l.get()/l.get(1))),h=this._context.new_var(n.adopt(o,a,0)),d=this._context.new_var(this.correlationLog(c,h,this.period,this._context)),u=this._context.new_var(d.adopt(a,i,0)).get(),p=r.Std.round(1e3*u)/1e3;return this._context.select_sym(0),[p]}}},{name:"Detrended Price Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:21,in_1:!1}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"DPO",histogramBase:0,joinPoints:!1,isHidden:!1,zorder:1}},description:"Detrended Price Oscillator",shortDescription:"DPO",is_price_study:!1,is_hidden_study:!1,id:"detrended_price_oscillator@tv-basicstudies-1",bands:[{id:"hline_0",name:"Zero",isHidden:!1,zorder:-1}],inputs:[{id:"in_0",name:"Period",defval:21,type:"integer",min:1,max:1e12},{id:"in_1",name:"isCentered",defval:!1,type:"bool"}],scriptIdPart:"",name:"Detrended Price Oscillator",format:{type:"price",precision:2},usePlotsZOrder:!0},constructor:function(){this.f_0=function(){var e=this._input(0),t=this._input(1),i=Math.floor(e/2+1);this._context.setMinimumAdditionalDepth(e+i);var s=this._context.new_var(r.Std.close(this._context)),n=this._context.new_var(r.Std.sma(s,e,this._context)),o=this._context.new_var(r.Std.close(this._context)).get(i)-n,a=r.Std.close(this._context)-n.get(i);return[t?o:a,t?-i:0]},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0();return[{value:i[0],offset:i[1]}]}}},{name:"Directional Movement Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_3:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#F50057"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FFA726"},plot_4:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#ab47bc"}},inputs:{in_0:14,in_1:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"},{id:"plot_3",type:"line"},{id:"plot_4",type:"line"}],styles:{
plot_0:{title:"+DI",histogramBase:0,joinPoints:!1},plot_1:{title:"-DI",histogramBase:0,joinPoints:!1},plot_2:{title:"DX",histogramBase:0,joinPoints:!1},plot_3:{title:"ADX",histogramBase:0,joinPoints:!1},plot_4:{title:"ADXR",histogramBase:0,joinPoints:!1}},description:"Directional Movement",shortDescription:"DMI",is_price_study:!1,inputs:[{id:"in_0",name:"DI Length",defval:14,type:"integer",min:1,max:2e3},{id:"in_1",name:"ADX Smoothing",defval:14,type:"integer",min:1,max:50}],id:"Directional Movement Index@tv-basicstudies-1",scriptIdPart:"",name:"Directional Movement Index",format:{precision:4,type:"price"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1);return this._context.setMinimumAdditionalDepth(2*i+s),r.Std.dmi(i,s,this._context)}}},{name:"Donchian Channels",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:95,visible:!0}},inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Lower",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Basis",histogramBase:0,joinPoints:!1}},description:"Donchian Channels",shortDescription:"DC",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_0",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"length",defval:20,type:"integer",min:1,max:2e3}],id:"Donchian Channels@tv-basicstudies-1",scriptIdPart:"",name:"Donchian Channels",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.Std.low(this._context),n=this._context.new_var(s),o=r.Std.lowest(n,i,this._context),a=r.Std.high(this._context),l=this._context.new_var(a),c=r.Std.highest(l,i,this._context);return[o,c,r.Std.avg(c,o)]}}},{name:"Double Exponential Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Double EMA",shortDescription:"DEMA",is_price_study:!0,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1e4}],id:"Double Exponential Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Double Exponential Moving Average",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return 2*e-t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);this._context.setMinimumAdditionalDepth(2*i)
;var s=r.Std.close(this._context),n=this._context.new_var(s),o=r.Std.ema(n,i,this._context),a=this._context.new_var(o),l=r.Std.ema(a,i,this._context);return[this.f_0(o,l)]}}},{name:"Ease of Movement",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"}},inputs:{in_0:1e4,in_1:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Ease Of Movement",shortDescription:"EOM",is_price_study:!1,inputs:[{id:"in_0",name:"Divisor",defval:1e4,type:"integer",min:1,max:1e9},{id:"in_1",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Ease of Movement@tv-basicstudies-1",scriptIdPart:"",name:"Ease of Movement",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i,s,r){return e*t*(i-s)/r},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.Std.hl2(this._context),o=this._context.new_var(n),a=r.Std.change(o),l=this.f_0(i,a,r.Std.high(this._context),r.Std.low(this._context),r.Std.volume(this._context)),c=this._context.new_var(l);return[r.Std.sma(c,s,this._context)]}}},{name:"Elders Force Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:13}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Elder's Force Index",shortDescription:"EFI",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"length",defval:13,type:"integer",min:1,max:2e3}],id:"Elders Force Index@tv-basicstudies-1",scriptIdPart:"",name:"Elders Force Index",format:{type:"volume"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return e*t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.Std.close(this._context),n=this._context.new_var(s),o=r.Std.change(n),a=this.f_0(o,r.Std.volume(this._context)),l=this._context.new_var(a);return[r.Std.ema(l,i,this._context)]}}},{name:"EMA Cross",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"},plot_2:{linestyle:0,linewidth:4,plottype:3,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:26}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Short",histogramBase:0,joinPoints:!1},plot_1:{title:"Long",histogramBase:0,joinPoints:!1},plot_2:{title:"Crosses",histogramBase:0,joinPoints:!1}},description:"EMA Cross",shortDescription:"EMA Cross",is_price_study:!0,inputs:[{id:"in_0",
name:"Short",defval:9,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0","plot_2"]},{id:"in_1",name:"Long",defval:26,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1","plot_2"]}],id:"EMA Cross@tv-basicstudies-1",scriptIdPart:"",name:"EMA Cross",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e?t:r.Std.na()},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.Std.close(this._context),o=this._context.new_var(n),a=r.Std.ema(o,i,this._context),l=this._context.new_var(n),c=r.Std.ema(l,s,this._context),h=a,d=c,u=r.Std.cross(a,c,this._context);return[h,d,this.f_0(u,a)]}}},{name:"Envelopes",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:95,visible:!0}},inputs:{in_0:20,in_1:10,in_2:10,in_3:"Simple",in_4:"close"}},plots:[{id:"plot_1",type:"line"},{id:"plot_0",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Average",histogramBase:0,joinPoints:!1},plot_1:{title:"Upper",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Envelopes",shortDescription:"Envelopes",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_1",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"Length",defval:20,type:"integer",min:1,max:2e3},{id:"in_1",name:"Upper Percentage",defval:2,type:"float",min:0},{id:"in_2",name:"Lower Percentage",defval:2,type:"float",min:0},{id:"in_3",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]},{id:"in_4",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]}],id:"Envelope@tv-basicstudies-1",scriptIdPart:"",name:"Envelopes",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e*(1+t)},this.f_1=function(e,t){return e*(1-t)},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r.Std[this._input(4)](this._context)),s=r.Std.sma(i,this._input(0),this._context);return"Exponential"===this._input(3)?s=r.Std.ema(i,this._input(0),this._context):"Weighted"===this._input(3)&&(s=r.Std.wma(i,this._input(0),this._context)),[this.f_0(s,this._input(1)/100),s,this.f_1(s,this._input(2)/100)]}}},{name:"Standard Error",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Standard Error@tv-basicstudies-1",scriptIdPart:"",name:"Standard Error",description:"Standard Error",shortDescription:"Standard Error",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"}},inputs:{length:14}},
styles:{plot_0:{title:"Plot"}},inputs:[{id:"length",type:"integer",name:"Length",min:3}],format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0)},this.main=function(e,t){this._context=e,this._input=t;for(var i,s,n=this._context.new_var(r.Std.close(this._context)),o=0,a=0,l=0;l0?1:3,i=r.Std.change(this._context.new_var(e));return t-(r.Std.le(i,0)?0:1)},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std[this._input(2)](this._context),s=this._input(0),n=this._input(1),o=this._input(3);this._context.setMinimumAdditionalDepth(Math.max(s,n)+o);var a=this._context.new_var(i),l=r.Std.ema(a,s,this._context),c=this._context.new_var(i),h=r.Std.ema(c,n,this._context),d=this.f_0(l,h),u=this._context.new_var(d),p=r.Std.ema(u,o,this._context),_=this.f_0(d,p);return[_,d,p,this.f_1(_)]}}},{name:"Moving Average Exponential",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},inputs:{length:9,source:"close",offset:0,smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1}},description:"Moving Average Exponential",shortDescription:"EMA",is_price_study:!0,inputs:[{id:"length",name:"Length",defval:9,type:"integer",min:1,max:1e4},{id:"source",name:"Source",defval:"close",type:"source",
options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"offset",name:"Offset",defval:0,type:"integer",min:-1e4,max:1e4},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"Moving Average Exponential@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Exponential",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.Std[this._input(1)](this._context),s=this._input(0),n=this._input(2),o=this._input(3),a=this._input(4);this._context.setMinimumAdditionalDepth(s+a);var l,c=this._context.new_var(i),h=r.Std.ema(c,s,this._context),d=this._context.new_var(h);return"EMA"===o?l=r.Std.ema(d,a,this._context):"WMA"===o?l=r.Std.wma(d,a,this._context):"SMA"===o&&(l=r.Std.sma(d,a,this._context)),[{value:h,offset:n},{value:l,offset:n}]}}},{name:"Moving Average Weighted",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9,in_1:"close",in_2:0}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Moving Average Weighted",shortDescription:"WMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:2e3},{id:"in_1",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_2",name:"Offset",defval:0,type:"integer",min:-1e4,max:1e4}],id:"Moving Average Weighted@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Weighted",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.Std[this._input(1)](this._context),s=this._input(0),n=this._input(2),o=this._context.new_var(i);return[{value:r.Std.wma(o,s,this._context),offset:n}]}}},{name:"Moving Average Double",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"Moving Average Double@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Double",description:"Moving Average Double",shortDescription:"Moving Average Double",is_price_study:!0,plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"},plot_1:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{firstPeriods:14,secondPeriods:21,method:"Simple"}},styles:{plot_0:{title:"Plot 1"},plot_1:{title:"Plot 2"}},inputs:[{id:"firstPeriods",name:"1st Period",type:"integer",defval:14,min:1,max:1e4},{id:"secondPeriods",name:"2nd Period",type:"integer",defval:21,min:1,max:1e4},{id:"method",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]}],format:{type:"inherit"}},constructor:function(){
this.main=function(e,t){this._context=e,this._input=t;var i,s,n=this._context.new_var(r.Std.close(this._context));return"Exponential"===this._input(2)?(i=r.Std.ema(n,this._input(0),this._context),s=r.Std.ema(n,this._input(1),this._context)):"Weighted"===this._input(2)?(i=r.Std.wma(n,this._input(0),this._context),s=r.Std.wma(n,this._input(1),this._context)):(i=r.Std.sma(n,this._input(0),this._context),s=r.Std.sma(n,this._input(1),this._context)),[i,s]}}},{name:"Moving Average Triple",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Triple@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Triple",description:"Moving Average Triple",shortDescription:"Moving Average Triple",plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#FF6D00"},plot_1:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#2196F3"},plot_2:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#26C6DA"}},inputs:{firstPeriods:14,secondPeriods:21,thirdPeriods:35,method:"Simple"}},styles:{plot_0:{title:"Plot 1"},plot_1:{title:"Plot 2"},plot_2:{title:"Plot 3"}},inputs:[{id:"firstPeriods",name:"1st Period",type:"integer",defval:14,min:1,max:1e4,hideWhenPlotsHidden:["plot_0"]},{id:"secondPeriods",name:"2nd Period",type:"integer",defval:21,min:1,max:1e4,hideWhenPlotsHidden:["plot_1"]},{id:"thirdPeriods",name:"3rd Period",type:"integer",defval:35,min:1,max:1e4,hideWhenPlotsHidden:["plot_2"]},{id:"method",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]}],format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i,s,n,o=this._context.new_var(r.Std.close(this._context));return"Exponential"===this._input(3)?(i=r.Std.ema(o,this._input(0),this._context),s=r.Std.ema(o,this._input(1),this._context),n=r.Std.ema(o,this._input(2),this._context)):"Weighted"===this._input(3)?(i=r.Std.wma(o,this._input(0),this._context),s=r.Std.wma(o,this._input(1),this._context),n=r.Std.wma(o,this._input(2),this._context)):(i=r.Std.sma(o,this._input(0),this._context),s=r.Std.sma(o,this._input(1),this._context),n=r.Std.sma(o,this._input(2),this._context)),[i,s,n]}}},{name:"Moving Average Adaptive",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Adaptive@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Adaptive",description:"Moving Average Adaptive",shortDescription:"Moving Average Adaptive",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#AB47BC"}},inputs:{periods:10}},styles:{plot_0:{title:"Plot 1"}},inputs:[{id:"periods",name:"Period",type:"integer",defval:10,min:2,max:1e4}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,
this._input=t,this.periods=this._input(0)},this.ama=function(e,t){var i=this.periods,s=this._context.new_var(),n=e.get(),o=r.Std.stdev(t,i,this._context),a=r.Std.log(n/e.get(i))/(o*Math.sqrt(i)),l=.1*Math.abs(a),c=(n-s.get(1))*l+s.get(1);return s.set(isNaN(c)?n:c),c},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r.Std.close(this._context)),s=this._context.new_var(r.Std.log(i.get()/i.get(1)));return[this.ama(i,s)]}}},{name:"Moving Average Hamming",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Hamming@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Hamming",description:"Moving Average Hamming",shortDescription:"Moving Average Hamming",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#4CAF50"}},inputs:{periods:10}},styles:{plot_0:{title:"Plot 1"}},inputs:[{id:"periods",name:"Period",type:"integer",defval:10,min:1,max:1e4}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.periods=this._input(0);for(var i=[],s=0,r=1;r<=this.periods;++r){var n=Math.sin((1+r)/this.periods*Math.PI/2);i.unshift(n),s+=n}this.hmaFactors=i,this.hmaFactorsSum=s},this.hma=function(e){for(var t=this.periods,i=0,s=0;sthis._context.new_var(s).get(1)?1:0,[100*r.Std.sma(this._context.new_var(i),this.rollingPeriod,this._context)]}}},{name:"Net Volume",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Net Volume",shortDescription:"Net Volume",is_price_study:!1,inputs:[],id:"Net Volume@tv-basicstudies-1",scriptIdPart:"",name:"Net Volume",
format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i){return r.Std.gt(e,0)?t:r.Std.lt(i,0)?-t:0*t},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._context.new_var(i),n=r.Std.change(s);return[this.f_0(n,r.Std.volume(this._context),n)]}}},{name:"On Balance Volume",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},inputs:{smoothingLine:"SMA",smoothingLength:9}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1}},description:"On Balance Volume",shortDescription:"OBV",is_price_study:!1,inputs:[{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:9,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"On Balance Volume@tv-basicstudies-1",scriptIdPart:"",name:"On Balance Volume",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t,i){return r.Std.gt(e,0)?t:r.Std.lt(i,0)?-t:0*t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.Std.close(this._context),o=this._context.new_var(n),a=r.Std.change(o),l=this.f_0(a,r.Std.volume(this._context),a),c=r.Std.cum(l,this._context);this._context.setMinimumAdditionalDepth(s);var h,d=this._context.new_var(c);return"EMA"===i?h=r.Std.ema(d,s,this._context):"WMA"===i?h=r.Std.wma(d,s,this._context):"SMA"===i&&(h=r.Std.sma(d,s,this._context)),[c,h]}}},{name:"Parabolic SAR",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:3,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:.02,in_1:.02,in_2:.2}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Parabolic SAR",shortDescription:"SAR",is_price_study:!0,inputs:[{id:"in_0",name:"start",defval:.02,type:"float",min:-1e12,max:1e12},{id:"in_1",name:"increment",defval:.02,type:"float",min:-1e12,max:1e12},{id:"in_2",name:"maximum",defval:.2,type:"float",min:-1e12,max:1e12}],id:"Parabolic SAR@tv-basicstudies-1",scriptIdPart:"",name:"Parabolic SAR",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);return[r.Std.sar(i,s,n,this._context)]}}},{name:"Price Channel",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#F50057"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#F50057"
},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:20,in_1:0}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Highprice Line",histogramBase:0,joinPoints:!1},plot_1:{title:"Lowprice Line",histogramBase:0,joinPoints:!1},plot_2:{title:"Centerprice Line",histogramBase:0,joinPoints:!1}},description:"Price Channel",shortDescription:"PC",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:20,type:"integer",min:1,max:2e3},{id:"in_1",name:"Offset Length",defval:0,type:"integer",min:1,max:2e3}],id:"Price Channel@tv-basicstudies-1",scriptIdPart:"",name:"Price Channel",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.high(this._context),s=this._context.new_var(i),n=r.Std.low(this._context),o=this._context.new_var(n),a=this._input(0),l=this._input(1),c=r.Std.highest(s,a,this._context),h=r.Std.lowest(o,a,this._context);return[{value:c,offset:l},{value:h,offset:l},{value:r.Std.avg(c,h),offset:l}]}}},{name:"Price Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:u}},inputs:{in_0:10,in_1:21}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Price Oscillator",shortDescription:"PPO",is_price_study:!1,inputs:[{id:"in_0",name:"shortlen",defval:10,type:"integer",min:1,max:2e3},{id:"in_1",name:"longlen",defval:21,type:"integer",min:1,max:2e3}],id:"Price Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Price Oscillator",format:{type:"price",precision:2}},constructor:function(){this.f_0=function(e,t){return(e-t)/t*100},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.Std.sma(o,s,this._context),l=this._context.new_var(i),c=r.Std.sma(l,n,this._context);return[this.f_0(a,c)]}}},{name:"Price Volume Trend",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"PVT",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Price Volume Trend",shortDescription:"PVT",is_price_study:!1,is_hidden_study:!1,id:"price_volume_trend@tv-basicstudies-1",inputs:[],scriptIdPart:"",name:"Price Volume Trend",format:{type:"volume"}},constructor:function(){this.f_0=function(){var e=this._context.new_var(r.Std.close(this._context));return[r.Std.cum(r.Std.change(e)/e.get(1)*r.Std.volume(this._context),this._context)]},this.main=function(e,t){return this._context=e,this._input=t,[this.f_0()[0]]}}},{name:"Rate Of Change",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,
transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"ROC",histogramBase:0,joinPoints:!1,isHidden:!1,zorder:1}},description:"Rate Of Change",shortDescription:"ROC",is_price_study:!1,bands:[{id:"hline_0",name:"Zero Line",isHidden:!1,zorder:-1}],inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1e12}],id:"rate_of_change@tv-basicstudies-1",scriptIdPart:"",name:"Rate Of Change",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r.Std.close(this._context)),s=this._input(0);return[100*(i.get(0)-i.get(s))/i.get(s)]}}},{name:"Relative Strength Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#7E57C2"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:70,zorder:-1.1},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:50,zorder:-1.11},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:30,zorder:-1.111}],filledAreasStyle:{fill_0:{color:"#7E57C2",transparency:90,visible:!0}},inputs:{length:14,smoothingLine:"SMA",smoothingLength:14}},plots:[{id:"plot_0",type:"line"},{id:"smoothedMA",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1},smoothedMA:{title:"Smoothed MA",histogramBase:0,joinPoints:!1,zorder:2}},description:"Relative Strength Index",shortDescription:"RSI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_2",name:"MiddleLimit",zorder:-1.11},{id:"hline_1",name:"LowerLimit",zorder:-1.111}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"length",name:"Length",defval:14,type:"integer",min:1,max:2e3},{id:"smoothingLine",name:"Smoothing Line",defval:"SMA",type:"text",options:["SMA","EMA","WMA"],hideWhenPlotsHidden:["smoothedMA"]},{id:"smoothingLength",name:"Smoothing Length",defval:14,type:"integer",min:1,max:1e4,hideWhenPlotsHidden:["smoothedMA"]}],id:"Relative Strength Index@tv-basicstudies-1",scriptIdPart:"",name:"Relative Strength Index",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e){return r.Std.max(e,0)},this.f_1=function(e){return-r.Std.min(e,0)},this.f_2=function(e,t){return r.Std.eq(e,0)?100:r.Std.eq(t,0)?0:100-100/(1+t/e)},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._input(2);this._context.setMinimumAdditionalDepth(s+o)
;var a,l=this._context.new_var(i),c=r.Std.change(l),h=this.f_0(c),d=this._context.new_var(h),u=r.Std.rma(d,s,this._context),p=this.f_1(c),_=this._context.new_var(p),m=r.Std.rma(_,s,this._context),g=this.f_2(m,u),f=this._context.new_var(g);return"EMA"===n?a=r.Std.ema(f,o,this._context):"WMA"===n?a=r.Std.wma(f,o,this._context):"SMA"===n&&(a=r.Std.sma(f,o,this._context)),[{value:g},{value:a}]}}},{name:"Relative Vigor Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:u},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"RVGI",histogramBase:0,joinPoints:!1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1}},description:"Relative Vigor Index",shortDescription:"RVGI",is_price_study:!1,inputs:[{id:"in_0",name:"Length",defval:10,type:"integer",min:1,max:2e3}],id:"Relative Vigor Index@tv-basicstudies-1",scriptIdPart:"",name:"Relative Vigor Index",format:{precision:4,type:"price"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e,t){return e/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(r.Std.close(this._context),r.Std.open(this._context)),n=this._context.new_var(s),o=r.Std.swma(n,this._context),a=this._context.new_var(o),l=r.Std.sum(a,i,this._context),c=this.f_0(r.Std.high(this._context),r.Std.low(this._context)),h=this._context.new_var(c),d=r.Std.swma(h,this._context),u=this._context.new_var(d),p=r.Std.sum(u,i,this._context),_=this.f_1(l,p),m=this._context.new_var(_);return[_,r.Std.swma(m,this._context)]}}},{name:"Relative Volatility Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#7E57C2"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:20}],filledAreasStyle:{fill_0:{color:"#7E57C2",transparency:90,visible:!0}},inputs:{in_0:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Relative Volatility Index",shortDescription:"RVI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:2e3}],id:"Relative Volatility Index@tv-basicstudies-1",scriptIdPart:"",name:"Relative Volatility Index",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return r.Std.le(e,0)?0:t},this.f_1=function(e,t){return r.Std.gt(e,0)?0:t},this.f_2=function(e,t){return e/(e+t)*100},this.main=function(e,t){this._context=e,
this._input=t;var i=this._input(0);this._context.setMinimumAdditionalDepth(i+12);var s=r.Std.close(this._context),n=this._context.new_var(s),o=r.Std.stdev(n,i,this._context),a=this._context.new_var(s),l=r.Std.change(a),c=this.f_0(l,o),h=this._context.new_var(c),d=r.Std.ema(h,14,this._context),u=this.f_1(l,o),p=this._context.new_var(u),_=r.Std.ema(p,14,this._context);return[this.f_2(d,_)]}}},{name:"SMI Ergodic Indicator/Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},plot_2:{linestyle:0,linewidth:1,plottype:1,trackPrice:!1,transparency:0,visible:!0,color:c}},inputs:{in_0:5,in_1:20,in_2:5}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Indicator",histogramBase:0,joinPoints:!1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1},plot_2:{title:"Oscillator",histogramBase:0,joinPoints:!1}},description:"SMI Ergodic Indicator/Oscillator",shortDescription:"SMIIO",is_price_study:!1,inputs:[{id:"in_0",name:"shortlen",defval:5,type:"integer",min:1,max:2e3},{id:"in_1",name:"longlen",defval:20,type:"integer",min:1,max:2e3},{id:"in_2",name:"siglen",defval:5,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1"]}],id:"SMI Ergodic Indicator/Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"SMI Ergodic Indicator/Oscillator",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e-t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);this._context.setMinimumAdditionalDepth(i+s+n);var o=r.Std.close(this._context),a=this._context.new_var(o),l=r.Std.tsi(a,i,s,this._context),c=this._context.new_var(l),h=r.Std.ema(c,n,this._context);return[l,h,this.f_0(l,h)]}}},{name:"Smoothed Moving Average",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#673AB7"}},inputs:{in_0:7,in_1:"close"}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Smoothed Moving Average",shortDescription:"SMMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:7,type:"integer",min:1,max:1e12},{id:"in_1",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]}],id:"smoothed_moving_average@tv-basicstudies-1",scriptIdPart:"",name:"Smoothed Moving Average",format:{type:"inherit"}},constructor:function(){this.f_0=function(){var e=this._input(0),t=r.Std[this._input(1)](this._context);return[r.Std.smma(t,e,this._context)]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Standard Deviation",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,
id:"Standard Deviation@tv-basicstudies-1",scriptIdPart:"",name:"Standard Deviation",description:"Standard Deviation",shortDescription:"Standard Deviation",is_price_study:!1,plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:u}},inputs:{periods:5,deviations:1}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"periods",name:"Periods",type:"integer"},{id:"deviations",name:"Deviations",type:"float"}],format:{precision:2,type:"price"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._context.new_var(r.Std.close(this._context));return[r.Std.stdev(n,i,this._context)*s]}}},{name:"Stochastic",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:20}],filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:14,in_1:1,in_2:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"%K",histogramBase:0,joinPoints:!1,zorder:1.1},plot_1:{title:"%D",histogramBase:0,joinPoints:!1,zorder:1.11}},description:"Stochastic",shortDescription:"Stoch",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"%K Length",defval:14,type:"integer",min:1,max:1e4},{id:"in_1",name:"%K Smoothing",defval:1,type:"integer",min:1,max:1e4},{id:"in_2",name:"%D Smoothing",defval:3,type:"integer",min:1,max:1e4}],id:"Stochastic@tv-basicstudies-1",scriptIdPart:"",name:"Stochastic",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);this._context.setMinimumAdditionalDepth(i+s+n);var o=r.Std.close(this._context),a=r.Std.high(this._context),l=r.Std.low(this._context),c=this._context.new_var(o),h=this._context.new_var(a),d=this._context.new_var(l),u=r.Std.stoch(c,h,d,i,this._context),p=this._context.new_var(u),_=r.Std.sma(p,s,this._context),m=this._context.new_var(_);return[_,r.Std.sma(m,n,this._context)]}}},{name:"Stochastic RSI",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:80},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:20}],
filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:14,in_1:14,in_2:3,in_3:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"%K",histogramBase:0,joinPoints:!1,zorder:1.1},plot_1:{title:"%D",histogramBase:0,joinPoints:!1,zorder:1.11}},description:"Stochastic RSI",shortDescription:"Stoch RSI",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"lengthRSI",defval:14,type:"integer",min:1,max:1e4},{id:"in_1",name:"lengthStoch",defval:14,type:"integer",min:1,max:1e4},{id:"in_2",name:"smoothK",defval:3,type:"integer",min:1,max:1e4},{id:"in_3",name:"smoothD",defval:3,type:"integer",min:1,max:1e4}],id:"Stochastic RSI@tv-basicstudies-1",scriptIdPart:"",name:"Stochastic RSI",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_1=function(e,t,i){var s=i.new_var(r.Std.max(r.Std.change(e),0));return r.Std.rma(s,t,i)},this.f_2=function(e,t,i){var s=i.new_var(-r.Std.min(r.Std.change(e),0));return r.Std.rma(s,t,i)},this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._input(0),n=this._input(1),o=this._input(2),a=this._input(3);e.setMinimumAdditionalDepth(s+n+o+a);var l=this._context.new_var(i),c=r.Std.rsi(this.f_1(l,s,this._context),this.f_2(l,s,this._context)),h=this._context.new_var(c),d=this._context.new_var(c),u=this._context.new_var(c),p=r.Std.stoch(h,d,u,n,this._context),_=this._context.new_var(p),m=r.Std.sma(_,o,this._context),g=this._context.new_var(m);return[m,r.Std.sma(g,a,this._context)]}}},{name:"TRIX",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:18}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"TRIX",histogramBase:0,joinPoints:!1,zorder:1}},description:"TRIX",shortDescription:"TRIX",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"length",defval:18,type:"integer",min:1,max:2e3}],id:"TRIX@tv-basicstudies-1",scriptIdPart:"",name:"TRIX",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e){return r.Std.log(e)},this.f_1=function(e){return 1e4*e},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);e.setMinimumAdditionalDepth(3*i);var s=this.f_0(r.Std.close(this._context)),n=this._context.new_var(s),o=r.Std.ema(n,i,this._context),a=this._context.new_var(o),l=r.Std.ema(a,i,this._context),c=this._context.new_var(l),h=r.Std.ema(c,i,this._context),d=this._context.new_var(h),u=r.Std.change(d);return[this.f_1(u)]}}},{name:"Triple EMA",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,
linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Triple EMA",shortDescription:"TEMA",is_price_study:!0,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1e4}],id:"Triple EMA@tv-basicstudies-1",scriptIdPart:"",name:"Triple EMA",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t,i){return 3*(e-t)+i},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0);this._context.setMinimumAdditionalDepth(3*i);var s=r.Std.close(this._context),n=this._context.new_var(s),o=r.Std.ema(n,i,this._context),a=this._context.new_var(o),l=r.Std.ema(a,i,this._context),c=this._context.new_var(l),h=r.Std.ema(c,i,this._context);return[this.f_0(o,l,h)]}}},{name:"True Strength Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#E91E63"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:25,in_1:13,in_2:13}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"True Strength Index",histogramBase:0,joinPoints:!1,zorder:1.1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1,zorder:1.11}},description:"True Strength Index",shortDescription:"True Strength Index",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"long",defval:25,type:"integer",min:1,max:4999},{id:"in_1",name:"short",defval:13,type:"integer",min:1,max:4999},{id:"in_2",name:"siglen",defval:13,type:"integer",min:1,max:4999,hideWhenPlotsHidden:["plot_1"]}],id:"True Strength Indicator@tv-basicstudies-1",scriptIdPart:"",name:"True Strength Index",format:{precision:4,type:"price"},usePlotsZOrder:!0},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2);this._context.setMinimumAdditionalDepth(this._input(0)+this._input(1)+this._input(2));var o=r.Std.close(this._context),a=this._context.new_var(o),l=r.Std.tsi(a,s,i,this._context),c=this._context.new_var(l);return[l,r.Std.ema(c,n,this._context)]}}},{name:"Trend Strength Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Trend Strength Index@tv-basicstudies-1",scriptIdPart:"",name:"Trend Strength Index",description:"Trend Strength Index",shortDescription:"Trend Strength Index",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:c}},inputs:{periods:14}},styles:{plot_0:{title:"Plot",histogramBase:0}},inputs:[{id:"periods",type:"integer",name:"Periods"}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),
this.invertedPeriod=1/this.period,this.sumX=(this.period-1)*this.period/2,this.sumXX=(this.period-1)*this.period*(2*this.period-1)/6,this.invertedPeriodSumXSumX=this.invertedPeriod*this.sumX*this.sumX},this.trendStrengthIndex=function(){for(var e=this._context.new_var(r.Std.close(this._context)),t=r.Std.sum(e,this.period,this._context),i=0,s=0,n=0;n0?1:-1:a/(l=Math.sqrt(l))},this.main=function(e,t){return this._context=e,this._input=t,[this.trendStrengthIndex()]}}},{name:"Typical Price",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"TypicalPrice@tv-basicstudies-1",scriptIdPart:"",name:"Typical Price",description:"Typical Price",shortDescription:"Typical Price",is_price_study:!0,plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#FF6D00"}},inputs:{}},styles:{plot_0:{title:"Plot"}},inputs:[],format:{type:"inherit"}},constructor:function(){this.main=function(e,t){return this._context=e,this._input=t,[r.Std.hlc3(this._context)]}}},{name:"Ultimate Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:a}},inputs:{in_0:7,in_1:14,in_2:28}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"UO",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Ultimate Oscillator",shortDescription:"UO",is_price_study:!1,inputs:[{id:"in_0",name:"length7",defval:7,type:"integer",min:1,max:1e12},{id:"in_1",name:"length14",defval:14,type:"integer",min:1,max:1e12},{id:"in_2",name:"length28",defval:28,type:"integer",min:1,max:1e12}],id:"ultimate_oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Ultimate Oscillator",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t,i){var s=this._context.new_var(e),n=this._context.new_var(t);return[r.Std.sum(s,i,this._context)/r.Std.sum(n,i,this._context)]},this.f_1=function(){var e=this._input(0),t=this._input(1),i=this._input(2),s=this._context.new_var(r.Std.close(this._context)),n=r.Std.max(r.Std.high(this._context),s.get(1)),o=this._context.new_var(r.Std.close(this._context)),a=r.Std.min(r.Std.low(this._context),o.get(1)),l=r.Std.close(this._context)-a,c=n-a,h=this.f_0(l,c,e),d=this.f_0(l,c,t),u=this.f_0(l,c,i);return[100*(4*h[0]+2*d[0]+u[0])/7]},this.main=function(e,t){return this._context=e,this._input=t,this.f_1()}}},{name:"Volatility Close-to-Close",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Volatility Close-to-Close@tv-basicstudies-1",scriptIdPart:"",name:"Volatility Close-to-Close",description:"Volatility Close-to-Close",shortDescription:"Volatility Close-to-Close",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,
visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#2196F3"}},inputs:{periods:10,daysPerYear:252}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"periods",name:"Periods",type:"integer",defval:10,min:2},{id:"daysPerYear",name:"Days Per Year",type:"integer",defval:252,min:1,max:366}],format:{precision:2,type:"percent"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.daysPerYear=this._input(1)},this.stdev=function(e,t,i){var s=this.variance(e,t,i);return r.Std.sqrt(s)},this.variance=function(e,t,i){var s=r.Std.sma(e,t,i);return this.variance2(e,s,t)},this.variance2=function(e,t,i){var s,r,n=0;for(s=0;s0&&(l=.12*this.square(e.get()-s.get(1))/this.marketClosedPercentage+.88*l/(1-this.marketClosedPercentage)),l/=a,l*=this.secondsPerYear;var c=this._context.new_var(l);return 100*Math.sqrt(r.Std.sum(c,this.period,this._context)/this.period)},this.main=function(e,t){return this._context=e,this._input=t,[this.volatilityOHLC()]}}},{name:"Volatility Index",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Volatility Index@tv-basicstudies-1",scriptIdPart:"",name:"Volatility Index",description:"Volatility Index",shortDescription:"Volatility Index",plots:[{id:"plot_0",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:c}},inputs:{periods:10,atrMult:3,method:"Wilder Smoothing"}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"periods",name:"Periods",type:"integer"},{id:"atrMult",name:"ATR Mult",type:"float"},{id:"method",name:"Method",type:"text",defval:"Exponential",options:["Exponential","Wilder Smoothing"]}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.atrMult=this._input(1),this.maMethod=this._input(2),this.nextsar=null,this.position=null,this.sic=null,this.bars=[],this.count=0,this.lastSar=null,this._context.setMinimumAdditionalDepth("Exponential"===this.maMethod?2*this.period+2:this.period)},this.computeATR=function(){var e=r.Std.high(this._context)-r.Std.low(this._context),t=r.Std.high(this._context)-this.bars[this.bars.length-2],i=this.bars[this.bars.length-2]-r.Std.low(this._context);return this.tr=Math.max(e,t,i),"Exponential"===this.maMethod?this.atr=r.Std.ema(this._context.new_var(this.tr),this.period,this._context):this.atr=this.tr/this.period+(1-1/this.period)*this.atr,this.atr*this.atrMult},this.calculateVolatility=function(){if(r.Std.close(this._context)===this.bars[this.bars.length-1])return this.lastSar;if(this.bars.push(r.Std.close(this._context)),1===this.count)this.atr=r.Std.high(this._context)-r.Std.low(this._context),this.sic=r.Std.close(this._context);else if(this.countthis.sic&&(this.sic=r.Std.close(this._context))}else if(this.count===this.period){e=r.Std.high(this._context)-r.Std.low(this._context),t=r.Std.high(this._context)-this.bars[this.bars.length-2],i=this.bars[this.bars.length-2]-r.Std.low(this._context);this.atr+=Math.max(e,t,i),this.atr*=1/this.period,r.Std.close(this._context)>this.sic&&(this.sic=r.Std.close(this._context)),this.position="LONG",this.nextsar=this.sic-this.atr*this.atrMult}else{var s=this.nextsar;"LONG"===this.position?r.Std.close(this._context)s?(this.position="LONG",this.sic=r.Std.close(this._context),this.nextsar=this.sic-this.computeATR()):(this.position="SHORT",this.sic=Math.min(r.Std.close(this._context),this.sic),this.nextsar=this.sic+this.computeATR())),this.lastSar=s}return this.count++,s},this.main=function(e,t){return this._context=e,this._input=t,this._context.select_sym(0),[this.calculateVolatility()]}}},{name:"VWAP",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{inputs:{in_0:"hlc3",in_anchor:"Session"},styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:0,transparency:0,visible:!0,color:"#2196F3"}}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"VWAP",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"VWAP",shortDescription:"VWAP",is_price_study:!0,inputs:[{id:"in_0",name:"Source",defval:"hlc3",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_anchor",name:"Anchor Period",defval:"Session",type:"text",options:["Session","Week","Month","Quarter","Year","Decade","Century"]}],id:"VWAP@tv-basicstudies-1",scriptIdPart:"",name:"VWAP",format:{type:"inherit"}},constructor:function(){this.f_1=function(e){e.reset_hist()},this.createAnchorChecker=function(e,t){switch(t){case"Week":return function(t,i){return r.Std.weekofyear(e,t)!==r.Std.weekofyear(e,i)||r.Std.year(e,t)!==r.Std.year(e,i)};case"Month":return function(t,i){return r.Std.month(e,t)!==r.Std.month(e,i)||r.Std.year(e,t)!==r.Std.year(e,i)};case"Quarter":return function(t,i){return Math.floor(r.Std.month(e,t)/3)!==Math.floor(r.Std.month(e,i)/3)||r.Std.year(e,t)!==r.Std.year(e,i)};case"Year":return function(t,i){return r.Std.year(e,t)!==r.Std.year(e,i)};case"Decade":return function(t,i){return Math.floor(r.Std.year(e,t)/10)!==Math.floor(r.Std.year(e,i)/10)};case"Century":return function(t,i){return Math.floor(r.Std.year(e,t)/100)!==Math.floor(r.Std.year(e,i)/100)};default:return e=>this._isNewSession(e)}},this.init=function(e,t){this._input=t,this._isNewSession=null;const i=this._input(1)||"Session"
;this._anchorChecker=this.createAnchorChecker(e,i)},this.main=function(e,t){this._context=e,this._input=t;const i=this._input(0);var s=e.new_var(),n=e.new_var();const o=r.Std.time(this._context),a=this._context.new_unlimited_var(o);return o&&(null===this._isNewSession&&(this._isNewSession=r.Std.createNewSessionCheck(e)),this._anchorChecker(a.get(),a.get(1))&&(this.f_1(s),this.f_1(n))),s.set(r.Std.nz(s.get(1))+r.Std[i](this._context)*r.Std.volume(this._context)),n.set(r.Std.nz(n.get(1))+r.Std.volume(this._context)),[s.get(0)/n.get(0)]}}},{name:"VWMA",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},inputs:{in_0:20}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"VWMA",shortDescription:"VWMA",is_price_study:!0,inputs:[{id:"in_0",name:"len",defval:20,type:"integer",min:1,max:1e4}],id:"VWMA@tv-basicstudies-1",scriptIdPart:"",name:"VWMA",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.Std.close(this._context),s=this._input(0),n=this._context.new_var(i);return[r.Std.vwma(n,s,this._context)]}}},{name:"Volume Oscillator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:5,in_1:10}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Volume Oscillator",shortDescription:"Volume Osc",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"shortlen",defval:5,type:"integer",min:1,max:4999},{id:"in_1",name:"longlen",defval:10,type:"integer",min:1,max:4999}],id:"Volume Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Volume Oscillator",format:{precision:2,type:"percent"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t){return 100*(e-t)/t},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.Std.volume(this._context),o=this._context.new_var(n),a=r.Std.ema(o,i,this._context),l=this._context.new_var(n),c=r.Std.ema(l,s,this._context);return[this.f_0(a,c)]}}},{name:"Vortex Indicator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#E91E63"}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"VI +",histogramBase:0,joinPoints:!1,isHidden:!1},plot_1:{title:"VI -",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Vortex Indicator",shortDescription:"VI",is_price_study:!1,is_hidden_study:!1,
id:"vortex_indicator@tv-basicstudies-1",inputs:[{id:"in_0",name:"Period",defval:14,type:"integer",min:2,max:1e12}],scriptIdPart:"",name:"Vortex Indicator",format:{precision:4,type:"price"}},constructor:function(){this.f_0=function(){var e=this._input(0),t=this._context.new_var(r.Std.low(this._context)),i=this._context.new_var(r.Std.abs(r.Std.high(this._context)-t.get(1))),s=r.Std.sum(i,e,this._context),n=this._context.new_var(r.Std.high(this._context)),o=this._context.new_var(r.Std.abs(r.Std.low(this._context)-n.get(1))),a=r.Std.sum(o,e,this._context),l=this._context.new_var(r.Std.atr(1,this._context)),c=r.Std.sum(l,e,this._context);return[s/c,a/c]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Willams %R",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#7E57C2"}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-20},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-80}],filledAreasStyle:{fill_0:{color:"#7E57C2",transparency:90,visible:!0}},inputs:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Williams %R",shortDescription:"%R",is_price_study:!1,bands:[{id:"hline_0",name:"UpperLimit",zorder:-1.1},{id:"hline_1",name:"LowerLimit",zorder:-1.11}],filledAreas:[{id:"fill_0",objAId:"hline_0",objBId:"hline_1",type:"hline_hline",title:"Hlines Background",zorder:-2}],inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:2e3}],id:"Willams %R@tv-basicstudies-1",scriptIdPart:"",name:"Willams %R",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i){return 100*(e-t)/(t-i)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.Std.high(this._context),n=this._context.new_var(s),o=r.Std.highest(n,i,this._context),a=r.Std.low(this._context),l=this._context.new_var(a),c=r.Std.lowest(l,i,this._context);return[this.f_0(r.Std.close(this._context),o,c)]}}},{name:"Williams Alligator",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,defaults:{styles:{plot_0:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#E91E63"},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#66BB6A"}},inputs:{in_0:21,in_1:13,in_2:8,in_3:8,in_4:5,in_5:3}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Jaw",histogramBase:0,joinPoints:!1},plot_1:{title:"Teeth",histogramBase:0,joinPoints:!1},plot_2:{title:"Lips",histogramBase:0,joinPoints:!1}},description:"Williams Alligator",shortDescription:"Alligator",is_price_study:!0,inputs:[{id:"in_0",name:"Jaw Length",defval:21,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0"]},{id:"in_1",
name:"Teeth Length",defval:13,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1"]},{id:"in_2",name:"Lips Length",defval:8,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_2"]},{id:"in_3",name:"Jaw Offset",defval:8,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_0"]},{id:"in_4",name:"Teeth Offset",defval:5,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1"]},{id:"in_5",name:"Lips Offset",defval:3,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_2"]}],id:"Williams Alligator@tv-basicstudies-1",scriptIdPart:"",name:"Williams Alligator",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=this._input(2),o=this._input(3),a=this._input(4),l=this._input(5),c=r.Std.hl2(this._context);return[{value:r.Std.smma(c,i,this._context),offset:o},{value:r.Std.smma(c,s,this._context),offset:a},{value:r.Std.smma(c,n,this._context),offset:l}]}}},{name:"Williams Fractals",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,defaults:{styles:{plot_0:{plottype:"shape_triangle_down",visible:!0,location:"BelowBar",transparency:0,color:a},plot_1:{plottype:"shape_triangle_up",visible:!0,location:"AboveBar",transparency:0,color:u}},inputs:{in_0:2}},plots:[{id:"plot_0",type:"shapes"},{id:"plot_1",type:"shapes"}],styles:{plot_0:{title:"Down fractals",isHidden:!1},plot_1:{title:"Up fractals",isHidden:!1}},description:"Williams Fractal",shortDescription:"Fractals",is_price_study:!0,is_hidden_study:!1,id:"Williams Fractals@tv-basicstudies-1",inputs:[{id:"in_0",name:"Periods",defval:2,type:"integer",min:2,max:1e12}],scriptIdPart:"",name:"Williams Fractals",isCustomIndicator:!0,format:{type:"inherit"}},constructor:function(){this.f_0=function(){for(var e=this._input(0),t=this._context.new_var(r.Std.high(this._context)),i=!0,s=!0,n=!0,o=!0,a=!0,l=!0,c=1;c<=e;c++)i=r.Std.and(i,r.Std.lt(t.get(e-c),t.get(e))),s=r.Std.and(s,r.Std.lt(t.get(e+c),t.get(e))),n=r.Std.and(n,r.Std.and(r.Std.le(t.get(e+1),t.get(e)),r.Std.lt(t.get(e+c+1),t.get(e)))),o=r.Std.and(o,r.Std.and(r.Std.le(t.get(e+1),t.get(e)),r.Std.and(r.Std.le(t.get(e+2),t.get(e)),r.Std.lt(t.get(e+c+2),t.get(e))))),a=r.Std.and(a,r.Std.and(r.Std.le(t.get(e+1),t.get(e)),r.Std.and(r.Std.le(t.get(e+2),t.get(e)),r.Std.and(r.Std.le(t.get(e+3),t.get(e)),r.Std.lt(t.get(e+c+3),t.get(e)))))),l=r.Std.and(l,r.Std.and(r.Std.le(t.get(e+1),t.get(e)),r.Std.and(r.Std.le(t.get(e+2),t.get(e)),r.Std.and(r.Std.le(t.get(e+3),t.get(e)),r.Std.and(r.Std.le(t.get(e+4),t.get(e)),r.Std.lt(t.get(e+c+4),t.get(e)))))));var h=r.Std.or(s,r.Std.or(n,r.Std.or(o,r.Std.or(a,l)))),d=r.Std.and(i,h),u=this._context.new_var(r.Std.low(this._context)),p=1,_=1,m=1,g=1,f=1,v=1;for(c=1;c<=e;c++)p=r.Std.and(p,r.Std.gt(u.get(e-c),u.get(e))),_=r.Std.and(_,r.Std.gt(u.get(e+c),u.get(e))),m=r.Std.and(m,r.Std.and(r.Std.ge(u.get(e+1),u.get(e)),r.Std.gt(u.get(e+c+1),u.get(e)))),g=r.Std.and(g,r.Std.and(r.Std.ge(u.get(e+1),u.get(e)),r.Std.and(r.Std.ge(u.get(e+2),u.get(e)),r.Std.gt(u.get(e+c+2),u.get(e))))),
f=r.Std.and(f,r.Std.and(r.Std.ge(u.get(e+1),u.get(e)),r.Std.and(r.Std.ge(u.get(e+2),u.get(e)),r.Std.and(r.Std.ge(u.get(e+3),u.get(e)),r.Std.gt(u.get(e+c+3),u.get(e)))))),v=r.Std.and(v,r.Std.and(r.Std.ge(u.get(e+1),u.get(e)),r.Std.and(r.Std.ge(u.get(e+2),u.get(e)),r.Std.and(r.Std.ge(u.get(e+3),u.get(e)),r.Std.and(r.Std.ge(u.get(e+4),u.get(e)),r.Std.gt(u.get(e+c+4),u.get(e)))))));var S=r.Std.or(_,r.Std.or(m,r.Std.or(g,r.Std.or(f,v))));return[r.Std.and(p,S),d]},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_0();return[{value:i[0],offset:-this._input(0)},{value:i[1],offset:-this._input(0)}]}}},{name:"Guppy Multiple Moving Average",metainfo:{isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,description:"Guppy Multiple Moving Average",shortDescription:"GMMA",is_price_study:!0,id:"Guppy Multiple Moving Average@tv-basicstudies-1",_metainfoVersion:52,format:{type:"inherit"},defaults:{inputs:{traderEMA1Length:3,traderEMA2Length:5,traderEMA3Length:8,traderEMA4Length:10,traderEMA5Length:12,traderEMA6Length:15,investorEMA1Length:30,investorEMA2Length:35,investorEMA3Length:40,investorEMA4Length:45,investorEMA5Length:50,investorEMA6Length:60},styles:{traderEMA1:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:15,visible:!0},traderEMA2:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:12,visible:!0},traderEMA3:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:9,visible:!0},traderEMA4:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:6,visible:!0},traderEMA5:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:3,visible:!0},traderEMA6:{color:"#00FFFF",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0},investorEMA1:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:15,visible:!0},investorEMA2:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:12,visible:!0},investorEMA3:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:9,visible:!0},investorEMA4:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:6,visible:!0},investorEMA5:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:3,visible:!0},investorEMA6:{color:"#FF0000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0}}},inputs:[{defval:3,id:"traderEMA1Length",max:1e3,min:1,name:"Trader EMA 1 length",type:"integer",hideWhenPlotsHidden:["traderEMA1"]},{defval:5,id:"traderEMA2Length",max:1e3,min:1,name:"Trader EMA 2 length",type:"integer",hideWhenPlotsHidden:["traderEMA2"]},{defval:8,id:"traderEMA3Length",max:1e3,min:1,name:"Trader EMA 3 length",type:"integer",hideWhenPlotsHidden:["traderEMA3"]},{defval:10,id:"traderEMA4Length",max:1e3,min:1,name:"Trader EMA 4 length",type:"integer",hideWhenPlotsHidden:["traderEMA4"]},{defval:12,id:"traderEMA5Length",max:1e3,min:1,name:"Trader EMA 5 length",type:"integer",hideWhenPlotsHidden:["traderEMA5"]},{
defval:15,id:"traderEMA6Length",max:1e3,min:1,name:"Trader EMA 6 length",type:"integer",hideWhenPlotsHidden:["traderEMA6"]},{defval:30,id:"investorEMA1Length",max:1e3,min:1,name:"Investor EMA 1 length",type:"integer",hideWhenPlotsHidden:["investorEMA1"]},{defval:35,id:"investorEMA2Length",max:1e3,min:1,name:"Investor EMA 2 length",type:"integer",hideWhenPlotsHidden:["investorEMA2"]},{defval:40,id:"investorEMA3Length",max:1e3,min:1,name:"Investor EMA 3 length",type:"integer",hideWhenPlotsHidden:["investorEMA3"]},{defval:45,id:"investorEMA4Length",max:1e3,min:1,name:"Investor EMA 4 length",type:"integer",hideWhenPlotsHidden:["investorEMA4"]},{defval:50,id:"investorEMA5Length",max:1e3,min:1,name:"Investor EMA 5 length",type:"integer",hideWhenPlotsHidden:["investorEMA5"]},{defval:60,id:"investorEMA6Length",max:1e3,min:1,name:"Investor EMA 6 length",type:"integer",hideWhenPlotsHidden:["investorEMA6"]}],plots:[{id:"traderEMA1",type:"line"},{id:"traderEMA2",type:"line"},{id:"traderEMA3",type:"line"},{id:"traderEMA4",type:"line"},{id:"traderEMA5",type:"line"},{id:"traderEMA6",type:"line"},{id:"investorEMA1",type:"line"},{id:"investorEMA2",type:"line"},{id:"investorEMA3",type:"line"},{id:"investorEMA4",type:"line"},{id:"investorEMA5",type:"line"},{id:"investorEMA6",type:"line"}],styles:{traderEMA1:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 1"},traderEMA2:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 2"},traderEMA3:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 3"},traderEMA4:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 4"},traderEMA5:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 5"},traderEMA6:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Trader EMA 6"},investorEMA1:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 1"},investorEMA2:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 2"},investorEMA3:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 3"},investorEMA4:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 4"},investorEMA5:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 5"},investorEMA6:{histogramBase:0,isHidden:!1,joinPoints:!1,title:"Investor EMA 6"}}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r.Std.close(this._context)),s=this._input(0),n=this._input(1),o=this._input(2),a=this._input(3),l=this._input(4),c=this._input(5),h=r.Std.ema(i,s,this._context),d=r.Std.ema(i,n,this._context),u=r.Std.ema(i,o,this._context),p=r.Std.ema(i,a,this._context),_=r.Std.ema(i,l,this._context),m=r.Std.ema(i,c,this._context),g=this._input(6),f=this._input(7),v=this._input(8),S=this._input(9),y=this._input(10),b=this._input(11);return[h,d,u,p,_,m,r.Std.ema(i,g,this._context),r.Std.ema(i,f,this._context),r.Std.ema(i,v,this._context),r.Std.ema(i,S,this._context),r.Std.ema(i,y,this._context),r.Std.ema(i,b,this._context)]}}},{name:"52 Week High/Low",metainfo:{_metainfoVersion:52,id:"52 Week High/Low@tv-basicstudies-1",
description:"52 Week High/Low",shortDescription:"52W H/L",is_price_study:!0,format:{type:"inherit"},plots:[],graphics:{horizlines:{highest:{name:"Highest"},lowest:{name:"Lowest"}}},inputs:[{defval:"close",id:"highestSource",name:"High source",options:["close","high"],type:"text"},{defval:"close",id:"lowestSource",name:"Low source",options:["close","low"],type:"text"}],defaults:{graphics:{horizlines:{highest:{color:"rgb(93, 96, 107)",showPrice:!0,style:1,visible:!0,width:2},lowest:{color:"rgb(93, 96, 107)",showPrice:!0,style:1,visible:!0,width:2}}},inputs:{highestSource:"close",lowestSource:"close"}}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this._symbolSupports1DResolution=!this._context.symbol.info.supported_resolutions||-1!==this._context.symbol.info.supported_resolutions.indexOf("1D"),this._symbolSupports1DResolution&&"1D"!==r.Std.period(this._context)&&this._context.new_sym(this._context.symbol.ticker,"1D")},this.main=function(e,t){this._symbolSupports1DResolution||r.Std.error(`Daily bars are not available for ${this._context.symbol.info.name}`),this._context=e,this._input=t,"1D"!==r.Std.period(this._context)&&this._context.select_sym(1);const i=this._input(0),s=this._input(1),n=r.Std.time(this._context),o=this._context.new_unlimited_var(n),a=this._context.new_unlimited_var(r.Std[i](this._context)),l=this._context.new_unlimited_var(r.Std[s](this._context));if(o.get(365),!this._context.symbol.isLastBar||!this._context.symbol.isNewBar)return null;const c=r.Std.add_years_considering_dst(this._context.symbol.info.timezone,new Date(n),-1),h=o.indexOf(c.getTime());return{nonseries:!0,type:"study_graphics",data:{graphicsCmds:{create:{horizlines:[{styleId:"highest",data:[{startIndex:n,endIndex:n,level:r.Std.highest(a,h,this._context),extendLeft:!0,extendRight:!0}]},{styleId:"lowest",data:[{startIndex:n,endIndex:n,level:r.Std.lowest(l,h,this._context),extendLeft:!0,extendRight:!0}]}]},erase:[{action:"all"}]}}}}}}]},66846:(e,t,i)=>{"use strict";var s;i.d(t,{SubsessionId:()=>s}),function(e){e.Regular="regular",e.Extended="extended",e.PreMarket="premarket",e.PostMarket="postmarket"}(s||(s={}))},15294:(e,t,i)=>{"use strict";i.d(t,{SymbolInstrument:()=>d});var s=i(27856),r=i(41249),n=i(98829),o=i(57333),a=i(36274),l=i(60156),c=i(66846),h=i(50151);class d{constructor(e,t,i,r,o,l,c){this.periodBase="";const h=(0,s.decodeExtendedSymbol)(e),d="string"==typeof h.symbol?h:h.symbol;if((0,s.isStudySymbol)(d))throw new Error(`Unexpected nested study symbol: ${e}`);const u="string"==typeof h.symbol?h.symbol:h.symbol.symbol;this.ticker=u,this.currencyCode=i||d["currency-id"],this.unitId=r||d["unit-id"],this.subsessionId=c||d.session;const p=d["currency-id"]!==this.currencyCode||d["unit-id"]!==this.unitId;d["currency-id"]=this.currencyCode,d["unit-id"]=this.unitId,p&&(e=(0,s.encodeExtendedSymbolOrGetSimpleSymbolString)(h)),this.tickerid=e;const _=a.Interval.parse(t);this.resolution=_.letter(),this.interval=_.multiplier(),this.period=_.value(),this.index=-1,this.time=NaN,this.open=NaN,this.high=NaN,
this.low=NaN,this.close=NaN,this.volume=NaN,this.updatetime=NaN,this.minTick=NaN,this.isNewBar=!1,this.isBarClosed=!1,this.isFirstBar=!1,this.isLastBar=!1,this.session=new n.SessionInfo("Etc/UTC","24x7"),this.regularSubsession=null,this.preMarketSubsession=null,this.postMarketSubsession=null,this.script=o,this.isAdditionalDepthAllowed=!(0,s.isStudySymbol)(h)||h.type.includes("BarSetHeikenAshi"),l&&this.set_symbolinfo(l)}set_symbolinfo(e){if(e||console.error("WARN: symbolinfo isn't defined for "+this.tickerid),this.info=e,this.minTick=e.minmov/e.pricescale,this.currencyCode=e.currency_code,this.unitId=e.unit_id,this.subsessionId=e.subsession_id,this.timezone=r.get_timezone(e.timezone),this.session.init(e.timezone,e.session,e.session_holidays,e.corrections),void 0!==e.subsessions){const t=e.subsessions.find((e=>e.id===c.SubsessionId.Regular)),i=e.subsessions.find((e=>e.id===c.SubsessionId.PreMarket)),s=e.subsessions.find((e=>e.id===c.SubsessionId.PostMarket));void 0!==t&&(this.regularSubsession=new o.SessionSpec(e.timezone,t.session,e.session_holidays,t["session-correction"])),void 0!==i&&(this.preMarketSubsession=new o.SessionSpec(e.timezone,i.session,e.session_holidays,i["session-correction"])),void 0!==s&&(this.postMarketSubsession=new o.SessionSpec(e.timezone,s.session,e.session_holidays,s["session-correction"]))}}isdwm(){return""!==this.resolution&&"S"!==this.resolution&&"T"!==this.resolution}enable_dwm_aligning(e,t){this.dwm_aligner=(0,l.newBarBuilder)(this.period,e,t)}bartime(){const e=this.time;if(!this.isdwm()||isNaN(e))return e;const t=(0,h.ensureDefined)(this.timezone,"symbol instrument timezone"),i=r.utc_to_cal(t,e);return this.session.spec.correctTradingDay(i),r.cal_to_utc(t,i)}lastbar(e){if(isNaN(e.time))return;let t=e.time;this.dwm_aligner&&(this.dwm_aligner.moveTo(t),t=this.dwm_aligner.startOfBar(0));const i=this.time!==t;i&&this.index>=0&&!this.isBarClosed&&(this.isNewBar=!1,this.isBarClosed=!0,this.script.calc(this)),this.time=t,this.open=e.open,this.high=e.high,this.low=e.low,this.close=e.close,this.volume=e.volume||NaN,this.updatetime=e.updatetime||NaN,this.isNewBar=i,this.isBarClosed=!!e.isBarClosed,this.isLastBar=!!e.isLastBar,this.isNewBar&&(this.index++,this.isFirstBar=0===this.index),this.script.calc(this)}}},34108:(e,t,i)=>{"use strict";i.d(t,{PointsetsManager:()=>n});var s=i(36274);const r=(0,i(59224).getLogger)("ChartApi.PointsetsManager");class n{constructor(){this._pointsetsDataBySymbol=new Map}destroy(){this._pointsetsDataBySymbol.clear()}createPointset(e,t,i,s,n){let o=this._pointsetsDataBySymbol.get(t);void 0===o&&(o=new Map,this._pointsetsDataBySymbol.set(t,o));const a=[];for(const t of s){const[i,s]=t;"number"!=typeof i||Number.isNaN(i)?r.logWarn(`Pointset time is invalid: id=${e}, ${i} of type ${typeof i}`):a.push({point:t,extrapolation:n.extrapolateTimeWithOffsetToTime(1e3*i,s)})}s.length===a.length&&o.set(e,{resolution:i,points:a})}removePointset(e){const t=[];this._pointsetsDataBySymbol.forEach(((i,s)=>{i.delete(e),0===i.size&&t.push(s)}))
;for(const e of t)this._pointsetsDataBySymbol.delete(e)}invalidatePointsetsForSymbol(e,t){const i=this._pointsetsDataBySymbol.get(e);void 0!==i&&i.forEach(((e,i)=>{if(s.Interval.isEqual(e.resolution,t))for(const t of e.points)null!==t.extrapolation&&t.extrapolation.exact&&(t.extrapolation.exact=!1)}))}getUpdatesForSymbol(e,t,i,s){const r=new Map,n=this._pointsetsDataBySymbol.get(e);return void 0!==n&&n.forEach(((e,n)=>{const o=this._refreshPointsetData(e,t,i,s);null!==o&&r.set(n,o)})),r}_refreshPointsetData(e,t,i,n){if(s.Interval.isEqual(e.resolution,t))for(let t=0;t ${t}`),null;o.push({index:i,value:[a.index,a.timeMs/1e3]})}return o}}},21125:(e,t,i)=>{"use strict";i.d(t,{SessionTimeScale:()=>v});var s=i(50151),r=i(14483),n=i(41249),o=i(78071),a=i(77475),l=i(61401),c=i(13041);function h(e){return 60*e*60*1e3}function d(e){return 60*e*1e3}const u=[{divisor:1,weight:18},{divisor:(p=1,1e3*p),weight:19},{divisor:d(1),weight:20},{divisor:d(5),weight:21},{divisor:d(30),weight:22},{divisor:h(1),weight:30},{divisor:h(3),weight:31},{divisor:h(6),weight:32},{divisor:h(12),weight:33}];var p;function _(e,t){if(null!==t){if(e.getUTCFullYear()!==t.getUTCFullYear())return 70;if(e.getUTCMonth()!==t.getUTCMonth())return 60;if(e.getUTCDate()!==t.getUTCDate())return 50;const i=t.getTime(),s=e.getTime();for(let e=u.length-1;e>=0;--e)if(Math.floor(i/u[e].divisor)!==Math.floor(s/u[e].divisor))return u[e].weight}return 18}function m(e,t,i=0){if(0===e.length)return[];let s=i,r=i;const n=[];for(;s=t.length?(n.push({old:s,new:l.INVALID_TIME_POINT_INDEX}),s++):e[s].timeMs===t[r].timeMs?(s!==r&&n.push({old:s,new:r}),s++,r++):e[s].timeMs{if(e.new===t.new&&e.new===l.INVALID_TIME_POINT_INDEX)return e.old-t.old;if(e.new===l.INVALID_TIME_POINT_INDEX)return-1;if(t.new===l.INVALID_TIME_POINT_INDEX)return 1;const i=e.old-e.new,s=t.old-t.new;return i>0?s>0?e.old-t.old:-1:s<0?t.new-e.new:1}))}function g(e,t){return{span:e.markWeight,time:e.displayTime,index:t}}const f=r.enabled("end_of_period_timescale_marks");class v{constructor(){this._completed=!0,this._mainSymbolExtrapolator=null,this._pointDataByTimePoint=new Map,this._instanceIds=new Set,this._displayTimezone=null,this._minFutureBarsCount=0,this._sortedTimePoints=[]}destroy(){this.clearTimeScale()}setCompleted(e){this._completed=e}isCompleted(){return this._completed}clearTimeScale(){return this._pointDataByTimePoint.clear(),this._instanceIds.clear(),this._sortedTimePoints=[],{baseIndex:null,pointsIndex:0,indexChange:[],marks:[],points:[]}}indexOfTime(e){
if(0===this._sortedTimePoints.length)return null===this._mainSymbolExtrapolator?null:this._mainSymbolExtrapolator.indexOfTime(e);if(ethis._sortedTimePoints[this._sortedTimePoints.length-1].timeMs){if(null===this._mainSymbolExtrapolator)return null;const t=this._mainSymbolExtrapolator.indexOfTime(e),i=this._mainSymbolExtrapolator.indexOfTime(this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs);if(null===t||null===i)return null;const s=t.index-i.index-1;return{index:this._sortedTimePoints.length+s,timeMs:t.timeMs}}let t=(0,o.lowerbound)(this._sortedTimePoints,e,((e,t)=>e.timeMs({timeMs:e,markWeight:0,displayTime:NaN})));this._fillPointsData(i,0,0!==this._sortedTimePoints.length?this._sortedTimePoints[this._sortedTimePoints.length-1].displayTime:null);const r=[];for(let t=e;tg(e,i+t)));return r.concat(n)}setTimezone(e){this._displayTimezone="exchange"===e?null:(0,n.get_timezone)(e),this._fillPointsData(this._sortedTimePoints,0)}fillIndexesInRows(e){if(0===e.length)return;let t=-1,i=(0,o.lowerbound)(this._sortedTimePoints,Math.round(1e3*e[0].value[0]),((e,t)=>e.timeMse.timeMs{for(;i=this._sortedTimePoints.length){const t=this.indexOfTime(e)
;if(null===t)return l.INVALID_TIME_POINT_INDEX;i=t.timeMs!==e?t.index+1:t.index}return(0,s.assert)(i>t,"data must have unique sorted times"),t=i,i}))}firstSeriesBarTime(){return 0===this._sortedTimePoints.length?null:this._sortedTimePoints[0].timeMs}replaceBarsTimesTail(e,t){if(0===t.length)return null;if(!this._instanceIds.has(e))return this.setSeriesBarsTimes(e,t);const i=[],s=(0,o.lowerbound)(this._sortedTimePoints,t[0],((e,t)=>e.timeMs({timeMs:e.timeMs,pointData:e.pointData,markWeight:0,displayTime:NaN})));for(let e=s;ee.timeMs-t.timeMs));const a=this._updateTimeScalePointsTail(n);return this._applyTimeScaleChanges(a,!1)}setSeriesBarsTimes(e,t){return this._setBarsTimes(e,t)}setStudyBarsTimes(e,t){return this._setBarsTimes(e,t)}_setBarsTimes(e,t){const i=0!==this._pointDataByTimePoint.size;if(this._instanceIds.has(e))for(const t of this._sortedTimePoints)t.pointData.instances.delete(e);0===t.length?this._instanceIds.delete(e):this._instanceIds.add(e),this._addBarsTimesToInstance(e,t,!1),i&&this._cleanupPointsData(this._sortedTimePoints);const s=[];this._pointDataByTimePoint.forEach(((e,t)=>{s.push({markWeight:0,timeMs:t,displayTime:NaN,pointData:e})})),s.sort(((e,t)=>e.timeMs-t.timeMs));const r=this._updateTimeScalePoints(s);return this._applyTimeScaleChanges(r,!1)}_updateFutureBars(){if(0===this._minFutureBarsCount||null===this._mainSymbolExtrapolator)return;if(0!==this._sortedTimePoints.length){const e=this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs;this._mainSymbolExtrapolator.ensureExtrapolatedToFutureTime(e)}const e=this._futureBarsFirstPointIndex();this._mainSymbolExtrapolator.setMinFutureBarsCount(e+this._minFutureBarsCount)}_addBarsTimesToInstance(e,t,i){const s=i?[]:null;for(const i of t){const t=this._pointDataByTimePoint.get(i);if(void 0===t){const t=new Set;t.add(e);const r={index:0,instances:t};this._pointDataByTimePoint.set(i,r),null!==s&&s.push({timeMs:i,pointData:r})}else t.instances.add(e)}return s}_futureBarsFirstPointIndex(){if(null===this._mainSymbolExtrapolator||0===this._sortedTimePoints.length)return 0;const e=this._mainSymbolExtrapolator.futureBars();return(0,o.upperbound_int)(e,this._sortedTimePoints[this._sortedTimePoints.length-1].timeMs)}_futureBars(){return null===this._mainSymbolExtrapolator?[]:this._mainSymbolExtrapolator.futureBars().slice(this._futureBarsFirstPointIndex(),this._futureBarsFirstPointIndex()+1e3)}_cleanupPointsData(e){for(const t of e)0===t.pointData.instances.size&&this._pointDataByTimePoint.delete(t.timeMs)}_updateTimeScalePoints(e){let t=-1;for(let i=0;ie.timeMs=this._sortedTimePoints.length)continue;this._sortedTimePoints[n].timeMs!==r.timeMs&&-1===i&&(i=n)}const s=t+e.length;if(i=S(i,this._sortedTimePoints.length,s),-1===i)return null;this._fillPointsData(e,0,0===t||0===this._sortedTimePoints.length?null:this._sortedTimePoints[t-1].displayTime);const r=m(this._sortedTimePoints.slice(t),e).map((e=>({old:e.old+t,new:e.new===l.INVALID_TIME_POINT_INDEX?e.new:e.new+t})));{const i=this._sortedTimePoints;let r=0;for(;t+r1&&null===i){const t=Math.ceil(n/(e.length-1)),i=new Date(1e3*(e[0].displayTime-t));e[0].markWeight=_(new Date(1e3*e[0].displayTime),i)}}(e,t,i)}_applyTimeScaleChanges(e,t){if(null===e)return t?(this._fillPointsData(this._sortedTimePoints,0),{points:[],pointsIndex:0,baseIndex:this._getBaseIndex(),indexChange:[],marks:this.tickMarks(0)}):null;let i=e.pointsIndex;if(0!==i&&t&&(this._fillPointsData(this._sortedTimePoints,0),i=0),0===this._sortedTimePoints.length)return{baseIndex:null,pointsIndex:0,indexChange:[],marks:[],points:[]};const s=[];for(let t=e.pointsIndex;t{"use strict";var s=i(3035),r=i(74649),n=i(61476),o=i(76537).SymbolExtrapolator,a=i(21125).SessionTimeScale,l=i(34108).PointsetsManager,c=i(60156),h=i(77475).createDwmAligner,d=i(36274).Interval,u=i(76422),p=i(2663).visitObject,_=i(1722).isObject;i(24172),i(60325);var m=i(79850).DatafeedRequestsCachedProcessor,g=i(38618).timezoneIsAvailable,f=i(77475).isAlignmentEnabled,v=i(27856),S=v.isEncodedExtendedSymbol,y=v.decodeExtendedSymbol,b=i(42960).extractSymbolNameFromSymbolInfo,w=i(48739).replaceGraphicsTimesWithTimePointIndexIndex,C=i(14483),P=i(66846).SubsessionId,x=i(60156).getPeriodsBetweenDates;const T="pre_post_market_sessions",I=C.enabled(T);var M=-5e6;function A(e){var t=e.findIndex((function(e){return e.index!==M}));return-1===t?[]:0===t?e:e.slice(t)}function L(e,t,i){if(e){if("string"==typeof e)return void console.warn("`logo_urls` should be an array of urls, not a string.");const[t,s]=e;s?(i["base-currency-logoid"]=t,i["currency-logoid"]=s):i.logoid=e}t&&(i.provider_id=t)}function k(e,t){return e+"_"+t}function D(e){if(null===e||"number"==typeof e)return e;if("object"==typeof e&&Array.isArray(e)){switch(e[0]){case"bar_count":return e[2];case"from_to":return e.length>=3?e[2]:null}}return null}function E(e){const t=y(e),i="string"==typeof t.symbol?t:t.symbol;return[i.symbol,{currency:i["currency-id"],unit:i["unit-id"],session:i.session===P.Regular?void 0:i.session}]}var V=function(e){var t=this;this._studiesCache={},this._objectsDataCache={},this._studiesNonSeriesTimes={},this._metainfoCache=[],this._barsCoefficientsCache={},this._externalDatafeed=e,e.getVolumeProfileResolutionForPeriod&&r.overwriteVolumeProfileResolutionForPeriodGetter((function(t,i,s,r){return e.getVolumeProfileResolutionForPeriod(t,i,s,r)})),this._datafeedConfiguration=null,this._marketStatusWatchers={},this._resolveRequests={},this._resolvePromisesBySymbolId=new Map,this._symbolIdToSymbolRequestString=new Map,this._callbacks={},this._serverTimeOffset=0,t._logMessage("Datafeed settings received: {0}".format(JSON.stringify(window.configurationData))),t._datafeedConfiguration=t._adoptConfigurationData(window.configurationData),t._fireEvent("configuration_received"),t._externalDatafeed.getServerTime&&t._externalDatafeed.getServerTime((function(e){t._serverTimeOffset=e-(new Date).valueOf()/1e3})),this._invalidatedPointsetSessions=new Set,this._refreshPointsetsTimerId=null,this._pointsetsManagers={},this._quotesInfo=[],this._depthInfo=[],this._endOfData={},this._computeStudyCounter=0,this._symbolExtrapolators={},this._timeScales={},this._cachedDatafeed=new m(e,this.serverTimeOffset.bind(this),this._datafeedConfiguration.reset_cache_timeout),n.setupFeed({resolve:function(e,i,s,r){t._resolveSymbolByName(e,i,s,r)},subscribe:function(e,i,s,r,n){return t._cachedDatafeed.subscribe(e,i,s,function(e,i,s){var r=new c.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),n=c.newBarBuilder(i,r,r);return function(e){if(e&&e.count()){var i=1e3*t.getCurrentUTCTime();n.moveTo(i),
n.indexOfBar(i)>=0&&e.setLastBarClosed(!1)}s(e)}}(e,i,r),n)},unsubscribe:function(e){return t._cachedDatafeed.unsubscribe(e)}})};function B(e,t){return e+"_"+t}function R(e,t,i,s){return e+(t?"_#_"+t:"")+(i?"_#_"+i:"")+(s?"_#_"+s:"")}V.prototype._getSymbolExtrapolator=function(e,t,i){var s=d.normalize(i),r=function(e,t,i){const s=void 0!==t.subsession_id?","+t.subsession_id:"";return e+","+t.full_name+","+i+s}(e,t,s),n=this._symbolExtrapolators[r];return void 0===n&&(n=new o(t,s),this._symbolExtrapolators[r]=n),n},V.prototype._barsCoefficients=function(e,t){if(void 0===y(e).type)return{};var i=e+t;return this._barsCoefficientsCache[i]||(this._barsCoefficientsCache[i]={}),this._barsCoefficientsCache[i]},V.prototype.destroy=function(){this._cachedDatafeed.destroy(),this._externalDatafeed=null,Object.keys(this._pointsetsManagers).forEach((function(e){this._pointsetsManagers[e].destroy()}),this),this._pointsetsManagers={}},V.prototype.purgeCache=function(){this._endOfData={},this._resolveRequests={},this._objectsDataCache={},this._studiesNonSeriesTimes={},this._studiesCache={},this._resolvePromisesBySymbolId.clear(),this._symbolIdToSymbolRequestString.clear(),Object.keys(this._pointsetsManagers).forEach((function(e){this._pointsetsManagers[e].destroy()}),this),this._pointsetsManagers={},Object.keys(this._timeScales).forEach((function(e){this._timeScales[e].destroy()}),this),this._timeScales={},Object.keys(this._symbolExtrapolators).forEach((function(e){this._symbolExtrapolators[e].destroy()}),this),this._symbolExtrapolators={}},V.prototype.purgeDataCache=function(){this._cachedDatafeed.purgeCache()},V.prototype._logMessage=function(e){C.enabled("charting_library_debug_mode")&&console.log(e)},V.prototype.on=function(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this},V.prototype._fireEvent=function(e,t,i){if(this._callbacks.hasOwnProperty(e)){for(var s=this._callbacks[e],r=0;r{this._resolveSymbolImpl(e,(e=>{t(e.price_sources)}),(e=>{i(e)}))}))},V.prototype.supportedSymbolsTypes=function(){return this._datafeedConfiguration.symbols_types||[]},V.prototype.symbolsGrouping=function(){return this._datafeedConfiguration.symbols_grouping||{futures:/$a/}},V.prototype._findStudyObject=function(e){e.endsWith("!")&&(e=e.slice(0,-1))
;var t=e.split("@")[0],i=JSServer.studyLibrary.filter((function(i){return i.metainfo.id===e||i.metainfo.shortDescription===t}));return 0===i.length?null:i[0]},V.prototype.getMarks=function(e,t,i,s,r){var n={red:6,green:5,blue:4,yellow:3};if(this._externalDatafeed.getMarks&&this._datafeedConfiguration.supports_marks){this._logMessage("Requesting bars marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format(e.full_name,r,new Date(1e3*t).toUTCString(),new Date(1e3*i).toUTCString()));var o=this;this._externalDatafeed.getMarks(e,t,i,(function(t){var i=t.map((function(e){return e.time=parseInt(e.time),e}));o._logMessage("Received bars marks: symbol {0}, resolution {1}, marks {2}".format(e.full_name,r,JSON.stringify(i)));var a=h(r,e),l=C.enabled("two_character_bar_marks_labels"),c=i.map((function(e){return e.tickmark=null!==a?a.timeToSessionStart(1e3*e.time)/1e3:e.time,e.direction=n[e.color],e.onClicked=function(){u.emit("onMarkClick",e.id)},e.label=!!e.label&&(l?e.label.slice(0,2):e.label[0]),e}));s(c)}),r)}},V.prototype.getTimescaleMarks=function(e,t,i,s,r){if(this._externalDatafeed.getTimescaleMarks&&this._datafeedConfiguration.supports_timescale_marks){this._logMessage("Requesting timescale marks: symbol {0}, resolution {1}, range [{2} ... {3}]".format(e.full_name,r,new Date(1e3*t).toUTCString(),new Date(1e3*i).toUTCString()));var n=this;this._externalDatafeed.getTimescaleMarks(e,t,i,(function(t){n._logMessage("Received timescale marks: symbol {0}, resolution {1}, marks {2}".format(e.full_name,r,JSON.stringify(t)));var i=h(r,e),o=t.map((function(e){return e.tickmark=null!==i?i.timeToSessionStart(1e3*e.time)/1e3:e.time,e}));s(o)}),r)}},V.prototype.getSeriesLastBarTime=function(e,t){var i=this._getSeriesData(e,t);return null===i||0===i.length?null:i[i.length-1].timeMs},V.prototype.getSeriesInterval=function(e,t){var i=this._studiesCache[e][t];return i?i.resolution:null},V.prototype.getSeriesSymbolInfo=function(e,t){var i=this._studiesCache[e][t];return i?i.symbolInfo:null},V.prototype._getSeriesData=function(e,t){return this._objectsDataCache[B(e,t)]||null},V.prototype._computeStudy=async function(e,t,i,s,n,o,a,l,c,u){var p=!0,_=[];null!==l&&(this._objectsDataCache[l]=null),this._timeScales[e].setCompleted(!1);var m=this._computeStudyCounter++;function g(e,t){if(e_[a].timeMs;l?_.push({index:g(s,_.length),value:[s/1e3].concat(r),timeMs:s}):(_[a].index=g(s,a),_[a].value=[s/1e3].concat(r),_[a].timeMs=s),p||u.onRealtimeCallback([_[_.length-1]],l,_.length,v,i)}(e,t,i)},nonseriesOut:function(e,t){u.onNonSeriesDataUpdate(t,i)},setNoMoreData:function(){S=!0},recalc:function(e,s){p=!1,_.endOfData=S,_.emptyBarCount=s.emptyBarCount,t.error&&null!==t.error()||(null!==l&&(y._objectsDataCache[l]=_),u.onDataReadyCallback(_,v,i,s))}});if(!y._studiesCache[e]||!y._studiesCache[e][n])throw Error("This should never happen");y._studiesCache[e][n].engine=w}catch(e){if(!e.studyError)throw e;u.onErrorCallback(e.message)}}else u.onErrorCallback("Unsupported resolution. Did you forget to set has_intraday to true?")}(w,P)},V.prototype._getDataRangeForStudy=function(e,t){var i=this._studiesCache[e][t],s={...this._seriesDataRange(e,i.parentId)};return this._studyCanExtendTimeScale(e,t)?void 0!==i.dataRange?i.dataRange:(i.firstLoadedTimeMs&&(s.to=i.firstLoadedTimeMs),s):s},V.prototype._createStudy=function(e,t,i,s,r,n,o,a){var l=this;function c(e,t,i){const o=l._studiesCache[s][r];if(o.completed=!0,e.length>0&&(o.firstLoadedTimeMs=e[0].timeMs),e=A(e),l._setEndOfData(s,r,n,!l._studyCanExtendTimeScale(s,r)||e.endOfData),l._studyCanExtendTimeScale(s,r)){const t=e.map((function(e){return e.timeMs})),i=l._timeScales[s].setStudyBarsTimes(r,t);l._applyTimeScaleUpdate(s,i)}l._timeScales[s].fillIndexesInRows(e),TradingView.ChartapiMessagerInstances[s].onDataUpdate(r,n,e,t),TradingView.ChartapiMessagerInstances[s].onStudyCompleted(r,n),l._updateTimeScaleState(s)}function h(e){var t={};if(0!==e.size){var i={},n=l._studiesCache[s][r].metainfo;e.forEach((function(e,t){i[n.plots[t].id]=e})),t.data={offsets:i}}return t}this._studiesCache[s][r].completed=!1,a=function(e){if(Array.isArray(e))return e;for(var t=[],i=l._studiesCache[s][r].metainfo.inputs,n=0;n=0},V.prototype.ensureExtendedTo=function(e,t,i){if(!this._studiesCache[t][e])throw Error("This should never happen");var s=this;setTimeout((function(){s._recreateSourcesForDataRange(t,{to:i})}),0)},V.prototype.extendSeriesRange=function(e,t){var i=this._timeScales[e].firstSeriesBarTime();if(null!==i){var s=this._mainSeriesRecord(e);if(d.isDWM(s.resolution)&&null!=s.symbolInfo){var r=h(s.resolution,s.symbolInfo);null!==r&&(i=r.timeToExchangeTradingDay(i))}var n=this._symbolIdToSymbolRequestString.get(k(e,s.symbolId)),o=this._barsCoefficients(n,s.resolution),a=o.barsCoefficient||1;if(!o.barsCoefficient){var l=this._getSeriesData(e,s.guid);null!==l&&(o.expectedBarsCount=l.length+t)}var c=this;setTimeout((function(){c._recreateSourcesForDataRange(e,{to:i,countBack:(t+2)*a})}),0)}else this._logMessage("Nothing to extend - there is no points on time scale")},V.prototype.seriesTurnaround=function(e,t){return this._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].turnaround},V.prototype._seriesDataRange=function(e,t){var i=this._studiesCache[e][t];return null!==i.firstLoadedTimeMs?{to:i.firstLoadedTimeMs,countBack:0}:i.dataRange},V.prototype._applyTimeScaleUpdate=function(e,t){if(null!==t){var i=[];for(var s in this._studiesCache[e]){var r=this._studiesCache[e][s];if(r&&"study"===r.type){var n=this._studiesNonSeriesTimes[e][s];if(n){var o={indexes:this._timeScales[e].convertTimesToIndexes(n),data:{indexes_replace:!0}};i.push({objId:s,turnaround:r.turnaround,data:[],nonSeriesData:o})}}}TradingView.ChartapiMessagerInstances[e].onTimescaleUpdate(t,i),Promise.resolve().then(function(){var t=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){var i=this._getSymbolExtrapolator(e,t.symbolInfo,t.resolution);this._pointsetsManagers[e].getUpdatesForSymbol(t.symbolInfo.full_name,t.resolution,i,this._timeScales[e]).forEach((function(t,i){TradingView.ChartapiMessagerInstances[e].onPointsetDataUpdate(i,null,t)}))}}.bind(this))}},V.prototype._updateMainTsBuilder=function(e){var t=this._mainSeriesRecord(e);if(null!==t&&null!=t.symbolInfo){var i=this._getSymbolExtrapolator(e,t.symbolInfo,t.resolution);this._timeScales[e].setMainSymbolExtrapolator(i)}},V.prototype._updateTimeScaleState=function(e){var t=!0,i=!0;for(var s in this._studiesCache[e]){var r=this._studiesCache[e][s];i=i&&this._isEndOfData(e,s,r.turnaround),t=t&&r.completed}this._timeScales[e].isCompleted()!==t&&(this._timeScales[e].setCompleted(t),t&&TradingView.ChartapiMessagerInstances[e].onTimescaleCompleted(i))},V.prototype._mainSeriesRecord=function(e){var t=null,i=null;for(var s in this._studiesCache[e]){
var r=this._studiesCache[e][s];if("series"===r.type&&(null===t&&(t=r),r.isMain)){i=r;break}}return null===i&&(i=t),null!==i&&(i.isMain=!0),i},V.prototype._seriesCount=function(e){var t=0;for(var i in this._studiesCache[e]){"series"===this._studiesCache[e][i].type&&(t+=1)}return t},V.prototype._prepareSeriesNonSeriesData=function(e,t,i){var s=i.data[i.data.length-1],r=this._getSeriesData(e,t),n=null===r?[]:i.data;return{data:{data:{reversalAmount:i.reversalAmount,boxSize:i.boxSize,price:s?s[4]:i.price,bars:n.map((function(e,t){return{time:t,open:e[1],high:e[2],low:e[3],close:e[4],volume:e[5],factor:e[6],additionalPrice:e[6]}}))}},indexes:this._timeScales[e].convertTimesToIndexes(n.map((function(e){var t=e[0]||0;return t<0?r[r.length+t].timeMs:i.projectionTime+t})))}},V.prototype.createSeries=function(e,t,i,s,n,o,a){this._setEndOfData(e,t,i,!1);var l=new r.OHLCV;this._studiesCache[e]=this._studiesCache[e]||{};var c=this._getSeriesData(e,t),h=this._studiesCache[e][t],u=this._seriesCount(e),p=this._mainSeriesRecord(e);if(!h||d.isEqual(h.resolution,n)&&h.symbolId===s)void 0!==o.countBack&&null!==c&&0!==c.length&&(o.to=c[0].timeMs),h&&null!=h.firstLoadedTimeMs?o.to=void 0!==o.to?Math.min(h.firstLoadedTimeMs,o.to):h.firstLoadedTimeMs:h||0===u||null!==p&&(null!=p.firstLoadedTimeMs?(o.to=p.firstLoadedTimeMs,o.countBack=0):o=Object.assign({},p.dataRange));else if(1===u)o=Object.assign({},h.initialDatarange);else{var _=this._timeScales[e].firstSeriesBarTime();(void 0===o.to||null!==_&&_{L(e.logo_urls,e.exchange_logo,e)})),s(e)}))},V.prototype.resolveSymbol=function(e,t,i){var s=this;this._symbolIdToSymbolRequestString.set(k(e,t),i),this._resolvePromisesBySymbolId.set(k(e,t),new Promise((function(r,n){s._resolveSymbolImpl(i,(function(s){TradingView.ChartapiMessagerInstances[e].onSymbolResolved(t,s),r({symbolInfo:s,requestedSymbol:i})}),(function(i){TradingView.ChartapiMessagerInstances[e].onSymbolError(t,i),n(i)}))})))},V.prototype._resolveSymbolImpl=function(e,t,i){S(e)||console.error("Expect to get symbol encoded string, but got the following instead: "+e);const[s,r]=E(e);this._resolveSymbolByName(s,r,t,i)},V.prototype._resolveSymbolByName=function(e,t,i,s){var r,n=t&&t.currency,o=t&&t.unit,a=t&&t.session,l=R(e,n,o,a);if(this._resolveRequests[l])r=this._resolveRequests[l];else{r=this._resolveSymbolInternal(e,n||void 0,o||void 0,a||void 0),this._resolveRequests[l]=r;var c=this;r.then((function(t){
c._resolveRequests[R(e,t.currency_id,t.unit_id,t.subsession_id)]=r,c._resolveRequests[R(b(t,null),t.currency_id,t.unit_id,t.subsession_id)]=r,c._resolveRequests[R(b(t,null),n,o,a)]=r})).catch((function(){}))}r.then(i).catch(s)},V.prototype._resolveSymbolInternal=function(e,t,i,s){var r=this;return new Promise(function(n,o){const a=[e,t,i,s].filter((e=>!!e)).join("|");this._logMessage("Symbol resolve requested: `{0}` ".format(a));var l=!0;this._externalDatafeed.resolveSymbol(e,(function(e){l&&console.warn("`resolveSymbol` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),r._logMessage("Symbol resolved: `{0}`, SymbolInfo in server response {1}".format(a,JSON.stringify(e))),function(e){const t=e.exchange+":"+e.name;if(e.full_name=t,e.pro_name=t,e.base_name||(e.base_name=[e.name]),e.legs||(e.legs=[e.name]),e.exchange||(e.exchange=e["exchange-listed"]),e.ticker||(e.ticker=e.symbol||e.name),e.data_status||(e.data_status="streaming"),!e.session&&e["session-regular"]&&(e.session=e["session-regular"]),!e.minmov&&e.minmovement&&(e.minmov=e.minmovement),e.currency_code&&(e.currency_id=e.currency_code),e.original_currency_code&&(e.original_currency_id=e.original_currency_code),e.holidays&&(e.session_holidays=e.holidays),void 0!==e.has_no_volume&&(e.visible_plots_set=e.has_no_volume?"ohlc":"ohlcv"),e.supported_resolutions)for(var i=0;ithis._resolveSymbolByName(t,i,o,(t=>{this.quoteRemoveSymbols(e,[r]),a(t)}))),e,r)}}},V.prototype._removeMarketStatusWatchers=function(e){var t=this;Object.keys(this._marketStatusWatchers[e]||{}).forEach((function(i){t._marketStatusWatchers[e][i].stop()})),this._marketStatusWatchers[e]={}},V.prototype._stopQuotesSubscription=function(e){this._quotesInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeQuotes(this._quotesInfo[e].listenerGUID),this._quotesInfo[e].listenerGUID=void 0),this._removeMarketStatusWatchers(e)},V.prototype._startQuotesSubscription=function(e){var t={},i=this;function s(t,s){var r=i._marketStatusWatchers[e][t.n];t.symbolname=t.n,t.status=t.s,t.values=t.v,t.values.change=t.v.ch,t.values.last_price=t.v.lp,t.values.change_percent=t.v.chp,t.values.current_session=t.v.cs||r&&r.marketStatus(),t.values.pricescale=s.pricescale,t.values.minmov=s.minmov,t.values.minmove2=s.minmove2||0,t.values.fractional=s.fractional||!1,L(s.logo_urls,s.exchange_logo,t.values),r&&t.v.cs&&r.stop(),TradingView.ChartapiMessagerInstances[e].onQuotesData([e].concat([t]))}function r(e){e.forEach((function(e){void 0!==t[e.n]?null!==t[e.n]&&s(e,t[e.n]):i._resolveSymbolByName(e.n,null,(function(i){t[e.n]=i,s(e,i)}),(function(){t[e.n]=null}))}))}var n=this._quotesInfo[e].symbols;if(0===n.length)return;const o=n.map((e=>E(e)[0]));this._externalDatafeed.getQuotes&&!C.enabled("charting_library")?this._externalDatafeed.getQuotes(o,(function(t){i._quotesInfo[e]&&0!==i._quotesInfo[e].symbols.length&&(r(t),i._quotesInfo[e].listenerGUID=e,i._externalDatafeed.subscribeQuotes(o,i._quotesInfo[e].fastSymbols,r,i._quotesInfo[e].listenerGUID))}),(function(e){})):!this._externalDatafeed.getQuotes&&C.enabled("trading_terminal")&&setTimeout((function(){r(o.map((function(e){return{n:e,s:"ok",v:{}}})))})),
this._createMarketStatusWatchers(e,n)},V.prototype._restartQuotesSubscription=function(e){this._stopQuotesSubscription(e),this._startQuotesSubscription(e)},V.prototype.quoteCreateSession=function(e){this._quotesInfo[e]={symbols:[],fastSymbols:[],listenerGUID:void 0}},V.prototype.quoteDeleteSession=function(e){this._stopQuotesSubscription(e),this._quotesInfo[e]=null},V.prototype.quoteSetFields=function(e,t){},V.prototype.quoteAddSymbols=function(e,t){this._quotesInfo[e].symbols=this._filteredSymbols(this._quotesInfo[e].symbols.concat(t)),this._restartQuotesSubscription(e)},V.prototype.quoteRemoveSymbols=function(e,t){this._quotesInfo[e].symbols=this._quotesInfo[e].symbols.filter((function(e){return t.indexOf(e)<0})),this._restartQuotesSubscription(e)},V.prototype.quoteFastSymbols=function(e,t){this._quotesInfo[e].fastSymbols=this._filteredSymbols(t),this._restartQuotesSubscription(e)},V.prototype.quoteHibernateAll=function(e){},V.prototype._stopDepthSubscription=function(e){this._depthInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeDepth(this._depthInfo[e].listenerGUID),this._depthInfo[e].listenerGUID=void 0)},V.prototype._startDepthSubscription=function(e){var t=this,i=this._depthInfo[e].symbol;function s(e){return e.map((function(e){return{p:e.price,v:e.volume}}))}function r(e){var t={};return t.s=i,t.bids=s(e.bids),t.asks=s(e.asks),t}i&&this._externalDatafeed.subscribeDepth&&(t._depthInfo[e].listenerGUID=this._externalDatafeed.subscribeDepth(i,(function(i){var s;t._depthInfo[e]&&((s=i).snapshot?TradingView.ChartapiMessagerInstances[e].onDepthData([e].concat([r(s)])):TradingView.ChartapiMessagerInstances[e].onDepthUpdate([e].concat([r(s)])))})))},V.prototype._restartDepthSubscription=function(e){this._stopDepthSubscription(e),this._startDepthSubscription(e)},V.prototype.depthCreateSession=function(e){this._depthInfo[e]={symbol:null,listenerGUID:void 0}},V.prototype.depthDeleteSession=function(e){this._depthInfo[e].symbol=null,this._stopDepthSubscription(e),delete this._depthInfo[e]},V.prototype.depthSetSymbol=function(e,t){this._depthInfo[e].symbol=t,this._restartDepthSubscription(e)},V.prototype._filteredSymbols=function(e){var t=[];return e.forEach((function(e){e instanceof Object||t.indexOf(e)<0&&t.push(e)})),t},V.prototype._isEndOfData=function(e,t,i){var s=e+"!"+t+"@"+i;return!!this._endOfData[s]},V.prototype._setEndOfData=function(e,t,i,s){var r=e+"!"+t+"@"+i;this._endOfData[r]=!1!==s},V.prototype.serverTimeOffset=function(){return this._serverTimeOffset},V.prototype.serverTime=function(){return 1e3*this.getCurrentUTCTime()},V.prototype.getCurrentUTCTime=function(){return(new Date).valueOf()/1e3+this._serverTimeOffset},V.prototype.switchTimezone=function(e,t){this._timeScales[e].setTimezone(t);var i=this._timeScales[e].tickMarks();null!==i&&TradingView.ChartapiMessagerInstances[e].onTickmarksUpdated(0,i)},V.prototype._studyCanExtendTimeScale=function(e,t){const i=this._studiesCache[e][t]?.metainfo
;return void 0!==i&&(C.enabled("studies_extend_time_scale")&&i.canExtendTimeScale||C.enabled("secondary_series_extend_time_scale")&&"Overlay@tv-basicstudies-1"===i.id)},e.exports=V},76537:(e,t,i)=>{"use strict";i.d(t,{SymbolExtrapolator:()=>c});var s=i(50151),r=i(78071),n=i(60156),o=i(94421),a=i(36274);function l(e,t){return e.length>t}class c{constructor(e,t,i=2e5){this._firstRealBarTimeMs=null,this._historyBarsCache=[],this._projectionFirstIndex=1/0,this._barsTimes=[],this._minFutureBarsCount=0,this._lastRealBarTimeMs=null,this._futureBarsCache=[],this._symbolInfo=e,this._interval=a.Interval.parse(t),this._extrapolateLimit=i,this._barBuilder=(0,n.newBarBuilder)(t,new n.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),null)}destroy(){this.clear()}interval(){return this._interval}barBuilder(){return this._barBuilder}symbolInfo(){return this._symbolInfo}clear(){this._firstRealBarTimeMs=null,this._historyBarsCache=[],this._barsTimes=[],this._lastRealBarTimeMs=null,this._futureBarsCache=[],this._minFutureBarsCount=0,this._projectionFirstIndex=1/0}firstFutureBarIndex(){return this._barsTimes.length}futureBars(){return this._futureBarsCache}replaceBarsTimesTail(e,t=e.length){if(0===e.length)return;if(0===this._barsTimes.length)return void this.setBarsTimes(e,t);const i=e[0],n=this._barsTimes[this._barsTimes.length-1],o=i>n?this._barsTimes.length:(0,r.lowerbound_int)(this._barsTimes,i);0!==o?(this._barsTimes.splice(o,this._barsTimes.length,...e),this._projectionFirstIndex=t===e.length?this._barsTimes.length:this._barsTimes.indexOf(e[t]),(0,s.assert)(-1!==this._projectionFirstIndex,"something went wrong"),n!==e[e.length-1]&&this._setLastRealBarTime(e[e.length-1])):this.setBarsTimes(e,t)}setBarsTimes(e,t=e.length){const i=this._barsTimes;if(this._barsTimes=e.slice(),this._projectionFirstIndex=0===this._barsTimes.length?1/0:t,0===e.length)return this._historyBarsCache=[],this._futureBarsCache=[],this._firstRealBarTimeMs=null,void(this._lastRealBarTimeMs=null);0!==i.length&&i[i.length-1]===e[e.length-1]||this._setLastRealBarTime(e[e.length-1]),0!==i.length&&i[0]===e[0]||(this._historyBarsCache=[],this._firstRealBarTimeMs=e[0])}extrapolateTimeWithOffsetToTime(e,t){if(0===t)return{timeMs:e,exact:!0};0===this._barsTimes.length&&(t<0?null===this._firstRealBarTimeMs?this._firstRealBarTimeMs=e:(this._extendHistoryCacheToTimeFromRight(Math.min(e,null!==this._lastRealBarTimeMs?this._lastRealBarTimeMs:1/0)),this._ensureExtrapolatedToHistoryTime(e)):null===this._lastRealBarTimeMs?this._lastRealBarTimeMs=e:(this._extendFutureCacheToTimeFromLeft(Math.max(e,null!==this._firstRealBarTimeMs?this._firstRealBarTimeMs:1/0)),this._ensureExtrapolatedToFutureTime(e)));const i=this.indexOfTime(e);if(null===i)return null;const s=this._timeOfBarIndex(i.index+t);return null===s?null:((i.index<0||this._projectionFirstIndex<=i.index)&&(s.exact=!1),s)}indexOfTime(e){if(null!==this._firstRealBarTimeMs&ðis._lastRealBarTimeMs){this._ensureExtrapolatedToFutureTime(e);let t=(0,r.lowerbound_int)(this._futureBarsCache,e);if(0!==this._futureBarsCache.length&&t===this._futureBarsCache.length&&e>this._futureBarsCache[this._futureBarsCache.length-1])return null;this._futureBarsCache[t]!==e&&(t-=1);const i=Math.max(1,this._barsTimes.length)+t;return{index:i,timeMs:i===this._barsTimes.length-1?(0,s.ensureNotNull)(this._lastRealBarTimeMs):this._futureBarsCache[t]}}if(0===this._barsTimes.length)return null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs<=e||null!==this._lastRealBarTimeMs&&e<=this._lastRealBarTimeMs?{index:0,timeMs:(0,s.ensureNotNull)(this._timeOfBarIndex(0)).timeMs}:null;let t=(0,r.lowerbound_int)(this._barsTimes,e);return this._barsTimes[t]!==e&&(t-=1),{index:t,timeMs:this._barsTimes[t]}}setMinFutureBarsCount(e){this._minFutureBarsCount=e,0!==this._barsTimes.length&&this._ensureExtrapolatedToFutureBar(e)}ensureExtrapolatedToFutureTime(e){this._ensureExtrapolatedToFutureTime(e)}_setLastRealBarTime(e){const t=this._futureBarsCache.length,i=(0,r.upperbound_int)(this._futureBarsCache,e);0===i?this._extendFutureCacheToTimeFromLeft(e):(this._lastRealBarTimeMs=e,this._futureBarsCache=this._futureBarsCache.slice(i)),this._ensureExtrapolatedToFutureBar(Math.max(t,this._minFutureBarsCount))}_timeOfBarIndex(e){var t;if(e<0){const t=Math.abs(e);this._ensureExtrapolatedToHistoryBar(t);const i=this._historyBarsCache.length-t;return i<0?null:{timeMs:this._historyBarsCache[i],exact:!1}}if(0===e&&0===this._barsTimes.length)return{timeMs:(0,s.ensureNotNull)(null!==(t=this._firstRealBarTimeMs)&&void 0!==t?t:this._lastRealBarTimeMs),exact:!1};if(e>=this._barsTimes.length){const t=e-Math.max(1,this._barsTimes.length);return this._ensureExtrapolatedToFutureBar(t+1),t>=this._futureBarsCache.length?null:{timeMs:this._futureBarsCache[t],exact:!1}}return{timeMs:this._barsTimes[e],exact:e=e)return;if((0,s.assert)(0===this._barsTimes.length,"bars should be empty"),this._firstRealBarTimeMs=e,0===this._historyBarsCache.length)return;const t=(0,o.extrapolateBarsFrontToTime)(this._barBuilder,this._historyBarsCache[this._historyBarsCache.length-1],e-1,this._extrapolateLimit,!0).times;this._historyBarsCache=this._historyBarsCache.concat(t)}_ensureExtrapolatedToFutureBar(e){return!(this._futureBarsCache.length>=e||l(this._futureBarsCache,this._extrapolateLimit))&&this._extendFutureCacheFromRight(((t,i)=>(0,o.extrapolateBarsFrontByCount)(this._barBuilder,t,e-i,!0).times))}_ensureExtrapolatedToFutureTime(e){null!==this._lastRealBarTimeMs&&this._lastRealBarTimeMs>=e||l(this._futureBarsCache,this._extrapolateLimit)||0!==this._futureBarsCache.length&&this._futureBarsCache[this._futureBarsCache.length-1]>=e||(this._extendFutureCacheFromRight(((t,i)=>(0,o.extrapolateBarsFrontToTime)(this._barBuilder,t,e,this._extrapolateLimit,!0).times)),this._futureBarsCache[this._futureBarsCache.length-1]=e||l(this._historyBarsCache,this._extrapolateLimit)||this._extendHistoryCacheFromLeft(((t,i)=>(0,o.extrapolateBarsFrontByCount)(this._barBuilder,t,-(e-i),!0).times.reverse()))}_ensureExtrapolatedToHistoryTime(e){null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs<=e||l(this._historyBarsCache,this._extrapolateLimit)||0!==this._historyBarsCache.length&&this._historyBarsCache[0]<=e||(this._extendHistoryCacheFromLeft(((t,i)=>{const s=(0,o.extrapolateBarsFrontToTime)(this._barBuilder,t-1,e-1,this._extrapolateLimit,!0).times;return s[s.length-1]===t?s.slice(0,-1):s})),(0===this._historyBarsCache.length||this._historyBarsCache[0]>e)&&this._ensureExtrapolatedToHistoryBar(this._historyBarsCache.length+1))}}},61595:(e,t,i)=>{"use strict";i.d(t,{backend:()=>s});const s=i(58844)},47327:(e,t,i)=>{"use strict";i.d(t,{HandlerInfo:()=>s});class s{constructor(e,t){this.handler=e,this.customId=t}}},17133:(e,t,i)=>{"use strict";var s,r;function n(e,t){return"period-back"===e.type&&"period-back"===t.type?e.value===t.value:"time-range"===e.type&&"time-range"===t.type&&(e.from===t.from&&e.to===t.to)}i.d(t,{TIMEFRAMETYPE:()=>r,areEqualTimeFrames:()=>n}),function(e){e.extractErrorReason=function(e){return e.params[1]}}(s||(s={})),function(e){e.PeriodBack="period-back",e.TimeRange="time-range"}(r||(r={}))},89173:()=>{"use strict";TradingView.Pro=function(){this.hasPackage=function(){return!1}},window.user={is_pro:!1,settings:{}},TradingView.Pro.prototype.isPaidPro=function(){return!1},TradingView.Pro.prototype.isSupportAvailable=function(){return!1},TradingView.Pro.prototype.getProduct=function(){return{}},
TradingView.Pro.prototype.getStudiesOrder=function(){return[]}},67545:(e,t,i)=>{"use strict";i.r(t),i.d(t,{QUOTE_FIELDS:()=>n,QUOTE_FIELDS_CACHE:()=>o,QuoteCache:()=>r});var s=i(50151);class r{constructor(e){this._cache=new Map,this._fields=[...e.fields]}update(e,t,i){const r=(0,s.ensureDefined)(e.symbolname);if(this._cache.has(r)||this._cache.set(r,{symbolname:r,status:e.status,values:{}}),"error"===e.status)return;const n=(0,s.ensureDefined)(this._cache.get(r));n.status=e.status;for(const s of this._fields)t.has(s)&&(i||void 0!==e.values[s])&&(n.values[s]=e.values[s])}get(e){var t;return null!==(t=this._cache.get(e))&&void 0!==t?t:null}fields(){return this._fields}}
const n=new Set(["pro_name","base_name","logoid","currency-logoid","base-currency-logoid","source-logoid","short_name","timezone","current_session","last_price","lp_time","prev_close_price","open_price","high_price","low_price","price_52_week_high","price_52_week_low","ask","ask_size","bid","bid_size","rch","rchp","rtc","data_frequency","reference-last-period-start","business_description","web_site_url","number_of_employees","float_shares_outstanding","earnings_release_next_calendar_date","root","description","exchange","listed_exchange","type","country_code","provider_id","sector","typespecs","visible-plots-set","industry","currency_id","last_price","fractional","minmov","minmove2","pricescale","variable_tick_size","change","change_percent","volume","average_volume","market_cap_basic","total_revenue","earnings_per_share_basic_ttm","price_earnings_ttm","beta_1_year","dps_common_stock_prim_issue_fy","dividends_yield","earnings_release_next_date","earnings_per_share_forecast_next_fq","earnings_release_date","earnings_per_share_fq","fundamental_currency_code","number_of_employees","web_site_url","business_description","founded","ceo","float_shares_outstanding","total_shares_outstanding","dividend_payout_ratio_ttm","dividends_yield_current","dividend_ex_date_upcoming","dividend_amount_upcoming","dividend_amount_recent","dividend_ex_date_recent","total_revenue_fq_h","total_revenue_fy_h","net_income_fy_h","net_income_fq_h","total_assets_fy_h","total_assets_fq_h","total_liabilities_fy_h","total_liabilities_fq_h","cash_f_operating_activities_fy_h","cash_f_operating_activities_fq_h","cash_f_investing_activities_fy_h","cash_f_investing_activities_fq_h","cash_f_financing_activities_fy_h","cash_f_financing_activities_fq_h","fiscal_period_fy_h","fiscal_period_fq_h","fiscal_period_fh_h","earnings_release_date_fq_h","earnings_release_next_date_fq","earnings_per_share_forecast_next_fq","earnings_per_share_forecast_fq_h","earnings_per_share_fq_h","earnings_fiscal_period_fq_h","next_earnings_fiscal_period_fq","earnings_release_next_time","is_next_earnings_release_date_estimated","symbol-primaryname","currency_code","rates_mc","rates_fy","rates_ttm","measure","value_unit_id","value-unit-id","update_mode","language","local_description","short_description","source","source2","format","recommendation_mark","last_report_frequency","price_target_estimates_num","price_target_average","update_mode_seconds","recommendation_total","recommendation_buy","recommendation_over","recommendation_hold","recommendation_under","recommendation_sell","recommendation_total","price_target_high","price_target_low","rates_pt","rates_pt","total_revenue_fy_h","total_revenue_fq_h","total_revenue_fh_h","net_income_fy_h","net_income_fq_h","net_income_fh_h","total_assets_fy_h","total_assets_fq_h","total_assets_fh_h","total_liabilities_fy_h","total_liabilities_fq_h","total_liabilities_fh_h","cash_f_operating_activities_fy_h","cash_f_operating_activities_fq_h","cash_f_operating_activities_fh_h","cash_f_investing_activities_fy_h","cash_f_investing_activities_fq_h","cash_f_investing_activities_fh_h","cash_f_financing_activities_fy_h","cash_f_financing_activities_fq_h","cash_f_financing_activities_fh_h","fiscal_period_fy","fiscal_period_fq","fiscal_period_fh","earnings_release_date_fq_h","earnings_release_date_fy_h","earnings_release_date_fh_h","earnings_release_next_date_fq","earnings_release_next_date_fy","earnings_release_next_date_fh","earnings_release_next_time","is_next_earnings_release_date_estimated","earnings_per_share_forecast_next_fq","earnings_per_share_forecast_next_fy","earnings_per_share_forecast_next_fh","earnings_per_share_forecast_fq_h","earnings_per_share_forecast_fy_h","earnings_per_share_forecast_fh_h","earnings_per_share_fq_h","earnings_per_share_fy_h","earnings_per_share_fh_h","earnings_fiscal_period_fq_h","earnings_fiscal_period_fy_h","earnings_fiscal_period_fh_h","next_earnings_fiscal_period_fq","next_earnings_fiscal_period_fy","next_earnings_fiscal_period_fh","revenue_fq_h","revenue_fy_h","revenue_fh_h","revenue_forecast_fq_h","revenue_forecast_fy_h","revenue_forecast_fh_h","revenue_forecast_next_fq","revenue_forecast_next_fy","revenue_forecast_next_fh","revenue_seg_by_business_h","revenue_seg_by_region_h","dividend_payout_ratio_ttm","dividends_yield_current","dividend_ex_date_upcoming","dividend_amount_upcoming","dividend_amount_recent","dividend_ex_date_recent","dividend_amount_h","total_revenue_fy","total_revenue_fq","total_revenue_fh","gross_profit_fy","gross_profit_fq","gross_profit_fh","ebitda_fy","ebit_fy","net_income_fy","net_income_fq","net_income_fh","total_debt_fy_h","total_debt_fq_h","total_debt_fh_h","free_cash_flow_fy_h","free_cash_flow_fq_h","free_cash_flow_fh_h","cash_n_equivalents_fy_h","cash_n_equivalents_fq_h","cash_n_equivalents_fh_h","total_current_assets_fy","total_current_assets_fq","total_current_assets_fh","total_current_liabilities_fy","total_current_liabilities_fq","total_current_liabilities_fh","total_non_current_assets_fy","total_non_current_assets_fq","total_non_current_assets_fh","total_non_current_liabilities_fy","total_non_current_liabilities_fq","total_non_current_liabilities_fh","loans_net_fy","total_deposits_fy","loan_loss_allowances_fy","price_earnings_fq_h","price_earnings_fy_h","price_earnings_fh_h","price_sales_fq_h","price_sales_fy_h","price_sales_fh_h","diluted_net_income_ttm","total_revenue_ttm","price_earnings_current","price_sales_current","isin","interest_income_fy_h","interest_income_fq_h","interest_income_fh_h","non_interest_income_fy_h","non_interest_income_fq_h","non_interest_income_fh_h","website","doc","explorer","sources","contracts","crypto_common_categories","crypto_asset","community","dividends_availability","earnings_availability","financials_availability","etf_asset_type_exposure","etf_region_exposure","top_holdings","unit-id","options-info","interest_income_fy","interest_income_fq","interest_income_fh","non_interest_income_fy","non_interest_income_fq","non_interest_income_fh","interest_expense_fy","interest_expense_fq","interest_expense_fh","loan_loss_provision_fy","loan_loss_provision_fq","loan_loss_provision_fh","non_interest_expense_fy","non_interest_expense_fq","non_interest_expense_fh","non_oper_income_fy","non_oper_income_fq","non_oper_income_fh","unusual_expense_inc_fy","unusual_expense_inc_fq","unusual_expense_inc_fh","pretax_income_fy","pretax_income_fq","pretax_income_fh","income_tax_fy","income_tax_fq","income_tax_fh","after_tax_other_income_fy","after_tax_other_income_fq","after_tax_other_income_fh","total_non_oper_income_fy","total_non_oper_income_fq","total_non_oper_income_fh","oper_income_fy","oper_income_fq","oper_income_fh","operating_expenses_fy","operating_expenses_fq","operating_expenses_fh","cost_of_goods_fy","cost_of_goods_fq","cost_of_goods_fh","equity_in_earnings_fy","equity_in_earnings_fq","equity_in_earnings_fh","minority_interest_exp_fy","minority_interest_exp_fq","minority_interest_exp_fh","discontinued_operations_fy","discontinued_operations_fq","discontinued_operations_fh","front_contract","pointvalue","unit_id","expiration","aum","asset_class","focus","expense_ratio","launch_date","issuer","brand","homepage","index_tracked","fund_view_mode","common_equity_tier1_ratio_fy_h","common_equity_tier1_ratio_fq_h","common_equity_tier1_ratio_fh_h","tier1_capital_ratio_fy_h","tier1_capital_ratio_fq_h","tier1_capital_ratio_fh_h","total_capital_ratio_fy_h","total_capital_ratio_fq_h","total_capital_ratio_fh_h","etf_holdings_count","contract-description"]),o=new r({
fields:n})},2438:(e,t,i)=>{"use strict";i.d(t,{destroyQuoteSessions:()=>a,getQuoteSessionInstance:()=>o});var s=i(49326),r=i.n(s);const n={};function o(e="full"){return n[e]||function(e="full",t){n[e]=t}(e,new(r())(e)),n[e]}function a(){for(const e in n)if(n.hasOwnProperty(e)){const t=n[e];void 0!==t&&t.destroy(),delete n[e]}}},47562:(e,t,i)=>{"use strict";i.d(t,{QuoteSession:()=>r});var s=i(36174);class r{constructor(e,t=(0,s.randomHash)()){this._sessionstarted=!1,this._globalHandler=null,this._chartApi=e,this._sessionid="qs_"+t}destroy(){this._sessionstarted&&(this._chartApi.quoteDeleteSession(this._sessionid),this._sessionstarted=!1)}connected(){return this._chartApi.connected()}connect(e){this._globalHandler=e,this._chartApi.createSession(this._sessionid,this),this._chartApi.connect()}disconnect(){this._chartApi.disconnect()}quoteAddSymbols(e){this._chartApi.quoteAddSymbols(this._sessionid,e)}quoteRemoveSymbols(e){this._chartApi.quoteRemoveSymbols(this._sessionid,e)}quoteFastSymbols(e){this._chartApi.quoteFastSymbols(this._sessionid,e)}quoteSetFields(e){this._chartApi.quoteSetFields(this._sessionid,e)}onMessage(e){var t;switch(e.method){case"connected":this._sessionstarted||(this._chartApi.quoteCreateSession(this._sessionid),this._sessionstarted=!0);break;case"disconnected":this._sessionstarted=!1}null===(t=this._globalHandler)||void 0===t||t.call(this,e)}quoteHibernateAll(){this._chartApi.quoteHibernateAll(this._sessionid)}}window.TradingView.QuoteSession=r},49326:(e,t,i)=>{"use strict";e=i.nmd(e);var s=i(43370).default,r=i(12481).default,n=i(71766).PriceFormatter;const{uniq:o}=i(15051);var a=i(36174);const{normalizeUpdateMode:l}=i(5370);var c=i(30888).deepExtend;const{QUOTE_FIELDS_CACHE:h,QUOTE_FIELDS:d}=i(67545);var u,p=i(57898).Delegate;function _(e,t){this.options=Object.assign({throttleTimeout:125},t),this._connected=!1,this._symbol_data={},this._subscriptions={},this.onConnect=new p,this.onDisconnect=new p,this._quoteApi=new u(window.ChartApiInstance),this._type=e||"full",this._delayUpdateFastSymbols=r(this._updateFastSymbols,250),this._throttledSymbolData={},this._formatterValuesCache={},this._waitingForFormatters={},this._snapshotValuesCache={},this._waitingForSnapshot={},this.connect()}u=i(47562).QuoteSession,_.prototype.destroy=function(){this._quoteApi.destroy(),this._quoteApi=null,this._connected=!1,this.onDisconnect.fire()},_.prototype.typeFields={},_.prototype.typeFields.simple=["base-currency-logoid","ch","chp","currency-logoid","currency_code","currency_id","base_currency_id","current_session","description","exchange","format","fractional","is_tradable","language","local_description","listed_exchange","logoid","lp","lp_time","minmov","minmove2","original_name","pricescale","pro_name","short_name","type","typespecs","update_mode","volume","variable_tick_size","value_unit_id"],
_.prototype.typeFields.simpleDetailed=[].concat(_.prototype.typeFields.simple,["ask","bid","fundamentals","high_price","is_tradable","low_price","open_price","prev_close_price","rch","rchp","rtc","rtc_time","status","basic_eps_net_income","beta_1_year","earnings_per_share_basic_ttm","industry","market_cap_basic","price_earnings_ttm","sector","volume","dividends_yield","timezone"]),_.prototype.typeFields.full=[],_.prototype.typeFields.watchlist=[].concat(_.prototype.typeFields.simple,["rchp","rtc","country_code","provider_id"]),_.prototype.typeFields.portfolio=["pro_name","short_name","exchange","listed_exchange","description","sector","type","typespecs","industry","currency_code","currency_id","ch","chp","logoid","currency-logoid","base-currency-logoid","earnings_per_share_forecast_next_fq","earnings_release_next_date","earnings_release_date","earnings_per_share_fq","lp","fractional","minmov","minmove2","pricescale","volume","average_volume","market_cap_basic","total_revenue","earnings_per_share_basic_ttm","price_earnings_ttm","beta_1_year","dps_common_stock_prim_issue_fy","dividends_yield","fundamental_currency_code","rates_mc","rates_fy","rates_ttm","format","value_unit_id"],_.prototype.typeFields.notes=["short_name","pro_name","logoid","currency-logoid","base-currency-logoid","symbol-primaryname","type","typespecs"],_.prototype.typeFields.estimates=["fundamental_data","type","typespecs","earnings_per_share_forecast_next_symbol_currency_fq","earnings_release_next_aligned_date","earnings_release_next_calendar_date","earnings_release_next_date"],_.prototype.connect=function(e){this._quoteApi.connect(this.quoteHandler.bind(this))},_.prototype.quoteHandler=function(e){var t=e.method,i=e.params;switch(t){case"connected":this._connected||(this._connected=!0,this.onConnected());break;case"quote_list_fields":break;case"quote_symbol_data":this._connected&&this.onSymbolData(i[0]);break;case"quote_completed":this._connected&&this.onSymbolData({symbolname:i[0],complete:performance.now(),values:{}});break;case"disconnected":this._connected&&(this._connected=!1,this.onDisconnect.fire())}},_.prototype.onConnected=function(){this.setFields();var e=Object.keys(this._symbol_data);e.length&&(this._quoteApi.quoteAddSymbols(e),this._delayUpdateFastSymbols()),this.onConnect.fire()},_.prototype.setFields=function(){var e=_.prototype.typeFields[this._type];e&&e.length&&this._quoteApi.quoteSetFields(e)},_.prototype.onSymbolData=function(e){try{e.status&&h.update(e,d,!1)}catch(e){}var t=e.symbolname,i=this._throttledSymbolData[t];i||(i=this._throttledSymbolData[t]={fnDispatch:s(this.dipatchSymbolData.bind(this),this.options.throttleTimeout)}),i.cache?c(i.cache,e):i.cache=e,i.fnDispatch(t)},_.prototype._parseUpdateMode=function(e){l(e)},_.prototype.dipatchSymbolData=function(e){var t=this._symbol_data[e],i=this._throttledSymbolData[e].cache;if(delete this._throttledSymbolData[e].cache,this._symbol_data[e])for(var s in c(t,i),t.values&&this._parseUpdateMode(t.values),this._subscriptions){var r=this._subscriptions[s]
;r.has(e)&&[...r.get(e)].forEach((function(e){e(t,i)}))}},_.prototype.subscribe=function(e,t,i){this._subscriptions[e]=this._subscriptions[e]||new Map;var s=this._subscriptions[e];t=[].concat(t);var r=[];t.forEach((function(e){this._symbol_data[e]?s&&s.has(e)||this._symbol_data[e].subscribers_count++:(this._symbol_data[e]={subscribers_count:1},r.push(e)),s.has(e)||s.set(e,[]),s.get(e).push(i),s.get(e).fast=!0,this._symbol_data[e]&&this._symbol_data[e].values&&i(this._symbol_data[e],this._symbol_data[e])}),this),r.length&&this._connected&&(this._quoteApi.quoteAddSymbols(r),this._delayUpdateFastSymbols())},_.prototype.unsubscribe=function(e,t,i){t=[].concat(t);for(var s=this._subscriptions[e],r=[],n=0;n{"use strict";function s(e,t,i){const s=e.get(t);return void 0!==s?s:(e.set(t,i),i)}function r(e,t,i){const s=e.get(t);if(void 0!==s)return s;const r=i();return e.set(t,r),r}function n(e,t,i,n){return r(s(e,t,new Map),i,n)}function o(e,t,i,r,n){const o=s(e,t,new Map),a=s(o,i,new Map);return s(a,r,n)}i.d(t,{AbstractMapContainer:()=>a,getDefault2Lazy:()=>n,getDefault3:()=>o});class a{constructor(){this._map=new Map,this._size=0}size(){return this._size}clear(){this._map.clear(),this._size=0}}},78071:(e,t,i)=>{"use strict";i.d(t,{compareTwoCollectionsByIds:()=>v,indexOf:()=>f,intersect:()=>_,join:()=>m,lowerbound:()=>o,lowerboundExt:()=>n,lowerbound_int:()=>a,moveAfter:()=>u,moveBefore:()=>p,moveToHead:()=>d,removeItemFromArray:()=>g,subtract:()=>h,upperbound:()=>l,upperbound_int:()=>c});var s=i(50151);function r(e,t){return e>1,o=s+r;i(e(o),t)?(s=o+1,n-=r+1):n=r}return s}function o(e,t,i,s=0,r=e.length){return n((t=>e[t]),t,i,s,r)}function a(e,t,i=0,s=e.length){return o(e,t,r,i,s)}function l(e,t,i,s=0,r=e.length){let n=r-s;for(;0>1,o=s+r;i(t,e[o])?n=r:(s=o+1,n-=r+1)}return s}function c(e,t,i=0,s=e.length){return l(e,t,r,i,s)}function h(e,t){return e.filter((e=>!t.includes(e)))}function d(e,t){const i=e.indexOf(t);return i<0?e.slice():[t].concat(e.slice(0,i)).concat(e.slice(i+1))}function u(e,t,i){const s=new Set(t),r=[],n=[],o=[];return e.forEach(((e,t)=>{s.has(e)?n.push(e):(r.push(e),o.push(t))})),i=i{s.has(e)?n.push(e):(r.push(e),o.push(t))})),i=i<=e.length-1?a(o,i):r.length,r.splice(i,0,...n),{newItems:r,movedItemsStartIndex:i}}function _(e,t){const i=new Set;return e.forEach((e=>{t.has(e)&&i.add(e)})),i}function m(e,t){const i=new Set(e);return t.forEach((e=>i.add(e))),i}function g(e,t){const i=e.indexOf(t);(0,s.assert)(-1!==i,"Item is not found"),e.splice(i,1)}function f(e,t){for(let i=0;i{"use strict";var s=i(84917),r=i(96429).tzData;let n;function o(e){this._name=e;var t=r[e];if(!t&&n&&(t=n.instance().getTimezoneData(e)),t||(t={time:[],offset:[]},this._invalid=!0),t.time.length!==t.offset.length&&(t={time:[],offset:[]},this._invalid=!0),!t.time_utc){for(var i=t.time,s=t.offset,o=i.length,a=new Array(o),l=0;lt){if((r=n-1)0&&e-t[s-1]<=r)return r;return 0},o.prototype.is_valid=function(){return!this._invalid},o._offset=function(e,t,i){var s=a(e,i);return-1===s?0:t[s]};var l=function(e){return 0|e},c=function(e){return 60*e*1e3},h=function(e,t){return d(e)-d(t)},d=function(e){return e<0?l(e/1e3)-(e%1e3!=0?1:0):l(e/1e3)};function u(e){return e%4==0&&(e%100!=0||e%400==0)}var p={0:0,1:31,2:59,3:90,4:120,5:151,6:181,7:212,8:243,9:273,10:304,11:334},_={...s.WeekDays,...s.Months,YEAR:1,MONTH:2,WEEK_OF_YEAR:3,DAY_OF_MONTH:5,DAY_OF_YEAR:6,DAY_OF_WEEK:7,HOUR_OF_DAY:11,MINUTE:12,SECOND:13,minutesPerDay:1440,millisecondsPerDay:c(1440),get_minutes_from_hhmm:function(e){return-1!==e.indexOf(":")&&(e=e.split(":").join("")),e%100+60*l(e/100)},get_year:function(e){return e.getUTCFullYear()},get_month:function(e){return e.getUTCMonth()},get_hours:function(e){return e.getUTCHours()},get_minutes:function(e){return e.getUTCMinutes()},get_seconds:function(e){return e.getUTCSeconds()},get_day_of_month:function(e){return e.getUTCDate()},get_day_of_week:function(e){return e.getUTCDay()+1},get_day_of_year:function(e){var t=e.getUTCMonth(),i=p[t];return t>_.JANUARY+1&&u(e.getUTCFullYear())&&(i+=1),i+e.getUTCDate()},get_week_of_year:function(e){var t=new Date(Date.UTC(e.getUTCFullYear(),0,1)).getUTCDay(),i=0===t?1:8-t,s=_.get_day_of_year(e)-i;return Math.ceil(s/7)+1},get_minutes_from_midnight:function(e){return 60*_.get_hours(e)+_.get_minutes(e)},set_hms:function(e,t,i,s,r,n){e.setUTCHours(t),e.setUTCMinutes(i),e.setUTCSeconds(s),e.setUTCMilliseconds(r),void 0!==n&&_.correct_time(e,n)},correct_time:function(e,t){var i=e.getTime(),s=t.correction_loc(i);e.setTime(i+s)},add_days_considering_dst:function(e,t,i){var s=e.offset_utc(t),r=this.clone(t);this.add_date(r,i);var n=e.offset_utc(r);return r.setTime(r.getTime()+s-n),r},add_years_considering_dst:function(e,t,i){let s=t;for(let t=Math.abs(i);t>0;t--)s=this.add_days_considering_dst(e,s,this.get_days_per_year(s)*Math.sign(i));return s},add_date:function(e,t){e.setTime(e.getTime()+t*_.millisecondsPerDay)},add_minutes:function(e,t){e.setTime(e.getTime()+c(t))},clone:function(e){return new Date(e.getTime())},get_days_per_year:function(e){var t=e.getUTCFullYear();return this.days_per_year(t)},days_per_year:function(e){return u(e)?366:365},get_days_in_month:function(e,t){let i;switch(e){case 0:case 2:case 4:case 6:case 7:case 9:case 11:i=31;break;case 1:i=28,u(t)&&i++;break;default:i=30}return i},get_part:function(e,t){switch(t){case _.YEAR:return _.get_year(e);case _.MONTH:return _.get_month(e);case _.DAY_OF_MONTH:return _.get_day_of_month(e);case _.WEEK_OF_YEAR:return _.get_week_of_year(e);case _.DAY_OF_WEEK:return _.get_day_of_week(e);case _.HOUR_OF_DAY:return _.get_hours(e);case _.MINUTE:return _.get_minutes(e);case _.DAY_OF_YEAR:return _.get_day_of_year(e);case _.SECOND:return _.get_seconds(e);default:return e.getTime()}},time_minutes:c,
time_seconds:function(e){return 1e3*e},time_minutes_diff:function(e,t){return l(h(e,t)/60)},time_seconds_diff:h,utc_to_cal:function(e,t){return new Date(_.utc_to_cal_ts(e,t))},utc_to_cal_ts:function(e,t){return t+e.offset_utc(t)},get_cal:function(e,t,i,s,r,n,o){var a=new Date(Date.UTC(t,i,s,r||0,n||0,o||0)),l=e.offset_utc(+a);return new Date(a.valueOf()-l)},get_cal_from_unix_timestamp_ms:function(e,t){return new Date(t+e.offset_utc(t))},get_cal_utc:function(e,t,i){return new Date(Date.UTC(e,t,i))},cal_to_utc:function(e,t){var i=t.getTime();return i-e.offset_loc(i)},get_timezone:function(e){return new o(e)},shift_day:function(e,t){var i=e-1;return(i+=t)>6?i%=7:i<0&&(i=(7+i%7)%7),i+1},setCustomTimezones:function(e){n=e}};e.exports=_},79849:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LINESTYLE_DASHED:()=>n,LINESTYLE_DOTTED:()=>r,LINESTYLE_LARGE_DASHED:()=>o,LINESTYLE_SMALL_DASHED:()=>l,LINESTYLE_SOLID:()=>s,LINESTYLE_SPARSE_DOTTED:()=>a});const s=0,r=1,n=2,o=3,a=4,l=5},42449:(e,t,i)=>{"use strict";i.d(t,{CircularCacheBuffer:()=>n});var s=i(50151);function r(e){const{prevItem:t,nextItem:i}=e;null!==t&&(t.nextItem=i),null!==i&&(i.prevItem=t)}class n{constructor(e=0,t=1.3){this._cache=new Map,this._lastItem=null,this._firstItem=null,this._size=e,this._sizeLimited=e>0,this._capacityFactor=t}set(e,t){const i={key:e,value:t,prevItem:this._lastItem,nextItem:null};null!==this._lastItem&&(this._lastItem.nextItem=i);const s=this._cache.get(e);return void 0!==s&&(r(s),s===this._firstItem&&(this._firstItem=s.nextItem)),this._cache.set(e,i),this._lastItem=i,null===this._firstItem&&(this._firstItem=i),this._sizeLimited&&this._cache.size>this._size*this._capacityFactor&&this._removeExtraItems(),this}has(e){return this._cache.has(e)}get(e){var t;const i=this._cache.get(e);if(void 0===i)return i;if(i===this._firstItem&&(this._firstItem=null!==(t=i.nextItem)&&void 0!==t?t:i),i!==this._lastItem){r(i);const e=(0,s.ensureNotNull)(this._lastItem);e.nextItem=i,i.prevItem=e,i.nextItem=null,this._lastItem=i}return i.value}clear(){this._cache.clear(),this._firstItem=null,this._lastItem=null}delete(e){const t=this._cache.get(e);return void 0!==t&&(r(t),t===this._lastItem&&(this._lastItem=t.prevItem),t===this._firstItem&&(this._firstItem=t.nextItem)),this._cache.delete(e)}_removeExtraItems(){const e=this._cache.size-this._size;let t=(0,s.ensureNotNull)(this._firstItem);for(let i=0;i{"use strict";i.d(t,{combine:()=>o,combineWithFilteredUpdate:()=>n});var s=i(97145);function r(e,t,...i){const r=(...t)=>e(...t.map((e=>e.value()))),n=new s.WatchedValue(r(...i)),o=()=>{t(...i.map((e=>e.value())))&&n.setValue(r(...i))},a=i.map((e=>e.spawn()));for(const e of a)e.subscribe(o);return n.readonly().spawn((()=>{a.forEach((e=>e.destroy())),i.forEach((e=>e.release()))}))}function n(e,t,...i){return r(e,t,...i)}function o(e,...t){return r(e,(()=>!0),...t)}},38618:(e,t,i)=>{"use strict";i.r(t),i.d(t,{availableTimezones:()=>l,timezoneIsAvailable:()=>u,
timezoneIsSupported:()=>p,timezoneTitle:()=>_,updateAvailableTimezones:()=>d});var s=i(11542),r=i(88270);const n=[{id:"Etc/UTC",title:s.t(null,void 0,i(50406))},{id:"exchange",title:s.t(null,void 0,i(77295))}],o=[{id:"Africa/Cairo",title:s.t(null,void 0,i(94099)),offset:0},{id:"Africa/Casablanca",title:s.t(null,void 0,i(53705)),offset:0},{id:"Africa/Johannesburg",title:s.t(null,void 0,i(87469)),offset:0},{id:"Africa/Lagos",title:s.t(null,void 0,i(89155)),offset:0},{id:"Africa/Nairobi",title:s.t(null,void 0,i(79023)),offset:0},{id:"Africa/Tunis",title:s.t(null,void 0,i(93855)),offset:0},{id:"America/Anchorage",title:s.t(null,void 0,i(99873)),offset:0},{id:"America/Argentina/Buenos_Aires",title:s.t(null,void 0,i(82446)),offset:0},{id:"America/Bogota",title:s.t(null,void 0,i(54173)),offset:0},{id:"America/Caracas",title:s.t(null,void 0,i(46837)),offset:0},{id:"America/Chicago",title:s.t(null,void 0,i(28244)),offset:0},{id:"America/El_Salvador",title:s.t(null,void 0,i(68553)),offset:0},{id:"America/Juneau",title:s.t(null,void 0,i(36253)),offset:0},{id:"America/Lima",title:s.t(null,void 0,i(25846)),offset:0},{id:"America/Los_Angeles",title:s.t(null,void 0,i(87604)),offset:0},{id:"America/Mexico_City",title:s.t(null,void 0,i(85095)),offset:0},{id:"America/New_York",title:s.t(null,void 0,i(91203)),offset:0},{id:"America/Phoenix",title:s.t(null,void 0,i(19093)),offset:0},{id:"America/Santiago",title:s.t(null,void 0,i(65412)),offset:0},{id:"America/Sao_Paulo",title:s.t(null,void 0,i(13538)),offset:0},{id:"America/Toronto",title:s.t(null,void 0,i(83836)),offset:0},{id:"America/Vancouver",title:s.t(null,void 0,i(15771)),offset:0},{id:"US/Mountain",title:s.t(null,void 0,i(57701)),offset:0},{id:"Asia/Almaty",title:s.t(null,void 0,i(14452)),offset:0},{id:"Asia/Ashkhabad",title:s.t(null,void 0,i(59340)),offset:0},{id:"Asia/Bahrain",title:s.t(null,void 0,i(53260)),offset:0},{id:"Asia/Bangkok",title:s.t(null,void 0,i(32376)),offset:0},{id:"Asia/Chongqing",title:s.t(null,void 0,i(49648)),offset:0},{id:"Asia/Colombo",title:s.t(null,void 0,i(15168)),offset:0},{id:"Asia/Dhaka",title:s.t(null,void 0,i(24477)),offset:0},{id:"Asia/Dubai",title:s.t(null,void 0,i(22429)),offset:0},{id:"Asia/Ho_Chi_Minh",title:s.t(null,void 0,i(87338)),offset:0},{id:"Asia/Hong_Kong",title:s.t(null,void 0,i(32918)),offset:0},{id:"Asia/Jakarta",title:s.t(null,void 0,i(52707)),offset:0},{id:"Asia/Jerusalem",title:s.t(null,void 0,i(42890)),offset:0},{id:"Asia/Karachi",title:s.t(null,void 0,i(2693)),offset:0},{id:"Asia/Kathmandu",title:s.t(null,void 0,i(3155)),offset:0},{id:"Asia/Kolkata",title:s.t(null,void 0,i(16245)),offset:0},{id:"Asia/Kuwait",title:s.t(null,void 0,i(72374)),offset:0},{id:"Asia/Manila",title:s.t(null,void 0,i(90271)),offset:0},{id:"Asia/Muscat",title:s.t(null,void 0,i(42769)),offset:0},{id:"Asia/Nicosia",title:s.t(null,void 0,i(33566)),offset:0},{id:"Asia/Qatar",title:s.t(null,void 0,i(19056)),offset:0},{id:"Asia/Riyadh",title:s.t(null,void 0,i(52588)),offset:0},{id:"Asia/Seoul",title:s.t(null,void 0,i(5961)),offset:0},{id:"Asia/Shanghai",
title:s.t(null,void 0,i(69240)),offset:0},{id:"Asia/Singapore",title:s.t(null,void 0,i(56683)),offset:0},{id:"Asia/Taipei",title:s.t(null,void 0,i(38788)),offset:0},{id:"Asia/Tehran",title:s.t(null,void 0,i(16267)),offset:0},{id:"Asia/Tokyo",title:s.t(null,void 0,i(94284)),offset:0},{id:"Asia/Yangon",title:s.t(null,void 0,i(69293)),offset:0},{id:"Atlantic/Reykjavik",title:s.t(null,void 0,i(26833)),offset:0},{id:"Australia/Adelaide",title:s.t(null,void 0,i(17365)),offset:0},{id:"Australia/Brisbane",title:s.t(null,void 0,i(11741)),offset:0},{id:"Australia/Perth",title:s.t(null,void 0,i(35590)),offset:0},{id:"Australia/Sydney",title:s.t(null,void 0,i(11020)),offset:0},{id:"Europe/Amsterdam",title:s.t(null,void 0,i(88010)),offset:0},{id:"Europe/Athens",title:s.t(null,void 0,i(21983)),offset:0},{id:"Europe/Belgrade",title:s.t(null,void 0,i(54861)),offset:0},{id:"Europe/Berlin",title:s.t(null,void 0,i(26825)),offset:0},{id:"Europe/Bratislava",title:s.t(null,void 0,i(5262)),offset:0},{id:"Europe/Brussels",title:s.t(null,void 0,i(90204)),offset:0},{id:"Europe/Bucharest",title:s.t(null,void 0,i(37728)),offset:0},{id:"Europe/Budapest",title:s.t(null,void 0,i(87143)),offset:0},{id:"Europe/Copenhagen",title:s.t(null,void 0,i(43432)),offset:0},{id:"Europe/Dublin",title:s.t(null,void 0,i(9497)),offset:0},{id:"Europe/Helsinki",title:s.t(null,void 0,i(99820)),offset:0},{id:"Europe/Istanbul",title:s.t(null,void 0,i(37885)),offset:0},{id:"Europe/Lisbon",title:s.t(null,void 0,i(50091)),offset:0},{id:"Europe/London",title:s.t(null,void 0,i(50286)),offset:0},{id:"Europe/Luxembourg",title:s.t(null,void 0,i(64352)),offset:0},{id:"Europe/Madrid",title:s.t(null,void 0,i(58038)),offset:0},{id:"Europe/Malta",title:s.t(null,void 0,i(34190)),offset:0},{id:"Europe/Moscow",title:s.t(null,void 0,i(18665)),offset:0},{id:"Europe/Oslo",title:s.t(null,void 0,i(82906)),offset:0},{id:"Europe/Paris",title:s.t(null,void 0,i(95995)),offset:0},{id:"Europe/Prague",title:s.t(null,void 0,i(46298)),offset:0},{id:"Europe/Riga",title:s.t(null,void 0,i(5871)),offset:0},{id:"Europe/Rome",title:s.t(null,void 0,i(74214)),offset:0},{id:"Europe/Stockholm",title:s.t(null,void 0,i(48767)),offset:0},{id:"Europe/Tallinn",title:s.t(null,void 0,i(39108)),offset:0},{id:"Europe/Vienna",title:s.t(null,void 0,i(32166)),offset:0},{id:"Europe/Vilnius",title:s.t(null,void 0,i(75354)),offset:0},{id:"Europe/Warsaw",title:s.t(null,void 0,i(48474)),offset:0},{id:"Europe/Zurich",title:s.t(null,void 0,i(84301)),offset:0},{id:"Pacific/Auckland",title:s.t(null,void 0,i(24143)),offset:0},{id:"Pacific/Chatham",title:s.t(null,void 0,i(59884)),offset:0},{id:"Pacific/Fakaofo",title:s.t(null,void 0,i(20466)),offset:0},{id:"Pacific/Honolulu",title:s.t(null,void 0,i(61351)),offset:0},{id:"Pacific/Norfolk",title:s.t(null,void 0,i(99203)),offset:0}];function a(e,t,i){const s=function(e){return e.map((({id:e,title:t})=>{const{string:i,offset:s}=(0,r.parseTzOffset)(e);return{id:e,offset:s,title:`(${i}) ${t}`}}))}(e),n=i.filter((({alias:e})=>Boolean(e))).map((({title:e,alias:t,id:i})=>{
const{string:s,offset:n}=(0,r.parseTzOffset)(t);return{id:i,offset:n,title:`(${s}) ${e}`,alias:t}})),o=function(e){return e.sort(((e,t)=>{const i=e.offset-t.offset;return 0!==i?i:e.title.localeCompare(t.title)}))}(s.concat(n));return t.concat(o)}const l=a(o,n,[]),c=new Map;l.forEach((e=>{c.set(e.id,!0)}));const h=new Map;n.concat(o).forEach((e=>{h.set(e.id,!0)}));const d=e=>{l.splice(0,l.length,...a(o,n,e)),l.forEach((e=>{c.set(e.id,!0)}))};function u(e){return c.has(e)}function p(e){return h.get(e)||!1}function _(e){for(const{id:t,title:i}of o)if(t===e){return`${i} (${(0,r.parseTzOffset)(e).string})`}for(const{id:t,title:i}of l)if(t===e)return`${i}`;return e}},57898:(e,t,i)=>{"use strict";i.d(t,{Delegate:()=>n});const s=(0,i(44441).getLogger)("Common.Delegate");function r(e){return!e.singleShot}class n{constructor(){this.fire=this._fireImpl.bind(this),this._listeners=[]}subscribe(e,t,i){this._listeners.push({object:e,member:t,singleShot:!!i,skip:!1})}unsubscribe(e,t){for(let i=0;i=0;--t){const i=this._listeners[t];i.object===e&&(i.skip=!0,this._listeners.splice(t,1))}}destroy(){this._listeners=[]}_fireImpl(...e){const t=this._listeners;this._listeners=this._listeners.filter(r);const i=t.length;for(let r=0;r{"use strict";i.d(t,{getImage:()=>n});const s=new Map;function r(e){e.crossOrigin="anonymous"}function n(e,t,i=r){let n=s.get(e);return void 0===n&&(n=new Promise(((e,s)=>{const r=new Image;r.onload=()=>{e(r),r.onload=null,r.onerror=null},r.onerror=()=>{s(),r.onload=null,r.onerror=null},i(r),r.src=t})),s.set(e,n)),n}},19782:(e,t,i)=>{"use strict";function s(e){const t=Object.create(e);return t.release=()=>{},t.ownership=()=>t,t}function r(e){const t=Object.create(e);return t.release=()=>e.destroy(),t.ownership=()=>t,t}i.d(t,{ownership:()=>r,weakReference:()=>s})},44441:(e,t,i)=>{"use strict";i.d(t,{LOGLEVEL:()=>n,getLogHistory:()=>b,getLogLevel:()=>g,getLogger:()=>C,getRawLogHistory:()=>S,isHighRateEnabled:()=>f,loggingOff:()=>T,loggingOn:()=>x,serializeLogHistoryEntry:()=>y,setLogLevel:()=>v});const s="undefined"!=typeof window?window:{};let r=!1;try{localStorage.getItem(""),r=!0}catch(e){}var n;!function(e){e[e.ERROR=1]="ERROR",e[e.WARNING=2]="WARNING",e[e.INFO=3]="INFO",e[e.NORMAL=4]="NORMAL",e[e.DEBUG=5]="DEBUG"}(n||(n={}));let o=0;const a="tv.logger.loglevel",l="tv.logger.logHighRate",c=[];let h=null,d=null,u=null,p=NaN,_=n.WARNING,m=!1;function g(){return _}function f(){return m}function v(e){e=Math.max(n.ERROR,Math.min(n.DEBUG,e)),_=e,I()}function S(e,t){let i=c.reduce(((e,t)=>e.concat(t)),[]);return i.sort(((e,t)=>e.id-t.id)),void 0!==t&&(i=i.filter((e=>e.subSystemId===t))),"number"==typeof e&&(i=i.slice(-e)),i}function y(e){
return new Date(e.timestamp).toISOString()+":"+e.subSystemId+":"+e.message.replace(/"/g,"'")}const b=s.lget=(e,t)=>function(e,t){let i,s=0,r=0;for(i=e.length-1;i>=1&&(s+=8*(1+encodeURIComponent(e[i]).length),!(i-1>0&&(r=8*(1+encodeURIComponent(e[i-1]).length),s+r>t)));i--);return e.slice(i)}(S(e,t).map(y),75497472);function w(e,t,i,s){if(t===d&&s.id===u)return;const r=new Date;if(e<=n.NORMAL&&function(e,t,i,s,r){"function"==typeof structuredClone&&(t=structuredClone(t));const n={id:o,message:t,subSystemId:s,timestamp:Number(e)};o+=1,i.push(n),void 0!==r&&i.length>r&&i.splice(0,1)}(r,t,i,s.id,s.maxCount),e<=_&&(!s.highRate||f())&&(!h||s.id.match(h))){const i=r.toISOString()+":"+s.id+":"+t;switch(e){case n.DEBUG:console.debug(i);break;case n.INFO:case n.NORMAL:s.color?console.log("%c"+i,"color: "+s.color):console.log(i);break;case n.WARNING:console.warn(i);break;case n.ERROR:console.error(i)}d=t,u=s.id,p&&clearTimeout(p),p=setTimeout((()=>{d=null,u=null,p=NaN}),1e3)}}function C(e,t={}){const i=[];c.push(i);const s=Object.assign(t,{id:e});function r(e){return t=>w(e,String(t),i,s)}return{logDebug:r(n.DEBUG),logError:r(n.ERROR),logInfo:r(n.INFO),logNormal:r(n.NORMAL),logWarn:r(n.WARNING)}}const P=C("logger"),x=s.lon=(e,t)=>{v(n.DEBUG),P.logNormal("Debug logging enabled"),m=Boolean(e),h=t||null,I()},T=s.loff=()=>{v(n.INFO),P.logInfo("Debug logging disabled")};function I(){try{r&&(localStorage.setItem(l,String(m)),localStorage.setItem(a,String(_)))}catch(e){P.logWarn(`Cannot save logger state (level: ${_}, high-rate: ${m}) to localStorage: ${e.message}`)}}!function(){m=!!r&&"true"===localStorage.getItem(l);let e=parseInt(r&&localStorage.getItem(a)||"");Number.isNaN(e)&&(e=n.WARNING),v(e),P.logNormal(`Init with settings - level: ${_}, high-rate: ${m}`)}(),s.performance&&s.performance.now?P.logNormal(`Sync logger and perf times, now is ${s.performance.now()}`):P.logWarn("Perf time is not available")},37160:(e,t,i)=>{"use strict";function s(e,t){return e<=t}function r(e,t){return e>=t}function n(e,t,i){return Math.min(Math.max(e,t),i)}function o(e){return e<0?-1:e>0?1:0}function a(e){if(e<0)return!1;if(e>1e18)return!0;for(let t=e;t>1;t/=10)if(t%10!=0)return!1;return!0}function l(e,t,i){return t-e<=i}function c(e,t,i){return Math.abs(e-t)t?1:0}function u(e,t=d){if(e.length<1)throw Error("array is empty");let i=e[0];for(let s=0;s0&&(i=e[s]);return i}function _(e){const t=Math.ceil(e);return t%2!=0?t-1:t}function m(e){return e>0?Math.floor(e):Math.ceil(e)}i.r(t),i.d(t,{ceiledEven:()=>_,clamp:()=>n,defComparator:()=>d,equal:()=>c,greaterOrEqual:()=>l,greaterThan:()=>r,isBaseDecimal:()=>a,lessThan:()=>s,log10:()=>h,max:()=>p,min:()=>u,sign:()=>o,toInt:()=>m})},88270:(e,t,i)=>{"use strict";i.d(t,{parseTzOffset:()=>r});var s=i(41249);function r(e,t=Date.now()){const i=(0,
s.get_timezone)(e).offset_utc(t);let r="";const n=i/1e3/60/60;n%1&&(r=":"+Math.round(Math.abs(n%1*60)).toString().padStart(2,"0"));let o="";return o=n>0?"+"+(n-n%1)+r:0===n?"":String(n-n%1+r),{offset:i,string:"UTC"+o}}},91349:(e,t,i)=>{"use strict";function s(e,t){return!!(null==t?void 0:t.includes("cfd"))&&["commodity","futures","index","stock","fund"].includes(e)}i.d(t,{isCFDSymbol:()=>s})},79982:(e,t,i)=>{"use strict";var s=i(14483),r=[{d:"E-Mini S&P 500",t:"ES"},{d:"E-Mini Nasdaq 100",t:"NQ"},{d:"Gold",t:"GC"},{d:"Silver",t:"SI"},{d:"Crude Oil WTI",t:"CL"},{d:"Natural Gas",t:"NG"},{d:"Australian Dollar",t:"6A"},{d:"Australian Dollar (Floor)",t:"AD"},{d:"Euro FX",t:"6E"},{d:"Euro FX (Floor)",t:"EC"},{d:"Corn",t:"ZC"},{d:"Corn (Floor)",t:"C"},{d:"Eurodollar",t:"GE"},{d:"Eurodollar (Floor)",t:"ED"}],n=function(){var e=[{pattern:"(",ctor:o},{pattern:")",ctor:a},{pattern:"+",ctor:c},{pattern:"-",ctor:h},{pattern:"*",ctor:d},{pattern:"/",ctor:u},{pattern:"^",ctor:p},{pattern:/\d+(?:\.\d*|(?![a-zA-Z0-9_!:.&]))|\.\d+/,ctor:f},{pattern:/\./,ctor:y},{pattern:s.enabled("charting_library_base")?/[a-zA-Z0-9_\u0370-\u1FFF_\u2E80-\uFFFF^][a-zA-Z0-9_\u0020\u0370-\u1FFF_\u2E80-\uFFFF_!:.&]*|'.+?'/:/[a-zA-Z0-9_\u0370-\u1FFF_\u2E80-\uFFFF][a-zA-Z0-9_\u0020\u0370-\u1FFF_\u2E80-\uFFFF_!|:.&]*|'.+?'/,ctor:g},{pattern:/'[^']*/,ctor:S},{pattern:/[\0-\x20\s]+/,ctor:n}];function t(e,t){var i=function(){};return i.prototype=t.prototype,e.prototype=new i,e}function i(){}function n(e){this.value=e}function o(){}function a(){}function l(){}function c(){}function h(){}function d(){}function u(){}function p(){}i.prototype.toString=function(){return this.value},t(n,i),t(o,i),o.prototype.value="(",t(a,i),a.prototype.value=")",t(l,i),t(c,l),c.prototype.value="+",c.prototype.precedence=0,c.prototype.commutative=!0,t(h,l),h.prototype.value="-",h.prototype.precedence=0,h.prototype.commutative=!1,t(d,l),d.prototype.value="*",d.prototype.precedence=1,d.prototype.commutative=!0,t(u,l),u.prototype.value="/",u.prototype.precedence=1,u.prototype.commutative=!1,t(p,l),p.prototype.value="^",p.prototype.precedence=2,p.prototype.commutative=!1;var _=/^'?(?:([A-Z0-9_]+):)?(.*?)'?$/i,m=/[+\-/*]/;function g(e){this.value=e}function f(e){this.value=e}function v(e){this.value=e}function S(){g.apply(this,arguments)}function y(){f.apply(this,arguments)}t(g,i),g.prototype.toString=function(){if(this.hasOwnProperty("_ticker")){var e=m.test(this._ticker)?"'":"";return e+(this._exchange?this._exchange+":":"")+this._ticker+e}return this.value},g.prototype.parse=function(){var e=_.exec(this.value);e[1]&&(this._exchange=e[1]),this._ticker=e[2]},g.prototype.parseAsFutures=function(){this.hasOwnProperty("_ticker")||this.parse();for(var e=function(e){return r.some((function(t){return t.t===e}))},t=2;t>=1;--t){var i=this._ticker.slice(0,t);if(e(i)){this._root=i,this._contract=this._ticker.slice(t);break}}},g.prototype.exchange=function(e){if(this.hasOwnProperty("_ticker")||this.parse(),!(arguments.length>0))return this._exchange;null==e?delete this._exchange:this._exchange=e+""
},g.prototype.ticker=function(e){if(this.hasOwnProperty("_ticker")||this.parse(),!(arguments.length>0))return this._ticker;null==e?delete this._ticker:this._ticker=e+"",delete this._root,delete this._contract},g.prototype.root=function(e){if(this.hasOwnProperty("_root")||this.parseAsFutures(),!(arguments.length>0))return this._root;null==e?delete this._root:(this._root=e+"",this._root&&(this._ticker=this._root+(this._contract||"")))},g.prototype.contract=function(e){if(this.hasOwnProperty("_contract")||this.parseAsFutures(),!(arguments.length>0))return this._root;null==e?delete this._contract:(this._contract=e+"",this._root&&(this._ticker=this._root+this._contract))},t(f,i),f.prototype.toString=function(){return this.hasOwnProperty("_normalizedValue")?this._normalizedValue:this.value},f.prototype.parse=function(){this._normalizedValue=this.value.replace(/^0+|\.0*$/g,"").replace(/(\.\d*?)0+$/,"$1").replace(/^(\.|$)/,"0$1")},v.prototype.toString=function(){return this.value},t(S,g),S.prototype.isIncomplete=!0,S.prototype.incompleteSuggest=function(){if("'"!==this.value)return String("'")},t(y,f),y.prototype.isIncomplete=!0;var b=new RegExp(e.map((function(e){return"("+("string"==typeof e.pattern?e.pattern.replace(/[\^$()[\]{}*+?|\\]/g,"\\$&"):e.pattern.source)+")"})).concat(".").join("|"),"g");function w(t,i){var s,r=[];e:for(;s=b.exec(t);){for(var o=e.length;o--;)if(s[o+1]){if(e[o].ctor){var a=new e[o].ctor(s[o+1]);a._offset=s.index,r.push(a)}continue e}var l=new v(s[0]);l._offset=s.index,r.push(l)}if(i&&i.recover){var c;for(o=r.length;o--;){var h=r[o];if(h instanceof f||h instanceof g){if(void 0!==c){var d=new g(""),u=r.splice(o,c-o+1,d);d.value=u.map((function(e){return e.value})).join("")}c=o}else h instanceof n||(c=void 0)}}return r}function C(e){for(var t=[],i=0;in.precedence&&(s[s.length-1].minPrecedence=n.precedence);else if(n instanceof o)s.push(t={minPrecedence:1/0,openBraceIndex:r});else if(n instanceof a){var c=e[(t=s.pop()).openBraceIndex-1],h=e[r+1];h instanceof l&&!(h.precedence<=t.minPrecedence)||!(!(c instanceof l)||c.precedencet.minPrecedence&&(s[s.length-1].minPrecedence=t.minPrecedence))}}for(r=i.length;r--;)e.splice(i[r],1);return e}function x(e){if("string"!=typeof e)throw new TypeError("expression must be a string");return(e=w(e)).filter((function(e){return e instanceof g})).map((function(e){return e.exchange()})).filter((function(e){return e}))}function T(e){return 1!==(e=x(e)).length?null:e[0]}function I(e,t){return(e=x(e)).some((function(e){return t.includes((e||"").toUpperCase())}))}function M(e){return e.join("")}return{tokenize:w,validate:function(e){if(s.enabled("charting_library_base"))return{currentState:"var"};for(var t="init",i="var",r=t,c={warnings:[],errors:[],
isEmpty:!0},h=[],d=0;d{"use strict";i.d(t,{TranslatedString:()=>s});class s{constructor(e,t){this._originalText=e,this._translatedText=t}originalText(){return this._originalText}
translatedText(){return this._translatedText}format(e){const t={},i={};for(const r of Object.keys(e)){const n=e[r];n instanceof s?(t[r]=n.originalText(),i[r]=n.translatedText()):(t[r]=n.toString(),i[r]=n.toString())}const r=this._originalText.format(t),n=this._translatedText.format(i);return new s(r,n)}}},96429:e=>{e.exports.tzData={"America/New_York":{time:[-2717668562,-1633298400,-1615154400,-1601848800,-1583704800,-1570399200,-1551650400,-1536530400,-1523224800,-1504476e3,-1491775200,-1473026400,-1459720800,-1441576800,-1428271200,-1410127200,-1396821600,-1378677600,-1365372e3,-1347228e3,-1333922400,-1315173600,-1301868e3,-1283724e3,-1270418400,-1252274400,-1238968800,-1220824800,-1207519200,-1189375200,-1176069600,-1157320800,-114462e4,-1125871200,-1112565600,-1094421600,-1081116e3,-1062972e3,-1049666400,-1031522400,-1018216800,-1000072800,-986767200,-968018400,-955317600,-936568800,-923263200,-905119200,-891813600,-880236e3,-76941e4,-765410400,-747266400,-733960800,-715816800,-702511200,-684367200,-671061600,-652917600,-639612e3,-620863200,-608162400,-589413600,-576108e3,-557964e3,-544658400,-526514400,-513208800,-495064800,-481759200,-463615200,-447285600,-431560800,-415836e3,-400111200,-384386400,-368661600,-352936800,-337212e3,-321487200,-305762400,-289432800,-273708e3,-257983200,-242258400,-226533600,-210808800,-195084e3,-179359200,-163634400,-147909600,-13158e4,-11646e4,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],
offset:[-17762,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3]},"America/Los_Angeles":{
time:[-2717668378,-1633298400,-1615154400,-1601848800,-1583704800,-880236e3,-769420800,-765410400,-687995940,-662680800,-620866800,-608162400,-589417200,-576108e3,-557967600,-544658400,-526518e3,-513208800,-495068400,-481759200,-463618800,-450309600,-431564400,-418255200,-400114800,-386805600,-368665200,-355356e3,-337215600,-323906400,-305766e3,-292456800,-273711600,-261007200,-242262e3,-226533600,-210812400,-195084e3,-179362800,-163634400,-147913200,-13158e4,-116463600,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],offset:[-28378,-28800,-25200,-28800,-25200,-28800,-25200,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800]},"America/Chicago":{
time:[-2717668236,-1633298400,-1615154400,-1601848800,-1583704800,-1563746400,-1551650400,-1538949600,-1520200800,-1504476e3,-1491775200,-1473026400,-1459720800,-1441576800,-1428271200,-1410127200,-1396821600,-1378677600,-1365372e3,-1347228e3,-1333922400,-1315173600,-1301868e3,-1283724e3,-1270418400,-1252274400,-1238968800,-1220824800,-1207519200,-1189375200,-1176069600,-1157320800,-114462e4,-1125871200,-1112565600,-1094421600,-1081116e3,-1067810400,-1045432800,-1031522400,-1018216800,-1000072800,-986767200,-968018400,-955317600,-936568800,-923263200,-905119200,-891813600,-880236e3,-769413600,-765410400,-747266400,-733960800,-715816800,-702511200,-684367200,-671061600,-652917600,-639612e3,-620863200,-608162400,-589413600,-576108e3,-557964e3,-544658400,-526514400,-513208800,-495064800,-481759200,-463615200,-447285600,-431560800,-415836e3,-400111200,-384386400,-368661600,-352936800,-337212e3,-321487200,-305762400,-289432800,-273708e3,-257983200,-242258400,-226533600,-210808800,-195084e3,-179359200,-163634400,-147909600,-13158e4,-11646e4,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],
offset:[-21036,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600]},"America/Phoenix":{time:[-2717670498,-1633298400,-1615154400,-1601848800,-1583704800,-880236e3,-820540740,-812678340,-796867140,-84405600,-68680800,1924966800],offset:[-26898,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200]},"America/Toronto":{
time:[-2366755200,-1632088800,-1615154400,-1601771400,-1583712e3,-1567375200,-1554681600,-1534716e3,-1524088800,-1503266400,-149238e4,-1471816800,-1460930400,-1440972e3,-1428876e3,-1409522400,-1397426400,-1378072800,-1365976800,-1346623200,-1333922400,-1315173600,-1301868e3,-1283724e3,-1270418400,-1252274400,-1238968800,-1220824800,-1207519200,-1188770400,-1176069600,-1157320800,-1144015200,-1125871200,-1112565600,-1094421600,-1081116e3,-1062972e3,-1049666400,-1031522400,-1018216800,-1000072800,-986767200,-968018400,-955317600,-936568800,-880232400,-76941e4,-765410400,-747266400,-733960800,-715824e3,-702518400,-684374400,-671068800,-652924800,-634176e3,-620863200,-602719200,-589413600,-576108e3,-557964e3,-544658400,-526514400,-513208800,-495064800,-481759200,-463615200,-450309600,-431560800,-418255200,-400111200,-384386400,-368661600,-352936800,-337212e3,-321487200,-305762400,-289432800,-273708e3,-257983200,-242258400,-226533600,-210808800,-195084e3,-179359200,-163634400,-147909600,-13158e4,-11646e4,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,136346400,152071200,167796e3,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],
offset:[-19052,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-14400,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3]},"America/Vancouver":{
time:[-2713910400,-1632088800,-1615154400,-880236e3,-769420800,-765410400,-747266400,-733960800,-715816800,-702511200,-684367200,-671061600,-652917600,-639612e3,-620863200,-608162400,-589413600,-576108e3,-557964e3,-544658400,-526514400,-513208800,-495064800,-481759200,-463615200,-450309600,-431560800,-418255200,-400111200,-386805600,-368661600,-355356e3,-337212e3,-323906400,-305762400,-292456800,-273708e3,-261007200,-242258400,-226533600,-210808800,-195084e3,-179359200,-163634400,-147909600,-13158e4,-11646e4,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,136346400,152071200,167796e3,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],
offset:[-29548,-28800,-25200,-28800,-25200,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800]},"America/Argentina/Buenos_Aires":{time:[-2372112e3,-1567468800,-1233446400,-1222992e3,-1205971200,-1194048e3,-117288e4,-1162512e3,-1141344e3,-1130976e3,-1109808e3,-109944e4,-1078272e3,-1067817600,-1046649600,-1036281600,-1015113600,-1004745600,-983577600,-973209600,-952041600,-941587200,-931046400,-900892800,-890352e3,-83376e4,-82728e4,-752284800,-733795200,-197337600,-190857600,-184204800,-164505600,-152668800,-132969600,-121132800,-101433600,-86832e3,-71107200,-54777600,-39052800,-23328e3,-7603200,128131200,136598400,596937600,605059200,624412800,636508800,656467200,667958400,687916800,699408e3,719366400,731462400,938908800,952041600,1198972800,1205625600,1224374400,1237075200,1924981200],offset:[-14028,-15408,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-10800,-10800,-7200,-10800,-7200,-10800]},"America/El_Salvador":{time:[-1546300800,546998400,559699200,578448e3,591148800,1924970400],offset:[-21408,-21600,-18e3,-21600,-18e3,-21600]},"America/Sao_Paulo":{
time:[-1767225600,-1206968400,-1191369600,-1175385600,-1159833600,-633830400,-622076400,-602294400,-59184e4,-570758400,-560217600,-539136e3,-53136e4,-195436800,-184204800,-155174400,-150076800,-128908800,-121132800,-99964800,-89596800,-68428800,-57974400,499737600,511228800,530582400,540259200,562118400,571190400,592963200,602035200,624412800,634694400,656467200,666748800,687916800,697593600,719971200,728438400,750816e3,761702400,782265600,793152e3,813715200,823996800,84456e4,856051200,876096e3,888710400,908064e3,919555200,938908800,951609600,970963200,982454400,1003017600,1013904e3,1036281600,1045353600,1066521600,1076803200,1099353600,1108857600,1129420800,1140307200,1162684800,1172361600,119232e4,1203206400,1224374400,1234656e3,1255824e3,1266710400,1287273600,129816e4,1318723200,1330214400,1350777600,1361059200,1382227200,1392508800,1413676800,1424563200,1445126400,1456012800,1476576e3,1487462400,1508025600,1518912e3,1541289600,1550361600,1924981200],offset:[-11188,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800,-7200,-10800]},"America/Bogota":{time:[-2707689600,-1739059200,704851200,729043200,1924974e3],offset:[-17776,-17776,-18e3,-14400,-18e3]},"America/Caracas":{time:[-2524521600,-1826755200,-157766400,1197169200,1462069800,1924977600],offset:[-16064,-16060,-16200,-14400,-16200,-14400]},"America/Anchorage":{
time:[-3225173303,-2188987200,-880236e3,-769428e3,-765410400,-86918400,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,438998400,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],offset:[50424,-35976,-36e3,-32400,-32400,-36e3,-36e3,-32400,-36e3,-32400,-36e3,-32400,-36e3,-32400,-36e3,-32400,-36e3,-32400,-36e3,-32400,-36e3,-32400,-36e3,-32400,-36e3,-32400,-36e3,-32400,-36e3,-32400,-36e3,-32400,-36e3,-32400,-36e3,-32400,-32400,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400]},"Europe/Moscow":{
time:[-2840140800,-1688256e3,-165681e4,-1641340800,-1627956e3,-1618700400,-1596416400,-1593804521,-1589846400,-1542416400,-1539478800,-1525305600,-1522713600,-1491177600,-1247529600,354931200,370742400,386467200,402278400,418003200,433814400,449625600,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,695786400,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1414288800,1925002800],offset:[9017,9017,9079,12679,9079,16279,12679,16279,14400,10800,14400,18e3,14400,10800,7200,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,10800,7200,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800]},"Europe/Athens":{time:[-2344636800,-1686095940,-1182988800,-1178150400,-906854400,-904867200,-85725e4,-844473600,-828230400,-812419200,-552355200,-541641600,166492800,186195600,198036e3,213764400,228880800,244090800,260330400,275457600,291805200,307418400,323395200,338947200,354682800,370411200,386132400,401860800,417582e3,433310400,449031600,465364800,481086e3,496814400,512535600,528264e3,543985200,559713600,575434800,591163200,606884400,622612800,638334e3,654667200,670388400,686116800,701838e3,717566400,733287600,749016e3,764737200,780465600,796186800,811915200,828241200,846388800,859690800,877838400,891140400,909288e3,92259e4,941342400,954039600,972792e3,985489200,1004241600,1017543600,1035691200,1048993200,1067140800,1080442800,1099195200,1111892400,1130644800,1143342e3,1162094400,1174791600,1193544e3,1206846e3,1224993600,1238295600,1256443200,1269745200,1288497600,1301194800,1319947200,1332644400,1351396800,1364698800,1382846400,1396148400,1414296e3,1427598e3,1445745600,1459047600,14778e5,1490497200,1509249600,1521946800,1540699200,1554001200,1572148800,1585450800,1603598400,1616900400,1635652800,164835e4,1667102400,1679799600,1698552e3,1711854e3,1730001600,1743303600,1761451200,1774753200,1792900800,1806202800,1824955200,1837652400,1856404800,1869102e3,1887854400,1901156400,1919304e3,1932606e3],
offset:[5692,5692,7200,10800,7200,10800,7200,3600,7200,3600,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Europe/Belgrade":{time:[-2713910400,-905821200,-85725e4,-844552800,-828219600,-812498400,-79677e4,-777938400,-766616400,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[4920,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Berlin":{
time:[-2422051200,-1693702800,-1680476400,-1663452e3,-1650142800,-1632002400,-1618693200,-938901600,-85725e4,-844552800,-828219600,-812498400,-79677e4,-781048800,-776556e3,-765925200,-761173200,-748476e3,-733266e3,-717627600,-714603600,-71037e4,-701902800,-684972e3,-670453200,-654127200,-639003600,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[3208,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,10800,7200,3600,7200,3600,7200,10800,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Bratislava":{
time:[-3786825600,-2469398400,-1693702800,-1680476400,-1663452e3,-1650142800,-1632002400,-1618693200,-938901600,-85725e4,-844552800,-828219600,-812498400,-79677e4,-781048800,-765320400,-746575200,-733352400,-728514e3,-72126e4,-716421600,-701902800,-684972e3,-670453200,-654213600,-639003600,29178e4,307508400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[3464,3464,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,0,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Bucharest":{
time:[-2469398400,-1213142400,-1187049600,-1175468400,-1159747200,-1144018800,-1127692800,-1111964400,-1096243200,-1080514800,-1064793600,-1049065200,-1033344e3,-1017615600,-1001894400,-986166e3,-970444800,-954716400,296611200,307497600,323823600,338950800,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670377600,686106e3,701827200,717555600,733276800,749005200,764726400,780451200,796176e3,811900800,828230400,846374400,859690800,877838400,891140400,909288e3,92259e4,941342400,954039600,972792e3,985489200,1004241600,1017543600,1035691200,1048993200,1067140800,1080442800,1099195200,1111892400,1130644800,1143342e3,1162094400,1174791600,1193544e3,1206846e3,1224993600,1238295600,1256443200,1269745200,1288497600,1301194800,1319947200,1332644400,1351396800,1364698800,1382846400,1396148400,1414296e3,1427598e3,1445745600,1459047600,14778e5,1490497200,1509249600,1521946800,1540699200,1554001200,1572148800,1585450800,1603598400,1616900400,1635652800,164835e4,1667102400,1679799600,1698552e3,1711854e3,1730001600,1743303600,1761451200,1774753200,1792900800,1806202800,1824955200,1837652400,1856404800,1869102e3,1887854400,1901156400,1919304e3,1932606e3],offset:[6264,6264,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Europe/Budapest":{
time:[-2498256e3,-1693702800,-1680476400,-1663452e3,-1650142800,-1632002400,-1618693200,-1600466400,-1587243600,-1569708e3,-1555189200,-906771600,-85725e4,-844552800,-828219600,-812498400,-79677e4,-778467600,-762649200,-749685600,-733269600,-717631200,-701902800,-686181600,-670453200,-654127200,-639003600,-492652800,-481161600,-461196e3,-449701200,-428536800,-418251600,-397087200,-386802e3,323827200,338950800,354672e3,370400400,386121600,40185e4,417571200,433299600,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[4580,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/London":{
time:[-3852662400,-1691964e3,-1680469200,-1664143200,-1650142800,-1633903200,-1617483600,-1601848800,-1586034e3,-1570399200,-1552165200,-1538344800,-152253e4,-15075e5,-1490562e3,-1473631200,-1460926800,-1442786400,-1428872400,-1410732e3,-1396213200,-1379282400,-1364763600,-1348437600,-1333314e3,-1315778400,-1301259600,-1284328800,-126981e4,-1253484e3,-1238360400,-1221429600,-1206910800,-118998e4,-1175461200,-1159135200,-1143406800,-1126476e3,-1111957200,-1095631200,-1080507600,-1063576800,-1049058e3,-1032127200,-1017608400,-1001282400,-986158800,-969228e3,-950475600,-942012e3,-904514400,-896043600,-875484e3,-864594e3,-844034400,-832539600,-812584800,-798066e3,-781048800,-772059600,-764802e3,-748476e3,-733352400,-719445600,-717026400,-706741200,-699483600,-687996e3,-668034e3,-654732e3,-636584400,-622072800,-605739600,-590623200,-57429e4,-558568800,-542235600,-527119200,-512600400,-496274400,-481150800,-46422e4,-449701200,-432165600,-417646800,-401320800,-386197200,-369266400,-354747600,-337816800,-323298e3,-306972e3,-291848400,-276732e3,-257979600,-245282400,-22653e4,-213228e3,-195080400,-182383200,-163630800,-150933600,-132181200,-119484e3,-100731600,-88034400,-68677200,-59004e3,-37238400,57726e3,69818400,89175600,101268e3,120625200,132717600,152074800,164167200,183524400,196221600,214974e3,227671200,246423600,259120800,278478e3,290570400,309927600,32202e4,341377200,354675600,372823200,386125200,404272800,417574800,435722400,449024400,467776800,481078800,499226400,512528400,530676e3,543978e3,562125600,575427600,593575200,606877200,625629600,638326800,657079200,670381200,688528800,701830800,719978400,733280400,751428e3,76473e4,782877600,796179600,814327200,828234e3,846381600,859683600,877831200,891133200,909280800,922582800,941335200,954032400,972784800,985482e3,1004234400,1017536400,1035684e3,1048986e3,1067133600,1080435600,1099188e3,1111885200,1130637600,1143334800,1162087200,1174784400,1193536800,1206838800,1224986400,1238288400,1256436e3,1269738e3,1288490400,1301187600,131994e4,1332637200,1351389600,1364691600,1382839200,1396141200,1414288800,1427590800,1445738400,1459040400,1477792800,149049e4,1509242400,1521939600,1540692e3,1553994e3,1572141600,1585443600,1603591200,1616893200,1635645600,1648342800,1667095200,1679792400,1698544800,1711846800,1729994400,1743296400,1761444e3,1774746e3,1792893600,1806195600,1824948e3,1837645200,1856397600,1869094800,1887847200,1901149200,1919296800,1932598800],
offset:[-75,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,0,3600,0,3600,7200,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0]},"Europe/Luxembourg":{time:[-2069712e3,-1692493200,-1680476400,-1662339600,-165015e4,-1632002400,-1618693200,-1612656e3,-1604278800,-1585515600,-1574038800,-1552255200,-1539997200,-1520546400,-1507510800,-1490569200,-1473642e3,-1459116e3,-1444006800,-142767e4,-1411866e3,-1396220400,-1379293200,-1364770800,-1348448400,-1333321200,-1316394e3,-1301266800,-1284339600,-126981e4,-1253484e3,-1238360400,-1221429600,-1206910800,-1191189600,-1175461200,-1160344800,-1143406800,-1127685600,-1111957200,-1096840800,-1080507600,-1063576800,-1049058e3,-1033336800,-1017608400,-1002492e3,-986158800,-969228e3,-950475600,-942012e3,-935182800,-85725e4,-844552800,-828219600,-812498400,-797979600,-781048800,-766616400,-745452e3,-733266e3,228880800,244004400,260330400,276058800,29178e4,307508400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],
offset:[1476,3600,7200,3600,7200,3600,7200,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Madrid":{time:[-2177453684,-1631926800,-1616886e3,-1601168400,-158535e4,-1442451600,-142767e4,-1379293200,-1364770800,-1348448400,-1333321200,-1316390400,-1301266800,-1284339600,-1269817200,-1026954e3,-1017615600,-1001898e3,-999478800,-986083200,-954111600,-940208400,-873075600,-862614e3,-842835600,-828313200,-811386e3,-796863600,-779936400,-765414e3,-748486800,-733964400,-652323600,-639010800,135126e3,150253200,166575600,181702800,196815600,212547600,22887e4,243997200,260330400,276058800,29178e4,307508400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],
offset:[-884,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,7200,3600,0,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Paris":{time:[-2486592e3,-1855958400,-1689814800,-1680393600,-1665363600,-1648339200,-1635123600,-1616889600,-1604278800,-158544e4,-1574038800,-1552262400,-1539997200,-1520553600,-1507510800,-1490572800,-1470618e3,-1459123200,-1444006800,-1427673600,-1411952400,-1396224e3,-1379293200,-1364774400,-1348448400,-1333324800,-1316394e3,-1301270400,-1284339600,-1269820800,-1253494800,-1238371200,-1221440400,-1206921600,-1191200400,-1175472e3,-1160355600,-1143417600,-1127696400,-1111968e3,-1096851600,-1080518400,-1063587600,-1049068800,-1033347600,-1017619200,-1002502800,-986169600,-969238800,-950486400,-942012e3,-932432400,-85725e4,-844552800,-828219600,-812498400,-800064e3,-796258800,-781048800,-766616400,196822800,212547600,228880800,244004400,260330400,276058800,29178e4,307508400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],
offset:[561,561,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,7200,3600,7200,3600,7200,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Prague":{time:[-3786825600,-2469398400,-1693702800,-1680476400,-1663452e3,-1650142800,-1632002400,-1618693200,-938901600,-85725e4,-844552800,-828219600,-812498400,-79677e4,-781048800,-765320400,-746575200,-733352400,-728514e3,-72126e4,-716421600,-701902800,-684972e3,-670453200,-654213600,-639003600,29178e4,307508400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[3464,3464,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,0,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Rome":{
time:[-3252096e3,-2403562204,-1690761600,-168048e4,-1664755200,-1648944e3,-163512e4,-1616889600,-1604275200,-1585526400,-1571011200,-1555286400,-932428800,-85725e4,-844552800,-828219600,-812498400,-798066e3,-781048800,-76671e4,-750895200,-733352400,-719452800,-70191e4,-689205600,-670453200,-114048e3,-103161600,-81993600,-71708400,-50544e3,-40258800,-18489600,-8204400,1296e4,23245200,43804800,54694800,75859200,86749200,107913600,118198800,138758400,149648400,170812800,181098e3,202262400,212547600,233107200,243997200,265161600,276051600,296611200,307501200,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[2996,2996,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Vienna":{
time:[-2422051200,-1693702800,-1680476400,-1663452e3,-1650142800,-1632002400,-1618693200,-1569708e3,-1555794e3,-938901600,-85725e4,-844552800,-828219600,-812498400,-79677e4,-781048800,-780181200,-748476e3,-733266e3,-717631200,-701902800,-684972e3,-670453200,323827200,338947200,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[3921,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Warsaw":{
time:[-2840140800,-1717027200,-1693702800,-1680476400,-1663452e3,-1650142800,-1632002400,-1618693200,-1600466400,-1587157200,-1501718400,-931730400,-85725e4,-844552800,-828219600,-812498400,-796600800,-778723200,-762652800,-748483200,-733266e3,-715212e3,-701902800,-684972e3,-670453200,-654127200,-639003600,-397090800,-386805600,-371084400,-355356e3,-334191600,-323301600,-307580400,-291852e3,-271292400,-260402400,-239842800,-228952800,-208393200,-197503200,-176338800,-166053600,228877200,244000800,260326800,276055200,291776400,307504800,323830800,338954400,354675600,370404e3,386125200,401853600,417574800,433303200,449024400,465357600,481078800,496807200,512528400,528256800,543978e3,559706400,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[5040,5040,3600,7200,3600,7200,3600,7200,7200,10800,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Istanbul":{
time:[-2840140800,-1869868800,-1693699200,-168048e4,-1570406400,-1552176e3,-1538352e3,-1522540800,-1507507200,-1490572800,-1440201600,-1428019200,-1409702400,-1396483200,-931046400,-922665600,-917827200,-892425600,-875836800,-764726400,-744336e3,-733795200,-716428800,-701913600,-684979200,-670464e3,-654134400,-639014400,-62208e4,-60696e4,-590025600,-575510400,-235612800,-194832e3,-177724800,-165715200,107917200,121226400,133927200,152676e3,164685600,184125600,196221600,215575200,228880800,245815200,260330400,267926400,428464800,433908e3,468122400,482806800,496720800,512528400,528256800,543978e3,559706400,575427600,591156e3,606877200,622605600,638326800,65466e4,670381200,686109600,701830800,717559200,733280400,749008800,764125200,780458400,796179600,811908e3,828234e3,846381600,859683600,877831200,891133200,909280800,922582800,941335200,954032400,972784800,985482e3,1004234400,1017536400,1035684e3,1048986e3,1067133600,1080435600,1099188e3,1111885200,1130637600,1143334800,1162087200,1174791600,1193544e3,1206846e3,1224993600,1238295600,1256443200,1269745200,1288497600,1301281200,1319947200,1332644400,1351396800,1364698800,1382846400,1396234800,1414296e3,1427598e3,1446955200,1459047600,1473206400,1925002800],offset:[6952,7016,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,10800,14400,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,10800]},"Europe/Zurich":{time:[-3675196800,-2385244800,-904431600,-891122400,-872982e3,-859672800,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],
offset:[2048,1786,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Australia/Sydney":{time:[-2364076800,-1672524e3,-1665349200,-883605600,-876085200,-860364e3,-844635600,-828309600,-813186e3,57722400,68007600,89172e3,100062e3,120621600,131511600,152071200,162961200,183520800,195015600,215575200,226465200,247024800,257914800,278474400,289364400,309924e3,320814e3,341373600,352263600,372823200,386737200,404877600,415767600,436327200,447217200,467776800,478666800,499226400,511326e3,530071200,542775600,562125600,57483e4,59418e4,606279600,625629600,636519600,657079200,667969200,688528800,699418800,719978400,731473200,752032800,762922800,783482400,794372400,814932e3,828241200,846381600,859690800,877831200,891140400,909280800,92259e4,941335200,954039600,967341600,985489200,1004234400,1017543600,1035684e3,1048993200,1067133600,1080442800,1099188e3,1111892400,1130637600,1143946800,1162087200,1174791600,1193536800,1207450800,1223172e3,1238900400,1254621600,127035e4,1286071200,1301799600,1317520800,1333249200,1349575200,1365303600,1381024800,1396753200,1412474400,1428202800,1443924e3,1459652400,1475373600,1491102e3,1506823200,1522551600,1538877600,1554606e3,1570327200,1586055600,1601776800,1617505200,1633226400,1648954800,1664676e3,1680404400,1696125600,1712458800,172818e4,1743908400,1759629600,1775358e3,1791079200,1806807600,1822528800,1838257200,1853978400,1869706800,1886032800,1901761200,1917482400,1933210800],offset:[36292,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600]},"Australia/Brisbane":{time:[-2366755200,-1672524e3,-1665349200,-883605600,-876085200,-860364e3,-844635600,-828309600,-813186e3,57722400,68007600,625629600,636519600,657079200,667969200,688528800,699418800,1925028e3],offset:[36728,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3]},"Australia/Adelaide":{
time:[-2364076800,-2230156800,-1672524e3,-1665349200,-883605600,-876085200,-860364e3,-844635600,-828309600,-813186e3,57722400,68007600,89172e3,100062e3,120621600,131511600,152071200,162961200,183520800,195015600,215575200,226465200,247024800,257914800,278474400,289364400,309924e3,320814e3,341373600,352263600,372823200,384318e3,404877600,415767600,436327200,447217200,467776800,478666800,499226400,511326e3,530071200,542775600,562125600,57483e4,59418e4,606279600,625629600,637729200,657079200,667969200,688528800,701233200,719978400,731473200,752032800,764132400,783482400,796186800,814932e3,828241200,846381600,859690800,877831200,891140400,909280800,92259e4,941335200,954039600,972784800,985489200,1004234400,1017543600,1035684e3,1048993200,1067133600,1080442800,1099188e3,1111892400,1130637600,1143946800,1162087200,1174791600,1193536800,1207450800,1223172e3,1238900400,1254621600,127035e4,1286071200,1301799600,1317520800,1333249200,1349575200,1365303600,1381024800,1396753200,1412474400,1428202800,1443924e3,1459652400,1475373600,1491102e3,1506823200,1522551600,1538877600,1554606e3,1570327200,1586055600,1601776800,1617505200,1633226400,1648954800,1664676e3,1680404400,1696125600,1712458800,172818e4,1743908400,1759629600,1775358e3,1791079200,1806807600,1822528800,1838257200,1853978400,1869706800,1886032800,1901761200,1917482400,1933210800],offset:[33260,32400,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800,34200,37800]},"Australia/ACT":{
time:[-2364076800,-1672524e3,-1665349200,-883605600,-876085200,-860364e3,-844635600,-828309600,-813186e3,57722400,68007600,89172e3,100062e3,120621600,131511600,152071200,162961200,183520800,195015600,215575200,226465200,247024800,257914800,278474400,289364400,309924e3,320814e3,341373600,352263600,372823200,386737200,404877600,415767600,436327200,447217200,467776800,478666800,499226400,511326e3,530071200,542775600,562125600,57483e4,59418e4,606279600,625629600,636519600,657079200,667969200,688528800,699418800,719978400,731473200,752032800,762922800,783482400,794372400,814932e3,828241200,846381600,859690800,877831200,891140400,909280800,92259e4,941335200,954039600,967341600,985489200,1004234400,1017543600,1035684e3,1048993200,1067133600,1080442800,1099188e3,1111892400,1130637600,1143946800,1162087200,1174791600,1193536800,1207450800,1223172e3,1238900400,1254621600,127035e4,1286071200,1301799600,1317520800,1333249200,1349575200,1365303600,1381024800,1396753200,1412474400,1428202800,1443924e3,1459652400,1475373600,1491102e3,1506823200,1522551600,1538877600,1554606e3,1570327200,1586055600,1601776800,1617505200,1633226400,1648954800,1664676e3,1680404400,1696125600,1712458800,172818e4,1743908400,1759629600,1775358e3,1791079200,1806807600,1822528800,1838257200,1853978400,1869706800,1886032800,1901761200,1917482400,1933210800],offset:[36292,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600,36e3,39600]},"Asia/Almaty":{time:[-1441152e3,-1247529600,354931200,370742400,386467200,402278400,418003200,433814400,449625600,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,695786400,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1925013600],offset:[18468,18e3,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,21600,18e3,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600,25200,21600]},"Asia/Ashkhabad":{
time:[-1441152e3,-1247529600,354931200,370742400,386467200,402278400,418003200,433814400,449625600,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,695786400,192501e4],offset:[14012,14400,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,21600,18e3,18e3,14400,18e3]},"Asia/Colombo":{time:[-2840140800,-2019686400,-883267200,-862617600,-764028e3,832982400,846289800,1145061e3,1925011800],offset:[19164,19172,19800,21600,23400,19800,23400,21600,19800]},"Asia/Dhaka":{time:[-2524521600,-891561600,-872035200,-862617600,-576115200,1245452400,1262303999,1925013600],offset:[21700,21200,23400,19800,23400,21600,25200,21600]},"Asia/Tokyo":{time:[-2587678861,-683769600,-672274800,-654739200,-640825200,-620265600,-609375600,-588816e3,-577926e3,1925024400],offset:[33539,32400,36e3,32400,36e3,32400,36e3,32400,36e3,32400]},"Asia/Taipei":{time:[-2335219200,-1017792e3,-766191600,-745804800,-733795200,-716860800,-699580800,-683856e3,-670636800,-65232e4,-639100800,-620784e3,-607564800,-589248e3,-576028800,-562896e3,-541728e3,-528681600,-510192e3,-497145600,-478656e3,-465609600,-449798400,-433987200,-418176e3,-402451200,-38664e4,-370915200,-355104e3,-339379200,-323568e3,-302486400,-291945600,-270950400,-260409600,134006400,149817600,165542400,181353600,299635200,307584e3,1925020800],offset:[29160,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800]},"Asia/Singapore":{time:[-2177452800,-2038176e3,-1167609600,-1073001600,-894153600,-879638400,-766972800,378689400,1925020800],offset:[24925,24925,25200,26400,26400,27e3,32400,27e3,28800]},"Asia/Karachi":{time:[-1988150400,-862617600,-764121600,-576115200,38793600,1018137600,1033862400,1212278400,1225497600,1239753600,1257033600,192501e4],offset:[16092,19800,23400,19800,18e3,18e3,21600,18e3,21600,18e3,21600,18e3]},"Asia/Manila":{time:[-3944678400,-2229292800,-1046649600,-1038700800,-873244800,-794188800,-496195200,-489283200,259372800,275184e3,1925020800],offset:[-57360,29040,28800,32400,28800,32400,28800,32400,28800,32400,28800]},"Asia/Shanghai":{time:[-2177452800,-1600646400,-1585872e3,-933638400,-922060800,-908841600,-888796800,-881020800,-767836800,-745804800,-733795200,-716860800,-699580800,-683856e3,-670636800,-65232e4,-649987200,515556e3,527047200,545191200,558496800,577245600,589946400,608695200,622000800,640144800,653450400,671594400,6849e5,1925020800],offset:[29143,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800]},"Asia/Seoul":{
time:[-1948752e3,-1830384e3,-767318400,-681177600,-672192e3,-654739200,-640828800,-623376e3,-609379200,-588816e3,-577929600,-498096e3,-462672e3,-451699200,-429753600,-418262400,-399513600,-387417600,-368064e3,-355968e3,-336614400,-324518400,-305164800,-293068800,-264902400,547610400,560919600,57906e4,592369200,1925024400],offset:[30472,30600,32400,32400,36e3,32400,36e3,32400,36e3,32400,36e3,32400,30600,34200,30600,34200,30600,34200,30600,34200,30600,34200,30600,34200,30600,32400,36e3,32400,36e3,32400]},"Asia/Tehran":{time:[-1704153600,-1090454400,227833200,24624e4,259632e3,271126800,283996800,296611200,306547200,322444800,338515200,673228800,685497600,701222400,71712e4,732758400,748656e3,764294400,780192e3,795830400,811728e3,827366400,843264e3,858988800,874886400,890524800,906422400,922060800,937958400,953596800,969494400,985219200,1001116800,1016755200,1032652800,1048291200,1064188800,1079827200,1095724800,1111449600,1127347200,1206057600,1221955200,123768e4,1253577600,1269216e3,1285113600,1300752e3,1316649600,1332288e3,1348185600,1363910400,1379808e3,1395446400,1411344e3,1426982400,144288e4,1458518400,1474416e3,1490140800,1506038400,1521676800,1537574400,1553212800,1569110400,1584748800,1600646400,1616371200,1632268800,1647907200,1663804800,1925004600],offset:[12344,12344,12600,16200,14400,18e3,14400,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600,16200,12600]},"Asia/Dubai":{time:[-1577923200,1925006400],offset:[13272,14400]},"Asia/Kolkata":{time:[-3645216e3,-3155673600,-2019686400,-891561600,-872035200,-862617600,-764121600,1925011800],offset:[21208,21200,19270,19800,23400,19800,23400,19800]},"Asia/Hong_Kong":{time:[-2056663398,-900882e3,-891547200,-884217600,-761176800,-747878400,-728508600,-717021e3,-697059e3,-683757e3,-668028600,-654726600,-636579e3,-623277e3,-605129400,-591827400,-573679800,-559773e3,-541625400,-528323400,-510179400,-498083400,-478729800,-466633800,-446675400,-435184200,-415225800,-403129800,-383776200,-371680200,-352326600,-340230600,-320877e3,-308781e3,-288822600,-277331400,-257373e3,-245881800,-225923400,-213827400,-194473800,-182377800,-163024200,-148509e3,-132784200,-117059400,-101334600,-85609800,-69280200,-53555400,-37830600,-22105800,-6381e3,9343800,25068600,40793400,56518200,72243e3,88572600,104297400,120022200,126070200,151471800,167196600,182921400,198646200,214371e3,295414200,309324600,1925020800],
offset:[27402,28800,32400,30600,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800]},"Asia/Bangkok":{time:[-2840140800,-1570060800,1925017200],offset:[24124,24124,25200]},"Asia/Chongqing":{time:[-2177452800,-1600646400,-1585872e3,-933638400,-922060800,-908841600,-888796800,-881020800,-767836800,-745804800,-733795200,-716860800,-699580800,-683856e3,-670636800,-65232e4,-649987200,515556e3,527047200,545191200,558496800,577245600,589946400,608695200,622000800,640144800,653450400,671594400,6849e5,1925020800],offset:[29143,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800]},"Asia/Jerusalem":{time:[-2840140800,-1640995200,-933631200,-923086800,-919029600,-857336400,-844293600,-825800400,-812671200,-794178e3,-779839200,-762642e3,-748303200,-731106e3,-681948e3,-673214400,-667947600,-652312800,-636411600,-622072800,-608936400,-591832800,-572475600,-558568800,-542840400,-527724e3,-514414800,-490831200,-482965200,-459381600,-451515600,-428536800,-418251600,-400111200,-387406800,142387200,150854400,167184e3,178675200,334108800,337741200,452649600,46233e4,482284800,494380800,516758400,526435200,545443200,558489600,576633600,589334400,609897600,620784e3,638323200,651628800,669772800,683683200,701827200,715737600,733708800,747187200,765158400,778032e3,796608e3,810086400,826848e3,842832e3,858902400,874195200,890352e3,90504e4,923018400,936324e3,955677600,970794e3,986778e3,1001293200,1017363600,1033952400,1048813200,1065142800,1081299600,1095814800,1112320800,1128823200,1143770400,1159668e3,117522e4,1189908e3,1206669600,1223172e3,1238119200,1254016800,1269568800,1284256800,1301623200,1317520800,1333072800,1348365600,1364522400,1382839200,1395972e3,1414288800,1427421600,1445738400,1458871200,1477792800,1490320800,1509242400,1521770400,1540692e3,1553824800,1572141600,1585274400,1603591200,1616724e3,1635645600,1648173600,1667095200,1679623200,1698544800,1711677600,1729994400,1743127200,1761444e3,1774576800,1792893600,1806026400,1824948e3,1837476e3,1856397600,1868925600,1887847200,190098e4,1919296800,1932429600],
offset:[8454,8440,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,14400,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Asia/Kuwait":{time:[-631152e3,1925002800],offset:[11516,10800]},"Asia/Muscat":{time:[-1577923200,1925006400],offset:[14064,14400]},"Asia/Nicosia":{time:[-1518912e3,166579200,182304e3,200966400,21384e4,228873600,243993600,260323200,276134400,291772800,307497600,323827200,338947200,354672e3,370396800,386121600,401846400,417571200,433296e3,449020800,465350400,481075200,4968e5,512524800,528249600,543974400,559699200,575424e3,591148800,606873600,622598400,638323200,654652800,670377600,686102400,701827200,717552e3,733276800,749001600,764726400,780451200,796176e3,811900800,828230400,843955200,85968e4,875404800,891129600,909288e3,92259e4,941342400,954039600,972792e3,985489200,1004241600,1017543600,1035691200,1048993200,1067140800,1080442800,1099195200,1111892400,1130644800,1143342e3,1162094400,1174791600,1193544e3,1206846e3,1224993600,1238295600,1256443200,1269745200,1288497600,1301194800,1319947200,1332644400,1351396800,1364698800,1382846400,1396148400,1414296e3,1427598e3,1445745600,1459047600,14778e5,1490497200,1509249600,1521946800,1540699200,1554001200,1572148800,1585450800,1603598400,1616900400,1635652800,164835e4,1667102400,1679799600,1698552e3,1711854e3,1730001600,1743303600,1761451200,1774753200,1792900800,1806202800,1824955200,1837652400,1856404800,1869102e3,1887854400,1901156400,1919304e3,1932606e3],offset:[8008,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Asia/Qatar":{time:[-1577923200,76204800,1925002800],offset:[12368,14400,10800]},"Asia/Riyadh":{time:[-719625600,1925002800],offset:[11212,10800]},"Asia/Yangon":{time:[-2840140800,-1577923200,-873244800,-778377600,1925015400],offset:[23087,23087,23400,32400,23400]},"Pacific/Auckland":{
time:[-3192393600,-1330293600,-1320012e3,-1300658400,-1287352800,-1269208800,-1255903200,-1237759200,-1224453600,-1206309600,-1192399200,-117486e4,-1160949600,-1143410400,-1125871200,-1112565600,-1094421600,-1081116e3,-1062972e3,-1049666400,-1031522400,-1018216800,-1000072800,-986767200,-968018400,-955317600,-936568800,-923263200,-757382400,152676e3,162356400,183520800,195015600,215575200,226465200,247024800,257914800,278474400,289364400,309924e3,320814e3,341373600,352263600,372823200,384318e3,404877600,415767600,436327200,447217200,467776800,478666800,499226400,510116400,530676e3,541566e3,562125600,573620400,59418e4,60507e4,623815200,637729200,655264800,669178800,686714400,700628400,718164e3,732682800,749613600,764132400,781063200,795582e3,812512800,827031600,844567200,858481200,876016800,889930800,907466400,921985200,938916e3,953434800,970365600,984884400,100242e4,1016334e3,1033869600,1047783600,1065319200,1079838e3,1096768800,1111287600,1128218400,1142737200,1159668e3,1174186800,1191117600,1207450800,1222567200,1238900400,1254016800,127035e4,1285466400,1301799600,1316916e3,1333249200,1348970400,1365303600,138042e4,1396753200,1411869600,1428202800,1443319200,1459652400,1474768800,1491102e3,1506218400,1522551600,1538272800,1554606e3,1569722400,1586055600,1601172e3,1617505200,1632621600,1648954800,1664071200,1680404400,1695520800,1712458800,1727575200,1743908400,1759024800,1775358e3,1790474400,1806807600,1821924e3,1838257200,1853373600,1869706800,1885428e3,1901761200,1916877600,1933210800],offset:[41944,41400,45e3,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,41400,43200,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800,43200,46800]},"Pacific/Chatham":{
time:[-3192393600,-757382400,152678700,162359100,183523500,195018300,215577900,226467900,247027500,257917500,278477100,289367100,309926700,320816700,341376300,352266300,372825900,384320700,404880300,415770300,436329900,447219900,467779500,478669500,499229100,510119100,530678700,541568700,562128300,573623100,594182700,605072700,623817900,637731900,655267500,669181500,686717100,700631100,718166700,732685500,749616300,764135100,781065900,795584700,812515500,827034300,844569900,858483900,876019500,889933500,907469100,921987900,938918700,953437500,970368300,984887100,1002422700,1016336700,1033872300,1047786300,1065321900,1079840700,1096771500,1111290300,1128221100,1142739900,1159670700,1174189500,1191120300,1207453500,1222569900,1238903100,1254019500,1270352700,1285469100,1301802300,1316918700,1333251900,1348973100,1365306300,1380422700,1396755900,1411872300,1428205500,1443321900,1459655100,1474771500,1491104700,1506221100,1522554300,1538275500,1554608700,1569725100,1586058300,1601174700,1617507900,1632624300,1648957500,1664073900,1680407100,1695523500,1712461500,1727577900,1743911100,1759027500,1775360700,1790477100,1806810300,1821926700,1838259900,1853376300,1869709500,1885430700,1901763900,1916880300,1933213500],offset:[44028,44100,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500,45900,49500]},"Pacific/Fakaofo":{time:[-2177452800,1325203200,1925038800],offset:[-41096,-39600,46800]},"Pacific/Honolulu":{time:[-2334139200,-1157320800,-1155470400,-880236e3,-769429800,-765410400,-712188e3,1924956e3],offset:[-37886,-37800,-34200,-37800,-34200,-34200,-37800,-36e3]},"America/Mexico_City":{time:[-1514763396,-1343091600,-1234828800,-1220317200,-1207180800,-1191369600,-975283200,-963187200,-917136e3,-907372800,-821923200,-810086400,-627523200,-613008e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,989114400,1001815200,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1175392800,1193536800,1207447200,1224986400,1238896800,1256436e3,1270346400,1288490400,1301796e3,131994e4,1333245600,1351389600,13653e5,1382839200,1396749600,1414288800,1428199200,1445738400,1459648800,1477792800,1491098400,1509242400,1522548e3,1540692e3,1554602400,1572141600,1586052e3,1603591200,1617501600,1635645600,1648951200,1667095200,1924970400],
offset:[-23796,-25200,-21600,-25200,-21600,-25200,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600,-18e3,-21600]},"Africa/Cairo":{time:[-2185401600,-929836800,-923097600,-906163200,-892857600,-875836800,-857779200,-844300800,-825811200,-812678400,-794188800,-779846400,-762652800,-399081600,-38664e4,-368323200,-355104e3,-336783600,-323643600,-305161200,-292021200,-273625200,-260485200,-242089200,-228949200,-210553200,-197413200,-178930800,-165790800,-147394800,-134254800,-115858800,-102632400,-84322800,-71096400,-52700400,-39474e3,-21164400,-7938e3,10371600,23598e3,41907600,55134e3,7353e4,86756400,105066e3,118292400,136602e3,149828400,168138e3,181364400,199760400,212986800,231296400,244522800,262832400,276058800,294368400,307594800,325990800,339217200,357526800,370753200,396406800,402289200,426819600,433825200,452221200,465447600,483757200,496983600,515293200,528519600,546829200,560055600,578451600,591678e3,610419600,623214e3,641523600,65475e4,673059600,686286e3,704682e3,717908400,736218e3,749444400,767754e3,780980400,799027200,812332800,830476800,843782400,861926400,875232e3,893376e3,906681600,925430400,938736e3,95688e4,970185600,988329600,1001635200,1019779200,1033084800,1051228800,1064534400,1083283200,1096588800,1114732800,1128038400,1146182400,1158883200,1177632e3,1189123200,1209081600,1219968e3,1240531200,1250812800,1272585600,1281484800,1284076800,1285891200,1400198400,1403827200,1406851200,1411689600,168264e4,1698364800,1714089600,1730419200,1745539200,1761868800,1776988800,1793318400,1809043200,1824768e3,1840492800,1856217600,1871942400,1887667200,1903392e3,1919721600,1934841600],offset:[7509,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Africa/Casablanca":{
time:[-1773014400,-956361600,-950486400,-942019200,-761184e3,-617241600,-605145600,-81432e3,-71107200,141264e3,147225600,199756800,207705600,231292800,244252800,265507200,271036800,448243200,504921600,1212278400,1220227200,1243814400,1250812800,1272758400,1281225600,1301788800,1312070400,1335664800,1342753200,1345428e3,1348974e3,1367114400,1373166e3,13761e5,1382842800,1396144800,1403924400,1406944800,1414292400,1427594400,1434250800,1437271200,1445742e3,1459044e3,1465095600,1468116e3,1477796400,1490493600,1495335600,1498960800,1509246e3,1521943200,1526180400,1529200800,1540695600,1557025200,1560045600,1587265200,1590890400,161811e4,1621130400,164835e4,1651975200,1679194800,1682215200,1710039600,171306e4,1740279600,1743904800,1771124400,1774144800,1801969200,1804989600,1832209200,1835834400,1863054e3,1866074400,1893294e3,1896919200,1924138800,1927159200],offset:[-1820,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0]},"Africa/Johannesburg":{time:[-2458166400,-2109283200,-860968800,-845244e3,-829519200,-813794400,1924999200],offset:[6720,5400,7200,10800,7200,10800,7200]},"Africa/Nairobi":{time:[-194616e4,-1309737600,-1261958400,-1041379200,-865296e3,1925002800],offset:[8836,9e3,10800,9e3,9900,10800]},"Africa/Tunis":{time:[-27972e5,-1855958400,-969238800,-950486400,-941936400,-891129600,-877824e3,-85725e4,-844552800,-842911200,-84222e4,-828223200,-812498400,-796262400,-781048800,-766627200,231206400,243910800,262828800,276051600,581126400,591152400,606873600,622602e3,64152e4,654656400,1114905600,1128045600,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1924995600],offset:[2444,561,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Asia/Kathmandu":{time:[-1577923200,504921600,1925012700],offset:[20476,19800,20700]},"US/Mountain":{
time:[-2717668796,-1633298400,-1615154400,-1601848800,-1583704800,-1570399200,-1551650400,-1538949600,-1534111200,-880236e3,-769417200,-765410400,-147909600,-13158e4,-11646e4,-100130400,-84405600,-68680800,-52956e3,-37231200,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],offset:[-25196,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200,-21600,-25200]},"Europe/Helsinki":{
time:[-2890252800,-1535932800,-875664e3,-859762800,354679200,370407600,386128800,401857200,417582e3,433310400,449031600,465364800,481086e3,496814400,512535600,528264e3,543985200,559713600,575434800,591163200,606884400,622612800,638334e3,654667200,670388400,686116800,701838e3,717566400,733287600,749016e3,764737200,780465600,796186800,811915200,828241200,846388800,859690800,877838400,891140400,909288e3,92259e4,941342400,954039600,972792e3,985489200,1004241600,1017543600,1035691200,1048993200,1067140800,1080442800,1099195200,1111892400,1130644800,1143342e3,1162094400,1174791600,1193544e3,1206846e3,1224993600,1238295600,1256443200,1269745200,1288497600,1301194800,1319947200,1332644400,1351396800,1364698800,1382846400,1396148400,1414296e3,1427598e3,1445745600,1459047600,14778e5,1490497200,1509249600,1521946800,1540699200,1554001200,1572148800,1585450800,1603598400,1616900400,1635652800,164835e4,1667102400,1679799600,1698552e3,1711854e3,1730001600,1743303600,1761451200,1774753200,1792900800,1806202800,1824955200,1837652400,1856404800,1869102e3,1887854400,1901156400,1919304e3,1932606e3],offset:[5989,5989,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Europe/Stockholm":{time:[-2871676800,-2208988800,-1692493200,-1680476400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],
offset:[4332,3614,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Copenhagen":{time:[-2524521600,-2398291200,-1692493200,-1680483600,-935107200,-85725e4,-844552800,-828219600,-812498400,-79677e4,-781048800,-769381200,-747007200,-736376400,-715212e3,-706741200,-683157600,-675291600,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[3020,3020,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Atlantic/Reykjavik":{
time:[-1956614400,-1668214800,-1647212400,-1636678800,-161343e4,-1605142800,-1581894e3,-1539565200,-153135e4,-968029200,-952293600,-942012e3,-920239200,-909961200,-888789600,-877906800,-857944800,-846457200,-826495200,-815007600,-795045600,-783558e3,-762991200,-752108400,-731541600,-717634800,-700092e3,-686185200,-668642400,-654735600,-636588e3,-623286e3,-605743200,-591836400,-573688800,-559782e3,-542239200,-528332400,-510789600,-496882800,-47934e4,-465433200,-447890400,-433983600,-415836e3,-401929200,-384386400,-370479600,-352936800,-33903e4,-321487200,-307580400,-290037600,-276130800,-258588e3,-244681200,-226533600,-212626800,-195084e3,-181177200,-163634400,-149727600,-132184800,-118278e3,-100735200,-86828400,-68680800,-54774e3,1924992e3],offset:[-5280,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0,-3600,0]},"Europe/Tallinn":{time:[-2840140800,-1638316800,-1632002400,-1618693200,-1593820800,-1535932800,-927936e3,-892944e3,-85725e4,-844552800,-828219600,-812498400,-797644800,354931200,370742400,386467200,402278400,418003200,433814400,449625600,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909288e3,92259e4,941342400,1017543600,1035691200,1048993200,1067140800,1080442800,1099195200,1111892400,1130644800,1143342e3,1162094400,1174791600,1193544e3,1206846e3,1224993600,1238295600,1256443200,1269745200,1288497600,1301194800,1319947200,1332644400,1351396800,1364698800,1382846400,1396148400,1414296e3,1427598e3,1445745600,1459047600,14778e5,1490497200,1509249600,1521946800,1540699200,1554001200,1572148800,1585450800,1603598400,1616900400,1635652800,164835e4,1667102400,1679799600,1698552e3,1711854e3,1730001600,1743303600,1761451200,1774753200,1792900800,1806202800,1824955200,1837652400,1856404800,1869102e3,1887854400,1901156400,1919304e3,1932606e3],offset:[5940,5940,3600,7200,3600,5940,7200,10800,7200,3600,7200,3600,7200,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Europe/Riga":{
time:[-2840140800,-1632002400,-1618693200,-1601676e3,-1597266e3,-1377302400,-928022400,-899510400,-85725e4,-844552800,-828219600,-812498400,-79677e4,-795830400,354931200,370742400,386467200,402278400,418003200,433814400,449625600,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,843966e3,859690800,877838400,891140400,909288e3,92259e4,941342400,985489200,1004241600,1017543600,1035691200,1048993200,1067140800,1080442800,1099195200,1111892400,1130644800,1143342e3,1162094400,1174791600,1193544e3,1206846e3,1224993600,1238295600,1256443200,1269745200,1288497600,1301194800,1319947200,1332644400,1351396800,1364698800,1382846400,1396148400,1414296e3,1427598e3,1445745600,1459047600,14778e5,1490497200,1509249600,1521946800,1540699200,1554001200,1572148800,1585450800,1603598400,1616900400,1635652800,164835e4,1667102400,1679799600,1698552e3,1711854e3,1730001600,1743303600,1761451200,1774753200,1792900800,1806202800,1824955200,1837652400,1856404800,1869102e3,1887854400,1901156400,1919304e3,1932606e3],offset:[5794,5794,9394,5794,9394,5794,7200,10800,7200,3600,7200,3600,7200,3600,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"Europe/Vilnius":{time:[-2840140800,-1672531200,-1585094400,-1561248e3,-1553558400,-928195200,-900115200,-85725e4,-844552800,-828219600,-812498400,-802137600,354931200,370742400,386467200,402278400,418003200,433814400,449625600,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891140400,909284400,922586400,941338800,1048993200,1067140800,1080442800,1099195200,1111892400,1130644800,1143342e3,1162094400,1174791600,1193544e3,1206846e3,1224993600,1238295600,1256443200,1269745200,1288497600,1301194800,1319947200,1332644400,1351396800,1364698800,1382846400,1396148400,1414296e3,1427598e3,1445745600,1459047600,14778e5,1490497200,1509249600,1521946800,1540699200,1554001200,1572148800,1585450800,1603598400,1616900400,1635652800,164835e4,1667102400,1679799600,1698552e3,1711854e3,1730001600,1743303600,1761451200,1774753200,1792900800,1806202800,1824955200,1837652400,1856404800,1869102e3,1887854400,1901156400,1919304e3,1932606e3],
offset:[6076,5040,5736,3600,7200,3600,10800,7200,3600,7200,3600,7200,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,14400,10800,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,7200,3600,7200,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200,10800,7200]},"America/Lima":{time:[-2524521600,-1938556800,-1009843200,-1002067200,-986774400,-971049600,-955324800,-9396e5,504921600,512697600,536457600,544233600,631152e3,638928e3,757382400,765158400,1924974e3],offset:[-18492,-18516,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3]},"America/Santiago":{time:[-2524521600,-1892678400,-1688428800,-1619222400,-1593820800,-1336003200,-13176e5,-1304380800,-1286064e3,-1272844800,-1254528e3,-1241308800,-1222992e3,-1209772800,-1191369600,-1178150400,-870566400,-865296e3,-740534400,-736646400,-718070400,-713667600,-36633600,-23932800,-3369600,7516800,24451200,37756800,55900800,69206400,87955200,100656e3,118195200,132105600,150854400,163555200,182304e3,195609600,213753600,227059200,245203200,258508800,277257600,289958400,308707200,321408e3,340156800,353462400,371606400,384912e3,403056e3,416361600,434505600,447811200,46656e4,479260800,498009600,510710400,529459200,545184e3,560908800,574214400,592358400,605664e3,624412800,637113600,653443200,668563200,687312e3,700617600,718761600,732067200,750211200,763516800,781660800,794966400,813715200,826416e3,845164800,85968e4,876614400,88992e4,906854400,923184e3,939513600,952819200,971568e3,984268800,1003017600,1015718400,1034467200,1047168e3,1065916800,1079222400,1097366400,1110672e3,1128816e3,1142121600,1160870400,1173571200,119232e4,1206835200,1223769600,1237075200,1255219200,1270339200,1286668800,1304812800,1313884800,1335657600,1346544e3,1367107200,1378598400,1398556800,1410048e3,1463270400,1471132800,149472e4,1502582400,1526169600,1534032e3,1554595200,1567900800,1586044800,1599350400,1617494400,16308e5,1648944e3,1662854400,1680393600,1693699200,1712448e3,1725753600,1743897600,1757203200,1775347200,1788652800,1806796800,1820102400,1838246400,1851552e3,1870300800,1883001600,1901750400,1915056e3,19332e5],
offset:[-16965,-16965,-18e3,-16965,-14400,-16965,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-18e3,-14400,-10800,-14400,-18e3,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800,-14400,-10800]},"Asia/Bahrain":{time:[-897868800,-820540800,76204800,1925002800],offset:[12140,12600,14400,10800]},"Asia/Jakarta":{time:[-3231273600,-1451693568,-117288e4,-876614400,-766022400,-683856e3,-620784e3,-189388800,1925017200],offset:[25632,25632,26400,27e3,32400,27e3,28800,27e3,25200]},"Africa/Lagos":{time:[-2035584e3,-1940889600,-1767225600,-1588464e3,1924995600],offset:[815,0,815,1800,3600]},"Pacific/Norfolk":{time:[-2177452800,-599616e3,152071200,162961200,1443924e3,1570327200,1586055600,1601776800,1617505200,1633226400,1648954800,1664676e3,1680404400,1696125600,1712458800,172818e4,1743908400,1759629600,1775358e3,1791079200,1806807600,1822528800,1838257200,1853978400,1869706800,1886032800,1901761200,1917482400,1933210800],offset:[40312,40320,41400,45e3,41400,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200,39600,43200]},"America/Juneau":{
time:[-3225169588,-2188987200,-880236e3,-769420800,-765410400,-21506400,-5781600,9943200,25668e3,41392800,57722400,73447200,89172e3,104896800,120621600,126669600,152071200,162352800,183520800,199245600,215575200,230695200,247024800,262749600,278474400,294199200,309924e3,325648800,341373600,357098400,372823200,388548e3,404877600,419997600,436327200,438998400,452052e3,467776800,483501600,499226400,514951200,530676e3,544586400,562125600,576036e3,59418e4,607485600,625629600,638935200,657079200,670989600,688528800,702439200,719978400,733888800,752032800,765338400,783482400,796788e3,814932e3,828842400,846381600,860292e3,877831200,891741600,909280800,923191200,941335200,954640800,972784800,986090400,1004234400,1018144800,1035684e3,1049594400,1067133600,1081044e3,1099188e3,1112493600,1130637600,1143943200,1162087200,1173578400,1194141600,1205028e3,1225591200,1236477600,1257040800,1268532e3,1289095200,1299981600,1320544800,1331431200,1351994400,1362880800,1383444e3,1394330400,1414893600,142578e4,1446343200,1457834400,1478397600,1489284e3,1509847200,1520733600,1541296800,1552183200,1572746400,1583632800,1604196e3,1615687200,1636250400,1647136800,16677e5,1678586400,1699149600,1710036e3,1730599200,1741485600,1762048800,1772935200,1793498400,1804989600,1825552800,1836439200,1857002400,1867888800,1888452e3,1899338400,1919901600,1930788e3],offset:[54139,-32261,-28800,-25200,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-25200,-28800,-28800,-28800,-25200,-28800,-25200,-28800,-25200,-32400,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400,-28800,-32400]},"Asia/Ho_Chi_Minh":{time:[-2004048e3,-1851552e3,-852080400,-782614800,-767836800,-718070400,-457747200,-315622800,171849600,1925017200],offset:[25590,25590,25200,28800,32400,25200,28800,25200,28800,25200]},"Australia/Perth":{time:[-2337897600,-1672524e3,-1665349200,-883605600,-876085200,-860364e3,-844635600,152071200,162961200,436327200,447217200,690343200,699418800,1165111200,1174791600,1193536800,1206846e3,1224986400,1238295600,1925020800],offset:[27804,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800,32400,28800]},"Europe/Malta":{
time:[-2403475200,-1690761600,-168048e4,-1664755200,-1648944e3,-163512e4,-1616889600,-1604275200,-1585526400,-1571011200,-1555286400,-932428800,-85725e4,-844552800,-828219600,-812584800,-798066e3,-781048800,-76671e4,-750895200,-733352400,-719452800,-70191e4,-689205600,-670453200,-114048e3,-103161600,-81993600,-71708400,-50544e3,-40258800,-18489600,-8204400,1296e4,23245200,43804800,54694800,75859200,86749200,102384e3,118112400,135734400,148525200,167191200,180496800,198640800,211946400,230090400,243396e3,26154e4,274845600,292989600,306295200,323316e3,338349600,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[3484,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Amsterdam":{
time:[-4260211200,-1693699200,-168048e4,-1663452e3,-1650142800,-1633212e3,-1617483600,-1601157600,-1586034e3,-1569708e3,-1554584400,-1538258400,-1523134800,-15075e5,-1490562e3,-1470175200,-1459112400,-1443996e3,-1427662800,-1406671200,-1396213200,-1376949600,-1364763600,-1345413600,-1333314e3,-1313791200,-1301259600,-1282255200,-126981e4,-1250719200,-1238360400,-1219183200,-1206910800,-1186956e3,-1175461200,-1156024800,-1143406800,-1124488800,-1111957200,-1092952800,-1080507600,-1061330400,-1049058e3,-1029189600,-1025740800,-1017608400,-998258400,-986158800,-966722400,-954104400,-935020800,-85725e4,-844552800,-828219600,-812498400,-79677e4,-781048800,-766616400,228880800,244004400,260330400,276058800,29178e4,307508400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[1172,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,1172,4772,4800,1200,4800,1200,4800,1200,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Brussels":{
time:[-2840140800,-2450994150,-1740355200,-1693699200,-1680476400,-1663452e3,-1650142800,-1632002400,-1618693200,-1613822400,-1604278800,-1585526400,-1574038800,-1552262400,-1539997200,-1520553600,-1507510800,-1490572800,-1473642e3,-1459123200,-1444006800,-1427673600,-1411952400,-1396224e3,-1379293200,-1364774400,-1348448400,-1333324800,-1316394e3,-1301259600,-1284328800,-126981e4,-1253484e3,-1238360400,-1221429600,-1206910800,-1191189600,-1175461200,-1160344800,-1143406800,-1127685600,-1111957200,-1096840800,-1080507600,-1063576800,-1049058e3,-1033336800,-1017608400,-1002492e3,-986158800,-969228e3,-950475600,-942012e3,-934664400,-85725e4,-844552800,-828219600,-812498400,-798066e3,-781048800,-766616400,-745452e3,-733266e3,228880800,244004400,260330400,276058800,29178e4,307508400,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[1050,1050,0,3600,7200,3600,7200,3600,7200,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]},"Europe/Lisbon":{
time:[-1830386205,-1689555600,-1677798e3,-1667437200,-1647734400,-1635814800,-1616198400,-1604365200,-1584662400,-1572742800,-155304e4,-1541206800,-1521504e3,-1442451600,-1426809600,-1379293200,-1364774400,-1348448400,-1333324800,-1316394e3,-1301270400,-1284339600,-1269820800,-1221440400,-1206921600,-1191200400,-1175472e3,-1127696400,-1111968e3,-1096851600,-1080518400,-1063587600,-1049068800,-1033347600,-1017619200,-1002502800,-986169600,-969238800,-950486400,-942022800,-922665600,-906944400,-891129600,-877309200,-873680400,-864e6,-857952e3,-845859600,-842835600,-831340800,-825897600,-81441e4,-810781200,-799891200,-794448e3,-782960400,-779331600,-768441600,-762998400,-749091600,-733363200,-717631200,-701902800,-686181600,-670453200,-654732e3,-639003600,-623282400,-607554e3,-591832800,-575499600,-559778400,-54405e4,-528328800,-512600400,-496879200,-481150800,-465429600,-449701200,-43398e4,-417646800,-401925600,-386197200,-370476e3,-354747600,-339026400,-323298e3,-307576800,-291848400,-276127200,-260398800,-244677600,-228344400,-212623200,-196894800,-181173600,-165445200,-149724e3,-133995600,-118274400,212547600,228268800,243997200,260323200,276051600,291772800,307504800,323222400,338954400,354675600,370404e3,386125200,401853600,417578400,433303200,449024400,465357600,481078800,496807200,512528400,528256800,543978e3,559706400,575427600,591156e3,606877200,622605600,638326800,65466e4,670381200,686109600,701830800,717559200,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846381600,859683600,877831200,891133200,909280800,922582800,941335200,954032400,972784800,985482e3,1004234400,1017536400,1035684e3,1048986e3,1067133600,1080435600,1099188e3,1111885200,1130637600,1143334800,1162087200,1174784400,1193536800,1206838800,1224986400,1238288400,1256436e3,1269738e3,1288490400,1301187600,131994e4,1332637200,1351389600,1364691600,1382839200,1396141200,1414288800,1427590800,1445738400,1459040400,1477792800,149049e4,1509242400,1521939600,1540692e3,1553994e3,1572141600,1585443600,1603591200,1616893200,1635645600,1648342800,1667095200,1679792400,1698544800,1711846800,1729994400,1743296400,1761444e3,1774746e3,1792893600,1806195600,1824948e3,1837645200,1856397600,1869094800,1887847200,1901149200,1919296800,1932598800],offset:[-2205,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,7200,3600,0,3600,7200,3600,0,3600,7200,3600,0,3600,7200,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,3600,7200,3600,7200,3600,7200,3600,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0]},"Europe/Dublin":{
time:[-2821651200,-1691964e3,-1680469200,-1664143200,-1650142800,-1633903200,-1617483600,-1601848800,-1586034e3,-1570399200,-1552165200,-1538344800,-152253e4,-15075e5,-1490562e3,-1473631200,-1460926800,-1442786400,-1428872400,-1410732e3,-1396213200,-1379282400,-1364763600,-1348437600,-1333314e3,-1315778400,-1301259600,-1284328800,-126981e4,-1253484e3,-1238360400,-1221429600,-1206910800,-118998e4,-1175461200,-1159135200,-1143406800,-1126476e3,-1111957200,-1095631200,-1080507600,-1063576800,-1049058e3,-1032127200,-1017608400,-1001282400,-986158800,-969228e3,-950475600,-942012e3,-733352400,-719445600,-699483600,-684972e3,-668034e3,-654732e3,-636584400,-622072800,-605739600,-590623200,-57429e4,-558568800,-542235600,-527119200,-512600400,-496274400,-481150800,-46422e4,-449701200,-432165600,-417646800,-401320800,-386197200,-369266400,-354747600,-337816800,-323298e3,-306972e3,-291848400,-276732e3,-257979600,-245282400,-22653e4,-213228e3,-195080400,-182383200,-163630800,-150933600,-132181200,-119484e3,-100731600,-88034400,-68677200,-59004e3,57726e3,69818400,89175600,101268e3,120625200,132717600,152074800,164167200,183524400,196221600,214974e3,227671200,246423600,259120800,278478e3,290570400,309927600,32202e4,341377200,354675600,372823200,386125200,404272800,417574800,435722400,449024400,467776800,481078800,499226400,512528400,530676e3,543978e3,562125600,575427600,593575200,606877200,625629600,638326800,657079200,670381200,688528800,701830800,719978400,733280400,751428e3,76473e4,782877600,796179600,814327200,828234e3,846381600,859683600,877831200,891133200,909280800,922582800,941335200,954032400,972784800,985482e3,1004234400,1017536400,1035684e3,1048986e3,1067133600,1080435600,1099188e3,1111885200,1130637600,1143334800,1162087200,1174784400,1193536800,1206838800,1224986400,1238288400,1256436e3,1269738e3,1288490400,1301187600,131994e4,1332637200,1351389600,1364691600,1382839200,1396141200,1414288800,1427590800,1445738400,1459040400,1477792800,149049e4,1509242400,1521939600,1540692e3,1553994e3,1572141600,1585443600,1603591200,1616893200,1635645600,1648342800,1667095200,1679792400,1698544800,1711846800,1729994400,1743296400,1761444e3,1774746e3,1792893600,1806195600,1824948e3,1837645200,1856397600,1869094800,1887847200,1901149200,1919296800,1932598800],offset:[-1521,-1521,2079,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0,3600,0]},"Europe/Oslo":{
time:[-2366755200,-1691881200,-1680566400,-927507600,-85725e4,-844552800,-828219600,-812498400,-79677e4,-781048800,-765320400,-340840800,-324507600,-308786400,-293058e3,-277336800,-261608400,-245887200,-230158800,-214437600,-198709200,-182988e3,-166654800,-147909600,-135205200,323834400,338958e3,354679200,370407600,386128800,401857200,417578400,433306800,449028e3,465361200,481082400,496810800,512532e3,528260400,543981600,55971e4,575431200,591159600,606880800,622609200,638330400,654663600,670384800,686113200,701834400,717562800,733284e3,749012400,764733600,780462e3,796183200,811911600,828237600,846385200,859687200,877834800,891136800,909284400,922586400,941338800,954036e3,972788400,985485600,1004238e3,101754e4,1035687600,1048989600,1067137200,1080439200,1099191600,1111888800,1130641200,1143338400,1162090800,1174788e3,1193540400,1206842400,122499e4,1238292e3,1256439600,1269741600,1288494e3,1301191200,1319943600,1332640800,1351393200,1364695200,1382842800,1396144800,1414292400,1427594400,1445742e3,1459044e3,1477796400,1490493600,1509246e3,1521943200,1540695600,1553997600,1572145200,1585447200,1603594800,1616896800,1635649200,1648346400,1667098800,1679796e3,1698548400,1711850400,1729998e3,17433e5,1761447600,1774749600,1792897200,1806199200,1824951600,1837648800,1856401200,1869098400,1887850800,1901152800,1919300400,1932602400],offset:[2580,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600,7200,3600]}}},18923:(e,t,i)=>{"use strict";i.d(t,{Version:()=>r});var s=i(50151);class r{constructor(e,t){this._major=e,this._minor=t}major(){return this._major}minor(){return this._minor}isZero(){return 0===this._major&&0===this._minor}toString(){return this._major+"."+this._minor}compareTo(e){return this._majore._major?1:this._minore._minor?1:0}isLess(e){return this.compareTo(e)<0}isLessOrEqual(e){return this.compareTo(e)<=0}isEqual(e){return 0===this.compareTo(e)}isGreater(e){return this.compareTo(e)>0}isGreaterOrEqual(e){return this.compareTo(e)>=0}static parse(e){if(e instanceof r)return new r(e.major(),e.minor());if("number"==typeof e)return(0,s.assert)(Math.floor(e)===e,"Version should not be a float number"),new r(e,0);if("string"==typeof e){const t=e.split(".");if(1===t.length){const i=parseInt(t[0],10);return(0,s.assert)(!isNaN(i),"Bad version string: "+e),new r(i,0)}if(2===t.length){const i=parseInt(t[0],10);(0,s.assert)(!isNaN(i),"Bad version string: "+e);const n=parseInt(t[1],10);return(0,
s.assert)(!isNaN(n),"Bad version string: "+e),new r(i,n)}throw new Error("Bad version string (one dot expected): "+e)}throw new Error("Bad version: "+e)}}r.ZERO=new r(0,0)},97145:(e,t,i)=>{"use strict";i.d(t,{WatchedValue:()=>o});var s=i(19782);const r=(0,i(44441).getLogger)("Common.WatchedValue");function n(e){r.logError(`${e&&(e.stack||e.message)}`)}class o{constructor(...e){this._listeners=[],e.length>0&&(this._value=e[0])}destroy(){this.unsubscribe()}value(){return this._owner?this._owner._value:this._value}setValue(e,t){const i=this._owner?this._owner:this;if("function"==typeof i.hook&&(e=i.hook(e)),i.writeLock)return;const s=i._value===e||Number.isNaN(i._value)&&Number.isNaN(e);if(!t&&s&&i.hasOwnProperty("_value"))return;i._value=e;const r=i._listeners.slice();let o=0;for(let t=0;tthis.spawn(e).readonly(),destroy:this.destroy.bind(this)};return this._readonlyInstance=e,e}spawn(e){return new a(this._owner||this,e)}when(e){!function(e,t,i){if(t(e.value()))return void i();const s=r=>{t(r)&&(e.unsubscribe(s),i())};e.subscribe(s,{callWithLast:!0})}(this,(e=>Boolean(e)),(()=>{try{e(this.value())}catch(e){n(e)}}))}assertNoSubscriptions(){0}ownership(){return(0,s.ownership)(this)}spawnOwnership(){return(0,s.ownership)(this.spawn())}weakReference(){return(0,s.weakReference)(this)}}class a extends o{constructor(e,t){super(),delete this._listeners,this._owner=e,this._onDestroy=t}destroy(){var e;try{null===(e=this._onDestroy)||void 0===e||e.call(this)}catch(e){n(e)}super.destroy()}readonly(){return super.readonly()}}},83669:(e,t,i)=>{"use strict";i.d(t,{WatchedObject:()=>o});var s=i(97145),r=i(1722);function n(e,t){return(0,r.deepEquals)(e,t)[0]}class o extends s.WatchedValue{constructor(e,t=n){super(e),this._comparator=t}setValue(e,t){!1===this._comparator(this.value(),e)&&super.setValue(e,t)}}},71026:(e,t,i)=>{"use strict";i.d(t,{AriaChartDescription:()=>l});var s=i(42960),r=i(75531),n=i(14483),o=i(73055),a=i(36274);class l{constructor(){this._ariaElement=null,this._customProvider=null,this._lastDescription=null,this._locale="en"}createElement(e){this._ariaElement=(0,
o.createAriaDescriptionElement)(e)}setCustomProvider(e){this._customProvider=e}setLocale(e){this._locale=e}async updateChartDescription(e,t,i){const s=function(e){var t;const i=r.layouts[e];return null!==(t=null==i?void 0:i.count)&&void 0!==t?t:1}(i),a=await this._buildChartContext(e,t,s);if(null===a)return;if(this._customProvider){const e=await this._customProvider(a);if(null!==e)return void this._setChartDescription(e)}if("en"!==this._locale)return;const l=function(e){const t=function(e){if(!n.enabled("aria_detailed_chart_descriptions")||!e.visibleData)return"";let t;try{t=function(e){let t=e.schema.findIndex((e=>"userTime"===e.type));t<0&&(t=e.schema.findIndex((e=>"time"===e.type)));if(t<0)throw new Error("Exported Data should contain `time`.");const i=c(e,(e=>"value"===e.type&&"series"===e.sourceType&&"close"===e.plotTitle),-1);if(i<0)throw new Error("Exported Data should contain `close`.");const s=c(e,(e=>"value"===e.type&&"series"===e.sourceType&&"low"===e.plotTitle),i),r=c(e,(e=>"value"===e.type&&"series"===e.sourceType&&"high"===e.plotTitle),i),n=c(e,(e=>"value"===e.type&&"series"===e.sourceType&&"open"===e.plotTitle),i),o=e.data.map((e=>({time:e[t],open:e[n],high:e[r],low:e[s],close:e[i]}))),a={start:o[0],close:o[o.length-1],low:o[0],high:o[0]};for(const e of o)e.high>a.high.high&&(a.high=e),e.low=0?s:i}l._instance=null},78325:(e,t,i)=>{"use strict";i.d(t,{AriaCrosshairPriceDescription:()=>r});var s=i(73055);class r{constructor(){this._ariaElement=null,this._nextAnnouncementTime=Date.now().valueOf(),this._latestDescription="",this._timeoutId=null,this._locale="en"}createElement(e){this._ariaElement=(0,s.createAriaDescriptionElement)(e)}setLocale(e){this._locale=e}async updateChartDescription(e,t,i,r){if("en"!==this._locale)return;let n=`Price ${e.formatter().format(t)}`;if(i){n+=` as of ${(0,s.formatDate)(i/1e3,r)}`}this._setChartDescription(n)}static getInstance(){return null===this._instance&&(this._instance=new r),this._instance}_setChartDescription(e){if(this._latestDescription=e,null!==this._timeoutId)return;const t=Date.now().valueOf();t{this._timeoutId=null,this._applyChartDescription()}),this._nextAnnouncementTime-t):this._applyChartDescription()}_applyChartDescription(){if(!this._ariaElement)return;this._ariaElement.textContent=this._latestDescription;const e=Date.now().valueOf();this._nextAnnouncementTime=e+2e3}}r._instance=null},73055:(e,t,i)=>{"use strict";function s(e){const t=e.querySelector("#chart-aria-description");if(null!==t)return t;const i=e.createElement("div");return i.id="chart-aria-description",i.tabIndex=-1,i.role="alert",i.ariaLive="assertive",e.body.appendChild(i),i}function r(e,t){const i={weekday:"long",year:"numeric",month:"long",day:"numeric",hour:t?"2-digit":void 0,minute:t?"2-digit":void 0,hour12:!0};return new Date(1e3*e).toLocaleString(void 0,i)}i.d(t,{createAriaDescriptionElement:()=>s,formatDate:()=>r})},16838:(e,t,i)=>{"use strict";i.d(t,{PLATFORM_ACCESSIBILITY_ENABLED:()=>r,createScopedVisibleElementFilter:()=>n,mapKeyCodeToDirection:()=>h,navigationOrderComparator:()=>o,queryFocusableElements:()=>l,queryTabbableElements:()=>a,updateTabIndexes:()=>c});var s=i(38223);const r=i(14483).enabled("accessibility");function n(e){return t=>{let i=t;for(;i!==e&&null!==i;){const e=getComputedStyle(i);if("none"===e.display||"visible"!==e.visibility)return!1;i=i.parentElement}return!0}}function o(e,t){return e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function a(e){
return Array.from(e.querySelectorAll('button:not([disabled]):not([aria-disabled]):not([tabindex="-1"]), [tabindex]:not([disabled]):not([aria-disabled]):not([tabindex="-1"])')).filter(n(e))}function l(e){return Array.from(e.querySelectorAll('button:not([disabled]):not([aria-disabled="true"]):not([aria-disabled=""]), [tabindex]:not([disabled]):not([aria-disabled="true"]):not([aria-disabled=""])')).filter(n(e))}function c(){window.dispatchEvent(new CustomEvent("keyboard-navigation-activation",{bubbles:!0}))}function h(e){const t=(0,s.isRtl)();switch(e){case 38:return"blockPrev";case 40:return"blockNext";case 37:return t?"inlineNext":"inlinePrev";case 39:return t?"inlinePrev":"inlineNext";default:return null}}},9438:(e,t,i)=>{"use strict";i.d(t,{TOOLBAR_WIDTH_COLLAPSED:()=>r,TOOLBAR_WIDTH_EXPANDED:()=>s});const s=52,r=5},14873:(e,t,i)=>{"use strict";i.d(t,{isDrawingToolbarVisible:()=>l});var s=i(56840),r=i(14483),n=i(97145);const o=!r.enabled("hide_left_toolbar_by_default"),a=s.getBool("ChartDrawingToolbarWidget.visible",o),l=new n.WatchedValue(a)},69774:(e,t,i)=>{"use strict";i.d(t,{HEADER_TOOLBAR_HEIGHT_COLLAPSED:()=>n,HEADER_TOOLBAR_HEIGHT_EXPANDED:()=>r});var s=i(62995);const r=parseInt(s["css-value-header-toolbar-height"]),n=3},98731:(e,t,i)=>{"use strict";i.d(t,{shouldShowQuickSearchOnLib:()=>o});var s=i(49483),r=i(84015),n=i(14483);function o(){return!s.CheckMobile.any()&&!(0,r.isOnMobileAppPage)("any")&&!n.enabled("widget")&&n.enabled("header_quick_search")}},35423:(e,t,i)=>{"use strict";i.d(t,{FavoriteStudyTemplateService:()=>r});var s=i(68456);class r extends s.CommonJsonStoreService{constructor(e,t){super(e,t,"FAVORITE_STUDY_TEMPLATES_CHANGED","StudyTemplates.quicks",[])}remove(e){this.set(this.get().filter((t=>t!==e)))}}},95059:(e,t,i)=>{"use strict";var s;i.d(t,{ACTION_ID:()=>s}),function(e){e.UnknownAction="UnknownAction",e.ChartApplyIndicatorsToAllCharts="Chart.ApplyIndicatorsToAllCharts",e.ChartChangeTimeZone="Chart.ChangeTimeZone",e.ChartIndicatorPineSource="Chart.Indicator.PineSource",e.ChartDialogsShowChangeInterval="Chart.Dialogs.ShowChangeInterval",e.ChartDialogsShowChangeSymbol="Chart.Dialogs.ShowChangeSymbol",e.ChartDialogsShowCompareOrAddSymbol="Chart.Dialogs.ShowCompareOrAddSymbol",e.ChartDialogsShowGeneralSettings="Chart.Dialogs.ShowGeneralSettings",e.ChartDialogsShowGeneralSettingsSymbolTab="Chart.Dialogs.ShowGeneralSettings.SymbolTab",e.ChartDialogsShowGeneralScalesTab="Chart.Dialogs.ShowGeneralSettings.ScalesTab",e.ChartDialogsShowGoToDate="Chart.Dialogs.ShowGoToDate",e.ChartDialogsShowInsertIndicators="Chart.Dialogs.ShowInsertIndicators",e.ChartDialogsShowInsertFinancials="Chart.Dialogs.ShowInsertFinancials",e.ChartDialogsShowSymbolInfo="Chart.Dialogs.ShowSymbolInfo",e.ChartDrawingToolbarToggleVisibility="Chart.DrawingToolbar.ToggleVisibility",e.ChartLinesToggleBidAskLinesVisibility="Chart.Lines.ToggleBidAskLinesVisibility",e.ChartLinesToggleHighLowLinesVisibility="Chart.Lines.ToggleHighLowLinesVisibility",e.ChartLinesToggleAverageLineVisibility="Chart.Lines.ToggleAverageLineVisibility",
e.ChartLinesTogglePrePostMarketLineVisibility="Chart.Lines.TogglePrePostMarketLineVisibility",e.ChartLinesToggleSeriesPrevCloseLineVisibility="Chart.Lines.ToggleSeriesPrevCloseLineVisibility",e.ChartLinesToggleSeriesPriceLineVisibility="Chart.Lines.ToggleSeriesPriceLineVisibility",e.ChartLineToolPitchforkChangeTypeToInside="Chart.LineTool.Pitchfork.ChangeTypeToInside",e.ChartLineToolPitchforkChangeTypeToModifiedSchiff="Chart.LineTool.Pitchfork.ChangeTypeToModifiedSchiff",e.ChartLineToolPitchforkChangeTypeToOriginal="Chart.LineTool.Pitchfork.ChangeTypeToOriginal",e.ChartLineToolPitchforkChangeTypeToSchiff="Chart.LineTool.Pitchfork.ChangeTypeToSchiff",e.ChartMarksToggleVisibility="Chart.Marks.ToggleVisibility",e.ChartMoveChartInLayout="Chart.MoveChartInLayout",e.ChartMoveChartInLayoutBack="Chart.MoveChartInLayout.Back",e.ChartMoveChartInLayoutForward="Chart.MoveChartInLayout.Forward",e.ChartObjectTreeShow="Chart.ObjectTree.Show",e.ChartDataWindowShow="Chart.DataWindow.Show",e.ChartPriceScaleLabelsToggleBidAskLabelsVisibility="Chart.PriceScale.Labels.ToggleBidAskLabelsVisibility",e.ChartPriceScaleLabelsToggleHighLowPriceLabelsVisibility="Chart.PriceScale.Labels.ToggleHighLowPriceLabelsVisibility",e.ChartPriceScaleLabelsToggleAveragePriceLabelVisibility="Chart.PriceScale.Labels.ToggleAveragePriceLabelVisibility",e.ChartPriceScaleLabelsToggleIndicatorsNameLabelsVisibility="Chart.PriceScale.Labels.ToggleIndicatorsNameLabelsVisibility",e.ChartPriceScaleLabelsToggleIndicatorsValueLabelsVisibility="Chart.PriceScale.Labels.ToggleIndicatorsValueLabelsVisibility",e.ChartPriceScaleLabelsTogglePrePostMarketLabelsVisibility="Chart.PriceScale.Labels.TogglePrePostMarketLabelsVisibility",e.ChartPriceScaleLabelsToggleSeriesLastValueVisibility="Chart.PriceScale.Labels.ToggleSeriesLastValueVisibility",e.ChartPriceScaleLabelsToggleSymbolNameLabelsVisibility="Chart.PriceScale.Labels.ToggleSymbolNameLabelsVisibility",e.ChartPriceScaleLabelsToggleSymbolPrevCloseValueVisibility="Chart.PriceScale.Labels.ToggleSymbolPrevCloseValueVisibility",e.ChartPriceScaleMergeAllScalesToLeft="Chart.PriceScale.MergeAllScalesToLeft",e.ChartPriceScaleMergeAllScalesToRight="Chart.PriceScale.MergeAllScalesToRight",e.ChartPriceScaleMoveToLeft="Chart.PriceScale.MoveToLeft",e.ChartPriceScaleMoveToRight="Chart.PriceScale.MoveToRight",e.ChartPriceScaleToggleAddOrderPlusButtonVisibility="Chart.PriceScale.ToggleAddOrderPlusButtonVisibility",e.ChartPriceScaleToggleAutoScaleSeriesOnly="Chart.PriceScale.ToggleAutoScaleSeriesOnly",e.ChartPriceScaleToggleCountdownToBarCloseVisibility="Chart.PriceScale.ToggleCountdownToBarCloseVisibility",e.ChartRedo="Chart.Redo",e.ChartRemoveAllIndicators="Chart.RemoveAllIndicators",e.ChartRemoveAllIndicatorsAndLineTools="Chart.RemoveAllIndicatorsAndLineTools",e.ChartRemoveAllLineTools="Chart.RemoveAllLineTools",e.ChartToggleVisibilityAllLineTools="Chart.ToggleVisibility.AllLineTools",e.ChartScalesReset="Chart.Scales.Reset",e.ChartScalesToggleLockPriceToBarRatio="Chart.Scales.ToggleLockPriceToBarRatio",
e.ChartSelectedObjectHide="Chart.SelectedObject.Hide",e.ChartSelectedObjectRemove="Chart.SelectedObject.Remove",e.ChartSelectedObjectShowSettingsDialog="Chart.SelectedObject.ShowSettingsDialog",e.ChartSelectedObjectToggleLocked="Chart.SelectedObject.ToggleLocked",e.ChartSeriesPriceScaleToggleAutoScale="Chart.Series.PriceScale.ToggleAutoScale",e.ChartSeriesPriceScaleToggleIndexedTo100="Chart.Series.PriceScale.ToggleIndexedTo100",e.ChartSeriesPriceScaleToggleInvertPriceScale="Chart.Series.PriceScale.ToggleInvertPriceScale",e.ChartSeriesPriceScaleToggleLogarithmic="Chart.Series.PriceScale.ToggleLogarithmic",e.ChartSeriesPriceScaleTogglePercentage="Chart.Series.PriceScale.TogglePercentage",e.ChartSeriesPriceScaleToggleRegular="Chart.Series.PriceScale.ToggleRegular",e.ChartSessionBreaksToggleVisibility="Chart.SessionBreaks.ToggleVisibility",e.ChartTimeScaleReset="Chart.TimeScale.Reset",e.ChartUndo="Chart.Undo",e.ChartThemeApply="Chart.Theme.Apply",e.ChartSourceIntervalsVisibility="Chart.Source.IntervalsVisibility",e.ChartSourceIntervalsVisibilityCurrentAndAbove="Chart.Source.IntervalsVisibility.CurrentAndAbove",e.ChartSourceIntervalsVisibilityCurrentAndBelow="Chart.Source.IntervalsVisibility.CurrentAndBelow",e.ChartSourceIntervalsVisibilityOnlyCurrent="Chart.Source.IntervalsVisibility.Current",e.ChartSourceIntervalsVisibilityAll="Chart.Source.IntervalsVisibility.All",e.Loading="Loading"}(s||(s={}))},86909:(e,t,i)=>{"use strict";i.d(t,{ActionWithStandardIcon:()=>n});var s=i(39347),r=i(3994);class n extends s.Action{constructor(e){var t,i;const{options:s,customActionOptions:n}=e;s.iconId&&(s.icon=null!==(t=s.icon)&&void 0!==t?t:r.icons.get(s.iconId)),n&&n.iconId&&(n.icon=null!==(i=n.icon)&&void 0!==i?i:r.icons.get(n.iconId)),super(e)}}},39347:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Action:()=>a,Loader:()=>c,Separator:()=>l});var s=i(50151),r=i(57898),n=i(68335),o=i(36174);class a{constructor(e){this.type="action",this._destroyed=!1,this._binding=null,this._loadOptionsPromise=null,this._customAction=null;const{actionId:t,options:i,optionsLoader:n,customActionOptions:l,customActionOptionsLoader:c,id:h=o.guid()}=e;(0,s.assert)(void 0!==t,"actionId must be defined"),this.id=h,this._onUpdate=new r.Delegate,this._options={actionId:t,...i},this.update(i),this._loadOptionsGetter=null!=n?n:null,this._loadOptionsGetter&&(this._options.loading=!0),l&&(this._customAction=new a({actionId:t,options:l,optionsLoader:c,id:h}))}custom(){return this._customAction}execute(){this._options.checkable&&this.update({checked:!this._options.checked}),this._options.onExecute&&this._options.onExecute(this)}getLabel(){return this._options.label||""}getSubItems(){return this._options.subItems||[]}isDisabled(){return!0===this._options.disabled}isActive(){return!0===this._options.active}isCheckable(){return!0===this._options.checkable}isChecked(){return!0===this._options.checked}isLoading(){return!0===this._options.loading}loadOptions(){
return this._loadOptionsPromise?this._loadOptionsPromise:this._loadOptionsGetter?(this._loadOptionsPromise=this._loadOptionsGetter().then((e=>this.update({...e,loading:!1}))),this._loadOptionsPromise):null}getSize(){var e;return null!==(e=this._options.size)&&void 0!==e?e:"normal"}getPayload(){return this._options.payload}update(e){this._destroyed||(this._unbindShortcut(),e.hotkeyHash&&(this._options.shortcutHint=(0,n.humanReadableHash)(e.hotkeyHash)),this._options=Object.assign(this._options,e),this._bindShortcut(),this._onUpdate.fire(this))}onUpdate(){return this._onUpdate}getState(){return this.loadOptions(),{actionId:this._options.actionId,label:this.getLabel(),styledLabel:this._options.styledLabel,disabled:this.isDisabled(),active:this.isActive(),subItems:this.getSubItems(),checkable:this.isCheckable(),checked:this.isChecked(),loading:this.isLoading(),size:this.getSize(),doNotCloseOnClick:this._options.doNotCloseOnClick||!1,shortcutHint:this._options.shortcutHint,hint:this._options.hint,icon:this._options.icon,iconId:this._options.iconId,iconChecked:this._options.iconChecked,toolbox:this._options.toolbox,showToolboxOnHover:this._options.showToolboxOnHover||!1,statName:this._options.statName,name:this._options.name,invisibleHotkey:this._options.invisibleHotkey,noInteractive:this._options.noInteractive,jsxLabel:"jsxLabel"in this._options?this._options.jsxLabel:void 0,isRepeatAccepted:this._options.isRepeatAccepted}}getBinding(){return this._binding}setBinding(e){this._binding=e}destroy(){var e,t,i;this._destroyed=!0,this._onUpdate.destroy(),null!==this._binding&&this._binding.destroy(),this._unbindShortcut(),null===(t=(e=this._options).onDestroy)||void 0===t||t.call(e),null===(i=this._customAction)||void 0===i||i.destroy()}options(){return this._options}_bindShortcut(){if(!this._options.hotkeyGroup||!this._options.hotkeyHash)return;const e="string"==typeof this._options.label?this._options.label:this._options.name;this._hotkeyAction=this._options.hotkeyGroup.add({hotkey:this._options.hotkeyHash,isRepeatAccepted:this._options.isRepeatAccepted,desc:e,handler:()=>this.execute(),isDisabled:()=>this.isDisabled()})}_unbindShortcut(){this._hotkeyAction&&(this._hotkeyAction.destroy(),delete this._hotkeyAction)}}class l{constructor(e){this.type="separator",this.id=o.guid(),this._hint=e}getHint(){return this._hint}}class c extends a{constructor(e){super({actionId:e,options:{}})}isLoading(){return!0}getSize(){return"big"}}},3994:(e,t,i)=>{"use strict";i.d(t,{icons:()=>f});var s=i(39267),r=i(35149),n=i(51983),o=i(84959),a=i(37924),l=i(77067),c=i(16911),h=i(25191),d=i(54190),u=i(6862),p=i(97874),_=i(2872),m=i(1457),g=i(93379);const f=new Map([["Chart.Reset",s],["Chart.RemoveSelectedObject",r],["Settings",n],["Chart.Hide",o],["Chart.SymbolInfo",a],["Chart.VisualOrder",l],["Chart.ShowObject",c],["Chart.PriceScale",h],["Chart.Move",d],["Chart.ApplyIndicator",u],["Chart.UnlockObject",p],["Chart.LockObject",_],["Chart.Clone",m],["Chart.AddHorzLine",g]])},24120:(e,t,i)=>{"use strict";i.d(t,{ActionsProvider:()=>Je,
createActionCopyPrice:()=>Ye,createChangeIntervalsVisibilitiesAction:()=>$e,createLinesAction:()=>Ze,createMTPredictorActions:()=>Ke,createPasteAction:()=>Ge,createSyncDrawingActions:()=>Xe,createVisualOrderAction:()=>qe,defaultContextMenuOptions:()=>je});var s,r=i(50151),n=i(59224),o=(i(60521),i(1722)),a=i(11542),l=i(14483),c=i(39347),h=i(77212),d=i(10688),u=i(37591),p=i(28853),_=(i(14787),i(26426)),m=i(96362),g=i(68335),f=(i(25812),i(64063)),v=i(8561),S=i(5894),y=i(69618),b=i(92249),w=i(18611),C=i(53180),P=i(36298),x=(i(88348),i(36274)),T=i(4949),I=i(93352),M=i(33703),A=i(88640);!function(e){e.Value="ChartEventsSource"}(s||(s={}));var L=i(86909);(0,n.getLogger)("Chart.ActionsProvider");const k=new P.TranslatedString("change visibility",a.t(null,void 0,i(21511))),D=new P.TranslatedString("pin to scale {label}",a.t(null,void 0,i(56015))),E=new P.TranslatedString("pin to right scale",a.t(null,void 0,i(22615))),V=new P.TranslatedString("pin to left scale",a.t(null,void 0,i(84018))),B=(new P.TranslatedString("change earnings visibility",a.t(null,void 0,i(88217))),new P.TranslatedString("change dividends visibility",a.t(null,void 0,i(84944))),new P.TranslatedString("change splits visibility",a.t(null,void 0,i(74488))),new P.TranslatedString("change continuous contract switch visibility",a.t(null,void 0,i(7017))),new P.TranslatedString("change futures contract expiration visibility",a.t(null,void 0,i(28288))),new P.TranslatedString("change latest news and Minds visibility",a.t(null,void 0,i(19839))),new P.TranslatedString("show all ideas",a.t(null,void 0,i(13622)))),R=new P.TranslatedString("show ideas of followed users",a.t(null,void 0,i(26267))),N=new P.TranslatedString("show my ideas only",a.t(null,void 0,i(40061))),O=(new P.TranslatedString("change events visibility on chart",a.t(null,void 0,i(79574))),new P.TranslatedString("add this symbol to entire layout",a.t(null,void 0,i(27982)))),F=new P.TranslatedString("add this indicator to entire layout",a.t(null,void 0,i(82388))),W=(new P.TranslatedString("add this strategy to entire layout",a.t(null,void 0,i(94292))),new P.TranslatedString("add this financial metric to entire layout",a.t(null,void 0,i(22856))),new P.TranslatedString("apply drawing template",a.t(null,void 0,i(49037))),new P.TranslatedString("lock objects",a.t(null,void 0,i(68163)))),H=new P.TranslatedString("unlock objects",a.t(null,void 0,i(66824))),z=new P.TranslatedString("change visibility at current interval and above",a.t(null,void 0,i(78422))),U=new P.TranslatedString("change visibility at current interval and below",a.t(null,void 0,i(49529))),j=new P.TranslatedString("change visibility at current interval",a.t(null,void 0,i(16698))),G=new P.TranslatedString("change visibility at all intervals",a.t(null,void 0,i(66927))),q=(a.t(null,void 0,i(87085)),(0,C.appendEllipsis)(a.t(null,void 0,i(52302))),a.t(null,void 0,i(81428))),$=a.t(null,void 0,i(31971)),Y=(a.t(null,void 0,i(11156)),a.t(null,void 0,i(15682)),a.t(null,void 0,i(66631)),a.t(null,void 0,i(37422)),a.t(null,void 0,i(5716)),
a.t(null,void 0,i(50352)),a.t(null,void 0,i(19263)),a.t(null,void 0,i(15818)),a.t(null,void 0,i(5897)),a.t(null,void 0,i(58976)),a.t(null,void 0,i(11661)),a.t(null,void 0,i(66560)),a.t(null,void 0,i(53958)),a.t(null,void 0,i(34150)),a.t(null,void 0,i(83927)),a.t(null,void 0,i(15644)),a.t(null,void 0,i(42660)),a.t(null,void 0,i(44788)),a.t(null,void 0,i(70437)),a.t(null,void 0,i(71263)),a.t(null,void 0,i(70573)),a.t(null,void 0,i(59560)),a.t(null,void 0,i(14125))),K=a.t(null,void 0,i(44538)),Z=a.t(null,void 0,i(56948)),X=a.t(null,void 0,i(20207)),J=a.t(null,void 0,i(65810)),Q=a.t(null,void 0,i(3822)),ee=a.t(null,void 0,i(97324)),te=a.t(null,void 0,i(764)),ie=a.t(null,void 0,i(8128)),se=a.t(null,void 0,i(61201)),re=a.t(null,void 0,i(32156)),ne=a.t(null,void 0,i(91130)),oe=a.t(null,void 0,i(37680)),ae=a.t(null,void 0,i(43707)),le=a.t(null,void 0,i(39065)),ce=a.t(null,void 0,i(54727)),he=a.t(null,void 0,i(66156)),de=a.t(null,void 0,i(76598)),ue=a.t(null,void 0,i(3485)),pe=a.t(null,void 0,i(45828)),_e=a.t(null,void 0,i(2899)),me=a.t(null,void 0,i(40887)),ge=a.t(null,void 0,i(53387)),fe=a.t(null,void 0,i(96712)),ve=a.t(null,void 0,i(26354)),Se=a.t(null,void 0,i(19796)),ye=a.t(null,void 0,i(59901)),be=a.t(null,void 0,i(23221)),we=a.t(null,void 0,i(22198)),Ce=a.t(null,void 0,i(27557)),Pe=a.t(null,void 0,i(98486)),xe=a.t(null,void 0,i(73106)),Te=a.t(null,void 0,i(85964)),Ie=a.t(null,void 0,i(59192)),Me=a.t(null,void 0,i(83182)),Ae=((0,C.appendEllipsis)(a.t(null,void 0,i(92206))),(0,C.appendEllipsis)(a.t(null,void 0,i(3612))),(0,C.appendEllipsis)(a.t(null,void 0,i(89517)))),Le=(a.t(null,void 0,i(13345)),(0,C.appendEllipsis)(a.t(null,void 0,i(9908))),a.t(null,void 0,i(35216))),ke=a.t(null,void 0,i(52977)),De=(a.t(null,void 0,i(19611)),a.t(null,void 0,i(38342))),Ee=a.t(null,void 0,i(15101)),Ve=a.t(null,void 0,i(42284)),Be=(a.t(null,void 0,i(46771)),a.t(null,void 0,i(66263)),a.t(null,void 0,i(30816)),a.t(null,void 0,i(24620)),a.t(null,void 0,i(84813)),a.t(null,void 0,i(72973)),a.t(null,void 0,i(48284))),Re=a.t(null,void 0,i(87933)),Ne=a.t(null,void 0,i(58669)),Oe=((0,C.appendEllipsis)(a.t(null,void 0,i(89517))),a.t(null,void 0,i(8251)),a.t(null,void 0,i(34059))),Fe=a.t(null,void 0,i(64288)),We=(a.t(null,void 0,i(77920)),a.t(null,void 0,i(75669)),a.t(null,void 0,i(8886)),a.t(null,void 0,i(18008)),a.t(null,void 0,i(33606)),(0,C.appendEllipsis)(a.t(null,void 0,i(65986)))),He=(0,C.appendEllipsis)(a.t(null,void 0,i(18001))),ze=a.t(null,void 0,i(29682)),Ue=a.t(null,void 0,i(28851)),je={general:!0,mainSeries:!0,mainSeriesTrade:!1,esdStudies:!0,studies:!0,fundamentals:!0,lineTools:!0,publishedCharts:!0,ordersAndPositions:!0,alerts:!0,chartEvents:!0,objectTree:!0,gotoLineTool:!1};function Ge(e,t){return!t.isEmpty()&&l.enabled("datasource_copypaste")?new L.ActionWithStandardIcon({actionId:"Chart.Clipboard.PasteSource",options:{label:ze.trim(),shortcutHint:(0,g.humanReadableHash)(g.Modifiers.Mod+86),statName:"Paste",onExecute:()=>e.chartWidgetCollection().clipboard.uiRequestPaste(t)}}):null}function qe(e,t){
const i=e.model(),s=i.availableZOrderOperations(t),r=[new L.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder.BringToFront",options:{label:ve,statName:"BringToFront",disabled:!s.bringToFrontEnabled,onExecute:()=>i.bringToFront(t)}}),new L.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder.SendToBack",options:{label:Se,statName:"SendToBack",disabled:!s.sendToBackEnabled,onExecute:()=>i.sendToBack(t)}}),new L.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder.BringForward",options:{label:ye,statName:"BringForward",disabled:!s.bringForwardEnabled,onExecute:()=>i.bringForward(t)}}),new L.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder.SendBackward",options:{label:be,statName:"SendBackward",disabled:!s.sendBackwardEnabled,onExecute:()=>i.sendBackward(t)}})];return new L.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder",options:{label:we,iconId:"Chart.VisualOrder",statName:"VisualOrder",subItems:r}})}function $e(e,t){const i=e.model(),s=(e,s)=>{const r=x.Interval.parse(i.mainSeries().interval()),n=(0,T.getIntervalsVisibilitiesForMode)(r,e),o=[],a=[];t.forEach((e=>{const t=e.properties().intervalsVisibilities.childs();o.push(t.ticks),a.push(n.ticks),o.push(t.seconds),a.push(n.seconds),o.push(t.secondsFrom),a.push(n.secondsFrom),o.push(t.secondsTo),a.push(n.secondsTo),o.push(t.minutes),a.push(n.minutes),o.push(t.minutesFrom),a.push(n.minutesFrom),o.push(t.minutesTo),a.push(n.minutesTo),o.push(t.hours),a.push(n.hours),o.push(t.hoursFrom),a.push(n.hoursFrom),o.push(t.hoursTo),a.push(n.hoursTo),o.push(t.days),a.push(n.days),o.push(t.daysFrom),a.push(n.daysFrom),o.push(t.daysTo),a.push(n.daysTo),o.push(t.weeks),a.push(n.weeks),o.push(t.weeksFrom),a.push(n.weeksFrom),o.push(t.weeksTo),a.push(n.weeksTo),o.push(t.months),a.push(n.months),o.push(t.monthsFrom),a.push(n.monthsFrom),o.push(t.monthsTo),a.push(n.monthsTo),o.push(t.ranges),a.push(n.ranges)})),i.setProperties(o,a,s)},r=[new L.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility.CurrentAndAbove",options:{label:Pe,statName:"currentAndAboveIntervals",onExecute:()=>s(3,z)}}),new L.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility.CurrentAndBelow",options:{label:xe,statName:"currentAndBelowIntervals",onExecute:()=>s(2,U)}}),new L.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility.Current",options:{label:Te,statName:"currentInterval",onExecute:()=>s(1,j)}}),new L.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility.All",options:{label:Ie,statName:"allIntervals",onExecute:()=>s(0,G)}})];return new L.ActionWithStandardIcon({actionId:"Chart.Source.IntervalsVisibility",options:{label:Ce,statName:"IntervalsVisibility",subItems:r}})}function Ye(e,t){var i,s,r;const n=e.defaultPriceScale(),o=void 0!==t?n.coordinateToPrice(t,null!==(s=null===(i=e.mainDataSource())||void 0===i?void 0:i.firstValue())&&void 0!==s?s:0):e.model().mainSeries().lastValueData(4,!0,!0).price,a=null===(r=e.mainDataSource())||void 0===r?void 0:r.formatter();if(void 0===o||!a)return null;const l=a.format(o)
;return new L.ActionWithStandardIcon({actionId:"Chart.Clipboard.CopyPrice",options:{label:`${Ue} ${l}`,statName:"CopyPrice",onExecute:()=>(0,I.getClipboard)().writeText(l)}})}function Ke(e,t,i,s){return null}function Ze(e){const t=e.actions(),i=[t.showPriceLine];return i.push(t.showHighLowPriceLines),l.enabled("show_average_close_price_line_and_label")&&i.push(t.showAverageClosePriceLine),new L.ActionWithStandardIcon({actionId:"Chart.Lines",options:{label:Me,statName:"Lines",subItems:i}})}function Xe(e,t){return[]}class Je{constructor(e,t){this._chartWidget=e,this._options=(0,o.merge)((0,o.clone)(je),t||{})}async contextMenuActionsForSources(e,t,i){const s=e[0],r=this._options;if(s===this._chartWidget.model().mainSeries()&&r.mainSeries)return this._contextMenuActionsForSeries(s,t);if((0,p.isStudy)(s)&&r.studies)return this._contextMenuActionsForStudy(s,t);if((0,b.isLineTool)(s)&&r.lineTools){const t=e.filter(b.isLineTool);return this._contextMenuActionsForLineTool(t)}return[]}_isReadOnly(){return this._chartWidget.readOnly()}_createActionHide(e){return new L.ActionWithStandardIcon({actionId:"Chart.SelectedObject.Hide",options:{label:$,iconId:"Chart.Hide",statName:"HideSelectedObject",onExecute:this._chartWidget.hideDataSources.bind(this._chartWidget,[e])}})}_createActionShow(e){const t=new L.ActionWithStandardIcon({actionId:"Chart.SelectedObject.Show",options:{checkable:!0,label:q,iconId:"Chart.ShowObject",statName:"ToggleShow"}}),i=new h.ActionBinder(t,e.properties().visible,this._chartWidget.model(),k);return t.setBinding(i),i.setValue(e.properties().visible.value()),t}_createActionScale(e){const t=(0,r.ensureNotNull)(e.priceScale()),i=this._chartWidget.model().model(),s=(0,r.ensureNotNull)(i.paneForSource(e)),n=s.priceScalePosition(t),o=("left"===n?s.leftPriceScales():s.rightPriceScales()).indexOf(t),a=i.priceScaleSlotsCount().totallySlots<2?"dontneedname":"needname",l="overlay"===n?"":(0,d.getPriceAxisNameInfo)(n,o).label,c=le.format({label:l}),h={"left-needname":c,"left-dontneedname":he,"right-needname":c,"right-dontneedname":de,"overlay-needname":ce,"overlay-dontneedname":ce}[n+"-"+a];return new L.ActionWithStandardIcon({actionId:"Chart.Source.ChangePriceScale",options:{label:h,iconId:"Chart.PriceScale",subItems:this._createActionScaleItems(e)}})}_createActionResetInputPoints(e){const t=e.metaInfo(),s=t.inputs.filter(M.isTimeOrPriceNotHiddenInput);return 0===s.length?null:new L.ActionWithStandardIcon({actionId:"Chart.Source.ResetInputPoints",options:{label:He,onExecute:async()=>{let r;try{const n=e.properties().childs().inputs.state();for(const e of Object.keys(n))s.find((t=>t.id===e))||delete n[e];const o=new A.default({inputs:n}),a=await Promise.all([i.e(5362),i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(6),i.e(8056),i.e(5993),i.e(2191),i.e(6221),i.e(2587),i.e(2639),i.e(3502),i.e(9842),i.e(7807),i.e(3353),i.e(4215),i.e(9327),i.e(6625),i.e(7194),i.e(6884),i.e(5940),i.e(1762),i.e(962),i.e(1740),i.e(6408),i.e(750),i.e(4403),i.e(4713),i.e(7051),i.e(3030)]).then(i.bind(i,73339))
;r=(await a.selectInputValuesOnChart(this._chartWidget,s,o,t.shortDescription,t.inputs)).customSourceId,e.properties().mergeAndFire(o.state())}finally{void 0!==r&&this._chartWidget.model().model().removeCustomSource(r)}}}})}_createActionLayoutChartsSync(){return new LayoutChartsSyncContextMenuAction(this._chartWidget.linkingGroupIndex().readonly(),(e=>this._chartWidget.model().setLinkingGroupIndex(e)))}_createActionScaleDetach(e,t,i,s){const n=this._chartWidget.model().model(),o=(0,r.ensureNotNull)(n.paneForSource(e));if(!o.canCreateNewPriceScale())return null;const a=(0,r.ensureNotNull)(e.priceScale()),l=a.canDetachSource(e),c=o.priceScalePosition(a),h=l||c!==t;if(!h)return null;const u=n.priceScaleSlotsCount(),p={left:{labelled:ee,sided:oe},right:{labelled:ee,sided:ae}},_="left"===t?o.leftPriceScales().length:o.rightPriceScales().length,m=u[t]>_?"labelled":"sided",g=(0,d.getPriceAxisNameInfo)(t,_).label,f=p[t][m].format({label:g});return new L.ActionWithStandardIcon({actionId:"Chart.Source.ChangePriceScale",options:{checkable:!1,disabled:!h,label:f,statName:s,payload:e,onExecute:i}})}_onDetachLeft(e){const t=e.getPayload(),i=this._chartWidget.model().model(),s=(0,r.ensureNotNull)(i.paneForSource(t));this._chartWidget.model().detachToLeft(t,s)}_onDetachRight(e){const t=e.getPayload(),i=this._chartWidget.model().model(),s=(0,r.ensureNotNull)(i.paneForSource(t));this._chartWidget.model().detachToRight(t,s)}_createActionScaleDetachLeft(e){return this._createActionScaleDetach(e,"left",this._onDetachLeft.bind(this),"ToggleScaleLeft")}_createActionScaleDetachRight(e){return this._createActionScaleDetach(e,"right",this._onDetachRight.bind(this),"ToggleScaleRight")}_onMoveToScale(e){const t=e.getPayload();if(t.datasource.priceScale()===t.priceScale)return;const i=this._chartWidget.model().model(),s=(0,r.ensureNotNull)(i.paneForSource(t.datasource));this._chartWidget.model().moveToScale(t.datasource,s,t.priceScale,t.undoText)}_createMoveToScaleAction(e,t,i,s){const r=e.priceScale()===t;return new L.ActionWithStandardIcon({actionId:"Chart.Source.MoveToOtherScale",options:{checkable:!0,checked:r,label:i,statName:"ToggleScale",payload:{datasource:e,priceScale:t,undoText:s},onExecute:this._onMoveToScale.bind(this)}})}_onNoScale(e){const t=e.getPayload().datasource,i=this._chartWidget.model().model(),s=(0,r.ensureNotNull)(i.paneForSource(t));s.isOverlay(t)||this._chartWidget.model().detachNoScale(t,s)}_createActionNoScale(e){const t=this._chartWidget.model().model(),i=(0,r.ensureNotNull)(t.paneForSource(e)),s=i.actionNoScaleIsEnabled(e);return new L.ActionWithStandardIcon({actionId:"Chart.Source.MoveToNoScale",options:{checkable:!0,checked:i.isOverlay(e),label:ue,disabled:!s,statName:"ToggleNoScale",payload:{datasource:e},onExecute:this._onNoScale.bind(this)}})}_createActionScaleItems(e){const t=[],i=this._chartWidget.model().model(),s=(0,
r.ensureNotNull)(i.paneForSource(e)),n=i.priceScaleSlotsCount().totallySlots>1,o=s.rightPriceScales(),a=s.leftPriceScales(),l=this._createActionScaleDetachRight(e),h=this._createActionScaleDetachLeft(e),u=o.length+a.length+(null===l?0:1)+(null===h?0:1)>2,p={right:{hidden:{checked:{labelled:Y,sided:K},unchecked:{labelled:Z,sided:X}},visible:{checked:{labelled:J,sided:Q},unchecked:{labelled:ee,sided:te}}},left:{hidden:{checked:{labelled:Y,sided:ie},unchecked:{labelled:Z,sided:se}},visible:{checked:{labelled:J,sided:re},unchecked:{labelled:ee,sided:ne}}}},_={right:E,left:V},m={left:s.visibleLeftPriceScales(),right:s.visibleRightPriceScales()},g=(t,i)=>{const s=("right"===i?o:a)[t],r=m[i].includes(s)?"visible":"hidden",l=e.priceScale()===s?"checked":"unchecked",c=n?"labelled":"sided",h=p[i],u=(0,d.getPriceAxisNameInfo)(i,t).label;return{actionText:h[r][l][c].format({label:u}),undoText:n?D.format({label:u}):_[i]}};t.push(...o.map(((t,i)=>{const s=g(i,"right");return this._createMoveToScaleAction(e,t,s.actionText,s.undoText)}))),null!==l&&t.push(l);u&&(o.length>0||null!==l)&&t.push(new c.Separator);t.push(...a.map(((t,i)=>{const s=g(i,"left");return this._createMoveToScaleAction(e,t,s.actionText,s.undoText)}))),null!==h&&t.push(h);u&&(a.length>0||null!==h)&&t.push(new c.Separator);return t.push(this._createActionNoScale(e)),t}_createActionMergeUp(e){const t=this._chartWidget.model();return t.model().isMergeUpAvailableForSource(e)?new L.ActionWithStandardIcon({actionId:"Chart.Source.MergeUp",options:{label:_e,statName:"MergeUp",onExecute:()=>t.mergeSourceUp(e)}}):null}_createActionUnmergeUp(e){const t=this._chartWidget.model();return t.model().isUnmergeAvailableForSource(e)?new L.ActionWithStandardIcon({actionId:"Chart.Source.UnmergeUp",options:{label:me,statName:"UnmergeUp",onExecute:()=>t.unmergeSourceUp(e)}}):null}_createActionMergeDown(e){const t=this._chartWidget.model();return t.model().isMergeDownAvailableForSource(e)?new L.ActionWithStandardIcon({actionId:"Chart.Source.MergeDown",options:{label:ge,statName:"MergeDown",onExecute:()=>t.mergeSourceDown(e)}}):null}_createActionUnmergeDown(e){const t=this._chartWidget.model();return t.model().isUnmergeAvailableForSource(e)?new L.ActionWithStandardIcon({actionId:"Chart.Source.UnmergeDown",options:{label:fe,statName:"UnmergeDown",onExecute:()=>t.unmergeSourceDown(e)}}):null}_mergeContentMenuItems(e){return[this._createActionMergeUp(e),this._createActionUnmergeUp(e),this._createActionMergeDown(e),this._createActionUnmergeDown(e)].filter(o.notNull)}_createActionMove(e){const t=this._mergeContentMenuItems(e);return t.length>0?new L.ActionWithStandardIcon({actionId:"Chart.Source.MoveToPane",options:{label:pe,iconId:"Chart.Move",subItems:t}}):null}async _contextMenuActionsForSeries(e,t){var i;const s=[],n=e.properties().childs().visible.value(),o=this._chartWidget.model().model(),a=(0,r.ensureNotNull)(o.paneForSource(e)),h=this._chartWidget.actions(),d=t&&"localY"in t?t.localY:void 0;if(this._isReadOnly())s.push(n?this._createActionHide(e):this._createActionShow(e)),
s.push(new c.Separator),s.push(this._createActionScale(e));else{0,s.length>0&&!(s[s.length-1]instanceof c.Separator)&&s.push(new c.Separator),l.enabled("symbol_info")&&s.push(h.showSymbolInfoDialog);o.mainSeries().symbolInfo();if(s.length>0&&!(s[s.length-1]instanceof c.Separator)&&s.push(new c.Separator),!a.isEmpty()&&l.enabled("datasource_copypaste")){const e=Ye(a,d),t=Ge(this._chartWidget,a);(e||t)&&(e&&s.push(e),t&&s.push(t),s.push(new c.Separator))}s.push(qe(this._chartWidget,[e]));const t=this._createActionMove(e);null!==t&&s.push(t),s.push(this._createActionScale(e)),s.push(n?this._createActionHide(e):this._createActionShow(e)),s.push(new c.Separator);Boolean(null===(i=window.widgetbar)||void 0===i?void 0:i.widget("watchlist"))&&h.addToWatchlist&&s.push(h.addToWatchlist),l.enabled("text_notes")&&s.push(h.addToTextNotes),s[s.length-1]instanceof c.Separator||s.push(new c.Separator),l.enabled("show_chart_property_page")&&!this._chartWidget.onWidget()&&s.push(h.mainSeriesPropertiesAction),s[s.length-1]instanceof c.Separator&&s.pop()}return s}_createActionAddChildStudy(e){throw new Error("unsupported")}_createActionAddFundamentals(e){return null}_createActionShowSymbolInfoDialog(e,t){const i=this._chartWidget.model().model();return new L.ActionWithStandardIcon({actionId:"Chart.Dialogs.ShowSymbolInfo",options:{label:We,iconId:"Chart.SymbolInfo",checkable:!1,statName:"SymbolInfo",onExecute:()=>{const s={symbolInfo:e.symbolInfo(),unitDescription:e=>e?t.description(e):"",dateFormatter:i.dateFormatter()};(0,S.showSymbolInfoDialog)(s)}}})}_createActionShowProperties(e){return new L.ActionWithStandardIcon({actionId:"Chart.Indicator.ShowSettingsDialog",options:{label:Ae,iconId:"Settings",statName:"EditSelectedObject",onExecute:()=>this._chartWidget.showSourceProperties(e)}})}async _contextMenuActionsForStudy(e,t){const i=this._chartWidget.actions(),s=e.properties().childs().visible.value(),r=(t&&"localY"in t&&t.localY,[]);if(!e.userEditEnabled())return r;if(this._chartWidget.readOnly())r.push(s?this._createActionHide(e):this._createActionShow(e)),r.push(new c.Separator),(0,_.isNonSeriesStudy)(e)||r.push(this._createActionScale(e));else{0,l.enabled("study_on_study")&&e.canHaveChildren()&&r.push(this._createActionAddChildStudy(e));const t=this._createApplyToEntireLayoutCommand(e);if(null!==t&&r.push(t),r.length>0&&!(r[r.length-1]instanceof c.Separator)&&r.push(new c.Separator),l.enabled("symbol_info")&&(e instanceof v.StudyCompare||e instanceof f.study_Overlay)&&null!==e.symbolInfo()&&(r.push(this._createActionShowSymbolInfoDialog(e,this._chartWidget.model().model().availableUnits())),r.push(new c.Separator)),r.push(qe(this._chartWidget,[e])),r.push($e(this._chartWidget,[e])),!(0,_.isNonSeriesStudy)(e)){const t=this._createActionMove(e);null!==t&&r.push(t),r.push(this._createActionScale(e))}r.push(new c.Separator);const n=e.metaInfo();if(e.copiable()){const t=new L.ActionWithStandardIcon({actionId:"Chart.Clipboard.CopySource",options:{label:Le,shortcutHint:(0,g.humanReadableHash)(g.Modifiers.Mod+67),statName:"Copy",
onExecute:()=>{this._chartWidget.chartWidgetCollection().clipboard.uiRequestCopy([e])}}});r.push(t)}r.push(s?this._createActionHide(e):this._createActionShow(e)),r.push(i.studyRemove);const o=this._options.objectTree&&i.paneObjectTree,a=!1;(o||a)&&(r.push(new c.Separator),o&&r.push(i.paneObjectTree),a&&r.push(this._chartWidget.actions().showDataWindow)),r.push(new c.Separator),l.enabled("property_pages")&&new m.MetaInfoHelper(n).hasUserEditableOptions()&&r.push(this._createActionShowProperties(e)),r[r.length-1]instanceof c.Separator&&r.pop()}return r}_createLineToolTemplateAction(e){return null}_createActionToggleLockLineTools(e){const t=e[0].properties().frozen.value(),i=t?Ee:Ve;return new L.ActionWithStandardIcon({actionId:"Chart.SelectedObject.ToggleLocked",options:{label:i,statName:"ToggleLockSelectedObject",checkable:!0,iconId:t?"Chart.UnlockObject":"Chart.LockObject",onExecute:()=>{if(1===e.length)this._chartWidget.toggleLockSelectedObject();else{const i=t?H:W,s=this._chartWidget.model();s.withMacro(i,(()=>{e.forEach((e=>{s.setProperty(e.properties().frozen,!t,i)}))}))}}}})}async _contextMenuActionsForLineTool(e){const t=[],i=this._chartWidget.actions(),s=(this._chartWidget.model().model(),()=>{t.push(qe(this._chartWidget,e))}),r=()=>{t.push($e(this._chartWidget,e))},n=()=>{const i=e.filter((e=>e.cloneable()));if(i.length>0){const e=new L.ActionWithStandardIcon({actionId:"Chart.LineTool.Clone",options:{label:ke,iconId:"Chart.Clone",shortcutHint:(0,g.humanReadableModifiers)(g.Modifiers.Mod)+"Drag",statName:"Clone",onExecute:()=>this._chartWidget.model().cloneLineTools(i,!1)},id:"Clone"});t.push(e)}return!!i.length},o=()=>{const i=e.filter((e=>e.copiable()));if(i.length>0){const e=new c.Action({actionId:"Chart.Clipboard.CopyLineTools",options:{label:Le,shortcutHint:(0,g.humanReadableHash)(g.Modifiers.Mod+67),statName:"Copy",onExecute:()=>this._chartWidget.chartWidgetCollection().clipboard.uiRequestCopy(i)},id:"Copy"});t.push(e)}return!!i.length},a=()=>{const e=(this._chartWidget,[]);return t.push(...e),e.length>0},h=e=>{const i=new L.ActionWithStandardIcon({actionId:"Chart.ScrollToLineTool",options:{label:De.format({lineToolName:e.title(u.TitleDisplayTarget.StatusLine)}),statName:"GoToLineTool",checkable:!1,onExecute:async()=>this._chartWidget.model().scrollToLineTool(e)}});t.push(i)},d=e=>{const t=this._chartWidget.model().model().lineToolsGroupModel(),i=e.map((e=>t.groupForLineTool(e)));return new Set(i).size<=1};if(1===e.length){const d=e[0];if(this._chartWidget.readOnly())t.push(i.lineHide);else if(d.userEditEnabled()){0,s(),r(),this._options.objectTree&&i.paneObjectTree&&t.push(i.paneObjectTree),t.push(new c.Separator);let e=n();e=o()||e,e=a()||e,e&&t.push(new c.Separator),t.push(this._createActionToggleLockLineTools([d])),t.push(i.lineHide),t.push(i.lineRemove),d.points().length>0&&this._options.gotoLineTool&&(t.push(new c.Separator),h(d));const u=await this._chartWidget.propertiesDefinitionsForSource(d);if(l.enabled("property_pages")&&null!==u&&(t.push(new c.Separator),t.push(i.format)),
d.additionalActions){t.push(new c.Separator);const e=d.additionalActions(this._chartWidget.model());t.push(...e)}}}else this._options.objectTree&&i.paneObjectTree&&t.push(i.paneObjectTree),d(e)&&s(),r(),t.length>0&&t.push(new c.Separator),n(),o(),a(),t.push(new c.Separator),t.push(this._createActionToggleLockLineTools(e)),t.push(i.lineHide),t.push(i.lineRemove),l.enabled("property_pages")&&(t.push(new c.Separator),t.push(i.format));return t}_createEarningsShow(){return null}_createDividendsShow(){return null}_createSplitsShow(){return null}_contextMenuActionsForESD(){return[]}_contextMenuActionsForRollDates(){return[]}_contextMenuActionsForFuturesContractExpiration(){return[]}_contextMenuActionsForisLatestUpdates(){return[]}_contextMenuActionsForPublishedTimeline(e){const t=this._chartWidget.actions(),i=[];if(i.push(t.lineHide),window.is_authenticated){const t=e.properties().childs().filter,s=new c.Action({actionId:"Chart.ShowAllIdeas",options:{checked:t.value()===PublishedChartsFilter.None,checkable:!0,label:Be,name:"ToggleAllIdeas",statName:"ToggleAllIdeas",onExecute:()=>this._chartWidget.model().setProperty(t,PublishedChartsFilter.None,B)}}),r=new c.Action({actionId:"Chart.ShowIdeasOfFollowedUsers",options:{checked:t.value()===PublishedChartsFilter.Following,checkable:!0,label:Re,name:"ToggleIdeasOfPeopleAndUser",statName:"ToggleIdeasOfPeopleAndUser",onExecute:()=>this._chartWidget.model().setProperty(t,PublishedChartsFilter.Following,R)}}),n=new c.Action({actionId:"Chart.ShowMyIdeasOnly",options:{checked:t.value()===PublishedChartsFilter.Private,checkable:!0,label:Ne,name:"ToggleUserIdeas",statName:"ToggleUserIdeas",onExecute:()=>this._chartWidget.model().setProperty(t,PublishedChartsFilter.Private,N)}});i.push(new c.Separator,s,r,n)}return i}_contextMenuActionsForTradingDrawings(e){return e.contextMenuItems()}async _contextMenuActionsForAlertLabel(e,t){return[]}_contextMenuActionsForChartEvents(e){return[]}_createApplyToEntireLayoutCommand(e){if(!this._chartWidget.chartWidgetCollection().applyIndicatorsToAllChartsAvailable())return null;const t=this._chartWidget.model().model();if(e.parentSources().length>0)return null;const i=(0,r.ensureNotNull)(t.paneForSource(e)),s=t.paneForSource(t.mainSeries())===i,n=e instanceof v.StudyCompare&&e.priceScale()===t.mainSeries().priceScale()&&(0,r.ensureNotNull)(e.priceScale()).isPercentage(),o=s?void 0:t.panes().indexOf(i);let a=Fe,l=F,h="AddStudyToEntireLayout";return(0,w.isActingAsSymbolSource)(e)&&(a=Oe,l=O,h="AddSymbolToEntireLayout"),new c.Action({actionId:"Chart.AddIndicatorToAllCharts",options:{label:a,statName:h,onExecute:()=>{const i=(0,r.ensureNotNull)((0,y.clipboardDataForSources)(t.id(),[e])),a=this._chartWidget.chartWidgetCollection(),c={isOnMainPane:s,asCompare:n,paneIndex:o};a.applyIndicatorToAllCharts(this._chartWidget,i,c,l)}},id:"applyStudyToEntireLayout"})}}},88913:(e,t,i)=>{"use strict";function s(e){return e in r}i.r(t),i.d(t,{isSupportedLineTool:()=>s,supportedLineTools:()=>r});const r={cursor:{name:"cursor",onlySelectable:!0},dot:{name:"dot",
onlySelectable:!0},arrow_cursor:{name:"arrow",onlySelectable:!0},eraser:{name:"eraser",onlySelectable:!0},measure:{name:"measure",onlySelectable:!0},zoom:{name:"zoom",onlySelectable:!0},brush:{name:"LineToolBrush"},highlighter:{name:"LineToolHighlighter"},text:{name:"LineToolText"},anchored_text:{name:"LineToolTextAbsolute",isAnchored:!0},note:{name:"LineToolNote"},anchored_note:{name:"LineToolNoteAbsolute",isAnchored:!0},signpost:{name:"LineToolSignpost"},callout:{name:"LineToolCallout"},balloon:{name:"LineToolBalloon"},comment:{name:"LineToolComment"},arrow_up:{name:"LineToolArrowMarkUp"},arrow_down:{name:"LineToolArrowMarkDown"},arrow_left:{name:"LineToolArrowMarkLeft"},arrow_right:{name:"LineToolArrowMarkRight"},price_label:{name:"LineToolPriceLabel"},price_note:{name:"LineToolPriceNote"},arrow_marker:{name:"LineToolArrowMarker"},flag:{name:"LineToolFlagMark"},vertical_line:{name:"LineToolVertLine"},horizontal_line:{name:"LineToolHorzLine"},cross_line:{name:"LineToolCrossLine"},horizontal_ray:{name:"LineToolHorzRay"},trend_line:{name:"LineToolTrendLine"},info_line:{name:"LineToolInfoLine"},trend_angle:{name:"LineToolTrendAngle"},arrow:{name:"LineToolArrow"},ray:{name:"LineToolRay"},extended:{name:"LineToolExtended"},parallel_channel:{name:"LineToolParallelChannel"},disjoint_angle:{name:"LineToolDisjointAngle"},flat_bottom:{name:"LineToolFlatBottom"},anchored_vwap:{name:"LineToolAnchoredVWAP"},pitchfork:{name:"LineToolPitchfork"},schiff_pitchfork_modified:{name:"LineToolSchiffPitchfork"},schiff_pitchfork:{name:"LineToolSchiffPitchfork2"},inside_pitchfork:{name:"LineToolInsidePitchfork"},pitchfan:{name:"LineToolPitchfan"},gannbox:{name:"LineToolGannSquare"},gannbox_square:{name:"LineToolGannComplex"},gannbox_fixed:{name:"LineToolGannFixed"},gannbox_fan:{name:"LineToolGannFan"},fib_retracement:{name:"LineToolFibRetracement"},fib_trend_ext:{name:"LineToolTrendBasedFibExtension"},fib_speed_resist_fan:{name:"LineToolFibSpeedResistanceFan"},fib_timezone:{name:"LineToolFibTimeZone"},fib_trend_time:{name:"LineToolTrendBasedFibTime"},fib_circles:{name:"LineToolFibCircles"},fib_spiral:{name:"LineToolFibSpiral"},fib_speed_resist_arcs:{name:"LineToolFibSpeedResistanceArcs"},fib_wedge:{name:"LineToolFibWedge"},fib_channel:{name:"LineToolFibChannel"},xabcd_pattern:{name:"LineTool5PointsPattern"},cypher_pattern:{name:"LineToolCypherPattern"},abcd_pattern:{name:"LineToolABCD"},triangle_pattern:{name:"LineToolTrianglePattern"},"3divers_pattern":{name:"LineToolThreeDrivers"},head_and_shoulders:{name:"LineToolHeadAndShoulders"},elliott_impulse_wave:{name:"LineToolElliottImpulse"},elliott_triangle_wave:{name:"LineToolElliottTriangle"},elliott_triple_combo:{name:"LineToolElliottTripleCombo"},elliott_correction:{name:"LineToolElliottCorrection"},elliott_double_combo:{name:"LineToolElliottDoubleCombo"},cyclic_lines:{name:"LineToolCircleLines"},time_cycles:{name:"LineToolTimeCycles"},sine_line:{name:"LineToolSineLine"},long_position:{name:"LineToolRiskRewardLong"},short_position:{name:"LineToolRiskRewardShort"},forecast:{
name:"LineToolPrediction"},date_range:{name:"LineToolDateRange"},price_range:{name:"LineToolPriceRange"},date_and_price_range:{name:"LineToolDateAndPriceRange"},bars_pattern:{name:"LineToolBarsPattern"},ghost_feed:{name:"LineToolGhostFeed"},projection:{name:"LineToolProjection"},rectangle:{name:"LineToolRectangle"},rotated_rectangle:{name:"LineToolRotatedRectangle"},circle:{name:"LineToolCircle"},ellipse:{name:"LineToolEllipse"},triangle:{name:"LineToolTriangle"},polyline:{name:"LineToolPolyline"},path:{name:"LineToolPath"},curve:{name:"LineToolBezierQuadro"},double_curve:{name:"LineToolBezierCubic"},arc:{name:"LineToolArc"},icon:{name:"LineToolIcon"},emoji:{name:"LineToolEmoji"},sticker:{name:"LineToolSticker"},regression_trend:{name:"LineToolRegressionTrend"},fixed_range_volume_profile:{name:"LineToolFixedRangeVolumeProfile"}}},69618:(e,t,i)=>{"use strict";i.d(t,{clipboardDataForSources:()=>l,isLineToolClipboardData:()=>a});var s=i(50151),r=i(37591),n=i(28853),o=i(92249);function a(e){return"drawing"===e.type}function l(e,t){if(1===t.length&&(0,n.isStudy)(t[0])){const e=t[0];return{title:e.title(r.TitleDisplayTarget.StatusLine),sources:[{source:(0,s.ensureNotNull)(e.state()),type:"study"}]}}const i={sources:[],title:""};return i.sources=t.filter((e=>e.copiable()&&(0,o.isLineTool)(e))).map((t=>{const i={type:"drawing",geometry:t.geometry(),source:{...t.state(!1),points:t.normalizedPoints()},modelId:e};return delete i.source.alertId,i})),i.sources.length>0?(1===i.sources.length?i.title=t[0].title(r.TitleDisplayTarget.StatusLine):i.title="Drawings",i):null}},74359:(e,t,i)=>{"use strict";i.d(t,{addExclusionArea:()=>b,addExclusionAreaByScope:()=>y,calcTextHorizontalShift:()=>v,clearRect:()=>u,createBoundCanvas:()=>g,createDisconnectedCanvas:()=>_,disableSelection:()=>S,drawScaled:()=>p,drawWithExclusionAreaByScope:()=>w,fillRect:()=>d,getBindingPixelRatio:()=>l,getContext2D:()=>c,getPrescaledContext2D:()=>h,measureText:()=>P,tryApplySuggestedCanvasBitmapSize:()=>f});var s=i(27714),r=i(50151),n=i(31964),o=i(38223),a=i(49483);function l(e){return(0,n.getCanvasDevicePixelRatio)(e.canvasElement)}function c(e){const t=(0,r.ensureNotNull)(e.getContext("2d"));return t.setTransform(1,0,0,1,0,0),t}function h(e){const t=(0,r.ensureNotNull)(e.getContext("2d")),i=(0,n.getCanvasDevicePixelRatio)(e);return t.setTransform(i,0,0,i,0,0),t}function d(e,t,i,s,r,n){e.save(),e.translate(-.5,-.5),e.fillStyle=n,e.fillRect(t,i,s,r),e.restore()}function u(e,t,i,s,r,n){e.save(),e.translate(-.5,-.5),e.globalCompositeOperation="copy",e.fillStyle=n,e.fillRect(t,i,s,r),e.restore()}function p(e,t,i,s){e.save(),e.scale(t,i),s(),e.restore()}function _(e,t,i){const s=m(e);return void 0===i&&(i=(0,n.getCanvasDevicePixelRatio)(s)),s.width=t.width*i,s.height=t.height*i,s}function m(e){const t=e.createElement("canvas");return S(t),t}function g(e,t){const i=m((0,r.ensureNotNull)(e.ownerDocument));e.appendChild(i);const n=(0,s.bindCanvasElementBitmapSizeTo)(i,{type:"device-pixel-content-box",transform:(e,t)=>0===e.width||0===e.height?e:{
width:Math.max(e.width,t.width),height:Math.max(e.height,t.height)}});return n.resizeCanvasElement(t),n}function f(e){const t=e.suggestedBitmapSize;return null!==t&&t.width>0&&t.height>0&&(e.applySuggestedBitmapSize(),!0)}function v(e,t){return"center"===e.textAlign?0:(0,o.isRtl)()?"start"===e.textAlign||"right"===e.textAlign?t:0:"start"===e.textAlign||"left"===e.textAlign?0:t}function S(e){e.style.userSelect="none",e.style.webkitUserSelect="none",e.style.msUserSelect="none",e.style.MozUserSelect="none",e.style.webkitTapHighlightColor="transparent"}function y(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r,bitmapSize:n}=e;i.beginPath(),i.rect(0,0,n.width,n.height);for(let e=0;e{"use strict";i.d(t,{ChartChangesWatcher:()=>n,changedAll:()=>r});var s=i(57898);const r=3;class n{constructor(e,t,i){this._undoHistoryHasChanges=!1,this._changesMask=0,this._recursiveLoopingGuard=!1,this._handleMetainfoChanged=()=>{this._changesMask=1|this._changesMask},this._recalculateHaveChanges=(e,t)=>{if(!this._recursiveLoopingGuard)try{this._recursiveLoopingGuard=!0;const e=this._undoHistoryHasChanges?1:0;let i=this._lineToolsHaveChanges.value()?2:0;const s=this._changesMask;this._changesMask=e|i,s!==this._changesMask&&(this._changesMask&&(this._chartWidgetCollection.getAll().forEach((e=>{var i;null===(i=e.lineToolsSynchronizer())||void 0===i||i.markAsValidatedBecauseOfSavingToContent(!!t)})),i=this._lineToolsHaveChanges.value()?2:0,this._changesMask=e|i),this._onValueChanged.fire(0!==this._changesMask))}finally{this._recursiveLoopingGuard=!1}},this._chartWidgetCollection=e,this._undoHistory=e.undoHistory,this._lineToolsHaveChanges=e.lineToolsSynchronizerHasChanges,this._chartSaver=t,this._globalEvents=i,this._onValueChanged=new s.Delegate,this._subscribe()}destroy(){this._unsubscribe(),this._onValueChanged.destroy()}changes(){return this._changesMask}hasChanges(){return this._changesMask>0}getOnChange(){return this._onValueChanged}_subscribe(){var e;this._globalEvents.subscribe("chart_loaded",this._handleChartLoaded,this),this._globalEvents.subscribe("chart_migrated",this._handleChartMigrated,this),this._undoHistory.undoStack().onChange().subscribe(this,this._handleUndoHistoryChange),null===(e=this._chartSaver)||void 0===e||e.chartSaved().subscribe(this,this._handleChartSaved),
this._lineToolsHaveChanges.subscribe(this._recalculateHaveChanges);this._chartWidgetCollection.metaInfo.name.subscribe(this._handleMetainfoChanged)}_unsubscribe(){var e;this._globalEvents.unsubscribe("chart_loaded",this._handleChartLoaded,this),this._globalEvents.unsubscribe("chart_migrated",this._handleChartMigrated,this),this._undoHistory.undoStack().onChange().unsubscribe(this,this._handleUndoHistoryChange),null===(e=this._chartSaver)||void 0===e||e.chartSaved().unsubscribe(this,this._handleChartSaved),this._lineToolsHaveChanges.unsubscribe(this._recalculateHaveChanges);this._chartWidgetCollection.metaInfo.name.unsubscribe(this._handleMetainfoChanged)}_setUndoHistoryHasChanges(e,t){this._undoHistoryHasChanges=e,this._recalculateHaveChanges(e,t)}_handleChartLoaded(){this._setUndoHistoryHasChanges(!1)}_handleUndoHistoryChange(e){e&&!e.customFlag("doesnt_affect_save")&&this._setUndoHistoryHasChanges(!0)}_handleChartMigrated(){this._setUndoHistoryHasChanges(!0)}_handleChartSaved(e){e&&this._setUndoHistoryHasChanges(!1,!0)}}},28571:(e,t,i)=>{"use strict";i.d(t,{ChartHotkeysListener:()=>v,globalEnvironmentState:()=>f,modifierPressed:()=>g,shiftPressed:()=>m});var s,r,n,o=i(4741),a=i(68335),l=i(35749),c=i(97145),h=i(81155);const d=new c.WatchedValue(Boolean((null!==(s=o.pressedKeys.value())&&void 0!==s?s:0)&a.Modifiers.Shift)),u=new c.WatchedValue(Boolean((null!==(r=o.pressedKeys.value())&&void 0!==r?r:0)&a.Modifiers.Mod)),p=new c.WatchedValue(Boolean((null!==(n=o.pressedKeys.value())&&void 0!==n?n:0)&a.Modifiers.Alt)),_=[a.Modifiers.None,a.Modifiers.Alt,a.Modifiers.Mod,a.Modifiers.Alt+a.Modifiers.Shift];function m(){return d}function g(){return u}function f(){return new h.EnvironmentState({altKey:p.value(),ctrlKey:g().value(),metaKey:g().value(),shiftKey:m().value()})}o.pressedKeys.subscribe(((e=0)=>{d.setValue(Boolean(e&a.Modifiers.Shift)),u.setValue(Boolean(e&a.Modifiers.Mod)),p.setValue(Boolean(e&a.Modifiers.Alt))}));class v{constructor(e,t){this._pressedKeyCode=null,this._boundKeydownHandler=null,this._boundKeyupHandler=null,this._chartWidget=e,this._parent=t,this._boundKeydownHandler=this._keydownHandler.bind(this),this._boundKeyupHandler=this._keyupHandler.bind(this),this._parent.ownerDocument.addEventListener("keydown",this._boundKeydownHandler),this._parent.ownerDocument.addEventListener("keyup",this._boundKeyupHandler)}destroy(){null!==this._boundKeydownHandler&&(this._parent.ownerDocument.removeEventListener("keydown",this._boundKeydownHandler),this._boundKeydownHandler=null),null!==this._boundKeyupHandler&&(this._parent.ownerDocument.removeEventListener("keyup",this._boundKeyupHandler),this._boundKeyupHandler=null)}_keydownHandler(e){this._chartWidget.hasModel()&&window.document.activeElement===window.document.body&&this._chartWidget.isActive()&&(this._handleMoveDrawingsKeyDown(e)||this._handleScrollKeyDown(e)||this._handleZoomKeyDown(e))&&e.preventDefault()}_keyupHandler(e){this._chartWidget.hasModel()&&this._handleScrollKeyUp(e)}_handleMoveDrawingsKeyDown(e){const t=255&(0,
a.hashFromEvent)(e),i=this._chartWidget.model();switch(t){case 37:return i.moveSelectedToolsLeft();case 39:return i.moveSelectedToolsRight();case 38:return i.moveSelectedToolsUp();case 40:return i.moveSelectedToolsDown()}return!1}_handleScrollKeyDown(e){if(null!==this._pressedKeyCode)return!1;const t=(0,a.hashFromEvent)(e),i=255&t,s=(0,a.modifiersFromEvent)(e);let r;if(37===i)r=1;else{if(39!==i)return!1;r=-1}return!(a.isMacKeyboard&&s===a.Modifiers.Mod||!_.includes(s))&&(!(0,l.isNativeUIInteraction)(t,e.target)&&(this._pressedKeyCode=i,s===a.Modifiers.None?this._chartWidget.scrollHelper().moveByBar(r):s===a.Modifiers.Alt||s===a.Modifiers.Mod?this._chartWidget.scrollHelper().move(r):-1===r?this._chartWidget.model().timeScale().scrollToRealtime(!0):this._chartWidget.model().timeScale().scrollToFirstBar(),!0))}_handleScrollKeyUp(e){if(null===this._pressedKeyCode)return!1;const t=(0,a.hashFromEvent)(e);if((0,l.isNativeUIInteraction)(t,e.target))return!1;return(255&t)===this._pressedKeyCode&&(this._pressedKeyCode=null,this._chartWidget.scrollHelper().stopMove(),!0)}_handleZoomKeyDown(e){const t=(0,a.hashFromEvent)(e),i=255&t;if((0,a.modifiersFromEvent)(e)!==a.Modifiers.Mod||(0,l.isNativeUIInteraction)(t,e.target))return!1;const s=this._chartWidget.model();if(38===i)s.zoomIn();else{if(40!==i)return!1;s.zoomOut()}return!0}}},75444:(e,t,i)=>{"use strict";i.d(t,{ChartWidgetApiBase:()=>ie});var s=i(50151),r=i(11542),n=i(36298),o=i(14483),a=i(36274),l=i(45574),c=i(60156),h=i(13041);class d{constructor(e){this._timeScale=e}coordinateToTime(e){const t=this._timeScale.coordinateToIndex(e);return this._timeScale.indexToTimePoint(t)}barSpacingChanged(){return this._timeScale.barSpacingChanged()}rightOffsetChanged(){return this._timeScale.rightOffsetChanged()}setRightOffset(e){this._timeScale.setRightOffset(e)}setBarSpacing(e){this._timeScale.setBarSpacing(e)}barSpacing(){return this._timeScale.barSpacing()}rightOffset(){return this._timeScale.rightOffset()}width(){return this._timeScale.width()}defaultRightOffset(){return this._timeScale.defaultRightOffset().spawn()}defaultRightOffsetPercentage(){return this._timeScale.defaultRightOffsetPercentage().spawn()}usePercentageRightOffset(){return this._timeScale.usePercentageRightOffset().spawn()}isEmpty(){return this._timeScale.isEmpty()}scrollToFirstBar(e){this._timeScale.scrollToFirstBar(e)}scrollToRealtime(e){this._timeScale.scrollToRealtime(!1,e)}pointsCount(){return this._timeScale.points().size()}}var u=i(57898),p=i(38618);const _=new n.TranslatedString("change timezone",r.t(null,void 0,i(20505)));class m{constructor(e){this._onTimezoneChanged=new u.Delegate,this._chartWidget=e,this._timezoneProperty=e.properties().childs().timezone,this._timezoneProperty.subscribe(this,(e=>{this._onTimezoneChanged.fire(e.value())})),e.onAboutToBeDestroyed().subscribe(this,(()=>{this._timezoneProperty.unsubscribeAll(this)}),!0)}availableTimezones(){return p.availableTimezones}getTimezone(){const e=this._timezoneProperty.value();return(0,
s.ensureDefined)(this.availableTimezones().find((t=>t.id===e)))}setTimezone(e,t){(0,s.assert)((0,p.timezoneIsAvailable)(e),`Incorrect timezone: ${e}`),(null==t?void 0:t.disableUndo)?this._timezoneProperty.setValue(e):this._chartWidget.model().setProperty(this._timezoneProperty,e,_)}onTimezoneChanged(){return this._onTimezoneChanged}}class g{constructor(e,t){this._chartUndoModel=e,this._chartModel=e.model(),this._priceScale=t}getMode(){const e=this._priceScale.properties().childs();return e.percentage.value()?2:e.indexedTo100.value()?3:e.log.value()?1:0}setMode(e){this._priceScale.setMode({percentage:2===e,log:1===e,indexedTo100:3===e})}isInverted(){return this._priceScale.isInverted()}setInverted(e){this._priceScale.properties().childs().isInverted.setValue(e)}isLocked(){return this._priceScale.isLockScale()}setLocked(e){this._priceScale.setMode({lockScale:e})}isAutoScale(){return this._priceScale.isAutoScale()}setAutoScale(e){this._priceScale.setMode({autoScale:e})}getVisiblePriceRange(){return this._priceScale.priceRangeInPrice()}setVisiblePriceRange(e){this._priceScale.setPriceRangeInPrice(e),this._chartModel.lightUpdate()}hasMainSeries(){return this._priceScale.hasMainSeries()}getStudies(){return this._priceScale.getStudies().map((e=>e.id()))}currency(){const e=this._chartModel.availableCurrencies(),t=this._priceScale.currency(e);return null===t?null:{readOnly:t.readOnly,selectedCurrency:null===t.selectedCurrency?"Mixed":t.selectedCurrency,currencies:e.getItems()}}setCurrency(e){var t;const i=null===(t=this.currency())||void 0===t?void 0:t.currencies;i&&e&&!i.includes(e)?console.warn("The provided currency is not supported by your datafeed!"):this._chartUndoModel.setPriceScaleCurrency(this._priceScale,e)}unit(){const e=this._priceScale.unit(this._chartModel.availableUnits());return null===e?null:{selectedUnit:e.selectedUnit,readOnly:0===e.availableGroups.size,availableGroups:Array.from(e.availableGroups)}}setUnit(e){!e||this._chartModel.availableUnits().unitGroupById(e)?this._chartUndoModel.setPriceScaleUnit(this._priceScale,e):console.warn("The provided unit is not supported by your datafeed!")}coordinateToPrice(e){var t;const i=null===(t=this._priceScale.mainSource())||void 0===t?void 0:t.firstValue();return null==i?null:this._priceScale.coordinateToPrice(e,i)}measureUnitId(){const e=this._priceScale.measureUnitId(this._chartModel.availableUnits());return null===e?null:{selectedMeasureUnitId:e.selectedMeasureUnitId}}}var f=i(45973),v=i(1722),S=i(62591);const y=new n.TranslatedString("change pane height",r.t(null,void 0,i(87510)));class b extends S.UndoCommand{constructor(e,t,i){super(y),this._model=e,this._paneIndex=t,this._paneHeight=i,this._prevStretchFactors=this._model.panes().map((e=>e.stretchFactor()))}redo(){this._model.changePanesHeight(this._paneIndex,this._paneHeight)}undo(){const e=this._model.panes();for(let t=0;t!e.isSpeciallyZOrderedSource())).map((t=>(0,f.entityForDataSource)(e,t))).filter(v.notNull).filter((e=>null!==e.name))}getHeight(){return this._pane.height()}setHeight(e){const t=this._chartWidget.model().model(),i=t.panes();(0,s.assert)(i.length>1,"Unable to change pane's height if there is only one pane");const r=i.indexOf(this._pane);(0,s.assert)(-1!==r,"Invalid pane index");const n=new b(t,r,e);this._chartWidget.model().undoHistory().pushUndoCommand(n)}moveTo(e){const t=this.paneIndex();t!==e&&((0,s.assert)(e>=0&&e{this._study.onStatusChanged().unsubscribeAll(this),this._study.onAboutToBeDestroyed().unsubscribeAll(this)})),this._study.onStatusChanged().subscribe(this,(e=>{switch(e.type){case D.StudyStatusType.Completed:this._onStudyCompleted.fire();break;case D.StudyStatusType.Error:this._onStudyError.fire()}}))}isUserEditEnabled(){return this._study.userEditEnabled()}setUserEditEnabled(e){this._study.setUserEditEnabled(e)}getInputsInfo(){return(0,E.getStudyInputsInfo)(this._study.metaInfo())}
getInputValues(){const e=this._study.inputs({symbolsForChartApi:!1,asObject:!0});return Object.keys(e).map((t=>{const i=e[t];return{id:t,value:(0,v.isObject)(i)?i.v:i}}))}getStyleInfo(){return(0,V.getStudyStylesInfo)(this._study.metaInfo())}getStyleValues(){const{styles:e,bands:t,filledAreas:i,palettes:s,graphics:r,ohlcPlots:n,filledAreasStyle:o}=this._study.properties().state();return{styles:e,bands:t,filledAreas:i,palettes:s,graphics:r,ohlcPlots:n,filledAreasStyle:o}}setInputValues(e){const t=this.getInputValues();for(const i of e){void 0!==t.find((e=>e.id===i.id))?this._study.properties().childs().inputs.childs()[i.id].setValue(i.value):console.warn(`There is no such input: "${i.id}"`)}}mergeUp(){this._model.isMergeUpAvailableForSource(this._study)&&new I.MergeUpUndoCommand(this._model,this._study,null).redo()}mergeDown(){this._model.isMergeDownAvailableForSource(this._study)&&new I.MergeDownUndoCommand(this._model,this._study,null).redo()}unmergeUp(){this._model.isUnmergeAvailableForSource(this._study)&&new T.UnmergeUpUndoCommand(this._model,this._study,null).redo()}unmergeDown(){this._model.isUnmergeAvailableForSource(this._study)&&new T.UnmergeDownUndoCommand(this._model,this._study,null).redo()}onDataLoaded(){return this._onStudyCompleted}onStudyError(){return this._onStudyError}mergeUpWithUndo(){this._model.isMergeUpAvailableForSource(this._study)&&this._undoModel.mergeSourceUp(this._study)}mergeDownWithUndo(){this._model.isMergeDownAvailableForSource(this._study)&&this._undoModel.mergeSourceDown(this._study)}unmergeUpWithUndo(){this._model.isUnmergeAvailableForSource(this._study)&&this._undoModel.unmergeSourceUp(this._study)}unmergeDownWithUndo(){this._model.isUnmergeAvailableForSource(this._study)&&this._undoModel.unmergeSourceDown(this._study)}priceScale(){return new g(this._undoModel,(0,s.ensureNotNull)(this._study.priceScale()))}symbolSource(){const e=(0,s.ensureNotNull)(this._study.symbolSource());return{symbol:e.symbol(),currencyId:e.currency(),unitId:e.unit()}}currency(){return this._study.currency()}changePriceScale(e){const t=(0,s.ensureNotNull)(this._model.paneForSource(this._model.mainSeries())),i=(0,s.ensureNotNull)(this._model.paneForSource(this._study));switch(e){case"no-scale":(0,s.assert)(i.actionNoScaleIsEnabled(this._study),"Unable to leave a pane without any non-overlay price scale"),new M.MoveToNewPriceScaleUndoCommand(this._model,this._study,i,"overlay",null).redo();break;case"as-series":(0,s.assert)(i===t,"Study should be on the main pane"),new M.MoveToExistingPriceScaleUndoCommand(this._model,this._study,i,this._model.mainSeries().priceScale(),null).redo();break;case"new-left":new M.MoveToNewPriceScaleUndoCommand(this._model,this._study,i,"left",null).redo();break;case"new-right":new M.MoveToNewPriceScaleUndoCommand(this._model,this._study,i,"right",null).redo();break;default:const r=this._model.dataSourceForId(e);if(null===r)throw new Error(`There is no study with entityId='${e}'`);const n=i===this._model.paneForSource(r);(0,s.assert)(n,"Both studies should be on the same pane")
;const o=(0,s.ensureNotNull)(r.priceScale()),a=(0,x.sourceNewCurrencyOnPinningToPriceScale)(this._study,o,this._model),l=(0,L.sourceNewUnitOnPinningToPriceScale)(this._study,o,this._model);new M.MoveToExistingPriceScaleUndoCommand(this._model,this._study,i,o,null).redo(),null!==a&&new P.SetPriceScaleCurrencyUndoCommand(o,a,this._undoModel.chartWidget(),null).redo(),null!==l&&new k.SetPriceScaleUnitUndoCommand(o,l,this._undoModel.chartWidget(),null).redo()}}isVisible(){return this._study.properties().childs().visible.value()}setVisible(e){this._study.properties().childs().visible.setValue(e)}bringToFront(){this._model.bringToFront([this._study])}sendToBack(){this._model.sendToBack([this._study])}applyOverrides(e){(0,l.applyOverridesToStudy)(this._study,e)}dataLength(){return this._study.status().type!==D.StudyStatusType.Completed?0:this._study.metaInfo().plots.length>0?this._study.data().size():this._model.mainSeries().bars().size()}isLoading(){const e=this._study.status();return e.type===D.StudyStatusType.Undefined||e.type===D.StudyStatusType.Loading}hasPendingUnresolvedSymbols(){return this._study.hasPendingUnresolvedSymbols()}anyGraphicsReady(){return!(0,B.isStudyGraphicsEmpty)(this._study.graphics())}graphicsViewsReady(){return this._study.graphicsViewsReady()}properties(){return this._study.properties()}async applyToEntireLayout(){const e=new A.ActionsProvider(this._chartWidget),t=(await e.contextMenuActionsForSources([this._study])).find((e=>"applyStudyToEntireLayout"===e.id));t&&t.execute()}status(){return{...this._study.status()}}title(){return this._study.title(C.TitleDisplayTarget.StatusLine)}symbolsResolved(){return this._study.symbolsResolved()}}var N=i(68582);class O{constructor(e,t){this._series=e,this._undoModel=t,this._model=t.model()}isUserEditEnabled(){return this._series.userEditEnabled()}setUserEditEnabled(e){this._series.setUserEditEnabled(e)}mergeUp(){this._model.isMergeUpAvailableForSource(this._series)&&new I.MergeUpUndoCommand(this._model,this._series,null).redo()}mergeDown(){this._model.isMergeDownAvailableForSource(this._series)&&new I.MergeDownUndoCommand(this._model,this._series,null).redo()}unmergeUp(){this._model.isUnmergeAvailableForSource(this._series)&&new T.UnmergeUpUndoCommand(this._model,this._series,null).redo()}unmergeDown(){this._model.isUnmergeAvailableForSource(this._series)&&new T.UnmergeDownUndoCommand(this._model,this._series,null).redo()}detachToRight(){new M.MoveToNewPriceScaleUndoCommand(this._model,this._series,this._pane(),"right",null).redo()}detachToLeft(){new M.MoveToNewPriceScaleUndoCommand(this._model,this._series,this._pane(),"left",null).redo()}detachNoScale(){new M.MoveToNewPriceScaleUndoCommand(this._model,this._series,this._pane(),"overlay",null).redo()}changePriceScale(e){const t=(0,s.ensureNotNull)(this._model.paneForSource(this._series));switch(e){case"new-left":new M.MoveToNewPriceScaleUndoCommand(this._model,this._series,t,"left",null).redo();break;case"new-right":new M.MoveToNewPriceScaleUndoCommand(this._model,this._series,t,"right",null).redo();break
;case"no-scale":(0,s.assert)(t.actionNoScaleIsEnabled(this._series),"Unable to leave a pane without any non-overlay price scale"),new M.MoveToNewPriceScaleUndoCommand(this._model,this._series,t,"overlay",null).redo();break;default:const i=this._model.dataSourceForId(e);if(null===i)throw new Error(`There is no study with entityId='${e}'`);const r=this._model.paneForSource(i)===t;(0,s.assert)(r,"Study should be on the main pane");const n=(0,s.ensureNotNull)(i.priceScale());new M.MoveToExistingPriceScaleUndoCommand(this._model,this._series,t,n,null).redo()}}isVisible(){return this._series.properties().childs().visible.value()}setVisible(e){this._series.properties().childs().visible.setValue(e)}bringToFront(){this._model.bringToFront([this._series])}sendToBack(){this._model.sendToBack([this._series])}entityId(){return this._series.id()}chartStyleProperties(e){return this._series.properties().childs()[F(e)].state(["inputs","inputsInfo"])}setChartStyleProperties(e,t){this._series.properties().childs()[F(e)].mergeAndFire(t)}barsCount(){return this._series.bars().size()}symbolSource(){return{symbol:this._series.symbol(),currencyId:this._series.currency(),unitId:this._series.unit()}}isLoading(){return this._series.isLoading()}data(){return this._series.data()}priceScale(){return new g(this._undoModel,this._series.priceScale())}_pane(){return(0,s.ensureNotNull)(this._model.paneForSource(this._series))}}function F(e){switch(e){case 0:return"barStyle";case 1:return"candleStyle";case 2:return"lineStyle";case 14:return"lineWithMarkersStyle";case 15:return"steplineStyle";case 3:return"areaStyle";case 16:return"hlcAreaStyle";case 4:return"renkoStyle";case 5:return"kagiStyle";case 6:return"pnfStyle";case 7:return"pbStyle";case 8:return"haStyle";case 9:return"hollowCandleStyle";case 10:return"baselineStyle";case 11:return"rangeStyle";case 12:return"hiloStyle";case 13:return"columnStyle";case 17:return"volFootprintStyle";default:(0,s.ensureNever)(e)}throw new Error(`unsupported chart style: ${e}`)}var W=i(32112),H=i(95367),z=i(610);function U(e,t){const{symbolChanged:i,currencyChanged:s,unitChanged:r,styleChangeRequiresRestart:n}=e.compareSymbolParams(t);return!(i||s||r||n)}function j(e,t){e.isLoading()&&!e.isFailed()||t(e.isFailed());const i=e.seriesSource().symbolInstanceId(),s=e.dataEvents(),r=e.symbolParams(),n=()=>{s.completed().unsubscribe(null,o),(U(e,r)||e.seriesSource().symbolInstanceId()===i)&&t(!1)},o=()=>{s.error().unsubscribe(null,n),(U(e,r)||e.seriesSource().symbolInstanceId()===i)&&t(!0)};s.completed().subscribe(null,n,!0),s.error().subscribe(null,o,!0)}var G=i(21866),q=i(42856),$=i(88348),Y=i(88913),K=i(66764),Z=i(97145),X=i(77475),J=i(11014),Q=i(80842);const ee=new n.TranslatedString("change price to bar ratio",r.t(null,void 0,i(69510))),te=new n.TranslatedString("toggle lock scale",r.t(null,void 0,i(21203)));class ie{constructor(e,t){this._visibleBarsChanged=new u.Delegate,this._crosshairMoved=new u.Delegate,this._dataSourceHovered=new u.Delegate,this._ranges=null,this._panes=new WeakMap,this._studies=new WeakMap,
this._lineDataSources=new WeakMap,this._selectionApi=null,this._prevVisibleRange=null,this._prevHoveredSourceId=null,this._chartWidget=e,this._activateChart=t,this._timezoneApi=new m(e),this._chartWidget.withModel(this,(()=>{this._chartWidget.model().crossHairSource().moved().subscribe(this,this._onCrosshairMoved),this._chartWidget.model().model().hoveredSourceChanged().subscribe(this,this._onHoveredSourceChanged),this._chartWidget.model().timeScale().logicalRangeChanged().subscribe(this,this._onLogicalRangeChanged)})),this._widgetLinkingGroupIndex=e.linkingGroupIndex().spawn(),this._widgetLinkingGroupIndex.subscribe((e=>this._apiLinkingGroupIndex.setValue(e))),this._apiLinkingGroupIndex=new Z.WatchedValue(this._widgetLinkingGroupIndex.value()),this._apiLinkingGroupIndex.subscribe((e=>{this._widgetLinkingGroupIndex.value()!==e&&(this._chartWidget.hasModel()?this._chartWidget.model().setLinkingGroupIndex(e):this._widgetLinkingGroupIndex.setValue(e))})),this._chartWidget.onAboutToBeDestroyed().subscribe(this,this._destroy,!0)}setActive(){this._activateChart()}getPriceToBarRatio(){return this._chartWidget.model().model().mainSeriesScaleRatioProperty().value()}setPriceToBarRatio(e,t){const i=this._chartWidget.model(),s=i.model(),r=s.mainSeriesScaleRatioProperty();(null==t?void 0:t.disableUndo)?new z.SetScaleRatioPropertiesCommand(r,e,null,s).redo():i.setScaleRatioProperty(r,e,ee)}isPriceToBarRatioLocked(){return this._chartWidget.model().model().mainSeries().priceScale().isLockScale()}setPriceToBarRatioLocked(e,t){const i=this._chartWidget.model(),s=i.model(),r=s.mainSeries().priceScale();(null==t?void 0:t.disableUndo)?new H.SetPriceScaleModeCommand({lockScale:e},r,null,s).redo():i.setPriceScaleMode({lockScale:e},r,te)}id(){return this._chartWidget.id()}onDataLoaded(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().dataEvents().completed())}onSymbolChanged(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().dataEvents().symbolResolved())}onIntervalChanged(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().onIntervalChanged())}onVisibleRangeChanged(){return this._makeSubscriptionFromDelegate(this._visibleBarsChanged)}onChartTypeChanged(){const e=this._chartWidget.model().mainSeries().onStyleChanged();return this._makeSubscriptionFromDelegate(e)}onSeriesTimeframe(){return this._makeSubscriptionFromDelegate(this._chartWidget.model().mainSeries().dataEvents().seriesTimeFrame())}dataReady(e){const t=!this._chartWidget.hasModel()||!this._chartWidget.model().mainSeries()||this._chartWidget.model().mainSeries().data().isEmpty();return e&&(t?this.onDataLoaded().subscribe(null,e,!0):e()),!t}whenChartReady(e){this._chartWidget.withModel(this,e)}crossHairMoved(){return this._makeSubscriptionFromDelegate(this._crosshairMoved)}onHoveredSourceChanged(){return this._makeSubscriptionFromDelegate(this._dataSourceHovered)}setVisibleRange(e,t){return new Promise((i=>{this._chartWidget.setVisibleTimeRange(e.from,e.to,t,i)}))}setSymbol(e,t){(0,
v.isFunction)(t)&&(t={dataReady:t});const{dataReady:i,doNotActivateChart:s}=t||{};e===this.symbol()||this._chartWidget.hasModel()&&this._chartWidget.model().mainSeries().symbolSameAsResolved(e)?null==i||i():(s||this._activateChart(),this._chartWidget.setSymbol(e),j(this._chartWidget.model().mainSeries(),(e=>{!e&&i&&i()})))}async setResolution(e,t){(0,v.isFunction)(t)&&(t={dataReady:t});const{dataReady:i,doNotActivateChart:s}=t||{};let r=a.Interval.normalize(e);if(null!==r&&(r=this._chartWidget.model().mainSeries().getSupportedResolution(r)),null===r||r===this.resolution())return null==i||i(),!0;s||this._activateChart();const n=this._chartWidget.chartWidgetCollection().setResolution(r,void 0,this._chartWidget);return j(this._chartWidget.model().mainSeries(),(e=>{!e&&i&&i()})),n}async setChartType(e,t){if(this._chartWidget.model().mainSeries().properties().childs().style.value()===e)return null==t||t(),!0;const i=this._chartWidget.chartWidgetCollection().setChartStyleToWidget(e,this._chartWidget);return j(this._chartWidget.model().mainSeries(),(e=>{!e&&t&&t()})),i}resetData(){this._chartWidget.model().mainSeries().rerequestData()}getBarsMarksSources(){return this._chartWidget.model().barsMarksSources()}getAllStudies(){return this._chartWidget.model().model().allStudies(!0).map(f.studyEntityInfo)}getAllPanesHeight(){const e=this._chartWidget.model().model().panes();if(this._chartWidget.isMaximizedPane()){let t=0,i=0;e.forEach((e=>{t+=e.height(),i+=e.stretchFactor()}));const s=i/t;return e.map((e=>Math.round(e.stretchFactor()/s*100)/100))}return e.map((e=>e.height()))}setAllPanesHeight(e){const t=this._chartWidget.model().model(),i=t.panes();(0,s.assert)(i.length===e.length,"There`s a mismatch between the number of heights you provided and the number of panes.");const r=i.reduce(((e,t)=>e+t.stretchFactor()),0)/e.reduce(((e,t)=>e+t));e.forEach(((e,t)=>{const s=e*r;i[t].setStretchFactor(s)})),t.fullUpdate()}maximizeChart(){this._chartWidget.requestFullscreen()}isMaximized(){return this._chartWidget.inFullscreen()}restoreChart(){this._chartWidget.exitFullscreen()}sessions(){return this._chartWidget.model().model().sessions()}chartModel(){return this._chartWidget.model().model()}getTimeScaleLogicalRange(){return this._chartWidget.model().timeScale().logicalRange()}createStudy(e,t,i,s,r,n){if("function"==typeof r)return console.warn('"createStudy" does not take "callback" parameter anymore'),Promise.resolve(null);if(n=n||{},"string"!=typeof e)return this._createStudy(e);if(n.checkLimit&&!this._chartWidget.model().canCreateStudy())return(0,G.showTooManyStudiesNotice)(),Promise.resolve(null);e=e.toLowerCase();const o=n.disableUndo?this._chartWidget.model().model():this._chartWidget.model(),a=q.StudyMetaInfo.findStudyMetaInfoByDescription(o.studiesMetaData(),e),c=o.createStudyInserter({type:"java",studyId:a.id},[]);if(c.setForceOverlay(!!t),n.priceScale&&c.setPreferredPriceScale(function(e){switch(e){case"no-scale":return"overlay";case"as-series":return"as-series";case"new-left":return"left";case"new-right":return"right"
;default:throw new Error('The pricescale "'+e+'" is invalid, the only valid options are "no-scale", "as-series", "new-left" and "new-right".')}}(n.priceScale)),n.allowChangeCurrency&&c.setAllowChangeCurrency(!0),n.allowChangeUnit&&c.setAllowChangeUnit(!0),Array.isArray(s)){console.warn("Passing study inputs as an ordered array is now deprecated. Please use an object where keys correspond to the inputs of your study instead.");const e={};for(let t=0;tPromise.resolve({inputs:s||{},parentSources:[]}))).then((e=>(r&&(0,l.applyOverridesToStudy)(e,r),i&&e.setUserEditEnabled(!1),e.id())))}getStudyById(e){const t=this._chartWidget.model().model().getStudyById(e);if(null===t)throw new Error("There is no such study");return this._getStudyApi(t)}getSeries(){const e=this._chartWidget.model(),t=e.mainSeries();return new O(t,e)}getShapeById(e){const t=this._chartWidget.model().model().getLineToolById(e);if(null===t)throw new Error("There is no such shape");return this._getLineDataSourceApi(t)}removeAllShapes(){this._chartWidget.removeAllDrawingTools()}removeAllStudies(){this._chartWidget.removeAllStudies()}selection(){return null===this._selectionApi&&(this._selectionApi=new W.SelectionApi(this._chartWidget.model().model())),this._selectionApi}createStudyTemplate(e){return this._chartWidget.model().model().studyTemplate(e.saveSymbol,e.saveInterval)}applyStudyTemplate(e){this._chartWidget.model().applyStudyTemplate(e,""+1e3*Math.random())}symbol(){return this._chartWidget.symbolWV().value()}symbolExt(){const e=this._chartWidget.model().mainSeries().symbolInfo();return null===e?null:{symbol:e.name,full_name:e.full_name,exchange:e.exchange,description:e.description,type:e.type,pro_name:e.pro_name,typespecs:e.typespecs,delay:e.delay}}resolution(){return this._chartWidget.model().mainSeries().interval()}marketStatus(){return this._chartWidget.model().mainSeries().marketStatusModel().status().spawn()}getVisibleRange(){const e={from:0,to:0},t=this._chartWidget.model().timeScale(),i=t.visibleBarsStrictRange();if(null===i)return e;const r=i.firstBar(),n=i.lastBar(),o=this._convertIndexToPublicTime(n);if(null===o)return e;const a=Math.max((0,s.ensureNotNull)(t.points().range().value()).firstIndex,r);return e.from=(0,s.ensureNotNull)(this._convertIndexToPublicTime(a)),e.to=o,e}getTimezoneApi(){return this._timezoneApi}getPanes(){return this._chartWidget.model().model().panes().map((e=>this._getPaneApi(e)))}exportData(e){if(!o.enabled("charting_library_export_chart_data"))return Promise.reject("Data export is not supported");const t={...e};return void 0!==t.from&&(t.from=this._convertTimeFromPublic(t.from)),void 0!==t.to&&(t.to=this._convertTimeFromPublic(t.to)),i.e(9498).then(i.bind(i,50210)).then((e=>e.exportData(this._chartWidget.model().model(),t)))}isSelectBarRequested(){return this._chartWidget.selectPointMode().value()!==$.SelectPointMode.None}barTimeToEndOfPeriod(e){const t=this._prepareEndOfPeriodArgs();return(0,h.barTimeToEndOfPeriod)(t.barBuilder,e,t.intervalObj)}
endOfPeriodToBarTime(e){const t=this._prepareEndOfPeriodArgs();return(0,h.endOfPeriodToBarTime)(t.barBuilder,e,t.intervalObj)}createAnchoredShape(e,t){const i=t.shape;if((0,Y.isSupportedLineTool)(i)&&!0!==Y.supportedLineTools[i].isAnchored)return console.warn(`${i} is not an anchored shape. It can be created using createShape or createMultipointShape`),null;const s=this._chartWidget.model().model(),r=s.mainSeries();if(s.timeScale().isEmpty())return null;const n=void 0!==t.ownerStudyId?s.dataSourceForId(t.ownerStudyId):r,o=this._convertPositionPercentToPricedPoint(e,n);return null===o?null:this.createMultipointShape([o],t)}properties(){return this._chartWidget.properties()}setBarSpacing(e){this._chartWidget.model().timeScale().setBarSpacing(e)}scrollChartByBar(e){this._chartWidget.model().scrollChartByBar(e)}mergeAllScales(e){this._chartWidget.model().mergeAllScales(e)}chartPainted(){return this._chartWidget.chartPainted()}applyOverrides(e){this._chartWidget.applyOverrides(e)}addOverlayStudy(e,t,i){return this._chartWidget.addOverlayStudy(e,t,i)}lineToolsSynchronizer(){return this._chartWidget.lineToolsSynchronizer()}cloneLineTool(e){const t=this._chartWidget.model(),i=t.model().dataSourceForId(e);t.cloneLineTools([i],!1)}shareLineTools(e,t){const i=this._chartWidget.model(),s=e.map((e=>i.model().dataSourceForId(e)));i.shareLineTools(s,t)}linkingGroupIndex(){return this._apiLinkingGroupIndex.spawn()}loadingScreenActive(){return this._chartWidget.screen.isShown()}symbolResolvingActive(){for(const e of this._chartWidget.model().model().symbolSources())if(e.symbolResolvingActive().value())return!0;return!1}hasModel(){return this._chartWidget.hasModel()}disableAllUtilitySources(){0}ranges(){throw new Error("not implemented")}getTimeScale(){return new d(this._chartWidget.model().timeScale())}async loadChartTemplate(e){await(0,J.loadTheme)(this._chartWidget.chartWidgetCollection(),{themeName:e,standardTheme:!1,noUndo:!1,onlyActiveChart:!0})}setTimeFrame(e){this.setActive(),this._chartWidget.loadRange(e)}syncTime(e){if(this._chartWidget.hasModel()){const t=this._chartWidget.model().model(),i=t.mainSeries().syncModel();i&&t.syncTimeWithModel(i.syncSourceTarget(),e)}}syncDateRange(e,t){this._chartWidget.hasModel()&&this._chartWidget.model().model().gotoTimeRange(e,t)}getLineToolsState(e,t,i){this._canUseLineToolsSynchronizer("getLineToolsState");const r=null==i||i,n=(0,s.ensureNotNull)(this.lineToolsSynchronizer()).getDTO(e,t,r);return delete n.clientId,n}async applyLineToolsState(e){this._canUseLineToolsSynchronizer("applyLineToolsState"),await(0,s.ensureNotNull)(this.lineToolsSynchronizer()).applyDTO(e)}reloadLineToolsFromServer(){this._canUseLineToolsSynchronizer("reloadLineToolsFromServer"),(0,s.ensureNotNull)(this.lineToolsSynchronizer()).reloadAllLineTools()}_destroy(){this._chartWidget.hasModel()&&(this._chartWidget.model().crossHairSource().moved().unsubscribeAll(this),this._chartWidget.model().timeScale().logicalRangeChanged().unsubscribe(this,this._onLogicalRangeChanged)),this._widgetLinkingGroupIndex.destroy()}
_createStudy(e){return Promise.reject("Pine Script™ and java studies are not supported")}_convertTimeToPublic(e){return this._getTimeConverter().convertInternalTimeToPublicTime(e)}_convertIndexToPublicTime(e){return null===this._chartWidget.model().mainSeries().symbolInfo()?null:this._getTimeConverter().convertTimePointIndexToPublicTime(e)}_getDefaultCreateMultipointShapeOptions(){return{filled:!0}}_convertPositionPercentToPricedPoint(e,t){const i=this._chartWidget.model().timeScale(),s=t.priceScale(),r=t.firstValue();if(null==r||!isFinite(r)||null===s)return null;const n=i.coordinateToIndex(e.x*i.width()),o=i.indexToTimePoint(n);if(null===o)return null;return{price:s.coordinateToPrice(e.y*s.height(),r),time:o}}_convertUserPointsToDataSource(e){const t=this._chartWidget.model().model(),i=t.mainSeries(),r=t.timeScale().points(),n=i.data();if(t.timeScale().isEmpty())return null;const o=e.map((e=>e.time||0)),a=this._alignPoints(o),l=(e,t,o)=>{const a=r.closestIndexLeft(e)||0,l={index:a,price:NaN},c=(0,s.ensureNotNull)(r.valueAt(a)),h=(0,s.ensureNotNull)(r.range().value());if(e>c&&a===h.lastIndex){const t=(0,s.ensureNotNull)(i.syncModel()).distance(c,e);t.success&&(l.index=l.index+t.result)}else if(ee.visible()&&0!==e.title().length)).map((e=>({title:e.title(),value:e.value()})));h.entityValues[t.id()]={isHovered:s,values:r,title:i.header()}}this._crosshairMoved.fire(h)}_makeSubscriptionFromDelegate(e){return{
subscribe:e.subscribe.bind(e),unsubscribe:e.unsubscribe.bind(e),unsubscribeAll:e.unsubscribeAll.bind(e)}}_prepareEndOfPeriodArgs(){const e=this._chartWidget.model().model(),t=e.timezone(),i=(0,s.ensureNotNull)(e.mainSeries().symbolInfo()),r=e.mainSeries().interval(),n=new c.SessionInfo(t,i.session,i.session_holidays,i.corrections);return{barBuilder:(0,c.newBarBuilder)(r,n,n),intervalObj:a.Interval.parse(r)}}_getPaneApi(e){let t=this._panes.get(e);return void 0===t&&(t=new w(e,this._chartWidget),this._panes.set(e,t)),t}_getStudyApi(e){let t=this._studies.get(e);return void 0===t&&(t=new R(e,this._chartWidget),this._studies.set(e,t)),t}_getLineDataSourceApi(e){let t=this._lineDataSources.get(e);return void 0===t&&(t=new N.LineDataSourceApi(e,this._chartWidget.model(),{apiPointsToDataSource:this._convertUserPointsToDataSource.bind(this),dataSourcePointsToPriced:e=>{const t=(0,s.ensureNotNull)(this._chartWidget.model().mainSeries().syncModel()),i=this._chartWidget.model().timeScale();return e.map((e=>{const s=i.normalizeBarIndex(e.index);return{price:e.price,time:this._convertTimeToPublic(t.projectTime(s.time_t,s.offset))}}))}}),this._lineDataSources.set(e,t)),t}_alignPoints(e){const t=this._chartWidget.model().model(),i=t.mainSeries(),s=i.interval(),r=i.symbolInfo();if(t.timeScale().isEmpty()||!a.Interval.isDWM(s)||null===r)return e;const n=(0,X.createDwmAligner)(s,r);return null===n?e:e.map((e=>n.timeToSessionStart(1e3*e)/1e3))}_onLogicalRangeChanged(){const e=this._chartWidget.model().mainSeries(),t=e.data().isEmpty();if(null!==this._chartWidget.model().timeScale().visibleBarsStrictRange()&&t)return void e.dataEvents().completed().subscribe(this,this._onLogicalRangeChanged,!0);const i=this.getVisibleRange();null!==this._prevVisibleRange&&(0,v.deepEquals)(this._prevVisibleRange,i)[0]||(this._prevVisibleRange=i,this._visibleBarsChanged.fire(i))}_canUseLineToolsSynchronizer(e){if(!o.enabled("saveload_separate_drawings_storage"))throw new Error(`${e} can only be used when 'saveload_separate_drawings_storage' featureset is enabled`)}}},66764:(e,t,i)=>{"use strict";i.d(t,{getChartWidgetApiTimeConverter:()=>n});var s=i(50151),r=i(77475);function n(e,t,i){return new a(function(e,t){const i=function(e,t){return e+t.session+t.timezone+(t.corrections||"")+(t.session_holidays||"")}(e,t);let s=o.get(i);void 0===s&&(s=(0,r.createDwmAligner)(e,t),o.set(i,s));return s}(e,t),i)}const o=new Map;class a{constructor(e,t){this._dwmAligner=e,this._chartModel=t}convertPublicTimeToInternalTime(e){return null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(1e3*e)/1e3:e}convertInternalTimeToPublicTime(e){return null!==this._dwmAligner?this._dwmAligner.timeToExchangeTradingDay(1e3*e)/1e3:e}convertTimePointIndexToPublicTime(e){let t=this.convertTimePointIndexToInternalTime(e);return null!==t&&(t=this.convertInternalTimeToPublicTime(t)),t}convertTimePointIndexToInternalTime(e){const t=this._chartModel.timeScale();if(t.isEmpty())return null;const i=t.points(),{firstIndex:r,lastIndex:n}=(0,s.ensureNotNull)(i.range().value());let o=null
;if(r<=e&&e<=n)o=i.valueAt(e);else if(e>n){const i=this._chartModel.mainSeries().syncModel();if(null!==i){const r=(0,s.ensureNotNull)(t.indexToTimePoint(n));o=i.projectTime(r,e-n)}}return o}}},58487:(e,t,i)=>{"use strict";i.d(t,{ChartWidgetBase:()=>qi});var s=i(27714),r=i(50151),n=i(3343),o=i(11542),a=i(76422),l=(i(82992),i(49483)),c=i(56840),h=i(11014),d=i(51768),u=i(87095),p=i(59224),_=i(5894),m=i(53180),g=i(51608);function f(e,t){const i=Object.create(Object.getPrototypeOf(e));for(const s of t)Object.prototype.hasOwnProperty.call(e,s)&&(i[s]=e[s]);return i}var v=i(82723),S=i(90995),y=i(85067);let b;class w extends y.DialogRenderer{constructor(){super(),this._dialog=null,this._subscribe=e=>{this._setVisibility(e)}}show(){this._load().then((e=>e.show()))}hide(){var e;null===(e=this._dialog)||void 0===e||e.hide()}static getInstance(){return b||(b=new w),b}_load(){return Promise.all([i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(6),i.e(5649),i.e(8056),i.e(5993),i.e(6221),i.e(6752),i.e(8149),i.e(6106),i.e(4781),i.e(9465),i.e(6747),i.e(3780),i.e(962),i.e(1740),i.e(4062),i.e(6408),i.e(2544),i.e(5057),i.e(2052),i.e(3263),i.e(5164),i.e(4862)]).then(i.bind(i,56396)).then((e=>{var t,i;return null===(t=this._dialog)||void 0===t||t.hide(),null===(i=this._dialog)||void 0===i||i.visible().unsubscribe(this._subscribe),this._dialog=new e.ObjectTreeDialogRenderer,this._dialog.visible().subscribe(this._subscribe),this._dialog}))}}var C=i(1722),P=i(33703),x=i(88640);async function T(e,t,s,r,n,a="default"){let l,c=[];const h=e.model().model(),d=(0,C.clone)(t),u=new x.default({inputs:d}),p=function(e,t){return"symbol"===t?e.inputs.filter((t=>t.id===e.symbolInputId())):e.inputs.filter((e=>e.confirm))}(s,a),_=()=>{l&&h.removeCustomSource(l)},m=()=>{_(),n()},g=e=>{r({inputs:e,parentSources:c}),_()},f=p.filter(P.isTimeOrPriceNotHiddenInput);if(f.length>0)try{const t=await Promise.all([i.e(5362),i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(6),i.e(8056),i.e(5993),i.e(2191),i.e(6221),i.e(2587),i.e(2639),i.e(3502),i.e(9842),i.e(7807),i.e(3353),i.e(4215),i.e(9327),i.e(6625),i.e(7194),i.e(6884),i.e(5940),i.e(1762),i.e(962),i.e(1740),i.e(6408),i.e(750),i.e(4403),i.e(4713),i.e(7051),i.e(3030)]).then(i.bind(i,73339)),r=await t.selectInputValuesOnChart(e,f,u,s.shortDescription,s.inputs);if(l=r.customSourceId,r.destPane){const e=r.destPane.mainDataSource();c=e===h.mainSeries()?[]:[e]}else c=[]}catch(e){return void m()}f.length!==p.length?Promise.all([i.e(5362),i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(6),i.e(8056),i.e(5993),i.e(2191),i.e(6221),i.e(2587),i.e(2639),i.e(3502),i.e(9842),i.e(7807),i.e(3353),i.e(4215),i.e(9327),i.e(6625),i.e(7194),i.e(6884),i.e(5940),i.e(1762),i.e(962),i.e(1740),i.e(6408),i.e(750),i.e(4403),i.e(4713),i.e(7051),i.e(3030)]).then(i.bind(i,29638)).then((t=>{const r=new t.ConfirmInputsDialogRenderer(function(e){if("symbol"===e)return o.t(null,void 0,i(45743));return o.t(null,void 0,i(46689))}(a),p,u,a,s,e.model(),g,m);return r.show(),r
})):g(u.state().inputs||{})}let I=null;i(83135);var M=i(70027),A=i(58096);const L=(0,M.parseHtmlElement)(function(e=""){return``}());class k{constructor(e){this._shown=!1,this._el=L.cloneNode(!0),this.setSize(A.spinnerSizeMap[e||A.DEFAULT_SIZE])}spin(e){return this._el.classList.add("tv-spinner--shown"),void 0===this._container&&(this._container=e,void 0!==e&&e.appendChild(this._el)),this._shown=!0,this}stop(e){return e&&void 0!==this._container&&this._container.removeChild(this._el),this._el&&this._el.classList.remove("tv-spinner--shown"),this._shown=!1,this}setStyle(e){return Object.keys(e).forEach((t=>{const i=e[t];void 0!==i&&this._el.style.setProperty(t,i)})),this}style(){return this._el.style}setSize(e){const t=void 0!==e?`tv-spinner--size_${e}`:"";return this._el.className=`tv-spinner ${t} ${this._shown?"tv-spinner--shown":""}`,this}getEl(){return this._el}destroy(){this.stop(),delete this._el,delete this._container}}var D=i(78071),E=i(97906),V=i(38618),B=i(57898),R=i(14483);function N(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function O(e){return e.reduce(((e,t)=>{for(const i in t)if(N(t,i)){const s=t[i],r=e[i];r?r.push(s):e[i]=[s]}return e}),{})}var F=i(36298),W=i(97145),H=i(39347),z=i(86909),U=(i(3994),i(74359)),j=i(28571);const G=new F.TranslatedString("move left",o.t(null,void 0,i(15086))),q=new F.TranslatedString("move right",o.t(null,void 0,i(61711)));class ${constructor(e){this._chartModel=null,this._animation=null,this._chart=e,this._chart.withModel(this,(()=>{this._chartModel=this._chart.model()}))}destroy(){var e;null===(e=this._animation)||void 0===e||e.stop()}move(e){if(null!==this._chartModel){const t=this._chartModel.timeScale();if(t.isEmpty())return;const i=t.barSpacing(),s=.003/i,r=1.1/i,n=Math.round(r/s);this._moveImpl(e,((t,i,o)=>{const a=Math.min(i,n),l=e*s*Math.pow(a,2)/2;if(i<=n)return t-l;const c=Number.isFinite(o)?Math.max(0,n-o):0;return t-l-e*(i-a-c)*r-e*(r*c-s*Math.pow(c,2)/2)}),(e=>Math.max(0,n-e)+n))}}moveByBar(e){if(null!==this._chartModel){if(this._chartModel.timeScale().isEmpty())return;const t=300;this._moveImpl(e,((i,s)=>i-e*(Math.floor(Math.max(0,s-t)/100)+1)),(()=>0),!0)}}stopMove(){var e;null===(e=this._animation)||void 0===e||e.stop(),this._animation=null}scrollToRealtime(e){null!==this._chartModel&&this._chartModel.timeScale().scrollToRealtime(e)}_moveImpl(e,t,i,s){if(null===this._chartModel)return;const r=this._chartModel.timeScale();if(r.isEmpty())return;if(this._chartModel.changeTimeScale(1===e?G:q),s&&null!==r.visibleBarsStrictRange()){const e=r.indexToCoordinate(r.visibleBarsStrictRange().lastBar())+r.barSpacing()/2;Math.abs(r.width()-e)>r.barSpacing()/6&&r.setRightOffset(Math.round(r.rightOffset()))}const n=performance.now();let o=1/0;const a=r.rightOffset();this._animation={getPosition:e=>(e=Math.min(o,e),t(a,e-n,o-e)),finished:e=>e>=o,stop:()=>{const e=performance.now()-n;o=performance.now()+i(e)}},this._chartModel.model().setTimeScaleAnimation(this._animation)}}var Y=i(14787);function K(e,t,s,r,n){
return Promise.all([i.e(5362),i.e(2285),i.e(6306),i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(6),i.e(5649),i.e(8056),i.e(5993),i.e(2191),i.e(6221),i.e(2587),i.e(2639),i.e(3502),i.e(8149),i.e(9842),i.e(7807),i.e(3353),i.e(4215),i.e(6036),i.e(9327),i.e(6625),i.e(7194),i.e(6884),i.e(5940),i.e(3980),i.e(826),i.e(2486),i.e(4894),i.e(7391),i.e(7555),i.e(962),i.e(1740),i.e(750),i.e(4403),i.e(4713),i.e(7051),i.e(5664),i.e(4648),i.e(5983),i.e(6265)]).then(i.bind(i,63374)).then((i=>{const o=new(0,i.EditObjectDialogRenderer)(e,t,r,n);return o.show(s),o}))}var Z=i(28853);let X=null;var J=i(58229),Q=i(92249);const ee={[Y.TabNames.symbol]:"symbol",[Y.TabNames.legend]:"legend",[Y.TabNames.scales]:"scales",[Y.TabNames.trading]:"trading",[Y.TabNames.events]:"events",[Y.TabNames.eventsAndAlerts]:"events",[Y.TabNames.timezoneSessions]:"canvas",[Y.TabNames.text]:"text",[Y.TabNames.style]:"style",[Y.TabNames.visibility]:"visibility"},te={[Y.TabNames.style]:"style",[Y.TabNames.visibility]:"visibilities"};async function ie(e,t,s={},r,n){const o=r.activeChartWidget.value(),{initialTab:a,tabName:l}=s;if(l&&!a&&(s.initialTab=te[l]),(0,Q.isStudyLineTool)(e)&&function(e){return[J.LineToolVbPFixed,null].filter(C.notNull).some((t=>e instanceof t))}(e))return o.propertiesDefinitionsForSource(e).then((i=>null!==i?K(e,t,s,n,i):null));if((0,Z.isStudy)(e)&&function(e){const{shortId:t}=e.metaInfo();return"Overlay"===t}(e)||(0,Q.isLineTool)(e))return o.propertiesDefinitionsForSource(e).then((r=>{if(null!==r){return function(e){return Promise.all([i.e(5362),i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(6),i.e(5649),i.e(8056),i.e(5993),i.e(2191),i.e(6221),i.e(2587),i.e(2639),i.e(3502),i.e(8149),i.e(9842),i.e(7807),i.e(3353),i.e(4215),i.e(9327),i.e(6625),i.e(7194),i.e(6884),i.e(5940),i.e(3980),i.e(826),i.e(2486),i.e(7391),i.e(8904),i.e(962),i.e(1740),i.e(750),i.e(4403),i.e(4713),i.e(7051),i.e(5664),i.e(4648),i.e(5983),i.e(6780)]).then(i.bind(i,75892)).then((t=>{const i=new(0,t.SourcePropertiesEditorRenderer)(e);return null!==X&&X.hide(),i.show({shouldReturnFocus:e.shouldReturnFocus}),X=i,i}))}({propertyPages:r,model:t,source:e,activePageId:l&&ee[l],shouldReturnFocus:s.shouldReturnFocus})}return null}));if((0,Z.isStudy)(e))return K(e,t,s,n);{const e=l&&ee[l],t=r.getChartPropertiesDialogRenderer();return t.setActivePage(e),t.show(s)}}var se=i(33013),re=i(45345),ne=i(24633);async function oe(){return(await Promise.all([i.e(5866),i.e(962),i.e(139)]).then(i.bind(i,81200))).ErrorCardRenderer}var ae=i(42960);const le=(0,se.getHexColorByName)("color-cold-gray-700"),ce=(0,se.getHexColorByName)("color-cold-gray-400");class he{constructor(e){this._container=null,this._errorCardRenderer=null,this._mainSeriesErrorMessage=null,this._banErrorMessage=new W.WatchedValue(null).spawn(),this._errorMessageHandler=e=>{this._chartWidget.hasModel()?this._updatePaneWidgets(e):this._renderErrorWithoutModel(e)},this._chartWidget=e,this._subscribeToMainSeriesErrors()}destroy(){var e,t
;null===(e=this._mainSeriesErrorMessage)||void 0===e||e.destroy(),this._banErrorMessage.destroy(),null===(t=this._errorCardRenderer)||void 0===t||t.then((e=>{e.container.remove(),e.destroy()}))}updatePaneWidgets(){this._updatePaneWidgets()}setContainer(e){var t;if(this._container!==e){this._container=e,null===(t=this._errorCardRenderer)||void 0===t||t.then((e=>e.container.remove()));const i=this._getErrorMessage();i&&this._errorMessageHandler(i)}}_updatePaneWidgets(e=this._getErrorMessage()){this._chartWidget.paneWidgets().forEach((t=>t.setErrorMessage(e)))}async _renderErrorWithoutModel(e){if(null===this._container||null===e&&null===this._errorCardRenderer)return;const t=await this._getErrorCardRenderer();this._container.contains(t.container)||this._container.appendChild(t.container),t.update(this._createErrorCardRendererState(e))}async _getErrorCardRenderer(){return this._errorCardRenderer||(this._errorCardRenderer=this._createErrorCardRenderer())}async _createErrorCardRenderer(){return new(await oe())}_createErrorCardRendererState(e){return e?{message:e.message,icon:e.icon,textColor:re.watchedTheme.value()===ne.StdTheme.Dark?ce:le,backgroundColor:re.watchedTheme.value()===ne.StdTheme.Dark?"#131722":"#FFF",solutionId:e.solutionId}:{message:null}}_subscribeToMainSeriesErrors(){const e=this._chartWidget;e.withModel(this,(()=>{const t=e.model().model().mainSeries();this._mainSeriesErrorMessage=(0,E.combine)(((e,t)=>{if(e)return e;switch(t){case"invalid_symbol":return{message:o.t(null,void 0,i(32619)),icon:"ghost"};case"no_data":return{message:o.t(null,void 0,i(95222)),icon:"ghost"};case null:return null}}),this._banErrorMessage.weakReference(),(0,ae.getSeriesDisplayErrorWV)(t).ownership()),this._mainSeriesErrorMessage.subscribe(this._errorMessageHandler,{callWithLast:!0})}))}_getErrorMessage(){var e;return this._banErrorMessage.value()||(null===(e=this._mainSeriesErrorMessage)||void 0===e?void 0:e.value())||null}}var de=i(31964),ue=i(91280),pe=i(38325),_e=i(75531),me=i(93613),ge=i(1803),fe=i(54355);class ve{constructor(e,t){this._showed=!1,this._cw=e,this._element=document.createElement("div"),this._element.classList.add(fe.screen),t.appendChild(this._element),this._cw.withModel(this,this._connectToModel)}show(e){if(e){const e=this._cw.model().mainSeries().status();if(1!==e&&2!==e)return}this._cw.setInLoadingState(!0),this._showed||(this._showed=!0,this._show())}hide(){this._cw.setInLoadingState(!1),this._showed&&this._hide()}isShown(){return this._showed}_connectToModel(){const e=this._cw.model().mainSeries().dataEvents();e.symbolError().subscribe(this,(e=>{e!==ge.permissionDenied&&this.hide()})),e.seriesError().subscribe(this,(()=>{(0,R.enabled)("hide_loading_screen_on_series_error")&&this.hide()})),e.completed().subscribe(this,this.hide)}_show(){const e=this._cw.properties().childs().paneProperties.childs();let t;if(e.backgroundType.value()===me.ColorType.Solid)t=e.background.value();else{t=`linear-gradient(${e.backgroundGradientStartColor.value()},${e.backgroundGradientEndColor.value()})`}
this._element.style.background=t,this._element.classList.add(fe.fade)}_hide(){this._showed=!1,this._element.classList.remove(fe.fade)}}function Se(e,t){let{deltaX:i,deltaY:s}=e;switch(i/=100,s/=100,t.deltaMode){case t.DOM_DELTA_PAGE:i*=120,s*=120;break;case t.DOM_DELTA_LINE:i*=32,s*=32}return{deltaX:i,deltaY:s}}class ye{constructor(){this._totalDeltaX=0,this._totalDeltaY=0,this._prevWheelTime=0}processWheel(e){e.timeStamp-this._prevWheelTime>100&&this._reset(),this._totalDeltaX+=e.deltaX,this._totalDeltaY+=e.deltaY,this._prevWheelTime=e.timeStamp;const t={deltaX:e.deltaX,deltaY:e.deltaY};return 0===this._totalDeltaX||0===this._totalDeltaY||(Math.abs(this._totalDeltaX)>=Math.abs(3*this._totalDeltaY)&&(t.deltaY=0),Math.abs(this._totalDeltaY)>=Math.abs(3*this._totalDeltaX)&&(t.deltaX=0)),Se(t,e)}_reset(){this._totalDeltaX=0,this._totalDeltaY=0}}var be=i(24377),we=i(37160),Ce=i(42184),Pe=i(16838),xe=i(30383);class Te{constructor(e,t,i){this._handleEl=null,this._resizeInfo=null,this._colorCache={lineColor:"",backgroundColor:"",color:""},this._chart=e,this._topPaneIndex=t,this._bottomPaneIndex=i,this._element=document.createElement("div"),this._element.classList.add(xe.paneSeparator),this._element.style.background=this._color(),this.adjustSize(),this._element.addEventListener("click",(()=>{}));const s=document.createElement("div");s.classList.add(xe.handle),this._element.appendChild(s),this._mouseEventHandler=new Ce.MouseEventHandler(s,this,{treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!0}),this._handleEl=s,Pe.PLATFORM_ACCESSIBILITY_ENABLED&&this._element.setAttribute("aria-hidden","true")}destroy(){this._mouseEventHandler.destroy(),this._element.parentElement&&this._element.parentElement.removeChild(this._element)}getElement(){return this._element}hide(){this._element.classList.add("js-hidden")}show(){this._element.classList.remove("js-hidden")}adjustSize(){this._element.style.height=Te.height()+"px"}mouseEnterEvent(e){const{topPane:t,bottomPane:i}=this._topBottomPane(!0);null!==t&&null!==i&&(0,r.ensureNotNull)(this._handleEl).classList.add(xe.hovered)}mouseLeaveEvent(e){(0,r.ensureNotNull)(this._handleEl).classList.remove(xe.hovered)}mouseDownEvent(e){this._mouseDownOrTouchStartEvent(e)}touchStartEvent(e){this._mouseDownOrTouchStartEvent(e)}pressedMouseMoveEvent(e){this._pressedMouseOrTouchMoveEvent(e)}touchMoveEvent(e){this._pressedMouseOrTouchMoveEvent(e)}mouseUpEvent(e){this._mouseUpOrTouchEndEvent(e)}touchEndEvent(e){this._mouseUpOrTouchEndEvent(e)}update(){this._element.style.background=this._color().toString()}paint(){}image(){const{topPane:e}=this._topBottomPane(!1),t=e.leftPriceAxisesContainer().getWidth(),i=e.width(),r=e.rightPriceAxisesContainer().getWidth(),n=this._color(),o=(0,U.createDisconnectedCanvas)(document,(0,s.size)({width:t,height:1})),a=(0,U.getPrescaledContext2D)(o);a.fillStyle=n,a.fillRect(0,0,t,1);const l=(0,U.createDisconnectedCanvas)(document,(0,s.size)({width:i,height:1})),c=(0,U.getPrescaledContext2D)(l);c.fillStyle=n,c.fillRect(0,0,i,1);const h=(0,
U.createDisconnectedCanvas)(document,(0,s.size)({width:r,height:1})),d=(0,U.getPrescaledContext2D)(h);return d.fillStyle=n,d.fillRect(0,0,r,1),{type:"separator",leftAxis:{content:o.toDataURL(),canvas:o,contentWidth:t,contentHeight:1},rightAxis:{content:h.toDataURL(),canvas:h,contentWidth:r,contentHeight:1},content:l.toDataURL(),canvas:l,contentWidth:i,contentHeight:1}}static height(){const e=window.devicePixelRatio||1;return e>=1?1:1/e}_mouseDownOrTouchStartEvent(e){const{topPane:t,bottomPane:i}=this._topBottomPane(!0);if(null===t||null===i)return;const s=t.state().stretchFactor()+i.state().stretchFactor(),n=s/(t.height()+i.height()),o=30*n;s<=2*o||(this._resizeInfo={startY:e.pageY,prevStretchTopPane:t.state().stretchFactor(),maxPaneStretch:s-o,totalStretch:s,pixelStretchFactor:n,minPaneStretch:o},(0,r.ensureNotNull)(this._handleEl).classList.add(xe.active))}_pressedMouseOrTouchMoveEvent(e){const{topPane:t,bottomPane:i}=this._topBottomPane(!0),s=this._resizeInfo;if(null===s||null===t||null===i)return;const r=(e.pageY-s.startY)*s.pixelStretchFactor,n=(0,we.clamp)(s.prevStretchTopPane+r,s.minPaneStretch,s.maxPaneStretch);t.state().setStretchFactor(n),i.state().setStretchFactor(s.totalStretch-n),this._chart.model().model().fullUpdate()}_mouseUpOrTouchEndEvent(e){const{topPane:t,bottomPane:i}=this._topBottomPane(!0),s=this._resizeInfo;null!==s&&null!==t&&null!==i&&(this._chart.model().addPaneStretchFactorUndoCommand(t.state(),i.state(),s.prevStretchTopPane,t.state().stretchFactor()),this._resizeInfo=null,(0,r.ensureNotNull)(this._handleEl).classList.remove(xe.active))}_color(){const e=this._chart.properties().childs().paneProperties.childs().separatorColor.value(),t=this._chart.model().model().backgroundColor().value();if(this._colorCache.lineColor!==e||this._colorCache.backgroundColor!==t){const i=(0,be.parseRgba)(t),s=(0,be.parseRgba)(e),r=0===i[3]&&0===s[3]?"rgba(0,0,0,0)":(0,be.rgbaToString)((0,be.blendRgba)(i,s));this._colorCache={lineColor:e,backgroundColor:t,color:r}}return this._colorCache.color}_topBottomPane(e){const t=this._chart.paneWidgets();let i=null,s=null;for(let s=this._topPaneIndex;s>=0;--s){const r=t[s];if(!e||!r.state().collapsed().value()){i=r;break}}for(let i=this._bottomPaneIndex;i.1&&(this._currentScale=i,Math.abs(this._currentScale-1)>.1?this._element.style.transform=`scale(${this._currentScale})`:(this._currentScale=1,this._element.style.transform=""))}drawLabelForScreenshot(e,t){if(null===this._info||"gear"===this._mode)return;const i=(0,Oe.makeFont)(t.fontSize,He.CHART_FONT_FAMILY);e.fillStyle=h.themes[t.theme].getThemedColor("color-price-axis-label-back"),e.globalAlpha=.5,e.beginPath();const s=je(t.fontSize)*ze/2,r=(0,Ae.point)(t.offset+t.width/2,t.height/2);e.arc(r.x,r.y,s,0,2*Math.PI,!0),e.fill(),e.globalAlpha=1,e.fillStyle=h.themes[t.theme].getThemedColor("color-price-axis-label-text"),e.textAlign="center",e.font=i,e.textBaseline="middle",e.fillText(this._info.label,r.x,r.y)}setAxisNameInfo(e){this._info=e,null!==e&&(this._labelElement.textContent=e.label)}static height(e){return(ze+Ue)*e}}var qe=i(10643),$e=i(94194);const Ye={enableTooltip:!0,showLabels:!0,enableMenu:!0,enableHighlight:!0};class Ke{constructor(e,t,i,r,n,o=null){this._invalidated=!0,this._size=(0,s.size)({width:0,height:0}),this._offset=0,this._axisInfo=null,this._onLabelHovered=new B.Delegate,this._highlighted=!1,this._labelMode="auto",this._fixedLabelMode=null,this._canvasConfiguredHandler=()=>this.update(),this._timeAxisWidget=o,this._isLeft="left"===e,this._rendererOptionsProvider=r.rendererOptionsProvider,this._sourcesTitlesProvider=r.sourcesTitlesProvider,this._contextMenuItemsProvider=r.contextMenuItemsProvider,this._backgroundBasedTheme=r.backgroundBasedTheme,this._getBackgroundTopColor=r.getBackgroundTopColor,this._getBackgroundBottomColor=r.getBackgroundBottomColor,this._showHorizontalBorder=Boolean(r.showHorizontalBorder),this._properties=t,this._axisInfo=i,this._labelOptions={...Ye,...n},this._properties.lineColor.subscribe(this,this._onPropertyChanged),this._cell=document.createElement("div"),this._cell.classList.add(We["price-axis-stub"]),this._labelOptions.enableTooltip&&this._cell.classList.add("apply-common-tooltip"),this._cell.style.width="25px",this._cell.style.height="100%",this._cell.style.position="absolute",this._cell.style.left="0",this._cell.style.overflow="hidden",this._labelOptions.showLabels?(this._label=new Ge,this._label.setAxisNameInfo(this._axisInfo),this._cell.appendChild(this._label.getElement()),this._labelOptions.enableTooltip&&(0,$e.setTooltipData)(this._cell,"text",(e=>this._tooltipContent()))):this._label=null,this._mouseEventHandler=new Ce.MouseEventHandler(this._cell,this,{treatHorzTouchDragAsPageScroll:!0,treatVertTouchDragAsPageScroll:!0}),this._canvasBinding=(0,U.createBoundCanvas)(this._cell,(0,s.size)({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler)
;const a=this._canvasBinding.canvasElement;a.style.position="absolute",a.style.left="0",a.style.top="0",Pe.PLATFORM_ACCESSIBILITY_ENABLED&&this._cell.setAttribute("aria-hidden","true")}destroy(){this._canvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler),this._canvasBinding.dispose(),this._properties.lineColor.unsubscribe(this,this._onPropertyChanged),this._mouseEventHandler.destroy()}mouseEnterEvent(e){this._mouseOrTouchEnterEvent(e)}touchStartEvent(e){this._mouseOrTouchEnterEvent(e)}mouseLeaveEvent(e){this._mouseOrTouchLeaveEvent(e)}touchEndEvent(e){this._mouseOrTouchLeaveEvent(e)}mouseClickEvent(e){this._mouseClickOrTapEvent(e)}tapEvent(e){this._mouseClickOrTapEvent(e)}update(){}getElement(){return this._cell}onLabelHovered(){return this._onLabelHovered}setSizeAndOffset(e,t){(0,s.equalSizes)(this._size,e)||(this._size=e,this._canvasBinding.resizeCanvasElement(e),this._cell.style.width=`${e.width}px`,this._cell.style.minWidth=`${e.width}px`,this._cell.style.height=`${e.height}px`,this._invalidated=!0),this._offset!==t&&(this._offset=t,this._cell.style.left=`${t}px`)}paint(e){if(e{this.setLabelMode((0,r.ensureNotNull)(this._fixedLabelMode)),this._fixedLabelMode=null}))}}var Ze=i(10688);class Xe{constructor(e,t,i,r,n,o=null){this._axises=[],this._stubs=[],this._size=(0,s.size)({width:0,height:0}),this._onLabelHovered=new B.Delegate,this._scalesProperties=e,this._priceAxisWidgetFactory=i,this._timeAxisWidget=o,this._rendererOptionsProvider=r.rendererOptionsProvider,this._titlesProvider=r.titlesProvider,this._stubContextMenuProvider=r.stubContextMenuProvider,this._backgroundBasedTheme=r.backgroundBasedTheme,this._getBackgroundTopColor=r.getBackgroundTopColor,this._getBackgroundBottomColor=r.getBackgroundBottomColor,this._showHorisontalBorder=Boolean(r.showHorizontalBorder),this._labelsOptions={...Ye,...n};const a=this._scalesProperties.childs();this._stubProperties={lineColor:a.lineColor,fontSize:a.fontSize},this._side=t,this._cell=document.createElement("div"),this._cell.classList.add("chart-markup-table","price-axis-container"),this._cell.style.width="25px",this._cell.style.position="relative"}destroy(){this.setScales([],0,0,0)}onLabelHovered(){return this._onLabelHovered}setScales(e,t,i,s){for(;e.length>this._axises.length&&this._axises.lengtho;){const e=(0,r.ensureDefined)(this._stubs.pop());e.onLabelHovered().unsubscribeAll(this),this._cell.removeChild(e.getElement()),e.destroy()}for(;this._stubs.length{this._labelsOptions.showLabels&&this._labelsOptions.enableHighlight&&this._onLabelHovered.fire({owner:t,axis:(0,r.ensureNotNull)(e)},i)})),this._stubs.push(t),this._cell.appendChild(t.getElement())}const a=this._labelsOptions.enableMenu;1===s?this._stubs.forEach(((e,t)=>e.setLabelMode(a?"gear":"symbol"))):this._stubs.forEach(((e,t)=>e.setLabelMode(te.updateCurrencyLabel()))}optimalWidths(){return this._axises.map((e=>e.optimalWidth()))}setSizes(e,t){this._size=(0,s.size)({width:t.reduce(((e,t)=>e+t),0),height:e}),this._cell.style.width=this._size.width+"px",this._cell.style.minWidth=this._size.width+"px",this._cell.style.height=this._size.height+"px",t.length!==this._axises.length+this._stubs.length&&(0,r.assert)(t.length===this._axises.length+this._stubs.length,"Widgets count should be the same as widths one");let i=0;this._forEachWidgetFromLeft(((r,n)=>{const o=t[n];r.setSizeAndOffset((0,s.size)({width:o,height:e}),i),i+=o}))}update(){this._axises.forEach((e=>e.update())),this._stubs.forEach((e=>e.update()))}paint(e){this._axises.forEach(((t,i)=>t.paint(e(i)))),this._stubs.forEach(((t,i)=>t.paint(e(i))))}paintStubs(e){this._stubs.forEach((t=>t.paint(e)))}restoreDefaultCursor(){this._axises.forEach((e=>e.restoreDefaultCursor()))}getWidth(){return this._size.width}findAxisWidgetForScale(e){const t=this._axises.find((t=>t.priceScale()===e));return void 0===t?null:t}getScreenshotData(){const e=this._getImage();return{canvas:e,content:e.toDataURL(),contentHeight:this._size.height,contentWidth:this._size.width}}getImage(){return this._getImage()}slotsCount(){return this._axises.length+this._stubs.length}highlightPriceAxisByLabel(e){this._axises.forEach((t=>{const i=t.axisInfo();t.setHighlighted(null!==i&&i.equals(e))}))}axes(){return this._axises}_stubParams(e){return{rendererOptionsProvider:this._rendererOptionsProvider,backgroundBasedTheme:this._backgroundBasedTheme,sourcesTitlesProvider:()=>this._titlesProvider(this._side,e),contextMenuItemsProvider:()=>this._stubContextMenuProvider(this._side,e),getBackgroundTopColor:this._getBackgroundTopColor,getBackgroundBottomColor:this._getBackgroundBottomColor,showHorizontalBorder:this._showHorisontalBorder}}_getImage(){const e=(0,
U.createDisconnectedCanvas)(document,this._size),t=(0,U.getPrescaledContext2D)(e);let i=0;return this._forEachWidgetFromLeft(((e,s)=>{const r=e.getWidth();0!==r&&0!==this._size.height&&(t.drawImage(e.getImage(),i,0,r,this._size.height),i+=r)})),e}_forEachWidgetFromLeft(e){const t=[...this._axises,...this._stubs],i="left"===this._side,s=i?-1:t.length,r=i?-1:1;for(let n=i?t.length-1:0;n!==s;n+=r)e(t[n],n,t)}}var Je=i(34565),Qe=i(55824),et=i(60682);class tt{constructor(){this._width=null,this._labelBottom=null,this._currencyInfo=null,this._unitInfo=null,this._measureUnitIdInfo=null,this._fontSize=0,this._currencyAndUnitLabelsWrapper=document.createElement("div"),this._currencyAndUnitLabelsWrapper.className=et["price-axis-currency-label-wrapper"],this._currencyAndUnitLabelsWrapper.setAttribute("data-name","currency-unit-label-wrapper"),this._controlsContainer=document.createElement("div"),this._controlsContainer.className=et["price-axis-currency-label"],this._currencyAndUnitLabelsWrapper.appendChild(this._controlsContainer),this._currencyLabelDiv=document.createElement("div"),this._currencyLabelDiv.className=et.row,this._currencyLabelDiv.classList.add("apply-common-tooltip"),(0,$e.setTooltipData)(this._currencyLabelDiv,"text",(e=>this._currencyTooltipContent())),this._currencyText=document.createElement("div"),this._currencyText.className=et["price-axis-currency-label-text"],this._currencyLabelDiv.appendChild(this._currencyText),this._currencyArrowDown=document.createElement("div"),this._currencyArrowDown.className=et["price-axis-currency-label-arrow-down"],this._currencyArrowDown.innerHTML=Qe,this._currencyLabelDiv.appendChild(this._currencyArrowDown),this._measureUnitIdLabelDiv=document.createElement("div"),this._measureUnitIdLabelDiv.className=et.row,this._measureUnitIdLabelDiv.classList.add("apply-common-tooltip"),this._measureUnitIdLabelDiv.classList.add("readonly"),(0,$e.setTooltipData)(this._measureUnitIdLabelDiv,"text",(e=>this._measureUnitIdTooltipContent())),this._measureUnitIdText=document.createElement("div"),this._measureUnitIdText.className=et["price-axis-currency-label-text"],this._measureUnitIdLabelDiv.appendChild(this._measureUnitIdText),this._unitLabelDiv=document.createElement("div"),this._unitLabelDiv.className=et.row,this._unitLabelDiv.classList.add("apply-common-tooltip"),(0,$e.setTooltipData)(this._unitLabelDiv,"text",(e=>this._unitTooltipContent())),this._unitText=document.createElement("div"),this._unitText.className=et["price-axis-currency-label-text"],this._unitLabelDiv.appendChild(this._unitText),this._unitArrowDown=document.createElement("div"),this._unitArrowDown.className=et["price-axis-currency-label-arrow-down"],this._unitArrowDown.innerHTML=Qe,this._unitLabelDiv.appendChild(this._unitArrowDown),this._controlsContainer.appendChild(this._currencyLabelDiv),this._controlsContainer.appendChild(this._measureUnitIdLabelDiv),this._controlsContainer.appendChild(this._unitLabelDiv),this.disableCurrency(),this.disableUnit()}element(){return this._currencyAndUnitLabelsWrapper}currencyLabelElement(){
return this._currencyLabelDiv}unitLabelElement(){return this._unitLabelDiv}isEnabled(){return this.currencyLabelEnabled()||this.unitLabelEnabled()||this.measureUnitIdLableEnabled()}isHidden(){return this._currencyAndUnitLabelsWrapper.classList.contains(et.hidden)}setCurrencyExpanded(e){this._currencyLabelDiv.classList.toggle(et.expanded,e)}setUnitExpanded(e){this._unitLabelDiv.classList.toggle(et.expanded,e)}width(){if(null!==this._width)return this._width;let e=0;if(this.currencyLabelEnabled()){const t=this._currencyText.getBoundingClientRect(),i=this._currencyArrowDown.getBoundingClientRect();e=Math.max(e,t.width+i.width+2*this._textMarginAndPadding())}if(this.measureUnitIdLableEnabled()){const t=this._measureUnitIdText.getBoundingClientRect();e=Math.max(e,t.width+2*this._textMarginAndPadding())}if(this.unitLabelEnabled()){const t=this._unitText.getBoundingClientRect(),i=this._unitArrowDown.getBoundingClientRect();e=Math.max(e,t.width+i.width+2*this._textMarginAndPadding())}return this._width=e}drawLabel(e,t,i){var s,r,n;if(!this.isEnabled())return;const o=Math.round(Number(et.css_wrapper_margin)*i),a=(0,we.ceiledEven)(t*i)-2*o,l=Math.round(this.labelBottom()*i),c=l-2*o,h=Math.round(Number(et.css_value_currency_label_radius)*i);e.fillStyle=getComputedStyle(this._currencyAndUnitLabelsWrapper).backgroundColor,e.fillRect(0,0,Math.ceil(t*i),l);const d=[];d.push(this.currencyLabelEnabled()&&null!==(s=this._currencyText.textContent)&&void 0!==s?s:""),d.push(this.measureUnitIdLableEnabled()&&null!==(r=this._measureUnitIdText.textContent)&&void 0!==r?r:""),d.push(this.unitLabelEnabled()&&null!==(n=this._unitText.textContent)&&void 0!==n?n:""),e.font=(0,Oe.makeFont)(this._fontSize,He.CHART_FONT_FAMILY);const u=new Je.TextWidthCache;let p=0;const _=[];d.forEach((t=>{let i=0;""!==t&&(i=u.yMidCorrection(e,t),p++),_.push(i)}));const m=c/p;e.beginPath();const g=getComputedStyle(this._controlsContainer);e.fillStyle=g.backgroundColor,e.strokeStyle=g.borderColor,(0,Ne.drawRoundRect)(e,o,o,a,c,h),e.fill(),e.stroke(),e.fillStyle=getComputedStyle(this._currencyLabelDiv).color,e.textBaseline="middle",e.textAlign="left";const f=Math.round(this._textMarginAndPadding()*i)+o,v=m/2;let S=o+v;d.forEach(((t,s)=>{""!==t&&((0,U.drawScaled)(e,i,i,(()=>{e.fillText(t,f/i,(S+_[s])/i)})),S=Math.ceil(S+2*v))}))}setHidden(e){this._currencyAndUnitLabelsWrapper.classList.toggle(et.hidden,e)}enableCurrency(){this._currencyLabelDiv.classList.remove("js-hidden"),this._resetSizesAndVisibility()}disableCurrency(){this._currencyLabelDiv.classList.add("js-hidden"),this._resetSizesAndVisibility()}enableUnit(){this._unitLabelDiv.classList.remove("js-hidden"),this._resetSizesAndVisibility()}disableUnit(){this._unitLabelDiv.classList.add("js-hidden"),this._resetSizesAndVisibility()}enableMeasureUnitId(){this._measureUnitIdLabelDiv.classList.remove("js-hidden"),this._resetSizesAndVisibility()}disableMeasureUnitId(){this._measureUnitIdLabelDiv.classList.add("js-hidden"),this._resetSizesAndVisibility()}currencyLabelEnabled(){
return!this._currencyLabelDiv.classList.contains("js-hidden")}unitLabelEnabled(){return!this._unitLabelDiv.classList.contains("js-hidden")}measureUnitIdLableEnabled(){return!this._measureUnitIdLabelDiv.classList.contains("js-hidden")}currencyConversionAvailable(){return!this._currencyLabelDiv.classList.contains("readonly")}unitConversionAvailable(){return!this._unitLabelDiv.classList.contains("readonly")}setCurrencyInfo(e){if(this._currencyInfo===e)return!1;this._currencyInfo=e;const t=null===e.selectedCurrency?o.t(null,void 0,i(95093)):(0,r.ensureDefined)(e.displayedValues.get(e.selectedCurrency));return this._currencyText.textContent!==t&&(this._currencyText.textContent=t,this._width=null),this._currencyArrowDown.classList.contains("js-hidden")!==e.readOnly&&(this._currencyArrowDown.classList.toggle("js-hidden",e.readOnly),this._currencyLabelDiv.classList.toggle("readonly",e.readOnly),this._width=null),!0}setUnitInfo(e){if(null!==this._unitInfo&&this._unitInfo.selectedUnit===e.selectedUnit&&0===this._unitInfo.availableGroups.size==(0===e.availableGroups.size)&&this._unitInfo.originalUnits.size===e.originalUnits.size)return this._unitInfo=e,!1;this._unitInfo=e;const t=null===e.selectedUnit?o.t(null,void 0,i(95093)):(0,r.ensureDefined)(e.names.get(e.selectedUnit));return this._unitText.textContent!==t&&(this._unitText.textContent=t,this._width=null),this._unitArrowDown.classList.contains("js-hidden")!==(0===e.availableGroups.size)&&(this._unitArrowDown.classList.toggle("js-hidden",0===e.availableGroups.size),this._unitLabelDiv.classList.toggle("readonly",0===e.availableGroups.size),this._width=null),!0}setMeasureUnitIdInfo(e){if(this._measureUnitIdInfo===e)return!1;this._measureUnitIdInfo=e;const t=null===e.selectedMeasureUnitId?o.t(null,void 0,i(95093)):(0,r.ensureDefined)(e.names.get(e.selectedMeasureUnitId));return this._measureUnitIdText.textContent!==t&&(this._measureUnitIdText.textContent=t,this._width=null),this._measureUnitIdLabelDiv.classList.contains("js-hidden")!==(0===e.names.size)&&(this._measureUnitIdLabelDiv.classList.toggle("js-hidden",0===e.names.size),this._width=null),!0}currencyInfo(){return this._currencyInfo}unitInfo(){return this._unitInfo}measureUnitIdInfo(){return this._measureUnitIdInfo}setFontSize(e){this._fontSize!==e&&(this._fontSize=e,this._currencyLabelDiv.style.fontSize=e+"px",this._measureUnitIdLabelDiv.style.fontSize=e+"px",this._unitLabelDiv.style.fontSize=e+"px",this._width=null,this._labelBottom=null)}labelBottom(){if(null!==this._labelBottom)return this._labelBottom;const e=this._controlsContainer.getBoundingClientRect(),t=this._currencyAndUnitLabelsWrapper.getBoundingClientRect(),i=e.y-t.y;return this._labelBottom=e.height+2*i}_resetSizesAndVisibility(){this._width=null,this._labelBottom=null,this._updateVisibility()}_textMarginAndPadding(){return Number(et.css_wrapper_margin)+Number(et.css_row_left_right_padding)+2}_currencyTooltipContent(){const e=this._currencyInfo;return null===e?"":null===e.selectedCurrency?Array.from(e.currencies).map((t=>(0,
r.ensureDefined)(e.displayedValues.get(t)))).join(", "):e.displayedValues.get(e.selectedCurrency)||""}_unitTooltipContent(){const e=this._unitInfo;return null===e?"":null===e.selectedUnit?Array.from(e.units).map((t=>(0,r.ensureDefined)(e.names.get(t)))).join(", "):e.descriptions.get(e.selectedUnit)||""}_measureUnitIdTooltipContent(){const e=this._measureUnitIdInfo;return null===e?"":null===e.selectedMeasureUnitId?Array.from(e.measureUnitIds).map((t=>(0,r.ensureDefined)(e.names.get(t)))).join(", "):e.descriptions.get(e.selectedMeasureUnitId)||""}_updateVisibility(){const e=this.isEnabled();this._currencyAndUnitLabelsWrapper.classList.toggle("js-hidden",!e)}}async function it(e,t,s,r){const{UnitConversionRenderer:n}=await Promise.all([i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(6),i.e(2587),i.e(6752),i.e(6036),i.e(6025),i.e(7111),i.e(962),i.e(6408),i.e(2544),i.e(5057),i.e(2704)]).then(i.bind(i,41153));return new n(e,s,t,r)}var st=i(68335),rt=i(77212),nt=i(10786),ot=i(24120),at=i(42226),lt=i(39875),ct=i(97754),ht=i.n(ct),dt=i(58035);class ut{constructor({setMode:e,className:t=""}){const s=this._wrapper=document.createElement("div");s.classList.add(t),s.addEventListener("dblclick",this._stopPropagation,{capture:!0}),s.addEventListener("touchstart",this._stopPropagation,{capture:!0});const r=s.appendChild(document.createElement("div"));r.className=dt.priceScaleModeButtons,this._autoScaleButton=r.appendChild(this._createButton({title:o.t(null,{context:'The first letter of the "auto" word'},i(9846)),tooltip:o.t(null,void 0,i(50834)),onClick:()=>e("auto"),ariaLabel:Pe.PLATFORM_ACCESSIBILITY_ENABLED?o.t(null,void 0,i(74327)):void 0})),this._logarithmButton=r.appendChild(this._createButton({title:o.t(null,{context:'The first letter of the "logarithmic" word'},i(55765)),tooltip:o.t(null,void 0,i(12285)),onClick:()=>e("log"),ariaLabel:Pe.PLATFORM_ACCESSIBILITY_ENABLED?o.t(null,void 0,i(84112)):void 0}))}destroy(){this._wrapper.removeEventListener("dblclick",this._stopPropagation),this._wrapper.removeEventListener("touchstart",this._stopPropagation),this._autoScaleButton.remove(),this._logarithmButton.remove(),this._wrapper.remove()}element(){return this._wrapper}width(){return 52}updateMode(e){const{log:t,autoScale:i}=e;this._logarithmButton.classList.toggle(dt.priceScaleModeButtons__button_activated,!!t),this._autoScaleButton.classList.toggle(dt.priceScaleModeButtons__button_activated,!!i)}_createButton(e){const{ariaLabel:t,title:i,tooltip:s,onClick:r}=e,n=document.createElement("button");return n.className=ht()(dt.priceScaleModeButtons__button,"apply-common-tooltip"),n.textContent=i,n.dataset.tooltip=s,n.addEventListener("click",r),t&&n.setAttribute("aria-label",t),n}_stopPropagation(e){e.stopPropagation()}}i(47184)
;const pt=new F.TranslatedString("change no overlapping labels",o.t(null,void 0,i(83935))),_t=new F.TranslatedString("toggle auto scale",o.t(null,void 0,i(63060))),mt=new F.TranslatedString("toggle log scale",o.t(null,void 0,i(60166))),gt=o.t(null,void 0,i(75633)),ft=o.t(null,void 0,i(94420)),vt=o.t(null,void 0,i(81520)),St=o.t(null,void 0,i(25933)),yt=o.t(null,void 0,i(17258)),bt=o.t(null,void 0,i(50834)),wt=o.t(null,{context:"scale_menu"},i(70361)),Ct=o.t(null,{context:"scale_menu"},i(47807)),Pt=o.t(null,{context:"scale_menu"},i(34727)),xt=o.t(null,{context:"scale_menu"},i(72116)),Tt=o.t(null,{context:"scale_menu"},i(19238)),It=o.t(null,{context:"scale_menu"},i(54138));const Mt=function(e){const t=new nt.LimitedPrecisionNumericFormatter(e);return(e,i)=>(0,C.isNumber)(i)&&!e.isLog()?t.format(i):""}(4),At={contextMenuEnabled:!0,currencyConversionEnabled:!1,unitConversionEnabled:!1,countdownEnabled:!0,contextMenu:{general:!0,source:!0},pressedMouseMoveScale:!0,mouseWheelScale:!0,pinchScale:!0,croppedTickMarks:!0};class Lt{constructor(e,t,i,r,n,o,a,l,c){this._actions=null,this._priceScale=null,this._scaleModeButtons=null,this._widthCache=new Je.TextWidthCache(1e3),this._color=null,this._fontSize=null,this._currencyFontSize=0,this._currencyLabelWidth=null,this._isVisible=!0,this._currencyMenu=null,this._unitMenu=null,this._size=(0,s.size)({width:0,height:0}),this._currentCursorClassName="",this._destroyed=!1,this._highlighted=!1,this._highlightColorCache=null,this._mouseWheelHelper=null,this._dragScaleActive=!1,this._offset=NaN,this._pinching=!1,this._lastHittestResult=null,this._isHovered=new W.WatchedValue(!1),this._recalcCurrencyAndUnitVisibility=()=>{if(null===this._currencyLabel)return;let e=!0;switch((0,at.currencyUnitVisibilityProperty)().value()){case"alwaysOff":e=!1;break;case"visibleOnMouseOver":const t=this._chart.anyPriceAxisHovered().value(),i=null!==this._currencyMenu&&this._currencyMenu.isOpened(),s=null!==this._unitMenu&&this._unitMenu.isOpened();e=t||i||s}this._currencyLabel.setHidden(!e)},this._handleAutoLogButtonsVisibilityProperty=e=>{const t=e.value();"alwaysOff"===t?this._scaleModeButtons&&this._destroyScaleModeButtons():(this._scaleModeButtons||this._createScaleModeButtons(),"alwaysOn"===t?(this._isHovered.unsubscribe(this._updatePriceScaleModeButtonsVisibility),this._updatePriceScaleModeButtonsVisibility(!0)):this._isHovered.subscribe(this._updatePriceScaleModeButtonsVisibility,{callWithLast:!0}))},this._updatePriceScaleModeButtonsVisibility=e=>{var t;null===(t=this._scaleModeButtons)||void 0===t||t.element().classList.toggle("price-axis__modeButtons_hidden",!e)},this._updateScaleModeButtons=()=>{var e;this._priceScale&&(null===(e=this._scaleModeButtons)||void 0===e||e.updateMode(this._priceScale.mode()))},this._chart=e,this._pane=t,this._undoModel=i,this._properties=r,this._isLeft="left"===o,this._options=(0,C.merge)((0,C.clone)(At),a),this._rendererOptionsProvider=n,this._backgroundBasedTheme=c,this._cell=document.createElement("div"),this._cell.className="price-axis",
this._cell.style.width="25px",this._cell.style.left="0",this._canvasConfiguredHandler=()=>{this._undoModel.model().lightUpdate()},this._canvasBinding=(0,U.createBoundCanvas)(this._cell,(0,s.size)({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const h=this._canvasBinding.canvasElement;h.style.position="absolute",h.style.zIndex="1",h.style.left="0",h.style.top="0",this._topCanvasBinding=(0,U.createBoundCanvas)(this._cell,(0,s.size)({width:16,height:16})),this._topCanvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const d=this._topCanvasBinding.canvasElement;d.style.position="absolute",d.style.zIndex="2",d.style.left="0",d.style.top="0",Pe.PLATFORM_ACCESSIBILITY_ENABLED&&this._cell.setAttribute("aria-hidden","true"),this._mouseEventHandler=new Ce.MouseEventHandler(this._cell,this,{treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!0}),this._options.currencyConversionEnabled||this._options.unitConversionEnabled?(this._currencyLabel=new tt,this._cell.appendChild(this._currencyLabel.element())):this._currencyLabel=null,this._properties.childs().fontSize.subscribe(this,this._onFontSizeChanged),this._options.mouseWheelScale&&(this._mouseWheelHelper=new ye,this._cell.addEventListener("wheel",this._onMousewheel.bind(this),{passive:!1})),this._axisInfo=l,this._offset=0,this.restoreDefaultCursor(),(0,at.currencyUnitVisibilityProperty)().subscribe(this,this._recalcCurrencyAndUnitVisibility),(0,lt.autoLogButtonsVisibilityProperty)().subscribe(this,this._handleAutoLogButtonsVisibilityProperty),this._handleAutoLogButtonsVisibilityProperty((0,lt.autoLogButtonsVisibilityProperty)()),this._chart.anyPriceAxisHovered().subscribe(this._recalcCurrencyAndUnitVisibility,{callWithLast:!0}),this.update()}getContextMenuActions(){var e;this._initActions();const t=(0,r.ensureNotNull)(this._actions),i=this._chart.actions(),s=[];return(null===(e=this._priceScale)||void 0===e?void 0:e.resetScaleAvailable().value())&&s.push(t.reset,new H.Separator),s.push(this._autoScaleAction()),this._isMainSeriesAxis()&&s.push(this._lockScaleAction()),s.push(i.scaleSeriesOnly,this._invertAction(),new H.Separator,this._regularScaleAction(),this._percentageAction(),this._indexedTo100Action(),this._logAction(),new H.Separator),l.CheckMobile.any()||(s.push(this._createMergeScalesAction()),s.push(new H.Separator)),R.enabled("fundamental_widget")||s.push(new H.Action({actionId:"Chart.PriceScale.Labels",options:{label:ft,subItems:[i.showSymbolLabelsAction,i.showSeriesLastValue,null,null,i.showHighLowPriceLabels,R.enabled("show_average_close_price_line_and_label")?i.showAverageClosePriceLabel:null,null,i.showStudyPlotNamesAction,i.showStudyLastValue,t.alignLabels].filter(Boolean)}})),s.push((0,ot.createLinesAction)(this._chart)),this._options.countdownEnabled&&s.push(i.showCountdown),this._undoModel.crossHairSource().isMenuEnabled()&&s.push(i.addPlusButton),!(0,
l.onWidget)()&&R.enabled("show_chart_property_page")&&R.enabled("chart_property_page_scales")&&i.scalesProperties&&s.push(new H.Separator,i.scalesProperties),s}getElement(){return this._cell}onOptimalWidthNeedToBeRecalculated(e){(this._size.width1e-14){const o=r.formatPrice(Math.floor(Math.min(e,i))+.11111111111111,n),a=r.formatPrice(Math.ceil(Math.max(e,i))-.11111111111111,n);s=Math.max(s,this._widthCache.measureText(t,o),this._widthCache.measureText(t,a))}}}let o=0;this._isCurrencyLabelEnabled()&&(null===this._currencyLabelWidth&&(this._currencyLabelWidth=(0,r.ensureNotNull)(this._currencyLabel).width()),o=Math.round(this._currencyLabelWidth));const a=s||34;let l=Math.max(o,null!==(i=null===(t=this._scaleModeButtons)||void 0===t?void 0:t.width())&&void 0!==i?i:0,Math.ceil(n.borderSize+n.additionalPaddingInner+n.paddingInner+n.paddingOuter+a+4));return l+=l%2,l}setSizeAndOffset(e,t){(0,s.equalSizes)(this._size,e)||(this._size=e,this._canvasBinding.resizeCanvasElement(e),this._topCanvasBinding.resizeCanvasElement(e),this._cell.style.width=e.width+"px",this._cell.style.height=e.height+"px",this._cell.style.minWidth=e.width+"px"),this._offset!==t&&(this._offset=t,this._cell.style.left=t+"px")}getWidth(){return this._size.width}getImage(){const e=this._size,t=(0,U.createDisconnectedCanvas)(document,e);return(0,U.getPrescaledContext2D)(t).drawImage(this._canvasBinding.canvasElement,0,0,e.width,e.height),null===this._currencyLabel||this._currencyLabel.isHidden()||this._currencyLabel.drawLabel((0,U.getContext2D)(t),e.width,(0,de.getCanvasDevicePixelRatio)(t)),t}update(){null!==this._priceScale&&(this._priceScale.marks(),this._updateCurrencyLabelFont(),this.rendererOptions())}paint(e){if(!this._isVisible||0===this._size.width||0===this._size.height)return;if(e===ue.InvalidationLevel.None)return;const t=this._pane.state(),i=!t.maximized().value()&&t.collapsed().value(),s=this._pane.hasState();(0,U.tryApplySuggestedCanvasBitmapSize)(this._canvasBinding),(0,U.tryApplySuggestedCanvasBitmapSize)(this._topCanvasBinding);const n=this._groupedSources(),o=null!==this._currencyLabel&&!this._currencyLabel.isHidden(),a=(e,t,i)=>{if(o){e.save(),
e.beginPath();const i=(0,r.ensureNotNull)(this._currencyLabel).labelBottom();e.rect(0,i*t,this._size.width*t,this._size.height*t),e.clip()}i(),o&&e.restore()};if(e>ue.InvalidationLevel.Cursor){const e=(0,U.getContext2D)(this._canvasBinding.canvasElement),t=(0,U.getBindingPixelRatio)(this._canvasBinding);i||this._alignLabels(),s&&this.updateCurrencyLabel(),this._drawBackground(e,t),a(e,t,(()=>{this._drawDrawingsHighlight(e,t)})),this._drawBorder(e,t),s&&(this._scaleModeButtons&&(this._scaleModeButtons.element().style.background=this._highlighted?this._highlightColor():this.backgroundColor()),i||a(e,t,(()=>{this._drawTickMarks(e,t),this._drawLabels(this._views(0,n),e,t)})))}if(s&&!i){const e=(0,U.getContext2D)(this._topCanvasBinding.canvasElement),t=(0,U.getBindingPixelRatio)(this._topCanvasBinding);e.clearRect(0,0,Math.ceil(this._size.width*t)+1,Math.ceil(this._size.height*t)+1),a(e,t,(()=>{this._drawLabels(this._views(1,n),e,t),this._drawCrossHairLabel(e,t)}))}}restoreDefaultCursor(){this._setCursor("")}priceScale(){return(0,r.ensureNotNull)(this._priceScale)}setPriceScale(e){this._priceScale!==e&&(null!==this._priceScale&&(this._priceScale.onMarksChanged().unsubscribe(this,this.onOptimalWidthNeedToBeRecalculated),this._priceScale.modeChanged().unsubscribeAll(this)),this._priceScale=e,null!==e&&(e.onMarksChanged().subscribe(this,this.onOptimalWidthNeedToBeRecalculated),e.modeChanged().subscribe(this,(()=>this.onOptimalWidthNeedToBeRecalculated(!0))),this.onOptimalWidthNeedToBeRecalculated(),this._scaleModeButtons&&(e.modeChanged().subscribe(this,this._updateScaleModeButtons),this._updateScaleModeButtons())))}isVisible(){return this._isVisible}setVisible(e){(e=!!e)!==this._isVisible&&(this._cell.style.display=e?"table-cell":"none",this._isVisible=e)}destroy(){null!==this._currencyMenu&&(this._currencyMenu.close(),this._currencyMenu=null),null!==this._unitMenu&&(this._unitMenu.close(),this._unitMenu=null),this._topCanvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler),this._topCanvasBinding.dispose(),this._canvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler),this._canvasBinding.dispose(),null!==this._priceScale&&(this._priceScale.onMarksChanged().unsubscribe(this,this.onOptimalWidthNeedToBeRecalculated),this._priceScale.modeChanged().unsubscribeAll(this)),this._priceScale=null,this._mouseEventHandler.destroy(),this._properties.childs().fontSize.unsubscribe(this,this._onFontSizeChanged),null!==this._actions&&this._actions.reset&&this._actions.reset.destroy(),(0,at.currencyUnitVisibilityProperty)().unsubscribeAll(this),this._chart.anyPriceAxisHovered().unsubscribe(this._recalcCurrencyAndUnitVisibility),(0,lt.autoLogButtonsVisibilityProperty)().unsubscribeAll(this),this._chart.setPriceAxisHovered(this,!1),this._destroyScaleModeButtons(),this._destroyed=!0}axisInfo(){return this._axisInfo}setHighlighted(e){this._highlighted=e}backgroundColor(){return this._pane.state().model().backgroundColor().value()}backgroundTopColor(){
return this._pane.state().model().backgroundTopColor().value()}lineColor(){return this._properties.childs().lineColor.value()}textColor(){return this._properties.childs().textColor.value()}fontSize(){return this._properties.childs().fontSize.value()}baseFont(){return(0,Oe.makeFont)(this.fontSize(),He.CHART_FONT_FAMILY,"")}rendererOptions(){let e=this._rendererOptionsProvider.options();return this._color===e.color&&this._fontSize===e.fontSize||(this._color=e.color),this._fontSize!==e.fontSize&&(this._widthCache.reset(),this._fontSize=e.fontSize,this._currencyLabelWidth=null,this._currencyFontSize=0,this._updateCurrencyLabelFont(),this.onOptimalWidthNeedToBeRecalculated()),e}mouseEnterEvent(e){this._chart.setPriceAxisHovered(this,!0),this._isHovered.setValue(!0),this._applyLightUpdateIfRequired(),this._mouseEnterOrTouchStartEvent(e)}mouseMoveEvent(e){this._mouseOrTouchMoveEvent(e)}mouseDownEvent(e){this._mouseDownOrTouchStartEvent(e)}touchStartEvent(e){this._mouseOrTouchMoveEvent(e),this._mouseEnterOrTouchStartEvent(e),this._mouseDownOrTouchStartEvent(e)}pressedMouseMoveEvent(e){this._pressedMouseOrTouchMoveEvent(e)}touchMoveEvent(e){this._pressedMouseOrTouchMoveEvent(e)}pinchStartEvent(e,t,i,s){return s.bothPointsOnTargetElement}pinchEvent(e,t,i){if(this._zoomAvailable()&&this._options.pinchScale){if(this._dragScaleActive&&this._finishScale(),!this._pinching)return this._pinching=!0,void this._undoModel.startTwoPointsScalePrice(this._pane.state(),this.priceScale(),t.y,i.y);this._undoModel.twoPointsScalePriceTo(this._pane.state(),this.priceScale(),t.y,i.y)}}pinchEndEvent(){this._pinching=!1,this._undoModel.endTwoPointsScalePrice(this._pane.state(),this.priceScale())}mouseDownOutsideEvent(){this._finishScale()}touchStartOutsideEvent(){this._finishScale()}mouseUpEvent(e){this._mouseUpOrTouchEndEvent(e)}touchEndEvent(e){this._mouseLeaveOrTouchEndEvent(e),this._mouseUpOrTouchEndEvent(e)}mouseClickEvent(e){this._mouseClickOrTapEvent(e)}tapEvent(e){this._mouseClickOrTapEvent(e)}mouseLeaveEvent(e){this._chart.setPriceAxisHovered(this,!1),this._isHovered.setValue(!1),this._applyLightUpdateIfRequired(),this._mouseLeaveOrTouchEndEvent(e)}mouseDoubleClickEvent(e){this._mouseDoubleClickOrDoubleTapEvent(e)}doubleTapEvent(e){this._mouseDoubleClickOrDoubleTapEvent(e)}contextMenuEvent(e){this._contextMenuOrTouchContextMenuEvent(e)}touchContextMenuEvent(e){this._contextMenuOrTouchContextMenuEvent(e)}dataSourceAtPoint(e,t){const i=this._pane.state();if(!i.maximized().value()&&i.collapsed().value())return null;const s=this._groupedSources(),r=[...s.sources,...s.topLevelSources,...i.customSources()];let n=null,o=null;if(!this._priceScale)return null;const a=(e,t)=>{var i;const s=null!==(i=null==o?void 0:o.target())&&void 0!==i?i:0;e.target()>s&&(o=e,n=t)},l=new Ae.Point(e,t);for(let e=r.length-1;e>=0;--e){const t=r[e],s=t.priceAxisViews(i,this._priceScale);if(s&&0!==s.length)for(let e=s.length-1;e>=0;--e){const i=s[e].renderer();if(void 0!==i.hitTest){const e=i.hitTest(l,this._size.width,this._isLeft?"left":"right");null!==e&&a(e,t)}}}
return this._lastHittestResult=o,n}reset(){const e=this._pane.state(),t=this.priceScale();this._undoModel.resetPriceScale(e,t),this.onOptimalWidthNeedToBeRecalculated(!0)}updateCurrencyLabel(){if(null===this._currencyLabel)return;let e=!1;if(this._options.currencyConversionEnabled){const t=this.priceScale().currency(this._undoModel.model().availableCurrencies());null===t||"alwaysOff"===(0,at.currencyUnitVisibilityProperty)().value()?(e=this._currencyLabel.currencyLabelEnabled(),this._currencyLabel.disableCurrency()):(e=!this._currencyLabel.currencyLabelEnabled(),this._currencyLabel.enableCurrency(),e=this._currencyLabel.setCurrencyInfo(t)||e)}else this._currencyLabel.disableCurrency();if(this._options.unitConversionEnabled){const t="alwaysOff"===(0,at.currencyUnitVisibilityProperty)().value(),i=this._undoModel.model().availableUnits(),s=this.priceScale().unit(i);null===s||t?(e=e||this._currencyLabel.unitLabelEnabled(),this._currencyLabel.disableUnit()):(e=e||!this._currencyLabel.unitLabelEnabled(),this._currencyLabel.enableUnit(),e=this._currencyLabel.setUnitInfo(s)||e);const r=this.priceScale().measureUnitId(i);null===r||t?(e=e||this._currencyLabel.measureUnitIdLableEnabled(),this._currencyLabel.disableMeasureUnitId()):(e=e||!this._currencyLabel.measureUnitIdLableEnabled(),this._currencyLabel.enableMeasureUnitId(),e=this._currencyLabel.setMeasureUnitIdInfo(r)||e)}else this._currencyLabel.disableUnit(),this._currencyLabel.disableMeasureUnitId();this._updateCurrencyLabelFont(),e&&(this._currencyLabelWidth=null)}_groupedSources(){var e;const t=this._pane.state(),i=t.model(),s=this._pane.state().sourcesByGroup(),r=this._isLeft?s.leftPriceScalesSources():s.rightPriceScalesSources(),n=this._priceScale===t.defaultPriceScale(),o=new Set(t.customSources()),a=e=>!!o.has(e)||(e.priceScale()===this._priceScale||n&&t.isOverlay(e)),l={sources:[...r.filter(a),...t.customSources()],topLevelSources:new Set};if(n){const e=this._pane.state().dataSources();for(const i of e)t.isOverlay(i)&&l.sources.push(i)}const c=null!==(e=i.lineBeingEdited())&&void 0!==e?e:i.lineBeingCreated();c&&a(c)&&(l.topLevelSources.add(c),l.lineBeingEditedOrCreated=c);const h=i.customSourceBeingMoved();h&&a(h)&&(l.topLevelSources.add(h),l.customSourceBeingMoved=h);const d=i.sourcesBeingMoved().filter(a);d.length>0&&(i.sourcesBeingMoved().forEach((e=>l.topLevelSources.add(e))),l.sourcesBeingMoved=d);const u=i.selection().allSources().filter(a);u.length>0&&(u.forEach((e=>l.topLevelSources.add(e))),l.selectedSources=u);const p=i.hoveredSource();return p&&a(p)&&(l.topLevelSources.add(p),l.hoveredSource=p),l}_isCurrencyLabelEnabled(){return null!==this._currencyLabel&&this._currencyLabel.isEnabled()}_updateCurrencyLabelFont(){if(null===this._currencyLabel)return;const e=this.fontSize();e!==this._currencyFontSize&&(this._currencyLabel.setFontSize(e),this._currencyFontSize=e,this._currencyLabelWidth=null,this.onOptimalWidthNeedToBeRecalculated())}_alignLabels(){var e,t,i,s,r;const n=this._size.height;let o=n/2
;const a=[],l=this.priceScale(),c=l.orderedSources().slice(),h=this._pane.state(),d=this.rendererOptions();if(l===h.defaultPriceScale()){const e=h.priceDataSources();for(let t=0;t{if(e.ignoreAlignment()||!e.isVisible())return!1;const{total:t}=e.topBottomTotalHeight(d),i=e.floatCoordinate();return i>-t&&ie.floatCoordinate()<=o)),_=a.filter((e=>e.floatCoordinate()>o));p.sort(((e,t)=>t.floatCoordinate()-e.floatCoordinate())),p.length>0&&_.length>0&&_.push(p[0]),_.sort(((e,t)=>e.floatCoordinate()-t.floatCoordinate()));for(const e of a)e.setFixedCoordinate(e.coordinate());if(l.properties().childs().alignLabels.value()){if(_.length>0||p.length>0){{const e=null!==(s=p[0])&&void 0!==s?s:_[0],t=e.getFixedCoordinate(),{top:i,bottom:r,total:o}=e.topBottomTotalHeight(d);o0&&e.setFixedCoordinate(i)}{const e=null!==(r=_[0])&&void 0!==r?r:p[0],t=e.getFixedCoordinate(),{top:i,bottom:s,total:o}=e.topBottomTotalHeight(d);on&&e.setFixedCoordinate(n-s)}}for(let e=1;ea-n)t.setFixedCoordinate(a-n);else if(a>0&&o-s<0&&o+r>0){const{top:e}=i.topBottomTotalHeight(d);t.setFixedCoordinate(Math.min(a-e-r,s))}}for(let e=1;e<_.length;e++){const t=_[e],i=_[e-1],{bottom:s,total:r}=i.topBottomTotalHeight(d),o=t.getFixedCoordinate(),a=i.getFixedCoordinate();if(on&&t.setFixedCoordinate(Math.max(a+s+e,n-i))}}}}_drawTickMarks(e,t){const i=this.priceScale().marks();e.save(),e.font=this.baseFont();const s=this.rendererOptions(),n=this._isLeft?Math.floor((this._size.width-s.additionalPaddingInner)*t):0,o=this._isLeft?Math.round(n-s.paddingInner*t):Math.round(n+(s.additionalPaddingInner+s.paddingInner)*t),a=this.fontSize(),l=this._isCurrencyLabelEnabled()?(0,r.ensureNotNull)(this._currencyLabel).labelBottom():0,c=i.map((t=>{if(this._options.croppedTickMarks)return{visible:!0,yCorrection:this._widthCache.yMidCorrection(e,t.label)};const i=t.coord-a/2,s=t.coord+a/2,r=!(s>this._size.height||ithis._size.height||i{for(let s=i.length;s--;){if(!c[s].visible)continue;const r=i[s];e.fillText(r.label,o/t,r.coord+c[s].yCorrection)}})),e.restore()}_hasAlertLabel(){return!1}async _showCurrenciesContextMenu(){var e
;if(null!==this._currencyMenu&&this._currencyMenu.isOpened())return void this._currencyMenu.close();(0,d.trackEvent)("GUI","Currency conversion");const{currencyActions:t}=await Promise.all([i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(6),i.e(2587),i.e(6752),i.e(6036),i.e(6025),i.e(7111),i.e(962),i.e(6408),i.e(2544),i.e(5057),i.e(2704)]).then(i.bind(i,84298)),s=await it(vt,(()=>t(this._undoModel,(0,r.ensureNotNull)(this._currencyLabel).currencyInfo(),this.priceScale())),(0,r.ensureNotNull)(this._currencyLabel).currencyLabelElement(),(()=>{var e;this._recalcCurrencyAndUnitVisibility(),null===(e=this._currencyLabel)||void 0===e||e.setCurrencyExpanded(!1)}));null===(e=this._currencyLabel)||void 0===e||e.setCurrencyExpanded(!0),this._destroyed?s.close():this._currencyMenu=s}async _showUnitsContextMenu(){var e;if(null!==this._unitMenu&&this._unitMenu.isOpened())return void this._unitMenu.close();(0,d.trackEvent)("GUI","Unit conversion");const{unitActions:t}=await Promise.all([i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(6),i.e(2587),i.e(6752),i.e(6036),i.e(6025),i.e(7111),i.e(962),i.e(6408),i.e(2544),i.e(5057),i.e(2704)]).then(i.bind(i,14818)),s=await it(St,(()=>t(this._undoModel,(0,r.ensureNotNull)(this._currencyLabel).unitInfo(),this.priceScale())),(0,r.ensureNotNull)(this._currencyLabel).unitLabelElement(),(()=>{var e;this._recalcCurrencyAndUnitVisibility(),null===(e=this._currencyLabel)||void 0===e||e.setUnitExpanded(!1)}));null===(e=this._currencyLabel)||void 0===e||e.setUnitExpanded(!0),this._destroyed?s.close():this._unitMenu=s}_onFontSizeChanged(){this._currencyLabelWidth=null,this._currencyFontSize=0,this._updateCurrencyLabelFont(),this.onOptimalWidthNeedToBeRecalculated()}_mouseOrTouchMoveEvent(e){var t,i,s,r;if(!this._priceScale)return;if(e.localX<0||e.localY<0||e.localX>=this._size.width||e.localY>=this._size.height)return;let n=!0;const o=this.dataSourceAtPoint(e.localX,e.localY);o?(this._setCursorClassName("pointer"),(null===(i=null===(t=this._lastHittestResult)||void 0===t?void 0:t.data())||void 0===i?void 0:i.hoverModelFromAxis)&&(this._undoModel.model().setHoveredSource(o,null!==(r=null===(s=this._lastHittestResult)||void 0===s?void 0:s.data())&&void 0!==r?r:null),n=!1)):this._setResizeCursor(),n&&this._undoModel.model().setHoveredSource(null,null)}_mouseDownOrTouchStartEvent(e){this._zoomAvailable()&&this._options.pressedMouseMoveScale&&!this._pinching&&(this._dragScaleActive=!0,this._undoModel.startScalePrice(this._pane.state(),this.priceScale(),e.localY))}_mouseEnterOrTouchStartEvent(e){this._setResizeCursor()}_pressedMouseOrTouchMoveEvent(e){if(this._dragScaleActive){const t=this.priceScale();this._undoModel.scalePriceTo(this._pane.state(),t,e.localY)}}_mouseUpOrTouchEndEvent(e){this._finishScale()}_finishScale(){this._dragScaleActive&&(this._undoModel.endScalePrice(this._pane.state(),this.priceScale()),this.restoreDefaultCursor(),this._dragScaleActive=!1)}_mouseClickOrTapEvent(e){if(this._currencyLabel){
if(this._currencyLabel.currencyConversionAvailable()&&this._currencyLabel.currencyLabelElement().contains(e.target))return this._showCurrenciesContextMenu(),void e.preventDefault();if(this._currencyLabel.unitConversionAvailable()&&this._currencyLabel.unitLabelElement().contains(e.target))return this._showUnitsContextMenu(),void e.preventDefault()}const t=this.dataSourceAtPoint(e.localX,e.localY);t&&this._undoModel.selectionMacro((e=>{var i,s,r;e.selection().isSelected(t)&&this._undoModel.model().lastSelectedHittestData()===(null===(i=this._lastHittestResult)||void 0===i?void 0:i.data())||(e.clearSelection(),e.addSourceToSelection(t,null!==(r=null===(s=this._lastHittestResult)||void 0===s?void 0:s.data())&&void 0!==r?r:null))}))}_mouseLeaveOrTouchEndEvent(e){this._setCursorClassName("")}_mouseDoubleClickOrDoubleTapEvent(e){var t,i,s;if((null===(t=this._currencyLabel)||void 0===t?void 0:t.currencyLabelElement().contains(e.target))||(null===(i=this._currencyLabel)||void 0===i?void 0:i.unitLabelElement().contains(e.target)))return;const r=this.dataSourceAtPoint(e.localX,e.localY);r?this._pane.processDoubleClickOnSource(r,null!==(s=this._lastHittestResult)&&void 0!==s?s:void 0,{origin:"price_scale"}):(this.reset(),(0,d.trackEvent)("GUI","Double click price scale"))}_contextMenuOrTouchContextMenuEvent(e){if(this._options.contextMenuEnabled){const t=this.dataSourceAtPoint(e.localX,e.localY);if(null!==t&&this._options.contextMenu.source){return void this._undoModel.model().selectionMacro((i=>{i.selection().isSelected(t)||(i.clearSelection(),i.addSourceToSelection(t)),this._pane.showContextMenuForSelection(e,{origin:"price_scale"})}))}this._options.contextMenu.general&&qe.ContextMenuManager.showMenu(this.getContextMenuActions(),e,{statName:"PriceScaleContextMenu"},{menuName:"PriceScaleContextMenu"})}}_setResizeCursor(){const e=this.priceScale();e.isPercentage()||e.isIndexedTo100()?this._setCursorClassName(""):this._zoomAvailable()&&(this._options.pressedMouseMoveScale||this._options.mouseWheelScale)&&this._setCursorClassName("ns-resize")}_setCursorClassName(e){let t="";e&&(t="price-axis--cursor-"+e),this._currentCursorClassName!==t&&(this._currentCursorClassName&&this._cell.classList.remove(this._currentCursorClassName),t&&this._cell.classList.add(t),this._currentCursorClassName=t)}_zoomAvailable(){return!this.priceScale().isEmpty()&&this._undoModel.model().zoomEnabled()}_onMousewheel(e){if(!this._zoomAvailable()||!this._options.mouseWheelScale)return;const t=(0,r.ensureNotNull)(this._mouseWheelHelper).processWheel(e).deltaY;if(0===t)return;e.cancelable&&e.preventDefault();const i=this._undoModel,s=this._pane.state(),n=this.priceScale(),o=this._cell.getBoundingClientRect(),a=e.clientY-o.top,l=a+15*t;i.startScalePrice(s,this.priceScale(),a,!0),i.scalePriceTo(s,n,l),i.endScalePrice(s,n),e.stopPropagation()}_drawCrossHairLabel(e,t){const i=this._pane.state(),s=i.model(),r=this.priceScale(),n=s.crossHairSource().priceAxisViews(i,r);n&&n.length>0&&this._drawLabels(n,e,t)}_drawBackground(e,t){
const i=Math.ceil(this._size.width*t),s=Math.ceil(this._size.height*t),r=this.backgroundTopColor(),n=this.backgroundColor();if(r===n?(0,U.clearRect)(e,0,0,i+1,s+1,this.backgroundColor()):(0,Ne.clearRectWithGradient)(e,0,0,i+1,s+1,r,n),this._highlighted){e.globalAlpha=.5;const t=h.themes[this._backgroundBasedTheme.value()].getThemedColor("color-price-axis-highlight");(0,U.fillRect)(e,0,0,i+1,s+1,t),e.globalAlpha=1}}_drawDrawingsHighlight(e,t){const i=this._pane.state().model(),s=this.priceScale(),r=i.selection().lineDataSources().filter((e=>e.priceScale()===s)).reduce(((e,t)=>{const i=t.priceAxisPoints();return 0===i.length?e:e.concat(i)}),[]);r.length>0&&this._hightlightBackground(e,r,this.priceScale().mainSource(),t);const n=i.crossHairSource();n.startMeasurePoint()&&this._hightlightBackground(e,n.measurePoints(),this.priceScale().mainSource(),t)}_drawBorder(e,t){e.save(),e.fillStyle=this.lineColor();const i=Math.max(1,Math.floor(this.rendererOptions().borderSize*t)),s=this._isLeft?Math.floor(this._size.width*t)-i:0;e.fillRect(s,0,i,Math.ceil(this._size.height*t)+1),e.restore()}_drawLabels(e,t,i){const s=this.rendererOptions(),r=this._isLeft?"right":"left";for(const n of e)n.isAxisLabelVisible()&&(t.save(),n.renderer().draw(t,s,this._widthCache,this._size.width,this._size.height,r,i),t.restore())}_hightlightBackground(e,t,i,s){if(!i)return;const r=i.firstValue();if(null===r)return;let n=t[0].price,o=t[0].price;for(let e=1;e=n&&(n=e,a=i),e<=t&&(t=e,o=i)}}return a&&o?[a,o]:[]}}_views(e,t){var i,s;const r=this._pane.state(),n=this.priceScale(),o=[];if(1!==e)for(const e of t.sources)t.topLevelSources.has(e)||o.push(...null!==(i=e.priceAxisViews(r,n))&&void 0!==i?i:[]);if(0!==e){const e=new Set,i=t=>!e.has(t),a=t=>{const s=t.filter(i);o.push(...this._viewsOrMaxMinViews(s));for(const t of s)e.add(t)};t.customSourceBeingMoved&&a([t.customSourceBeingMoved]),t.sourcesBeingMoved&&a(t.sourcesBeingMoved),t.selectedSources&&a(t.selectedSources),t.hoveredSource&&a([t.hoveredSource]),t.lineBeingEditedOrCreated&&a([t.lineBeingEditedOrCreated]);for(const e of[...t.sources,...r.customSources()])e.topPriceAxisViews&&o.push(...null!==(s=e.topPriceAxisViews(r,n))&&void 0!==s?s:[])}return o}_initActions(){if(!this._pane.hasState()||null!==this._actions)return;const e=this._undoModel,t=new z.ActionWithStandardIcon({actionId:"Chart.PriceScale.Reset",options:{label:yt,iconId:"Chart.Reset",shortcutHint:(0,
st.humanReadableHash)(st.Modifiers.Alt+82),statName:"ResetScale",onExecute:()=>this.reset()}}),i=new H.Action({actionId:"Chart.PriceScale.ToggleAutoScale",options:{label:bt,checkable:!0,checked:!0,statName:"ToggleAutoScale",onExecute:()=>{e.togglePriceScaleAutoScaleMode(this.priceScale()),this._updateScalesActions()}}}),s=new H.Action({actionId:"Chart.PriceScale.TogglePercentage",options:{label:wt,checkable:!0,checked:this.priceScale().isPercentage(),statName:"TogglePercantage",onExecute:()=>{e.togglePriceScalePercentageScaleMode(this.priceScale()),this._updateScalesActions()}}}),r=new H.Action({actionId:"Chart.PriceScale.ToggleIndexedTo100",options:{label:Ct,checkable:!0,checked:this.priceScale().isIndexedTo100(),statName:"ToggleIndexedTo100",onExecute:()=>{e.togglePriceScaleIndexedTo100ScaleMode(this.priceScale()),this._updateScalesActions()}}}),n=new H.Action({actionId:"Chart.PriceScale.ToggleLogarithmic",options:{label:Pt,checkable:!0,checked:this.priceScale().isLog(),statName:"ToggleLogScale",onExecute:()=>{e.togglePriceScaleLogScaleMode(this.priceScale()),this._updateScalesActions()}}}),o=new H.Action({actionId:"Chart.PriceScale.ToggleRegular",options:{label:xt,checkable:!0,checked:this.priceScale().isRegular(),statName:"ToggleRegularScale",onExecute:()=>{e.setPriceScaleRegularScaleMode(this.priceScale()),this._updateScalesActions()}}}),a=new H.Action({actionId:"Chart.PriceScale.Labels.ToggleNoOverlappingLabelsVisibility",options:{label:Tt,checkable:!0,checked:this.priceScale().properties().childs().alignLabels.value(),statName:"TogglePreciseLabels"}});a.setBinding(new rt.ActionBinder(a,this.priceScale().properties().childs().alignLabels,e,pt));const l=new H.Action({actionId:"Chart.PriceScale.ToggleInvertScale",options:{label:It,checkable:!0,checked:this.priceScale().isInverted(),statName:"Invert Scale",onExecute:()=>{e.invertPriceScale(this.priceScale()),this._updateScalesActions()}}});this._actions={reset:t,setAutoScale:i,setPercentage:s,setIndexedTo100:r,setLog:n,setRegular:o,alignLabels:a,invertScale:l},this._updateScalesActions()}_logAction(){return this._isMainSeriesAxis()?this._chart.actions().logSeriesScale:(0,r.ensureNotNull)(this._actions).setLog}_percentageAction(){return this._isMainSeriesAxis()?this._chart.actions().percentSeriesScale:(0,r.ensureNotNull)(this._actions).setPercentage}_indexedTo100Action(){return this._isMainSeriesAxis()?this._chart.actions().indexedTo100SeriesScale:(0,r.ensureNotNull)(this._actions).setIndexedTo100}_autoScaleAction(){return this._isMainSeriesAxis()?this._chart.actions().autoSeriesScale:(0,r.ensureNotNull)(this._actions).setAutoScale}_regularScaleAction(){return this._isMainSeriesAxis()?this._chart.actions().regularSeriesScale:(0,r.ensureNotNull)(this._actions).setRegular}_lockScaleAction(){const e=this._chart.actions().lockSeriesScale,t=Mt(this.priceScale(),this._undoModel.model().mainSeriesScaleRatio());return e.update({hint:t}),e}_invertAction(){return this._isMainSeriesAxis()?this._chart.actions().invertSeriesScale:(0,r.ensureNotNull)(this._actions).invertScale}
_isMainSeriesAxis(){return this.priceScale().hasMainSeries()}_updateScalesActions(){const e=this.priceScale(),t=this._isMainSeriesAxis(),i=(0,r.ensureNotNull)(e.mainSource()).properties(),s=t&&e.isLockScale(),n=t&&6===i.style.value(),o=(0,r.ensureNotNull)(this._actions);o.setRegular.update({checked:e.isRegular(),disabled:s||n}),o.setPercentage.update({checked:e.isPercentage(),disabled:s||n}),o.setIndexedTo100.update({checked:e.isIndexedTo100(),disabled:s||n}),o.setLog.update({checked:e.isLog(),disabled:s||n}),o.setAutoScale.update({checked:e.isAutoScale(),disabled:e.properties().childs().autoScaleDisabled.value()})}_createMergeScalesAction(){const e=this._chart.actions(),t=this._undoModel.model().priceScaleSlotsCount();if(t.left+t.right===1)return 0===t.left?e.moveScaleToLeft:e.moveScaleToRight;const i=[];return i.push(e.mergeLeftScalesAction),i.push(e.mergeRightScalesAction),new H.Action({actionId:"Chart.PriceScale.MergeAllScales",options:{label:gt,subItems:i}})}_setCursor(e){let t="";"grabbing"!==e&&"ns-resize"!==e||(t="price-axis--cursor-"+e),this._currentCursorClassName!==t&&(this._currentCursorClassName&&this._cell.classList.remove(this._currentCursorClassName),t&&this._cell.classList.add(t),this._currentCursorClassName=t,this._cell.style.cursor)}_createScaleModeButtons(){var e;const t=this._scaleModeButtons=new ut({className:"price-axis__modeButtons",setMode:e=>{this._priceScale&&("log"===e?this._chart.model().setPriceScaleMode({log:!this._priceScale.isLog()},this._priceScale,mt):this._chart.model().setPriceScaleMode({autoScale:!this._priceScale.isAutoScale()},this._priceScale,_t))}});return t.element().style.background=this.backgroundColor(),this._cell.appendChild(t.element()),null===(e=this._priceScale)||void 0===e||e.modeChanged().subscribe(this,this._updateScaleModeButtons),this._updateScaleModeButtons(),t}_destroyScaleModeButtons(){var e;this._scaleModeButtons&&(this._isHovered.unsubscribe(this._updatePriceScaleModeButtonsVisibility),null===(e=this._priceScale)||void 0===e||e.modeChanged().unsubscribe(this,this._updateScaleModeButtons),this._scaleModeButtons.destroy(),this._scaleModeButtons=null)}_highlightColor(){const e=this.backgroundColor(),t=this._backgroundBasedTheme.value();if(null===this._highlightColorCache||this._highlightColorCache.backgroundColor!==e||this._highlightColorCache.theme!==t){const i=(0,u.applyTransparency)(h.themes[this._backgroundBasedTheme.value()].getThemedColor("color-price-axis-highlight"),50),s=(0,be.rgbaToString)((0,be.blendRgba)((0,be.parseRgba)(this.backgroundColor()),(0,be.parseRgba)(i)));this._highlightColorCache={theme:t,backgroundColor:e,resultColor:s}}return this._highlightColorCache.resultColor}_applyLightUpdateIfRequired(){"visibleOnMouseOver"===(0,at.currencyUnitVisibilityProperty)().value()&&this._undoModel.model().lightUpdate()}}function kt(e,t){return e.position-t.position}function Dt(e,t,i){const s=(e.position-t.position)/(e.time-t.time);return Math.sign(s)*Math.min(Math.abs(s),i)}class Et{constructor(e,t,i,s){this._position1=null,this._position2=null,
this._position3=null,this._position4=null,this._animationStartPosition=null,this._durationMsecs=0,this._speedPxPerMsec=0,this._minSpeed=e,this._maxSpeed=t,this._dumpingCoeff=i,this._minMove=s}addPosition(e,t){if(null!==this._position1){if(this._position1.time===t)return void(this._position1.position=e);if(Math.abs(this._position1.position-e)50)return;let i=0;const s=Dt(this._position1,this._position2,this._maxSpeed),r=kt(this._position1,this._position2),n=[s],o=[r];if(i+=r,null!==this._position3){const e=Dt(this._position2,this._position3,this._maxSpeed);if(Math.sign(e)===Math.sign(s)){const t=kt(this._position2,this._position3);if(n.push(e),o.push(t),i+=t,null!==this._position4){const e=Dt(this._position3,this._position4,this._maxSpeed);if(Math.sign(e)===Math.sign(s)){const t=kt(this._position3,this._position4);n.push(e),o.push(t),i+=t}}}}let a=0;for(let e=0;ea&&(e.result={hittest:t,source:i,renderer:s,isCustom:r})}const ai={contextMenuEnabled:!0,
contextMenu:ot.defaultContextMenuOptions,priceScaleContextMenuEnabled:!0,legendWidgetEnabled:!0,controlsEnabled:!0,propertyPagesEnabled:!0,sourceSelectionEnabled:!0,countdownEnabled:!0},li=new Map([[ke.AreaName.Text,"Text"],[ke.AreaName.Style,"Style"]]),ci=!R.enabled("display_legend_on_all_charts");let hi=null;function di(e,t){return!(0,ke.shouldDefaultActionBeExecuted)(e,t,"pressedMouseMoveHandler","touchMoveHandler")}class ui{constructor(e,t,i,r){this._legendWidget=null,this._paneControls=null,this._isDestroyed=!1,this._trackCrosshairOnlyAfterLongTap=(0,pe.lastMouseOrTouchEventInfo)().isTouch,this._startTrackPoint=null,this._exitTrackingModeOnNextTry=!1,this._startMoveSourceParams=null,this._startChangeLineToolParams=null,this._preventSourceChange=!1,this._preventScrollUntilNextMouseDownOrTouchStart=!1,this._clonningAtMoveLineTools=null,this._startCloningPoint=null,this._size=(0,s.size)({width:0,height:0}),this._themedTopColor=null,this._initCrossHairPosition=null,this._firstZoomPoint=null,this._editDialog=null,this._processing=!1,this._pressedMoveStage=0,this._touchMove=!1,this._startTouchPoint=null,this._isSelecting=!1,this._prevHoveredHittest=null,this._contextMenuX=0,this._contextMenuY=0,this._startScrollingPos=null,this._isScrolling=!1,this._scrollPriceScale=null,this._scrollXAnimation=null,this._prevPinchScale=1,this._pinching=!1,this._wasPinched=!1,this._longTap=!1,this._contextMenuOpenedOnLastTap=!1,this._paneControlsResizeObserver=null,this._lastClickedSource=null,this._customLegendWidgetsFactoryMap=new Map,this._prevMoveEventPosition=null,this._onMagnetStateChangedListener=this._onMagnetStateChanged.bind(this),this._onShiftKeyStateChangedListener=this._onShiftKeyStateChanged.bind(this),this._currentCursorClassName="",this._lastFinishedToolId=null,this._needResetMeasureLater=!1,this._currentChangingLineToolHitTest=null,this._currentMovingHitTest=null,this._prevTooltipData=null,this._errorRenderer=null,this._highlightedPriceAxis=new W.WatchedValue({owner:"",axis:null}),this._visuallyCollapsed=new W.WatchedValue(!1),this._endOfSeriesDataBanner=null,this._canvasConfiguredHandler=()=>this._state&&this._chartModel().lightUpdate(),this._updateVisuallyCollapsed=()=>{this._visuallyCollapsed.setValue(!this.state().maximized().value()&&this.state().collapsed().value())},this._chart=e,this._state=t,this._options=(0,C.merge)((0,C.clone)(ai),i),this._paneWidgetsSharedState=r,this._state&&this._subscribeToState();const n={contextMenuEnabled:this._options.priceScaleContextMenuEnabled,pressedMouseMoveScale:this._options.handleScale.axisPressedMouseMove.price,mouseWheelScale:this._options.handleScale.mouseWheel,currencyConversionEnabled:this._options.currencyConversionEnabled,unitConversionEnabled:this._options.unitConversionEnabled,countdownEnabled:this._options.countdownEnabled,croppedTickMarks:this._options.croppedTickMarks};void 0!==this._options.priceScaleContextMenu&&(n.contextMenu=this._options.priceScaleContextMenu)
;const o=(e,t,i,s,r)=>new Lt(this._chart,this,this._chartUndoModel(),i,t,e,n,s,r),a=e.properties().childs().scalesProperties,l=this._chartModel().rendererOptionsProvider(),c={backgroundBasedTheme:e.backgroundBasedTheme(),rendererOptionsProvider:l,getBackgroundTopColor:()=>this._chartModel().backgroundTopColor().value(),getBackgroundBottomColor:()=>this._chartModel().backgroundColor().value()},h={showLabels:!1};this._lhsPriceAxisesContainer=new Xe(a,"left",o,c,h),this._rhsPriceAxisesContainer=new Xe(a,"right",o,c,h),this._paneCell=document.createElement("div"),this._paneCell.classList.add("chart-markup-table","pane"),this._div=document.createElement("div"),this._div.classList.add("chart-gui-wrapper"),this._div.setAttribute("data-name","pane-widget-chart-gui-wrapper"),this._paneCell.appendChild(this._div),this._canvasBinding=(0,U.createBoundCanvas)(this._div,(0,s.size)({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const d=this._canvasBinding.canvasElement;d.style.position="absolute",d.style.left="0",d.style.top="0",this._topCanvasBinding=(0,U.createBoundCanvas)(this._div,(0,s.size)({width:16,height:16})),this._topCanvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const u=this._topCanvasBinding.canvasElement;if(u.style.position="absolute",u.style.left="0",u.style.top="0",this._rowElement=document.createElement("div"),this._rowElement.style.display="flex",this._rowElement.appendChild(this._lhsPriceAxisesContainer.getElement()),this._rowElement.appendChild(this._paneCell),this._rowElement.appendChild(this._rhsPriceAxisesContainer.getElement()),Pe.PLATFORM_ACCESSIBILITY_ENABLED){d.setAttribute("aria-hidden","true");const e=this._chartModel().mainSeries();e.dataEvents().symbolResolved().subscribe(this,this._updateAccesibilityAttr),e.onIntervalChanged().subscribe(this,this._updateAccesibilityAttr),this._updateAccesibilityAttr()}this._options.legendWidgetEnabled&&(this._options.customLegendWidgetFactories&&(this._customLegendWidgetsFactoryMap=this._options.customLegendWidgetFactories),this._loadAndCreateLegendWidget()),this._state&&!this._chart.readOnly()&&this._options.controlsEnabled&&this._loadAndCreatePaneControlsWidget(),(0,Ht.magnetEnabled)().subscribe(this._onMagnetStateChangedListener),(0,j.shiftPressed)().subscribe(this._onShiftKeyStateChangedListener),this._paneCell.addEventListener("dragover",(e=>{e.dataTransfer&&Array.from(e.dataTransfer.files).some(blobImageFilter)&&e.preventDefault()})),this.setCursorForTool(),this._mouseEventHandler=new Ce.MouseEventHandler(this._topCanvasBinding.canvasElement,this,{treatVertTouchDragAsPageScroll:!this._options.handleScroll.vertTouchDrag,treatHorzTouchDragAsPageScroll:!this._options.handleScroll.horzTouchDrag}),this._prevHoveredHittest=null,this._highlightedPriceAxis.subscribe((e=>this._highlightPriceAxisByLabel(e.axis))),this._prevPinchScale=0,this._isDestroyed=!1}destroy(){var e;if(this._chart.onPaneWidgetDestroyed(this),Pe.PLATFORM_ACCESSIBILITY_ENABLED){
const e=this._chartModel().mainSeries();e.dataEvents().symbolResolved().unsubscribeAll(this),e.onIntervalChanged().unsubscribeAll(this)}this._customLegendWidgetsFactoryMap.clear(),this._topCanvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler),this._topCanvasBinding.dispose(),this._canvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler),this._canvasBinding.dispose(),this._legendWidget&&(this._legendWidget.destroy(),this._legendWidget=null),null!==this._paneControlsResizeObserver&&this._paneControlsResizeObserver.disconnect(),null!==this._paneControls&&(this._paneControls.destroy(),this._paneControls=null),this._lhsPriceAxisesContainer.destroy(),this._rhsPriceAxisesContainer.destroy(),this.hasState()&&this._unsubscribeFromState(),(0,Ht.magnetEnabled)().unsubscribe(this._onMagnetStateChangedListener),(0,j.shiftPressed)().unsubscribe(this._onShiftKeyStateChangedListener),this._paneWidgetsSharedState.onPaneDestroyed(this),this._errorRenderer&&this._errorRenderer.then((e=>{e.destroy(),this._errorRenderer=null})),this._prevHoveredHittest=null,this._mouseEventHandler.destroy(),null===(e=this._rowElement.parentElement)||void 0===e||e.removeChild(this._rowElement),this._isDestroyed=!0}size(){return this._size}setSize(e){(0,s.equalSizes)(this._size,e)||(this._size=e,this._canvasBinding.resizeCanvasElement(e),this._topCanvasBinding.resizeCanvasElement(e),this._paneCell.style.width=e.width+"px",this._paneCell.style.height=e.height+"px",this._div.style.width=e.width+"px",this._div.style.height=e.height+"px",this._rowElement.classList.toggle("js-hidden",0===e.height),null!==this._legendWidget&&this._legendWidget.updateWidgetModeBySize(e),null!==this._paneControls&&this._paneControls.updateWidgetModeByWidth(e.width))}width(){return this._size.width}height(){return this._size.height}backgroundColor(){return this._chartModel().backgroundColor().value()}highlightedPriceAxis(){return this._highlightedPriceAxis}processDoubleClickOnSource(e,t,i){(0,Ve.isDataSource)(e)&&e.id()!==this._lastFinishedToolId&&this._showEditDialogForSource(e,t)}stretchFactor(){return this._state?this._state.stretchFactor():0}setStretchFactor(e){this.hasState()&&this.state().setStretchFactor(e)}setCursorForTool(e,t,i){if(t&&t.mod()&&e&&e!==this._chartModel().crossHairSource())return void this._setCursorClassName("pointer");if(void 0!==i){switch(i){case Ft.PaneCursorType.VerticalResize:this._setCursorClassName("ns-resize");break;case Ft.PaneCursorType.HorizontalResize:this._setCursorClassName("ew-resize");break;case Ft.PaneCursorType.DiagonalNeSwResize:this._setCursorClassName("nesw-resize");break;case Ft.PaneCursorType.DiagonalNwSeResize:this._setCursorClassName("nwse-resize");break;case Ft.PaneCursorType.Default:this._setCursorClassName("default");break;case Ft.PaneCursorType.Pointer:this._setCursorClassName("pointer");break;case Ft.PaneCursorType.Grabbing:this._setCursorClassName("grabbing")}return}const s=Be.tool.value();if((0,Be.toolIsCursor)(s)){
if(null!==this._paneWidgetsSharedState.draggingSource()||this._isScrolling||this._chartUndoModel()&&this._chartUndoModel().model().sourcesBeingMoved().length)return void this._setCursorClassName("grabbing");if(e&&this._options.sourceSelectionEnabled)return void this._setCursorClassName("pointer")}if("eraser"===s)return void this._setCursorClassName("eraser");if("performance"===s)return void this._setCursorClassName("performance");if("zoom"===s)return void this._setCursorClassName("zoom-in");const r=Be.cursorTool.value();"dot"!==r?"arrow"!==r?this._setCursorClassName(""):this._setCursorClassName("default"):this._setCursorClassName("dot")}showContextMenuForSelection(e,t){const i=this._chartUndoModel().selection();if(i.isEmpty())return;const s=i.dataSources().filter((e=>e.hasContextMenu()));this.showContextMenuForSources(s,e,void 0,t)}async showContextMenuForSources(e,t,i,s){var r,n,o,a;if(!e.length)return Promise.resolve(null);const l=e[0],c=(0,C.merge)((0,C.clone)(this._options.contextMenu),i||{}),h=new ot.ActionsProvider(this._chart,c);if(l===this._chartUndoModel().crossHairSource())return l.handleContextMenuEvent(t),Promise.resolve(null);{const i=await h.contextMenuActionsForSources(e,t,null==s?void 0:s.origin);if(0===i.length)return Promise.resolve(null);{let e;return e=l instanceof Ut.Series?{menuName:null!==(r=null==s?void 0:s.origin)&&void 0!==r?r:"ObjectTreeContextMenu",detail:{type:"series",id:l.instanceId()}}:(0,Q.isLineTool)(l)?{menuName:null!==(n=null==s?void 0:s.origin)&&void 0!==n?n:"ObjectTreeContextMenu",detail:{type:"shape",id:null!==(o=null==l?void 0:l.id())&&void 0!==o?o:null}}:{menuName:null!==(a=null==s?void 0:s.origin)&&void 0!==a?a:"ObjectTreeContextMenu",detail:{type:"study",id:(null==l?void 0:l.id())||null}},qe.ContextMenuManager.createMenu(i,void 0,e).then((e=>(e.show(t),e)))}}}leftPriceAxisesContainer(){return this._lhsPriceAxisesContainer}rightPriceAxisesContainer(){return this._rhsPriceAxisesContainer}setPriceAxisSizes(e,t,i){this._priceAxisesContainer(e).setSizes(t,i)}state(){return(0,r.ensureNotNull)(this._state)}hasState(){return null!==this._state}setState(e){this._state!==e&&(this.hasState()&&this._unsubscribeFromState(),this._state=e,this.hasState()&&(this._subscribeToState(),this.updatePriceAxisWidgetsStates()))}getScreenshotData(e){var t,i,s,r;const n=[],o=[];let a,l=[];const c=this.state().sourcesByGroup().priceSources().slice().reverse(),h=this._chart.properties().childs().paneProperties.childs().legendProperties.childs();for(const d of c){const c=d.statusView();if((0,Z.isStudy)(d)&&(h.showLegend.value()||(null==e?void 0:e.showCollapsedStudies))){const s=h.showStudyTitles.value(),r=s;if(d.properties().childs().visible.value()&&c&&r){n.push(s?d.statusProvider(null==e?void 0:e.status).text():"");const r=R.enabled("use_last_visible_bar_value_in_legend")&&null!==(i=null===(t=this._chartModel().timeScale().visibleBarsStrictRange())||void 0===t?void 0:t.lastBar())&&void 0!==i?i:null,a=d.valuesProvider().getValues(r);o.push(a)}
}else if(d===this._chartModel().mainSeries()&&c&&h.showSeriesTitle.value()){a=d.statusProvider((null==e?void 0:e.status)||{}).text();const t=R.enabled("use_last_visible_bar_value_in_legend")&&null!==(r=null===(s=this._chartModel().timeScale().visibleBarsStrictRange())||void 0===s?void 0:s.lastBar())&&void 0!==r?r:null;l=d.valuesProvider().getValues(t)}}return{type:"pane",leftAxis:this._lhsPriceAxisesContainer.getScreenshotData(),rightAxis:this._rhsPriceAxisesContainer.getScreenshotData(),content:this._canvasBinding.canvasElement.toDataURL(),canvas:this._canvasBinding.canvasElement,contentWidth:this._size.width,contentHeight:this._size.height,studies:n,studiesValues:o,containsMainSeries:this.containsMainSeries(),mainSeriesText:a,mainSeriesValues:l}}updatePriceAxisWidgetsStates(){if(!this.hasState())return;const e=this._chartModel(),t=e.paneForSource(e.mainSeries());if(!t)return;const i=e.priceScaleSlotsCount(),s=this.state(),r=s.visibleLeftPriceScales(),n=s.visibleRightPriceScales();this._lhsPriceAxisesContainer.setScales(r,i.left,t.leftPriceScales().length,i.left+i.right),this._rhsPriceAxisesContainer.setScales(n,i.right,t.rightPriceScales().length,i.left+i.right)}updatePriceAxisWidgets(){this._lhsPriceAxisesContainer.update(),this._rhsPriceAxisesContainer.update()}update(){this.hasState()&&(this.updatePriceAxisWidgets(),null!==this._legendWidget&&this._legendWidget.update(),this.updateControls())}updateStatusWidget(e){this.hasState()&&null!==this._legendWidget&&(e.legendWidgetLayoutInvalidated()?this._legendWidget.updateLayout():this._legendWidget.update())}updateControls(){this.hasState()&&null!==this._paneControls&&this._paneControls.update()}updateThemedColors(e){this._themedTopColor=e.topColor,this._updateByThemedColors()}statusWidget(){return this._legendWidget}getElement(){return this._rowElement}canvasElement(){return this._canvasBinding.canvasElement}hasCanvas(e){return this._canvasBinding.canvasElement===e||this._topCanvasBinding.canvasElement===e}pinchStartEvent(){return null===this._paneWidgetsSharedState.scrollingPane()&&null===this._paneWidgetsSharedState.pinchingPane()&&(this._onTouchEvent(),!!this._options.handleScale.pinch&&(this._chartModel().stopTimeScaleAnimation(),this._prevPinchScale=1,this._pinching=!0,this._wasPinched=!0,this._paneWidgetsSharedState.setPinchingPane(this),!0))}pinchEvent(e,t,i,s){if(null!==this._paneWidgetsSharedState.scrollingPane()||this._paneWidgetsSharedState.pinchingPane()!==this)return;if(this._onTouchEvent(),!this._options.handleScale.pinch)return;const r=10*(s-this._prevPinchScale);this._prevPinchScale=s,this._chartModel().zoomTime(e.x,r,!0),this._prevPinchScale=s}pinchEndEvent(){null===this._paneWidgetsSharedState.scrollingPane()&&this._paneWidgetsSharedState.pinchingPane()===this&&(this._onTouchEvent(),this._pinching=!1,this._paneWidgetsSharedState.setPinchingPane(null))}mouseClickEvent(e){this._onMouseEvent(),this._mouseClickOrTapEvent(e)}tapEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._mouseClickOrTapEvent(e))}mouseDownEvent(e){
this._onMouseEvent(),this.hasState()&&this._mouseDownOrTouchStartEvent(e,this._dataSourceAtPoint(e.localX,e.localY))}touchStartEvent(e){if(this._paneWidgetsSharedState.startTouch(this),this._preventTouchEventsExceptPinch())return;const t=!this._trackCrosshairOnlyAfterLongTap&&null!==hi&&hi.stateId===this.state().id()&&Math.abs(hi.x-e.localX)+Math.abs(hi.y-e.localY)<5;this._onTouchEvent(),this._chart.setActivePaneWidget(this);const i=this._dataSourceAtPoint(e.localX,e.localY);if(t){const t=this._chartModel().crossHairSource();null!==i&&i.source===t||t.selectPointMode().value()!==Be.SelectPointMode.None?this.startTrackingMode(new Ae.Point(e.localX,e.localY),new Ae.Point(e.localX,e.localY)):!this._chart.readOnly()&&null!==i&&(0,Q.isLineTool)(i.source)&&i.source.userEditEnabled()&&this._chartUndoModel().selectionMacro((e=>{e.clearSelection(),e.addSourceToSelection(i.source,i.hittest.data())}))}this._mouseDownOrTouchStartEvent(e,i),this._mouseOrTouchMoveEvent(e)}mouseUpEvent(e){this._onMouseEvent(),this._mouseUpOrTouchEndEvent(e)}touchEndEvent(e){this._paneWidgetsSharedState.endTouch(this),this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._mouseOrTouchLeaveEvent(e),this._mouseUpOrTouchEndEvent(e))}mouseMoveEvent(e){this._onMouseEvent(),this._mouseOrTouchMoveEvent(e)}pressedMouseMoveEvent(e){this._onMouseEvent(),this._pressedMouseOrTouchMoveEvent(e)}touchMoveEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._pressedMouseOrTouchMoveEvent(e))}mouseLeaveEvent(e){this._onMouseEvent(),this._updateHoveredSource(null,new Ee.EnvironmentState(e)),this._mouseOrTouchLeaveEvent(e)}mouseDoubleClickEvent(e){this._onMouseEvent(),this._mouseDoubleClickOrDoubleTapEvent(e)}wheelClickEvent(e){if(this._chart.readOnly())return;const t=this._dataSourceAtPoint(e.localX,e.localY);if(null===t||t.isCustom)return;if((t.hittest.target()||0)<=ke.HitTarget.MovePointBackground)return;const i=new Ee.EnvironmentState(e),s=t.hittest.eraseMarker();if(i.mod()&&void 0!==s&&t.source.processErase)return void t.source.processErase(this._chartUndoModel(),s);const n=this._chartUndoModel();n.selection().isSelected(t.source)||n.selectionMacro((e=>{e.clearSelection();const i=(0,r.ensureNotNull)(t.source);e.addSourceToSelection(i,ni(t,i))})),this._chart.removeSelectedSources()}doubleTapEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._mouseDoubleClickOrDoubleTapEvent(e))}longTapEvent(e){if(null===this._state||this._preventTouchEventsExceptPinch())return;if(this._onTouchEvent(),this._longTap=!0,null!==this._startTrackPoint||!this._trackingModeShouldBeActive())return;const t=this._chartModel().selection();if(!t.isEmpty()){const i=this._dataSourceAtPoint(e.localX,e.localY);if(null!==i&&t.isSelected(i.source))return}this.startTrackingMode(new Ae.Point(e.localX,e.localY),new Ae.Point(e.localX,e.localY),new Ee.EnvironmentState(e))}mouseEnterEvent(e){if(this._onMouseEvent(),!this.hasState())return;this._chart.setActivePaneWidget(this);const t=this._dataSourceAtPoint(e.localX,e.localY)
;this._updateHoveredSource(t,new Ee.EnvironmentState(e)),this.setCursorPosition(e.localX,e.localY,new Ee.EnvironmentState(e))}contextMenuEvent(e){this._onMouseEvent(),this._contextMenuEvent(e)}touchContextMenuEvent(e){this._preventTouchEventsExceptPinch()||(this._onTouchEvent(),this._contextMenuEvent(e))}mouseDownOutsideEvent(e){this._processOutsideClick(null,e)}touchStartOutsideEvent(e){this._processOutsideClick(null,e)}cancelZoom(){this._chartModel().crossHairSource().clearSelection(),this._firstZoomPoint=null,this._preventCrossHairMove()&&this._clearCursorPosition()}startTrackingMode(e,t,i){this._startChangeLineToolParams=null,this._startMoveSourceParams=null,this._currentChangingLineToolHitTest=null,this._currentMovingHitTest=null,this._chartUndoModel().selectionMacro((e=>e.clearSelection())),this._startTrackPoint=e,this._exitTrackingModeOnNextTry=!1,this.setCursorPosition(t.x,t.y,i),this._initCrossHairPosition=this._chartModel().crossHairSource().currentPoint()}setDragToAnotherPaneCursor(){this._setCursorClassName("grabbing")}cloneLineTools(e,t){return this._chartUndoModel().cloneLineTools(e,t)}exitTrackingMode(){null!==this._state&&null!==this._startTrackPoint&&(this._exitTrackingModeOnNextTry=!0,this._tryExitTrackingMode())}trackingModeEnabled(){return null!==this._state&&null!==this._startTrackPoint}addCustomWidgetToLegend(e,t){this._options.legendWidgetEnabled&&(this._customLegendWidgetsFactoryMap.set(e,t),null!==this._legendWidget&&this._legendWidget.addCustomWidgetToLegend(e,t))}containsMainSeries(){return!!this.hasState()&&this.state().containsMainSeries()}paint(e){if(!this._chartUndoModel()||!this.hasState()||0===this._size.width||0===this._size.height)return;(0,U.tryApplySuggestedCanvasBitmapSize)(this._canvasBinding),(0,U.tryApplySuggestedCanvasBitmapSize)(this._topCanvasBinding),this._state&&(e.priceScaleSideMaxLevel("left")>ue.InvalidationLevel.Cursor||e.priceScaleSideMaxLevel("right")>ue.InvalidationLevel.Cursor)&&(this._recalculatePriceScales((0,Gt.viewportChangeEvent)()),null!==hi&&hi.stateId===this.state().id()&&this.setCursorPosition(hi.x,hi.y,hi.envState));const t=e.fullInvalidation();if(t>ue.InvalidationLevel.Cursor&&null!==hi&&hi.stateId===this.state().id()){const e=this._dataSourceAtPoint(hi.x,hi.y);this._updateHoveredSource(e,(0,j.globalEnvironmentState)())}if(this._lhsPriceAxisesContainer.paint(e.getterForPriceScaleInvalidationLevelBySide("left")),this._rhsPriceAxisesContainer.paint(e.getterForPriceScaleInvalidationLevelBySide("right")),t===ue.InvalidationLevel.None)return;const i=this._state&&(this._state.maximized().value()||!this._state.collapsed().value());if(t>ue.InvalidationLevel.Cursor){const e=(0,r.ensureNotNull)(this._canvasBinding.canvasElement.getContext("2d"));e.setTransform(1,0,0,1,0,0),this._makeSureIsUpdated();const t=this._canvasRenderParams();this._drawBackground(e,t),i&&this._drawSources(e,t)}if(null!==this._state){const e=(0,r.ensureNotNull)(this._topCanvasBinding.canvasElement.getContext("2d"));e.setTransform(1,0,0,1,0,0);const t=this._topCanvasRenderParams()
;e.clearRect(0,0,Math.ceil(this._size.width*t.pixelRatio),Math.ceil(this._size.height*t.pixelRatio)),i&&this._drawTopViews(e,t),this._drawCrossHair(e,t),i&&this._drawActiveLineTools(e,t)}}cancelCreatingLineTool(){const e=this._chartUndoModel(),t=this._chartUndoModel().lineBeingCreated();if(t)if(t.pointsCount()<=0&&!(0,Ot.isLineDrawnWithPressedButton)(t.toolname)){const i=t.points();if(i.length>2){const s=i[i.length-2];e.continueCreatingLine(s),this._finishTool(t)}else e.cancelCreatingLine()}else e.cancelCreatingLine();null!==this._firstZoomPoint&&this.cancelZoom(),this.setCursorForTool()}drawRightThere(e){if((0,Ot.isLineToolName)(e)&&this.hasState()){const t=this._chartUndoModel(),i=t.crossHairSource(),s=t.model().magnet().align(i.price,i.index,this.state());t.createLineTool({pane:this.state(),point:{index:i.index,price:s},linetool:e})}}cancelMeasuring(){this._chartUndoModel().crossHairSource().clearMeasure(),(0,Be.resetToCursor)(),this.setCursorForTool()}async setErrorMessage(e){var t,i,s;e&&!this._errorRenderer&&(this._errorRenderer=this._createErrorBlock()),null===(t=await this._errorRenderer)||void 0===t||t.update({message:null==e?void 0:e.message,icon:(null===(i=this._state)||void 0===i?void 0:i.containsMainSeries())||(null===(s=this._state)||void 0===s?void 0:s.maximized().value())?null==e?void 0:e.icon:void 0,backgroundColor:`linear-gradient(${this._chartModel().backgroundTopColor().value()}, ${this._chartModel().backgroundColor().value()})`,textColor:this._chartModel().dark().value()?Zt:Kt,solutionId:null==e?void 0:e.solutionId})}collapsedHeight(){var e,t;return Math.max(Math.ceil(null!==(t=null===(e=this._paneControls)||void 0===e?void 0:e.bottomWithMargin())&&void 0!==t?t:0),33)}setCursorPosition(e,t,i){this._updateLastCrosshairPosition(e,t,i),this._chartModel().setAndSaveCurrentPosition(this._correctXCoord(e),this._correctYCoord(t),this.state(),i)}_topCanvasRenderParams(){return{pixelRatio:(0,U.getBindingPixelRatio)(this._topCanvasBinding),physicalWidth:this._topCanvasBinding.canvasElement.width,physicalHeight:this._topCanvasBinding.canvasElement.height,cssWidth:this._chartModel().timeScale().width(),cssHeight:this.height()}}_canvasRenderParams(){return{pixelRatio:(0,U.getBindingPixelRatio)(this._canvasBinding),physicalWidth:this._canvasBinding.canvasElement.width,physicalHeight:this._canvasBinding.canvasElement.height,cssWidth:this._chartModel().timeScale().width(),cssHeight:this.height()}}_tryExitTrackingMode(e){this._exitTrackingModeOnNextTry&&(this._startTrackPoint=null,e||this._clearCursorPosition())}_tryStartMeasure(e,t,i,s,r){return!(!(0,Be.toolIsMeasure)(Be.tool.value())||t.startMeasurePoint())&&(e.isTouch||this._preventCrossHairMove()||this.setCursorPosition(e.localX,e.localY,i),s=this._chartModel().magnet().align(s,r,this.state()),t.startMeasuring({price:s,index:r},this.state()),!0)}_tryFinishMeasure(e,t){if(t.startMeasurePoint()&&!t.endMeasurePoint()){let i=t.price;const s=t.index;return i=this._chartModel().magnet().align(i,s,this.state()),t.finishMeasure({price:i,index:s}),e.isTouch?(0,
Be.resetToCursor)():this._needResetMeasureLater=!0,this._preventCrossHairMove()&&this._clearCursorPosition(),!0}return!1}_tryStartZoom(e,t,i,s){const r=this._chart.model().model().zoomEnabled();if("zoom"===Be.tool.value()&&r){const r=this._chartUndoModel(),n=r.timeScale().indexToCoordinate(i)-.5*r.timeScale().barSpacing();return this._firstZoomPoint={price:t,index:i,x:n,y:e.localY},this._preventCrossHairMove()||this.setCursorPosition(e.localX,e.localY,s),this._chartModel().crossHairSource().startSelection(this.state()),!0}return!1}_finishZoom(e){const t=this.state(),i=t.defaultPriceScale(),s=(0,r.ensureNotNull)(t.mainDataSource()).firstValue(),n=i.coordinateToPrice(e.localY,(0,r.ensureNotNull)(s)),o=this._chartUndoModel(),a=Math.round(o.timeScale().coordinateToIndex(e.localX)),l=(0,r.ensureNotNull)(this._firstZoomPoint);a!==l.index&&o.zoomToViewport(l.index,a,l.price,n,t),this._chartModel().crossHairSource().clearSelection(),this._firstZoomPoint=null,(0,Be.resetToCursor)(),this._preventCrossHairMove()&&this._clearCursorPosition()}_tryFinishZoom(e){return null!==this._firstZoomPoint&&(this._finishZoom(e),!0)}_tryHandleEraserMouseDown(e,t){if(!("eraser"!==Be.tool.value()||e.isCustom||(i=e.source,i&&i.customization&&i.customization.disableErasing))){const i=this._chartUndoModel();if((0,Q.isLineTool)(e.source)||(0,Z.isStudy)(e.source)){const s=e.hittest.eraseMarker();return t.mod()&&void 0!==s&&e.source.processErase?e.source.processErase(i,s):i.removeSource(e.source,!1),!0}}var i;return!1}_tryStartChangingLineTool(e,t,i,s){var n,o,a;if(e.isTouch&&null!==this._startTrackPoint)return!1;const l=t.hittest;if((!e.isTouch||!this._preventSourceChange)&&l&&(0,Q.isLineTool)(t.source)&&l.target()===ke.HitTarget.ChangePoint){const c=this._chartUndoModel(),h=(0,r.ensure)(null===(n=this.state().mainDataSource())||void 0===n?void 0:n.firstValue()),d=(0,r.ensureNotNull)(t.source.priceScale()).coordinateToPrice(e.localY,h);c.selectionMacro((e=>{e.clearSelection(),e.addSourceToSelection(t.source,l.data())}));let u=d;t.source.priceScale()===c.mainSeries().priceScale()&&(u=c.model().magnet().align(d,s,this.state()));const p=null===(o=l.data())||void 0===o?void 0:o.nonDiscreteIndex;p&&(s=c.timeScale().coordinateToFloatIndex(e.localX));const _=null===(a=l.data())||void 0===a?void 0:a.pointIndex;return this._startChangeLineToolParams={source:t.source,startPoint:{index:s,price:u,nonDiscreteIndex:p},screenPoint:{x:e.localX,y:e.localY},pointIndex:_,envState:i},!0}return this._startChangeLineToolParams=null,!1}_tryStartCloning(e,t,i,s){if(i.mod()){const t=this._chartUndoModel().selection().dataSources().filter((e=>e.cloneable()));if(s&&s.cloneable()&&t.push(s),t.length>0)return this._clonningAtMoveLineTools=t.map((e=>e.id())),this._startCloningPoint=new Ae.Point(e.localX,e.localY),!0}return!1}_tryFinishClonning(e,t,i){const s=this._chartUndoModel(),n=this._chartModel();if(t.mod()&&this._clonningAtMoveLineTools){const o=new Ae.Point(e.localX,e.localY),a=(0,r.ensureNotNull)(this._startCloningPoint).subtract(o).length(),l=[]
;for(const e of this._clonningAtMoveLineTools){const t=n.dataSourceForId(e);null!==t&&l.push(t)}if(0===l.length)return!1;if(a>8){const n=this.cloneLineTools(l,!0).map((e=>(0,r.ensureNotNull)(s.model().dataSourceForId(e))));s.selectionMacro((e=>{e.clearSelection();let t=null;n.forEach((s=>{null===t&&(t=ni(i,s)),e.addSourceToSelection(s,t)}))}));const o=new Ae.Point(e.localX,e.localY),a=(0,r.ensureNotNull)(n[0].priceScale()),c=(0,r.ensureNotNull)(this.state().mainDataSource()).firstValue(),h={index:s.timeScale().coordinateToIndex(e.localX),price:a.coordinateToPrice(e.localY,(0,r.ensureNotNull)(c))};s.startMovingSources(n,{logical:h,screen:o},null,t),this._clonningAtMoveLineTools=null,this._startCloningPoint=null}return!0}return!1}_mouseDownEventForLineTool(e,t,i,s){var n,o;const a=Be.tool.value();if(!this.hasState()||(0,Ot.isLineToolDrawWithoutPoints)(a))return;const l=this._chartUndoModel();let c=!1,h=null;(0,Be.hideAllDrawings)().value()&&(0,S.toggleHideMode)(),(0,Be.lockDrawings)().setValue(!1),e.isTouch&&!e.stylus&&((0,Ot.isLineToolName)(a)&&!(0,Ot.isLineDrawnWithPressedButton)(a)||l.lineBeingCreated())&&this._initToolCreationModeParams(e);const d=l.lineBeingCreated();if(d&&!(0,Ot.isLineDrawnWithPressedButton)(d.toolname)){const a=(0,r.ensure)(null===(n=d.ownerSource())||void 0===n?void 0:n.firstValue());if(e.isTouch&&!e.stylus){if(!this._startTouchPoint){this._startTouchPoint=new Ae.Point(e.pageX,e.pageY);const t=d.points(),i=t[t.length-1],s=l.timeScale().indexToCoordinate(i.index),n=(0,r.ensureNotNull)(d.priceScale()).priceToCoordinate(i.price,a);return void(this._initCrossHairPosition=new Ae.Point(s,n))}}else if(!e.isTouch){h=d;const n=l.model().paneForSource(d);if(n!==this._state&&null!==n){const i=this._externalPaneXCoord(n,e.localX),s=this._externalPaneYCoord(n,e.localY);c=l.continueCreatingLine({index:Math.round(l.timeScale().coordinateToIndex(i)),price:(0,r.ensure)(null===(o=d.priceScale())||void 0===o?void 0:o.coordinateToPrice(s,a))},t)}else{const e=l.model().magnet().align(s,i,this.state());c=l.continueCreatingLine({index:i,price:e},t)}}}else if(!e.isTouch||e.stylus||(0,Ot.isLineDrawnWithPressedButton)(a)){const e={index:i,price:l.model().magnet().align(s,i,this.state())};h=l.createLineTool({pane:this.state(),point:e,linetool:a}),l.lineBeingCreated()||(c=!0)}const u=this._dataSourceAtPoint(e.localX,e.localY);h&&l.selectionMacro((e=>{e.addSourceToSelection((0,r.ensureNotNull)(h),null==u?void 0:u.hittest.data())})),c&&h&&(this._finishTool(h,u),e.preventDefault())}_handleSelectionMouseDownAndGetJustDeselectedSource(e,t,i){const s=this._chartUndoModel();let r=null;return(null===t||t.source.isSelectionEnabled())&&s.selectionMacro((s=>{!this._preventSourceChange&&null!==t&&(e.isTouch?t.hittest.target()>=ke.HitTarget.MovePointBackground:t.hittest.target()>ke.HitTarget.MovePointBackground)?(i.mod()||s.selection().isSelected(t.source)||s.clearSelection(),i.mod()&&s.selection().isSelected(t.source)?(r=t.source,s.removeSourceFromSelection(t.source)):s.addSourceToSelection(t.source,t.hittest.data()),
s.selection().allSources().length>1&&(0,d.trackEvent)("GUI","Multiselect","Click Select")):i.mod()||s.clearSelection()})),r}_processMouseMoveWhileZoom(e,t){this._preventCrossHairMove()||this.setCursorPosition(e.localX,e.localY,t)}_updateCommonTooltip(e,t){let i=null;if(null!==e&&null!==e.hittest){const t=e.hittest.data();t&&(i=t.tooltip||null)}if(null===this._prevTooltipData&&null===i)return;if(null===i||""===i.text)return this._prevTooltipData=null,void(0,Wt.hide)(t);if(this._prevTooltipData&&(0,Me.default)(i,this._prevTooltipData))return;this._prevTooltipData=i;const s=(0,C.clone)(i);if(void 0!==s.rect){const e=this._paneCell.getBoundingClientRect();s.rect.x+=e.left,s.rect.y+=e.top}(0,Wt.show)(s)}_setCursorPositionOnExternalPane(e,t,i,s){t=this._externalPaneXCoord(e,t),i=this._externalPaneYCoord(e,i);this._chart.paneByState(e).setCursorPosition(t,i,s)}_updateLastCrosshairPosition(e,t,i){const s=this.state().id();hi={x:e,y:t,envState:i,stateId:s}}_setCursorClassName(e){let t="";e&&(t="pane--cursor-"+e),this._currentCursorClassName!==t&&(this._currentCursorClassName&&this._paneCell.classList.remove(this._currentCursorClassName),t&&this._paneCell.classList.add(t),this._currentCursorClassName=t,this._paneCell.style.cursor)}_processMouseUpOrTouchEndHandler(e){const t=this._dataSourceAtPoint(e.localX,e.localY);null!==t&&t.hittest.tryCallMouseUpOrTouchEndHandler(e)}_crossHairShouldBeVisible(){const e=this._chartModel().crossHairSource();return(0,Ot.isLineToolName)(Be.tool.value())||(0,Be.toolIsMeasure)(Be.tool.value())||e.startMeasurePoint()&&!e.endMeasurePoint()||null!==this._firstZoomPoint||null!==this._chartModel().lineBeingEdited()||null!==this._chartModel().lineBeingCreated()}_clearCursorPosition(){hi=null,this._chartModel().clearCurrentPosition()}_dataSourceAtPoint(e,t){var i,s;if(!this.hasState())return null;const r={result:null},n=this._chartUndoModel();if((0,Ot.isLineToolName)(Be.tool.value())||null!==n.lineBeingCreated())return r.result;if(this._currentChangingLineToolHitTest)return this._currentChangingLineToolHitTest;const o=new Set;if(this._currentMovingHitTest&&this._currentMovingHitTest.sourceAtPoint.hittest.data()){if(!(null===(i=this._currentMovingHitTest.cancelledContainer)||void 0===i?void 0:i.cancelled))return this._currentMovingHitTest.sourceAtPoint;o.add(this._currentMovingHitTest.sourceAtPoint.source.id())}if(this._currentMovingHitTest&&this._currentMovingHitTest.sourceAtPoint.hittest.data()&&!(null===(s=this._currentMovingHitTest.cancelledContainer)||void 0===s?void 0:s.cancelled))return this._currentMovingHitTest.sourceAtPoint;const a=this.state(),l=a.height(),c=a.width();this._makeSureIsUpdated();const h=oi.bind(null,r),d=this._canvasRenderParams(),u=new Ae.Point(e,t);if(!this.state().maximized().value()&&this.state().collapsed().value()||(0,pe.lastMouseOrTouchEventInfo)().isTouch&&(Be.activePointSelectionMode.value()!==Be.SelectPointMode.None||null!==this._startTrackPoint))return this._hitTestSources(d,[n.crossHairSource()],u,h,!1,o),r.result;const p=a.sourcesByGroup(),_=n.selection()
;this._hitTestSources(d,_.dataSources(),u,h,!1,o),this._hitTestSources(d,_.customSources(),u,h,!0,o),_.allSources().forEach((e=>o.add(e.id()))),this._hitTestSources(d,[n.crossHairSource()],u,h,!1,o),this._hitTestSources(d,a.customSources(De.CustomSourceLayer.Topmost),u,h,!0,o),this._hitTestSources(d,p.tradingSources(),u,h,!1,o),this._hitTestSources(d,a.customSources(De.CustomSourceLayer.Foreground),u,h,!0,o);const m=[...this._chartModel().multiPaneSources(a),...p.hitTestSources()];if(this._hitTestSources(d,m,u,h,!1,o),this.containsMainSeries()){const e=n.activeStrategySource().value();if(null!==e&&!o.has(e.id())){const t=e.strategyOrdersPaneView();if(null!==t){const i=t.renderer(l,c);if(null!==i){const t=i.hitTest(u,d);t&&oi(r,t,e,i,!1)}}}}return null===r.result&&this._hitTestSources(d,a.customSources(De.CustomSourceLayer.Background),u,h,!0,o),r.result}_hitTestSources(e,t,i,s,n,o){const a=(0,r.ensureNotNull)(this._state),l=a.height(),c=a.width();for(let r=t.length-1;r>=0;--r){const h=t[r];if(o.has(h.id()))continue;const d=h.paneViews(a);if(null!==d&&0!==d.length)for(let t=d.length-1;t>=0;--t){const r=d[t].renderer(l,c);if(r&&r.hitTest){const t=r.hitTest(i,e);null!==t&&s(t,h,r,n)}}}}_tryStartMovingLineTool(e,t,i,s){var n;if(null===t.source||!t.source.movable()||null!==this._startTrackPoint)return!1;if(!this._preventSourceChange){const o=this._chartUndoModel(),a=(0,r.ensureNotNull)((0,r.ensureNotNull)(this._state).mainDataSource()).firstValue(),l=(0,r.ensureNotNull)(t.source.priceScale()).coordinateToPrice(e.localY,(0,r.ensureNotNull)(a));let c=(t.source.isSelectionEnabled()?o.selection().allSources():[t.source]).filter(zt);const h=c.filter(Q.isLineTool);c=h.length>0?h:c.includes(t.source)?[t.source]:[c[0]];const d=new Ae.Point(e.localX,e.localY),u={index:s,price:l},p=null===(n=t.hittest.data())||void 0===n?void 0:n.activeItem;return this._startMoveSourceParams={source:c,startPoint:{logical:u,screen:d},activeItem:void 0===p?null:p,envState:i},!0}return this._startMoveSourceParams=null,!1}_chartModel(){return this._chart.model().model()}_chartUndoModel(){return this._chart.model()}_externalPaneXCoord(e,t){t+=this._div.getBoundingClientRect().left+document.body.scrollLeft;const i=(0,r.ensureNotNull)(this._chart.paneByState(e)),s=i._div.getBoundingClientRect().left+document.body.scrollLeft;return i._correctXCoord(t-s)}_externalPaneYCoord(e,t){t+=this._div.getBoundingClientRect().top+document.body.scrollTop;const i=(0,r.ensureNotNull)(this._chart.paneByState(e)),s=i._div.getBoundingClientRect().top+document.body.scrollTop;return i._correctYCoord(t-s)}_correctXCoord(e){return Math.max(0,Math.min(e,this._size.width-1))}_correctYCoord(e){return Math.max(0,Math.min(e,this._size.height-1))}_processScroll(e){if(!this._chart.model().model().scrollEnabled())return;const t=performance.now();this._startScrollingPos||this._preventScroll()||(this._startScrollingPos={x:e.clientX,y:e.clientY,timestamp:t,localX:e.localX,localY:e.localY});const i=this._chartUndoModel(),s=this._chartModel().timeScale()
;let r=this.state().defaultPriceScale();if(this._startScrollingPos&&!this._isScrolling&&(this._startScrollingPos.x!==e.clientX||this._startScrollingPos.y!==e.clientY)){if(i.beginUndoMacro(Xt,!0),null===this._scrollXAnimation&&this._options.useKineticScroll){const e=s.barSpacing();this._scrollXAnimation=new Et(.2/e,7/e,.997,15/e),this._scrollXAnimation.addPosition(s.rightOffset(),this._startScrollingPos.timestamp)}return i.selection().isEmpty()||(r=i.selection().allSources()[0].priceScale()),null===r||r.isEmpty()||(this._scrollPriceScale=r,i.startScrollPrice(this.state(),r,e.localY)),i.startScrollTime(e.localX),this._isScrolling=!0,this.setCursorForTool(),void this._paneWidgetsSharedState.setScrollingPane(this)}this._isScrolling&&(null!==this._scrollPriceScale&&i.scrollPriceTo(this.state(),this._scrollPriceScale,e.localY),i.scrollTimeTo(e.localX),null!==this._scrollXAnimation&&this._scrollXAnimation.addPosition(s.rightOffset(),t))}_finishScroll(){const e=this._chartUndoModel();e.endScrollTime(),null!==this._scrollPriceScale&&e.endScrollPrice(this.state(),this._scrollPriceScale),e.endUndoMacro(),this._isScrolling=!1,this._startScrollingPos=null,this._scrollPriceScale=null,this.setCursorForTool(),this._paneWidgetsSharedState.setScrollingPane(null)}_endScroll(e){if(!this._isScrolling)return!1;this._finishScroll();const t=this._scrollUndoCommandInStack(),i=performance.now(),s=this._chartUndoModel().timeScale();return null!==this._scrollXAnimation&&(this._scrollXAnimation.start(s.rightOffset(),i),this._scrollXAnimation.finished(i)||(this._chartModel().setTimeScaleAnimation(this._scrollXAnimation),this._scrollXAnimation=null)),t}_preventScroll(){return this._trackCrosshairOnlyAfterLongTap&&this._longTap||this._contextMenuOpenedOnLastTap||(0,Ot.isLineToolName)(Be.tool.value())||Boolean(this._chartUndoModel().lineBeingCreated())||null!==this._startTrackPoint||this._preventScrollUntilNextMouseDownOrTouchStart}_isSelectPointModeEnabled(){return this._chartUndoModel().crossHairSource().selectPointMode().value()!==Be.SelectPointMode.None}_preventCrossHairMove(){return!!this._trackCrosshairOnlyAfterLongTap&&(null===this._chart.trackingModePaneWidget()&&(!!this._contextMenuOpenedOnLastTap||!this._crossHairShouldBeVisible()&&null===this._startTrackPoint))}_finishTool(e,t=null){const i=this._chartUndoModel(),s=e.toolname;if(s===Be.tool.value()&&(0,Be.resetToCursor)(),this._preventCrossHairMove()&&this._clearCursorPosition(),i.selectionMacro((i=>{i.addSourceToSelection(e,ni(t,e))})),(0,Ot.isTextToolName)(s)){const t=i.createUndoCheckpoint();this._chart.showChartPropertiesForSource(e,Y.TabNames.text,void 0,t).then((e=>{0}))}this._lastFinishedToolId=e.id(),(0,a.emit)("drawing_event",e.id(),"create"),(0,Nt.trackDrawingCreated)(e)}_alignSourcesThatBeingMoved(e,t,i,s){const r=this._chartUndoModel(),n=r.timeScale().coordinateToIndex(t);r.model().sourcesBeingMoved().forEach((e=>{var o;let a=n,l=e.convertYCoordinateToPriceForMoving(i,this.state().mainDataSource());if(null!==l){if((0,Z.isStudy)(e)){
const e=r.mainSeries(),t=e.bars().firstIndex(),i=e.bars().lastIndex();null!==t&&null!==i&&(a=Math.min(Math.max(n,t),i)),l=this._chartModel().magnet().align(l,n,this.state())}null!==this._currentMovingHitTest&&void 0!==(null===(o=this._currentMovingHitTest.sourceAtPoint.hittest.data())||void 0===o?void 0:o.cursorType)||this.setCursorForTool(),r.moveSources({screen:new Ae.Point(t,i),logical:{index:a,price:l}},s)}}))}_resetMeasureIfRequired(){this._needResetMeasureLater&&((0,Be.resetToCursor)(),this._needResetMeasureLater=!1)}_makeSureIsUpdated(){var e;const t=this.state(),i=[...t.dataSources(),...t.customSources()],s=t.height(),r=t.width();for(const n of i){const i=n.paneViews(t);if(null!==i)for(const t of i)null===(e=t.makeSureIsUpdated)||void 0===e||e.call(t,s,r)}}_drawBackground(e,t){const i=Math.ceil(t.pixelRatio*this._size.width),s=Math.ceil(t.pixelRatio*this._size.height),r=this._chartModel(),n=r.backgroundTopColor().value(),o=r.backgroundColor().value();n===o?(0,U.clearRect)(e,0,0,i+1,s+1,o):(0,Ne.clearRectWithGradient)(e,0,0,i+1,s+1,n,o)}_drawWatermark(e,t){const i=this._chartModel().watermarkSource();if(null===i)return;const s=this.state();if(!s.containsMainSeries())return;const r=i.paneViews(),n=s.height(),o=s.width();for(const i of r){e.save();const s=i.renderer(n,o);s&&s.draw(e,t),e.restore()}}_drawCrossHair(e,t){const i=this._chartUndoModel().crossHairSource();i.invalidateLockPosition(),i.visible||null===Be.crosshairLock.value()||i.updateAllViews((0,Gt.sourceChangeEvent)(i.id())),this._drawSourceImpl(e,t,ti,ei,i)}_drawActiveLineTools(e,t){const i=this._chartModel(),s=[i.lineBeingCreated(),i.lineBeingEdited(),...i.sourcesBeingMoved(),i.customSourceBeingMoved()].filter((e=>!!e));for(const r of s){(i.paneForSource(r)===this.state()||(0,Ve.isDataSource)(r)&&r.isMultiPaneEnabled())&&this._drawSourceImpl(e,t,ti,ei,r)}}_drawTopViews(e,t){for(const i of this.state().sourcesByGroup().all())i.topPaneViews&&this._drawSourceImpl(e,t,ii,ei,i)}_drawSources(e,t){const i=this.state(),s=i.model(),r=i.sourcesByGroup(),n=r.tradingSources(),o=[...s.multiPaneSources(i),...r.generalSources()],a=r.phantomSources(),l=i.customSources(De.CustomSourceLayer.Background).slice(),c=i.customSources(De.CustomSourceLayer.Foreground).slice(),h=i.customSources(De.CustomSourceLayer.Topmost).slice(),d=s.activeStrategySource().value();{const e=s.panes();for(let t=e.length-1;t>=0;t--)e[t].createDrawingsCaches()}this._drawSourceImpl(e,t,ti,ei,s.gridSource()),this._drawWatermark(e,t);for(const i of l)this._drawSourceImpl(e,t,ti,Qt,i);for(const i of o)this._drawSourceImpl(e,t,ti,Qt,i);for(const i of c)this._drawSourceImpl(e,t,ti,Qt,i);for(const i of a)this._drawSourceImpl(e,t,ti,Qt,i);const u=new Set;[s.lineBeingCreated(),s.lineBeingEdited(),...s.sourcesBeingMoved(),s.customSourceBeingMoved()].filter(C.notNull).forEach((e=>u.add(e.id())));let p=s.hoveredSource();null!==p&&((0,Ve.isDataSource)(p)&&!p.showOnTopOnHovering()||u.has(p.id())||(0,Ve.isDataSource)(p)&&!o.includes(p)?p=null:u.add(p.id()));const _=s.selection().allSources().filter((e=>!((0,
Ve.isDataSource)(e)&&!o.includes(e))&&!u.has(e.id())));_.forEach((e=>u.add(e.id())));for(const i of l)this._drawSourceImpl(e,t,ti,ei,i,u);for(const i of o)this._drawSourceImpl(e,t,ti,ei,i,u);for(const i of c)this._drawSourceImpl(e,t,ti,ei,i,u);d&&this.containsMainSeries()&&this._drawSourceImpl(e,t,ri,ei,d,u);for(const i of n)this._drawSourceImpl(e,t,ti,Qt,i);for(const i of h)this._drawSourceImpl(e,t,ti,Qt,i);for(const i of o)this._drawSourceImpl(e,t,si,ei,i,u);for(const i of c)this._drawSourceImpl(e,t,si,ei,i,u);for(const i of n)this._drawSourceImpl(e,t,ti,ei,i,u);for(const i of h)this._drawSourceImpl(e,t,ti,ei,i,u);for(const i of _)this._drawSourceImpl(e,t,ti,ei,i),i===d&&this.containsMainSeries()&&this._drawSourceImpl(e,t,ri,ei,d);for(const i of _)this._drawSourceImpl(e,t,si,ei,i);p&&(this._drawSourceImpl(e,t,ti,ei,p),p===d&&this.containsMainSeries()&&this._drawSourceImpl(e,t,ri,ei,d),this._drawSourceImpl(e,t,si,ei,p));for(const i of a)this._drawSourceImpl(e,t,ti,ei,i,u);{const e=s.panes();for(let t=e.length-1;t>=0;t--)e[t].clearDrawingCaches()}}_drawSourceImpl(e,t,i,s,r,n){if(n&&n.has(r.id()))return;const o=this.state(),a=o.height(),l=o.width(),c=i(r,this.state());if(c)for(const i of c){const r=i.renderer(a,l);r&&(e.save(),s(r,e,t),e.restore())}}_updateByThemedColors(){null!==this._legendWidget&&this._legendWidget.updateThemedColors(this._themedTopColor),null!==this._paneControls&&this._paneControls.updateThemedColors(this._themedTopColor)}_scrollUndoCommandInStack(){const e=this._chartUndoModel().undoHistory().undoStack();if(e.isEmpty())return!1;const t=e.head();if(!(t instanceof Re.UndoMacroCommand))return!1;if(t.isEmpty())return!1;const i=t.commands()[0];return i instanceof Bt.PriceScaleChangeUndoCommand||i instanceof Vt.TimeScaleChangeUndoCommand}_onStateDestroyed(){this.setState(null)}_onDataSourcesCollectionChanged(){this._startMoveSourceParams=null}_processMouseEnterLeaveMoveHandlers(e,t){var i,s,r,n;null===this._prevHoveredHittest||this._prevHoveredHittest.renderer===(null==e?void 0:e.renderer)&&(null===(i=this._prevHoveredHittest.hittest.data())||void 0===i?void 0:i.activeItem)===(null===(s=e.hittest.data())||void 0===s?void 0:s.activeItem)||((0,ke.tryCallHandler)(t,null===(r=this._prevHoveredHittest.hittest.data())||void 0===r?void 0:r.mouseLeaveHandler),this._prevHoveredHittest=null),t.isTouch||null!==e&&((null===(n=this._prevHoveredHittest)||void 0===n?void 0:n.renderer)!==e.renderer&&(e.hittest.tryCallMouseEnterHandler(t),this._prevHoveredHittest=e),e.hittest.tryCallMouseMoveHandler(t))}_startChangeOrMoveLineToolIfNeeded(){if(null!==this._startChangeLineToolParams){const e=this._startChangeLineToolParams;this._chartUndoModel().startChangingLinetool(e.source,e.startPoint,e.pointIndex,e.envState)}if(null!==this._startMoveSourceParams){const e=this._startMoveSourceParams;this._chartUndoModel().startMovingSources(e.source,e.startPoint,e.activeItem,e.envState)}this._startMoveSourceParams=null,this._startChangeLineToolParams=null}_trackingModeShouldBeActive(){
return!(!this._trackCrosshairOnlyAfterLongTap||this._contextMenuOpenedOnLastTap||this._crossHairShouldBeVisible())&&this._longTap}_processOutsideClick(e,t){var i;let s=null;const r=this._chartModel();if(null!==e&&(s=e.isCustom?r.customSourceName(e.source):e.source.id()),null!==this._lastClickedSource&&this._lastClickedSource.id!==s){const e=this._lastClickedSource.id;let i=this._lastClickedSource.isCustom?r.customSourceForName(e):r.dataSourceForId(e);null!==i||this._lastClickedSource.isCustom||(i=r.dataSourceForId(e)),null!==i&&i.onClickOutside&&(i.onClickOutside(t),this._chartModel().updateSource(i))}this._lastClickedSource=null!==s?{id:s,isCustom:null!==(i=null==e?void 0:e.isCustom)&&void 0!==i&&i}:null}_mouseClickOrTapEvent(e){var t;if(!this.hasState())return;const i=this._dataSourceAtPoint(e.localX,e.localY),s=i&&i.source,n=this._chartUndoModel(),o=Boolean(null===(t=null==i?void 0:i.hittest.data())||void 0===t?void 0:t.hideCrosshairLinesOnHover);this._processOutsideClick(i,e),!this._isSelectPointModeEnabled()||o||e.isTouch&&this.trackingModeEnabled()&&!this._exitTrackingModeOnNextTry||n.crossHairSource().trySelectCurrentPoint(),null!==i&&i.hittest.tryCallClickOrTapHandler(e)&&n.model().updateSource((0,r.ensureNotNull)(s)),!e.isTouch||this._isSelectPointModeEnabled()||i&&i.source===n.crossHairSource()||this._tryExitTrackingMode(),s&&(0,Q.isLineTool)(s)&&this._lastFinishedToolId!==s.id()&&(0,a.emit)("drawing_event",s.id(),"click"),this._resetMeasureIfRequired()}_mouseDownOrTouchStartEvent(e,t){var i,s,n,o,l,c;if(this._pressedMoveStage=1,this._preventScrollUntilNextMouseDownOrTouchStart=!1,e.isTouch&&(this._longTap=!1,this._exitTrackingModeOnNextTry=null!==this._startTrackPoint,this._paneWidgetsSharedState.clearDraggingSource()),this._contextMenuOpenedOnLastTap=!1,this._lastFinishedToolId=null,this._chartModel().stopTimeScaleAnimation(),e.isTouch&&this._switchTrackingModeFromAnotherPaneIfNeeded(e),document.activeElement!==document.body&&document.activeElement!==document.documentElement)document.activeElement&&document.activeElement.blur?document.activeElement.blur():document.body.focus();else{const e=document.getSelection();null!==e&&e.removeAllRanges()}(0,a.emit)("mouse_down",{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY}),this._updateCommonTooltip(null);const h=this._chartUndoModel(),d=new Ee.EnvironmentState(e);h.mainSeries().clearGotoDateResult();const u=this.state().defaultPriceScale();if(u.isEmpty()||h.timeScale().isEmpty())return;const p=h.crossHairSource();if(!e.isTouch&&!(0,Ot.isLineDrawnWithPressedButton)(Be.tool.value())){const t=h.lineBeingCreated(),i=null!==t?h.model().paneForSource(t):null;null!==i&&i!==this._state?this._setCursorPositionOnExternalPane(i,e.localX,e.localY,d):this.setCursorPosition(e.localX,e.localY,d)}e.isTouch&&(0,Ot.isLineToolName)(Be.tool.value())&&((0,Ot.isLineDrawnWithPressedButton)(Be.tool.value())||null!==p.pane?(0,
Ot.isLineDrawnWithPressedButton)(Be.tool.value())&&this._clearCursorPosition():this._chart.updateCrossHairPositionIfNeeded());const _=(0,r.ensureNotNull)(this.state().mainDataSource()).firstValue();if(null===_)return void(this._chart.readOnly()||(this._handleSelectionMouseDownAndGetJustDeselectedSource(e,t,d),null!==t&&(0,Rt.isPriceDataSource)(t.source)&&t.source.isDraggable()&&this._paneWidgetsSharedState.trySetDraggingSource(t.source,this)));let m=u.coordinateToPrice(e.localY,_),g=this._chartModel().timeScale().coordinateToIndex(e.localX);if(p.startMeasurePoint()&&p.endMeasurePoint()&&p.clearMeasure(),d.shift()&&(null===t||!(null===(s=null===(i=t.hittest.data())||void 0===i?void 0:i.hasOwnShortcutsBehaviourFor)||void 0===s?void 0:s.shiftKey))&&(0,Be.toolIsCursor)(Be.tool.value())&&h.selection().isEmpty()&&Be.tool.setValue("measure"),(e.isTouch&&!e.stylus||!this._tryStartMeasure(e,p,d,m,g))&&(e.isTouch&&!e.stylus||!this._tryFinishMeasure(e,p))&&!this._tryFinishZoom(e)&&!this._tryStartZoom(e,m,g,d)){if(e.isTouch&&(null!==this._startTrackPoint?(this._initCrossHairPosition=p.currentPoint(),this._startTrackPoint=new Ae.Point(e.localX,e.localY)):this._isSelectPointModeEnabled()&&null===this._chart.trackingModePaneWidget()&&this.startTrackingMode(new Ae.Point(e.localX,e.localY),new Ae.Point(e.localX,e.localY),new Ee.EnvironmentState(e))),e.isTouch&&(this._preventSourceChange=null===t||!h.selection().isSelected(t.source)),!this._isSelectPointModeEnabled()&&!this._isScrolling){if(e.isTouch&&!e.stylus&&((0,Be.toolIsMeasure)(Be.tool.value())||null!==p.measurePane().value()))return void this._initToolCreationModeParams(e);if((0,Ot.isLineToolName)(Be.tool.value())||h.lineBeingCreated())return d.shift()||h.selectionMacro((e=>e.clearSelection())),void this._mouseDownEventForLineTool(e,d,g,m)}if(null!==t&&t.hittest.tryCallMouseDownOrTouchStartHandler(e),!this._chart.readOnly()){const i=this._handleSelectionMouseDownAndGetJustDeselectedSource(e,t,d);if(null!==t&&!this._preventSourceChange){const i=t.hittest.data();if(t.isCustom){if(t.hittest.hasPressedMoveHandler(e))return h.model().setMovingCustomSource(t.source,i),this._preventScrollUntilNextMouseDownOrTouchStart=!0,this._currentMovingHitTest={sourceAtPoint:t,cancelledContainer:null!==(n=h.model().customSourceMovingHitTestData())&&void 0!==n?n:void 0},void h.selectionMacro((e=>{e.clearSelection(),e.addSourceToSelection((0,r.ensureNotNull)(t.source),(0,r.ensureNotNull)(i))}))}else if((null==i?void 0:i.areaName)===ke.AreaName.SourceItemMove){const s=null==i?void 0:i.activeItem;if(void 0!==s)return h.startCustomMoving(t.source,s,e),this._currentMovingHitTest={sourceAtPoint:t},void h.selectionMacro((e=>{e.clearSelection(),e.addSourceToSelection((0,r.ensureNotNull)(t.source),(0,r.ensureNotNull)(i))}))}}if(null!==t&&this._tryHandleEraserMouseDown(t,d))return;const s=null!==t&&(0,Q.isLineTool)(t.source)&&t.source.isLocked&&t.source.isLocked();if(!((0,Be.lockDrawings)().value()||s)&&null!==t&&!t.isCustom){if(!t.source.userEditEnabled())return
;const s=null===(o=t.hittest.data())||void 0===o?void 0:o.snappingPrice,n=null===(l=t.hittest.data())||void 0===l?void 0:l.snappingIndex;let a=e.localY,h=e.localX;if(void 0!==s&&(a=(0,r.ensure)(null===(c=t.source)||void 0===c?void 0:c.priceScale()).priceToCoordinate(s,_),m=s),void 0!==n&&(h=this._chartModel().timeScale().indexToCoordinate(n),g=n),a===e.localY&&h===e.localX||(e={...e,localY:a,localX:h},this.setCursorPosition(e.localX,e.localY,d)),this._tryStartChangingLineTool(e,t,d,g))return void(this._currentChangingLineToolHitTest=t);if(this._currentChangingLineToolHitTest=null,(f=t.hittest.target())===ke.HitTarget.MovePoint||f===ke.HitTarget.MovePointBackground&&(0,pe.lastMouseOrTouchEventInfo)().isTouch){if(this._tryStartCloning(e,t,d,i))return;if(this._tryStartMovingLineTool(e,t,d,g))return void(this._currentMovingHitTest={sourceAtPoint:t});this._currentMovingHitTest=null}}if(null!==t&&(0,Rt.isPriceDataSource)(t.source)&&t.source.isDraggable()&&this._paneWidgetsSharedState.trySetDraggingSource(t.source,this))return}var f;null!==t&&t.hittest.target()===ke.HitTarget.Regular||(this._processing=!0)}}_mouseUpOrTouchEndEvent(e){var t,i;if(!this.hasState())return;this._pressedMoveStage=0;const s=e.isTouch&&null!==this._startTrackPoint,n=e.isTouch&&this._wasPinched;e.isTouch&&(this._wasPinched=!1,this._longTap=!1),this._startMoveSourceParams=null,this._startChangeLineToolParams=null,this._currentChangingLineToolHitTest=null,this._currentMovingHitTest=null;const o=this._chartUndoModel(),l=o.model().customSourceMovingHitTestData();null!==l||o.customMoveBeingProcessed()||this._processMouseUpOrTouchEndHandler(e),this._isSelecting=!1;const c=o.model(),h=c.crossHairSource(),u=this._dataSourceAtPoint(e.localX,e.localY);if(h.selection()&&null===this._firstZoomPoint){const e=this.state().lineToolsForArea(h.selection());o.selectionMacro((t=>{let i=null;e.forEach((e=>{null===i&&(i=ni(u,e)),t.addSourceToSelection(e,i)}))})),h.clearSelection(),(0,d.trackEvent)("GUI","Multiselect","Area Select")}(0,a.emit)("mouse_up",{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY,screenX:e.screenX,screenY:e.screenY});const p=e.isTouch&&this._touchMove;e.isTouch&&(this._touchMove=!1);const _=new Ee.EnvironmentState(e),m=Be.tool.value();if(e.isTouch&&((0,Be.toolIsMeasure)(m)||null!==h.measurePane().value())){if(!p&&!e.stylus&&null===h.measurePane().value()&&h.pane!==this._state)return void this.setCursorPosition(e.localX,e.localY);if(!p&&!e.stylus&&this._tryStartMeasure(e,h,_,h.price,h.index))return;if((!p||e.stylus)&&this._tryFinishMeasure(e,h))return}if(e.isTouch&&!p&&!(0,Ot.isLineDrawnWithPressedButton)(m)&&(0,Ot.isLineToolName)(m)&&!o.lineBeingCreated()){if(this._chart.justActivated())return;if(h.pane!==this._state)return void this.setCursorPosition(e.localX,e.localY,_);const i=h.currentPoint(),s=this.state().defaultPriceScale(),n=(0,r.ensure)(null===(t=this.state().mainDataSource())||void 0===t?void 0:t.firstValue()),a={index:Math.round(o.timeScale().coordinateToIndex(i.x)),price:s.coordinateToPrice(i.y,n)},l=(0,
r.ensureNotNull)(o.createLineTool({pane:this.state(),point:a,linetool:m}));return o.selectionMacro((e=>{e.addSourceToSelection(l)})),o.lineBeingCreated()||(this._finishTool(l,u),e.preventDefault()),void(this._startTouchPoint=null)}const g=o.lineBeingCreated();if(g&&!(0,Ot.isLineDrawnWithPressedButton)(g.toolname)&&e.isTouch&&(this._startTouchPoint||e.stylus)){if(this._startTouchPoint=null,!p||e.stylus){const t=g.points()[g.points().length-1],i=o.continueCreatingLine({index:t.index,price:t.price},new Ee.EnvironmentState(e));this._initCrossHairPosition=null,i&&(this._finishTool(g,u),e.preventDefault())}return}if(null!==this._firstZoomPoint&&this._firstZoomPoint.draggingMode)return void this._finishZoom(e);if(this._processing=!1,o.customMoveBeingProcessed())return void o.endCustomMoving();if(null!==l&&(l.beingMoved&&!l.cancelled&&((0,ke.tryCallHandler)(e,l.mouseUpHandler,l.touchEndHandler),this.setCursorForTool()),c.setMovingCustomSource(null,null),di(e,l)))return;if(c.lineBeingEdited())return o.endChangingLinetool(!1),void(this._preventCrossHairMove()&&this._clearCursorPosition());if((0,Ot.isLineDrawnWithPressedButton)(m)&&!this._isSelectPointModeEnabled()){const t=o.lineBeingCreated();null!==t&&((0,Nt.trackDrawingCreated)(t),t.finish());const s=this.state().defaultPriceScale();if(s.isEmpty())return;if(!t)return;const n=(0,r.ensure)(null===(i=t.ownerSource())||void 0===i?void 0:i.firstValue()),a=s.coordinateToPrice(e.localY,n),l={index:Math.round(o.timeScale().coordinateToIndex(e.localX)),price:a};return void o.continueCreatingLine(l)}if(c.sourcesBeingMoved().length)return o.endMovingSource(!1,!1),c.sourcesBeingMoved().filter(Q.isLineTool).forEach((e=>{this.setCursorForTool(e)})),void c.invalidate(ue.InvalidationMask.cursor());if(!this._chart.readOnly()){const t=e.localX>=0&&e.localXke.HitTarget.MovePointBackground||(0,pe.lastMouseOrTouchEventInfo)().isTouch)&&o.selectionMacro((e=>{
e.clearSelection();const t=(0,r.ensureNotNull)(u.source);e.addSourceToSelection(t,ni(u,t))})),e.isTouch&&(this._touchMove=!1)}_mouseOrTouchMoveEvent(e){if(!this.hasState())return;this._resetMeasureIfRequired();const t=this._dataSourceAtPoint(e.localX,e.localY);this._processMouseEnterLeaveMoveHandlers(t,e);const i=this._chartUndoModel();if(!i)return;const s=e.localX,r=e.localY;this._prevMoveEventPosition=new Ae.Point(s,r);const n=new Ee.EnvironmentState(e);if(null===this._firstZoomPoint){if(this._updateHoveredSource(t,n,e),!e.isTouch&&i.lineBeingCreated()){const e=i.lineBeingCreated(),t=null===e?null:i.model().paneForSource(e);if(null!==t&&t!==this._state)return void this._setCursorPositionOnExternalPane(t,s,r,n)}e.isTouch||this.setCursorPosition(s,r,n)}else this._processMouseMoveWhileZoom(e,n)}_pressedMouseOrTouchMoveEvent(e){var t;if(!this.hasState()||this._pinching||e.isTouch&&this._contextMenuOpenedOnLastTap)return;this._pressedMoveStage=2,this._resetMeasureIfRequired(),this._startChangeOrMoveLineToolIfNeeded(),e.isTouch&&(this._touchMove=!0,this._preventSourceChange=!1);const i=new Ee.EnvironmentState(e),s=this._chartUndoModel(),n=s.crossHairSource(),o=e.localX,a=e.localY;if(this._prevMoveEventPosition=new Ae.Point(o,a),null!==this._firstZoomPoint)return this._processMouseMoveWhileZoom(e),void(this._firstZoomPoint.draggingMode=!0);const l=Be.tool.value();if(e.isTouch&&this._startTouchPoint&&(0,Ot.isLineToolName)(l)&&!(0,Ot.isLineDrawnWithPressedButton)(l)&&!s.lineBeingCreated()&&!this._isSelectPointModeEnabled())return void this._updateCrosshairPositionInToolCreationMode(e,this.state());const c=n.measurePane().value();if(e.isTouch&&(this._startTouchPoint||e.stylus)&&((0,Be.toolIsMeasure)(l)||null!==c))return void(e.stylus?this.setCursorPosition(e.localX,e.localY,new Ee.EnvironmentState(e)):this._updateCrosshairPositionInToolCreationMode(e,c||this.state()));const h=s.lineBeingCreated();if(e.isTouch&&!e.stylus&&h&&!(0,Ot.isLineDrawnWithPressedButton)(h.toolname)){if(this._startTouchPoint){const t=(0,r.ensureNotNull)(s.lineBeingCreated()),i=(0,r.ensureNotNull)(s.model().paneForSource(t));this._updateCrosshairPositionInToolCreationMode(e,i)}return}if(e.isTouch&&null!==this._startTrackPoint){this._exitTrackingModeOnNextTry=!1;const e=(0,r.ensureNotNull)(this._initCrossHairPosition),t=new Ae.Point(o,a).subtract(this._startTrackPoint),s=e.add(t);this.setCursorPosition(s.x,s.y,i)}else e.isTouch&&this._preventCrossHairMove()||this.setCursorPosition(o,a,i);const d=this._isSelectPointModeEnabled();if((0,Ot.isLineToolName)(l)&&!(0,Ot.isLineDrawnWithPressedButton)(l)&&!d&&!i.mod())return;if((0,Ot.isLineDrawnWithPressedButton)(l)&&!d){const i=this.state().defaultPriceScale();if(i.isEmpty())return;const n=s.lineBeingCreated();if(!n)return;const o=new Ae.Point(e.localX,e.localY),a=(0,r.ensure)(null===(t=n.ownerSource())||void 0===t?void 0:t.firstValue());return o.price=i.coordinateToPrice(e.localY,a),o.index=Math.round(s.timeScale().coordinateToIndex(e.localX)),void s.continueCreatingLine(o)}
if(null!==this._paneWidgetsSharedState.draggingSource()){const t=e.target,i=this._chart.paneByCanvas(t);i&&(i!==this?i.setDragToAnotherPaneCursor():i.setCursorForTool());const s=this._chart.timeAxisByCanvas(t);s&&s.setCursor("grabbing")}if(s.timeScale().isEmpty())return;const u=this._options.handleScroll;if((!u.pressedMouseMove||e.isTouch)&&(!u.horzTouchDrag&&!u.vertTouchDrag||!e.isTouch))return;if(s.customMoveBeingProcessed())return void s.processCustomMove(e);const p=s.model().customSourceMovingHitTestData();if(null!==p&&(this._updateCommonTooltip(null,!0),p.cancelled||(s.model().processingCustomSourceMove(),(0,ke.tryCallHandler)(e,p.pressedMouseMoveHandler,p.touchMoveHandler)),di(e,p)))return;if(s.model().lineBeingEdited())return void this.setCursorPosition(o,a,i);if(s.model().sourcesBeingMoved().length)return void this._alignSourcesThatBeingMoved(s.model().sourcesBeingMoved(),e.localX,e.localY,i);const _=this._dataSourceAtPoint(e.localX,e.localY);if(this._tryFinishClonning(e,new Ee.EnvironmentState(e),_))return;const m=(0,Be.toolIsMeasure)(l)||n.startMeasurePoint()&&n.endMeasurePoint();this._chart.readOnly()||!i.mod()||(0,Ot.isLineToolName)(l)||m||d?(this._processScroll(e),this._preventScroll()&&!this._preventCrossHairMove()&&null===this._startTrackPoint&&this.setCursorPosition(e.localX,e.localY,new Ee.EnvironmentState(e))):this._isSelecting||(n.startSelection(this.state()),this._isSelecting=!0)}_mouseOrTouchLeaveEvent(e){var t;if(!this.hasState())return;const i=this._chartUndoModel();if(!i)return;const s=i.crossHairSource();e.isTouch||null!==s.measurePane().value()&&null===s.endMeasurePoint()||this._clearCursorPosition(),i.model().setHoveredSource(null,null),null!==this._prevHoveredHittest&&((0,ke.tryCallHandler)(e,null===(t=this._prevHoveredHittest.hittest.data())||void 0===t?void 0:t.mouseLeaveHandler),this._prevHoveredHittest=null),this._updateCommonTooltip(null),this._chart.unsetActivePaneWidget()}_mouseDoubleClickOrDoubleTapEvent(e){if(!this.hasState())return;const t=!this._chart.readOnly()&&!(0,Ot.isLineToolName)(Be.tool.value())&&this._dataSourceAtPoint(e.localX,e.localY)||null;if(null!==t&&t.isCustom)t.hittest.tryCallDblClickOrDblTapHandler(e);else if(null!==t&&(e.isTouch||t.hittest.target()>ke.HitTarget.MovePointBackground))this.processDoubleClickOnSource(t.source,t.hittest?t.hittest:void 0);else if(!this._chart.readOnly()&&!(0,Ot.isLineToolName)(Be.tool.value())&&!this._chartUndoModel().lineBeingCreated()&&this._chartUndoModel().selection().isEmpty()){const t=this.state();new Ee.EnvironmentState(e).mod()&&!t.maximized().value()?(t.collapsed().value()||this._chartModel().paneCollapsingAvailable().value())&&this._chartUndoModel().toggleCollapsedPane(this.state()):this._chart.toggleMaximizePane(this)}}_contextMenuEvent(e){const t=this._chartUndoModel();if(t.crossHairSource().startMeasurePoint()&&!this._trackCrosshairOnlyAfterLongTap)return t.crossHairSource().clearMeasure(),void(0,Be.resetToCursor)(!0);if(this._pinching)return
;if(null===this._firstZoomPoint||this._trackCrosshairOnlyAfterLongTap||this.cancelZoom(),!(0,Be.toolIsCursor)(Be.tool.value())||this._isSelectPointModeEnabled()){if(e.isTouch)return;return(0,Be.resetToCursor)(!0),this.setCursorForTool(),void(t.lineBeingCreated()&&t.cancelCreatingLine())}if(!this._options.contextMenuEnabled)return;const i=this._dataSourceAtPoint(e.localX,e.localY),s=i?i.source:null;if(e.isTouch&&null!==this._startTrackPoint){if(this._preventSourceChange)return;this._clearCursorPosition()}e.isTouch&&(this._contextMenuOpenedOnLastTap=!0,this._startTrackPoint=null),this._contextMenuX=e.localX,this._contextMenuY=e.localY;const r=i&&i.hittest?i.hittest.target():0,n=r>=ke.HitTarget.Regular||r>=ke.HitTarget.MovePointBackground&&e.isTouch;this._chart.updateActions(),t.selectionMacro((t=>{null!==s&&n?t.selection().isSelected(s)||(t.clearSelection(),t.addSourceToSelection(s,ni(i,s))):(this._options.contextMenu.general&&this._showContextMenu(e),t.clearSelection())})),null!==i&&n&&null!==s&&((0,Ve.isDataSource)(s)&&s.hasContextMenu()?s.isSelectionEnabled()?this.showContextMenuForSelection(e):this.showContextMenuForSources([s],e):i.hittest.tryCallContextMenuHandler(e))}_onMouseEvent(){this._preventSourceChange=!1,this._startTrackPoint=null,this._trackCrosshairOnlyAfterLongTap=!1}_onTouchEvent(){this._trackCrosshairOnlyAfterLongTap=!0}_switchTrackingModeFromAnotherPaneIfNeeded(e){const t=this._chart.trackingModePaneWidget();if(null!==t&&t!==this){const i=this._chartModel().crossHairSource().currentPoint();t._exitTrackingModeOnNextTry=!0,t._tryExitTrackingMode(!0),this.startTrackingMode(new Ae.Point(e.localX,e.localY),new Ae.Point(i.x,e.localY),new Ee.EnvironmentState(e))}}async _showContextMenu(e){const t=e=>e instanceof H.Separator,i=this._customActions(),s=(await this._initActions(e)).filter((e=>null!==e));i.remove.forEach((e=>{for(let t=0;t0;e--)t(r[e])&&t(r[e-1])&&r.splice(e,1);r.length&&t(r[0])&&r.splice(0,1),r.length&&t(r[r.length-1])&&r.splice(r.length-1,1),qe.ContextMenuManager.showMenu(r,e,{statName:"ChartContextMenu"},{menuName:"ChartContextMenu"})}async _initActions(e){var t,i;const s=this._chart.actions(),r=[];if(this._chart.model().model().resetScalesAvailable().value()&&(r.push(s.chartReset),r.push(new H.Separator)),!this.state().isEmpty()&&R.enabled("datasource_copypaste")){const t=(0,ot.createActionCopyPrice)(this.state(),e.localY),i=(0,ot.createPasteAction)(this._chart,this.state());(t||i)&&(t&&r.push(t),i&&r.push(i),r.push(new H.Separator))}r[r.length-1]instanceof H.Separator||r.push(new H.Separator);return Boolean(null===(t=window.widgetbar)||void 0===t?void 0:t.widget("watchlist"))&&s.addToWatchlist&&r.push(s.addToWatchlist),R.enabled("text_notes")&&r.push(s.addToTextNotes),r[r.length-1]instanceof H.Separator||r.push(new H.Separator),r.push(this._createLockTimeAxisAction(e)),r.push(new H.Separator),
!R.enabled("charting_library_base")&&s.applyColorTheme&&r.push(s.applyColorTheme),r[r.length-1]instanceof H.Separator||r.push(new H.Separator),this._chart.applyIndicatorsToAllChartsAvailable()&&(r.push(s.applyStudiesToAllCharts),r.push(new H.Separator)),r.push(s.paneRemoveAllDrawingTools),r.push(s.paneRemoveAllStudies),r.push(new H.Separator),(null===(i=window.pro)||void 0===i?void 0:i.hasPackage("mtp-mtpredictor"))&&this.state().containsMainSeries()&&r.push((0,ot.createMTPredictorActions)(this._chart,this.state(),this._contextMenuX,this._contextMenuY),new H.Separator),r.push(s.hideAllMarks),r.push(new H.Separator),R.enabled("show_chart_property_page")&&r.push(s.chartProperties),r[r.length-1]instanceof H.Separator&&r.pop(),r}_loadAndCreateLegendWidget(){Promise.all([i.e(178),i.e(4015),i.e(9842),i.e(6639),i.e(8450),i.e(4102),i.e(962),i.e(2443),i.e(7663),i.e(5093)]).then(i.bind(i,62553)).then((e=>{if(this._isDestroyed)return;const t=e.LegendWidget,i=(0,Le.deepExtend)({},this._options.legendWidget);i.canShowSourceCode=!this._chart.onWidget()&&!l.CheckMobile.any(),i.readOnlyMode=i.readOnlyMode||this._chart.readOnly(),i.statusesWidgets={sourceStatusesEnabled:this._options.sourceStatusesWidgetEnabled,sourceStatuses:this._options.sourceStatusesWidget||{},marketStatusEnabled:this._options.marketStatusWidgetEnabled,dataUpdateModeEnabled:this._options.chartWarningWidgetEnabled,dataUpdateMode:this._options.chartWarningWidget||{},dataProblemEnabled:this._options.dataProblemWidgetEnabled};const s=(0,E.combine)(((e,t)=>ci&&this._chart!==e&&!t),this._chart.chartWidgetCollection().activeChartWidget.weakReference(),this._chart.chartWidgetCollection().lock.crosshair.weakReference()),n=(0,E.combine)(((e,t)=>null!==e?e===this._state:(0,Be.toolIsMeasure)(t)),this._chartModel().crossHairSource().measurePane().weakReference(),Be.tool.weakReference());this._legendWidget=new t(this._chartUndoModel(),this,this._chart.backgroundTopTheme().spawnOwnership(),s.ownership(),this._visuallyCollapsed.spawnOwnership(),n.ownership(),i,{showContextMenuForSelection:this.showContextMenuForSelection.bind(this),showContextMenuForSources:this.showContextMenuForSources.bind(this),updateActions:this._chart.updateActions.bind(this._chart),showChartPropertiesForSource:this._chart.showChartPropertiesForSource.bind(this._chart),showGeneralChartProperties:this._chart.showGeneralChartProperties.bind(this._chart),showObjectsTreeDialog:this._chart.showObjectsTreeDialog.bind(this._chart)}),this._div.appendChild(this._legendWidget.getElement()),this._legendWidget.updateLayout(),this._legendWidget.updateWidgetModeBySize(this._size),this._legendWidget.updateThemedColors(this._themedTopColor);for(const e of Array.from(this._customLegendWidgetsFactoryMap.keys()))this._legendWidget.addCustomWidgetToLegend(e,(0,r.ensureDefined)(this._customLegendWidgetsFactoryMap.get(e)))}))}_loadAndCreatePaneControlsWidget(){
Promise.all([Promise.all([i.e(178),i.e(4015),i.e(9842),i.e(6639),i.e(8450),i.e(4102),i.e(962),i.e(2443),i.e(7663),i.e(5093)]).then(i.bind(i,69289)),Promise.all([i.e(178),i.e(4015),i.e(9842),i.e(6639),i.e(8450),i.e(4102),i.e(962),i.e(2443),i.e(7663),i.e(5093)]).then(i.bind(i,59255))]).then((([e,t])=>{var i;if(this._isDestroyed)return;const s=e.PaneControlsWidget;this._paneControls=new s(this._chartUndoModel(),this,{backgroundThemeName:this._chart.backgroundTopTheme()},{toggleMaximizePane:this._chart.toggleMaximizePane.bind(this._chart)},this._div),this._paneControls.updateWidgetModeByWidth(this._size.width),this._paneControls.updateThemedColors(this._themedTopColor),this._paneControlsResizeObserver=new t.default(this._handleRestrictLegendWidth.bind(this)),this._paneControlsResizeObserver.observe(this._paneControls.getElement()),(null===(i=this._state)||void 0===i?void 0:i.collapsed().value())&&this._chartModel().fullUpdate()}))}_handleRestrictLegendWidth(e){if(null===this._legendWidget||null===this._paneControls)return;const t=e[e.length-1].contentRect.width,i=0===t?0:t+$t+Yt;this._legendWidget.addMargin(i)}_onMagnetStateChanged(){this._chart.isActive()&&(this._isSelectPointModeEnabled()||this._isToolActionActiveOnPane(!0))&&this._chartModel().crossHairSource().visible&&this._updateLineToolUsingMagnetOrShift()}_onShiftKeyStateChanged(){this._chart.isActive()&&this._isToolActionActiveOnPane(!1)&&this._chartModel().crossHairSource().visible&&this._updateLineToolUsingMagnetOrShift(Ee.EnvironmentState.create((0,j.shiftPressed)().value()))}_isToolActionActiveOnPane(e){const t=this._chartModel(),i=t.lineBeingCreated()||t.lineBeingEdited()||t.sourcesBeingMoved().length>0&&t.sourcesBeingMoved()[0];return i?t.paneForSource(i)===this._state:e&&(0,Ot.isLineToolName)(Be.tool.value())&&t.crossHairSource().pane===this._state}_updateLineToolUsingMagnetOrShift(e){if(null===this._prevMoveEventPosition)return;const{x:t,y:i}=this._prevMoveEventPosition,s=this._chartModel().sourcesBeingMoved();s.length>0?(Be.isStudyEditingNow.value()&&this.setCursorPosition(t,i,e),this._alignSourcesThatBeingMoved(s,t,i,e)):this.setCursorPosition(t,i,e)}_showEditDialogForSource(e,t){if(this._options.propertyPagesEnabled&&e.userEditEnabled())if(e===this._chartUndoModel().mainSeries())this._chart.showGeneralChartProperties(Y.TabNames.symbol);else if((0,Q.isLineTool)(e)||(0,Z.isStudy)(e)){let i;const s=null==t?void 0:t.data();if(null!=s){const e=s.areaName;void 0!==e&&(i=li.get(e))}this._chart.showChartPropertiesForSource(e,i).then((e=>{this._editDialog=e}))}}_initToolCreationModeParams(e){this._startTouchPoint=new Ae.Point(e.pageX,e.pageY),this._initCrossHairPosition=this._chartModel().crossHairSource().currentPoint()}_updateCrosshairPositionInToolCreationMode(e,t){if(t!==this._state){const i=this._chart.paneByState(t);return i._startTouchPoint=this._startTouchPoint,i._initCrossHairPosition=this._initCrossHairPosition,void i._updateCrosshairPositionInToolCreationMode(e,t)}const i=this._chartModel().crossHairSource()
;this._chart.justActivated()&&(this._initCrossHairPosition=i.currentPoint());const s=e.pageX,n=e.pageY,o=(0,r.ensureNotNull)(this._initCrossHairPosition),a=new Ae.Point(s,n).subtract((0,r.ensureNotNull)(this._startTouchPoint)),l=o.add(a);this.setCursorPosition(l.x,l.y,new Ee.EnvironmentState(e))}_priceAxisesContainer(e){return"left"===e?this._lhsPriceAxisesContainer:this._rhsPriceAxisesContainer}_recalculatePriceScales(e){const t=this.state();for(const i of t.leftPriceScales())t.recalculatePriceScale(i,e);for(const i of t.rightPriceScales())t.recalculatePriceScale(i,e);for(const i of t.sourcesByGroup().overlayPriceScaleSources())(0,Q.isLineTool)(i)||t.recalculatePriceScale(i.priceScale(),e)}_createLockTimeAxisAction(e){var t;const i=0===(null===(t=Be.crosshairLock.value())||void 0===t?void 0:t.type);return new H.Action({actionId:"Chart.Crosshair.LockVerticalCursor",options:{label:Jt,statName:"LockCursorInTime",checkable:!0,checked:i,onExecute:()=>this._toggleLockTimeAxis(e.localX,!i)}})}_toggleLockTimeAxis(e,t){if(t){const t=this._chartUndoModel().timeScale(),i=t.coordinateToIndex(e),s=t.points().roughTime(i);if(null!==s)return void Be.crosshairLock.setValue({type:0,time:s})}Be.crosshairLock.setValue(null)}_preventTouchEventsExceptPinch(){return this._paneWidgetsSharedState.hasTouchesOnOtherPanes(this)||null!==this._paneWidgetsSharedState.pinchingPane()}_updateHoveredSource(e,t,i){var s,r;const n=this._chartUndoModel(),o=n.model();let a=!1;const l=e&&e.source,c=this._chart.readOnly();if(o.crossHairSource().isReplaySelection())this._setCursorClassName("none");else if(!(!c||e&&(0,Q.isLineTool)(e.source))||this._editDialog&&this._editDialog.visible().value())c&&(o.setHoveredSource(null,null),this.setCursorForTool());else{const h=Be.tool.value();let d=null;if(!this._processing&&((0,Be.toolIsCursor)(h)||"eraser"===h&&!c||t.mod()||!n.lineBeingCreated())){const t=null==e?void 0:e.hittest;a=Boolean(null===(s=null==t?void 0:t.data())||void 0===s?void 0:s.hideCrosshairLinesOnHover),t&&t.target()>ke.HitTarget.MovePointBackground?(d=l,!(null==l?void 0:l.isHoveredEnabled())||"eraser"===h&&l===n.mainSeries()?o.setHoveredSource(null,null):o.setHoveredSource(l,t.data())):o.setHoveredSource(null,null)}c?this.setCursorForTool(d,t,Ft.PaneCursorType.Default):this._options.sourceSelectionEnabled&&(this._isSelectPointModeEnabled()?this._setCursorClassName("pointer"):this.setCursorForTool(d,t,null===(r=null==e?void 0:e.hittest.data())||void 0===r?void 0:r.cursorType));const u=o.customSourceBeingMoved(),p=null!==u?[u]:o.sourcesBeingMoved();if((!p.length||null!==e&&-1===p.indexOf(e.source))&&this._updateCommonTooltip(e),!c&&null!==e&&i&&e.hittest.hasPressedMoveHandler(i)){switch((e.hittest.data()||{}).cursorType){case Ft.PaneCursorType.VerticalResize:this._setCursorClassName("ns-resize");break;case Ft.PaneCursorType.HorizontalResize:this._setCursorClassName("we-resize");break;case Ft.PaneCursorType.DiagonalNeSwResize:this._setCursorClassName("nesw-resize");break;case Ft.PaneCursorType.DiagonalNwSeResize:
this._setCursorClassName("nwse-resize")}}}this._preventCrossHairMove()&&this._clearCursorPosition(),1!==this._pressedMoveStage&&o.crossHairSource().setLinesShouldBeHidden(a)}async _createErrorBlock(){const e=new(await oe());return this._div.insertBefore(e.container,this._topCanvasBinding.canvasElement.nextSibling),e}_customActions(){const e={top:[],bottom:[],remove:[]},t=this._chartUndoModel().timeScale(),i=this._state&&this._state.defaultPriceScale();if(!R.enabled("custom_items_in_context_menu"))return e;const s=t.isEmpty()?void 0:t.indexToUserTime(t.coordinateToIndex(this._contextMenuX));let n;if(i&&!i.isEmpty()){const e=(0,r.ensureNotNull)(this.state().mainDataSource()).firstValue();n=i.coordinateToPrice(this._contextMenuY,(0,r.ensureNotNull)(e))}return(0,a.emit)("onContextMenu",{unixtime:null!=s?s.getTime()/1e3:void 0,price:n,callback:t=>{[...t].forEach((t=>{if(t.text)if(t.text.length>1&&"-"===t.text[0])e.remove.push(t.text.slice(1));else{let i;i="-"===t.text?new H.Separator:new H.Action({actionId:"Chart.ExternalActionId",options:{label:t.text,onExecute:t.click}}),t.position&&"top"===t.position?e.top.push(i):e.bottom.push(i)}}))}}),e}_highlightPriceAxisByLabel(e){this._lhsPriceAxisesContainer.highlightPriceAxisByLabel(e),this._rhsPriceAxisesContainer.highlightPriceAxisByLabel(e)}_subscribeToState(){const e=this.state();e.onDestroyed().subscribe(this,this._onStateDestroyed,!0),e.dataSourcesCollectionChanged().subscribe(this,this._onDataSourcesCollectionChanged),e.maximized().subscribe(this._updateVisuallyCollapsed),e.collapsed().subscribe(this._updateVisuallyCollapsed)}_unsubscribeFromState(){const e=this.state();e.onDestroyed().unsubscribeAll(this),e.dataSourcesCollectionChanged().unsubscribeAll(this),e.maximized().unsubscribe(this._updateVisuallyCollapsed),e.collapsed().unsubscribe(this._updateVisuallyCollapsed)}_updateAccesibilityAttr(){if(this.state().isMainPane()){const e=this._chartModel().mainSeries(),t=e.symbol(),s=(0,jt.getTranslatedResolutionModel)(e.interval()).hint,r=o.t(null,{replace:{symbol:t,interval:s}},i(69916));this._topCanvasBinding.canvasElement.setAttribute("aria-label",r)}else this._topCanvasBinding.canvasElement.setAttribute("aria-hidden","true")}async _updateEndOfSeriesBanner(){}}class pi{constructor(){this._draggingSource=null,this._activeTouchPanes=new Set,this._scrollingPane=null,this._pinchingPane=null}onPaneDestroyed(e){this._activeTouchPanes.delete(e),this._scrollingPane===e&&(this._scrollingPane=null),this._pinchingPane===e&&(this._pinchingPane=null)}startTouch(e){this._activeTouchPanes.add(e)}endTouch(e){this._activeTouchPanes.delete(e)}hasTouchesOnOtherPanes(e){return this._activeTouchPanes.size>1||1===this._activeTouchPanes.size&&!this._activeTouchPanes.has(e)}trySetDraggingSource(e,t){return!this.hasTouchesOnOtherPanes(t)&&((0,r.assert)(null===this._draggingSource||this._draggingSource===e),this._draggingSource=e,!0)}clearDraggingSource(){null!==this._draggingSource&&(this._draggingSource=null)}draggingSource(){return this._draggingSource}setScrollingPane(e){(0,
r.assert)(null===e||null===this._scrollingPane||this._scrollingPane===e),this._scrollingPane=e}scrollingPane(){return this._scrollingPane}setPinchingPane(e){(0,r.assert)(null===e||null===this._pinchingPane||this._pinchingPane===e),this._pinchingPane=e}pinchingPane(){return this._pinchingPane}}var _i=i(42609),mi=i(11678);i(658);const gi={contextMenuEnabled:!0,timezoneMenuEnabled:!0,pressedMouseMoveScale:!0},fi=new F.TranslatedString("change session",o.t(null,void 0,i(65303))),vi=o.t(null,void 0,i(25866));class Si{constructor(e,t,i,r,n){this._rendererOptions=null,this._onLabelHovered=new B.Delegate,this._mousedown=!1,this._currentCursorClassName="invalid",this._options=(0,C.merge)((0,C.clone)(gi),t||{}),this.chart=e,this._properties=e.properties().childs().scalesProperties,this._element=document.createElement("div"),this._element.style.display="flex",this._backgroundBasedTheme=n;const o=()=>this.backgroundColor(),a=()=>{throw new Error("Time axis does not support real price scales")},l={titlesProvider:i,stubContextMenuProvider:(e,t)=>{const i=r(e,t),s=this.getContextMenuActions(!0);return 0===s.length?i:i.concat(new H.Separator,s)},backgroundBasedTheme:n,rendererOptionsProvider:e.model().model().rendererOptionsProvider(),getBackgroundTopColor:o,getBackgroundBottomColor:o,showHorizontalBorder:!0};this._lhsStubContainer=new Xe(this._properties,"left",a,l,this._options.priceAxisLabelsOptions,this),this._lhsStubContainer.onLabelHovered().subscribe(this,((e,t)=>{this._onLabelHovered.fire(e,t)})),this._rhsStubContainer=new Xe(this._properties,"right",a,l,this._options.priceAxisLabelsOptions,this),this._rhsStubContainer.onLabelHovered().subscribe(this,((e,t)=>{this._onLabelHovered.fire(e,t)})),this._element.appendChild(this._lhsStubContainer.getElement()),this._cell=document.createElement("div"),this._element.appendChild(this._cell),this._cell.classList.add("chart-markup-table","time-axis"),this._cell.style.height="25px",this._dv=document.createElement("div"),this._dv.style.width="100%",this._dv.style.height="100%",this._dv.style.position="relative",this._dv.style.overflow="hidden",this._cell.appendChild(this._dv),this._canvasConfiguredHandler=()=>this.chart.model().model().lightUpdate(),this._canvasBinding=(0,U.createBoundCanvas)(this._dv,(0,s.size)({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const c=this._canvasBinding.canvasElement;c.style.position="absolute",c.style.zIndex="1",c.style.left="0",c.style.top="0",this._topCanvasBinding=(0,U.createBoundCanvas)(this._dv,(0,s.size)({width:16,height:16})),this._topCanvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const h=this._topCanvasBinding.canvasElement;h.style.position="absolute",h.style.zIndex="2",h.style.left="0",h.style.top="0",Pe.PLATFORM_ACCESSIBILITY_ENABLED&&this._dv.setAttribute("aria-hidden","true"),this._element.appendChild(this._rhsStubContainer.getElement()),this.restoreDefaultCursor(),this.update(),this._minVisibleSpan=_i.MINUTE_SPAN,
this._mouseEventHandler=new Ce.MouseEventHandler(this._topCanvasBinding.canvasElement,this,{treatVertTouchDragAsPageScroll:!0,treatHorzTouchDragAsPageScroll:!1}),this.size=(0,s.size)({width:0,height:0}),(0,Be.hideMarksOnBars)().subscribe(this,(()=>this.chart.model().model().lightUpdate()))}destroy(){this._mouseEventHandler.destroy(),this._topCanvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler),this._topCanvasBinding.dispose(),this._canvasBinding.unsubscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler),this._canvasBinding.dispose(),this._rhsStubContainer.onLabelHovered().unsubscribeAll(this),this._lhsStubContainer.onLabelHovered().unsubscribeAll(this),this._lhsStubContainer.destroy(),this._rhsStubContainer.destroy(),this.chart.properties().childs().paneProperties.childs().background.unsubscribeAll(this),(0,Be.hideMarksOnBars)().unsubscribeAll(this)}setCursor(e){let t="";"grabbing"!==e&&"ew-resize"!==e||(t="time-axis--cursor-"+e),this._currentCursorClassName!==t&&(this._currentCursorClassName&&this._cell.classList.remove(this._currentCursorClassName),t&&this._cell.classList.add(t),this._currentCursorClassName=t,this._cell.style.cursor)}restoreDefaultCursor(){this.setCursor("")}getElement(){return this._element}optimalHeight(){const e=this.rendererOptions();return Math.ceil(e.borderSize+e.offsetSize+e.fontSize+e.paddingTop+e.paddingBottom+e.labelBottomOffset)}setSizes(e,t,i){this.size&&(0,s.equalSizes)(this.size,e)||(this.size=e,this._canvasBinding.resizeCanvasElement(e),this._topCanvasBinding.resizeCanvasElement(e),this._cell.style.width=e.width+"px",this._cell.style.height=e.height+"px"),this._lhsStubContainer.setSizes(e.height,t),this._rhsStubContainer.setSizes(e.height,i)}rendererOptions(){if(!this._rendererOptions||this._rendererOptions.fontSize!==this.fontSize()){const e=this.fontSize();this._rendererOptions={borderSize:1,offsetSize:5,fontSize:e,font:(0,Oe.makeFont)(e,He.CHART_FONT_FAMILY,""),widthCache:new Je.TextWidthCache,paddingTop:3*e/12,paddingBottom:3*e/12,paddingHorizontal:9*e/12,labelBottomOffset:4*e/12}}return this._rendererOptions}backgroundColor(){return this.chart.model().model().backgroundColor().value()}lineColor(){const e=this._properties.childs().lineColor.value();if(0===(0,be.parseRgba)(e)[3]){const e=this.chart.model().model().lastPane();if(e&&(e.collapsed().value()||e.isMainPane()&&this._areEventsEnabled()))return this.chart.properties().childs().paneProperties.childs().separatorColor.value()}return e}textColor(){return this._properties.childs().textColor.value()}fontSize(){return this._properties.childs().fontSize.value()}baseFont(){return(0,Oe.makeFont)(this.fontSize(),He.CHART_FONT_FAMILY)}baseBoldFont(){return(0,Oe.makeFont)(this.fontSize(),He.CHART_FONT_FAMILY,"","bold")}hasCanvas(e){return this._canvasBinding.canvasElement===e||this._topCanvasBinding.canvasElement===e}onLabelHovered(){return this._onLabelHovered}getScreenshotData(){return{content:this._canvasBinding.canvasElement.toDataURL(),canvas:this._canvasBinding.canvasElement,
contentWidth:this.size.width,contentHeight:this.size.height,lhsStub:this._lhsStubContainer.getScreenshotData(),rhsStub:this._rhsStubContainer.getScreenshotData()}}getContextMenuActions(e){var t;const i=this.chart;i.updateActions();const s=i.actions(),r=[];if(e||(i.model().timeScale().resetAvailable().value()&&(r.push(s.timeScaleReset),r.push(new H.Separator)),this._options.timezoneMenuEnabled&&r.push(s.applyTimeZone),r.push(s.sessionBreaks)),!i.model().mainSeries().isDWM()){const e=null===(t=i.model())||void 0===t?void 0:t.mainSeries().symbolInfo();if(e){const t=i.model().mainSeries().properties().childs().sessionId,s=(e.subsessions||[]).filter((e=>!e.private));if(s.length>1){const e=s.map((e=>new H.Action({actionId:"Chart.SetSession",options:{label:(0,mi.translateSessionDescription)(e.description),checkable:!0,checked:t.value()===e.id,statName:"SetSession",onExecute:()=>{i.model().setProperty(t,e.id,fi)}}}))),n=new H.Action({actionId:"Chart.SetSession",options:{label:vi,statName:"SetSession",subItems:e}});r.push(n)}}}return r}update(){if(!this.chart.hasModel())return;const e=this.chart.model().timeScale().marks();if(e){this._minVisibleSpan=_i.YEAR_SPAN;for(const t of e)this._minVisibleSpan=Math.min(t.span,this._minVisibleSpan)}}updatePriceAxisStubs(){const e=this.chart.model().model(),t=this.chart.isMaximizedPane()?(0,r.ensureNotNull)(this.chart.maximizedPaneWidget()).state():e.paneForSource(e.mainSeries());if(!t)return;const i=e.priceScaleSlotsCount();this._lhsStubContainer.setScales([],i.left,t.leftPriceScales().length,i.left+i.right),this._rhsStubContainer.setScales([],i.right,t.rightPriceScales().length,i.left+i.right)}paint(e){if(e===ue.InvalidationLevel.None||0===this.size.width||0===this.size.height)return;(0,U.tryApplySuggestedCanvasBitmapSize)(this._canvasBinding),(0,U.tryApplySuggestedCanvasBitmapSize)(this._topCanvasBinding);const t=(0,U.getContext2D)(this._topCanvasBinding.canvasElement);if(e>ue.InvalidationLevel.Cursor){const i=(0,U.getContext2D)(this._canvasBinding.canvasElement),s=(0,U.getBindingPixelRatio)(this._canvasBinding);this.drawBackground(i,s),this.chart.hasModel()&&(this.drawBorder(i,s),this.drawTickMarks(i,s),this.drawBackLabels(i,s),this.drawCrossHairLabel(t,s)),this._lhsStubContainer.paintStubs(e),this._rhsStubContainer.paintStubs(e)}this.drawCrossHairLabel(t,(0,U.getBindingPixelRatio)(this._topCanvasBinding))}drawBackground(e,t){if((0,U.clearRect)(e,0,0,Math.ceil(this.size.width*t)+1,Math.ceil(this.size.height*t)+1,this.backgroundColor()),!this.chart.hasModel())return;const i=this.chart.model();if(!i.timeScale().isEmpty()){const s=i.model().selection().lineDataSources().reduce(((e,t)=>{const i=t.timeAxisPoints();return 0===i.length?e:e.concat(i)}),[]);s.length>0&&this._hightlightBackground(e,s,t)}const s=i.model().crossHairSource();s.startMeasurePoint()&&this._hightlightBackground(e,s.measurePoints(),t)}drawBorder(e,t){e.save(),e.fillStyle=this.lineColor();const i=Math.max(1,Math.floor(this.rendererOptions().borderSize*t)),s=Math.ceil(this.size.width*t);e.fillRect(0,0,s+1,i),e.restore()}
drawTickMarks(e,t){const i=this.chart.model().timeScale().marks();if(!i||0===i.length)return;let s=i.reduce(((e,t)=>e.span>t.span?e:t),i[0]).span;s>30&&s<40&&(s=30),e.save(),e.strokeStyle=this.lineColor();const r=this.rendererOptions(),n=r.borderSize+r.offsetSize+r.paddingTop+r.fontSize/2;e.textAlign="center",e.textBaseline="middle",e.fillStyle=this.textColor(),(0,U.drawScaled)(e,t,t,(()=>{e.font=this.baseFont();for(let t=0;t=s&&e.fillText(r.label,r.coord,n)}})),e.restore()}drawBackLabels(e,t){var i;e.save();const s=new Set,r=this.chart.model().model();let n=r.dataSources();const o=r.selection().allSources();for(const e of o)s.add(e);r.hoveredSource()&&s.add(r.hoveredSource());for(const e of r.sourcesBeingMoved())s.add(e);const a=r.customSourceBeingMoved();null!==a&&s.add(a);const l=null!==(i=r.lineBeingEdited())&&void 0!==i?i:r.lineBeingCreated();l&&s.add(l),s.add(this.chart.model().crossHairSource()),n=n.concat(r.customSources());const c=this.rendererOptions();for(let i=0;i=s&&(s=a,n=o),a<=i&&(i=a,r=o)}}return n&&t.push(n),r&&t.push(r),t}_zoomAvailable(){return!this.chart.model().timeScale().isEmpty()&&this.chart.model().model().zoomEnabled()&&this._options.pressedMouseMoveScale}_mouseDownOrTouchStartEvent(e){if(this._mousedown||!this._zoomAvailable())return;this._mousedown=!0;const t=this.chart.model();t.timeScale().isEmpty()||t.startScaleTime(e.localX)}_pressedMouseOrTouchMoveEvent(e){this._zoomAvailable()&&this.chart.model().scaleTimeTo(e.localX)}_mouseUpOrTouchEndEvent(e){this._zoomAvailable()&&(this._mousedown=!1,this.chart.model().endScaleTime(),this.restoreDefaultCursor())}_contextMenuOrTouchContextMenuEvent(e){this._options.contextMenuEnabled&&qe.ContextMenuManager.showMenu(this.getContextMenuActions(),e,{statName:"TimeScaleContextMenu"},{menuName:"TimeScaleContextMenu"})}_mouseOrTouchEnterEvent(e){this._zoomAvailable()&&this.setCursor("ew-resize")}_mouseOrTouchLeaveEvent(e){this.restoreDefaultCursor()}_mouseDoubleClickOrDoubleTapEvent(e){(0,d.trackEvent)("GUI","Double click time scale"),this.chart.model().resetTimeScale()}_areEventsEnabled(){return!(0,Be.hideMarksOnBars)().value()}}var yi=i(94792);var bi=i(46100),wi=i(37591),Ci=i(74970),Pi=i(74007),xi=i(10066),Ti=i(78325),Ii=i(86972);i(42053);const Mi=o.t(null,void 0,i(58018));var Ai=i(3615);class Li extends class{constructor(e){this._lastResolvedSymbol=null,this._chart=e,this._chart.withModel(this,this._connectToModel)}_getPopupContent(){const e=this._getProSymbol(),t=new URL("https://www.tradingview.com/chart/");t.searchParams.append("symbol",e),t.searchParams.append("utm_source","www.tradingview.com"),t.searchParams.append("utm_medium","widget"),t.searchParams.append("utm_campaign","chart"),t.searchParams.append("utm_term",e);return Mi.format({linkStart:``,linkEnd:""})}_onPopupClosed(){const e=this._chart.defaultSymbol(),t=this._getSymbol();let i;i=this._lastResolvedSymbol?this._lastResolvedSymbol:e!==t?e:"AAPL",this._chart.setSymbol(i)}_getProSymbol(){return this._chart.model().mainSeries().proSymbol()}_getSymbol(){return this._chart.model().mainSeries().actualSymbol()}_connectToModel(){const e=this._chart.model().mainSeries()
;e.dataEvents().symbolResolved().subscribe(this,this._onSymbolResolved),e.dataEvents().symbolGroupNotPermitted().subscribe(this,this._onSymbolGroupNotPermitted),e.dataEvents().symbolNotPermitted().subscribe(this,this.show)}_onSymbolResolved(){this._lastResolvedSymbol=this._getSymbol()}_onSymbolGroupNotPermitted(){this.show()}}{show(){(0,Ai.showWarning)({title:"Unavailable",html:this._getPopupContent(),onClose:()=>this._onPopupClosed()})}}var ki=i(36174);const Di=(0,p.getLogger)("ChartApi.AbstractSession");class Ei extends class{constructor(e,t,i){this._isConnected=new W.WatchedValue(!1),this._state=0,this._isConnectForbidden=!1,this._sessionId="",this._sessionIdChanged=new B.Delegate,this._chartApi=e,this._sessionPrefix=t,this._shouldReconnectAfterCriticalError=i}destroy(){this._logNormal("Destroying session"),this._isConnected.unsubscribe(),this.disconnect(),this._sessionIdChanged.destroy(),delete this._chartApi,this._logNormal("Session has been destroyed")}isConnected(){return this._isConnected}sessionId(){return this._sessionId}onSessionIdChanged(){return this._sessionIdChanged}connect(){0===this._state&&((0,r.assert)(!this._isConnectForbidden,"Cannot call connect because it is forbidden at this moment"),this._setSessionId(`${this._sessionPrefix}_${(0,ki.randomHash)()}`),this._logNormal("Connecting session - wait until transport stay connected"),this._state=1,this._chartApi.createSession(this._sessionId,this))}disconnect(){0!==this._state&&((0,r.assert)(""!==this._sessionId,"sessionId must not be invalid"),this._logNormal("Disconnecting session..."),this._forbidConnectWhile((()=>{this._chartApi.connected()&&this._sendRemoveSession(),this._processDestroyingOnServer()})))}onMessage(e){switch(e.method){case"connected":return void this._onChartApiConnected();case"disconnected":return void this._onChartApiDisconnected();case"critical_error":const t=String(e.params[0]),i=String(e.params[1]);return void this._onCriticalError(t,i)}this._onMessage(e)}_getChartApi(){return this._chartApi}_generateLogMessage(e){return`[${this._sessionId}] ${e}`}_onCriticalError(e,t){this._logError(`Critical error. Reason=${e}, info=${t}.`),this._forbidConnectWhile((()=>{this._processDestroyingOnServer()})),this._shouldReconnectAfterCriticalError?(this._logNormal("Reconnecting after critical error..."),this.connect()):this._logNormal("Reconnecting after critical error skipped")}_onChartApiConnected(){(0,r.assert)(1===this._state,"Session is not registered"),this._logNormal("Transport is connected. Creating session on the server"),this._sendCreateSession(),this._state=2,this._isConnected.setValue(!0)}_onChartApiDisconnected(){this._logNormal("Transport is disconnected. Reconnecting..."),this._forbidConnectWhile((()=>{this._processDestroyingOnServer()})),this.connect()}_setSessionId(e){const t=this._sessionId;this._logNormal(`Changing sessionId: old=${t}, new=${e}`),this._sessionId=e,this._sessionIdChanged.fire(e,t)}_logNormal(e){Di.logNormal(this._generateLogMessage(e))}_logError(e){Di.logError(this._generateLogMessage(e))}
_processDestroyingOnServer(){this._state=0,this._isConnected.setValue(!1),this._chartApi.removeSession(this._sessionId),this._setSessionId("")}_forbidConnectWhile(e){this._isConnectForbidden=!0,e(),this._isConnectForbidden=!1}}{constructor(e,t=!1){super(e,"cs",!1),this._sessionDisabled=!1,this._handler=null,this._criticalError=new B.Delegate,this._symbolResolveMap=new Map,this._lastSymbolResolveInfoMap=new Map,this._disableStatistics=t}destroy(){this._criticalError.destroy(),this._handler=null,this._symbolResolveMap.clear(),super.destroy()}serverTime(){return this._getChartApi().serverTime()}switchTimezone(e){return this._getChartApi().switchTimezone(this.sessionId(),e)}defaultResolutions(){return this._getChartApi().defaultResolutions()}availableCurrencies(){return this._getChartApi().availableCurrencies()}availableUnits(){return this._getChartApi().availableUnits()}availablePriceSources(e){return this._getChartApi().availablePriceSources(e)}resolveSymbol(e,t,i){if(this._symbolResolveMap.has(t)){const[e,s]=this._symbolResolveMap.get(t);return Array.isArray(s)?s.push(i):s.then(i),e}{const s=[i];return this._getChartApi().resolveSymbol(this.sessionId(),e,t,(i=>{if("symbol_error"===i.method)this._symbolResolveMap.delete(t);else{this._symbolResolveMap.set(t,[e,Promise.resolve(i)]);const[,s]=i.params,r={pro_name:s.pro_name,ticker:s.ticker};this._lastSymbolResolveInfoMap.set(t,r),r.pro_name&&this._lastSymbolResolveInfoMap.set(r.pro_name,r),s.full_name&&this._lastSymbolResolveInfoMap.set(s.full_name,r),r.ticker&&this._lastSymbolResolveInfoMap.set(r.ticker,r)}s.forEach((e=>e(i)))})),this._symbolResolveMap.set(t,[e,s]),e}}requestFirstBarTime(e,t,i){return this._getChartApi().requestFirstBarTime(this.sessionId(),e,t,i)}lastSymbolResolveInfo(e){var t;return null!==(t=this._lastSymbolResolveInfoMap.get(e))&&void 0!==t?t:null}createSeries(e,t,i,s,r,n,o){return this._getChartApi().createSeries(this.sessionId(),e,t,i,s,r,n,o)}modifySeries(e,t,i,s,r,n,o){return this._getChartApi().modifySeries(this.sessionId(),e,t,i,s,r,n,o)}removeSeries(e){return!!this.isConnected().value()&&this._getChartApi().removeSeries(this.sessionId(),e)}requestMoreData(e,t,i){return"number"==typeof e?this._getChartApi().requestMoreData(this.sessionId(),e):this._getChartApi().requestMoreData(this.sessionId(),e,t,i)}requestMoreTickmarks(e,t,i){return(0,C.isNumber)(e)?this._getChartApi().requestMoreTickmarks(this.sessionId(),e):this._getChartApi().requestMoreTickmarks(this.sessionId(),e,t,i)}canCreateStudy(e){return this._getChartApi().canCreateStudy(e)}getStudyCounter(){return this._getChartApi().getStudyCounter()}createStudy(e,t,i,s,r,n,o){return this._getChartApi().createStudy(this.sessionId(),e,t,i,s,r,n,o)}rebindStudy(e,t,i,s,r,n,o){return this._getChartApi().rebindStudy(this.sessionId(),e,t,i,s,r,n,o)}modifyStudy(e,t,i,s,r){return this._getChartApi().modifyStudy(this.sessionId(),e,t,i,s,r)}removeStudy(e,t){return this._getChartApi().removeStudy(this.sessionId(),e,t)}createPointset(e,t,i,s,r,n){
return this._getChartApi().createPointset(this.sessionId(),e,t,i,s,r,n)}modifyPointset(e,t,i,s){return this._getChartApi().modifyPointset(this.sessionId(),e,t,i,s)}removePointset(e){return this._getChartApi().removePointset(this.sessionId(),e)}setVisibleTimeRange(e,t,i,s,r,n){this._getChartApi().setVisibleTimeRange(this.sessionId(),e,t,i,s,!0,r,n)}criticalError(){return this._criticalError}connect(e=null){null!==e&&(this._handler=e),this._symbolResolveMap.clear(),super.connect()}setHandler(e){this._handler=e}connected(){return this.isConnected().value()&&!this._sessionDisabled}disable(){this._sessionDisabled=!0}chartApi(){return this._getChartApi()}_sendCreateSession(){Object.keys(this).forEach((e=>{/^(s|st|symbol_)\d+$/.test(e)&&delete this[e]})),this._getChartApi().chartCreateSession(this.sessionId(),this._disableStatistics)}_sendRemoveSession(){this._getChartApi().chartDeleteSession(this.sessionId())}_onMessage(e){this._handler&&this._handler(e)}_onCriticalError(e,t){this._criticalError.fire(e,t),super._onCriticalError(e,t)}}var Vi=i(85804),Bi=i(36274),Ri=i(4949),Ni=i(60156);i(59744),i(37218);var Oi=i(86094),Fi=i(37292);const Wi=(0,p.getLogger)("ChartWidget",{color:"#606"}),Hi=R.enabled("chart_content_overrides_by_defaults"),zi=new F.TranslatedString("hide {title}",o.t(null,void 0,i(70301)));const Ui={addToWatchlistEnabled:!0,showFinancialsEnabled:!1,sourceSelectionEnabled:!0,propertyPagesEnabled:!0,paneContextMenuEnabled:!0,priceScaleContextMenuEnabled:!0,currencyConversionEnabled:!1,unitConversionEnabled:!1,goToDateEnabled:!1,marketStatusWidgetEnabled:!0,chartWarningWidgetEnabled:!0,dataProblemWidgetEnabled:!0,paneControlsEnabled:!0,isSymbolAvailable:e=>Promise.resolve(!0),legendWidgetEnabled:!0,chartEventsEnabled:!0,newsNotificationsEnabled:!0,esdEnabled:!1,latestUpdatesEnabled:{news:!1,minds:!1},continuousContractSwitchesEnabled:!1,futuresContractExpirationEnabled:!1,croppedTickMarks:!0,countdownEnabled:!0,lastPriceAnimationEnabled:!0,useKineticScroll:l.CheckMobile.any(),indicatorsDialogShortcutEnabled:!0,handleScale:{mouseWheel:!0,pinch:!0,axisPressedMouseMove:{time:!0,price:!0}},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!0}};function ji(e,t,i,s=0){const r=t.mainSeries().syncModel(),n=e.mainSeries().syncModel();let o=i;if(null!==r&&null!==n){const t=e.createSyncPoint(r.syncSourceTarget(),n.syncSourceTarget());0!==s&&(i=r.projectTime(i,s)),o=t.sourceTimeToTargetTime(i)}return e.timeScale().points().roughIndex(o,n&&n.distance.bind(n))}const Gi=["Overlay@tv-basicstudies","CorrelationCoefficient@tv-basicstudies","Correlation Coeff@tv-basicstudies","Spread@tv-basicstudies","Ratio@tv-basicstudies"];class qi{constructor(e,t,i){this.activePaneWidget=null,this._model=null,this._paneWidgets=[],this._maximizedPaneWidget=null,this._timeAxisWidget=null,this._paneSeparators=[],this._controlBarNavigation=null,this._lineToolsSynchronizer=null,this._modelCreated=new B.Delegate,this._isDestroyed=!1,this._customLegendWidgetsFactoryMap=new Map,
this._backgroundTopTheme=new W.WatchedValue("light"),this._backgroundBasedTheme=new W.WatchedValue("light"),this._backgroundBottomTheme=new W.WatchedValue("light"),this._lhsAxesWidth=0,this._rhsAxesWidth=0,this._lhsPriceAxisWidthChanged=new B.Delegate,this._rhsPriceAxisWidthChanged=new B.Delegate,this._mainDiv=null,this._parent=null,this._elTooltipDiv=null,this._hotkeysListener=null,this._mouseWheelHelper=null,this._onWheelBound=null,this._justActivated=!1,this._inited=!1,this._containsData=!1,this._initialLoading=!1,this._defTimeframe=void 0,this._removeMaximizeHotkey=null,this._invalidationMask=null,this._drawPlanned=!1,this._drawRafId=0,this._inLoadingState=!1,this._timingsMeter=null,this._tagsChanged=new B.Delegate,this._redraw=new B.Delegate,this._isVisible=new W.WatchedValue(!0),this._collapsed=new W.WatchedValue(!1),this._dataWindowWidget=null,this._resizeHandler=null,this._spinner=null,this._keydownEventListener=null,this._properties=null,this._symbolWV=new W.WatchedValue,this._resolutionWV=new W.WatchedValue,this._updateThemedColorBound=this._updateThemedColor.bind(this),this._disconnected=new B.Delegate,this._reconnectBailout=new B.Delegate,this._connected=new B.Delegate,this._chartWidgetInitialized=new B.Delegate,this._saveChartService=null,this._objectTreeDialogController=null,this._chartPaintedPromise=null,this._noExchangeSubscrptionWarning=null,this._paneWidgetsSharedState=new pi,this._onZoom=new B.Delegate,this._onScroll=new B.Delegate,this._availableScreen=null,this._hoveredPriceAxes=new Set,this._anyAxisHovered=new W.WatchedValue(!1),this._linkingGroupIndex=new W.WatchedValue(null),this._showDataWindowAction=null,this._activeHint=null,this._eventHintDeferredPromise=null,this._warningHintDeferredPromise=null,this._setSymbolIntervalContentOverrides={},this._ariaPriceDescription=null,this._invalidationHandler=e=>{if(!(e instanceof ue.InvalidationMask))throw new Error("Invalid mask");null!==this._invalidationMask?this._invalidationMask.merge(e):this._invalidationMask=e,this._drawPlanned||(this._drawPlanned=!0,this._options.visible.when((()=>{const e=!document.hidden,t=this.screen&&this.screen.isShown();null!==this._timingsMeter&&e&&!t&&this._timingsMeter.startWaitingDraw();const i=(0,r.ensureNotNull)((0,r.ensureNotNull)(this._parent).ownerDocument.defaultView);this._drawRafId=i.requestAnimationFrame(this._invalidationRAFCallback.bind(this))})))},this._onChartSessionIsConnectedChanged=e=>{e?this._onConnection():this._onDisconnect()},this._subscribeToBanInfo=e=>{var t,i;e?null===(t=this._spinner)||void 0===t||t.stop():null===(i=this._spinner)||void 0===i||i.spin()},this._id=t,this._layoutId=i,this._options=(0,C.merge)((0,C.clone)(Ui),e),this._options.customLegendWidgetFactories&&(this._customLegendWidgetsFactoryMap=this._options.customLegendWidgetFactories),this._subscribeToDrawingState(),this._chartWidgetCollection=this._options.chartWidgetCollection,this.withModel(this,(()=>{const e=this.model().model();e.backgroundTopColor().subscribe(this._updateThemedColorBound),
e.backgroundColor().subscribe(this._updateThemedColorBound)})),this._errorRenderer=new he(this),this._scrollHelper=new $(this),this._objectTreeDialogController=w.getInstance(),this._properties=new bi.DefaultProperty("chartproperties",void 0,void 0,this._options.useUserChartPreferences),this._properties.addExclusion("scalesProperties.axisHighlightColor"),this._properties.addExclusion("scalesProperties.axisLineToolLabelBackgroundColorActive"),this._properties.addExclusion("scalesProperties.axisLineToolLabelBackgroundColorCommon"),this._properties.addExclusion("scalesProperties.showPriceScaleCrosshairLabel"),this._properties.addExclusion("scalesProperties.showTimeScaleCrosshairLabel"),this._properties.addExclusion("scalesProperties.crosshairLabelBgColorLight"),this._properties.addExclusion("scalesProperties.crosshairLabelBgColorDark"),this._startSpinner(this._options.container.value()),this._chartSession=new Ei(window.ChartApiInstance),this._isMultipleLayout=(0,E.combine)((e=>(0,_e.isMultipleLayout)(e)),this._chartWidgetCollection.layout.weakReference()),this._ariaPriceDescription=Ti.AriaCrosshairPriceDescription.getInstance(),this.withModel(this,(()=>{this.model().crossHairSource().moved().subscribe(this,this._updateAriaPriceDescription)}))}destroy(){var e,t,i;null===(e=this._lineToolsSynchronizer)||void 0===e||e.destroy(),null===(t=this._noExchangeSubscrptionWarning)||void 0===t||t.destroy(),window.loginStateChange.unsubscribe(this,this._handleLoginStateChanged),null!==this._model&&(this._model.model().backgroundTopColor().unsubscribe(this._updateThemedColorBound),this._model.model().backgroundColor().unsubscribe(this._updateThemedColorBound),this._model.model().crossHairSource().moved().unsubscribe(this,this._updateAriaPriceDescription),this._model.destroy()),this._ariaPriceDescription=null,this._customLegendWidgetsFactoryMap.clear(),this._scrollHelper.destroy(),this._errorRenderer.destroy(),this._chartSession.criticalError().unsubscribe(this,this._onChartSessionCriticalError),this._chartSession.isConnected().unsubscribe(this._onChartSessionIsConnectedChanged),this._chartSession.destroy(),null===(i=this._persistentLogSwitcher)||void 0===i||i.destroy(),this._isDestroyed=!0}emulateCriticalError(){this._chartSession.removeSeries("-1")}chartSession(){return this._chartSession}onDisconnected(){return this._disconnected}onReconnectBailout(){return this._reconnectBailout}onConnected(){return this._connected}chartWidgetInitialized(){return this._chartWidgetInitialized}setVisibleTimeRange(e,t,i,s){{const n=this.model().mainSeries().seriesSource();this._chartSession.setVisibleTimeRange((0,r.ensureNotNull)(n.instanceId()),n.turnaround(),e,t,null!=i?i:{},null!=s?s:()=>{})}}fullSourceId(e){return{layoutId:this.layoutId(),chartId:this.id(),sourceId:e.id()}}lineToolsSynchronizer(){return this._lineToolsSynchronizer}requestFullscreen(){this.getResizerDetacher().requestFullscreen()}exitFullscreen(){this.getResizerDetacher().exitFullscreen()}inFullscreen(){return this.getResizerDetacher().fullscreen.value()}model(){return(0,
r.ensureNotNull)(this._model)}id(){return this._id}layoutId(){return this._chartWidgetCollection.metaInfo.uid.value()}crossHairSyncEnabled(){return this._chartWidgetCollection.lock.crosshair.value()}isVisible(){return this._isVisible.value()}setVisible(e){this._isVisible.setValue(e)}setCollapsed(e){this._collapsed.setValue(e)}isJustClonedChart(){return!!(this._options||{}).justCloned}removeAllDrawingTools(){this.model().removeAllDrawingTools()}removeAllStudies(){this.model().removeAllStudies()}removeAllStudiesDrawingTools(){this.model().removeAllStudiesAndDrawingTools()}getSymbol(e){var t,i,s,r;let n;return n=this._model?this._model.mainSeries().properties().childs():this.properties().childs().mainSeriesProperties.childs(),n?e&&n.shortName&&n.shortName.value()?null!==(i=null===(t=n.shortName)||void 0===t?void 0:t.value())&&void 0!==i?i:"":null!==(r=null===(s=n.symbol)||void 0===s?void 0:s.value())&&void 0!==r?r:"":""}setSymbol(e){this._model?(this._symbolWV.setValue(e),this._model.setSymbol(this._model.mainSeries(),e)):(this.properties().childs().mainSeriesProperties.merge({symbol:e}),this._symbolWV.setValue(e),this._setSymbolIntervalContentOverrides.symbol=e)}setResolution(e){this._model?(this._resolutionWV.setValue(e),this._model.setResolution(this._model.mainSeries(),e)):(this.properties().childs().mainSeriesProperties.merge({interval:e}),this._resolutionWV.setValue(e),this._setSymbolIntervalContentOverrides.interval=e)}getResolution(){return this._model?this._model.mainSeries().properties().childs().interval.value():this.properties().childs().mainSeriesProperties.childs().interval.value()}symbolWV(){return this._symbolWV.readonly()}resolutionWV(){return this._resolutionWV.readonly()}loadRange(e){if(this._model){this.screen.show();this._model.loadRange(e)||this.screen.hide()}}async showGeneralChartProperties(e,t){if(!R.enabled("show_chart_property_page"))return Promise.resolve(null);const s=await this._showChartProperties(this.model().mainSeries(),e,{doNotCloseOnBgClick:!0,onResetToDefault:async()=>{this.model().restorePreferences();const e=await Promise.resolve().then(i.bind(i,11014)),t=e.getCurrentTheme().name;e.loadTheme(this.chartWidgetCollection(),{themeName:t,standardTheme:!0})},shouldReturnFocus:null==t?void 0:t.shouldReturnFocus});if(null===s)return null;const r=()=>{s.hide(),this._chartWidgetCollection.activeChartWidget.unsubscribe(r)};return this._chartWidgetCollection.activeChartWidget.subscribe(r),s}showChartPropertiesForSource(e,t,i,s){return R.enabled("property_pages")&&e.userEditEnabled()?e===this.model().model().mainSeries()?this.showGeneralChartProperties(t):((i=i||{}).onResetToDefault=()=>{((0,Q.isLineTool)(e)||(0,Z.isStudy)(e))&&this.model().restorePropertiesForSource.bind(this._model,e)},this._showChartProperties(e,t,i,s)):Promise.resolve(null)}async showChartPropertiesForSources(e){if(!R.enabled("property_pages"))return Promise.resolve(null);const{sources:t,title:s,tabName:n,renamable:a}=e,l=(0,
r.ensureNotNull)(this._model),c=O(t.map((e=>e.properties().childs()))),h=O(t.map((e=>e.properties().childs().intervalsVisibilities))),[{createPropertyPage:d},{getSelectionStylePropertiesDefinitions:u},{getSelectionIntervalsVisibilitiesPropertiesDefinition:p},{getSelectionCoordinatesPropertyDefinition:_}]=await Promise.all([Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,73955)),Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,43940)),Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,97456)),Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,41339))]);return async function(e){const{SourcesPropertiesEditorRenderer:t}=await Promise.all([i.e(5362),i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(6),i.e(5649),i.e(8056),i.e(5993),i.e(2191),i.e(6221),i.e(2587),i.e(2639),i.e(3502),i.e(8149),i.e(9842),i.e(7807),i.e(3353),i.e(4215),i.e(9327),i.e(6625),i.e(7194),i.e(6884),i.e(5940),i.e(3980),i.e(826),i.e(2486),i.e(7391),i.e(8904),i.e(962),i.e(1740),i.e(750),i.e(4403),i.e(4713),i.e(7051),i.e(5664),i.e(4648),i.e(5983),i.e(6780)]).then(i.bind(i,66512)),s=new t(e);return null!==I&&(I.hide(),I=s),s.show(),s}({sources:t,propertyPages:[d(u(c,l),"style",o.t(null,void 0,i(32733))),d({definitions:[_(t,l)]},"displacement",o.t(null,void 0,i(62764))),d(p(h,l),"visibility",o.t(null,void 0,i(21852)))],undoModel:l,title:s,activeTabId:n,renamable:a})}getPriceAxisWidthChangedByName(e){return"left"===e?this._lhsPriceAxisWidthChanged:this._rhsPriceAxisWidthChanged}getPriceAxisMaxWidthByName(e){return"left"===e?this._lhsAxesWidth:this._rhsAxesWidth}timeAxisHeight(){return null!==this._timeAxisWidget?this._timeAxisWidget.size.height:0}withModel(e,t){null!==this._model?t.call(e):this.modelCreated().subscribe(e,t,!0)}hasModel(){return null!==this._model}onRedraw(){return this._redraw}copyLineToOtherCharts(){const e=(0,r.ensureNotNull)(this._model),t=e.selection().lineDataSources().filter((e=>e.isSynchronizable()));e.model().copyToOtherCharts(t,!0)}hideDataSources(e){if(e.length){const t=e.map((e=>e.properties().visible)),i=e.map((()=>!1));this.model().setProperties(t,i,zi.format({title:new F.TranslatedString(e[0].name(),e[0].title(wi.TitleDisplayTarget.StatusLine))}))}}hideSelectedObject(){this.hideDataSources(this.model().selection().dataSources().filter((e=>!0)))}unlinkSelectedLine(){const e=(0,r.ensureNotNull)(this._model),t=e.selection().lineDataSources();e.unlinkLines(t)}selectPointMode(){return(0,r.ensureNotNull)(this._model).model().selectPointMode()}cancelRequestSelectPoint(){const e=(0,r.ensureNotNull)(this._model);e.model().cancelRequestSelectPoint(),e.model().setReplayStatus(e.model().isInReplay()?ReplayStatus.Pause:ReplayStatus.Undefined),this.model().model().clearCurrentPosition()}requestSelectPoint(e,t){const i=(0,r.ensureNotNull)(this._model);return e.selectPointMode===Be.SelectPointMode.Replay&&i.model().setReplayStatus(ReplayStatus.PointSelect),new Promise(((s,r)=>{
const n=()=>!!this.isVisible()||(r("Chartwidget must be visible"),this.cancelRequestSelectPoint(),!1);if(!n())return;(0,Be.resetToCursor)(!0),i.lineBeingCreated()&&i.cancelCreatingLine();let o=!1;const a={};i.model().onPointSelected().subscribe(a,((e,t)=>{o=!0,this._isVisible.unsubscribe(n),this._hideHint(),s({point:e,pane:t})}),!0),i.model().requestSelectPoint(e),this.startTrackingMode(),void 0!==t&&this._showEventHint(t),this._isVisible.subscribe(n),this.selectPointMode().subscribe((()=>{setTimeout((()=>{o||(this.selectPointMode().value()===Be.SelectPointMode.None&&this._hideHint(),i.model().onPointSelected().unsubscribeAll(a),this._isVisible.unsubscribe(n),r("cancelled"))}))}),{once:!0})}))}onScroll(){return this._onScroll}onZoom(){return this._onZoom}images(e){window.TradingView.printing=!0;const t=this.model().selection().allSources();this.model().selectionMacro((e=>e.clearSelection())),this.model().model().recalculateAllPanes((0,Gt.globalChangeEvent)());const i=(t,i)=>{t.paint(i);const s={showCollapsedStudies:Boolean(null==e?void 0:e.showCollapsedStudies),status:null==e?void 0:e.status};return t.getScreenshotData(s)},s=[];if(null!==this._maximizedPaneWidget){const e=this._paneWidgets.indexOf(this._maximizedPaneWidget);s.push(i(this._maximizedPaneWidget,ue.InvalidationMask.light().invalidateForPane(e)))}else for(let e=0;e{t.forEach((t=>{e.addSourceToSelection(t)}))})),this.model().model().recalculateAllPanes((0,Gt.globalChangeEvent)()),this.model().model().lightUpdate();const n=this.mainSeriesQuotesAndMetainfo();return{panes:s,timeAxis:r,colors:{text:this.properties().childs().scalesProperties.childs().textColor.value(),bg:this.properties().childs().paneProperties.childs().background.value(),scales:this.properties().childs().scalesProperties.childs().lineColor.value()},meta:n.meta,ohlc:n.ohlc,quotes:n.quotes}}insertStudy(e,t,i,s){return new Promise((r=>{0!==t.length?window.runOrSignIn((()=>{r(this._insertStudy(e,t,i,s))}),{source:"study on study"}):r(this._insertStudy(e,t,i,s))})).catch((()=>null))}addOverlayStudy(e,t,i){const s=this.model();return this._options&&this._options.isSymbolAvailable?this._options.isSymbolAvailable(e).then((r=>{if(!r)return null;const n=s.createStudyInserter({type:"java",studyId:"Overlay@tv-basicstudies"},[]),o={allowExtendTimeScale:i};if(R.enabled("use_overrides_for_overlay")){const e=(0,Vi.factoryDefaults)("study_Overlay@tv-basicstudies.style");o.style=e}return n.setPropertiesState(o),n.setForceOverlay(t),n.insert((()=>Promise.resolve({inputs:{symbol:e},parentSources:[]})))})):Promise.resolve(null)}addCompareStudy(e){const t=this.model()
;return this._options&&this._options.isSymbolAvailable?this._options.isSymbolAvailable(e).then((i=>i?t.createStudyInserter({type:"java",studyId:"Compare@tv-basicstudies"},[]).insert((()=>Promise.resolve({inputs:{symbol:e},parentSources:[]}))):null)):Promise.resolve(null)}showIndicators(e,t){if(window.studyMarket)return window.studyMarket.visible().value()?void window.studyMarket.hide():(window.studyMarket.show(e,t),window.studyMarket)}setSaveChartService(e){this._saveChartService=e,null!==this._lineToolsSynchronizer&&this._lineToolsSynchronizer.setSaveChartService(e)}getSaveChartService(){return this._saveChartService}mainSeriesQuotesAndMetainfo(){let e,t,i;const s=this._model&&this._model.mainSeries();if(s){const r=e=>null==e?"":s.formatter().format(e,void 0,void 0,!0,!1)+"",n=e=>null==e?"":e+"";e={resolution:s.interval(),symbol:s.symbol(),values:s.valuesProvider().getValues(null)};const o=s.symbolInfo();o&&(e.symbol=o.full_name,e.description=o.description,e.exchange=o.exchange);const a=s.bars().last();null!==a&&(t=a.value.slice(1,5).map(r));const l=s.quotes();l&&(i={change:r(l.change),changePercent:n(l.change_percent),last:r(l.last_price)})}return{meta:e,ohlc:t,quotes:i}}isMultipleLayout(){return this._isMultipleLayout}updateCrossHairPositionIfNeeded(){if(this._model){const e=Be.tool.value();this._model.model().setCurrentTool(e);const t=(0,pe.lastMouseOrTouchEventInfo)();if(t.isTouch){const e=this._maximizedPaneWidget||this._paneWidgets[0];if(e.hasState()&&(!t.stylus&&(this._isLineToolModeExceptBrush()||(0,Be.toolIsMeasure)(Be.tool.value()))||this.selectPointMode().value()!==Be.SelectPointMode.None)){const t=.5*this._model.model().timeScale().width(),i=.5*e.state().defaultPriceScale().height();e.setCursorPosition(t,i)}const i=this._model.model().crossHairSource();i.updateAllViews((0,Gt.sourceChangeEvent)(i.id()))}}}trackingModePaneWidget(){if(!(0,pe.lastMouseOrTouchEventInfo)().isTouch)return null;for(const e of this.paneWidgets())if(e.trackingModeEnabled())return e;return null}startTrackingMode(){if((0,pe.lastMouseOrTouchEventInfo)().isTouch){this.exitTrackingMode(),this.updateCrossHairPositionIfNeeded();const e=this._maximizedPaneWidget||this._paneWidgets[0],t=this.model().model().crossHairSource().currentPoint();e.startTrackingMode(t,t)}}exitTrackingMode(){(0,pe.lastMouseOrTouchEventInfo)().isTouch&&this.paneWidgets().some((e=>e.trackingModeEnabled()))&&(this.paneWidgets().forEach((e=>e.exitTrackingMode())),this.model().model().clearCurrentPosition())}onToolChanged(){this.model().lineBeingCreated()&&this._cancelCreatingLine(),this.selectPointMode().value()!==Be.SelectPointMode.None&&this.cancelRequestSelectPoint(),this.exitTrackingMode()}setInLoadingState(e){this._inLoadingState=e}paint(e){const t=null!=e?e:ue.InvalidationMask.full();t.validationActions().forEach((e=>e())),this._paneWidgets.forEach(((e,i)=>{null!==this._maximizedPaneWidget&&this._maximizedPaneWidget!==e||e.paint(t.invalidateForPane(i))})),this._timeAxisWidget&&this._timeAxisWidget.paint(t.invalidateForTimeScale()),this._redraw.fire()}
GUIResetScales(){(0,d.trackEvent)("GUI","Reset Scales"),null!==this._model&&this._model.resetScales()}toggleMaximizePane(e){var t;if(!(this._paneWidgets.length<2)){this._maximizedPaneWidget?(this._maximizedPaneWidget.state().maximized().setValue(!1),this._maximizedPaneWidget=null,this._paneSeparators.forEach((e=>e.show()))):(this._maximizedPaneWidget=e,this._maximizedPaneWidget.state().maximized().setValue(!0),this._paneSeparators.forEach((e=>e.hide())));for(let e=this._paneWidgets.length;e--;)this._paneWidgets[e].updateControls(),this._paneWidgets[e].updatePriceAxisWidgetsStates();this._errorRenderer.updatePaneWidgets(),null===(t=this._timeAxisWidget)||void 0===t||t.updatePriceAxisStubs(),this._adjustSize(),this.updateCrossHairPositionIfNeeded()}}maximizedPaneWidget(){return this._maximizedPaneWidget}isMaximizedPane(){return null!==this._maximizedPaneWidget}unsetActivePaneWidget(){this.activePaneWidget=null}setActivePaneWidget(e){this.activePaneWidget=e}onPaneWidgetDestroyed(e){this.activePaneWidget===e&&(this.activePaneWidget=null)}backgroundTopTheme(){return this._backgroundTopTheme.readonly()}backgroundBasedTheme(){return this._backgroundBasedTheme.readonly()}backgroundBottomTheme(){return this._backgroundBottomTheme.readonly()}lineToolsAndGroupsDTO(){return(0,r.ensureNotNull)(this._lineToolsSynchronizer).prepareDTO()}resetLineToolsInvalidated(e,t,i){(0,r.ensureNotNull)(this._lineToolsSynchronizer).resetInvalidated(e,t,i)}applyLineToolUpdateNotification(e,t){(0,r.ensureNotNull)(this._lineToolsSynchronizer).applyLineToolUpdateNotification(e,t)}reloadAllLineTools(){(0,r.ensureNotNull)(this._lineToolsSynchronizer).reloadAllLineTools()}startApplyingLineToolUpdateNotification(){var e;null===(e=this._lineToolsSynchronizer)||void 0===e||e.startApplyingLineToolUpdateNotification()}endApplyingLineToolUpdateNotification(){var e;null===(e=this._lineToolsSynchronizer)||void 0===e||e.endApplyingLineToolUpdateNotification()}applyAlertIdByExternalSource(e,t){var i;null===(i=this._lineToolsSynchronizer)||void 0===i||i.applyAlertIdByExternalSource(e,t)}deleteAlertByExternalSource(e,t){var i;null===(i=this._lineToolsSynchronizer)||void 0===i||i.deleteAlertByExternalSource(e)}shouldBeSavedEvenIfHidden(){return this._model?this.model().model().shouldBeSavedEvenIfHidden():!!this._options.content.shouldBeSavedEvenIfHidden}showObjectsTreePanelOrDialog(){let e=!1;const t=window.widgetbar;if(t&&t.isVisible()){const i=(0,r.ensureNotNull)(t.setPage("object_tree"));(0,r.ensureNotNull)(i.widget("object_tree"));0,e="object_tree"===i.name}e||this.showObjectsTreeDialog()}showObjectsTreeDialog(){var e;null===(e=this._objectTreeDialogController)||void 0===e||e.show()}addCustomWidgetToLegend(e,t){this._customLegendWidgetsFactoryMap.set(e,t);for(const i of this.paneWidgets())i.addCustomWidgetToLegend(e,t)}applyIndicatorsToAllChartsAvailable(){if(!this.chartWidgetCollection().applyIndicatorsToAllChartsAvailable())return!1;for(const e of this.model().model().panes()){if(e.sourcesByGroup().all().some((e=>(0,Z.isStudy)(e)&&!0)))return!0}return!1}
restoreState(e,t,i){this._adjustSize();const s=(0,r.ensureNotNull)(this._model),n=(s.restoreState(this._content,t,i),s.mainSeries().properties().childs());this._symbolWV.setValue(n.symbol.value()),this._resolutionWV.setValue(n.interval.value()),this._setActions()}addCompareAsOverlay(e,t,i){const s=this.model();return(0,r.ensureDefined)(this._options.isSymbolAvailable)(e).then((r=>{if(!r)return null;const n=s.createStudyInserter({type:"java",studyId:"Overlay@tv-basicstudies"},[]);return n.setForceOverlay(!0),n.setPreferredPriceScale("as-series"),!0!==i&&n.setTargetPriceScaleMode({percentage:!0}),void 0!==t&&n.setPropertiesState({allowExtendTimeScale:t}),n.insert((async()=>({inputs:{symbol:e},parentSources:[]})))}))}scrollHelper(){return this._scrollHelper}chartPainted(){return this._drawPlanned?(null===this._chartPaintedPromise&&(this._chartPaintedPromise=(0,g.createDeferredPromise)()),this._chartPaintedPromise.promise):Promise.resolve()}setDataWindowWidget(e){this._dataWindowWidget=e}removeDataWindowWidget(){this._dataWindowWidget=null}showSelectedSourcesProperties(e){const t=(0,r.ensureNotNull)(this._model).selection().dataSources();if(1===t.length)this.showSourceProperties(t[0],e);else{const i=t.filter(Q.isLineTool);i.length>0&&this.showChartPropertiesForSources({sources:i,tabName:e})}}connect(){this._chartSession.isConnected().subscribe(this._onChartSessionIsConnectedChanged),this._chartSession.criticalError().subscribe(this,this._onChartSessionCriticalError),this._chartSession.connect(this._onData.bind(this))}finishInitWithoutConnect(){this._chartSession.disable(),this._init(),this._chartWidgetInitialized.fire()}reconnect(){this._chartSession.disconnect(),this._chartSession.connect()}update(){if(this.hasModel()){for(const e of this._paneWidgets)e.update();this._timeAxisWidget&&this._timeAxisWidget.update()}}setPriceAxisHovered(e,t){t?this._hoveredPriceAxes.add(e):this._hoveredPriceAxes.delete(e),this._anyAxisHovered.setValue(this._hoveredPriceAxes.size>0)}anyPriceAxisHovered(){return this._anyAxisHovered.readonly()}linkingGroupIndex(){return this._linkingGroupIndex}offsetInDocument(e){const t=this._paneWidgets.find((t=>t.state()===e));if(void 0===t)return{left:NaN,top:NaN};const i=t.getElement().getBoundingClientRect();return{left:Math.round(i.left+document.body.scrollLeft),top:Math.round(i.top+document.body.scrollTop)}}showHint(e,...t){if(0===e)this._showEventHint(...t);else if(1===e)throw new Error("Warning hint not implemented")}_registerLineToolHotkeys(){if(!this.readOnly()){const e=(e,t)=>{this.activePaneWidget&&("drawRightThere"===t.action?this.activePaneWidget.drawRightThere(e):Be.tool.setValue(e))},t=(t,i)=>()=>e(t,i);Object.entries(Ii.lineToolsSelectHotkeys).map((([e,i])=>({desc:i.description,hotkey:i.hash,handler:t(e,i)}))).forEach((e=>this._hotkeys.add(e)))}}_createShowDataWindowAction(){return this._showDataWindowAction=null,this._showDataWindowAction}_createChartResetAction(){return new z.ActionWithStandardIcon({actionId:"Chart.Scales.Reset",options:{label:o.t(null,void 0,i(34301)),
iconId:"Chart.Reset",statName:"ResetChart",onExecute:this.GUIResetScales.bind(this),hotkeyGroup:this._hotkeys,hotkeyHash:n.Modifiers.Alt+82}})}_createApplyColorThemeAction(){return null}_createRemoveSelectedObjectAction(){return new z.ActionWithStandardIcon({actionId:"Chart.SelectedObject.Remove",options:{label:o.t(null,void 0,i(34596)),iconId:"Chart.RemoveSelectedObject",statName:"RemoveSelectedObject",onExecute:()=>{var e;(null!==(e=this._chartWidgetCollection.activeChartWidget.value())&&void 0!==e?e:this).removeSelectedSources()},hotkeyGroup:this._hotkeys,hotkeyHash:n.isMacKeyboard?8:46}})}_createResetTimescaleAction(){return new z.ActionWithStandardIcon({actionId:"Chart.TimeScale.Reset",options:{label:o.t(null,void 0,i(25333)),iconId:"Chart.Reset",statName:"ResetScale",onExecute:()=>{this.model().resetTimeScale()},hotkeyGroup:this._hotkeys,hotkeyHash:n.Modifiers.Mod+n.Modifiers.Alt+81}})}_createChartPropertiesAction(){return new z.ActionWithStandardIcon({actionId:"Chart.Dialogs.ShowGeneralSettings",options:{label:(0,m.appendEllipsis)(o.t(null,void 0,i(89517))),iconId:"Settings",statName:"ChartProperties",onExecute:()=>{this.showGeneralChartProperties()}}})}_createMainSeriesPropertiesAction(){return new z.ActionWithStandardIcon({actionId:"Chart.Dialogs.ShowGeneralSettings.SymbolTab",options:{label:(0,m.appendEllipsis)(o.t(null,void 0,i(89517))),iconId:"Settings",statName:"MainSeriesProperties",onExecute:()=>{this.showGeneralChartProperties(Y.TabNames.symbol)}}})}_createScalesPropertiesAction(){return new z.ActionWithStandardIcon({actionId:"Chart.Dialogs.ShowGeneralSettings.ScalesTab",options:{label:(0,m.appendEllipsis)(o.t(null,void 0,i(89517))),iconId:"Settings",statName:"ScalesProperties",onExecute:()=>{this.showGeneralChartProperties(Y.TabNames.scales)}}})}_createSelectedSourcePropertiesAction(){return new z.ActionWithStandardIcon({actionId:"Chart.SelectedObject.ShowSettingsDialog",options:{label:(0,m.appendEllipsis)(o.t(null,void 0,i(89517))),iconId:"Settings",statName:"EditSelectedObject",onExecute:()=>{this.showSelectedSourcesProperties()}}})}_createHideSelectedObjectAction(){return new z.ActionWithStandardIcon({actionId:"Chart.SelectedObject.Hide",options:{label:o.t(null,void 0,i(31971)),iconId:"Chart.Hide",statName:"HideSelectedObject",onExecute:this.hideSelectedObject.bind(this)}})}_createShowSymbolInfoDialogAction(){return new z.ActionWithStandardIcon({actionId:"Chart.Dialogs.ShowSymbolInfo",options:{label:(0,m.appendEllipsis)(o.t(null,void 0,i(65986))),iconId:"Chart.SymbolInfo",checkable:!1,statName:"SymbolInfo",onExecute:()=>{{const e=this.model().model(),t=e.mainSeries().symbolInfo();if(t){const i=e.availableUnits(),s={symbolInfo:t,showUnit:e.unitConversionEnabled(),unitDescription:e=>e?i.description(e):"",dateFormatter:e.dateFormatter()};(0,_.showSymbolInfoDialog)(s)}}}}})}_createShowFinancialsAction(){return null}_createAddToWatchlistAction(){return null}_clearSelectionHotkey(){return{desc:"Cancel selection",hotkey:27,handler:()=>{var e,t,i,s
;if(this.selectPointMode().value()!==Be.SelectPointMode.None)return this.selectPointMode().value()===Be.SelectPointMode.Replay&&this._chartWidgetCollection.getAll().forEach((e=>{e!==this&&e.selectPointMode().value()===Be.SelectPointMode.Replay&&e.cancelRequestSelectPoint()})),void this.cancelRequestSelectPoint();null===(e=this._model)||void 0===e||e.selectionMacro((e=>{this._cancelCreatingLine(),e.clearSelection()}));const r=null===(t=this._model)||void 0===t?void 0:t.model().customSourceMovingHitTestData();r&&r.cancelMoveHandler&&r.cancelMoveHandler()&&(r.cancelled=!0,null===(i=this._model)||void 0===i||i.model().setMovingCustomSource(null,null),null===(s=this._model)||void 0===s||s.model().lightUpdate())},isDisabled:()=>{const e=this._model;if(!e)return!0;const t=0===e.selection().allSources().length,i=null===e.crossHairSource().measurePane().value(),s=this.selectPointMode().value()===Be.SelectPointMode.None;return t&&i&&s}}}_insertStudy(e,t,i,s){const n=(0,r.ensureNotNull)(this._model).createStudyInserter(e,t,i);n.setForceOverlay("java"===e.type&&"Volume@tv-basicstudies"===e.studyId&&R.enabled("volume_force_overlay"));const o=n.insert(((e,i,r)=>new Promise(((n,o)=>{var a;this.selectPointMode().value()!==Be.SelectPointMode.None&&this.cancelRequestSelectPoint(),s?n(s(e,i,r)):!function(e){return Gi.includes(e.id)}(r)?(null!=(a=i)?a:[]).some((e=>e.confirm))?((0,d.trackEvent)("GUI","Confirmation dialogs","Inputs confirmation dialog"),T(this,e,r,n,o)):n({inputs:{},parentSources:t}):((0,d.trackEvent)("GUI","Confirmation dialogs","Symbol confirmation dialog"),T(this,e,r,n,o,"symbol"))}))));return o.then((()=>{(0,Be.hideAllIndicators)().value()&&(0,S.toggleHideMode)()})).catch((e=>{})),o}async _showChartProperties(e,t,i,s){if(!this._model)return null;t&&((0,c.setValue)("properties_dialog.active_tab.chart",t),i.tabName=t);const r=await ie(e,this._model,i,this._options.chartWidgetCollection,s);return(null==r?void 0:r.visible().value())?r:null}_createLineToolsSynchronizerIfNeeded(){var e;if(R.enabled("saveload_separate_drawings_storage")){const t={readOnlyMode:this.readOnly(),migrateSyncedLineTools:this===this._options.chartWidgetCollection.getAll()[0]},i=(0,Fi.getLineToolsSynchronizerClass)();this._lineToolsSynchronizer=new i({layoutId:this.layoutId(),chartId:this._id,clientId:this._chartWidgetCollection.clientId},this.model().model(),t,(()=>this._chartWidgetCollection.isFirstChartInLayout(this)),(()=>this._chartWidgetCollection.deserializedChartIds())),null!==this._saveChartService&&this._lineToolsSynchronizer.setSaveChartService(this._saveChartService),this._lineToolsSynchronizer.invalidateAll(),null===(e=this._model)||void 0===e||e.model().setLineToolsSynchronizer(this._lineToolsSynchronizer)}}_updateThemedColor(){const e=this.model().model(),t=e.backgroundColorAtYPercentFromTop(.5);let i=e.backgroundTopColor().value(),s=e.backgroundColor().value();const r=(0,u.isColorDark)(t),n=(0,u.isColorDark)(i),o=(0,u.isColorDark)(s);this.widget().classList.toggle("chart-widget--themed-dark",r),
this.widget().classList.toggle("chart-widget--themed-light",!r),this.widget().classList.toggle("chart-widget__top--themed-dark",n),this.widget().classList.toggle("chart-widget__top--themed-light",!n),this.widget().classList.toggle("chart-widget__bottom--themed-dark",o),this.widget().classList.toggle("chart-widget__bottom--themed-light",!o),this._backgroundTopTheme.setValue(n?"dark":"light"),this._backgroundBasedTheme.setValue(r?"dark":"light"),this._backgroundBottomTheme.setValue(o?"dark":"light"),i===s&&(0,h.isStdThemedDefaultValue)("chartProperties.paneProperties.background",i,this._backgroundBasedTheme.value())&&(i=null,s=null);for(const e of this._paneWidgets)e.updateThemedColors({topColor:i,bottomColor:s})}_isLineToolModeExceptBrush(){const e=Be.tool.value();return(0,Ot.isLineToolName)(e)&&!(0,Ot.isLineDrawnWithPressedButton)(e)&&this.selectPointMode().value()===Be.SelectPointMode.None}_cancelCreatingLine(){const e=(0,r.ensureNotNull)(this._model).model(),t=e.lineBeingCreated();if(null!==t){const i=(0,r.ensureNotNull)(e.paneForSource(t));(0,r.ensureNotNull)(this.paneByState(i)).cancelCreatingLineTool(),t.toolname===Be.tool.value()&&(0,Be.resetToCursor)()}const i=e.crossHairSource().measurePane().value();if(null!==i){(0,r.ensureNotNull)(this.paneByState(i)).cancelMeasuring()}}_adjustSize(e){var t;let i=0;const r=null===this._model?null:this._model.model().priceScaleSlotsCount(),n=new Uint32Array(null===r?0:r.left),o=new Uint32Array(null===r?0:r.right),l=(0,de.getCanvasDevicePixelRatio)(document.body),c=(e,t)=>e+t,h=(e,t)=>{t.forEach(((t,i)=>{e[i]=Math.max(e[i],t)}))},d=this._width(),u=this._height(),p=this._paneSeparators.length,_=this.isMaximizedPane()?0:Te.height()*p,m=null!==this._timeAxisWidget?this._timeAxisWidget.optimalHeight():0;let g=u-m>=61?m:0;g%2&&(g+=1);const f=Math.max(1,Math.floor((u-_-g)/this._paneWidgets.length));let v=0,S=null;for(const e of this._paneWidgets)if(!this._maximizedPaneWidget||this._maximizedPaneWidget===e){e.leftPriceAxisesContainer().updateCurrencyLabels();const t=e.leftPriceAxisesContainer().optimalWidths();e.rightPriceAxisesContainer().updateCurrencyLabels();const s=e.rightPriceAxisesContainer().optimalWidths();h(n,t),h(o,s),this._maximizedPaneWidget!==e&&e.state().collapsed().value()?v+=Math.min(f,e.collapsedHeight()):(i+=e.stretchFactor(),S=e)}let y=n.reduce(c,0),b=o.reduce(c,0),w=Math.max(d-y-b,0);if(w<=102){y=0,b=0,w=d;for(let e=0;e0){const e=new Te(this,r-1,r);this._paneSeparators.push(e),this._timeAxisWidget?this._elMainTable.insertBefore(e.getElement(),this._timeAxisWidget.getElement()):this._elMainTable.appendChild(e.getElement())}this._timeAxisWidget?this._elMainTable.insertBefore(i.getElement(),this._timeAxisWidget.getElement()):this._elMainTable.appendChild(i.getElement())}for(let i=0;iue.InvalidationLevel.Cursor&&(null===(i=this._timeAxisWidget)||void 0===i||i.update(),this._paneWidgets.forEach((e=>{e.updatePriceAxisWidgets()})),this._applyTimeScaleInvalidations(e,t),(null===(s=this._invalidationMask)||void 0===s?void 0:s.fullInvalidation())===ue.InvalidationLevel.Full&&(this._invalidationMask.merge(e),this._adjustSize(this._invalidationMask.isVisibleTimeRangeLockedOnResize()),this._applyTimeScaleInvalidations(this._invalidationMask,t),e=this._invalidationMask,this._invalidationMask=null)),this.paint(e),this._dataWindowWidget){const t=e.maxPaneInvalidation();t===ue.InvalidationLevel.Full?this._dataWindowWidget.fullUpdate():t>ue.InvalidationLevel.None&&this._dataWindowWidget.update()}for(let t=0;t{s.appendChild(n),n.addEventListener("mousedown",this._beginRequestActive.bind(this)),n.addEventListener("mouseup",this._endRequestActive.bind(this)),n.addEventListener("touchstart",this._beginRequestActive.bind(this)),n.addEventListener("touchmove",this._endRequestActive.bind(this)),n.addEventListener("touchend",this._endRequestActive.bind(this)),n.addEventListener("click",this._requestActive.bind(this))})),this._inited&&(null!==this._timeAxisWidget&&(this._timeAxisWidget.destroy(),this._timeAxisWidget=null),this._paneWidgets.forEach((e=>{e.destroy()})),this._paneWidgets.length=0,this._paneSeparators.forEach((e=>{e.destroy()})),this._paneSeparators.length=0,this._update(ue.InvalidationMask.full(),performance.now()))}_init(){this.hasModel()&&this.model().mainSeries().clearData(),this._initColors(),this._makeDefaultGui();this._makeDefaultModel(),(()=>{this._checkObsoleteTimezone(),this._chartSession&&this._chartSession.connected()&&this.model().model().restart(),this._content&&(this._initColors(),this._updateGui(),this.update()),this._resizeHandler=()=>{this._invalidationHandler(ue.InvalidationMask.full())},this._resizeHandler(),(0,r.ensureNotNull)(this._parent).appendChild((0,r.ensureNotNull)(this._mainDiv)),this._spinner&&(this._spinner.stop(),this._spinner=null),this._keydownEventListener=e=>{27===e.which&&e.preventDefault()},window.addEventListener("keydown:chart_"+this._id,this._keydownEventListener),this._activateSymbolSearchHotkeys(),this.model().timeScale().onScroll().subscribe(this,(()=>this._onScroll.fire())),this._inited=!0})()}_makeDefaultModel(){let e;if(this._content&&this._content.timeScale.points){const t=this._content.timeScale.points.items[0];e={startDate:t}}const t=()=>{var t,i;const s={readOnly:this.readOnly(),isSnapshot:!!this._containsData,...f(this._options,["timeScale","crossHair","chartEventsEnabled","newsNotificationsEnabled","esdEnabled","latestUpdatesEnabled","continuousContractSwitchesEnabled","futuresContractExpirationEnabled","countdownEnabled","lastPriceAnimationEnabled","currencyConversionEnabled","unitConversionEnabled","watermarkEnabled","shiftVisibleRangeOnNewBar","hideIdeas","onWidget"])},r=function(e,t,i,s,r,n,o,a,l,c,h){const d=new yi.ChartUndoModel(e,t,i,s,r,n,o,a,l,c,h);return d.model().fullUpdate(),d
}(this._chartSession,this._invalidationHandler,this.properties(),e,this,this._options.undoHistory,this._options.barsMarksContainersFactory,s,this._collapsed,this._linkingGroupIndex,null!==(i=null===(t=this._saveChartService)||void 0===t?void 0:t.autoSaveEnabled())&&void 0!==i?i:new W.WatchedValue(!0));return this._createSessions(r.model()),r};R.enabled("lean_chart_load")?this._model=this._model||t():this._model=t(),this._model.model().setChartSaveTime(1e3*this._chartWidgetCollection.metaInfo.lastModified.value()),this._createVolumeIfNeeded();if(this._content){let e=this._setSymbolIntervalContentOverrides;Hi&&this._initialLoading&&(e={...e,symbol:this._defSymbol,interval:this._defInterval,style:this._defStyle}),this.restoreState(this._content,this._containsData,e),this._setSymbolIntervalContentOverrides={},Hi&&this._defSymbol&&this.model().model().recalculatePriceRangeOnce()}else this._setActions();this._createLineToolsSynchronizerIfNeeded(),(()=>{const e=(0,r.ensureNotNull)(this._model);e.onTagsChanged().subscribe(this,(()=>this.onModelTagsChanged())),this._initBackgroundColor(),this._updateGui(),this._modelCreated.fire(e),this._tagsChanged.fire(),R.enabled("determine_first_data_request_size_using_visible_range")&&this._setFirstRequestNumbarsUsingTimeframeAndInterval(e);const t=e.mainSeries(),s=t.properties().childs();this._defTimeframe&&t.setDefaultTimeframe(this._defTimeframe),t.dataEvents().symbolNotPermitted().subscribe(null,(e=>t.setSymbolParams({symbol:e}))),this._symbolWV.setValue(s.symbol.value()),s.symbol.subscribe(this,(e=>this._symbolWV.setValue(e.value()))),this._resolutionWV.setValue(s.interval.value()),s.interval.subscribe(this,(e=>this._resolutionWV.setValue(e.value()))),s.style.unsubscribe(this,this._onChartStyleChanged),s.style.subscribe(this,this._onChartStyleChanged),t.dataEvents().completed().subscribe(this,(()=>this._addPerfMark("SeriesCompleted")),!0),t.dataEvents().barReceived().subscribe(this,(()=>this._addPerfMark("SeriesFirstDataReceived")),!0);const n=this._options;t.dataEvents().chartTypeNotPermitted().subscribe(null,(()=>{t.setSymbolParams({interval:"D"})})),t.dataEvents().intradaySpreadNotPermitted().subscribe(null,(()=>{t.setSymbolParams({interval:"D"})})),t.dataEvents().customIntervalNotPermitted().subscribe(null,(i=>{const s=e.model().defaultResolutions(),r=s.find((e=>(0,jt.compareResolutions)(e,i)>=0)),n=null!=r?r:s[s.length-1];t.setSymbolParams({interval:n})}));const a=o.t(null,void 0,i(93213));t.dataEvents().intradayExchangeNotPermitted().subscribe(null,(()=>{t.setSymbolParams({interval:"D"})})),t.requestingTicksWhenNotSupported.subscribe(null,(()=>{if(!n.muteSessionErrors){const e=document.createElement("div"),t=o.t(null,void 0,i(87826)).format({p_start:"",p_end:"
"});e.innerHTML=t,showNoticeDialog({title:a,content:e})}})),t.requestingStyleIsNotSupported.subscribe(null,(()=>{const i=t.interval(),s=e.model().defaultResolutions(),r=(0,ae.getLastUsedSingleValueBasedStyle)(),n=(0,jt.getResolutionByChartStyle)(r,i,s);t.setChartStyleWithIntervalIfNeeded(r,n)})),
t.requestingStyleSupportRecovered.subscribe(null,(i=>{const s=t.interval(),r=e.model().defaultResolutions(),n=(0,jt.getResolutionByChartStyle)(i,s,r);t.setChartStyleWithIntervalIfNeeded(i,n)}))})()}_startSpinner(e){this._spinner||e&&(this._spinner=(new k).spin(e))}_handleLoginStateChanged(){0}_checkObsoleteTimezone(){const e=this.properties().childs().timezone.value();(0,V.timezoneIsAvailable)(e)||this.properties().childs().timezone.setValue({UTC:"Etc/UTC",EST:"America/New_York",CST:"America/Chicago",PST:"America/Los_Angeles"}[e]||"exchange")}_initColors(){const e=this.properties().childs(),t=e.scalesProperties.childs();t.lineColor.listeners().subscribe(this,this._updateAndPaint),t.textColor.listeners().subscribe(this,this._updateAndPaint),e.paneProperties.childs().separatorColor.listeners().subscribe(this,this._setPaneSeparatorLineColor)}_setPaneSeparatorLineColor(){this._paneSeparators.forEach((e=>e.update())),this._updateAndPaint()}_updateAndPaint(){this.update(),this.paint()}_makeDefaultGui(){this._makeLoadingScreen(),((0,xi.getChartingLibraryGlobalContext)().configurationData.is_tradingview_data||this.onWidget())&&this._makeAvailableOnTVPopup(),this.hasModel()&&(this._makeTimeAxisWidget(),this._makePaneWidgetsAndSeparators()),this._adjustSize(),this._updateScalesActions(),(0,U.disableSelection)(this._elMainTable),this._updateAndPaint()}_makeLoadingScreen(){if(R.enabled("lean_chart_load")){if(this.screen)return;this.screen=new ve(this,(0,r.ensureNotNull)(this._parent))}else this.screen=new ve(this,(0,r.ensureNotNull)(this._mainDiv))}_makeAvailableOnTVPopup(){this._availableScreen||(this._availableScreen=new Li(this))}_activateSymbolSearchHotkeys(){this.readOnly()||this._options.hideSymbolSearch||(0,v.activateKeyPressHandler)()}_makeTimeAxisWidget(){if(this._timeAxisWidget)return void this._timeAxisWidget.updatePriceAxisStubs();const e=this.model();this._timeAxisWidget=new Si(this,this._options.timeScaleWidget,this._titlesProvider.bind(this),this._menuItemsProvider.bind(this),this._backgroundBasedTheme),this._elMainTable.appendChild(this._timeAxisWidget.getElement()),this._timeAxisWidget.updatePriceAxisStubs(),this._timeAxisWidget.onLabelHovered().subscribe(this,((t,i)=>{const s=this._maximizedPaneWidget?this._maximizedPaneWidget.state():e.paneForSource(e.mainSeries()),n=(0,r.ensureNotNull)(this.paneByState((0,r.ensureNotNull)(s))).highlightedPriceAxis(),o=n.value();(i||o.owner===t.owner)&&(n.setValue({owner:t.owner,axis:i?t.axis:null}),this.model().model().lightUpdate())}))}_updateAriaPriceDescription(e){var t;if(this._ariaPriceDescription&&R.enabled("aria_crosshair_price_description")){const i=this.model().mainSeries().nearestData(e.index,Oi.PlotRowSearchMode.Exact);if(!i)return;const s=i.value[4];if(!(0,C.isNumber)(s))return;const r=this.model().timeScale().indexToUserTime(i.index),n=Bi.Interval.parse(this.model().mainSeries().interval());this._ariaPriceDescription.updateChartDescription(this.model().mainSeries(),s,null!==(t=null==r?void 0:r.getTime())&&void 0!==t?t:null,n.isIntraday())}}_titlesProvider(e,t){
const i=this.model(),s=(0,r.ensureNotNull)(this._maximizedPaneWidget?this._maximizedPaneWidget.state():i.paneForSource(i.mainSeries())),n="right"===e?s.rightPriceScales():s.leftPriceScales();if(n.lengthe===i.mainSeries()||(0,Z.isStudy)(e)));return o.reverse(),o=(0,D.moveToHead)(o,i.mainSeries()),o.map((e=>e.title(wi.TitleDisplayTarget.StatusLine,!0,void 0,!1)))}_menuItemsProvider(e,t){const i=this.model(),s=(0,r.ensureNotNull)(this._maximizedPaneWidget?this._maximizedPaneWidget.state():i.paneForSource(i.mainSeries())),n="right"===e?s.visibleRightPriceScales():s.visibleLeftPriceScales();if(n.length{const i=this._model;if(null===i)return;const s=i.model();e.model!==s&&(this._lineToolsSynchronizer?this._lineToolsSynchronizer.executeSyncedAction((()=>t(s,i))):t(s,i))};Be.createdLineTool.subscribe(null,(t=>{e(t,((e,i)=>{const s=(0,r.ensureNotNull)(e.paneForSource(e.mainSeries()));let n,o=null;if(void 0===t.pointPositionPercents){if(o=ji(e,t.model,t.point.timeStamp),null===o)return;n=t.point.price}else{const i=t.pointPositionPercents.x*e.timeScale().width(),s=e.mainSeries().priceScale(),r=t.pointPositionPercents.y*s.height(),a=e.mainSeries().firstValue();if(null===a)return;o=e.timeScale().coordinateToIndex(i),n=s.coordinateToPrice(r,a)}const a={index:(0,r.ensureNotNull)(o),price:n},l=i.createLineTool({pane:s,point:a,linetool:t.linetool,properties:t.properties,linkKey:t.linkKey,ownerSource:e.mainSeries(),disableSynchronization:!0,id:t.id,sharingMode:t.sharingMode});null!==l&&!Boolean(this.model().lineBeingCreated())&&t.finalState&&l.restoreExternalPoints(t.finalState,{indexesChanged:!0,pricesChanged:!0})}))})),Be.continuedLineTool.subscribe(null,(t=>{e(t,((e,i)=>{var s;const r=ji(e,t.model,t.point.timeStamp);if(null===r)return;const n={index:r,price:t.point.price},o=e.lineBeingCreated();if(null===o)return;i.continueExternalLine(n,null!==(s=t.envState)&&void 0!==s?s:void 0,!!t.finalState)&&t.finalState&&o.restoreExternalPoints(t.finalState,{indexesChanged:!0,pricesChanged:!0})}))})),Be.cancelledLineTool.subscribe(null,(t=>{e(t,((e,t)=>{e.cancelCreatingLine()}))})),Be.beenSetLineToolLastPoint.subscribe(null,(t=>{e(t,((e,i)=>{const s=e.lineBeingCreated();if(null===s||s.linkKey().value()!==t.linkKey)return;const r=ji(e,t.model,t.point.timeStamp);if(null===r)return;const n={index:r,price:t.point.price};s.setLastPoint(n),s.updateAllViews((0,Gt.sourceChangeEvent)(s.id())),e.lightUpdate()}))})),Be.startedMovingLineTool.subscribe(null,(t=>{e(t,((e,i)=>{var s;const r=t.linkKeys.map(Q.lineToolByLinkKey.bind(null,e)).filter(C.notNull);if(r.length){const i=ji(e,t.model,t.point.timeStamp);if(null===i)return;const n={index:i,price:t.point.price},o=null!==(s=t.activeItem)&&void 0!==s?s:null,a=r[0].pointToScreenPoint(n);a&&e.startMovingSources(r,{logical:n,screen:a},o,t.pointPositionPercents,null===t.envState?void 0:t.envState,!0)}}))})),Be.movedLineTool.subscribe(null,(t=>{e(t,((e,i)=>{var s;const r=e.sourcesBeingMoved().filter(Q.isLineTool).filter((e=>(e=>t.linkKeys.some((t=>e.linkKey().value()===t)))(e)));if(!r.length)return;const n=ji(e,t.model,t.point.timeStamp);if(null===n)return;const o={index:n,price:t.point.price},a=r[0].pointToScreenPoint(o);a&&e.moveSources({logical:o,screen:a},t.pointPositionPercents,null!==(s=t.envState)&&void 0!==s?s:void 0,!0)}))})),Be.finishedMovingLineTool.subscribe(null,(t=>{e(t,((e,i)=>{const s=e.sourcesBeingMoved().filter(Q.isLineTool);if(0===s.length)return;s.forEach((i=>{const s=(e=>{for(let i=0;i{e(t,((e,i)=>{var s;const r=(0,Q.lineToolByLinkKey)(e,t.linkKey);if(null!==r){const i=r.getPoint(t.pointIndex),n=i?i.index:ji(e,t.model,t.point.timeStamp);if(null===n)return;if(r.isActualSymbol()&&r.isActualCurrency()&&r.isActualUnit()){const i={index:n,price:t.point.price};e.startChangingLinetool(r,i,t.pointIndex,null!==(s=t.envState)&&void 0!==s?s:void 0,!0)}}}))})),Be.changedLineTool.subscribe(null,(t=>{e(t,((e,i)=>{const s=e.lineBeingEdited();if(null===s||s.linkKey().value()!==t.linkKey)return;let n=null;if(n=t.changes.indexesChanged?ji(e,t.model,t.point.timeStamp):(0,r.ensureNotNull)(e.linePointBeingChanged()).index,null!==n&&s.isActualSymbol()&&s.isActualCurrency()&&s.isActualUnit()){const i={index:n,price:t.point.price};e.changeLinePoint(i,void 0,!0)}}))})),Be.finishedChangingLineTool.subscribe(null,(t=>{e(t,((e,i)=>{const s=(0,Q.lineToolByLinkKey)(e,t.linkKey);null!==s&&s.isActualSymbol()&&s.isActualCurrency()&&s.isActualUnit()&&null!==e.lineBeingEdited()&&e.endChangingLinetool(!!t.finalState,!0),null!==s&&t.finalState&&s.restoreExternalPoints(t.finalState,t.changes)}))})),Be.removedLineTool.subscribe(null,(t=>{e(t,((e,i)=>{const{withUndo:s,unlink:r,linkKey:n}=t,o=(0,Q.lineToolByLinkKey)(e,n);if(null!==o)r&&o.detachAlert(),s?i.removeSource(o,!1):(e.lineToolsGroupModel().removeLineTools([o]),e.removeSource(o));else if(this._lineToolsSynchronizer){const{sourceTitle:e,symbol:o,lineToolState:a}=t;i.removeUnloadedLineTool({state:a,unlink:r,sourceTitle:e,linkKey:n,symbol:o,withUndo:s})}}))})),Be.finishedLineTool.subscribe(null,(t=>{e(t,((e,i)=>{const s=(0,Q.lineToolByLinkKey)(e,t.linkKey);null!==s&&(0,Ot.isLineToolFinishRequiredWhenCreatedByApi)(s.toolname)&&s.finish()}))})),Be.changedLineStyle.subscribe(null,(t=>{e(t,((e,i)=>{const s=(0,Q.lineToolByLinkKey)(e,t.linkKey);null!==s&&(s.restoreExternalState(t.state),s.propertiesChanged(!0),t.alertId&&s.syncAlert(t.alertId))}))})),Be.restoredLineToolState.subscribe(null,(t=>{e(t,((e,i)=>{const s=(0,Q.lineToolByLinkKey)(e,t.linkKey);if(null!==s){const i={...t.state};i.indexes=t.state.points.map((i=>({index:ji(e,t.model,i.time_t),price:i.price}))),e.restoreLineToolState(s,i,!1)}}))})),Be.restoredLineTool.subscribe(null,(t=>{e(t,((e,i)=>{e.restoreSource(t.state.restorePane,t.state.paneIndex,t.state.paneState,t.state.sourceState,null)}))})),Be.copiedLineTool.subscribe(null,(t=>{e(t,((e,i)=>{const s=(0,r.ensureNotNull)(e.paneForSource(e.mainSeries()));let n;const o={...t.state,intervalsVisibilities:(0,Ri.mergeIntervalVisibilitiesDefaults)(t.state.intervalsVisibilities)},a=(0,Q.createLineToolProperties)(t.linetool,o,e),l=e.dataSourceForId(t.id);if(l){if(!(0,
Q.isLineTool)(l))return void Wi.logError(`Error sync creating line tool. Object with id ${t.id} is already in use and it is not a line tool`);if(l.toolname!==t.linetool)return void Wi.logError(`Error sync creating line tool. Object with id ${t.id} is already in use and its type differs: ${l.toolname} and ${t.linetool}`)}if(l&&(l.linkKey().setValue(t.linkKey),l.share(t.sharingMode)),t.pointPositionPercents){const e={index:0,price:0};if(n=null!=l?l:i.createLineTool({pane:s,point:e,linetool:t.linetool,properties:a,linkKey:t.linkKey,disableSynchronization:!0,id:t.id}),null===n)return;n.restorePositionPercents((0,r.ensureDefined)(t.pointPositionPercents))}else{const o=t.points.map((i=>({index:(0,r.ensureNotNull)(ji(e,t.model,i.timeStamp)),price:i.price}))),c=o[0];if(l)n=l;else if(t.withUndo)n=i.createLineTool({pane:s,point:c,linetool:t.linetool,properties:a,linkKey:t.linkKey,sharingMode:t.sharingMode,disableSynchronization:!0,id:t.id});else{const e=new Pi.CreateLineToolUndoCommand({model:i.model(),pane:s,lineTool:t.linetool,ownerSource:(0,r.ensureNotNull)(s.mainDataSource()),drawOnAllChartsMode:t.sharingMode,id:t.id});e.redo(),e.startCreatingLine(c,a,t.linkKey||null,t.sharingMode),n=(0,r.ensureNotNull)(e.line())}if(null===n)return;const h=(e,s)=>{t.withUndo?i.continueCreatingLine(e,new Ee.EnvironmentState(void 0,!0),s,!0):i.model().continueCreatingLine(e,new Ee.EnvironmentState(void 0,!0),s,!0)},d=(0,Ot.isLineToolFinishRequiredWhenCreatedByApi)(t.linetool);if(e.lineBeingCreated())if(o.length>1)for(let e=1;e0){const i=Math.ceil(e.timeScale().width()/t.barCount);e.timeScale().setBarSpacing(i)}}_createEventHint(){if(null===this._eventHintDeferredPromise){const e=(0,g.createDeferredPromise)();this._eventHintDeferredPromise=e,Promise.all([i.e(6214),i.e(962),i.e(6166)]).then(i.bind(i,5015)).then((t=>{e.resolve(new t.ChartEventHintRenderer(this._chartWidgetCollection.getContainer()))}))}return this._eventHintDeferredPromise.promise}async _createWarningHint(){return null}_showEventHint(e){R.enabled("popup_hints")&&(null!==this._activeHint&&0===this._activeHint.type?this._activeHint.show(e):(this._hideHint(),this._createEventHint().then((t=>{this._activeHint=t,void 0!==e&&this._activeHint.show(e)}))))}_showWarningHint(e){0}_hideHint(){null!==this._activeHint&&this._activeHint.hide()}}},55148:(e,t,i)=>{"use strict";i.r(t),i.d(t,{activeLinkingGroupWV:()=>bi,allInitialModelsCreated:()=>ri,allInitialSymbolsResolved:()=>si,allLinkingGroupsWV:()=>Ci,applyIndicatorToAllChartsImpl:()=>mt,applyIndicatorsToAllChartsImpl:()=>_t,applyLineToolUpdateNotificationImpl:()=>Ct,applyThemeImpl:()=>ai,chartsSymbolsImpl:()=>Tt,checkProFeatureImpl:()=>ni,combinedTrackTimeLock:()=>Mi,computeContentBoxImpl:()=>Nt,copyScreenshotToClipboard:()=>Dt,createBroadcastChannel:()=>ei,createChartStorageSubscriptionsIfRequired:()=>It,createChartWidgetCollectionNewsNotifier:()=>Mt,createClipboardHandler:()=>Pt,createLeftBottomChartWidgetWV:()=>Vt,deserializedChartIds:()=>bt,destroyBroadcastChannel:()=>ti,downloadScreenshot:()=>kt,generateNewChartId:()=>jt,getAllLinkingGroups:()=>wi,getAsyncStateForChartImpl:()=>St,getChartWidgetsForIntervalLock:()=>Si,getClientSnapshot:()=>Rt,getLinkingGroupCharts:()=>Pi,getSnapshot:()=>Bt,getStateForChartImpl:()=>vt,getVisuallyAdjacentDefImpl:()=>zt,handleConnectionLimitReachedChanged:()=>Ti,handleDateRangeLockChange:()=>pi,handleInternalDateRangeLockChange:()=>ui,handleInternalIntervalLockChange:()=>hi,handleInternalSymbolLockChange:()=>li,handleInternalTrackTimeLockChange:()=>_i,handleIntervalLockChange:()=>di,handleSymbolLockChange:()=>ci,handleTrackTimeLockChange:()=>mi,hideChartImpl:()=>Yt,isFirstChartInLayout:()=>yt,
lineToolsAndGroupsDTOsImpl:()=>ft,removeChartWidgetSubscriptionsImpl:()=>Kt,resetLineToolsInvalidatedImpl:()=>wt,setBrokerImpl:()=>xt,setChartLayoutWithUndoImpl:()=>oi,setChartStyleToWidget:()=>vi,setLayoutImpl:()=>Xt,setResolution:()=>yi,setSymbol:()=>gi,setSymbolAll:()=>fi,someOfWidgetsAreInSelectingReplayPointMode:()=>Ii,subscribeToCompletedEventForDateRangeUpdate:()=>Ai,subscribeToEventsForDateRangeSync:()=>Ei,syncChartsDateRangesWithActiveChartRange:()=>Ri,syncCrosshairImpl:()=>Qt,syncScrollImpl:()=>ii,takeScreenshot:()=>At,takeServerScreenshot:()=>Lt,unsubscribeFromEventsForDateRangeSync:()=>Vi,updateLayoutImpl:()=>Ht,updateLayoutPartialImpl:()=>Wt,updateLinkingGroupCharts:()=>xi});var s=i(50151),r=i(86441),n=i(59224),o=i(11542),a=i(69109),l=i(49483),c=i(36298),h=i(14483);function d(e){const t={};return{promise:new Promise(((i,s)=>{e.subscribe(t,i,!0)})),destroy:()=>{e.unsubscribeAll(t)}}}var u=i(97145),p=(i(98310),i(62591));class _ extends p.UndoCommand{constructor(e,t){super(null),this._chartModel=e,this._targetIndex=t}redo(){const e=this._chartModel.createPane(this._targetIndex,void 0,this._paneId);this._paneId=e.id()}undo(){const e=(0,s.ensureDefined)(this._paneId),t=this._chartModel.panes().find((t=>t.id()===e));void 0!==t&&this._chartModel.removePane(t)}createdPaneId(){return this._paneId}}class m extends p.UndoCommand{constructor(e,t,i,s){super(s),this._setter=e,this._oldValue=t,this._newValue=i}redo(){this._setter(this._newValue)}undo(){this._setter(this._oldValue)}}class g extends m{constructor(e,t,i,s){super((e=>this._vwState.setValue(e)),t,i,s),this._vwState=e}}var f=i(94474),v=i(65446),S=i(93352);const y=(0,n.getLogger)("Clipboard");class b{constructor(e){this._e=e}write(e){return(0,v.writeImpl)(this._toRaw(e),this._e)}_toRaw(e){const t={files:[]};t.text=e.text,void 0!==e.app?t.html=this._serializeAppData(e.app,e.text):e.html&&(t.html=e.html);for(const i of e.files||[])t.files.push(i);return t}_serializeAppData(e,t){return`${t?(0,f.htmlEscape)(t.slice(0,256)):"📈"}`}}class w{constructor(e){this._e=e}async read(){this._e&&0===this._e.eventPhase&&(y.logWarn("Cannot use an already dispatched ClipboardEvent for reading"),this._e=null);const e=this._e?this._readUsingEvent(this._e):await this._readUsingApi();return this._fromRaw(e)}_readUsingEvent(e){const t=(0,s.ensure)(e.clipboardData);e.preventDefault();const i={files:[]};for(let e=0;e0&&(t.files=e.files),t}_parseAppData(e){if(-1===e.slice(0,1024).indexOf("data-tradingview-clip"))return;const t=(new DOMParser).parseFromString(e,"text/html").querySelector("[data-tradingview-clip]");return t?t.getAttribute("data-tradingview-clip")||"":void 0}_readBlobAsText(e){return new Promise(((t,i)=>{const s=new FileReader;s.onloadend=()=>{t(s.result)},s.onerror=()=>{i(s.error)},s.readAsText(e)}))}}var C=i(35749);function P(e){const t=e.target;return null!==t&&1===t.nodeType&&(0,C.isTextEditingField)(t)}function x(e){const t=e.target;if(null===t)return!1;const i=(t.ownerDocument||t).getSelection();return null!==i&&!i.isCollapsed}class T extends class{constructor(e){this._callbacks=Object.assign({},e),this._boundOnCopy=this._onCopyEv.bind(this),this._boundOnCut=this._onCutEv.bind(this),this._boundOnPaste=this._onPasteEv.bind(this)}listen(){document.addEventListener("copy",this._boundOnCopy),document.addEventListener("cut",this._boundOnCut),document.addEventListener("paste",this._boundOnPaste)}async peek(){if("granted"!==(await navigator.permissions.query({name:"clipboard-read"})).state)throw new Error("clipboard-read is not granted");return new w(null).read()}uiRequestCopy(e){this._callbacks.copyRequested&&this._callbacks.copyRequested(new b(null),e)}uiRequestCut(e){this._callbacks.cutRequested&&this._callbacks.cutRequested(new b(null),e)}uiRequestPaste(e){this._callbacks.pasteRequested&&this._callbacks.pasteRequested(new w(null),e)}destroy(){document.removeEventListener("copy",this._boundOnCopy),document.removeEventListener("cut",this._boundOnCut),document.removeEventListener("paste",this._boundOnPaste)}_onCopyEv(e){e.defaultPrevented||this._callbacks.copyRequested&&this._callbacks.copyRequested(new b(e))}_onCutEv(e){e.defaultPrevented||this._callbacks.cutRequested&&this._callbacks.cutRequested(new b(e))}_onPasteEv(e){e.defaultPrevented||this._callbacks.pasteRequested&&this._callbacks.pasteRequested(new w(e))}}{_onCopyEv(e){if(!P(e)&&!x(e))return super._onCopyEv(e)}_onCutEv(e){if(!P(e)&&!x(e))return super._onCutEv(e)}_onPasteEv(e){if(!P(e))return super._onPasteEv(e)}}const I=()=>i.e(4389).then(i.bind(i,82869));function M(e,t={}){return I().then((i=>i.copyToClipboardImageOfChart(e,t)))}function A(e,t={}){return I().then((i=>i.getImageOfChartSilently(e,t)))}var L=i(41249),k=i(42960),D=i(84015),E=i(11014),V=i(27714),B=i(24377),R=i(26843),N=i(78071),O=i(74359),F=i(46501),W=i(29764),H=i(34976),z=i(76351);const U=!h.enabled("widget_logo")||!1;function j(e,t=null,i=null){let s={};if("number"==typeof e)return{relativePositions:{[e]:{l:t,t:i}},nextElementLeft:e,nextElementTop:e};const[r,...n]=e;if("v"===r){let e=null
;for(const r of n){const n=j(r,t,i);s={...s,...n.relativePositions},i=n.nextElementTop,e=n.nextElementLeft}t=e}if("h"===r){let e=null;for(const r of n){const n=j(r,t,i);s={...s,...n.relativePositions},t=n.nextElementLeft,e=n.nextElementTop}i=e}return{relativePositions:s,nextElementTop:i,nextElementLeft:t}}const G=function(e){const t={};for(const i of Object.keys(e)){const s=j(e[i]).relativePositions;t[i]=s}return t}(H);function q(e,t,i,s){let r=Math.round(10*s),n=Math.round(10*s);const o=i[e];if(null!==o.l){const e=q(o.l,t,i,s);r=e.x+e.width+Math.round(5*s)}if(null!==o.t){const e=q(o.t,t,i,s);n=e.y+e.height+Math.round(5*s)}const a=t[e];return{x:r,y:n,width:a.width,height:a.height}}function $(e,t,i){var s;const r=(new DOMParser).parseFromString(z,"image/svg+xml");null===(s=null==r?void 0:r.firstElementChild)||void 0===s||s.setAttribute("color",i);const n=URL.createObjectURL(new Blob([(new XMLSerializer).serializeToString(r)],{type:"image/svg+xml"}));return new Promise((i=>{const s=new Image;s.width=e,s.height=t,s.onload=()=>{i({image:s,width:e,height:t})},s.src=n}))}function Y(e,t,i,s,r){e.save(),e.drawImage(s.image,t,i,s.width,s.height),e.textBaseline="bottom";const n=(t+s.width)/r+3,o=(i+s.height)/r;(0,O.drawScaled)(e,r,r,(()=>{e.fillText("TradingView",n,o)})),e.restore()}function K(e,t,i,s){return(0,O.drawScaled)(e,s,s,(()=>{e.fillText(i,t.x/s,t.y/s)})),e.measureText(i).width*s}function Z(e,t,i,s,n,o){const a=n.map((e=>e.text)).join("");let l=i.x;const c=function(e,t,i,s){if(e.measureText(t).width*s<=i)return{text:t,elided:!1};const r=e.measureText("...").width*s,n=[];for(let e=0;ee.measureText(t.slice(0,o+1)).width*s+r>i));return{text:(t=t.slice(0,o)).trim(),elided:!0}}(e,a,s-l,t);if(c.elided&&!o)return null;const h=[];let d=0;for(const e of n){if(d+e.text.length>c.text.length)break;h.push(e.text),d+=e.text.length}const u=h.join("").trim().length;d=0;for(const s of n){if(d+s.text.length>u)break;s.color&&(e.save(),e.fillStyle=s.color),l+=K(e,new r.Point(l,i.y),s.text,t),s.color&&e.restore(),d+=s.text.length}return c.elided&&(l+=K(e,new r.Point(l,i.y),"...",t)),l}function X(e){return e.map((e=>({...e,title:""})))}function J(e,t){const i=[{text:e.trim()}];for(const e of t)e.visible&&(""!==i[i.length-1].text&&i.push({text:" "}),e.title&&i.push({text:e.title}),i.push({text:e.value,color:e.color}));return i}class Q{constructor(e,t){this._logoTextColor=null,this._snapshotData=e,t=t||{},this._options={backgroundColor:E.themes[e.theme].getThemedColor("color-bg-primary"),borderColor:E.themes[e.theme].getThemedColor("color-border"),font:F.CHART_FONT_FAMILY,fontSize:12,legendMode:"vertical",hideResolution:!1,showHeaderPublishedBy:!1,showHeaderMainSymbol:!1,...t};const i=G[e.layout],s=e.charts.map((e=>function(e){const t=e.panes[0],i=t.canvas.width+t.leftAxis.canvas.width+t.rightAxis.canvas.width;let s=0;for(const t of e.panes)s+=t.canvas.height;return void 0!==e.timeAxis&&0!==e.timeAxis.contentHeight&&(s+=e.timeAxis.canvas.height),(0,V.size)({width:i,height:s})
}(e)));if(this._pixelRatio=e.hidpiRatio,this._chartsGeometry=e.charts.map(((e,t)=>q(t,s,i,this._pixelRatio))),!U){let i=e.theme;void 0!==t.backgroundColor&&(i="black"===(0,B.rgbToBlackWhiteString)((0,B.parseRgb)(t.backgroundColor),150)?R.StdTheme.Dark:R.StdTheme.Light),this._logoTextColor=E.themes[i].getThemedColor("color-text-primary")}this._headerDefaultTextColor=E.themes[e.theme].getThemedColor("color-text-primary")}async getImage(){const e=this._pixelRatio;let t=0,i=0,s=0;const n=this._headerItems();if(n.length>0){s=Math.ceil(1.4*this._options.fontSize*e)*n.length}i+=s;let o=0,a=0;for(const e of this._chartsGeometry)o=Math.max(o,e.x+e.width),a=Math.max(a,e.y+e.height);const l=i;t+=o,i+=a,t+=Math.round(10*e);const c=U?Math.round(10*e):Math.round(35*e),h=i;i+=c;const d=(0,O.createDisconnectedCanvas)(document,(0,V.size)({width:t,height:i}),1),u=(0,O.getContext2D)(d);u.font=(0,W.makeFont)(this._options.fontSize,this._options.font),u.textBaseline="top",u.fillStyle=this._options.backgroundColor,u.fillRect(0,0,t,i),n.length>0&&this._drawHeader(u,n,t,new r.Point(Math.round(10*e),Math.round(10*e)));for(let e=0;e0&&t.leftAxis.contentHeight>0&&(i.drawImage(t.leftAxis.canvas,s,n),s+=t.leftAxis.canvas.width),i.drawImage(t.canvas,s,n),s+=t.canvas.width,t.rightAxis.contentWidth>0&&t.rightAxis.contentHeight>0&&i.drawImage(t.rightAxis.canvas,s,n),"pane"===t.type&&(i.fillStyle=e.colors.text,this._drawLegend(t,i,new r.Point(o,l),a)),n+=t.canvas.height}if(void 0!==e.timeAxis&&0!==e.timeAxis.contentHeight){let t=0;e.timeAxis.lhsStub.contentWidth>0&&e.timeAxis.lhsStub.contentHeight>0&&(i.drawImage(e.timeAxis.lhsStub.canvas,t,n),t+=e.timeAxis.lhsStub.canvas.width),i.drawImage(e.timeAxis.canvas,t,n),t+=e.timeAxis.canvas.width,e.timeAxis.rhsStub.contentWidth>0&&e.timeAxis.rhsStub.contentHeight>0&&i.drawImage(e.timeAxis.rhsStub.canvas,t,n)}i.strokeStyle=this._options.borderColor,i.strokeRect(0,0,t.width,t.height),i.restore()}_headerItems(){var e,t,i,s;const r=[];if(this._options.showHeaderPublishedBy&&this._snapshotData.publishedBy)for(const e of this._snapshotData.publishedBy)r.push([{text:e}]);if(this._options.showHeaderMainSymbol){const n=this._snapshotData.charts[0],o=`${null===(e=n.meta)||void 0===e?void 0:e.symbol}, ${null===(t=n.meta)||void 0===t?void 0:t.resolution}`;r.push(J(o,null!==(s=null===(i=n.meta)||void 0===i?void 0:i.values)&&void 0!==s?s:[]))}return r}_drawHeader(e,t,i,s){e.save(),
e.fillStyle=this._headerDefaultTextColor;const n=Math.ceil(1.4*this._options.fontSize*this._pixelRatio);t.forEach(((t,o)=>{Z(e,this._pixelRatio,new r.Point(s.x,s.y+n*o),i,t,!0)})),e.restore()}_drawLegend(e,t,i,n){let o=!0;const a=Math.ceil(1.4*this._options.fontSize*this._pixelRatio);let l=i.x,c=i.y;if(e.mainSeriesText&&c+a{e.fillText(r,0,0)}))}_fillRadius(e){const t=this._data.style,i=Math.max(1,Math.floor(e));let s=Math.round(t.lollipop.width*e);return s%2!=i%2&&(s+=1),s/2}_drawBorderLine(e,t,i,s){
const r=this._data.style;e.strokeStyle=r.lollipop.strokeStyle,e.lineWidth=i,(0,Se.setLineStyle)(e,ve.LINESTYLE_SOLID),(0,Se.createCircle)(e,t.x,t.y,s),e.stroke()}_drawFilledCircle(e,t,i,s){e.fillStyle=s,(0,Se.createCircle)(e,t.x,t.y,i),e.fill()}}var we=i(18807);class Ce extends be{_drawLollipop(e,t,i){var s;if(!this._imageLoaded())return void super._drawLollipop(e,t,i);const r=this._data.style,n=i.pixelRatio,o=this._fillRadius(n);let a=Math.round(r.lollipop.lineWidth*n),l=o-Math.round(1*n+a/2);if(r.lollipop.fillCircle&&(r.lollipop.backgroundColor&&this._drawFilledCircle(e,t,o,r.lollipop.backgroundColor),r.lollipop.fillStyle&&this._drawFilledCircle(e,t,l,r.lollipop.fillStyle)),null===(s=this._data.style.lollipop.image)||void 0===s?void 0:s.imageElement){const i=o-Math.round(1*n+2*a),s=2*i;e.save(),e.imageSmoothingEnabled=!0,e.imageSmoothingQuality="high",(0,Se.createCircle)(e,t.x,t.y,i),e.clip(),e.drawImage(this._data.style.lollipop.image.imageElement,t.x-i,t.y-i,s,s),e.restore()}"active"===this._data.status&&(l-=a/2,a*=1.5),this._drawBorderLine(e,t,a,l)}_drawLabel(e,t,i){this._imageLoaded()&&!this._data.style.lollipop.text.showWhenImageLoaded||super._drawLabel(e,t,i)}_imageLoaded(){return Boolean(this._data.style.lollipop.image&&this._data.style.lollipop.image.imageElement&&this._data.style.lollipop.image.imageElement.complete&&this._data.style.lollipop.image.imageElement.naturalWidth)}}const Pe={fillPath:new Path2D("M8.961.92a3 3 0 0 1 3.078 0l7.5 4.48A3 3 0 0 1 21 7.975V20a3 3 0 0 1-3 3H3a3 3 0 0 1-3-3V7.975A3 3 0 0 1 1.461 5.4l7.5-4.48z"),strokePath:new Path2D("M9.867 2.742c.39-.23.875-.23 1.266 0l7.5 4.406c.382.225.617.635.617 1.078V20c0 .69-.56 1.25-1.25 1.25H3c-.69 0-1.25-.56-1.25-1.25V8.226c0-.443.235-.853.617-1.078l7.5-4.406z")},xe={fillPath:new Path2D("M8.961 22.08a3 3 0 0 0 3.078 0l7.5-4.48A3 3 0 0 0 21 15.025V3a3 3 0 0 0-3-3H3a3 3 0 0 0-3 3v12.025A3 3 0 0 0 1.461 17.6l7.5 4.48z"),strokePath:new Path2D("M9.866 20.257c.391.23.877.23 1.268 0l7.5-4.414a1.25 1.25 0 0 0 .616-1.078V3c0-.69-.56-1.25-1.25-1.25H3c-.69 0-1.25.56-1.25 1.25v11.765c0 .443.234.853.616 1.078l7.5 4.414z")},Te={fillPath:new Path2D("M3 0h15c1.662 0 3 1.338 3 3v15c0 1.662-1.338 3-3 3H3c-1.662 0-3-1.338-3-3V3c0-1.662 1.338-3 3-3z"),strokePath:new Path2D("M3 1.75h15c.693 0 1.25.557 1.25 1.25v15c0 .693-.557 1.25-1.25 1.25H3c-.692 0-1.25-.558-1.25-1.25V3c0-.692.558-1.25 1.25-1.25z")};function Ie(e,t,i,s,r){const n=i.pixelRatio;e.save(),e.translate(t.x-s.lollipop.width*n/2,t.y-s.lollipop.height*n/2),e.scale(n,n),s.lollipop.fillCircle&&s.lollipop.backgroundColor&&(e.fillStyle=s.lollipop.backgroundColor,e.fill(r.fillPath)),e.strokeStyle=s.lollipop.strokeStyle,e.lineWidth=Math.round(s.lollipop.lineWidth*n)/n,(0,Se.setLineStyle)(e,ve.LINESTYLE_SOLID),s.lollipop.fillCircle&&s.lollipop.fillStyle&&(e.fillStyle=s.lollipop.fillStyle,e.fill(r.strokePath)),e.stroke(r.strokePath),e.restore()}function Me(e,t,i,s){Ie(e,t,i,s,Pe)}function Ae(e,t,i,s){Ie(e,t,i,s,xe)}function Le(e,t,i,s){Ie(e,t,i,s,Te)}class ke extends be{_drawLollipop(e,t,i){
const s=this._data.style;switch(s.shape){case"earningUp":Me(e,t,i,s);break;case"earningDown":Ae(e,t,i,s);break;case"earning":Le(e,t,i,s);break;default:super._drawLollipop(e,t,i)}}}const De={backgroundDark:(0,pe.getHexColorByName)("color-cold-gray-900"),backgroundLight:(0,pe.getHexColorByName)("color-white")};class Ee extends class{constructor(e,t,i){this._invalidated=!1,this._renderer=new _e.CompositeRenderer,this._textWidthCache=new me.TextWidthCache,this._stylesCache=null,this._lollipops={},this._lollipopsCounter=0,this._lastClickedId=null,this.onPaneBgChange=()=>{this._recreateStyles(this._model)},this._lastClickedId=null,this._model=e,this._source=t,this._clickHandler=i,this._recreateStyles(e),e.backgroundColor().subscribe(this.onPaneBgChange),e.mainSeries().onSymbolIntervalChanged().subscribe(this,this._onSymbolOrIntervalChanged)}destroy(){this._model.backgroundColor().unsubscribe(this.onPaneBgChange),this._model.mainSeries().onSymbolIntervalChanged().unsubscribeAll(this)}processClickOutside(e){var t;if(null===this._lastClickedId||!e)return void this.clearLastClicked();let i=null;if(function(e){return void 0!==e.touches}(e)){if(1!==e.touches.length)return;{const t=(0,s.ensureNotNull)(e.target).getBoundingClientRect(),n=e.touches[0];i=new r.Point(n.clientX-t.left,n.clientY-t.top)}}else i=new r.Point(e.offsetX,e.offsetY);const n=this._renderer.hitTest(i,{physicalHeight:0,physicalWidth:0,pixelRatio:1,cssHeight:0,cssWidth:0});null!==n&&(null===(t=n.data())||void 0===t?void 0:t.activeItem)===(0,s.ensureDefined)(this._lollipops[this._lastClickedId]).itemIndex||this.clearLastClicked()}clearLastClicked(){const e=null!==this._lastClickedId&&this._lollipops[this._lastClickedId]||null;null!==e&&(e.active=!1),this._lastClickedId=null}getLastClickedLollipopId(){return this._lastClickedId}update(){this._invalidated=!0}afterUpdate(e,t,i,s){}getStyle(e,t){let i=t;if(e.stack&&(i+="_stack:"+e.stack),"active"===i)return this._activeStyle;if("hovered"===i)return this._hoveredStyle;if("default"===i)return this._defaultStyle;if(this._stylesCache||(this._stylesCache={}),!this._stylesCache[i]){const s=(0,de.clone)("active"===t?this._activeStyle:"hovered"===t?this._hoveredStyle:this._defaultStyle);e.stack&&(s.lollipop.incHeight=25*e.stack),this._stylesCache[i]=s}return this._stylesCache[i]}hasTooltip(e){return!0}_getY(){let e=0;const t=this._model.panes();for(let i=t.length;i--;){const s=t[i];s.containsMainSeries()&&(e+=s.height())}return e}_showBarLine(e){return this.hasTooltip(e)&&(e.hovered||e.active)}_createRenderers(e,t){this._renderer.clear();const i=(0,V.size)({width:e,height:t});for(const e in this._lollipops)if(this._lollipops.hasOwnProperty(e)){const t=(0,s.ensureDefined)(this._lollipops[e]);if(t.visible){const e=this._getLollipopStatus(t),s=this.getStyle(t,e),n={id:t.id,centerPoint:new r.Point(t.basePoint.x,t.basePoint.y-s.lollipop.bottom-s.lollipop.height/2-(s.lollipop.incHeight||0)),style:s,status:e},o={activeItem:t.itemIndex,hideCrosshairLinesOnHover:!0,clickHandler:this._lollipopMouseClickHandler.bind(this,n,i),
tapHandler:this._lollipopMouseClickHandler.bind(this,n,i)};if(this._renderer.append(this._createRendererForLollipop(n,o)),this._showBarLine(t)){const{strokeStyle:e,lineStyle:i,lineWidth:r}=s.barLine,n={color:e,linestyle:i,linewidth:r,x:t.basePoint.x,top:0,bottom:t.basePoint.y-s.lollipop.bottom-s.lollipop.height},o=new ge.VerticalLineRenderer;o.setData(n),this._renderer.insert(o,0)}}}}_recreateStyles(e){this._stylesCache=null}_createRendererForLollipop(e,t){return new be(e,new we.HitTestResult(we.HitTarget.Custom,t),this._textWidthCache)}_onSymbolOrIntervalChanged(){this._lollipops={},this._lollipopsCounter=0,this._renderer.clear(),this.clearLastClicked()}_lollipopMouseClickHandler(e,t,i){i.preventDefault();const n=e.id;if(this._lastClickedId=this._lastClickedId===n?null:n,null===this._lastClickedId)return;const o={target:i.target,targetSize:t,point:new r.Point(e.centerPoint.x,e.centerPoint.y-e.style.lollipop.height/2-8),marginTop:15};this._clickHandler(o,(()=>{const e=(0,s.ensureDefined)(this._lollipops[n]);return this._createTooltipContent(e)}))}_getLollipopStatus(e){return e.active?"active":e.hovered?"hovered":"default"}}{constructor(e,t,i){super(e,t,i),this.stylesCache={},this.templatesCache={},this._itemIndexToId=new Map,this.source=t}clearCaches(){this.clearLastClicked(),this._lollipops={},this._lollipopsCounter=0}update(){this._invalidated=!0}renderer(e,t){return this._invalidated&&(this._createLollipops(t,e),this._invalidated=!1),this._renderer}getStyle(e){const t=e.active?"active":e.hovered?"hovered":"default";return this._generateStyle(t,e)}hasTooltip(e){return Boolean(e.items&&e.items.length)}_createTooltipContent(e){const t=e.items;return t?[{type:"common",subTitle:Array.isArray(t)?t.map((e=>({value:e}))):[{value:t}],style:{color:e.color}}]:null}_createRendererForLollipop(e,t){return new(e.style.lollipop.image?Ce:ke)(e,new we.HitTestResult(we.HitTarget.Custom,t),this._textWidthCache)}_lollipopMouseClickHandler(e,t,i){super._lollipopMouseClickHandler(e,t,i),(0,ie.emit)("onTimescaleMarkClick",e.id)}_createLollipops(e,t){const i=this._model.timeScale(),s=super._getY(),n=this._model.lastHittestData(),o=this._model.hoveredSource(),a=this.source.marks(),l=new Map;Object.keys(a).forEach((e=>{var t;const c=a[e],h=c.id,d=c.index;if(null!=d){const e=h===this.getLastClickedLollipopId(),a=this._lollipops[h],u=void 0!==a?a.itemIndex:this._lollipopsCounter++;this._itemIndexToId.has(u)||this._itemIndexToId.set(u,h);const p=o===this.source&&null!==n&&n.activeItem===u,_=(null!==(t=l.get(d))&&void 0!==t?t:-1)+1;l.set(d,_),this._lollipops[h]={id:h,itemIndex:u,basePoint:new r.Point(i.indexToCoordinate(d)+1,s),hovered:p,active:e,label:c.label,color:c.color,items:c.tooltip,visible:!0,stack:_,shape:c.shape,image:this._getImageForUrl(c.imageUrl),showLabelWhenImageLoaded:c.showLabelWhenImageLoaded,textColor:c.labelFontColor}}})),super._createRenderers(e,t)}_getImageForUrl(e){if(e)return this.source.getImageElement(e)}_generateStyle(e,t){const{color:i,label:s,stack:r,shape:n,image:o,textColor:a}=t
;let l=e+i+s+(this._model.dark().value()?"dark":"light");if(void 0!==r&&(l+="_stack"+r),!(l in this.stylesCache)){const c=this._model.dark().value()?De.backgroundDark:De.backgroundLight;let h,d=i;if("active"===e)h=i,d="rgba(255, 255, 255, 0.92)";else if("hovered"===e){const e=(0,B.tryParseRgba)(i);if(null!==e){const t=e[3]*(1-.85);h=(0,B.rgbaToString)((0,B.rgba)(e[0],e[1],e[2],t))}}a&&(d=a);let u=23,p=23,_=1,m=0;"earning"===n?(p=21,u=21,_=2):"earningUp"===n?(u=21,m=1,_=2):"earningDown"===n&&(u=21,m=-.5,_=.5);const g={barLine:{lineStyle:ve.LINESTYLE_DASHED,lineWidth:1,strokeStyle:i},lollipop:{width:u,height:p,bottom:_,backgroundColor:c,lineWidth:1.5,fillStyle:h,strokeStyle:i,fillCircle:!0,text:{label:s,deltaY:m,strokeStyle:d,font:(0,W.makeFont)(12,F.CHART_FONT_FAMILY,"bold"),showWhenImageLoaded:t.showLabelWhenImageLoaded},image:o},shape:n};void 0!==r&&(g.lollipop.incHeight=25*r),this.stylesCache[l]=g}return this.stylesCache[l]}}var Ve=i(46100),Be=i(98517),Re=i(12767),Ne=i(36112);const Oe=(0,n.getLogger)("Chart.UserDefinedImageMarks");class Fe extends Ne.BarsMarksContainer{constructor(){super(...arguments),this._imageItems=new Map,this._destroyed=!1}destroy(){this._destroyed=!0,super.destroy()}getImageElement(e){return this._imageItems.has(e)||this.addImageToStore(e),this._imageItems.get(e)}addImageToStore(e){this._imageItems.has(e)||this._loadNewImage(e)}_loadNewImage(e){const t={imageElement:null};(0,Re.getImage)(e,e).then((e=>{this._destroyed||(t.imageElement=e,this.updateAllViewsAndRepaint(),this._model.updateSource(this))})).catch((()=>{Oe.logWarn(`An error ocurred while loading image ${e}`)})),this._imageItems.set(e,t)}}class We extends Fe{constructor(e){super(e,new Ve.DefaultProperty("UserDefinedTimescaleMarks",{visible:!0})),this._requestedPointsets=new Set,(0,ue.hideMarksOnBars)().subscribe(this,(()=>this._properties.childs().visible.setValue(!(0,ue.hideMarksOnBars)().value()))),this._paneView=new Ee(e,this,this._showTooltip.bind(this)),this._paneViews=[this._paneView]}destroy(){(0,ue.hideMarksOnBars)().unsubscribeAll(this),super.destroy()}zorder(){return Be.sortSourcesPreOrdered.TimeScaleMarks}name(){return"UserDefinedTimescaleMarks"}userEditEnabled(){return!1}clearMarks(e=0){if(1===e)return;const t=this._model.chartApi();t.isConnected().value()&&Object.keys(this._marks).forEach((e=>{const i=this._getPointsetId(e);t.removePointset(i)})),this._requestedPointsets.clear(),super.clearMarks(),this._paneView.clearCaches(),this.updateAllViewsAndRepaint()}hasContextMenu(){return!1}paneViews(){return this._properties.childs().visible.value()?this._paneViews:[]}updateAllViews(){this._paneView.update()}onClickOutside(){this._paneView.processClickOutside()}isVisible(){return this.properties().childs().visible.value()}_initialize(){this._properties.childs().visible.setValue(!0)}_plateViewData(e){return{text:e.text}}_getData(e){const t=this._model.mainSeries().symbolInfo();if(!t)return
;const i=this.roundRange(this._rangeDifference(e)),r=this._model.mainSeries(),n=r.seriesSource().symbolInstanceId(),o=r.properties().childs().interval.value();window.ChartApiInstance.getTimescaleMarks(t,i.start,i.end,(t=>{const i=this._model.chartApi();for(const e of t){e.index=null;const t=e.id,r=this._getPointsetId(t.toString()),a=this._marks[t];if(a&&null!==a.index&&(a.tickmark===e.tickmark?e.index=a.index:this._requestedPointsets.has(r)&&i.isConnected().value()&&(i.removePointset(r),this._requestedPointsets.delete(r))),e.imageUrl&&this.addImageToStore(e.imageUrl),this._marks[t]=e,null===e.index&&i.isConnected().value()){this._requestedPointsets.add(r);const t=[[e.tickmark,0]];i.createPointset(r,"turnaround",(0,s.ensureNotNull)(n),o,t,(e=>this._onPointsetData(e)))}}this._loadedRange=this._rangeUnion(e,this._loadedRange),this.updateAllViewsAndRepaint()}),o)}_getPointsetId(e){return"pointsetMark_"+e}_onPointsetData(e){if("data_update"===e.method){const t=e.params.customId.split("_")[1],i=this._marks[t],s=e.params.plots;i&&1===s.length&&(i.index=s[0].value[0])}this.updateAllViews()}async _showTooltip(e,t){const r=t();if(!r)return;const n=this._model.timeScale(),o=[n.onScroll(),n.barSpacingChanged(),this._model.mainSeries().onSymbolIntervalChanged(),(0,s.ensureNotNull)(this._model.paneForSource(this)).onSizeChanged()],a=this._paneView.processClickOutside.bind(this._paneView),l=this._paneView.clearLastClicked.bind(this._paneView);(await Promise.all([i.e(3842),i.e(5649),i.e(2639),i.e(6925),i.e(962),i.e(2544),i.e(9039)]).then(i.bind(i,70434))).showLollipopTooltip({items:r,position:e,customCloseSubscriptions:o,onClickOutside:a,onCustomClose:l})}}function He(e,t){const i=Math.max(1,Math.floor(t)),s=Math.round(e.x*t)+i%2/2;let r=Math.round(e.size*t);(s+r/2)%1!=0&&(r+=1);const n=Math.min(Math.max(1,Math.round(t*e.borderWidth)),r/2);let o;const a=("up"===e.direction?-1:1)*(e.yInverted?-1:1),l=a*(Math.round(e.size*t/2)+i%2);if(void 0!==e.fixedSpaceYPosition){const i=Math.round(e.fixedSpaceYPosition.itemSpacing*t),s=e.fixedSpaceYPosition.order,n=a*(r*s+i*(s+1));o=Math.round(e.fixedSpaceYPosition.basePosition*t)+n+l}else o=Math.round(e.y*t)+l;return{x:s,y:o,size:r,borderWidth:n,tickSize:i}}function ze(e,t,i,s){var r,n,o;if(e.save(),i&&!s.highlightByAuthor&&(e.globalAlpha=.4),s.mine)!function(e,t,i){const{borderColor:s,backgroundColor:r,doNotFill:n,direction:o,yInverted:a}=i,{x:l,y:c,borderWidth:h,size:d,tickSize:u}=He(i,t.pixelRatio);e.strokeStyle=s,e.fillStyle=r,e.lineWidth=h;const p="up"===o!==a?-1:1;let _=Math.round(d/2/Math.tan(Math.PI/6))+u%2/2;(l+_/2)%1!=0&&(_-=1);e.translate(l,c+_/2*p),e.beginPath();const m=h/2;e.moveTo(0,-p*(_-m)),e.lineTo(d/2-m,h/2),e.lineTo(-d/2+m,h/2),e.lineTo(0,-p*(_-h/2)),e.closePath(),n||e.fill();e.stroke()}(e,t,s);else{let i=!1;{const e=s.image&&(o=s.image,Boolean(o&&o.imageElement&&o.imageElement.complete&&o.imageElement.naturalWidth));i=Boolean(e&&!s.showLabelWhenImageLoaded)}!function(e,t,i,s,r){
const{borderColor:n,backgroundColor:o,label:a}=i,l=t.pixelRatio,{x:c,y:h,borderWidth:d,size:u}=He(i,l);e.strokeStyle=n,e.fillStyle=o,e.lineWidth=d,e.beginPath();const p=u/2-d/2;e.arc(c,h,p,0,2*Math.PI,!0),e.closePath(),e.fill(),r&&function(e,t,i,s,r){if(t){const n=2*i;e.save(),e.imageSmoothingEnabled=!0,e.imageSmoothingQuality="high",(0,Se.createCircle)(e,s,r,i),e.clip(),e.drawImage(t,s-i,r-i,n,n),e.restore()}}(e,r,p,c,h);e.stroke(),!s&&a&&u/2>=7&&(e.textAlign="center",e.textBaseline="middle",e.font=a.font,e.fillStyle=a.fontColor,(0,O.drawScaled)(e,l,l,(()=>{e.fillText(a.text,c/l,h/l)})))}(e,t,s,i,null!==(n=null===(r=s.image)||void 0===r?void 0:r.imageElement)&&void 0!==n?n:void 0)}e.restore()}class Ue{constructor(e,t,i,s){this._canvas=null,this._clickHandler=e,this._enterHandler=t,this._leaveHandler=i,this._data=null!=s?s:null}setData(e){this._data=e}hitTest(e,t){if(null===this._data)return null;for(let i=this._data.items.length-1;i>=0;--i){const s=this._hitTestDot(this._data.items[i],e,t.pixelRatio);if(s)return s}return null}draw(e,t){this._canvas=e.canvas,null!==this._data&&this._data.items.forEach(ze.bind(null,e,t,this._data.highlightByAuthor))}_hitTestDot(e,t,i){const s=new r.Point(e.x,He(e,i).y/i);if((0,fe.pointInCircle)(t,s,Math.max(e.size/2,8))){const t=this._canvas,i=null===t?void 0:{mouseEnterHandler:()=>this._enterHandler(e,s.y,t),mouseLeaveHandler:()=>this._leaveHandler(),clickHandler:i=>this._clickHandler(e,s.y,t,i),tapHandler:i=>this._clickHandler(e,s.y,t,i)};return new we.HitTestResult(we.HitTarget.Regular,{activeItem:e.originalItem.id,...i})}return null}}const je={green:{border:(0,pe.getHexColorByName)("color-minty-green-700"),background:(0,pe.getHexColorByName)("color-minty-green-a600")},red:{border:(0,pe.getHexColorByName)("color-ripe-red-700"),background:(0,pe.getHexColorByName)("color-ripe-red-500")},neutral:{border:(0,pe.getHexColorByName)("color-tan-orange-700"),background:(0,pe.getHexColorByName)("color-tan-orange-500")},yellow:{border:"#EAC300",background:"#FFD400"},blue:{border:"#047ACE",background:"#0496FF"}};function Ge(e){var t,i,s,r;return e.hovered||e.highlightByAuthor?null!==(i=null===(t=e.overrideBorderWidth)||void 0===t?void 0:t.hoveredWidth)&&void 0!==i?i:4:null!==(r=null===(s=e.overrideBorderWidth)||void 0===s?void 0:s.width)&&void 0!==r?r:2}class qe extends class{constructor(e,t){this._tooltip=null,this._hoveredBarsMarkData=null,this._destroyed=!1,this._invalidated=!0,this._originalData=[],this._source=e,this._model=t,this._renderer=new Ue(this._onItemClicked.bind(this),this._showItem.bind(this),this._hideItem.bind(this)),this._createTooltipRenderer().then((e=>{this._destroyed?null==e||e.destroy():this._tooltip=e})),e.properties().childs().visible.subscribe(null,(()=>{var e;null===(e=this._tooltip)||void 0===e||e.hide(!0)}))}destroy(){var e;this._destroyed=!0,null===(e=this._tooltip)||void 0===e||e.destroy()}source(){return this._source}update(){this._invalidated=!0}renderer(e,t){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer}onClickOutside(e){
e.isTouch&&null!==this._tooltip&&!this._tooltip.contains(e.target)&&this._tooltip.hide(!0)}_extractBarMarksRendererItemData(e,t){var i,s;const r=null!==(i=t.overridedTheme)&&void 0!==i?i:je[t.theme],n=this._calculateSize(e,t),o=this._calculateY(e,n,t);return null===this._hoveredBarsMarkData||this._hoveredBarsMarkData.id!==t.id||this._hoveredBarsMarkData.x===t.x&&this._hoveredBarsMarkData.y===Math.round(o)||(null===(s=this._tooltip)||void 0===s||s.hide(!0),this._hoveredBarsMarkData=null),{x:t.x,y:this._calculateY(e,n,t),direction:t.direction,borderColor:r.border,borderWidth:Ge(t),backgroundColor:r.background,size:n,doNotFill:!t.public,yInverted:t.yInverted,label:void 0===t.label?void 0:{text:t.label,fontColor:t.labelFontColor,font:(0,W.makeFont)(Math.ceil(Math.max(10,Math.min(n/2,20))),F.CHART_FONT_FAMILY,"bold")},originalItem:t}}_onItemClicked(e,t,i,s){s.isTouch&&this._showItem(e,t,i)}async _showItem(e,t,i){var r;const n=await this._tooltipProps(e);if(null===n)return;const o=this._model.timeScale().barSpacing(),a=this._calculateSize(o,e.originalItem);this._hoveredBarsMarkData={x:e.x,y:Math.round(this._calculateY(o,a,e.originalItem)),id:e.originalItem.id},null===(r=this._tooltip)||void 0===r||r.show({itemSize:a,container:(0,s.ensureNotNull)(i.parentElement),x:e.x,y:t,factoryProps:n,onClickOutside:()=>{var e;return null===(e=this._tooltip)||void 0===e?void 0:e.hide(!0)}})}_hideItem(){var e;null===(e=this._tooltip)||void 0===e||e.hide()}_calculateSize(e,t){return Math.min(553,Math.max(7,t.minSize,.8*e))}_updateImpl(){this._originalData=this._source.getPlatesViewData();const e=this._model.timeScale().barSpacing(),t=this._originalData.map(this._extractBarMarksRendererItemData.bind(this,e));this._renderer.setData({items:t,barSpacing:e,highlightByAuthor:!1})}}{async _createTooltipRenderer(){const[{TooltipRenderer:e},{UserDefinedBarsMarksTooltip:t}]=await Promise.all([Promise.all([i.e(9789),i.e(962),i.e(8020)]).then(i.bind(i,5972)),Promise.all([i.e(9789),i.e(962),i.e(8020)]).then(i.bind(i,48080))]);return new e(t)}_calculateY(e,t,i){const s=Math.max(1.4*i.minSize,e+4),r=("up"===i.direction?-1:1)*(i.yInverted?-1:1)*(s*(i.order+.6)+.25*s);return i.y+r}_onItemClicked(e,t,i,s){var r,n;super._onItemClicked(e,t,i,s),null===(n=(r=e.originalItem).onClicked)||void 0===n||n.call(r)}_tooltipProps(e){const t=e.originalItem.text;return t?Promise.resolve({text:t}):Promise.resolve(null)}_extractBarMarksRendererItemData(e,t){return{...super._extractBarMarksRendererItemData(e,t),showLabelWhenImageLoaded:t.showLabelWhenImageLoaded,image:t.image}}}class $e extends Fe{constructor(e){super(e,new Ve.DefaultProperty("UserDefinedBarsMarks",{visible:!0})),this._paneView=new qe(this,e),this._paneViews=[this._paneView],(0,ue.hideMarksOnBars)().subscribe(this,(()=>{this.properties().childs().visible.setValue(!(0,ue.hideMarksOnBars)().value())}))}destroy(){(0,ue.hideMarksOnBars)().unsubscribeAll(this),this._paneView.destroy(),super.destroy()}zorder(){return Be.sortSourcesPreOrdered.BarMarks}name(){return"UserDefinedBarsMarks"}userEditEnabled(){return!1}
clearMarks(e=0){2!==e&&(super.clearMarks(),this.updateAllViewsAndRepaint())}hasContextMenu(){return!1}paneViews(){return this._properties.childs().visible.value()?this._paneViews:[]}isVisible(){return this.properties().childs().visible.value()}onClickOutside(e){this._paneView.onClickOutside(e)}_initialize(){this.properties().childs().visible.setValue(!0)}_plateViewData(e){const t={text:e.text,onClicked:e.onClicked};"object"==typeof e.color&&(t.theme="user_defined_theme",t.overridedTheme={},t.overridedTheme.border=e.color.border,t.overridedTheme.background=e.color.background);const i=(0,de.isNumber)(e.borderWidth)?e.borderWidth:void 0,s=(0,de.isNumber)(e.hoveredBorderWidth)?e.hoveredBorderWidth:void 0;if(void 0===i&&void 0===s||(t.overrideBorderWidth={width:i,hoveredWidth:s}),e.showLabelWhenImageLoaded&&(t.showLabelWhenImageLoaded=!0),e.imageUrl){const i=this.getImageElement(e.imageUrl);t.image=i}return t}_getData(e){const t=this._model.mainSeries().symbolInfo();if(!t)return;const i=this.roundRange(this._rangeDifference(e)),s=this._model.mainSeries().properties().childs().interval.value();window.ChartApiInstance.getMarks(t,i.start,i.end,(t=>{for(const e of t)this._marks[e.id]=e,e.imageUrl&&this.addImageToStore(e.imageUrl);this._loadedRange=this._rangeUnion(e,this._loadedRange),this.updateAllViewsAndRepaint()}),s)}}var Ye=i(45345);const Ke=new c.TranslatedString("apply toolbars theme",o.t(null,void 0,i(58570)));class Ze extends p.UndoCommand{constructor(e,t,i=!0){super(Ke),this._prevThemeName=e,this._themeName=t,this._syncState=i}undo(){(0,E.isStdThemeName)(this._prevThemeName)&&((0,Ye.setTheme)(this._prevThemeName),this._syncState&&(0,E.syncTheme)())}redo(){(0,E.isStdThemeName)(this._themeName.toLowerCase())&&((0,Ye.setTheme)(this._themeName.toLowerCase()),this._syncState&&(0,E.syncTheme)())}}var Xe=i(97906),Je=i(49475),Qe=i(83669),et=(i(36274),i(94025)),tt=i(16838),it=i(81501);i(77825);const st=!l.CheckMobile.any(),rt=((0,n.getLogger)("ChartWidgetCollectionBase"),new c.TranslatedString("apply indicators to entire layout",o.t(null,void 0,i(44547)))),nt=new c.TranslatedString("sync time",o.t(null,void 0,i(60635))),ot=new c.TranslatedString("resize layout",o.t(null,void 0,i(13034))),at=new c.TranslatedString("reset layout sizes",o.t(null,void 0,i(30910))),lt=new c.TranslatedString("apply chart theme",o.t(null,void 0,i(66568))),ct=new c.TranslatedString("symbol lock",o.t(null,void 0,i(92831))),ht=new c.TranslatedString("interval lock",o.t(null,void 0,i(28916))),dt=new c.TranslatedString("date range lock",o.t(null,void 0,i(90621))),ut=new c.TranslatedString("track time",o.t(null,void 0,i(47122))),pt=new c.TranslatedString("change series style",o.t(null,void 0,i(53438)));o.t(null,void 0,i(46669)),o.t(null,void 0,i(98478)),o.t(null,void 0,i(34004)),o.t(null,void 0,i(96260)),o.t(null,void 0,i(38641)),o.t(null,void 0,i(10160)),o.t(null,void 0,i(19149)),o.t(null,void 0,i(38660)),o.t(null,void 0,i(47228)),o.t(null,void 0,i(19149));function _t(e,t){const i=t.model().model().studyTemplate();e.undoHistory.beginUndoMacro(rt)
;for(let s=0;se.id()===n)))}const l=await t.pasteSourceFromClip(o,i,!0);if(l&&1===l.length){const e=l[0];if(r.asCompare){const i=(0,s.ensureNotNull)(t.mainSeries().priceScale());t.moveToScale(e,(0,s.ensureDefined)(o),i,n),t.setPriceScaleMode({percentage:!0},i,null)}}t.model().lightUpdate()}}e.undoHistory.endUndoMacro()}function gt(e){let t=1;for(;e.has(""+t);)t++;return""+t}function ft(e){const t=new Map,i=e.chartsCountToSave(),s=new Set;for(let r=0;r(0,s.ensureDefined)(e.content.chartId)))}function wt(e,t,i){e.chartsCountToSave();i.forEach((i=>{const s=(t=>{var i,s;return null!==(s=null===(i=e.chartWidgetsDefs.find((e=>e.chartWidget.id()===t)))||void 0===i?void 0:i.chartWidget)&&void 0!==s?s:null})(i.chartId);null==s||s.resetLineToolsInvalidated(t,i.savedDto,i.sharingMode)}))}function Ct(e,t,i,s){const r=e.map((e=>e.chartWidget)).filter((e=>e.hasModel())).filter((e=>e.id()===t||0!==s));try{r.forEach((e=>e.startApplyingLineToolUpdateNotification())),r.forEach((e=>e.applyLineToolUpdateNotification(i,s)))}finally{r.forEach((e=>e.endApplyingLineToolUpdateNotification()))}}function Pt(e){return new T({copyRequested:(t,i)=>{e.activeChartWidget.value().model().clipboardCopy(t,i)},cutRequested:(t,i)=>{e.activeChartWidget.value().model().clipboardCut(t,i)},pasteRequested:(t,i)=>{(i?i.model().undoModel():e.activeChartWidget.value().model()).clipboardPaste(t,i)}})}function xt(e,t){0}function Tt(e){const t={};return e.chartWidgetsDefs.map((e=>e.chartWidget)).forEach((e=>t[e.id()]=function(e){var t,i,r,n,o;const a={};if(!e.hasModel()){const n=e.options().content;if(!n)return a
;const o=(0,s.ensureNotNull)(n.panes.reduce(((e,t)=>{var i;return null!==(i=null!=e?e:t.sources.find((e=>"MainSeries"===e.type)))&&void 0!==i?i:null}),null));return a.resolution=null===(t=o.state)||void 0===t?void 0:t.interval,a.symbol=null===(i=o.state)||void 0===i?void 0:i.symbol,a.short_name=null===(r=o.state)||void 0===r?void 0:r.shortName,a}const l=e.model().mainSeries(),c=l.properties().childs(),h=l.symbolInfo();a.resolution=c.interval.value(),a.symbol_type=null!==h&&h.type||"",a.exchange=null!==h&&h.exchange||"",a.listed_exchange=null!==h&&h.listed_exchange||"";const d=null!==(n=null==h?void 0:h.legs)&&void 0!==n?n:[];if(null!==h&&l.isSpread()){const e=d[0];let t=h.base_name[0];t=t.split(":")[1],a.symbol=e,a.short_name=t,a.expression=h.full_name}else a.symbol=null!==h&&h.ticker||c.symbol.value(),a.short_name=c.shortName.value();const u=null!==(o=null==h?void 0:h.base_name)&&void 0!==o?o:[];return a.legs=d.map(((e,t)=>({symbol:e,pro_symbol:u[t]}))),a}(e))),t}function It(e,t){0}async function Mt(e,t){return null}function At(e,t){return A(t,{snapshotUrl:e}).then((e=>((0,ie.emit)("onScreenshotReady",e),e)))}function Lt(e,t){const i={snapshotUrl:e};const s=(0,D.isOnMobileAppPage)("any");return(s?A:M)(t,i).then((e=>((0,ie.emit)("onScreenshotReady",e),s||(0,ie.emit)("onServerScreenshotCopiedToClipboard"),e)))}function kt(e){return function(e){return I().then((t=>t.downloadClientScreenshot(e)))}(e)}function Dt(e){return function(e){return I().then((t=>t.copyToClipboardClientScreenshot(e)))}(e).then((()=>{(0,ie.emit)("onClientScreenshotCopiedToClipboard")}))}const Et={s:0,"2h":0,"2v":1,"2-1":1,"3s":0,"3h":0,"3v":2,4:1,6:1,8:1,"1-2":1,"3r":1,"4h":0,"4v":3,"4s":0,"5h":0,"6h":0,"7h":0,"8h":0,"1-3":1,"2-2":3,"2-3":2,"1-4":1,"5s":0,"6c":4,"8c":6,"10c5":1,"12c6":1,"12c4":3,"14c7":1,"16c8":1,"16c4":3};function Vt(e,t,i,s){let r=0;const n=(0,Je.createWVFromGetterAndSubscriptions)((()=>++r),[i,s]);return(0,Xe.combine)((t=>{var i;return null!==(i=e()[Et[t]])&&void 0!==i?i:null}),t.weakReference(),n.ownership())}function Bt(e,t,i,s){const r=Math.max(1,window.devicePixelRatio||1),n=e.getAll();let o;const a=e.maximizedChartWidget().value();if(s&&s.onlyActiveChart||a)return{layout:"s",hidpiRatio:r,theme:(0,E.getCurrentTheme)().name,charts:[e.activeChartWidget.value().images(s)],publishedBy:o};const l=[],c=te.layouts[e.layout.value()].count,h={showCollapsedStudies:(s=s||{}).showCollapsedStudies,status:s.status};for(let e=0;e{const t=this._state.currentLayoutResizeAction.value();t&&this._applyMouseMove(t.delta,e)},this._state=e,this._splitterElement=t,this._splitter=i,(0,le.shiftPressed)().subscribe(this._onShiftPressed)}destroy(){(0,le.shiftPressed)().unsubscribe(this._onShiftPressed)}mouseDownEvent(e){this._mouseDownOrTouchStartEvent(e)}touchStartEvent(e){this._mouseDownOrTouchStartEvent(e)}pressedMouseMoveEvent(e){this._pressedMouseOrTouchMoveEvent(e)}touchMoveEvent(e){this._pressedMouseOrTouchMoveEvent(e)}mouseUpEvent(e){this._mouseUpOrTouchEndEvent(e)}touchEndEvent(e){this._mouseUpOrTouchEndEvent(e)}mouseEnterEvent(e){this._highlightSplitters(e.shiftKey)}mouseLeaveEvent(e){const t=Ot(this._splitter.className);Array.from(this._state.parent.getElementsByClassName(t)).forEach((e=>e.classList.remove(it.hovered)))}mouseDoubleClickEvent(e){const t=(0,ne.layoutInitialSizingState)(this._state.layoutTemplate.value().expression);this._state.undoHistory.beginUndoMacro(at),this._state.undoHistory.pushUndoCommand(new g(this._state.sizingState,this._state.sizingState.value(),t,at));const i=this._state.layoutTemplate.value().layoutType;this._state.undoHistory.pushUndoCommand(new m((e=>e?this._state.allLayoutSizesState.set(i,e):this._state.allLayoutSizesState.delete(i)),this._state.allLayoutSizesState.get(this._state.layoutTemplate.value().layoutType),t,at)),this._state.undoHistory.endUndoMacro()}_highlightSplitters(e){const t=Ot(this._splitter.className);Array.from(this._state.parent.getElementsByClassName(t)).forEach((e=>e.classList.remove(it.hovered)));(e?Array.from(this._state.parent.getElementsByClassName(t)):[this._splitterElement]).forEach((e=>e.classList.add(it.hovered)))}_mouseDownOrTouchStartEvent(e){const t=new r.Point(e.localX+this._splitterElement.offsetLeft,e.localY+this._splitterElement.offsetTop),i=(0,oe.deepCopy)(this._state.sizingState.value());this._state.currentLayoutResizeAction.setValue({point:t,splitter:this._splitter,initialState:i,alignedState:this._state.layoutTemplate.value().syncSublayoutsBySplitter(this._splitter,(0,oe.deepCopy)(i)),shiftState:e.shiftKey,delta:0}),this._splitterElement.classList.add(it["i-active"]),this._highlightSplitters(e.shiftKey)}_pressedMouseOrTouchMoveEvent(e){const t=this._state.currentLayoutResizeAction.value();if(!t)return;t.shiftState!==e.shiftKey&&(this._highlightSplitters(e.shiftKey),t.shiftState=e.shiftKey);const i=new r.Point(e.localX+this._splitterElement.offsetLeft,e.localY+this._splitterElement.offsetTop);t.delta="v"===t.splitter.orientation?i.y-t.point.y:i.x-t.point.x,this._applyMouseMove(t.delta,e.shiftKey)}
_mouseUpOrTouchEndEvent(e){const t=this._state.currentLayoutResizeAction.value();if(t&&(this._splitterElement.classList.remove(it["i-active"]),this._state.currentLayoutResizeAction.setValue(null),t.currentState)){this._state.undoHistory.beginUndoMacro(ot),this._state.undoHistory.pushUndoCommand(new g(this._state.sizingState,t.initialState,t.currentState,ot));const e=this._state.layoutTemplate.value().layoutType;this._state.undoHistory.pushUndoCommand(new m((t=>t?this._state.allLayoutSizesState.set(e,t):this._state.allLayoutSizesState.delete(e)),this._state.allLayoutSizesState.get(this._state.layoutTemplate.value().layoutType),this._state.sizingState.value(),at)),this._state.undoHistory.endUndoMacro(),this._state.layoutSizesChanged.setValue(!0)}}_applyMouseMove(e,t){var i;const r=(0,s.ensureNotNull)(this._state.currentLayoutResizeAction.value()),n=t?r.alignedState:r.initialState,o=null!==(i=this._state.options.padding)&&void 0!==i?i:2,a=Nt(this._state);r.currentState=this._state.layoutTemplate.value().resizeApplier(a,o,e,r.splitter,(0,oe.deepCopy)(n),t),this._state.sizingState.setValue(r.currentState)}}function Wt(e,t,i,s,r){var n,o;const a=null!==(n=e.options.padding)&&void 0!==n?n:2,l=null!==(o=e.options.border)&&void 0!==o?o:0;r=null!=r?r:e.layoutTemplate.value();const c=Nt(e),h=r.sizer(c,i,s,a+l,st?e.sizingState.value():void 0);h.width=Math.max(Math.round(h.width),0),h.height=Math.max(Math.round(h.height),0),h.top=Math.round(h.top),h.left=Math.round(h.left),t.metrics=h;const d=t.container.value();if(d){d.style.width=h.width+"px",d.style.height=h.height+"px",d.style.top=h.top+"px",d.style.left=h.left+"px";const e=1===s;false;const t=Math.round(c.width),i=0===h.top&&0===h.left,r=0===h.top&&h.left+h.width===t,n=0===h.top&&h.width===t;d.classList.toggle("top-left-chart",!e&&!n&&i),d.classList.toggle("top-right-chart",!e&&!n&&r),d.classList.toggle("top-full-width-chart",e||n)}t.width.setValue(h.width),t.height.setValue(h.height)}function Ht(e){var t,i,s;let r;const n=e.layoutTemplate.value(),o=e.maximizedChartDef.value();if(r=o?[o]:e.chartWidgetsDefs.slice(0,n.count).filter((e=>!e.hiddenInLayout.value())),r.forEach(((t,i)=>Wt(e,t,i,r.length))),st&&!e.maximizedChartDef.value()){const r=Nt(e),o=null!==(t=e.options.padding)&&void 0!==t?t:2,a=null!==(i=e.options.border)&&void 0!==i?i:0,l=n.splitters(r,o+a,e.sizingState.value()),c=null!==(s=e.splitters.value())&&void 0!==s?s:[];c.forEach(((e,t)=>{t>=l.length&&(e.splitterElement.remove(),e.mouseHandler.destroy(),e.mouseListener.destroy())}));const h=l.map(((t,i)=>{const s=i({def:t,metrics:e.layoutTemplate.value().sizer({top:0,left:0,width:256,height:256},i,s.length,0)}))).sort(((e,t)=>e.metrics.top-t.metrics.top||e.metrics.left-t.metrics.left)).map((e=>e.def));if(s.length<2)return null;let r=s.indexOf(t);return-1===r?null:(r=(r+(i?s.length-1:1))%s.length,s[r])}function Ut(e,t){return e.chartWidgetsDefs.some((e=>{var i;return(null===(i=e.chartWidget)||void 0===i?void 0:i.id())===t}))}function jt(e){let t=1;for(;e(""+t);)t++;return""+t}function Gt(e){const t=e.activeChartWidget.value();if(t){const i=t.state();return i.chartId=jt((t=>Ut(e,t))),i.shouldBeSavedEvenIfHidden=!1,i.panes.forEach((e=>{e.sources.forEach((e=>{"alertId"in e&&(e.alertId=void 0)}))})),{content:i}}}function qt(e,t,i){var r,n;const{toastsFactory:o,chartWidgetsDefs:a,customLegendWidgetsFactoriesMap:c}=e;let h={chartWidgetCollection:t,isActive:0===a.length,barsMarksContainersFactory:t=>function(e,t,i){const s=[];{const t=new $e(e);s.push(t);const i=new We(e);s.push(i)}return s}(t,0,e.options),undoHistory:e.undoHistory,readOnly:e.readOnly,initialLoading:e.initialLoading,getToasts:o?()=>o.getChartToasts():void 0,...null!=i?i:{}};void 0!==c&&(h.customLegendWidgetFactories=new Map(c));const d=document.createElement("div");d.classList.add("chart-container"),d.style.position="absolute",d.style.overflow="hidden",e.parent.appendChild(d),l.isEdge&&(d.style.touchAction="none",d.style.msTouchAction="none"),h.className&&d.classList.add(h.className);const p={alive:new u.WatchedValue(!0),container:new u.WatchedValue(d),width:new u.WatchedValue,height:new u.WatchedValue,collapsed:new u.WatchedValue(!1),hiddenInLayout:new u.WatchedValue(!1),visible:new u.WatchedValue,rdState:new se.ResizerDetacherState,requestFullscreen:()=>{e.globalDetachable.value()&&(e.setMaximized(p),e.activeChartWidget.setValue((0,s.ensureNotNull)(p.chartWidget)))},exitFullscreen:()=>{e.activeChartWidget.value()===p.chartWidget&&e.setMaximized(null)},detachable:e.globalDetachable,fullscreenable:e.globalDetachable,fullscreen:new u.WatchedValue,chartWidget:null};p.rdState.pushOwner(p),a.push(p);const _=()=>{p.visible.setValue(!p.hiddenInLayout.value()&&e.options.resizerBridge.visible.value())};p.hiddenInLayout.subscribe((()=>{(0,s.ensureNotNull)(p.chartWidget).setVisible(!p.hiddenInLayout.value()),_()})),p.collapsed.subscribe((()=>(0,s.ensureNotNull)(p.chartWidget).setCollapsed(p.collapsed.value()))),e.options.resizerBridge.visible.subscribe(_),_(),function(e,t){let i=0,s=0;const r=t.layoutTemplate.value();for(let n=0;nUt(e,t))),g=p.chartWidget=new re.ChartWidget(h,m,t.metaInfo.uid.value());e.saveChartService&&g.setSaveChartService(e.saveChartService),h.containsData?g.finishInitWithoutConnect():g.connect(),g.withModel(null,(()=>{const t=g.model().model();e.customSources.forEach(((e,i)=>{t.addCustomSource(i,e.factory,e.layer)}))})),e.updateWatchedValue(),e.updateActivityView();const f=null!==(n=null===(r=null==h?void 0:h.content)||void 0===r?void 0:r.linkingGroup)&&void 0!==n?n:null;g.linkingGroupIndex().setValue(f),g.linkingGroupIndex().subscribe(e.updateLinkingGroupCharts);const v=Pi(e,f).value();return v.length>0&&(e.symbolLock.value()&&g.setSymbol(v[0].symbolWV().value()),e.intervalLock.value()&&g.setResolution(v[0].resolutionWV().value())),e.updateLinkingGroupCharts(),e.chartWidgetCreatedDelegate.fire(g),p}function $t(e,t,i,s){const r={...e.widgetOptions,...e.savedChartWidgetOptions.shift()||Gt(e),...0===i||e.symbolLock.value()?void 0:{defSymbol:null}},n=qt(e,t,r),{chartWidget:o}=n;return o.modelCreated().subscribe(null,(()=>{s?s():e.checkAllPendingModelsAlreadyCreated(),e.dateRangeLock.value()&&o===e.activeChartWidget.value()&&e.subscribeToCompletedEventForDateRangeSync(o,!0)}),!0),n}function Yt(e){e.hiddenInLayout.setValue(!0);const t=e.container.value();t.parentNode&&t.parentNode.removeChild(t),e.fullscreen.setValue(!1)}function Kt(e,t){e.chartWidgetsDefs.forEach((i=>{const r=(0,s.ensureNotNull)(i.chartWidget);r.onZoom().unsubscribeAll(t),r.onScroll().unsubscribeAll(t),r.withModel(null,(()=>{const t=r.lineToolsSynchronizer();null!==t&&(t.hasChanges().unsubscribe(e.recalcHasChanges),e.recalcHasChanges())}))}))}function Zt(e,t){e.chartWidgetsDefs.forEach((i=>{const r=(0,s.ensureNotNull)(i.chartWidget);r.onZoom().subscribe(t,(t=>e.onZoom.fire(t))),r.onScroll().subscribe(t,(()=>e.onScroll.fire())),r.withModel(null,(()=>{const t=r.lineToolsSynchronizer();null!==t&&(t.hasChanges().subscribe(e.recalcHasChanges),e.recalcHasChanges())}))}))}async function Xt(e,t,i){var r,n;(t=e.checkProFeature(t))in te.layouts||(t="s"),Kt(e,i);const o=e.layoutType,a=te.layouts[t].count;(0,ie.emit)("layout_about_to_be_changed",t),(null!==(r=e.splitters.value())&&void 0!==r?r:[]).forEach(((e,t)=>{e.splitterElement.remove(),e.mouseHandler.destroy()})),e.splitters.setValue([]);const l=te.layouts[t];e.layoutTemplate.setValue(l);const c=null!==(n=e.allLayoutSizesState.get(l.layoutType))&&void 0!==n?n:(0,ne.layoutInitialSizingState)(l.expression);e.allLayoutSizesState.set(l.layoutType,c),e.sizingState.setValue(c);const h=e.maximizedChartDef.value();o!==t&&e.maximizedChartDef.value()&&e.maximizedChartDef.setValue(null),h&&e.activeChartWidget.setValue((0,s.ensureNotNull)(h.chartWidget));for(let t=0;t=a;if(r=e.maximizedChartDef.value()?e.maximizedChartDef.value()===n:t1),n.fullscreen.setValue(e.maximizedChartDef.value()===n),n.collapsed.setValue(o)}else n&&(Yt(n),n.collapsed.setValue(o))}e.sizingState.setValue(c),Ht(e),e.layoutWV.setValue(t),e.setLayoutType(t),e.updateWatchedValue(),function(e){const t=e.layoutTemplate.value().count;e.inlineChartsCount.setValue(t),e.globalDetachable.setValue(t>1)}(e),e.checkAllPendingModelsAlreadyCreated(),Zt(e,i),e.inlineChartsCount.value()<1&&a>0&&e.chartWidgetsDefs[a-1].rdState.bridge().attach()}function Jt(e,t,i,s,r){const n=e.actualLayoutCount();return e.chartWidgetsDefs.slice(0,n).filter((e=>e.rdState.bridge().visible.value())).map((e=>e.chartWidget)).filter((t=>t.id()!==i&&(!!t.hasModel()&&(s||e.crosshairLockRaw)))).forEach((e=>e.model().model().setExternalPosition(t,r))),!0}function Qt(e,t,i,s,r){if(Jt(e,t,i,s,r)){const i=e.crossHairSyncBroadcast;if(i){const e={type:"crosshair",payload:{point:t,envState:r,sourceUniqueId:i.uniqueId}};i.channel.postMessage(e)}}}function ei(e){const t=new BroadcastChannel("ChartWidgetsCollection");return t.onmessage=t=>{const i=t.data,s=e();if(s.crossHairSyncBroadcast&&"crosshair"===i.type)s.crossHairSyncBroadcast.uniqueId!==i.payload.sourceUniqueId&&Jt(s,i.payload.point,null,!1,i.payload.envState)},{channel:t,uniqueId:(0,ee.randomHashN)(6)}}function ti(e){var t;null===(t=e.crossHairSyncBroadcast)||void 0===t||t.channel.close()}function ii(e,t,i){if(!e.combinedTrackTimeLock.value()||e.dateRangeLock.value())return;const s=e.layoutTemplate.value().count;e.undoHistory.beginUndoMacro(nt),e.chartWidgetsDefs.slice(0,s).filter((e=>e.chartWidget.hasModel()&&e.chartWidget.model().model()!==i)).forEach((e=>{const i=e.chartWidget.model().model(),s=i.mainSeries().syncModel();s&&i.syncTimeWithModel(s.syncSourceTarget(),t)})),e.undoHistory.endUndoMacro(),(0,ie.emit)("sync_time",t)}function si(e){return Promise.all(e.map((e=>{const t=e.model().mainSeries();return t.symbolResolvingActive().value()?d(t.dataEvents().symbolResolved()).promise:t.symbolInfo()})))}function ri(e){return e.chartWidgetsDefs.every((e=>e.chartWidget.hasModel()))?Promise.resolve(e.chartWidgetsDefs.map((e=>e.chartWidget))):Promise.all(e.chartWidgetsDefs.map((e=>e.chartWidget.hasModel()||d(e.chartWidget.modelCreated()).promise))).then((()=>ri(e)))}function ni(e,t){var i;if((0,h.enabled)("charting_library_base"))return t;if("s"===t||e.widgetOptions.containsData||e.readOnly||isProductFeatureEnabled(ProductFeatures.MULTIPLE_CHARTS)&&(0,s.ensure)(null===(i=getProductFeatureConfig(ProductFeatures.MULTIPLE_CHARTS))||void 0===i?void 0:i.limit)>=te.layouts[t].count)return t;return"s"}async function oi(e,t,i){return i=ni(e,i),e.layoutWV.value()!==i&&(e.undoHistory.pushUndoCommand(new he(t,i)),!0)}async function ai(e,t,i){const{theme:s,onlyActiveChart:r,restoreNonThemeDefaults:n,themeName:o,standardTheme:a,syncState:l=!0,noUndo:c}=i,h=(0,E.getCurrentTheme)().name;let d
;r?d=[e.activeChartWidget.value()]:(Kt(e,t),await Promise.all(e.savedChartWidgetOptions.map(((i,s)=>new Promise((i=>{Yt($t(e,t,s,i))}))))),d=e.chartWidgetsDefs.map((e=>e.chartWidget)),Zt(e,t)),c?(a&&new Ze(h,o,l).redo(),d.forEach((e=>{e.model().model().restoreTheme(s,n,c)}))):(e.undoHistory.beginUndoMacro(lt),a&&e.undoHistory.pushUndoCommand(new Ze(h,o,l)),d.forEach((e=>{e.model().model().restoreTheme(s,n)})),e.undoHistory.endUndoMacro()),await Promise.all(d.map((e=>e.model().model().colorStudiesPropertiesReady())))}function li(e,t){e.symbolLock.setValue(t)}function ci(e,t){const{internalSymbolLock:i,activeChartWidget:s,undoHistory:r,dateRangeLock:n,loadingContent:o,linkingGroupsCharts:l,chartWidgetsDefs:c}=e;if(t!==i.value())if(o)i.setValue(t);else{if(e.undoHistory.beginUndoMacro(ct),t){const t=s.value();c.map((e=>e.chartWidget));l.forEach(((i,s)=>{const r=(t.linkingGroupIndex().value(),t);if(void 0!==r){(0,a.muteLinkingGroup)(s,!0);for(const t of i.value())t!==r&&t.symbolWV().value()!==r.symbolWV().value()&&(t.setSymbol(r.symbolWV().value()),n.value()&&e.subscribeToCompletedEventForDateRangeSync(t,!0));(0,a.muteLinkingGroup)(s,!1)}}))}r.setWatchedValue(i,t,ct),r.endUndoMacro()}}function hi(e,t){e.intervalLock.setValue(t)}function di(e,t){const{internalIntervalLock:i,activeChartWidget:s,undoHistory:r,dateRangeLock:n,loadingContent:o,chartWidgetsDefs:l,linkingGroupsCharts:c}=e;if(t!==i.value())if(o)i.setValue(t);else{if(r.beginUndoMacro(ht),t&&t){const t=s.value();l.map((e=>e.chartWidget));c.forEach(((i,s)=>{const r=(t.linkingGroupIndex().value(),t);if(void 0!==r){(0,a.muteLinkingGroup)(s,!0);for(const t of i.value())t!==r&&t.resolutionWV().value()!==r.resolutionWV().value()&&(t.setResolution(r.resolutionWV().value()),n.value()&&e.subscribeToCompletedEventForDateRangeSync(t,!0));(0,a.muteLinkingGroup)(s,!1)}}))}r.setWatchedValue(i,t,ht),r.endUndoMacro()}}function ui(e,t){const i=e.activeChartWidget.value();if(i&&i.hasModel()){const s=i.model();t?(e.subscribeToEventsForDateRangeSync(s),e.syncChartsDateRangesWithActiveChartRange()):e.unsubscribeFromEventsForDateRangeSync(s)}e.dateRangeLock.setValue(t)}function pi(e,t){const{internalDateRangeLock:i,undoHistory:s,loadingContent:r}=e;r?i.setValue(t):s.setWatchedValue(i,t,dt)}function _i(e,t){e.trackTimeLock.setValue(t)}function mi(e,t){const{internalTrackTimeLock:i,undoHistory:s,loadingContent:r}=e;r?i.setValue(t):s.setWatchedValue(i,t,ut)}function gi(e,t,i){e.symbolLock.value()?fi(e,t,i):e.activeChartWidget.value().setSymbol(t)}function fi(e,t,i){const s=e.activeChartWidget.value();void 0===i&&(i=s.linkingGroupIndex().value());for(const i of e.chartWidgetsDefs){const e=i.chartWidget;(e.hasModel()?e.model().mainSeries().symbolSameAsResolved(t):e.symbolWV().value()===t)||e.setSymbol(t)}}async function vi(e,t=this.activeChartWidget.value()){return!!t&&(function(e,t){const i=e.model(),s=i.mainSeries().properties().childs().style;i.setChartStyleProperty(s,t,pt)}(t,e),!0)}function Si(e){
return e.intervalLock.value()?e.chartWidgetsDefs.map((e=>e.chartWidget)):[e.activeChartWidget.value()]}async function yi(e,t,i,s){return!(e.flags.loadingChart||e.flags.setTimeFrameActive||e.flags.setNewResolution)&&(function(e,t,i,s){(0,et.setLastUsedResolution)(t),e.flags.setNewResolution=!0,s=null!=s?s:e.activeChartWidget.value(),void 0===i&&(i=s.linkingGroupIndex().value());if(e.intervalLock.value())for(const i of e.chartWidgetsDefs){const e=i.chartWidget;e.resolutionWV().value()!==t&&e.setResolution(t)}else s.setResolution(t);e.flags.setNewResolution=!1}(e,t,i,s),!0)}function bi(e){return new u.WatchedValue(null).spawn()}function wi(e){return[null]}function Ci(e){const t=new Qe.WatchedObject((e.chartWidgetsDefs,[null])),i=()=>{t.setValue((e.chartWidgetsDefs,[null]))};e.chartWidgetsDefs.forEach((e=>e.chartWidget.linkingGroupIndex().subscribe(i)));const s=e=>{e.linkingGroupIndex().subscribe(i),i()};return e.chartWidgetCreatedDelegate.subscribe(null,s),t.spawn((()=>{e.chartWidgetsDefs.forEach((e=>e.chartWidget.linkingGroupIndex().unsubscribe(i))),e.chartWidgetCreatedDelegate.unsubscribe(null,s)}))}function Pi(e,t){t=null;let i=e.linkingGroupsCharts.get(t);return void 0===i&&(i=new Qe.WatchedObject([],N.compareTwoCollectionsByIds),e.linkingGroupsCharts.set(t,i)),i}function xi(e){var t;const i=new Map;for(const t of e.chartWidgetsDefs){const e=null;let s=i.get(e);void 0===s&&(s=[],i.set(e,s)),s.push(t.chartWidget)}for(const s of(0,N.join)(new Set(e.linkingGroupsCharts.keys()),new Set(i.keys())))Pi(e,s).setValue(null!==(t=i.get(s))&&void 0!==t?t:[])}function Ti(e){0}function Ii(e,t){return new u.WatchedValue(!1).spawn()}function Mi(e,t,i){return(0,Xe.combine)(((e,t)=>e||t),t.weakReference(),Ii().ownership())}function Ai(e,t,i){const s=t.id();if(e.chartWidgetIdToCompletedCallbackMap.has(s))return;const r=()=>{e.chartWidgetIdToCompletedCallbackMap.has(s)&&(e.chartWidgetIdToCompletedCallbackMap.delete(s),Ri(e,i?t:void 0))};t.model().mainSeries().dataEvents().completed().subscribe(null,r,!0),e.chartWidgetIdToCompletedCallbackMap.set(s,{cw:t,callback:r})}function Li(e){Ri(e)}const ki=new Map;function Di(e){var t;const i=null!==(t=ki.get(e.id()))&&void 0!==t?t:{};return ki.set(e.id(),i),i}function Ei(e,t){t.timeScale().visibleBarsStrictRangeChanged().subscribe(Di(t),Li.bind(null,e))}function Vi(e,t){t.timeScale().visibleBarsStrictRangeChanged().unsubscribeAll(Di(t)),e.chartWidgetIdToCompletedCallbackMap.forEach((e=>{const t=e.cw,i=e.callback;t.model().mainSeries().dataEvents().completed().unsubscribe(null,i)})),e.chartWidgetIdToCompletedCallbackMap.clear()}function Bi(e,t,i){e.model().model().gotoTimeRange(t,i),(0,ie.emit)("sync_date_range",t,i)}function Ri(e,t){if(!e.dateRangeLock.value()||null!==e.currentLayoutResizeAction.value())return;const i=e.activeChartWidget.value(),r=i.model().mainSeries();if(!(0,k.isTimeBasedStyle)(r.style()))return;const n=i.model().timeScale(),o=n.visibleBarsStrictRange();if(null===o)return;const a=(0,s.ensureNotNull)(n.points().range().value());let l=n.indexToTimePoint(o.firstBar())
;null===l&&r.endOfData()&&(l=n.indexToTimePoint(a.firstIndex));let c=n.indexToTimePoint(o.lastBar());if(null===c&&(c=n.indexToTimePoint(a.lastIndex)),null===l||null===c)return void Ai(e,i,!1);e.chartWidgetIdToCompletedCallbackMap.delete(i.id());let h=1e3*l,d=1e3*c;if(r.isDWM()){const e=new Date(h),t=new Date(d);(0,L.set_hms)(e,0,0,0,0),(0,L.set_hms)(t,0,0,0,0),h=e.getTime(),d=t.getTime()}for(let s=0;s{"use strict";i.r(t),i.d(t,{CHART_FONT_FAMILY:()=>n,CHART_MONOSPACE_FONT_FAMILY:()=>o,setChartFontFamily:()=>r});const s="'Trebuchet MS', Roboto, Ubuntu, sans-serif";function r(e){n=e}let n=`-apple-system, BlinkMacSystemFont, ${s}`;const o="monospace"},66509:(e,t,i)=>{"use strict";var s=i(36298).TranslatedString,r=i(50151).assert,n=i(76544).Series,o=i(14483),a=i(77212).ActionBinder,l=i(56840).setValue,c=i(14787).TabNames,h=i(64358).showGoToDateDialog,d=i(68335),u=i(4741),p=i(56827).Study,_=i(52329).StudyStub,m=i(28853).isStudy,g=i(13087).LineDataSource,f=i(92249),v=f.isLineTool,S=f.isStudyLineTool,y=i(72877).STUDYPLOTDISPLAYTARGET,b=i(74970).studyMetaInfoRepository,w=i(39347).Action,C=i(95059).ACTION_ID,P=i(88348),x=i(36274).Interval,T=i(42960),I=T.getDefaultStyle,M=T.hasVolume,A=i(91280).InvalidationMask,L=i(82992).linking,k=i(54270).showChangeIntervalDialogAsync,D=i(85769).createSymbolSearchAction,E=i(38618),V=E.availableTimezones,B=E.timezoneIsAvailable,R=i(90995).toggleHideMode,N=i(42856).StudyMetaInfo,O=i(51768).trackEvent,F=i(38325).lastMouseOrTouchEventInfo,W=i(85804);const{viewportChangeEvent:H}=i(28558);var z=i(57898).Delegate,U=i(59224).getLogger("ChartWidget",{color:"#606"}),j=i(53180).appendEllipsis,G=i(19334).addPerfMark,q=i(49152).combineProperty,$=i(58487).ChartWidgetBase,Y=i(49483).CheckMobile.any(),K=i(17133).TIMEFRAMETYPE,Z=i(11095).addPlusButtonProperty;const X=o.enabled("show_average_close_price_line_and_label");var J=new s("change timezone",i.tf(null,void 0,i(20505))),Q=new s("scale price chart only",i.tf(null,void 0,i(99042))),ee=new s("stay in drawing mode",i.tf(null,void 0,i(52010))),te=(new s("hide all drawing tools",i.tf(null,void 0,i(54781))),new s("hide marks on bars",i.tf(null,void 0,i(44974)))),ie=new s("change symbol last value visibility",i.tf(null,void 0,i(53150))),se=(new s("change symbol previous close value visibility",i.tf(null,void 0,i(12707))),new s("change previous close price line visibility",i.tf(null,void 0,i(59883))),new s("change symbol labels visibility",i.tf(null,void 0,i(9402)))),re=new s("change indicators name labels visibility",i.tf(null,void 0,i(87027))),ne=new s("change indicators value labels visibility",i.tf(null,void 0,i(14922))),oe=(new s("change bid and ask labels visibility",i.tf(null,void 0,i(5100))),new s("change bid and ask lines visibility",i.tf(null,void 0,i(32311))),
new s("change pre/post market price label visibility",i.tf(null,void 0,i(49889))),new s("change pre/post market price line visibility",i.tf(null,void 0,i(16750))),new s("change high and low price lines visibility",i.tf(null,void 0,i(92556)))),ae=new s("change high and low price labels visibility",i.tf(null,void 0,i(66805))),le=new s("change average close price line visibility",i.tf(null,void 0,i(98866))),ce=new s("change average close price label visibility",i.tf(null,void 0,i(39402))),he=new s("change countdown to bar close visibility",i.tf(null,void 0,i(58108))),de=new s("change plus button visibility",i.tf(null,void 0,i(50190))),ue=new s("change price line visibility",i.tf(null,void 0,i(67761))),pe=new s("unlock {title}",i.tf(null,void 0,i(92421))),_e=new s("lock {title}",i.tf(null,void 0,i(50193))),me=new s("change session breaks visibility",i.tf(null,void 0,i(15403))),ge=i.tf(null,void 0,i(15241)),fe=i.tf(null,void 0,i(29404)),ve=i.tf(null,void 0,i(44302)),Se=i.tf(null,void 0,i(94338));e.exports.ChartWidget=class extends ${constructor(e,t,i){super(e,t,i),this._options.timeScaleWidget&&(this._options.timeScaleWidget.pressedMouseMoveScale=this._options.handleScale.axisPressedMouseMove.time);var s=this,r=this._options.content,n=this._options.readOnly;this._removeMaximizeHotkey=null,s._hotkeys=u.createGroup({desc:"Chart actions",isDisabled:function(){return!s._isActive}});var o=this._options.containsData,a=this._options.onWidget,l=this._options.onCmeWidget;l&&U.logWarn("[ChartWidget] 'onCmeWidget' option is depricated");var c=this._options.widgetCustomer,h=this._options.timezone,d=this._options.hideSymbolSearch,p=this._options.defSymbol,_=x.isValid(this._options.defInterval)?this._options.defInterval:void 0,m=parseInt(this._options.defStyle),g=T.isValidStyle(m)?m:void 0,f=this._options.defSessionId,v=void 0!==this._options.defTimeframe?"string"==typeof this._options.defTimeframe?{value:this._options.defTimeframe.toUpperCase(),type:K.PeriodBack}:{...this._options.defTimeframe,type:K.TimeRange}:void 0;this._content=r,this._initialLoading=this._options.initialLoading,this._readOnly=n,this._containsData=o,this._defSymbol=p,this._defInterval=_,this._defTimeframe=v,this._defStyle=g,this._onWidget=!!a,this._compareSymbols=this._options.compareSymbols,this._onWidget&&(l?this._widgetCustomer="cme":c&&(this._widgetCustomer=c)),this._hideSymbolSearch=d,this._frameTime=30,this._model=null,this._metaInfo={},this._drawRafId=0,this._compareDialog=this._chartWidgetCollection.getCompareDialogRenderer();var S=this._contentSeriesProperties();S&&(p=S.symbol,_=S.interval),void 0===this._options.useUserChartPreferences&&(this._options.useUserChartPreferences=!0);var y="chartproperties.mainSeriesProperties",b=this._options.useUserChartPreferences?W.defaults(y):W.factoryDefaults(y);this._properties.mainSeriesProperties.merge(b),this._properties.mainSeriesProperties.hasChild("esdBreaksStyle")&&this._properties.mainSeriesProperties.removeProperty("esdBreaksStyle"),_=_||b.interval||"D",
T.isValidStyle(g)||(g=T.isValidStyle(b.style)?b.style:I(x.isRange(_))),this._properties.mainSeriesProperties.merge({visible:!0,symbol:p||DEFAULT_SYMBOL,shortName:"",timeframe:"",onWidget:this._onWidget,interval:_,currencyId:null,unitId:null,style:g,sessionId:f}),this._symbolWV.setValue(this.getSymbol()),this._resolutionWV.setValue(this.getResolution()),this._containsData&&this._properties.mainSeriesProperties.merge({showCountdown:!1}),h&&B(h)&&this._properties.timezone.setValue(h),this._tagsChanged=new z,this._timingsMeter=null,this._isActive=this._options.isActive,this._options.container.subscribe((function(e){s._setElement(e)}),{callWithLast:!0});var w=function(){s.resize()};this._options.width.subscribe(w),this._options.height.subscribe(w),this._options.visible.subscribe(this._updateTimingsMeterState.bind(this)),this._aboutToBeDestroyed=new z,this._actions=null,this._definitionsViewModel=null,this._backgroundTopColorSpawn=null,this._backgroundBottomColorSpawn=null}isInitialized(){return Boolean(this._inited)}compareSymbols(){return this._compareSymbols}async _getChartPropertyDefinitionsViewModel(){if(null===this._definitionsViewModel){const{ChartPropertyDefinitionsViewModel:e}=await Promise.all([i.e(2578),i.e(2547),i.e(8882),i.e(3986),i.e(3596)]).then(i.bind(i,73023));if(this._isDestroyed)throw new Error("Chart widget already destroyed");await new Promise((e=>this.withModel(null,e))),null===this._definitionsViewModel&&(this._definitionsViewModel=new e(this.model(),this.properties(),this._options))}return this._definitionsViewModel}_initMaximizeHotkey(e){var t=this;function i(e){e.defaultPrevented||d.modifiersFromEvent(e)===d.Modifiers.Alt&&e.stopPropagation()}function s(e){e.defaultPrevented||d.modifiersFromEvent(e)===d.Modifiers.Alt&&(e.preventDefault(),e.stopPropagation(),t.toggleFullscreen())}return e.addEventListener("mousedown",i,!0),e.addEventListener("click",s,!0),function(){e.removeEventListener("mousedown",i,!0),e.removeEventListener("click",s,!0)}}toggleFullscreen(){var e=this.getResizerDetacher();e.fullscreenable.value()&&(e.fullscreen.value()?e.exitFullscreen():e.requestFullscreen())}_beginRequestActive(){var e=this._chartWidgetCollection.activeChartWidget.value()!==this;if(this._chartWidgetCollection.activeChartWidget.setValue(this),e){this._chartWidgetCollection.ariaDescribeChart(this._chartWidgetCollection.activeChartWidget.value());const e=F();e.isTouch&&!e.stylus&&this._isLineToolModeExceptBrush()&&this.updateCrossHairPositionIfNeeded(),this._justActivated=!0}}_endRequestActive(){var e=this;this._justActivated&&setTimeout((function(){e._justActivated=!1}),0)}_requestActive(){this._beginRequestActive(),this._endRequestActive()}justActivated(){return this._justActivated}setTimezone(e){e&&B(e)?this._properties.timezone.setValue(e):console.warn("Incorrect timezone: "+JSON.stringify(e))}getTimezone(){return this._properties.timezone.value()}refreshMarks(){this.model().barsMarksSources().forEach((function(e){e.refreshData()}))}clearMarks(e){this.model().barsMarksSources().forEach((function(t){
t.clearMarks(e)}))}_initBackgroundColor(){null===this._backgroundTopColorSpawn&&(this._backgroundTopColorSpawn=this._model.model().backgroundTopColor().spawn(),this._backgroundTopColorSpawn.subscribe(this._onBackgroundColorChanged.bind(this))),null===this._backgroundBottomColorSpawn&&(this._backgroundBottomColorSpawn=this._model.model().backgroundColor().spawn(),this._backgroundBottomColorSpawn.subscribe(this._onBackgroundColorChanged.bind(this)))}paneWidgets(){return this._paneWidgets}paneByCanvas(e){for(var t=0;t{null!==e&&t()}))}));var t=new w({actionId:C.ChartSeriesPriceScaleToggleInvertPriceScale,options:{label:i.tf(null,void 0,i(53239)),statName:"Invert Scale",checkable:!0,onExecute:function(){e._model.invertPriceScale(e._model.mainSeries().priceScale())},hotkeyGroup:this._hotkeys,hotkeyHash:u.Modifiers.Alt+73}
}),s=new w({actionId:C.ChartSeriesPriceScaleToggleAutoScale,options:{label:i.tf(null,void 0,i(50834)),checkable:!0,onExecute:function(){var t=e._model.mainSeries().priceScale();e._model.togglePriceScaleAutoScaleMode(t),s.update({checked:t.isAutoScale()})}}}),r=new w({actionId:C.ChartScalesToggleLockPriceToBarRatio,options:{label:i.tf(null,void 0,i(18219)),checkable:!0,statName:"ToggleLockScale",onExecute:function(){e._model.togglePriceScaleLockScaleMode(e._model.mainSeries().priceScale())}}}),n=new w({actionId:C.ChartSeriesPriceScaleToggleRegular,options:{label:i.tf(null,{context:"scale_menu"},i(72116)),checkable:!0,statName:"ToggleRegularScale",onExecute:function(){var t=e._model.mainSeries().priceScale();e._model.setPriceScaleRegularScaleMode(t),n.update({checked:t.isRegular()})}}}),c=new w({actionId:C.ChartSeriesPriceScaleTogglePercentage,options:{label:i.tf(null,void 0,i(51102)),checkable:!0,statName:"TogglePercantage",onExecute:function(){e._model.togglePriceScalePercentageScaleMode(e._model.mainSeries().priceScale())},hotkeyGroup:this._hotkeys,hotkeyHash:u.Modifiers.Alt+80}}),p=new w({actionId:C.ChartSeriesPriceScaleToggleIndexedTo100,options:{label:i.tf(null,void 0,i(20062)),checkable:!0,statName:"ToggleIndexedTo100",onExecute:function(){e._model.togglePriceScaleIndexedTo100ScaleMode(e._model.mainSeries().priceScale())}}}),_=new w({actionId:C.ChartSeriesPriceScaleToggleLogarithmic,options:{label:i.tf(null,void 0,i(12285)),statName:"ToggleLogScale",checkable:!0,onExecute:function(){e._model.togglePriceScaleLogScaleMode(e._model.mainSeries().priceScale())},hotkeyGroup:this._hotkeys,hotkeyHash:u.Modifiers.Alt+76}}),m=new w({actionId:C.ChartUndo,options:{label:i.tf(null,void 0,i(81320)),onExecute:function(){O("GUI","Undo"),e._model.undoHistory().undo()},disabled:!0,hotkeyGroup:this._hotkeys,hotkeyHash:u.Modifiers.Mod+90,isRepeatAccepted:!0}}),g=new w({actionId:C.ChartRedo,options:{label:i.tf(null,void 0,i(41615)),onExecute:function(){O("GUI","Redo"),e._model.undoHistory().redo()},disabled:!0,hotkeyGroup:this._hotkeys,hotkeyHash:u.Modifiers.Mod+89,isRepeatAccepted:!0}});e.withModel(null,(function(){e._model.undoHistory().undoStack().onChange().subscribe(e,e.updateUndoRedo),e._model.undoHistory().redoStack().onChange().subscribe(e,e.updateUndoRedo)}));var f=new w({actionId:C.ChartChangeTimeZone,options:{label:i.tf(null,void 0,i(64375)),statName:"TimeZone"}}),v=D();l("symboledit.dialog_last_entry","");var S={label:j(i.tf(null,void 0,i(99374))),statName:"ChangeInterval",onExecute:function(){k({initVal:L.interval.value(),selectOnInit:!0})}};!o.enabled("show_interval_dialog_on_key_press")||this.readOnly()||this._hideSymbolSearch||(S.shortcutHint=",",S.hotkeyGroup=this._hotkeys,S.hotkeyHash=188);var y=new w({actionId:C.ChartDialogsShowChangeInterval,options:S});TradingView.onWidget();var b=this._createResetTimescaleAction(),x=new w({actionId:C.ChartRemoveAllIndicators,options:{label:i.tf(null,void 0,i(13951)),statName:"RemoveAllIndicators",onExecute:this.removeAllStudies.bind(this)}}),T=new w({
actionId:C.ChartRemoveAllLineTools,options:{label:i.tf(null,void 0,i(1434)),statName:"RemoveAllDrawingTools",onExecute:this.removeAllDrawingTools.bind(this)}}),I=new w({actionId:C.ChartRemoveAllIndicatorsAndLineTools,options:{label:i.tf(null,void 0,i(97305)),statName:"RemoveAllIndicatorsAndDrawingTools",onExecute:this.removeAllStudiesDrawingTools.bind(this)}}),M=this.chartWidgetCollection(),E=new w({actionId:C.ChartApplyIndicatorsToAllCharts,options:{label:i.tf(null,void 0,i(95910)),statName:"ApplyIndicatorsToAllCharts",onExecute:function(){M.applyIndicatorsToAllCharts(e)}}}),V={label:j(i.tf(null,void 0,i(98767))),statName:"InsertIndicator",onExecute:function(){e.showIndicators()}};this._options.indicatorsDialogShortcutEnabled&&(V.hotkeyGroup=this._hotkeys,V.hotkeyHash=191,this._hotkeys.add({handler:function(){this.showIndicators()}.bind(this),desc:"Show insert indicator dialog",hotkey:111}));var B,N=new w({actionId:C.ChartDialogsShowInsertIndicators,options:V}),F=new w({actionId:C.ChartDialogsShowCompareOrAddSymbol,options:{label:j(i.tf(null,void 0,i(20229))),statName:"CompareOrAddSymbol",onExecute:this.toggleCompareOrAdd.bind(this)}}),W=new w({actionId:C.ChartObjectTreeShow,options:{label:j(i.tf(null,void 0,i(675))),statName:"ObjectsTree",onExecute:this.showObjectsTreePanelOrDialog.bind(this)}}),z=this._createChartPropertiesAction(),U=this._createMainSeriesPropertiesAction(),G=this._createScalesPropertiesAction(),$=new w({actionId:C.ChartSelectedObjectToggleLocked,options:{label:i.tf(null,void 0,i(1441)),statName:"ToggleLockSelectedObject",onExecute:this.toggleLockSelectedObject.bind(this)}}),Y=this._createHideSelectedObjectAction();o.enabled("property_pages")&&(B=this._createSelectedSourcePropertiesAction()),this.withModel(null,(function(){var t=e.model().mainSeries(),i=t.properties();i.priceAxisProperties.subscribe(e,e._updateScalesActions),t.priceScaleAboutToBeChanged().subscribe(e,(function(){i.priceAxisProperties.unsubscribeAll(e)})),t.priceScaleChanged().subscribe(e,(function(){i.priceAxisProperties.subscribe(e,e._updateScalesActions),e._updateScalesActions()}))}));var K=new w({actionId:C.ChartPriceScaleToggleAutoScaleSeriesOnly,options:{label:i.tf(null,void 0,i(37207)),checkable:!0,statName:"ScalePriceChartOnly"}});K.binder=new a(K,this._properties.scalesProperties.scaleSeriesOnly,this.model(),Q);var J=this.model().model();this._properties.scalesProperties.scaleSeriesOnly.listeners().subscribe(null,(function(){J.recalculateAllPanes(H()),J.invalidate(A.full())}));var pe=new w({actionId:C.ChartDrawingToolbarToggleVisibility,options:{label:i.tf(null,void 0,i(22903)),checkable:!0,statName:"ToggleDrawingToolbar"}}),_e=this._options.isDrawingToolbarVisible;_e&&(_e.subscribe((function(e){pe.update({checked:e})}),{callWithLast:!0}),pe.update({onExecute:function(){_e.setValue(!_e.value())}}));var me=new w({actionId:"",options:{label:i.tf(null,void 0,i(93161)),checkable:!0,statName:"ToggleStayInDrawingMode"}});me.binder=new a(me,P.properties().stayInDrawingMode,this.model(),ee),this._hotkeys.add({handler:function(){
R()},desc:"Hide all drawing tools",hotkey:u.Modifiers.Mod+u.Modifiers.Alt+72});var ye=new w({actionId:C.ChartMarksToggleVisibility,options:{label:i.tf(null,void 0,i(2441)),checkable:!0,statName:"ToggleHideMarksOnBars"}});ye.binder=new a(ye,P.hideMarksOnBars(),this.model(),te,(function(){P.hideMarksOnBars().setValue(this.value())}));const be=this.properties().scalesProperties;var we=new w({actionId:C.ChartPriceScaleLabelsToggleSeriesLastValueVisibility,options:{label:i.tf(null,void 0,i(52054)),checkable:!0,checked:!1,statName:"ToggleSymbolLastValue"}});we.binder=new a(we,be.showSeriesLastValue,this.model(),ie);var Ce=new w({actionId:C.ChartPriceScaleLabelsToggleSymbolNameLabelsVisibility,options:{label:i.tf(null,void 0,i(90932)),checkable:!0,checked:!1,statName:"ToggleSymbolLabels"}});Ce.binding=new a(Ce,be.showSymbolLabels,this.model(),se);const Pe=q(((e,t)=>e||!1),be.showStudyLastValue.weakReference(),be.showFundamentalLastValue.weakReference());var xe=new w({actionId:C.ChartPriceScaleLabelsToggleIndicatorsValueLabelsVisibility,options:{label:i.tf(null,void 0,i(81584)),checkable:!0,checked:!1,statName:"ToggleStudiesAndFundamentalsPriceLabels"}});xe.binder=new a(xe,Pe,this.model(),null,(()=>{const e=!Pe.value();this.model().beginUndoMacro(ne),this.model().setProperty(be.showStudyLastValue,e,null),this.model().endUndoMacro()}));const Te=q(((e,t)=>e||!1),be.showStudyPlotLabels.weakReference(),be.showFundamentalNameLabel.weakReference());var Ie=new w({actionId:C.ChartPriceScaleLabelsToggleIndicatorsNameLabelsVisibility,options:{label:i.tf(null,void 0,i(31485)),checkable:!0,checked:!1,statName:"ToggleStudiesAndFundamentalsNameLabels"}});Ie.binding=new a(Ie,Te,this.model(),null,(()=>{const e=!Te.value();this.model().beginUndoMacro(re),this.model().setProperty(be.showStudyPlotLabels,e,null),this.model().endUndoMacro()}));var Me=this.model().mainSeries().properties().highLowAvgPrice,Ae=new w({actionId:C.ChartPriceScaleLabelsToggleHighLowPriceLabelsVisibility,options:{label:i.tf(null,void 0,i(60259)),checkable:!0,checked:!1,statName:"ToggleHighLowPriceLabels"}});Ae.binding=new a(Ae,Me.highLowPriceLabelsVisible,this.model(),ae);var Le=new w({actionId:C.ChartLinesToggleHighLowLinesVisibility,options:{label:i.tf(null,void 0,i(21803)),checkable:!0,checked:!1,statName:"ToggleHighLowPriceLine"}});if(Le.binding=new a(Le,Me.highLowPriceLinesVisible,this.model(),oe),X){var ke=new w({actionId:C.ChartPriceScaleLabelsToggleAveragePriceLabelVisibility,options:{label:i.tf(null,void 0,i(8975)),checkable:!0,checked:!1,statName:"ToggleAverageClosePriceLabel"}});ke.binding=new a(ke,Me.averageClosePriceLabelVisible,this.model(),ce);var De=new w({actionId:C.ChartLinesTogglePrePostMarketLineVisibility,options:{label:i.tf(null,void 0,i(87899)),checkable:!0,checked:!1,statName:"ToggleAverageClosePriceLine"}});De.binding=new a(De,Me.averageClosePriceLineVisible,this.model(),le)}var Ee=new w({actionId:C.ChartPriceScaleToggleCountdownToBarCloseVisibility,options:{label:i.tf(null,void 0,i(94370)),checkable:!0,checked:!1,statName:"ToggleCountdown"}})
;Ee.binder=new a(Ee,this.model().mainSeries().properties().showCountdown,this.model(),he);var Ve=new w({actionId:C.ChartPriceScaleToggleAddOrderPlusButtonVisibility,options:{label:i.tf(null,void 0,i(97378)),checkable:!0,checked:Z.value(),statName:"ToggleAddOrderPlusButton"}});Ve.binder=new a(Ve,Z,this.model(),de);var Be=null;this._options.goToDateEnabled&&(Be=new w({actionId:C.ChartDialogsShowGoToDate,options:{label:j(i.tf(null,void 0,i(75190))),statName:"GoToDate",onExecute:function(){var t=e._chartWidgetCollection.activeChartWidget.value();h(t)},hotkeyGroup:this._hotkeys,hotkeyHash:u.Modifiers.Alt+71}}));var Re=this._createShowSymbolInfoDialogAction(),Ne=new w({actionId:C.ChartPriceScaleMergeAllScalesToLeft,options:{label:ge,statName:"MergeAllScalesToLeft",onExecute:function(){e.model().mergeAllScales("left")}}}),Oe=new w({actionId:C.ChartPriceScaleMergeAllScalesToRight,options:{label:fe,statName:"MergeAllScalesToRight",onExecute:function(){e.model().mergeAllScales("right")}}}),Fe=new w({actionId:C.ChartPriceScaleMoveToLeft,options:{label:ve,statName:"MoveScaleToLeft",onExecute:function(){e.model().mergeAllScales("left")}}}),We=new w({actionId:C.ChartPriceScaleMoveToRight,options:{label:Se,statName:"MoveScaleToRight",onExecute:function(){e.model().mergeAllScales("right")}}});var He=o.enabled("show_object_tree");this._actions={chartProperties:z,mainSeriesPropertiesAction:U,scalesProperties:G,timeScaleReset:b,invertSeriesScale:t,logSeriesScale:_,autoSeriesScale:s,lockSeriesScale:r,regularSeriesScale:n,percentSeriesScale:c,indexedTo100SeriesScale:p,compareOrAdd:F,paneObjectTree:He?W:void 0,insertIndicator:N,symbolSearch:v,showSymbolInfoDialog:Re,changeInterval:y,seriesHide:Y,studyHide:Y,lineToggleLock:$,lineHide:Y,scaleSeriesOnly:K,drawingToolbarAction:pe,stayInDrawingModeAction:me,hideAllMarks:ye,applyTimeZone:f,showCountdown:Ee,addPlusButton:Ve,showSeriesLastValue:we,showHighLowPriceLabels:Ae,showHighLowPriceLines:Le,showAverageClosePriceLabel:ke,showAverageClosePriceLine:De,showSymbolLabelsAction:Ce,showStudyLastValue:xe,showStudyPlotNamesAction:Ie,undo:m,redo:g,mergeLeftScalesAction:Ne,mergeRightScalesAction:Oe,moveScaleToLeft:Fe,moveScaleToRight:We,moveChartAction:undefined},this._actions.chartReset=this._createChartResetAction();const ze=this._createApplyColorThemeAction();ze&&(this._actions.applyColorTheme=ze);const Ue=this._createAddToWatchlistAction();if(Ue&&(this._actions.addToWatchlist=Ue),!TradingView.onWidget()&&o.enabled("text_notes")&&(this._actions.addToTextNotes=undefined),null!==Be&&(this._actions.gotoDate=Be),this.createSessionBreaksActions(),!this.readOnly()){var je=this._createRemoveSelectedObjectAction();this._hotkeys.add({handler:function(){this.removeSelectedSources()}.bind(this),desc:"Remove selected source",hotkey:d.isMacKeyboard?46:8}),this._actions.paneRemoveAllStudies=x,this._actions.paneRemoveAllDrawingTools=T,this._actions.paneRemoveAllStudiesDrawingTools=I,this._actions.applyStudiesToAllCharts=E,this._actions.studyRemove=je,this._actions.lineRemove=je,
o.enabled("property_pages")&&(this._actions.format=B)}this._actions.showPriceLine=new w({actionId:C.ChartLinesToggleSeriesPriceLineVisibility,options:{label:i.tf(null,void 0,i(91492)),checkable:!0,statName:"TogglePriceLine"}}),this._actions.showPriceLine.binding=new a(this._actions.showPriceLine,this.model().mainSeries().properties().showPriceLine,this.model(),ue),this._registerLineToolHotkeys(),this._updateScalesActions()}options(){return this._options}executeActionById(e){if("takeScreenshot"===e)return console.warn('Action "takeScreenshot" is deprecated. Use method "takeScreenshot" instead'),void this._chartWidgetCollection.takeScreenshot();e in this._actions?this._actions[e]instanceof w&&this._actions[e].execute():console.warn("Unknown action id: "+e)}getCheckableActionState(e){if(e in this._actions){var t=this._actions[e];if(t instanceof w&&t.isCheckable())return t.isChecked();console.warn("Action "+e+" has no state")}else console.warn("Unknown action id: "+e);return null}_updateScalesActions(){if(null!==this._actions){var e=this.model().mainSeries(),t=e.priceScale(),i=e.properties(),s=t.isLockScale(),r=i.style.value()===n.STYLE_PNF;this._actions.percentSeriesScale.update({disabled:s||r,checked:t.isPercentage()}),this._actions.logSeriesScale.update({disabled:s||r,checked:t.isLog()}),this._actions.regularSeriesScale.update({disabled:s||r,checked:t.isRegular()}),this._actions.indexedTo100SeriesScale.update({disabled:s||r,checked:t.isIndexedTo100()}),this._actions.invertSeriesScale.update({checked:t.isInverted()}),this._actions.lockSeriesScale.update({checked:t.isLockScale()}),this._actions.autoSeriesScale.update({checked:t.isAutoScale(),disabled:t.properties().autoScaleDisabled.value()})}}defaultSymbol(){return this._defSymbol}widget(){return this._mainDiv}_onBackgroundColorChanged(){for(var e=0;e0;)for(var t=this._content.panes[e].sources,i=t.length;i-- >0;)if("MainSeries"===t[i].type)return t[i].state}updateUndoRedo(){this._model&&(this.actions().undo.update({disabled:this._model.undoHistory().undoStack().isEmpty()}),this.actions().redo.update({disabled:this._model.undoHistory().redoStack().isEmpty()}))}createSessionBreaksActions(){var e=new w({actionId:C.ChartSessionBreaksToggleVisibility,options:{label:i.tf(null,void 0,i(59827)),checkable:!0,statName:"ToggleSessionBreaks"}});e.binder=new a(e,this._model.chartModel().sessions().properties().graphics.vertlines.sessBreaks.visible,this.model(),me),this._actions.sessionBreaks=e}updateActionForIntradayOnly(e){e&&e instanceof w&&e.update({disabled:this.model().mainSeries().isDWM()})}containsVolume(){return this.model().dataSources().some((function(e){
return e instanceof p&&"Volume"===e.metaInfo().shortId}))}containsStudyByPredicate(e){return!!this._model&&this._model.dataSources().some((function(t){if(!(t instanceof p))return!1;var i=t.metaInfo();return e(i)}))}containsStudy(e){return this.containsStudyByPredicate((function(t){return t.id===e||t.fullId===e}))}isSmall(){return this._width()<550||this._height()<300}onWidget(){return this._onWidget}onCmeWidget(){return"cme"===this.widgetCustomer()}widgetCustomer(){return this._widgetCustomer}resize(){var e=this._height()+"px",t=this._width()+"px";this._mainDiv.style.height=e,this._mainDiv.style.width=t,this._elMainTable.style.height=e,this._elMainTable.style.width=t,this._resizeHandler&&this._mainDiv&&this._resizeHandler()}applyOverrides(e){var t={};for(var i in e)i.startsWith("mainSeriesProperties.priceAxisProperties")||(t[i]=e[i]);if(applyPropertiesOverrides(this.properties(),null,!1,t,null),this._model){applyPropertiesOverrides(this._model.model().properties(),null,!1,t),applyPropertiesOverrides(this._model.mainSeries().properties(),null,!1,t,"mainSeriesProperties"),this._model.model().sessions().applyOverrides(t);const e=this._model.chartModel().watermarkSource();null!==e&&e.applyOverrides(t)}}applyStudiesOverrides(e){N.mergeDefaultsOverrides(e),this._applyStudiesOverrides()}setActive(e){this._isActive=e,F().isTouch&&(e&&0!==this.selectPointMode().value()?this.startTrackingMode():this.exitTrackingMode()),this._paneWidgets.forEach((function(e){e.update()})),e||this.model().selectionMacro((function(e){e.clearSelection()}))}isActive(){return this._isActive}showReplayOrderConfirmationDialog(){if(!this.model().isInReplay())return Promise.resolve()}_addPerfMark(e){G("ChartWidget."+this._id+"."+e)}getResizerDetacher(){return this._options}}},3162:(e,t,i)=>{"use strict";var s=i(50151).assert,r=i(75531).layouts,n=i(18687).createUndoHistory,o=i(88348),a=i(4741),l=i(68335),c=i(76422),h=i(14483),d=i(97145).WatchedValue,u=i(59224).getLogger("Chart.ChartWidgetCollection"),p=i(21861).preventDefaultForContextMenu,_=i(88732),m=i(13323).GeneralChartPropertiesRenderer,g=i(42120).CompareDialogRenderer,f=i(84015).isOnMobileAppPage,v=i(57898).Delegate;const{isSupportedLayout:S,tryGuessingTheMostSuitableLayout:y}=i(75531);var b,w=i(71026).AriaChartDescription;const C=i(36174).randomHash;var P=i(55148),x=P.applyIndicatorsToAllChartsImpl,T=P.applyIndicatorToAllChartsImpl,I=P.lineToolsAndGroupsDTOsImpl,M=P.getStateForChartImpl,A=P.resetLineToolsInvalidatedImpl,L=P.applyLineToolUpdateNotificationImpl,k=P.createClipboardHandler,D=P.chartsSymbolsImpl,E=P.updateLayoutImpl,V=P.computeContentBoxImpl,B=(P.getVisuallyAdjacentDefImpl,
P.setLayoutImpl),R=P.removeChartWidgetSubscriptionsImpl,N=P.generateNewChartId,O=P.syncCrosshairImpl,F=P.createBroadcastChannel,W=P.destroyBroadcastChannel,H=P.syncScrollImpl,z=P.allInitialModelsCreated,U=P.allInitialSymbolsResolved,j=P.applyThemeImpl,G=P.isFirstChartInLayout,q=P.deserializedChartIds,$=P.handleDateRangeLockChange,Y=P.handleInternalDateRangeLockChange,K=P.handleTrackTimeLockChange,Z=P.handleInternalTrackTimeLockChange,X=P.handleIntervalLockChange,J=P.handleInternalIntervalLockChange,Q=P.handleSymbolLockChange,ee=P.handleInternalSymbolLockChange,te=(P.handleConnectionLimitReachedChanged,P.createLeftBottomChartWidgetWV),ie=P.subscribeToEventsForDateRangeSync,se=P.unsubscribeFromEventsForDateRangeSync,re=P.syncChartsDateRangesWithActiveChartRange,ne=P.subscribeToCompletedEventForDateRangeUpdate,oe=new Map,ae={saveChartEnabled:!0,takeScreenshotEnabled:!0,publishedChartsEnabled:!0};e.exports=function(e){var t=this,le=Object.assign({},ae,e),ce=new d,he=le.readOnly||!1,de=C(),ue=[],pe=0,_e=new d,me=new d,ge=new d,fe="s",ve=new d(null),Se=new Map,ye=new d([]),be=new d,we=[];const Ce={isConfirmationAboutReplayLocked:!1,loadingChart:!1,setTimeFrameActive:!1,setNewResolution:!1};var Pe=!1,xe=!1,Te=new d(!1),Ie=new d(null),Me=new d(!1),Ae=new d(!1);Ae.subscribe((e=>Q(gt(),e)));var Le=new d(Ae.value());Le.subscribe((e=>ee(gt(),e)));var ke=new d(!1);ke.subscribe((e=>X(gt(),e)));var De=new d(ke.value());De.subscribe((e=>J(gt(),e)));var Ee=new d(fe),Ve=new d(!1);Ve.subscribe((e=>K(gt(),e)));var Be=P.combinedTrackTimeLock(Ee,Ve,ue);Ve.subscribe((e=>K(gt(),e)));var Re=new d(Be.value());Re.subscribe((e=>Z(gt(),e)));var Ne=new d(!1);Ne.subscribe((e=>$(gt(),e))),ve.subscribe(Ht);var Oe=new d(Ne.value());Oe.subscribe((e=>Y(gt(),e)));var Fe=new d(TVSettings.getBool("chart.syncCrosshair",!0)),We=a.createGroup({desc:"Layout"}),He=null,ze=null,Ue=null,je=null;if(window.TVD){var Ge=window.TVD.crosshairSyncEnabled;Ge?(Ge.value()&&(Ue=F(gt)),je=Ge.subscribe((e=>{e?Ue=F(gt):(W(gt()),Ue=null)}))):Ue=F(gt)}var qe=Fe.value();Fe.subscribe((function(e){qe=e=!!e,TVSettings.setValue("chart.syncCrosshair",e);for(var t=0;t{Ze.setValue(null===e?null:e.chartWidget)}));var Xe=le.widgetOptions||{},Je=le.metaInfo||{},Qe={id:new d(Je.id||null),name:new d(Je.name),description:new d(Je.description),username:new d(Je.username),uid:new d(Je.uid),lastModified:new d(Je.lastModified)},et=n();et.onChange().subscribe(null,(function(e){c.emit("undo_redo_state_changed",e)}));var tt=le.resizerBridge.container.value();tt.addEventListener("contextmenu",p);var it,st=new v,rt=new v,nt=new v,ot=new d(!1),at=new d(null),lt=null,ct=null;le.seriesControlBarEnabled&&(it="0px",at.setValue(document.createElement("div")),at.value().style.left=it,at.value().style.right=it,at.value().style.bottom=it,at.value().classList.add("chart-toolbar","chart-controls-bar"),
at.value().setAttribute("data-is-chart-toolbar-component","true"),tt.appendChild(at.value()),Promise.all([i.e(2666),i.e(4015),i.e(3842),i.e(5145),i.e(6),i.e(5649),i.e(8056),i.e(5993),i.e(6639),i.e(6036),i.e(9916),i.e(6106),i.e(5166),i.e(1033),i.e(4987),i.e(962),i.e(2544),i.e(2052),i.e(7260)]).then(i.bind(i,33279)).then((({BottomToolbarRenderer:e})=>{var i=le.resizerBridge,s=[i.container.spawn(),i.width.spawn(),i.height.spawn()],r=i.container.value(),n=function(){var e=r.getBoundingClientRect(),t=V(gt());return t.top=e.top+t.top,t.left=e.left+t.left,t},o=new v,a=function(){o.fire()};s.forEach((function(e){e.subscribe(a)}));var l=function(){s.forEach((function(e){e.destroy()})),o.destroy()};lt=new e(at.value(),o,n,t,ChartApiInstance,Xe,le.seriesControlBar),ct=function(){null!==lt&&(lt.destroy(),lt=null,at.value().remove(),at.setValue(null)),l()}})));var ht=new m(t),dt=new g(t);function ut(){ot.setValue(ue.some((e=>{const t=e.chartWidget.lineToolsSynchronizer();return null!==t&&t.hasChanges().value()})))}function pt(e){return P.checkProFeatureImpl(gt(),e)}Ie.subscribe((()=>bt()));const _t=new Map,mt=()=>P.updateLinkingGroupCharts(gt());function gt(){return{undoHistory:et,chartWidgetsDefs:ue,chartsCountToSave:ft,actualLayoutCount:vt,savedChartWidgetOptions:we,activeChartWidget:ce,options:le,parent:tt,toastsFactory:null,crosshairLockRaw:qe,crossHairSyncBroadcast:Ue,setChartStorageNotificationSubscription:e=>{ze=e},maximizedChartDef:Ke,setMaximized:Tt,layoutTemplate:ge,widthWV:$e,heightWV:Ye,checkProFeature:pt,lineToolsSynchronizerHasChanges:ot,recalcHasChanges:ut,onZoom:rt,onScroll:nt,layoutType:fe,layoutWV:Ee,setLayoutType:e=>{fe=e},isPhoneSize:Te,viewMode:be,updateViewMode:Mt,loadingContent:Pe,setLoadingContent:e=>{Pe=e},initialLoading:xe,inlineChartsCount:me,updateWatchedValue:At,checkAllPendingModelsAlreadyCreated:It,readOnly:he,symbolLock:Ae,internalSymbolLock:Le,intervalLock:ke,internalIntervalLock:De,dateRangeLock:Oe,internalDateRangeLock:Oe,trackTimeLock:Ve,internalTrackTimeLock:Re,crosshairLock:Fe,customLegendWidgetsFactoriesMap:Zt,globalDetachable:_e,saveChartService:He,customSources:Yt,updateActivityView:Lt,chartWidgetCreatedDelegate:st,sizingState:Ie,currentLayoutResizeAction:ve,allLayoutSizesState:Se,splitters:ye,widgetOptions:Xe,bottomToolbar:at,replayContainer:Kt,layoutSizesChanged:Me,subscribeToCompletedEventForDateRangeSync:(e,t)=>ne(gt(),e,t),subscribeToEventsForDateRangeSync:e=>ie(gt(),e),unsubscribeFromEventsForDateRangeSync:e=>se(gt(),e),syncChartsDateRangesWithActiveChartRange:e=>re(gt(),e),combinedTrackTimeLock:Be,chartWidgetIdToCompletedCallbackMap:oe,flags:Ce,linkingGroupsCharts:_t,updateLinkingGroupCharts:mt}}function ft(){return vt()}function vt(){return r[fe].count}function St(e,t,i,s,r){return M(gt(),e,t,i,s,r)}function yt(e){return e.value()?1:0}function bt(){E(gt())}$e.subscribe(bt),Ye.subscribe(bt),this.updateLayout=bt;const wt=P.activeLinkingGroupWV(ce),Ct=P.allLinkingGroupsWV(gt());function Pt(e){return e.rdState.owner.value()!==e}function xt(e){return B(gt(),e,t)}function Tt(e){
Ke.value()!==e&&(Ke.setValue(e),xt(fe))}function It(){ue.every((e=>e.chartWidget.hasModel()))&&(At(),c.emit("layout_changed"))}function Mt(){"s"===fe||Ke.value()?be.setValue(b.ForceFullscreen):be.setValue(b.Multichart)}function At(){var e=Math.min(ge.value().count,ue.length)-1;if(e<0)ce.deleteValue();else{var t=pe;t<0&&(t=0),t>e&&(t=e),ce.setValue(ue[t].chartWidget)}}function Lt(){for(var e=ue.length;e--;){var t=e===pe;ue[e].container.value().classList.toggle("active",t),ue[e].container.value().classList.toggle("inactive",!t)}}function kt(e){{const t=si().indexOf(e);w.getInstance().updateChartDescription(e,t,fe)}}function Dt(e){kt(ce.value())}const Et=new v;var Vt=new v,Bt=new d,Rt=new d([]),Nt=null;function Ot(e){var t=e.mainSeries().properties();t.style.subscribe(null,Ft),Ft(t.style),e.model().onSelectedSourceChanged().subscribe(null,Wt),Ne.value()&&(ie(gt(),e),re(gt())),Wt(e.selection().allSources())}function Ft(e){Bt.setValue(e.value())}function Wt(){var e=Nt.model();Rt.setValue(e.selection().allSources())}function Ht(e){Ne.value()&&null===e&&re(gt())}ce.subscribe((function(e){if(e){for(var t,i=ue.length;i--;)if(ue[i].chartWidget===e){t=i;break}if(!isFinite(t))throw new Error("Cannot make detached ChartWidget active");if(pe!==t){Ke.value()&&(Pt(ue[t])||Ke.setValue(ue[t])),pe=t,Lt();for(i=ue.length;i--;)ue[i].chartWidget!==e&&ue[i].chartWidget.setActive(!1);oi(),e.setActive(!0),o.activePointSelectionMode.setValue(e.selectPointMode().value())}!function(e){if(Nt!==e){if(Nt&&(Nt.modelCreated().unsubscribe(null,Ot),Nt.hasModel())){var t=Nt.model();Ne.value()&&se(gt(),t),t.mainSeries().properties().style.unsubscribe(null,Ft),t.model().onSelectedSourceChanged().unsubscribe(null,Wt),Nt=null}e&&(Nt=e,e.hasModel()?Ot(e.model()):e.modelCreated().subscribe(null,Ot))}}(e)}}),{callWithLast:!0});var zt=new v;function Ut(){le.resizerBridge.requestFullscreen()}function jt(){le.resizerBridge.exitFullscreen()}function Gt(){return le.resizerBridge.fullscreenable}function qt(){return le.resizerBridge.fullscreen}function $t(e){if(0!==ue.length){for(var t=ue.length;t--;)ue[t].chartWidget.setActive(!1);ue[pe].chartWidget.setActive(e)}}he||(We.add({desc:"Switch active chart",hotkey:h.enabled("accessible_keyboard_shortcuts")?l.Modifiers.Shift+39:9,handler:function(){Dt()}}),We.add({desc:"Switch active chart",hotkey:h.enabled("accessible_keyboard_shortcuts")?l.Modifiers.Shift+37:l.Modifiers.Shift+9,handler:function(){Dt()}})),We.add({desc:"Fullscreen mode",hotkey:l.Modifiers.Shift+70,isDisabled:h.enabled("widget")||!Gt().value(),handler:function(){qt().value()?jt():Ut()}}),le.takeScreenshotEnabled&&(We.add({desc:"Screenshot server",hotkey:l.Modifiers.Alt+83,handler:P.takeServerScreenshot.bind(this,le.snapshotUrl,t)}),f("any")||(We.add({desc:"Download client screenshot",hotkey:l.Modifiers.Mod+l.Modifiers.Alt+83,handler:P.downloadScreenshot.bind(this,t)}),We.add({desc:"Copy client screenshot",hotkey:l.Modifiers.Mod+l.Modifiers.Shift+83,handler:P.copyScreenshotToClipboard.bind(this,t)}))),le.saveChartEnabled&&We.add({desc:"Save Chart Layout",
hotkey:l.Modifiers.Mod+83,handler:function(){Vt.fire()}});var Yt=new Map,Kt=null,Zt=new Map;const Xt=k(gt());le.globalEvents&&Xt.listen();const Jt=Ae.spawn(),Qt=ke.spawn(),ei=Ne.spawn(),ti=Ve.spawn(),ii=Fe.spawn(),si=()=>ue.map((e=>e.chartWidget)),ri=te(si,Ee.readonly(),Et,st);function ni(e,t){if(Pe=!0,xe=Boolean(t),we.splice(0),e){if(e.charts||(e={layout:"s",charts:[e]}),e.layoutsSizes)for(const t of Object.keys(e.layoutsSizes))Se.set(t,e.layoutsSizes[t]);var i=new Set;e.charts.forEach((function(e){e.chartId&&i.add(e.chartId)})),e.charts.forEach((function(e){if(!e.chartId){var t=N((function(e){return i.has(e)}));i.add(t),e.chartId=t}}));let t=e.layout;if(!S(t)){const e=y(t);u.logError(`Loading unsupported layout ${t}. Force migration to ${e}`),t=e}fe=pt(t||"s");for(var s=0;sZe.readonly(),leftBottomChartWidget:()=>ri,activeLinkingGroup:()=>wt,allLinkingGroups:()=>Ct,linkingGroupsCharts:e=>P.getLinkingGroupCharts(gt(),e).readonly(),destroy:function(){if(zt.fire(),$t(!1),null!==ct&&(ct(),ct=null),R(gt()),Jt.destroy(),Qt.destroy(),ti.destroy(),ei.destroy(),Be.destroy(),ii.destroy(),ve.unsubscribe(Ht),ue.forEach((function(e){void 0!==e.timingsMeter&&e.timingsMeter.destroy(),e.chartWidget.linkingGroupIndex().unsubscribe(mt),e.chartWidget.destroy()})),le.resizerBridge.remove(),ye.value().forEach((e=>{e.mouseHandler.destroy(),e.mouseListener.destroy()})),window.removeEventListener("resize",bt),o.tool.unsubscribe(oi),o.tool.unsubscribe(ai),tt.remove(),Yt.clear(),Zt.clear(),We.destroy(),ze&&ze.destroy(),Xt&&Xt.destroy(),wt.destroy(),Ct.destroy(),window.TVD){const e=window.TVD.crosshairSyncEnabled;e&&e.unsubscribe(je),W(gt())}ri.destroy(),!0},onAboutToBeDestroyed:zt,layout:Ee.readonly(),setLayout:xt,activeChartWidget:ce,viewMode:be,activeChartStyle:Bt.readonly(),setChartStyleToWidget:P.setChartStyleToWidget.bind(this),selectedSources:Rt.readonly(),metaInfo:Qe,state:function(e,i,s,r){for(var n=[],o=ft(),a=0;a{c.layoutsSizes[t]=e})),c},lineToolsAndGroupsDTOs:function(){return I(gt())},resetLineToolsInvalidated:function(e,t){return A(gt(),e,t)},
applyLineToolUpdateNotification:L.bind(null,ue),readOnly:function(){return he},onZoom:function(){return rt},onScroll:function(){return nt},resizerBridge:function(){return le.resizerBridge},lock:{symbol:Jt,interval:Qt,dateRange:ei,crosshair:ii,trackTime:ti},setSymbol:(e,t)=>P.setSymbol(gt(),e,t),setSymbolAll:(e,t)=>P.setSymbolAll(gt(),e,t),setResolution:(e,t,i)=>P.setResolution(gt(),e,t,i),setTimeFrame:function(e){Ce.loadingChart||Ce.setTimeFrameActive||(Ce.setTimeFrameActive=!0,ke.value()?ue.forEach((function(t){t.chartWidget.loadRange(e)})):ce.value().loadRange(e),Ce.setTimeFrameActive=!1)},updateLayout:bt,setChartLayoutWithUndo:function(e){return P.setChartLayoutWithUndoImpl(gt(),this,e)},images:P.getSnapshot.bind(this,this,le.widgetOptions.customerReadableName,Xe.onWidget),clientSnapshot:P.getClientSnapshot.bind(this,this,le.widgetOptions.customerReadableName,Xe.onWidget),tags:function(){for(var e=[],t=0;tO(gt(),e,t,i,s),syncScroll:function(e,t){return H(gt(),e,t)},clearChartMetaInfo:function(){Qe.id.setValue(null),Qe.uid.setValue(void 0),Qe.name.setValue(void 0)},takeScreenshot:P.takeScreenshot.bind(this,le.snapshotUrl,this),takeServerScreenshot:P.takeServerScreenshot.bind(this,le.snapshotUrl,this),loadContent:ni,purgeUnusedWidgets:function(){for(var e=r[fe].count;e1},applyIndicatorToAllCharts:async function(e,t,i,s){await T(gt(),e,t,i,s)},setActive:$t,inlineChartsCount:me.readonly(),revertToInline:function(){Tt(null);for(var e=0;ebt())),bt()},destroyReplayWidget:function(){s(null!==Kt,"Cannot remove replay container, container is not created"),Kt.remove(),Kt=null,bt()},setViewMode:function(e){be.setValue(e)},moveActiveChartWithUndo:function(e){},activeChartCanBeMoved:function(){return!1},generalPropertiesDefinitions:function(){return ce.value().generalPropertiesDefinitions()},reconnectChartApi:function(e){undefined(e)},setBroker:function(e){0},setSaveChartService:function(e){He=e;for(var t=0;tMe,clientId:de,ariaDescribeChart:kt}),ni(le.content,!0),Ee.subscribe((function(){Lt()})),Ee.hook=function(e){return e===this.value()?e:pt(e)},he&&(Ee.writeLock=!0),window.addEventListener("resize",bt);var li=0;function ci(){0===--li&&c.emitOnce("onChartReady")}ue.forEach((function(e){if(e){li++;var t=e.chartWidget;t.withModel(null,(function(){le.metaInfo&&t.model().model().setChartSaveTime(1e3*le.metaInfo.lastModified);var e=t.model().mainSeries();if(e.bars().size()>0||e.isFailed())ci();else{var i=e.dataEvents(),s=function(){ci(),i.barReceived().unsubscribe(null,s),i.completed().unsubscribe(null,s),i.error().unsubscribe(null,s)};i.barReceived().subscribe(null,s),i.completed().subscribe(null,s),i.error().subscribe(null,s)}}))}})),z(gt()).then(U).then((function(){window.saver&&window.is_authenticated&&le.widgetOptions.justCloned&&window.saver.saveChartSilently()})).catch(u.logError.bind(u))}},10643:(e,t,i)=>{"use strict";i.d(t,{ContextMenuManager:()=>s});var s,r=i(78071),n=i(39347),o=i(59064);!function(e){let t=null,s=null;const a=[],l={createAction:e=>new n.Action({actionId:"Chart.CustomActionId",options:e}),createAsyncAction:e=>new n.Action({actionId:"Chart.CustomActionId",options:{},optionsLoader:e}),createSeparator:()=>new n.Separator};async function c(e,n={},o={menuName:""},c){null!==t&&(e=await t(e,l,o));let d=null;const u=()=>{const e=(0,r.indexOf)(a,(e=>e.renderer===d));-1!==e&&a.splice(e,1),void 0!==c&&c()};let p=!1;if(null!==s&&(d=await s(e,o,u)),d)p=!0,h();else{
const t=await Promise.all([i.e(3842),i.e(5649),i.e(3502),i.e(6752),i.e(8149),i.e(6639),i.e(9916),i.e(6985),i.e(962),i.e(2544),i.e(5128),i.e(1584)]).then(i.bind(i,20323));d=new t.ContextMenuRenderer(e,n,u,h)}return a.push({renderer:d,isExternal:p}),d}function h(){(0,o.globalCloseMenu)(),a.forEach((e=>{e.isExternal&&e.renderer.isShown()&&e.renderer.hide()}))}e.createMenu=c,e.showMenu=function(e,t,i={},s,r){return c(e,i,s,r).then((e=>e.show(t)))},e.setCustomRendererFactory=function(e){s=e},e.setCustomItemsProcessor=function(e){t=e},e.hideAll=h,e.getShown=function(){for(let e=0;e{"use strict";i.d(t,{createSymbolSearchAction:()=>a});var s=i(11542),r=i(39347),n=i(53180),o=i(82723);i(14483);function a(){return new r.Action({actionId:"Chart.Dialogs.ShowChangeSymbol",options:{label:(0,n.appendEllipsis)(s.t(null,void 0,i(28089))),statName:"ChangeSymbol",onExecute:()=>{(0,o.showDialog)({defaultValue:"",trackResultsOptions:{trackResults:!1,emptySearchType:"empty_result__supercharts"}})}}})}},85067:(e,t,i)=>{"use strict";i.d(t,{DialogRenderer:()=>r});var s=i(97145);class r{constructor(){this._container=document.createElement("div"),this._visibility=new s.WatchedValue(!1)}visible(){return this._visibility.readonly()}_setVisibility(e){this._visibility.setValue(e)}}},14787:(e,t,i)=>{"use strict";var s;i.d(t,{TabNames:()=>s}),function(e){e.background="Background",e.coordinates="Coordinates",e.drawings="Drawings",e.events="Events",e.eventsAndAlerts="Events & Alerts",e.inputs="Inputs",e.properties="Properties",e.scales="Scales",e.legend="Legend",e.sourceCode="Source Code",e.style="Style",e.symbol="Symbol",e.timezoneSessions="Timezone/Sessions",e.trading="Trading",e.visibility="Visibility",e.text="Text"}(s||(s={}))},241:(e,t,i)=>{"use strict";i.d(t,{createFavoriteDrawingToolbar:()=>a,getFavoriteDrawingToolbarPromise:()=>o});var s=i(69774);let r=null,n=null;function o(){return n}function a(){null===n&&(n=Promise.all([i.e(9417),i.e(2666),i.e(4015),i.e(3842),i.e(6),i.e(5649),i.e(8056),i.e(5993),i.e(2191),i.e(3502),i.e(6752),i.e(8149),i.e(6639),i.e(9327),i.e(9916),i.e(6106),i.e(6985),i.e(1109),i.e(4788),i.e(962),i.e(2544),i.e(1890),i.e(2052),i.e(5128),i.e(2306)]).then(i.bind(i,9629)).then((({FavoriteDrawingToolbar:e})=>(r=null!==r?r:new e({left:window.innerWidth/2,top:s.HEADER_TOOLBAR_HEIGHT_EXPANDED+61}),r))))}},31964:(e,t,i)=>{"use strict";function s(e){var t,i;return Math.max(1,(null===(i=null===(t=e.ownerDocument)||void 0===t?void 0:t.defaultView)||void 0===i?void 0:i.devicePixelRatio)||1)}i.d(t,{getCanvasDevicePixelRatio:()=>s})},10688:(e,t,i)=>{"use strict";i.d(t,{getPriceAxisNameInfo:()=>o});const s=["Z","Y","X","W","V","U","T","S"],r=["A","B","C","D","E","F","G","H"];class n{constructor(e){this.label=e}equals(e){return null!==e&&this.label===e.label}}function o(e,t){const i="left"===e?s:r;return new n(t{"use strict";i.d(t,{CHART_WIDGET_COLLECTION_SERVICE:()=>s});i(16216);const s={
id:"ChartWidgetCollectionService"};var r;!function(e){e.Multichart="multichart",e.ForceFullscreen="force-fullscreen"}(r||(r={}))},91280:(e,t,i)=>{"use strict";i.d(t,{InvalidationLevel:()=>s,InvalidationMask:()=>a,defaultInvalidationLevel:()=>o});var s,r=i(50151);class n{constructor(e=o){this._paneInvalidationLevel=o,this._leftPriceScalesInvalidationMap=new Map,this._rightPriceScalesInvalidationMap=new Map,this._legendWidgetInvalidated=!1,this._invalidationLevel=e}fullInvalidation(){return this._invalidationLevel}invalidateAll(e){this._invalidationLevel=Math.max(this._invalidationLevel,e)}invalidatePane(e){this._paneInvalidationLevel=Math.max(this._invalidationLevel,e)}invalidateLegendWidgetLayout(){this._legendWidgetInvalidated=!0}invalidatePriceScale(e,t,i){const s="left"===e?this._leftPriceScalesInvalidationMap:this._rightPriceScalesInvalidationMap,r=s.get(t)||o;s.set(t,Math.max(r,i))}invalidationLevelForPane(){return Math.max(this._paneInvalidationLevel,this._invalidationLevel)}legendWidgetLayoutInvalidated(){return this._legendWidgetInvalidated||this._invalidationLevel===s.Full}getterForPriceScaleInvalidationLevelBySide(e){const t="left"===e?this._leftPriceScalesInvalidationMap:this._rightPriceScalesInvalidationMap;return e=>Math.max(t.get(e)||o,this._invalidationLevel)}priceScaleSideMaxLevel(e){const t="left"===e?this._leftPriceScalesInvalidationMap:this._rightPriceScalesInvalidationMap;let i=this._invalidationLevel;return t.size>0&&t.forEach((e=>{e>i&&(i=e)})),i}merge(e){this._invalidationLevel=Math.max(this._invalidationLevel,e._invalidationLevel),this._paneInvalidationLevel=Math.max(this._paneInvalidationLevel,e._paneInvalidationLevel),e._leftPriceScalesInvalidationMap.forEach(((e,t)=>{const i=this._leftPriceScalesInvalidationMap.get(t)||o;this._leftPriceScalesInvalidationMap.set(t,Math.max(i,e))})),e._rightPriceScalesInvalidationMap.forEach(((e,t)=>{const i=this._rightPriceScalesInvalidationMap.get(t)||o;this._rightPriceScalesInvalidationMap.set(t,Math.max(i,e))})),this._legendWidgetInvalidated=this._legendWidgetInvalidated||e._legendWidgetInvalidated}}!function(e){e[e.None=0]="None",e[e.Cursor=1]="Cursor",e[e.Light=2]="Light",e[e.Full=3]="Full"}(s||(s={}));const o=s.None;class a{constructor(e=o){this._panesOrderChanged=!1,this._keepVisibleTimeRangeOnResize=!1,this._timeAxisInvalidationLevel=o,this._invalidatedPanes=new Map,this._additionalActions=[],this._timeScaleInvalidations=[],this._invalidationLevel=e}invalidateAll(e){this._invalidationLevel!==e&&(this._invalidationLevel=Math.max(this._invalidationLevel,e),this._invalidatedPanes.forEach((e=>{e.invalidateAll(this._invalidationLevel)})))}invalidateAllPane(e,t){this._invalidatedPanes.has(e)||this._invalidatedPanes.set(e,new n(this._invalidationLevel)),(0,r.ensureDefined)(this._invalidatedPanes.get(e)).invalidateAll(t)}invalidatePriceScale(e,t,i,s){this._invalidatedPanes.has(e)||this._invalidatedPanes.set(e,new n(this._invalidationLevel)),(0,r.ensureDefined)(this._invalidatedPanes.get(e)).invalidatePriceScale(t,i,s)}invalidateTimeScale(e){
this._timeAxisInvalidationLevel=Math.max(this._timeAxisInvalidationLevel,e)}invalidatePanesOrder(){this._panesOrderChanged=!0}lockVisibleTimeRangeOnResize(){this._keepVisibleTimeRangeOnResize=!0}fullInvalidation(){return this._invalidationLevel}maxPaneInvalidation(){const e=[];return this._invalidatedPanes.forEach((t=>{e.push(t.fullInvalidation())})),Math.max(...e,this._invalidationLevel)}invalidateForPane(e){return this._invalidatedPanes.get(e)||new n(this._invalidationLevel)}invalidateForTimeScale(){return Math.max(this._timeAxisInvalidationLevel,this._invalidationLevel)}validationActions(){return this._additionalActions}addValidationAction(e){this._additionalActions.push(e)}merge(e){this._invalidationLevel=Math.max(this._invalidationLevel,e._invalidationLevel),this._panesOrderChanged=this._panesOrderChanged||e._panesOrderChanged,this._keepVisibleTimeRangeOnResize=this._keepVisibleTimeRangeOnResize||e._keepVisibleTimeRangeOnResize,this._invalidatedPanes.forEach((e=>{e.invalidateAll(this._invalidationLevel)})),e._invalidatedPanes.forEach(((e,t)=>{this._invalidatedPanes.has(t)||this._invalidatedPanes.set(t,new n(this._invalidationLevel)),(0,r.ensureDefined)(this._invalidatedPanes.get(t)).merge(e)})),this._timeAxisInvalidationLevel=Math.max(this._timeAxisInvalidationLevel,e._timeAxisInvalidationLevel);for(let t=0;t0===e.type));if(-1!==i){const[s]=this._timeScaleInvalidations.splice(i,1);null===(t=(e=s.value).onFinish)||void 0===t||t.call(e,!1)}}}},38325:(e,t,i)=>{"use strict";i.d(t,{lastMouseOrTouchEventInfo:()=>r,setLastMouseOrTouchEventInfo:()=>n});let s=(0,i(49483).supportTouch)()?{isTouch:!0,stylus:!1}:{isTouch:!1};function r(){return s}function n(e){s=e.isTouch?{isTouch:!0,stylus:e.stylus}:{isTouch:!1}}},26097:(e,t,i)=>{"use strict";i.d(t,{layoutInitialSizingState:()=>n});var s=i(3308);i(50151)
;function r(e){return e.map((t=>{if((0,s.default)(t))return{percent:1/e.length};{const i=t.slice(1);return{percent:1/e.length,substate:r(i)}}}))}function n(e){return r(e.slice(1))}},75531:(e,t,i)=>{"use strict";i.r(t),i.d(t,{isMultipleLayout:()=>o,isSingleLayout:()=>n,isSupportedLayout:()=>a,layouts:()=>r,tryGuessingTheMostSuitableLayout:()=>l});i(34976),i(26097);let s;s={};const r={...{s:{title:"1 chart",count:1,layoutType:"s",sizer:(e,t)=>{if(0!==t)throw new RangeError("invalid index");return e},splitters:()=>[],resizeApplier:(e,t,i,s,r)=>r,syncSublayoutsBySplitter:(e,t)=>t,expression:["h",0]}},...s};function n(e){return"s"===e}function o(e){return!n(e)}function a(e){return n(e)||s.hasOwnProperty(e)}function l(e){return"s"}},72414:(e,t,i)=>{"use strict";i.d(t,{LineToolsGroupControllerApi:()=>o});var s=i(98517),r=i(50151),n=i(92249);class o{constructor(e,t){this._controller=e,this._model=t}createGroupFromSelection(){return this._controller.createGroupFromSelection().id}removeGroup(e){const t=(0,r.ensureDefined)(this._groupById(e));this._controller.removeGroup(t)}groups(){return this._controller.groups().map((e=>e.id))}shapesInGroup(e){const t=(0,r.ensureDefined)(this._groupById(e));return(0,s.sortSources)(t.lineTools()).map((e=>e.id()))}excludeShapeFromGroup(e,t){const i=(0,r.ensureDefined)(this._groupById(e)),s=(0,r.ensureNotNull)(this._model.dataSourceForId(t));(0,r.assert)((0,n.isLineTool)(s),"Passed shapeId is not a line tool"),this._controller.excludeLineToolFromGroup(i,s)}addShapeToGroup(e,t){const i=(0,r.ensureDefined)(this._groupById(e)),s=(0,r.ensureNotNull)(this._model.dataSourceForId(t));(0,r.assert)((0,n.isLineTool)(s),"Passed shapeId is not a line tool"),this._controller.addLineToolToGroup(i,s)}availableZOrderOperations(e){const t=(0,r.ensureDefined)(this._groupById(e));return this._controller.availableZOrderOperations(t)}bringToFront(e){const t=(0,r.ensureDefined)(this._groupById(e));this._controller.bringToFront(t)}bringForward(e){const t=(0,r.ensureDefined)(this._groupById(e));this._controller.bringForward(t)}sendBackward(e){const t=(0,r.ensureDefined)(this._groupById(e));this._controller.sendBackward(t)}sendToBack(e){const t=(0,r.ensureDefined)(this._groupById(e));this._controller.sendToBack(t)}insertAfter(e,t){const i=(0,r.ensureDefined)(this._groupById(e)),s=(0,r.ensureNotNull)(this._groupById(t)||this._model.dataSourceForId(t));this._controller.insertAfter(i,s)}insertBefore(e,t){const i=(0,r.ensureDefined)(this._groupById(e)),s=(0,r.ensureNotNull)(this._groupById(t)||this._model.dataSourceForId(t));this._controller.insertBefore(i,s)}groupVisibility(e){return(0,r.ensureDefined)(this._groupById(e)).visibility()}setGroupVisibility(e,t){const i=(0,r.ensureDefined)(this._groupById(e));this._controller.setGroupVisibility(i,t)}groupLock(e){return(0,r.ensureDefined)(this._groupById(e)).locked()}setGroupLock(e,t){const i=(0,r.ensureDefined)(this._groupById(e));this._controller.setGroupLock(i,t)}getGroupName(e){return(0,r.ensureDefined)(this._groupById(e)).name().value()}setGroupName(e,t){const i=(0,
r.ensureDefined)(this._groupById(e));this._controller.setGroupName(i,t)}canBeGroupped(e){const t=e.map((e=>(0,r.ensureNotNull)(this._model.dataSourceForId(e))));return!t.some((e=>!(0,n.isLineTool)(e)))&&this._controller.canBeGroupped(t)}_groupById(e){return this._controller.groups().find((t=>t.id===e))}}},86972:(e,t,i)=>{"use strict";i.d(t,{lineToolsSelectHotkeys:()=>r});i(42053);var s=i(68335);const r={LineToolFibRetracement:{hash:s.Modifiers.Alt+70,action:"setTool",description:"Draw Fib Retracement"},LineToolHorzLine:{hash:s.Modifiers.Alt+72,action:"drawRightThere",description:"Draw Horizontal Line here"},LineToolHorzRay:{hash:s.Modifiers.Alt+74,action:"drawRightThere",description:"Draw Horizontal Ray here"},LineToolRectangle:{hash:s.Modifiers.Alt+s.Modifiers.Shift+82,action:"setTool",description:"Draw Rectangle"},LineToolTrendLine:{hash:s.Modifiers.Alt+84,action:"setTool",description:"Draw Trend Line"},LineToolVertLine:{hash:s.Modifiers.Alt+86,action:"drawRightThere",description:"Draw Vertical Line here"},LineToolCrossLine:{hash:s.Modifiers.Alt+67,action:"drawRightThere",description:"Draw Cross Line here"}}},42184:(e,t,i)=>{"use strict";i.d(t,{MouseEventHandler:()=>u,defaultPreventedHandler:()=>h});var s=i(49483),r=i(50151),n=i(1722),o=i(80007),a=i(38325);const l=s.isSafari?"click":"auxclick",c={treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!1,ignoreClickAndTapOnDblClickOrDblTap:!1};function h(e){return t=>{t.preventDefault(),e(t)}}function d(e){let t=!1;return{clickOrTap:i=>{t=!1,setTimeout((()=>!t&&e.clickOrTap(i)),501)},doubleClickOrDoubleTap:i=>{var s;t=!0,null===(s=e.doubleClickOrDoubleTap)||void 0===s||s.call(e,i)}}}class u{constructor(e,t,i){if(this._clickCount=0,this._clickTimeoutId=null,this._clickPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._tapCount=0,this._tapTimeoutId=null,this._tapPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY},this._longTapTimeoutId=null,this._longTapActive=!1,this._mouseMoveStartPosition=null,this._touchMoveStartPosition=null,this._touchMoveExceededManhattanDistance=!1,this._cancelClick=!1,this._cancelTap=!1,this._unsubscribeOutsideMouseEvents=null,this._unsubscribeOutsideTouchEvents=null,this._unsubscribeMobileSafariEvents=null,this._unsubscribeMousemove=null,this._unsubscribeRootMouseEvents=null,this._unsubscribeRootTouchEvents=null,this._pinchInfo=null,this._pinchPrevented=!1,this._preventTouchDragProcess=!1,this._mousePressed=!1,this._lastTouchEventTimeStamp=0,this._activeTouchId=null,this._acceptMouseLeave=!s.CheckMobile.iOS(),this._onFirefoxOutsideMouseUp=e=>{this._mouseUpHandler(e)},this._onMobileSafariDoubleClick=e=>{if(this._firesTouchEvents(e)){const t=this._makeCompatEvent(e);if(++this._tapCount,this._tapTimeoutId&&this._tapCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(_(e),this._tapPosition);i<30&&!this._cancelTap&&this._processTouchEvent(t,this._handlers.doubleTapEvent),this._resetTapTimeout()}}else{const t=this._makeCompatEvent(e);if(++this._clickCount,
this._clickTimeoutId&&this._clickCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(_(e),this._clickPosition);i<5&&!this._cancelClick&&this._processMouseEvent(t,this._handlers.mouseDoubleClickEvent),this._resetClickTimeout()}}},this._target=e,this._options=(0,n.merge)((0,n.clone)(c),i||{}),this._options.ignoreClickAndTapOnDblClickOrDblTap){const{mouseClickEvent:e,mouseDoubleClickEvent:i,tapEvent:s,doubleTapEvent:r}=t;if(e){const s=d({clickOrTap:e,doubleClickOrDoubleTap:i});t.mouseClickEvent=s.clickOrTap,t.mouseDoubleClickEvent=s.doubleClickOrDoubleTap}if(s){const e=d({clickOrTap:s,doubleClickOrDoubleTap:r});t.tapEvent=e.clickOrTap,t.doubleTapEvent=e.doubleClickOrDoubleTap}}this._handlers=t,this._init()}destroy(){null!==this._unsubscribeOutsideMouseEvents&&(this._unsubscribeOutsideMouseEvents(),this._unsubscribeOutsideMouseEvents=null),null!==this._unsubscribeOutsideTouchEvents&&(this._unsubscribeOutsideTouchEvents(),this._unsubscribeOutsideTouchEvents=null),null!==this._unsubscribeMousemove&&(this._unsubscribeMousemove(),this._unsubscribeMousemove=null),null!==this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),null!==this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null),null!==this._unsubscribeMobileSafariEvents&&(this._unsubscribeMobileSafariEvents(),this._unsubscribeMobileSafariEvents=null),this._clearLongTapTimeout(),this._resetClickTimeout()}_mouseEnterHandler(e){this._unsubscribeMousemove&&this._unsubscribeMousemove();const t=this._mouseMoveHandler.bind(this);if(this._unsubscribeMousemove=()=>{this._target.removeEventListener("mousemove",t)},this._target.addEventListener("mousemove",t),this._firesTouchEvents(e))return;const i=this._makeCompatEvent(e);this._processMouseEvent(i,this._handlers.mouseEnterEvent),this._acceptMouseLeave=!0}_resetClickTimeout(){null!==this._clickTimeoutId&&clearTimeout(this._clickTimeoutId),this._clickCount=0,this._clickTimeoutId=null,this._clickPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}}_resetTapTimeout(){null!==this._tapTimeoutId&&clearTimeout(this._tapTimeoutId),this._tapCount=0,this._tapTimeoutId=null,this._tapPosition={x:Number.NEGATIVE_INFINITY,y:Number.POSITIVE_INFINITY}}_mouseMoveHandler(e){if(this._mousePressed||null!==this._touchMoveStartPosition)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.mouseMoveEvent),this._acceptMouseLeave=!0}_touchMoveHandler(e){const t=f(e.changedTouches,(0,r.ensureNotNull)(this._activeTouchId));if(null===t)return;if(this._lastTouchEventTimeStamp=g(e),null!==this._pinchInfo)return;if(this._preventTouchDragProcess)return;this._pinchPrevented=!0;const i=this._touchMouseMoveWithDownInfo(_(t),(0,r.ensureNotNull)(this._touchMoveStartPosition)),{xOffset:s,yOffset:n,manhattanDistance:a}=i;if(this._touchMoveExceededManhattanDistance||!(a<5)){if(!this._touchMoveExceededManhattanDistance){
const e=.5*s,t=n>=e&&!this._options.treatVertTouchDragAsPageScroll,i=e>n&&!this._options.treatHorzTouchDragAsPageScroll;t||i||(this._preventTouchDragProcess=!0),this._touchMoveExceededManhattanDistance=!0,this._cancelTap=!0,this._clearLongTapTimeout(),this._resetTapTimeout()}if(!this._preventTouchDragProcess){const i=this._makeCompatEvent(e,t);this._processTouchEvent(i,this._handlers.touchMoveEvent),(0,o.preventDefault)(e)}}}_mouseMoveWithDownHandler(e){if(0!==e.button)return;const t=this._touchMouseMoveWithDownInfo(_(e),(0,r.ensureNotNull)(this._mouseMoveStartPosition)),{manhattanDistance:i}=t;if(i>=5&&(this._cancelClick=!0,this._resetClickTimeout()),this._cancelClick){const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.pressedMouseMoveEvent)}}_touchMouseMoveWithDownInfo(e,t){const i=Math.abs(t.x-e.x),s=Math.abs(t.y-e.y);return{xOffset:i,yOffset:s,manhattanDistance:i+s}}_touchEndHandler(e){let t=f(e.changedTouches,(0,r.ensureNotNull)(this._activeTouchId));if(null===t&&0===e.touches.length&&(t=e.changedTouches[0]),null===t)return;this._activeTouchId=null,this._lastTouchEventTimeStamp=g(e),this._clearLongTapTimeout(),this._touchMoveStartPosition=null,this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);const i=this._makeCompatEvent(e,t);if(this._processTouchEvent(i,this._handlers.touchEndEvent),++this._tapCount,this._tapTimeoutId&&this._tapCount>1){const{manhattanDistance:e}=this._touchMouseMoveWithDownInfo(_(t),this._tapPosition);e<30&&!this._cancelTap&&this._processTouchEvent(i,this._handlers.doubleTapEvent),this._resetTapTimeout()}else this._cancelTap||(this._processTouchEvent(i,this._handlers.tapEvent),this._handlers.tapEvent&&(0,o.preventDefault)(e));0===this._tapCount&&(0,o.preventDefault)(e),0===e.touches.length&&this._longTapActive&&(this._longTapActive=!1,(0,o.preventDefault)(e))}_touchCancelHandler(e){this._touchEndHandler(e)}_mouseUpHandler(e){if(0!==e.button)return;const t=this._makeCompatEvent(e);if(this._mouseMoveStartPosition=null,this._mousePressed=!1,this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null),s.isFF){this._target.ownerDocument.documentElement.removeEventListener("mouseleave",this._onFirefoxOutsideMouseUp)}if(!this._firesTouchEvents(e))if(this._processMouseEvent(t,this._handlers.mouseUpEvent),++this._clickCount,this._clickTimeoutId&&this._clickCount>1){const{manhattanDistance:i}=this._touchMouseMoveWithDownInfo(_(e),this._clickPosition);i<5&&!this._cancelClick&&this._processMouseEvent(t,this._handlers.mouseDoubleClickEvent),this._resetClickTimeout()}else this._cancelClick||this._processMouseEvent(t,this._handlers.mouseClickEvent)}_clearLongTapTimeout(){null!==this._longTapTimeoutId&&(clearTimeout(this._longTapTimeoutId),this._longTapTimeoutId=null)}_touchStartHandler(e){if(null!==this._activeTouchId)return this._clearLongTapTimeout(),void this._resetTapTimeout();const t=e.changedTouches[0];this._activeTouchId=t.identifier,this._lastTouchEventTimeStamp=g(e)
;const i=this._target.ownerDocument.documentElement;this._cancelTap=!1,this._touchMoveExceededManhattanDistance=!1,this._preventTouchDragProcess=!1,this._touchMoveStartPosition=_(t),this._unsubscribeRootTouchEvents&&(this._unsubscribeRootTouchEvents(),this._unsubscribeRootTouchEvents=null);{const t=this._touchMoveHandler.bind(this),s=this._touchEndHandler.bind(this);this._unsubscribeRootTouchEvents=()=>{i.removeEventListener("touchmove",t),i.removeEventListener("touchend",s)},i.addEventListener("touchmove",t,{passive:!1}),i.addEventListener("touchend",s,{passive:!1}),this._clearLongTapTimeout(),this._longTapTimeoutId=setTimeout(this._longTapHandler.bind(this,e),240)}const s=this._makeCompatEvent(e,t);this._processTouchEvent(s,this._handlers.touchStartEvent),this._tapTimeoutId||(this._tapCount=0,this._tapTimeoutId=setTimeout(this._resetTapTimeout.bind(this),500),this._tapPosition=_(t))}_wheelClickHandler(e){if(1!==e.button)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.wheelClickEvent)}_mouseDownHandler(e){if(0!==e.button)return;const t=this._target.ownerDocument.documentElement;s.isFF&&t.addEventListener("mouseleave",this._onFirefoxOutsideMouseUp),this._cancelClick=!1,this._mouseMoveStartPosition=_(e),this._unsubscribeRootMouseEvents&&(this._unsubscribeRootMouseEvents(),this._unsubscribeRootMouseEvents=null);{const e=this._mouseMoveWithDownHandler.bind(this),i=this._mouseUpHandler.bind(this);this._unsubscribeRootMouseEvents=()=>{t.removeEventListener("mousemove",e),t.removeEventListener("mouseup",i)},t.addEventListener("mousemove",e),t.addEventListener("mouseup",i)}if(this._mousePressed=!0,this._firesTouchEvents(e))return;const i=this._makeCompatEvent(e);this._processMouseEvent(i,this._handlers.mouseDownEvent),this._clickTimeoutId||(this._clickCount=0,this._clickTimeoutId=setTimeout(this._resetClickTimeout.bind(this),500),this._clickPosition=_(e))}_init(){this._target.addEventListener("mouseenter",this._mouseEnterHandler.bind(this)),this._target.addEventListener("touchcancel",this._touchCancelHandler.bind(this));{const e=this._target.ownerDocument,t=e=>!e.target||!this._target.contains(e.target),i=e=>{if(!t(e))return;const i=e.changedTouches[0];this._lastTouchEventTimeStamp=g(e),this._processTouchEvent(this._makeCompatEvent(e,i),this._handlers.touchStartOutsideEvent)},s=e=>{t(e)&&!this._firesTouchEvents(e)&&this._processMouseEvent(this._makeCompatEvent(e),this._handlers.mouseDownOutsideEvent)};this._unsubscribeOutsideTouchEvents=()=>{e.removeEventListener("touchstart",i)},this._unsubscribeOutsideMouseEvents=()=>{e.removeEventListener("mousedown",s)},e.addEventListener("mousedown",s),e.addEventListener("touchstart",i,{passive:!0})}s.CheckMobile.iOS()&&(this._unsubscribeMobileSafariEvents=()=>{this._target.removeEventListener("dblclick",this._onMobileSafariDoubleClick)},this._target.addEventListener("dblclick",this._onMobileSafariDoubleClick)),this._target.addEventListener("mouseleave",this._mouseLeaveHandler.bind(this)),
this._target.addEventListener("contextmenu",this._contextMenuHandler.bind(this)),this._target.addEventListener("touchstart",this._touchStartHandler.bind(this),{passive:!0}),(0,o.preventScrollByWheelClick)(this._target),this._target.addEventListener("mousedown",this._mouseDownHandler.bind(this)),this._target.addEventListener(l,this._wheelClickHandler.bind(this)),this._initPinch(),this._target.addEventListener("touchmove",(()=>{}),{passive:!1})}_initPinch(){void 0===this._handlers.pinchStartEvent&&void 0===this._handlers.pinchEvent&&void 0===this._handlers.pinchEndEvent||(this._target.addEventListener("touchstart",(e=>this._checkPinchState(e.touches)),{passive:!0}),this._target.addEventListener("touchmove",(e=>{if(null===this._pinchInfo)return;const t=f(e.touches,(0,r.ensureNotNull)(this._activeTouchId)),i=f(e.touches,this._pinchInfo.secondTouchId);if(t&&i&&void 0!==this._handlers.pinchEvent){const{startPinchDistance:s,startPinchMiddlePoint:r}=this._pinchInfo,n=m(t,i)/s,a=p(this._target);this._handlers.pinchEvent(r,{x:t.clientX-a.left,y:t.clientY-a.top},{x:i.clientX-a.left,y:i.clientY-a.top},n),(0,o.preventDefault)(e)}}),{passive:!1}),this._target.addEventListener("touchend",(e=>{this._checkPinchState(e.touches)})))}_checkPinchState(e){1===e.length&&(this._pinchPrevented=!1),2!==e.length||this._pinchPrevented||this._longTapActive?this._stopPinch():this._startPinch(e)}_startPinch(e){if(void 0!==this._handlers.pinchStartEvent&&null===this._pinchInfo){const t=p(this._target);let i,s;e[0].identifier===this._activeTouchId?(i=e[0],s=e[1]):(i=e[1],s=e[0]);const r={x:i.clientX-t.left,y:i.clientY-t.top},n={x:s.clientX-t.left,y:s.clientY-t.top},o={x:(r.x+n.x)/2,y:(r.y+n.y)/2};this._handlers.pinchStartEvent(o,r,n,{bothPointsOnTargetElement:this._target.contains(s.target)})&&(this._pinchInfo={startPinchDistance:m(i,s),startPinchMiddlePoint:o,secondTouchId:s.identifier})}this._clearLongTapTimeout()}_stopPinch(){var e,t;null!==this._pinchInfo&&(this._pinchInfo=null,null===(t=(e=this._handlers).pinchEndEvent)||void 0===t||t.call(e))}_mouseLeaveHandler(e){if(this._unsubscribeMousemove&&this._unsubscribeMousemove(),this._firesTouchEvents(e))return;if(!this._acceptMouseLeave)return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.mouseLeaveEvent),this._acceptMouseLeave=!s.CheckMobile.iOS()}_longTapHandler(e){const t=f(e.touches,(0,r.ensureNotNull)(this._activeTouchId));if(null===t)return;const i=this._makeCompatEvent(e,t);this._processTouchEvent(i,this._handlers.longTapEvent),this._processTouchEvent(i,this._handlers.touchContextMenuEvent),this._cancelTap=!0,this._longTapActive=!0}_contextMenuHandler(e){if((0,o.preventDefault)(e),null!==this._touchMoveStartPosition)return;if(this._firesTouchEvents(e))return;const t=this._makeCompatEvent(e);this._processMouseEvent(t,this._handlers.contextMenuEvent),this._cancelClick=!0}_firesTouchEvents(e){return e.sourceCapabilities&&void 0!==e.sourceCapabilities.firesTouchEvents?e.sourceCapabilities.firesTouchEvents:g(e){"touchstart"!==e.type&&(0,o.preventDefault)(e)}}}}function p(e){return e.getBoundingClientRect()||{left:0,top:0}}function _(e){return{x:e.pageX,y:e.pageY}}function m(e,t){const i=e.clientX-t.clientX,s=e.clientY-t.clientY;return Math.sqrt(i*i+s*s)}function g(e){return e.timeStamp||performance.now()}function f(e,t){for(let i=0;i{"use strict";i.d(t,{actualBehavior:()=>a,availableValues:()=>o,navigationButtonsVisibilityKey:()=>r,property:()=>n,restoreNavigationButtonsVisibilitySettingsValue:()=>l});var s=i(29542);const r="NavigationButtons.visibility",{property:n,availableValues:o,actualBehavior:a,restoreDefaultValue:l}=(0,s.createVisibilityController)(r)},3228:(e,t,i)=>{"use strict";i.d(t,{actualBehavior:()=>a,availableValues:()=>o,property:()=>n,restorePaneButtonsVisibilitySettingsValue:()=>l});var s=i(29542),r=i(78159);const{property:n,availableValues:o,actualBehavior:a,restoreDefaultValue:l}=(0,s.createVisibilityController)("PaneButtons.visibility",r.navigationButtonsVisibilityKey)},77212:(e,t,i)=>{"use strict";i.d(t,{ActionBinder:()=>s});class s{constructor(e,t,i,s,r=null){this._property=t,this._undoModel=i,this._undoText=s,this._action=e,this.setValue(t.value()),t.subscribe(this,this._propertyChanged),null!==r?e.update({onExecute:r.bind(this)}):e.update({onExecute:this._onActionCallback.bind(this)})}destroy(){this._property.unsubscribe(this,this._propertyChanged)}value(){return this._action.isChecked()}setValue(e){this._action.update({checked:Boolean(e)})}_onActionCallback(){this._undoModel.setProperty(this._property,this.value(),this._undoText)}_propertyChanged(e){this.setValue(e.value())}}},43886:(e,t,i)=>{"use strict";i.d(t,{isCustomStudy:()=>r});const s={VbPFixed:!0,PivotPointsStandard:!0,VbPVisible:!0,VbPAnchored:!0};function r(e){return e in s}},96362:(e,t,i)=>{"use strict";i.d(t,{MetaInfoHelper:()=>u});var s=i(50151),r=i(42856),n=i(72877),o=i(1722),a=i(59224),l=i(33703);function c(e){return!e.groupId&&!e.isHidden&&e.id!==l.RangeDependentStudyInputNames.FirstBar&&e.id!==l.RangeDependentStudyInputNames.LastBar}var h=i(43886);const d=(0,a.getLogger)("Platform.GUI.PropertyDialog.Indicators.MetaInfo");class u{constructor(e){this._metaInfo=e}hasUserEditableInputs(){return this._metaInfo.inputs.some(c)}getUserEditableInputs(){return this._metaInfo.inputs.filter(c)}
hasUserEditableProperties(){return r.StudyMetaInfo.isScriptStrategy(this._metaInfo)}hasUserEditableStyles(){const e=this._metaInfo;return e.plots.length>0||void 0!==e.bands||void 0!==e.filledAreas||(0,h.isCustomStudy)(e.shortId)||r.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((i=>{if((0,n.isColorerPlot)(i)||(0,n.isTextColorerPlot)(i)||(0,n.isDataOffsetPlot)(i)||(0,n.isOhlcColorerPlot)(i)||(0,n.isAlertConditionPlot)(i)||(0,n.isDataPlot)(i))return!1;if((0,n.isOhlcPlot)(i)){const r=i.target;if(e.has(r))return!1;e.add(r);const n=(0,s.ensureDefined)(t.ohlcPlots);return!(0,s.ensureDefined)(n[r]).isHidden}{const e=t.styles?t.styles[i.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(_),i={...p};for(const s of t){const t=s.internalID;i[t]=s,p.hasOwnProperty(t)||d.logWarn(`Unknown strategy input internal id ${t} in ${e.fullId}`)}return(0,o.clone)(i)}}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}},83526:(e,t,i)=>{"use strict";i.d(t,{checkAuthBeforeSaveLoad:()=>n});var s=i(14483),r=i(39080);function n(e,t){s.enabled("saveload_requires_authentication")?(0,r.runOrSigninWithFeature)(e,{...t,feature:"savedCharts"}):e()}},68456:(e,t,i)=>{"use strict";i.d(t,{AbstractJsonStoreService:()=>r,CommonJsonStoreService:()=>n});var s=i(57898);class r{constructor(e,t,i,r,n){this._onChange=new s.Delegate,this._handleChange=()=>{this._onChange.fire(this.get())},this._crossTabEvents=e,this._jsonKeyValueStore=t,this.CROSSTAB_EVENT_NAME=i,this.JSON_STORE_KEY=r,this.defaultStoreValue=this._serialize(n),this._subscribe()}get(){const e=this._jsonKeyValueStore.getJSON(this.JSON_STORE_KEY,this.defaultStoreValue);return this._deserialize(e)}set(e,t){const i=this._serialize(e);this._jsonKeyValueStore.setJSON(this.JSON_STORE_KEY,i,t),this._crossTabEvents.emit(this.CROSSTAB_EVENT_NAME),this._onChange.fire(e)}getOnChange(){return this._onChange}destroy(){this._unsubscribe(),this._onChange.destroy(),delete this._onChange}_subscribe(){this._crossTabEvents.on(this.CROSSTAB_EVENT_NAME,this._handleChange),this._jsonKeyValueStore.onSync.subscribe(this,this._handleChange)}_unsubscribe(){this._crossTabEvents.off(this.CROSSTAB_EVENT_NAME,this._handleChange),this._jsonKeyValueStore.onSync.unsubscribe(this,this._handleChange)}}class n extends r{_serialize(e){return e}_deserialize(e){return e}}},10638:(e,t,i)=>{"use strict";i.d(t,{LoadChartService:()=>d})
;var s=i(14483),r=i(61595),n=i(83526),o=i(85067),a=i(21097),l=i(56840),c=i(68456);class h extends c.CommonJsonStoreService{constructor(e,t){super(e,t,"FAVORITE_CHARTS_CHANGED","loadChartDialog.favorites",{})}}class d extends o.DialogRenderer{constructor(e=null){super(),this._chartWidgetCollection=null,this._promise=null,this._dialog=null,this._subscribe=e=>{this._setVisibility(e)},this._getChartEntry=e=>({id:e.id,url:e.url,title:e.name,symbol:e.short_symbol,interval:e.interval,toolsCount:0,modified:e.modified_iso,favorite:void 0,active:()=>this._isActiveChart(e.id),openAction:()=>r.backend.loadChart(e),deleteAction:()=>r.backend.removeChart(e.image_url).then((()=>this._deleteChart(e.id))),favoriteAction:e=>Promise.resolve(this._updateFavorites(e))}),this._updateFavorites=e=>{var t;null===(t=this._favoriteChartsService)||void 0===t||t.set(e)},this._isActiveChart=e=>null!==this._chartWidgetCollection&&e===this._chartWidgetCollection.metaInfo.id.value(),this._deleteChart=e=>{this._isActiveChart(e)&&(s.enabled("saveload_storage_customization")?null!==this._chartWidgetCollection&&this._chartWidgetCollection.clearChartMetaInfo():location.href="/chart/"+location.search)},this._chartWidgetCollection=e,this._favoriteChartsService=new h(a.TVXWindowEvents,l)}showLoadDialog(){(0,n.checkAuthBeforeSaveLoad)(this._showLoadDialog.bind(this),{source:"Load chart",sourceMeta:"Chart"})}show(){this.showLoadDialog()}hide(){var e,t;null===(e=this._dialog)||void 0===e||e.hide(),null===(t=this._dialog)||void 0===t||t.visible().unsubscribe(this._subscribe)}_showLoadDialog(){(s.enabled("saveload_requires_authentication")&&!window.is_authenticated?Promise.resolve([]):r.backend.getCharts()).then((e=>e.map(this._getChartEntry))).then((e=>{const t=this._promise=Promise.all([i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(3842),i.e(5145),i.e(855),i.e(5993),i.e(2587),i.e(6752),i.e(8149),i.e(4781),i.e(6747),i.e(898),i.e(962),i.e(1740),i.e(6408),i.e(2544),i.e(5057),i.e(5164),i.e(5009)]).then(i.bind(i,34557)).then((i=>{if(this._promise===t){this._dialog&&(this._dialog.hide(),this._dialog.visible().unsubscribe(this._subscribe));const t={charts:e,favoriteChartsService:this._favoriteChartsService,chartWidgetCollection:this._chartWidgetCollection};this._dialog=new i.LoadChartDialogRenderer(t),this._dialog.visible().subscribe(this._subscribe),this._dialog.show()}}))}))}async _changeFavoriteState(e,t,i){return Promise.resolve()}}},75593:(e,t,i)=>{"use strict";i.d(t,{CustomStatusModel:()=>c});var s=i(97145);const r="#9598a1",n=!1,o=null,a='';class l{constructor(e){this._visible=new s.WatchedValue(n),this._tooltip=new s.WatchedValue(o),this._icon=new s.WatchedValue(a),this._color=new s.WatchedValue(r),this._tooltipContent=new s.WatchedValue(null),this._symbol=e}symbol(){return this._symbol}tooltip(){return this._tooltip}icon(){return this._icon}color(){return this._color}visible(){return this._visible}tooltipContent(){return this._tooltipContent}}class c{constructor(){
this._symbolCustomStatuses=new Map}getSymbolCustomStatus(e){if(this._symbolCustomStatuses.has(e))return this._symbolCustomStatuses.get(e);const t=new l(e);return this._symbolCustomStatuses.set(e,t),t}hideAll(){for(const e of this._symbolCustomStatuses.values())e.visible().setValue(!1)}static getInstance(){return null===this._instance&&(this._instance=new c),this._instance}}c._instance=null},98425:(e,t,i)=>{"use strict";i.d(t,{restoreShowMarketOpenStatusProperty:()=>l,showMarketOpenStatusProperty:()=>a});var s=i(59680),r=i(56840);const n="Chart.ShowMarketOpenStatus";function o(){return r.getBool(n,true)}const a=(0,s.createPrimitiveProperty)(o());function l(){a.setValue(true),r.remove(n)}r.onSync.subscribe(null,(()=>a.setValue(o()))),a.subscribe(null,(()=>r.setValue(n,a.value())))},10585:(e,t,i)=>{"use strict";i.d(t,{MarketStatusModel:()=>l});i(50151);var s=i(97145),r=i(57333),n=i(41249);function o(){return window.ChartApiInstance.serverTime()/1e3}function a(e,t,i){return e<=i?t<=i?1/0:t/1e3:Math.min(e,t)/1e3}class l{constructor(e){this._marketStatus=new s.WatchedValue(null),this._lastMarketStatus=null,this._sessionsSpec=null,this._nextSessionEdgeInternal=null,this._nextSessionEdge=new s.WatchedValue(null),this._recalcNextSessionEdgeTimerId=null,this._futuresContractExpirationTime=null,this._quotesProvider=e,e.quotesUpdate().subscribe(this,this._update.bind(this)),e.quoteSymbolChanged().subscribe(this,this._resetStatus)}destroy(){this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._quotesProvider.quoteSymbolChanged().unsubscribeAll(this),null!==this._recalcNextSessionEdgeTimerId&&clearTimeout(this._recalcNextSessionEdgeTimerId)}futuresContractExpirationTime(){return this._futuresContractExpirationTime}setSymbolInfo(e){var t,i,s,n,o;if(this._nextSessionEdgeInternal=null,null===e)return void(this._sessionsSpec=null);const a=new r.SessionSpec(e.timezone,null!==(t=e.session_display)&&void 0!==t?t:e.session,e.session_holidays,e.corrections);let l,c;const h=null===(i=e.subsessions)||void 0===i?void 0:i.find((e=>"premarket"===e.id)),d=null===(s=e.subsessions)||void 0===s?void 0:s.find((e=>"postmarket"===e.id));void 0!==h&&(l=new r.SessionSpec(e.timezone,null!==(n=h["session-display"])&&void 0!==n?n:h.session,e.session_holidays,h["session-correction"])),void 0!==d&&(c=new r.SessionSpec(e.timezone,null!==(o=d["session-display"])&&void 0!==o?o:d.session,e.session_holidays,d["session-correction"])),this._sessionsSpec={general:a,preMarket:l,postMarket:c},this._recalculateNextSessionEdge()}status(){return this._marketStatus}nextSessionEdge(){return this._nextSessionEdge}_resetStatus(){this._lastMarketStatus=null,this._marketStatus.setValue(null)}_update(e){void 0!==e&&void 0!==e.values.current_session&&(this._lastMarketStatus=e.values.current_session),null!==this._lastMarketStatus?this._marketStatus.setValue(this._lastMarketStatus):this._resetStatus()}_getNextSessionEdgeInternal(){var e;if(null===this._sessionsSpec||"24x7"===this._sessionsSpec.general.spec())return null;const t=1e3*o()
;if(null===this._nextSessionEdgeInternal||(null!==(e=this._nextSessionEdgeInternal.timestamp)&&void 0!==e?e:1/0)<=t/1e3){const{general:e,preMarket:i,postMarket:s}=this._sessionsSpec,r=(0,n.get_timezone)(e.timezone()),l=(0,n.utc_to_cal)(r,t),c=a((0,n.cal_to_utc)(r,e.alignToNearestSessionStart(l,1)),(0,n.cal_to_utc)(r,e.alignToNearestSessionEnd(l,1)),t),h=a(void 0!==i?(0,n.cal_to_utc)(r,i.alignToNearestSessionStart(l,1)):1/0,void 0!==i?(0,n.cal_to_utc)(r,i.alignToNearestSessionEnd(l,1)):1/0,t),d=a(void 0!==s?(0,n.cal_to_utc)(r,s.alignToNearestSessionStart(l,1)):1/0,void 0!==s?(0,n.cal_to_utc)(r,s.alignToNearestSessionEnd(l,1)):1/0,t);let u=Math.min(c,h,d);if(u===1/0){const t=o(),i=6e4,s=new Date(Math.round(new Date(1e3*t).getTime()/i)*i).getTime()+i,l=(0,n.utc_to_cal)(r,s),c=a((0,n.cal_to_utc)(r,e.alignToNearestSessionStart(l,1)),(0,n.cal_to_utc)(r,e.alignToNearestSessionEnd(l,1)),s),p=Math.min(c,h,d);p!==1/0?(this._nextSessionEdgeInternal={timestamp:u},u=p):this._nextSessionEdgeInternal={timestamp:null}}this._nextSessionEdgeInternal=u===d?{timestamp:u,status:"post_market"}:u===h?{timestamp:u,status:"pre_market"}:{timestamp:u}}return this._nextSessionEdgeInternal}_recalculateNextSessionEdge(){const e=this._getNextSessionEdgeInternal();if(null===e||null===e.timestamp)return void this._nextSessionEdge.setValue(null);const t={status:e.status,remainingSeconds:Math.max(0,e.timestamp-o())};if(null===this._recalcNextSessionEdgeTimerId){const e=Number.isFinite(t.remainingSeconds)?Math.ceil(t.remainingSeconds%60):1;this._recalcNextSessionEdgeTimerId=setTimeout((()=>this._recalculateNextSessionEdgeByTimer()),1e3*e)}this._nextSessionEdge.setValue(t)}_recalculateNextSessionEdgeByTimer(){this._recalcNextSessionEdgeTimerId=null,this._recalculateNextSessionEdge()}}},77248:(e,t,i)=>{"use strict";i.d(t,{CRUCIAL_REALTIME_BATS:()=>a,firstReplacedByBatsExchange:()=>l,isDelay:()=>h,isEod:()=>c,witoutRealtime:()=>d});i(50151);var s=i(79982),r=i.n(s);const n=["DJ","JSE","BELEX"],o=["NZX"],a=["AMEX","NASDAQ","NYSE"];function l(e){return null}function c(e,t){return r().hasEodSymbols(e.full_name)||6===t}function h(e){return void 0!==e&&e>0}function d(e){return"index"===e.type&&n.includes(e.listed_exchange)||"futures"===e.type&&o.includes(e.listed_exchange)}},31330:(e,t,i)=>{"use strict";i.d(t,{canShowSpreadActions:()=>r,globalKeypressMatches:()=>n});var s=i(14483);i(94025),i(82992);new RegExp("^quandl","i");function r(){let e=!1;return s.enabled("show_spread_operators")&&(e=!0),e}function n(e){if(e.ctrlKey)return!1;if(e.metaKey)return!1;if(!e.charCode)return!1;if(!e.which||e.which<=32)return!1;const t=e.target;return!t||!/^(input|textarea)$/i.test(t.tagName)&&"listbox"!==t.getAttribute("role")}},13702:(e,t,i)=>{"use strict";function s(){return Promise.all([i.e(2666),i.e(956),i.e(2109),i.e(4015),i.e(5145),i.e(855),i.e(6),i.e(8056),i.e(2587),i.e(2639),i.e(9842),i.e(7807),i.e(3353),i.e(962),i.e(1740),i.e(6408),i.e(5057),i.e(750),i.e(1754)]).then(i.bind(i,89324))}i.d(t,{loadNewSymbolSearch:()=>s})},40493:(e,t,i)=>{"use strict";i.d(t,{
tradingService:()=>n});var s=i(16216);const r={id:"TradingService"};function n(){return(0,s.hasService)(r)?(0,s.service)(r):null}},96005:(e,t,i)=>{"use strict";i.d(t,{TradingViewApiBase:()=>U});var s=i(50151),r=i(82992),n=i(76422),o=i(14483),a=i(10643),l=i(75531),c=i(51768),h=i(11014),d=i(45345),u=i(57898);class p{constructor(e){this._toolbarThemeChanged=new u.Delegate,this._onWatchedThemeChanged=e=>{this._toolbarThemeChanged.fire(e)},this._opts=e,d.watchedTheme.subscribe(this._onWatchedThemeChanged)}destroy(){d.watchedTheme.unsubscribe(this._onWatchedThemeChanged)}isStdTheme(){const e=this._opts.chartWidgetCollection.getAll().every((e=>(0,h.isStdTheme)((0,h.extractThemeFromModel)(e.model()))));return Promise.resolve(e)}async setStdTheme(e,t=!0,i){await(0,h.loadTheme)(this._opts.chartWidgetCollection,{themeName:e,standardTheme:!0,syncState:t,noUndo:i})}setStdThemeForLayout(e,t=!0){(0,d.setTheme)(e),t&&(0,h.syncTheme)()}getCurrentThemeName(){return(0,h.getCurrentTheme)().name}toolbarThemeChanged(){return this._toolbarThemeChanged}}var _=i(88913),m=i(88348),g=i(97145),f=i(46100),v=i(92249),S=i(56954),y=i.t(S,2);const b=new u.Delegate;var w=i(50151).ensureNotNull,C=i(68582).isLineToolRiskReward,P=i(88913).supportedLineTools,x=i(92249).createLineToolProperties,T=i(92249).prepareLineToolPropertiesByOwnerSource,I=i(45973).lineToolEntityInfo,M=i(72414).LineToolsGroupControllerApi,A=i(47513).RemoveSourcesUndoCommand;const{isLineDrawnWithPressedButton:L,isLineToolFinishRequiredWhenCreatedByApi:k}=i(15367),D=i(81155).EnvironmentState;var E=i(75444).ChartWidgetApiBase,V=i(88348);i(51768).trackEvent;function B(e,t){return t.map((function(t){return e.dataSourceForId(t)}))}class R extends E{executeActionById(e){this._chartWidget.executeActionById(e)}getCheckableActionState(e){return this._chartWidget.getCheckableActionState(e)}setZoomEnabled(e){this._chartWidget.model().model().setZoomEnabled(e)}setScrollEnabled(e){this._chartWidget.model().model().setScrollEnabled(e)}refreshMarks(){this._chartWidget.refreshMarks()}clearMarks(e){this._chartWidget.clearMarks(e)}setEntityVisibility(e,t){console.warn("`setEntityVisibility` is deprecated. Use shape/study API instead");var i=this._chartWidget.model().model().dataSourceForId(e);if(i){var s=i.properties();s&&s.visible&&s.visible.setValue(t)}}availableZOrderOperations(e){var t=B(this._chartWidget.model().model(),e);return this._chartWidget.model().availableZOrderOperations(t)}sendToBack(e){var t=B(this._chartWidget.model().model(),e);this._chartWidget.model().sendToBack(t)}bringToFront(e){var t=B(this._chartWidget.model().model(),e);this._chartWidget.model().bringToFront(t)}insertAfter(e,t){var i=this._chartWidget.model().model(),s=B(i,e),r=i.dataSourceForId(t);this._chartWidget.model().insertAfter(s,r)}insertBefore(e,t){var i=this._chartWidget.model().model(),s=B(i,e),r=i.dataSourceForId(t);this._chartWidget.model().insertBefore(s,r)}bringForward(e){var t=B(this._chartWidget.model().model(),e);this._chartWidget.model().bringForward(t)}sendBackward(e){
var t=B(this._chartWidget.model().model(),e);this._chartWidget.model().sendBackward(t)}showPropertiesDialog(e){var t=this._chartWidget.model().model().dataSourceForId(e);if(null===t)throw new Error("Study or shape "+e+" does not exist");this._chartWidget.showChartPropertiesForSource(t)}getAllShapes(){return this._chartWidget.model().model().allLineTools().map(I).filter((function(e){return null!==e.name}))}removeEntity(e,t){var i=this._chartWidget.model().chartModel().dataSourceForId(e);i?t&&t.disableUndo?new A(this._chartWidget.model().chartModel(),[i],"").redo():this._chartWidget.model().removeSource(i,!0,!0):console.warn("Can't find a source with id: "+e)}removeEntityWithUndo(e){var t=this._chartWidget.model().chartModel().dataSourceForId(e);this._chartWidget.model().removeSource(t,!1)}drawOnAllCharts(e){V.drawOnAllCharts.setValue(e)}getVisiblePriceRange(){return console.warn("`getVisiblePriceRange` is deprecated. Use Price Scale API instead"),this._chartWidget.model().mainSeries()?this._chartWidget.model().mainSeries().priceScale().priceRangeInPrice():null}scrollPosition(){return console.warn("`scrollPosition` is deprecated. Use rightOffset from Time Scale API instead"),this._chartWidget.model().timeScale().rightOffset()}defaultScrollPosition(){return console.warn("`defaultScrollPosition` is deprecated. Use defaultRightOffset from Time Scale API instead"),this._chartWidget.model().timeScale().defaultRightOffset().value()}_createTradingPrimitive(e,t){var i,s=this._chartWidget.model(),r=s.model(),n=r.paneForSource(r.mainSeries());function o(){var e=TradingView.CLOSE_PLOT,t=w(s.mainSeries().bars().last());return{index:t.index,price:t.value[e]}}return(i=t?r.createLineTool(n,o(),e):s.createLineTool({pane:n,point:o(),linetool:e}))?i._adapter:void 0}createOrderLine(e){e=e||{};return this._createTradingPrimitive("LineToolOrder",e.disableUndo)}createPositionLine(e){e=e||{};return this._createTradingPrimitive("LineToolPosition",e.disableUndo)}createExecutionShape(e){e=e||{};return this._createTradingPrimitive("LineToolExecution",e.disableUndo)}createShape(e,t){return this.createMultipointShape([e],t)}createMultipointShape(e,t){const i=Object.assign({},this._getDefaultCreateMultipointShapeOptions(),t);var s=P[i.shape]||P.flag;var r=this._chartWidget.model().model(),n=r.mainSeries();if(!r.timeScale().isEmpty()){var o=r.dataSourceForId(i.ownerStudyId)||n,a=r.paneForSource(o),l=this._convertUserPointsToDataSource(e);if(s.onlySelectable)throw new Error('Cannot create "'+i.shape+'" shape');if("LineToolIcon"===s.name){if(i.icon=i.icon||i.overrides&&i.overrides.icon,!i.hasOwnProperty("icon"))throw new Error("icon must be specified in options");i.overrides=i.overrides||{},i.overrides.icon=i.icon}var c,h,d=x(s.name,void 0,this._chartWidget.model().model());if(T(d,o),i.overrides)for(var u in i.overrides)d[u]?d[u].mergeAndFire(i.overrides[u]):C(s.name)&&-1!==["profitLevel","stopLevel"].indexOf(u)&&d.addProperty(u,i.overrides[u]);if(void 0!==d.text&&i.text&&d.text.setValue(i.text),d.hasChild("filled")&&i.filled&&d.filled.setValue(!0),
null!==(h=i.disableUndo?(c=this._chartWidget.model().model()).createLineTool(a,l[0],s.name,d,void 0,o):(c=this._chartWidget.model()).createLineTool({pane:a,point:l[0],linetool:s.name,properties:d,ownerSource:o}))){if(C(s.name)){if(l.length>2)throw new Error("Wrong points count for "+i.shape+". Required 1 or 2");2===l.length&&(h.startChanging(1,l[1]),h.setPoint(1,l[1]),h.endChanging())}else{var p=h.pointsCount();if(p!==l.length&&-1!==p)throw new Error("Wrong points count for "+i.shape+". Required "+p);for(var _=new D(void 0,!0),m=L(s.name),g=1;g{this.setActiveChart(this._chartIndex(e))};const{chartApiInstance:t,chartWidgetCollection:i,studyMarket:s,saveChartService:o,loadChartService:a,sharingChartService:l=null,webview:c=null}=e;this._chartWidgetCollection=i,
this._studyMarket=s,this._saveChartService=o,this._sharingChartService=l,this._loadChartLayoutDialog=a,this._intervalsService=null,this._alertsWidgetDialog=null,this._detailsDialogController=null,this._supportedChartStylesSpawn=r.linking.supportedChartStyles.spawn(),this._chartWidgetCollection.onAboutToBeDestroyed.subscribe(null,(()=>this.destroy()),!0),this._webview=c;const h=new W.ChartChangesWatcher(this._chartWidgetCollection,window.saver,n);this._chartChangesWatcher=h,this._chartHasChanged=(0,H.createWVFromGetterAndSubscription)((()=>h.hasChanges()),h.getOnChange());const d=i.lock;this._symbolSync=d.symbol.spawn(),this._intervalSync=d.interval.spawn(),this._dateRangeSync=d.dateRange.spawn(),this._crosshairSync=d.crosshair.spawn(),this._timeSync=d.trackTime.spawn()}destroy(){var e,t,i;this._chartHasChanged.destroy(),this._chartChangesWatcher.destroy(),this._supportedChartStylesSpawn.destroy(),null===(e=this._intervalsService)||void 0===e||e.destroy(),null===(t=this._themesApi)||void 0===t||t.destroy(),null===(i=this._widgebarApi)||void 0===i||i.destroy(),this._widgetbarApiRejectionReason="This ITradingViewApi instance has been destroyed",this._symbolSync.destroy(),this._intervalSync.destroy(),this._dateRangeSync.destroy(),this._crosshairSync.destroy(),this._timeSync.destroy(),this._isDestroyed=!0,(0,m.properties)().childs().magnet.unsubscribeAll(this),(0,m.properties)().childs().magnetMode.unsubscribeAll(this)}themes(){return null===this._themesApi&&(this._themesApi=new p({chartWidgetCollection:this._chartWidgetCollection})),this._themesApi}dialogs(){var e,t,i,s,r,n;return{Indicators:this._studyMarket,Compare:this._chartWidgetCollection.getCompareDialogRenderer(),ObjectsTree:null,ChartProperties:this._chartWidgetCollection.getChartPropertiesDialogRenderer(),ChartLayoutSaveAs:null!==(t=null===(e=this._saveChartService)||void 0===e?void 0:e.getSaveAsController())&&void 0!==t?t:null,ChartLayoutRename:null!==(s=null===(i=this._saveChartService)||void 0===i?void 0:i.getRenameController())&&void 0!==s?s:null,ChartLayoutCreate:null!==(n=null===(r=this._saveChartService)||void 0===r?void 0:r.getCreateController())&&void 0!==n?n:null,ChartLayoutLoad:this._loadChartLayoutDialog,Alerts:this._alertsWidgetDialog,Details:this._detailsDialogController,FinancialsCharts:null,Technicals:null,Forecast:null}}subscribe(e,t){n.subscribe(e,t,void 0)}unsubscribe(e,t){n.unsubscribe(e,t,void 0)}webview(){return z(),this._webview}studyTemplatesDrawerApi(){z()}fontIconsSettingsDrawer(){z()}intervalsService(){z()}supportedChartTypes(){return this._supportedChartStylesSpawn}setBrokerName(e){this._chartWidgetCollection.setBroker(e)}getDrawOnAllCharts(){return(0,m.drawOnAllCharts)().value()}drawOnAllCharts(e){return(0,m.drawOnAllCharts)().setValue(e)}getDrawOnAllChartsMode(){return(0,m.drawOnAllChartsMode)().value()}drawOnAllChartsMode(e){(0,m.drawOnAllChartsMode)().setValue(e)}disableTrackingEvents(){(0,c.disableTrackingEvents)()}getSaveChartService(){return this._saveChartService}symbolSync(){return this._symbolSync}intervalSync(){
return this._intervalSync}dateRangeSync(){return this._dateRangeSync}crosshairSync(){return this._crosshairSync}timeSync(){return this._timeSync}setSymbolSearchUI(e){z()}chart(e=0){if(e<0||e>=this.chartsCount())throw Error("Incorrect index: "+e);return this._getChartWidgetApi(this._chartWidgetCollection.getAll()[e])}activeChart(){return this._getChartWidgetApi(this._activeChartWidget())}setActiveChart(e){if(e>=0&&e(this._favoriteDrawingsToolbar||(this._favoriteDrawingsToolbar=new e.FavoriteDrawingsApi),this._favoriteDrawingsToolbar)))}sharingChart(){return this._sharingChartService}watchlist(){z()}setWatchlistApiPromise(e){z()}news(){z()}setNewsApiPromise(e){z()}widgetbar(){z()}setWidgetbarApiPromise(e){z()}getChartStorage(){return getChartStorage()}setDebugMode(e){o.setEnabled("charting_library_debug_mode",e)}setFeatureEnabled(e,t){"chart_crosshair_menu"!==e?o.setEnabled(e,t):F.addPlusButtonProperty.setValue(t)}magnetEnabled(){return null===this._magnetEnabledWatchedValue&&(this._magnetEnabledWatchedValue=new g.WatchedValue((0,m.properties)().childs().magnet.value()),this._magnetEnabledWatchedValue.subscribe((e=>{(0,f.saveDefaultProperties)(!0),(0,m.properties)().childs().magnet.setValue(e),(0,f.saveDefaultProperties)(!1)})),(0,m.properties)().childs().magnet.subscribe(this,(()=>{(0,s.ensureNotNull)(this._magnetEnabledWatchedValue).setValue((0,m.properties)().childs().magnet.value())}))),this._magnetEnabledWatchedValue}magnetMode(){return null===this._magnetModeWatchedValue&&(this._magnetModeWatchedValue=new g.WatchedValue((0,m.properties)().childs().magnetMode.value()),
this._magnetModeWatchedValue.subscribe((e=>{(0,f.saveDefaultProperties)(!0),(0,m.properties)().childs().magnetMode.setValue(e),(0,f.saveDefaultProperties)(!1)})),(0,m.properties)().childs().magnetMode.subscribe(this,(()=>{(0,s.ensureNotNull)(this._magnetModeWatchedValue).setValue((0,m.properties)().childs().magnetMode.value())}))),this._magnetModeWatchedValue}flushBufferedData(){b.fire()}chartWidgetCollectionState(...e){return this._chartWidgetCollection.state(...e)}chartWidgetCollectionSeriesStatuses(){return this._chartWidgetCollection.chartSeriesStatuses()}initAllLineTools(){return Promise.all(Object.keys(y).filter((e=>!y[e])).map((e=>(0,v.initLineTool)(e)))).then((()=>{}))}watermark(){{const e=O.WatermarkApi.getInstance();if(!e.ready())throw new Error("Watermark API is not initialised yet.");return e}}setContextMenuOptions(e){U.setContextMenuOptions(e)}changeSymbol(e,t,i){r.linking.interval.setValue((0,s.ensureNotNull)(N.Interval.normalize(t))),r.linking.setSymbolAndLogInitiator(e,"API"),i&&this.activeChart().onDataLoaded().subscribe(null,i,!0)}getSymbolInterval(e){const t={symbol:this.linking.proSymbol.value(),interval:this.linking.interval.value()};return null==e||e(t),t}hasChartChanges(){return this._chartHasChanged}setForceFullscreenMode(){z()}setMultichartMode(){z()}setDateRangeLinkingEnabled(e){this._chartWidgetCollection.lock.dateRange.setValue(e)}static setContextMenuOptions(e){void 0!==e.items_processor&&a.ContextMenuManager.setCustomItemsProcessor(e.items_processor),void 0!==e.renderer_factory&&a.ContextMenuManager.setCustomRendererFactory(e.renderer_factory)}_getChartWidgetApi(e){let t=this._chartWidgets.get(e);return void 0===t&&(t=new R(e,this._activateChart.bind(null,e)),this._chartWidgets.set(e,t)),t}_chartIndex(e){return this._chartWidgetCollection.getAll().indexOf(e)}_activeChartWidget(){return this._chartWidgetCollection.activeChartWidget.value()}}},75117:(e,t,i)=>{"use strict";var s=i(82992).linking,r=(i(51608).createDeferredPromise,i(76422)),n=i(10643).ContextMenuManager,o=i(88348),a=i(94025),l=i(61595).backend,c=i(59224),h=i(3615).showWarning,d=i(3615).showConfirm,u=i(88913),p=i(52092).CLOSE_POPUPS_AND_DIALOGS_COMMAND,_=i(96005).TradingViewApiBase,m=i(42856).StudyMetaInfo,g=i(152).getStudyInputsInfo,f=i(70120).getStudyStylesInfo,v=i(57898).Delegate,S=i(97145).WatchedValue;e.exports=class extends _{constructor(e){const{chartWidgetCollection:t,saveChartService:i,loadChartService:s,sharingChartService:r,alertsDispatcher:n,supportTicketData:o,favoriteServices:a,chartApiInstance:l=null,studyMarket:c=null,webview:h,alertsFacadeChannelPushApi:d}=e;super({chartApiInstance:l,chartWidgetCollection:t,studyMarket:c,saveChartService:i,loadChartService:s,sharingChartService:r,webview:h}),this._chartApiInstance=l,this._loadChartService=s,this._alertsDispatcher=n,this._supportTicketData=o,this._favoriteServices=a,this._alertsFacadeChannelPushApi=d,this._proxyWatchListChangedDelegate=null,this._lockDrawingsWatchedValue=null,this._hideDrawingsWatchedValue=null,this._hideIndicatorsWatchedValue=null,
this._replayApi=null,this._getDataSourceHub=function(){return t.activeChartWidget.value().model().model()},this._alertService=this._alertsDispatcher&&this._alertsFacadeChannelPushApi?new undefined(this._alertsDispatcher,this._getDataSourceHub,this._alertsFacadeChannelPushApi):null,this._activeChangedChangedDelegate=new v,this._chartWidgetCollection.activeChartWidget.subscribe(function(){this._activeChangedChangedDelegate.fire()}.bind(this))}onContextMenu(e){r.subscribe("onContextMenu",(function(t){t.callback(e(t.unixtime,t.price))}))}onGrayedObjectClicked(e){r.subscribe("onGrayedObjectClicked",e)}onActiveChartChanged(){return this._activeChangedChangedDelegate}viewMode(){throw new Error("not implemented")}viewModeWatchedValue(){throw new Error("not implemented")}saveChart(e,t){if(this._saveChartService){var i=this._saveChartService.saveToJSON(t);return e&&e(JSON.parse(i.content))}}loadChart(e){this._chartApiInstance.disconnect(),e.extendedData&&(this._chartWidgetCollection.metaInfo.id.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.uid.setValue(e.extendedData.uid),this._chartWidgetCollection.metaInfo.name.setValue(e.extendedData.name)),this._chartWidgetCollection.loadContent(e.json),this._chartWidgetCollection.purgeUnusedWidgets(),this._chartApiInstance.connect(),s.setSymbolAndLogInitiator(this.activeChart().symbol(),"API"),r.emit("chart_loaded")}getStudiesList(){return this._chartApiInstance.allStudiesMetadata().filter((function(e){return!e.is_hidden_study})).map((function(e){return e.description}))}getStudyInputs(e){{const t=m.findStudyMetaInfoByDescription(this._chartApiInstance.allStudiesMetadata(),e);return g(t)}}getStudyStyles(e){{const t=m.findStudyMetaInfoByDescription(this._chartApiInstance.allStudiesMetadata(),e);return f(t)}}getSavedCharts(e){l.getCharts().then(e)}loadChartFromServer(e){l.loadChart(e)}saveChartToServer(e,t,i){this._saveChartService&&this._saveChartService.saveChartSilently(e,t,i)}setAutosave(e){this._saveChartService&&this._saveChartService.autoSaveEnabled().setValue(e)}removeChartFromServer(e,t){l.removeChart(e).then(t)}getIntervals(){var e=[],t=a.getCustomResolutions();return null!==this._chartApiInstance&&(e=this._chartApiInstance.defaultResolutions()),a.mergeResolutions(e,t)}closePopupsAndDialogs(){n.hideAll(),r.emit(p)}selectedLineTool(){for(var e=Object.keys(u.supportedLineTools),t=o.tool.value(),i=0;i{"use strict";i.d(t,{WatermarkApi:()=>o});var s=i(50151),r=i(63821),n=i(65632);class o{constructor(){this._widgets=null,this._provider=null,this._watermarkProperties=(0,n.watermarkProperty)();const e=(0,s.ensureDefined)(this._watermarkProperties.child("color")),t=(0,s.ensureDefined)(this._watermarkProperties.child("visibility"));this._colorWatchedValue=(0,r.convertPropertyToWatchedValue)(e),this._visibilityWatchedValue=(0,r.convertPropertyToWatchedValue)(t)}setWidgetCollection(e){this._widgets=e}setContentProvider(e){this._provider=e,this._widgets&&this._widgets.getAll().forEach((e=>{e.model().model().lightUpdate()}))}provider(){return this._provider}ready(){return null!==this._widgets}destroy(){this._colorWatchedValue.destroy(),this._visibilityWatchedValue.destroy()}visibility(){return this._visibilityWatchedValue}color(){return this._colorWatchedValue}static getInstance(){return null===this._instance&&(this._instance=new o),this._instance}}o._instance=null},85402:(e,t,i)=>{"use strict";i.d(t,{AbstractBarColorer:()=>s});class s{constructor(){this._backColorers=[]}barStyle(e,t,i){const s={};for(const r of this._backColorers)r.applyBarStyle(e,t,s,i);return this.applyBarStyle(e,t,s,i),s}pushBackBarColorer(e){this._backColorers.unshift(e)}firstColoredBar(e){return null}}},11095:(e,t,i)=>{"use strict";i.d(t,{addPlusButtonProperty:()=>_,restoreAddPlusButtonSettingsValue:()=>m,showPlusButtonOnCursor:()=>d});var s=i(4741),r=i(14483),n=i(56840),o=i(59680),a=i(97145);const l="add_plus_button";function c(){const e=s.keyboardPressedKeysState.value();return void 0!==e&&(Boolean(e.modifiers&s.Modifiers.Alt&&e.modifiers&s.Modifiers.Mod)&&(void 0===e.code||e.altOrOptionCode()||e.controlOrMetaCode()))}const h=new a.WatchedValue(c());s.keyboardPressedKeysState.subscribe((()=>h.setValue(c())));const d=h.readonly();function u(){return r.enabled("chart_crosshair_menu")}function p(){return n.getBool(l,u())}const _=(0,o.createPrimitiveProperty)(p());function m(){_.setValue(u()),n.remove(l)}n.onSync.subscribe(null,(()=>_.setValue(p()))),_.subscribe(null,(()=>{n.setValue(l,_.value()),r.setEnabled("chart_crosshair_menu",!r.enabled("chart_crosshair_menu"))}))},83654:(e,t,i)=>{"use strict";i.d(t,{alignToStep:()=>n});var s=i(60521),r=i.n(s);function n(e,t){return r()(e).div(t).round(0,r().roundHalfUp).mul(t).toNumber()}},28640:(e,t,i)=>{"use strict";i.d(t,{AppliedTimeFrame:()=>r});var s=i(83669);class r{constructor(e){this._appliedTimeFrame=new s.WatchedObject(null),this._appliedTimeFrameInfo=null,this._appliedTimeFrameChangedBound=this._appliedTimeFrameChanged.bind(this),this._model=e,e.mainSeries().dataEvents().seriesTimeFrame().subscribe(this,this._onSeriesTimeFrame),this._appliedTimeFrame.subscribe(this._appliedTimeFrameChangedBound)}destroy(){this._appliedTimeFrame.unsubscribe(this._appliedTimeFrameChangedBound),this._model.timeScale().logicalRangeChanged().unsubscribeAll(this),this._model.mainSeries().dataEvents().seriesTimeFrame().unsubscribeAll(this)}appliedTimeFrame(){
return this._appliedTimeFrame}_appliedTimeFrameChanged(){this._model.timeScale().logicalRangeChanged().unsubscribe(this,this._invalidateAppliedTimeFrame)}_onSeriesTimeFrame(e,t,i,s){if(s){const e=this._model.timeScale();this._appliedTimeFrameInfo={logicalRange:e.logicalRange(),baseIndex:e.baseIndex()},e.logicalRangeChanged().subscribe(this,this._invalidateAppliedTimeFrame)}}_invalidateAppliedTimeFrame(){if(null===this._appliedTimeFrameInfo)return;const e=this._model.timeScale(),t=e.logicalRange(),i=e.baseIndex(),s=this._appliedTimeFrameInfo.logicalRange,r=this._appliedTimeFrameInfo.baseIndex;(null===t||null===s||Math.abs(i-t.left()-(r-s.left()))>=.01||Math.abs(i-t.right()-(r-s.right()))>=.01)&&this._appliedTimeFrame.setValue(null)}}},12416:(e,t,i)=>{"use strict";i.d(t,{defaultsPreferencesByWhiteList:()=>x,preferencesByWhiteList:()=>P});var s=i(1722),r=i(67980),n=i(62615),o=i(59224),a=i(74304),l=i(85804),c=i(16776),h=i(30888),d=i(93613);const u=(0,o.getLogger)("Chart.ApplyPreferencesToAllCharts"),p={color:"",style:0},_={autoScale:!1,autoScaleDisabled:!1,lockScale:!1,percentage:!1,percentageDisabled:!1,log:!1,logDisabled:!1,alignLabels:!1,isInverted:!1,indexedTo100:!1},m={backgroundType:d.ColorType.Solid,background:"",backgroundGradientStartColor:"",backgroundGradientEndColor:"",topMargin:0,bottomMargin:0,rightOffset:0,gridLinesMode:"both",horzGridProperties:(0,h.deepExtend)({},p),vertGridProperties:(0,h.deepExtend)({},p),crossHairProperties:(0,h.deepExtend)({},{color:"",style:0,transparency:0,width:0}),legendProperties:(0,h.deepExtend)({},{showStudyArguments:!1,showStudyTitles:!1,showStudyValues:!1,showSeriesTitle:!1,showSeriesOHLC:!1,showLegend:!1,showLastDayChange:!1,showBarChange:!0,showVolume:!1,showPriceSource:!1,showBackground:!0,backgroundTransparency:0,showLogo:!0}),axisProperties:(0,h.deepExtend)({},_),separatorColor:""},g={lineColor:"",textColor:"",fontSize:0,scaleSeriesOnly:!1,showSeriesLastValue:!1,seriesLastValueMode:a.PriceAxisLastValueMode.LastValueAccordingToScale,showSeriesPrevCloseValue:!1,showStudyLastValue:!1,showSymbolLabels:!1,showStudyPlotLabels:!1,showBidAskLabels:!1,showPrePostMarketPriceLabel:!0,showFundamentalLastValue:!1,showFundamentalNameLabel:!1,showPriceScaleCrosshairLabel:!0,showTimeScaleCrosshairLabel:!0},f={...g},v={visible:!1,futureOnly:!1,breaks:(0,h.deepExtend)({},{color:"",visible:!1,style:0,width:0})},S={style:0,minTick:"",showPriceLine:!1,priceLineWidth:0,priceLineColor:"",baseLineColor:"",showPrevClosePriceLine:!1,showCountdown:!0,prevClosePriceLineWidth:0,sessionId:"regular",prevClosePriceLineColor:"",esdShowDividends:!1,esdShowSplits:!1,esdShowEarnings:!1,esdShowBreaks:!1,showContinuousContractSwitches:!1,showContinuousContractSwitchesBreaks:!1,showFuturesContractExpiration:!1,showLastNews:!1,dividendsAdjustment:!1,backAdjustment:!1,settlementAsClose:!0,statusViewStyle:(0,h.deepExtend)({},{fontSize:16,showExchange:!0,showInterval:!0,symbolTextSource:"description"}),priceAxisProperties:(0,h.deepExtend)({},_),highLowAvgPrice:(0,h.deepExtend)({},{highLowPriceLinesVisible:!1,
highLowPriceLabelsVisible:!1,averageClosePriceLabelVisible:!1,averageClosePriceLineVisible:!1,highLowPriceLinesColor:"",highLowPriceLinesWidth:0,averagePriceLineColor:"",averagePriceLineWidth:0}),candleStyle:(0,h.deepExtend)({},n.candleStylePreferencesDefault),hollowCandleStyle:(0,h.deepExtend)({},n.hollowCandlePreferencesStyleDefault),barStyle:(0,h.deepExtend)({},n.barStylePreferencesDefault),lineStyle:(0,h.deepExtend)({},n.lineStyleDefault),lineWithMarkersStyle:(0,h.deepExtend)({},n.lineStyleDefault),steplineStyle:(0,h.deepExtend)({},n.lineStyleDefault),areaStyle:(0,h.deepExtend)({},n.areaStylePreferencesDefault),hlcAreaStyle:(0,h.deepExtend)({},n.hlcAreaStylePreferencesDefault),baselineStyle:(0,h.deepExtend)({},n.baselineStylePreferencesDefault),hiloStyle:(0,h.deepExtend)({},n.hiloStylePreferencesDefault),haStyle:(0,h.deepExtend)({},n.haStylePreferencesDefault),renkoStyle:(0,h.deepExtend)({},n.renkoStylePreferencesDefault),pbStyle:(0,h.deepExtend)({},n.pbStylePreferencesDefault),kagiStyle:(0,h.deepExtend)({},n.kagiStylePreferencesDefault),pnfStyle:(0,h.deepExtend)({},n.pnfStylePreferencesDefault),rangeStyle:(0,h.deepExtend)({},n.rangeStylePreferencesDefault),columnStyle:(0,h.deepExtend)({},n.columnStylePreferencesDefault),useVolumeWeightBars:!1},y={priceScaleSelectionStrategyName:"auto",timeScale:(0,h.deepExtend)({},{defaultRightOffset:0,defaultRightOffsetPercentage:5,usePercentageRightOffset:!1}),mainSeries:(0,h.deepExtend)({},S),sessions:(0,h.deepExtend)({},c.sessionsPreferencesDefault),paneProperties:(0,h.deepExtend)({},m),chartEventsSourceProperties:(0,h.deepExtend)({},v),tradingProperties:(0,h.deepExtend)({},r.tradingPreferencesDefault)},b={timezone:"",scalesProperties:(0,h.deepExtend)({},f),...y},w={scalesProperties:(0,h.deepExtend)({},g),...y};function C(e,t,i,r,n=!0){if(void 0===t[e])return u.logDebug(`We haven't had this property ${r}.${e} yet, please, remove it from whiteList`),null;if((0,s.isObject)(i[e])){const s=Object.keys(i[e]);let o="";return s.map((s=>({[s]:C(s,t[e],i[e],`${r}.${e}`,n)}))).reduce(((e,t)=>(o=Object.keys(t)[0],e[o]=t[o],e)),{})}return n?t[e].value():t[e]}function P(e,t,i=b){const s={timezone:"",priceScaleSelectionStrategyName:"auto",timeScale:{defaultRightOffset:e.timeScale().defaultRightOffset().value(),defaultRightOffsetPercentage:e.timeScale().defaultRightOffsetPercentage().value(),usePercentageRightOffset:e.timeScale().usePercentageRightOffset().value()},mainSeries:{},sessions:{},paneProperties:{},scalesProperties:{},chartEventsSourceProperties:{},tradingProperties:{}},r=["timeScale","mainSeries","sessions"],n=i.mainSeries,o=Object.keys(i),a=Object.keys(n),l=t.properties(),c=e.properties(),h=i.sessions,d=Object.keys(h),u=e.sessions().properties();return a.forEach((e=>{s.mainSeries[e]=C(e,l,n,"mainSeries")})),d.forEach((e=>{s.sessions[e]=C(e,u,h,"sessions")})),o.forEach((e=>{r.includes(e)||(s[e]=C(e,c,i,"preferences"))})),s}function x(e,t,i=w,s=!0){const r={timeScale:{defaultRightOffset:e.timeScale().rightOffsetDefaultValue(),
defaultRightOffsetPercentage:e.timeScale().defaultRightOffsetPercentage().value(),usePercentageRightOffset:e.timeScale().usePercentageRightOffset().value()},mainSeries:{},sessions:(0,h.deepExtend)({},c.sessionsPreferencesDefault),paneProperties:{},scalesProperties:{},chartEventsSourceProperties:{},tradingProperties:{},priceScaleSelectionStrategyName:"auto"},n=["timeScale","mainSeries","sessions"],o=i.mainSeries,a=Object.keys(i),d=Object.keys(o),u=(0,l.factoryDefaults)("chartproperties.mainSeriesProperties"),p=(0,l.factoryDefaults)("chartproperties");return d.forEach((e=>{s&&"style"===e||(r.mainSeries[e]=C(e,u,o,"mainSeries",!1))})),a.forEach((e=>{n.includes(e)||(r[e]=C(e,p,i,"preferences",!1))})),r}},39875:(e,t,i)=>{"use strict";i.d(t,{autoLogButtonsVisibilityOptions:()=>n,autoLogButtonsVisibilityProperty:()=>r,restoreAutoLogButtonsVisibilitySettingsValue:()=>o});var s=i(29542);const{property:r,availableValues:n,restoreDefaultValue:o}=(0,s.createVisibilityController)("PriceAxisAutoLogButtons.visibility")},81580:(e,t,i)=>{"use strict";i.d(t,{axisLabelBackgroundColor:()=>r});var s=i(33013);const r={common:s.colorsPalette["color-tv-blue-500"],active:s.colorsPalette["color-tv-blue-800"]}},77475:(e,t,i)=>{"use strict";i.d(t,{createDwmAligner:()=>c,createTimeToBarTimeAligner:()=>d,isAlignmentEnabled:()=>h});var s=i(41249),r=i(14483),n=i(36274),o=i(98829),a=i(60156);const l=new o.SessionInfo("Etc/UTC","0000-0000:1234567");function c(e,t){if(!h()||!n.Interval.isDWM(e))return null;const i=new o.SessionInfo(t.timezone,t.session,t.session_holidays,t.corrections),r=(0,a.newBarBuilder)(e,i,l);return{timeToSessionStart:e=>r.tradingDayToSessionStart(e),timeToExchangeTradingDay:e=>{const t=s.utc_to_cal(i.timezone,e),r=i.spec.correctTradingDay(t);return s.set_hms(r,0,0,0,0,s.get_timezone("Etc/UTC")),r.getTime()}}}function h(){return!r.enabled("disable_resolution_rebuild")}function d(e,t){if(!h())return e=>e;const i=new o.SessionInfo(t.timezone,t.session,t.session_holidays,t.corrections),s=(0,a.newBarBuilder)(e,i,i,!1);return e=>s.alignTimeIfPossible(e)}},98829:(e,t,i)=>{"use strict";i.d(t,{BarBuilderBase:()=>a,SessionInfo:()=>o});var s=i(41249),r=i(60062),n=i(57333);class o{constructor(e,t,i,s){this.init(e,t,i,s),this._state={timezone:e,spec:t,holidays:i,corrections:s}}init(e,t,i,r){this.timezone=s.get_timezone(e),this.spec=new n.SessionSpec(e,t,i,r)}state(){return this._state}static fromState(e){return new o(e.timezone,e.spec,e.holidays,e.corrections)}}class a{alignTime(e){if(isNaN(e))return NaN;let t=this.indexOfBar(e);return t===r.SessionStage.POST_SESSION&&(this.moveTo(e),t=this.indexOfBar(e)),t<0?NaN:this.startOfBar(t)}}},60156:(e,t,i)=>{"use strict";i.r(t),i.d(t,{SessionInfo:()=>o.SessionInfo,alignExchangeTimeToSessionStartAndReturnUTC:()=>P,alignPeriodsBackForDataRequest:()=>y,alignPeriodsBackForVisibleRange:()=>b,getPeriodsBetweenDates:()=>C,isTradingNow:()=>x,newBarBuilder:()=>S});var s=i(41249),r=i(36274),n=i(37160),o=i(98829),a=i(60062);class l extends o.BarBuilderBase{constructor(e,t){super(),
this._sessionStartMs=-Number.MAX_VALUE,this._sessionEndMs=-Number.MAX_VALUE,this._periodSec=e,this._session=t}alignTimeIfPossible(e){const t=this.alignTime(e);return isNaN(t)?e:t}indexOfBar(e){return e=this._sessionEndMs?a.SessionStage.POST_SESSION:(0,n.toInt)(s.time_seconds_diff(e,this._sessionStartMs)/this._periodSec)}startOfBar(e){if(e===a.SessionStage.PRE_SESSION){const e=s.get_cal_from_unix_timestamp_ms(this._session.timezone,this._sessionStartMs-1),t=this._session.spec.alignToNearestSessionEnd(e,-1);return s.cal_to_utc(this._session.timezone,t)}if(e===a.SessionStage.POST_SESSION)return this._sessionEndMs;if(e<0)throw new Error("Negative offset is not supported");return this._sessionStartMs+s.time_seconds(this._periodSec*e)}endOfBar(e){if(e<0)throw new Error("Index cannot be negative");const t=this.startOfBar(e)+1e3*this._periodSec;return t>this._sessionEndMs?this._sessionEndMs:t}isLastBar(e,t){return t>=this._sessionStartMs+s.time_seconds(this._periodSec*(e+1)-1)}moveTo(e){const t=this._session.timezone,i=s.utc_to_cal(t,e),r=this._session.spec.alignToSessionStart(i);this._sessionStartMs=s.cal_to_utc(t,i),s.add_minutes(i,r),this._sessionEndMs=s.cal_to_utc(t,i)}indexOfLastBarInSession(){return(0,n.toInt)((this._sessionEndMs-1-this._sessionStartMs)/1e3/this._periodSec)}moveNext(){this.moveTo(this._sessionEndMs)}}var c=i(54606);function h(e,t){const i=s.clone(t),r=e.businessDaysToCalendarDays(i,1);r>1&&s.add_date(i,r-1);const n=e.leftBorderOfDailyBar(i);if(null===n)throw new Error("Cannot calculate left border of daily bar");return s.cal_to_utc(s.get_timezone(e.timezone()),n)}class d extends o.BarBuilderBase{constructor(e,t,i,s,r=!1){super(),this._periodStart=-Number.MAX_VALUE,this._periodEnd=-Number.MAX_VALUE,this._periodLastBarStart=-Number.MAX_VALUE,this._periodStartDay=new c.BusinessDay(0,0,0),this._periodEndDay=new c.BusinessDay(0,0,0),this._period=i,this._sessionTgt=e,this._builder=s,this._useBusinessDays=r,this._sessionSrc=r?new o.SessionInfo("Etc/UTC","24x7"):t||e}builder(){return this._builder}alignTimeIfPossible(e){return this.tradingDayToSessionStart(e)}tradingDayToSessionStart(e){return this.moveTo(e),this.startOfBar(0)}indexOfBar(e){if(this._useBusinessDays){const t=c.BusinessDay.fromCalendar(s.get_cal_from_unix_timestamp_ms(this._sessionSrc.timezone,e));return t.before(this._periodStartDay)?a.SessionStage.PRE_SESSION:this._periodEndDay.before(t)?a.SessionStage.POST_SESSION:0}return e=this._periodEnd?a.SessionStage.POST_SESSION:0}startOfBar(e){if(e===a.SessionStage.PRE_SESSION){const e=s.get_cal_from_unix_timestamp_ms(this._sessionTgt.timezone,this._periodStart-1),t=this._sessionTgt.spec.alignToNearestSessionEnd(e,-1);return s.cal_to_utc(this._sessionTgt.timezone,t)-1}return e===a.SessionStage.POST_SESSION||e>0?this._periodEnd:e===a.SessionStage.LASTBAR_SESSION?this._periodLastBarStart:this._periodStart}moveTo(e){const t=s.get_cal_from_unix_timestamp_ms(this._sessionSrc.timezone,e)
;this._sessionSrc.spec.correctTradingDay(t);const i=s.get_year(t),r=this._indexOfPeriodInYear(t),n=r+this._period,o=this._sessionTgt.spec,a=this._sessionTgt.timezone,l=this._builder.startOfPeriod(a,r,i);this._periodStart=h(o,l);const d=s.clone(l),u=o.businessDaysToCalendarDays(d,1);u>1&&s.add_date(d,u-1),this._periodStartDay=c.BusinessDay.fromCalendar(d);const p=this._builder.startOfPeriod(a,n,i);this._periodEnd=h(o,p);const _=s.clone(p);for(s.add_date(_,-1);o.isCalWeekEnd(_);)s.add_date(_,-1);this._periodEndDay=c.BusinessDay.fromCalendar(_),s.add_date(p,-1),function(e,t){for(;e.isCalWeekEnd(t);)s.add_date(t,-1)}(this._sessionTgt.spec,p),this._periodLastBarStart=h(o,p),(this._periodLastBarStart=this._periodLastBarStart}currentRange(){return{from:this._periodStartDay,to:this._periodEndDay}}indexOfBarInYear(e){const t=s.get_cal_from_unix_timestamp_ms(this._sessionSrc.timezone,e),i=s.get_year(t),r=this._builder.indexOfPeriod(t),o=this._sessionTgt.timezone;let a=this._builder.startOfPeriod(o,r,i),l=h(this._sessionTgt.spec,a);return a=s.get_cal_from_unix_timestamp_ms(s.get_timezone("Etc/UTC"),l),i=0&&(r-=7),(0,n.toInt)((r+i)/7))}class _{indexOfPeriod(e){return s.get_day_of_year(e)-1}startOfPeriod(e,t,i){const r=s.days_per_year(i);return s.get_cal(s.get_timezone("Etc/UTC"),i,s.JANUARY,1+Math.min(t,r))}}class m extends _{constructor(e){super(),this._sessionsSpec=e}indexOfPeriod(e){return super.indexOfPeriod(e)-function(e,t){const i=p(e,t),r=s.get_cal(s.get_timezone("Etc/UTC"),s.get_year(t),s.JANUARY,1);s.add_date(r,7*i);const n=i*e.weekEndsCount()+e.holidaysFromYearStart(r),o=s.get_day_of_year(t)-s.get_day_of_year(r);return n+o-e.calendarDaysToBusinessDays(r,o)}(this._sessionsSpec,e)}startOfPeriod(e,t,i){const r=7-this._sessionsSpec.weekEndsCount(),o=Math.max(0,(0,n.toInt)(t/r)-1),a=s.get_cal(s.get_timezone("Etc/UTC"),i,s.JANUARY,1),l=s.get_days_per_year(a);if(s.add_date(a,7*o),(t-=r*o-this._sessionsSpec.holidaysFromYearStart(a))>0){const e=this._sessionsSpec.businessDaysToCalendarDays(a,t);s.add_date(a,e)}let c=s.get_day_of_year(a)-1;return is.get_days_per_year(r)?this.startOfPeriod(e,0,i+1):(s.add_date(r,a),r)}}class v{indexOfPeriod(e){return s.get_month(e)}startOfPeriod(e,t,i){if(t<0){const e=(0,n.toInt)((11-t)/12);i-=e,t+=12*e}else t>s.DECEMBER&&(i++,t=s.JANUARY);return s.get_cal(s.get_timezone("Etc/UTC"),i,t,1)}}function S(e,t,i,s=!1){const n=r.Interval.parse(e),o=n.multiplier();return n.isMinutes()?new l(60*o,t):n.isSeconds()?new l(o,t):n.isTicks()?new l(1,t):n.isRange()?new l(60*o,t):new d(t,i,o,function(e,t){switch(e){case r.ResolutionKind.Days:return new g(t);case r.ResolutionKind.Weeks:return new f(t);case r.ResolutionKind.Months:return new v}throw new Error(`Unknown dwm resolution: ${e}`)}(n.kind(),t),s)}function y(e,t,i,s,r,n,o){return w(e,t,i,s,r,n,o,0)}function b(e,t,i,s,r,n,o){return w(e,t,i,s,r,n,o,1)}function w(e,t,i,s,n,a,l,c){const h=r.Interval.parse(n+s);if(h.isMonths()){const e=new Date(l);return 0===c&&e.setUTCDate(1),function(e,t){T(e,Math.floor(t/12));let i=e.getUTCMonth()-t%12;i<0&&(T(e,1),i+=12);e.setUTCMonth(i);for(;e.getUTCMonth()!==i;)I(e,1)}(e,a*h.multiplier()),e.getTime()}const d=new o.SessionInfo("Etc/UTC",e,t,i),u=h.inMilliseconds(),p=h.isDWM();let _;_=p?864e5:60*d.spec.maxTradingDayLength()*1e3;let m=0;m=h.isWeeks()?7:7-d.spec.weekEndsCount();const g=_/u,f=m*g;let v;if(a=g&&(f=_/6048e5*g);return f%1<=Number.EPSILON*Math.ceil(f)?Math.round(f):Math.ceil(f)}function P(e,t){const i=s.clone(t);return e.alignToSessionStart(i),s.cal_to_utc(s.get_timezone(e.timezone()),i)}function x(e,t){const i=s.utc_to_cal(t.timezone,+e);let r=s.get_day_of_week(i),n=s.get_minutes_from_midnight(i);const o=t.spec.findSession(t.spec.getWeekIndex(i),r,n).getEntry();return o.isOvernight()&&n>o.startOffset()+o.length()&&r===o.dayOfWeek()-1&&(r++,n-=1440),r===o.dayOfWeek()&&n>=o.startOffset()&&n{"use strict";i.d(t,{BusinessDay:()=>r});var s=i(41249);class r{constructor(e,t,i){this.year=e,this.month=t,this.day=i}toString(){return`${this.year}-${this.month}-${this.day}`}compareTo(e){return this.year>e.year||this.year===e.year&&this.month>e.month||this.year===e.year&&this.month===e.month&&this.day>e.day?1:this.year===e.year&&this.month===e.month&&this.day===e.day?0:-1}before(e){return-1===this.compareTo(e)}toCalendar(e){return s.get_cal(s.get_timezone("Etc/UTC"),this.year,this.month-1,this.day)}addDays(e){const t=this.toCalendar(s.get_timezone("Etc/UTC"));return s.add_date(t,e),r.fromCalendar(t)}static fromCalendar(e){return new r(s.get_year(e),s.get_month(e)+1,s.get_day_of_month(e))}}},60062:(e,t,i)=>{"use strict";var s;i.d(t,{SessionStage:()=>s}),function(e){e[e.PRE_SESSION=-1]="PRE_SESSION",e[e.POST_SESSION=-2]="POST_SESSION",e[e.LASTBAR_SESSION=-3]="LASTBAR_SESSION"}(s||(s={}))},94421:(e,t,i)=>{"use strict";i.d(t,{extrapolateBarsFrontByCount:()=>n,extrapolateBarsFrontToTime:()=>r});var s=i(60062);function r(e,t,i,s,n=!1){if(t>i){const o=r(e,i,t,s,n);return o.count=-o.count,o}return o(e,t,1,((e,t)=>t>i||0!==s&&e>s),n)}function n(e,t,i,s=!1){const r=i<0?-1:1;return o(e,t,r,((e,t)=>e>=i*r),s)}function o(e,t,i,r,n){let o=0,a=t;e.moveTo(a);let l=0,c=Number.MAX_VALUE,h=!1,d=t;const u=[];for(;!r(o,a);){if(l>15)throw new Error("Internal error 0x10 while extrapolating.");const r=e.indexOfBar(a);if(r===s.SessionStage.PRE_SESSION&&1===i)a=e.startOfBar(0),e.moveTo(a);else if(r===s.SessionStage.PRE_SESSION&&-1===i)a=e.startOfBar(s.SessionStage.PRE_SESSION),e.moveTo(a);else if(r===s.SessionStage.POST_SESSION&&1===i)a=e.startOfBar(s.SessionStage.POST_SESSION),e.moveTo(a);else{if(r===s.SessionStage.POST_SESSION&&-1===i)throw new Error("Internal error 0x12 while extrapolating.");{const p=e.startOfBar(r);if(p>t&&i>0||t>p&&i<0){if(h&&c===p)throw new Error("Internal error 0x11 while extrapolating.");h=!0,c=p,l=0,o++,d=p,n&&u.push(d)}if(0===r&&-1===i)a=p-1;else{a=e.startOfBar(r+i);const t=e.startOfBar(s.SessionStage.POST_SESSION);a>t&&(e.moveTo(t),a=e.startOfBar(0))}}}l++}return{time:d,times:u,count:o}}},57333:(e,t,i)=>{"use strict";i.d(t,{SessionSpec:()=>v});var s=i(41249),r=i(78071),n=i(54606);function o(e,t){return e.compareTo(t)}class a{constructor(e,t,i){this._dayOfWeek=e,this._start=t,this._length=i}start(){return this._start+s.minutesPerDay*this.sessionStartDaysOffset()}startOffset(){return this._start}sessionStartDaysOffset(){return this._start>=0?0:this._start%s.minutesPerDay==0?-Math.ceil(this._start/s.minutesPerDay):-Math.floor(this._start/s.minutesPerDay)}sessionEndDaysOffset(){const e=this._start+this._length;return e>=0?0:e%s.minutesPerDay==0?-Math.ceil(e/s.minutesPerDay):-Math.floor(e/s.minutesPerDay)}isOvernight(){return this._start<0}dayOfWeek(){return this._dayOfWeek}sessionStartDayOfWeek(){let e=this._dayOfWeek-this.sessionStartDaysOffset()
;return es.SATURDAY&&(e=1),e}length(){return this._length}weight(){return this._dayOfWeek*s.minutesPerDay+this._start}compareTo(e){const t=this.weight(),i=t+this._length,s=e.weight(),r=s+e._length;return t<=s&&ss?1:-1}contains(e){const t=60*s.get_hours(e)+s.get_minutes(e);let i=s.get_day_of_week(e)-this._dayOfWeek;i>0&&(i-=7);const r=i*s.minutesPerDay+t;return r>=this._start&&r=48&&e<=57}class _{constructor(){this.entries=[],this.firstDayOfWeek=s.MONDAY,this.weekEndsCount=-1,this.maxTradingDayLength=0}parseSessions(e,t){var i;let s=!1;this._clear(),this.timezone=e;const{hasErrors:r,spec:n}=this._parseFirstDayOfWeek(t);if("24x7"===n.toLowerCase())for(const e of d)this.entries.push(_._createSessionEntry(e,0,0,0,0));else{let e=!1;const t=new Map;for(const i of n.split("|")){const r=i.split(":");if(1!==r.length&&2!==r.length){s=!0,u.logError(`Bad session section: ${i}`);continue}const n=1===r.length;if(n){if(e){s=!0,u.logError(`Duplicated default section: ${i}`);continue}e=!0}const o=n?h:_._parseWorkingDays(r[1]);for(const e of o)n&&t.has(e)||t.set(e,r[0])}for(const e of d){const i=t.get(e);if(void 0!==i)for(const t of i.split(",")){const{hasErrors:i,sessionEntry:r}=_._parseSessionEntry(e,t);i&&(s=i),this.entries.push(r)}}}this.entries.sort(o);const a=new Map;for(const e of this.entries){const t=e.dayOfWeek();a.set(t,e.length()+(null!==(i=a.get(t))&&void 0!==i?i:0))}return this.maxTradingDayLength=0,a.forEach((e=>{this.maxTradingDayLength=Math.max(this.maxTradingDayLength,e)})),this.weekEndsCount=7-a.size,s||r}static parseHolidaysAndCorrections(e,t,i){const r=new Map,n=new Map,o=e=>{const t=this._parseDay(e),i=t.toString(),s=n.get(i);return void 0!==s?s:(n.set(i,t),t)};if(""!==t){const e=[];for(const i of t.split(",")){if(8!==i.length)throw new Error(`bad holiday date: ${i}`);const t=o(i);r.set(t,e)}}if(""===i)return r;const l=s.get_timezone("Etc/UTC");for(const e of i.split(";")){const t=e.split(":");if(2!==t.length)throw new Error(`bad correction section: ${e}`);const i=[];if("dayoff"!==t[0])for(const e of t[0].split(","))i.push(this._parseSessionEntry(1,e).sessionEntry);for(const e of t[1].split(",")){if(8!==e.length)throw new Error(`bad correction date: ${e}`);const t=o(e),n=s.get_day_of_week(s.get_cal(l,t.year,t.month-1,t.day)),c=[];for(const e of i)c.push(new a(n,e.startOffset(),e.length()));r.set(t,c)}}return r}_clear(){this.entries=[],this.timezone="",this.firstDayOfWeek=s.MONDAY,this.weekEndsCount=-1}_parseFirstDayOfWeek(e){const t=e.split(";")
;if(t.length>2)return u.logError(`Only one \`first day\` specification expected @ session ${e}`),{hasErrors:!0,spec:e};if(1===t.length)return{hasErrors:!1,spec:e};let i=1;let r=t[0].indexOf("-")>=0?NaN:parseInt(t[0]);return isNaN(r)&&(i=0,r=parseInt(t[1])),rs.SATURDAY?(u.logError(`Unexpected day index @ session: ${e}; day index ${r}`),{hasErrors:!0,spec:e}):(this.firstDayOfWeek=r,{hasErrors:!1,spec:t[i]})}static _parseDay(e){const t=parseInt(e.substring(0,4)),i=parseInt(e.substring(4,6)),s=parseInt(e.substring(6,8));return new n.BusinessDay(t,i,s)}static _parseSessionEntry(e,t){let i=!1,s=t.split("-");2!==s.length&&(i=!0,u.logError(`Bad sessions entry: ${t}`),s=["0000","0000"]);let r=0,n=s[0];if(n.includes("F")){const e=n.split("F");n=e[0],r=""!==e[1]?parseInt(e[1]):1}let o=0,a=s[1];if(a.includes("F")){const e=a.split("F");a=e[0],o=""!==e[1]?parseInt(e[1]):1}if(!this._isCorrectSession(n)||!this._isCorrectSession(a))throw new Error(`Incorrect entry syntax: ${t}`);const l=n,c=a;return{hasErrors:i,sessionEntry:this._createSessionEntry(e,_._minutesFromHHMM(l),_._minutesFromHHMM(c),r,o)}}static _isCorrectSession(e){return 4===e.length&&p(e.charCodeAt(0))&&p(e.charCodeAt(1))&&p(e.charCodeAt(2))&&p(e.charCodeAt(3))}static _parseWorkingDays(e){const t=[];for(let i=0;i0&&(t-=r*s.minutesPerDay),n>0&&(i-=n*s.minutesPerDay);return new a(e,t,i-t)}}function m(e,t){return e.compareTo(t)<0}function g(e,t){const i=(0,r.lowerbound)(e,t,((e,t)=>-1===e.day.compareTo(t)));return i===e.length?null:e[i]}const f=621672192e5;class v{constructor(e="Etc/UTC",t="0000-0000",i="",r=""){this._entries=[],this._firstDayOfWeek=s.MONDAY,this._entriesHash=new Map,this._holidayAndCorrectionMap=new Map,this._holidaySessions=[],t=function(e){const t=e.lastIndexOf("/");return-1===t?e:e.slice(t+1)}(t);const n=new _;n.parseSessions(e,t),this._entries=n.entries,this._timezone=n.timezone,this._spec=t,this._firstDayOfWeek=n.firstDayOfWeek,this._weekEndsCount=n.weekEndsCount,this._maxTradingDayLength=n.maxTradingDayLength;const o=_.parseHolidaysAndCorrections(e,i,r),a=s.get_timezone(e);this._isThereCorrections=""!==i||""!==r,o.forEach(((e,t)=>{this._holidayAndCorrectionMap.set(t.toString(),e),this._holidaySessions.push({day:t,sessions:e});const i=this.getWeekIndex(t.toCalendar(a));this._entriesHash.set(i,null)})),this._holidaySessions.sort(((e,t)=>e.day.compareTo(t.day)))}entries(){return this._entries}timezone(){return this._timezone}spec(){return this._spec}firstDayOfWeek(){return this._firstDayOfWeek}addSessionEntry(e,t,i,r,n){0===i&&(i=s.minutesPerDay),r===n&&i<=t&&(r+=1),r>0&&(t-=r*s.minutesPerDay),n>0&&(i-=n*s.minutesPerDay);const o=i-t;this._entries.push(new a(e,t,o))}longestSessionLength(){let e=0,t=0;for(const t of this._holidaySessions)t.sessions.forEach((t=>{e=Math.max(e,t.length())}));return this._entries.forEach((e=>{
t=Math.max(t,e.length())})),Math.max(e,t)}isWeekEnd(e){const t=(0,r.lowerbound)(this._entries,new a(e,0,0),((e,t)=>e.dayOfWeek()this._entries.length-1||this._entries[t].dayOfWeek()!==e}isCalWeekEnd(e){const t=s.get_day_of_week(e);if(!this._isThereCorrections)return this.isWeekEnd(t);const i=n.BusinessDay.fromCalendar(e),r=this._holidayAndCorrectionMap.get(i.toString());return void 0===r?this.isWeekEnd(t):0===r.length}hasWeekEnds(){return this.weekEndsCount()>0}weekEndsCount(){return this._weekEndsCount}maxTradingDayLength(){return this._maxTradingDayLength}holidaysFromYearStart(e){if(!this._isThereCorrections)return 0;const t=s.get_timezone(this._timezone),i=new n.BusinessDay(s.get_year(e),s.JANUARY,1),r=n.BusinessDay.fromCalendar(e);let o=0;const a=this._selectHolidays(i,r);for(let e=0;et.start()%e==0&&t.length()%e==0))}indexOfSession(e,t,i){const n=this._getEntriesForWeek(e);let o=(0,r.lowerbound)(n,new a(t,i,0),m);if(o!==n.length)return new l(e,o,n);let c=e;const h=7-t+this._firstDayOfWeek-1;for(i=-(s.minutesPerDay-i+h*s.minutesPerDay);;){c++;const e=this._getEntriesForWeek(c);if(0!==e.length)return o=(0,r.lowerbound)(e,new a(this._firstDayOfWeek,i,0),m),new l(c,o,e)}}findSession(e,t,i,s=0){const r=this.indexOfSession(e,t,i),n=r.entries;let o=r.entryIndex;if(0!==s){const e=n[o].dayOfWeek(),t=s>0?1:-1;for(;;){const i=o+t;if(i<0||i>=n.length||n[i].dayOfWeek()!==e)break;o=i}}return new l(r.weekIndex,o,n)}getWeekIndex(e){if(!this._isThereCorrections)return 0;const t=s.get_day_of_week(e)-s.SUNDAY,i=s.get_timezone("Etc/UTC"),r=s.get_cal(i,s.get_year(e),s.get_month(e),s.get_day_of_month(e)-t);return Math.floor((r.getTime()+f)/1e3/86400/7)}correctTradingDay(e){const t=s.get_day_of_week(e),i=60*s.get_hours(e)+s.get_minutes(e),r=this.getWeekIndex(e),n=this.findSession(r,t,i,0),o=n.getEntry().dayOfWeek()-t+7*(n.weekIndex-r);return 0!==o&&s.add_date(e,o),e}alignToSessionStart(e,t=0){const i=s.get_day_of_week(e),r=60*s.get_hours(e)+s.get_minutes(e),n=this.getWeekIndex(e),o=this.findSession(n,i,r,t),a=o.getEntry(),l=a.dayOfWeek()-i+7*(o.weekIndex-n);0!==l&&s.add_date(e,l);const c=a.startOffset();return s.set_hms(e,c/60,c%60,0,0,s.get_timezone(this._timezone)),a.length()}businessDaysToCalendarDays(e,t){let i=this.getWeekIndex(e),r=s.get_day_of_week(e),n=0,o=0;for(;oi);)e[a].dayOfWeek()=t)return n}i++,r=s.SUNDAY}return n}calendarDaysToBusinessDays(e,t){let i=this.getWeekIndex(e),r=s.get_day_of_week(e),n=0,o=0;for(;ni);)e[a].dayOfWeek()=t)return o}i++,r=s.SUNDAY}return o}
alignToNearestSessionStart(e,t){return this._alignToNearestSessionValue(e,t,this._entrySessionStart.bind(this))}alignToNearestSessionEnd(e,t){return this._alignToNearestSessionValue(e,t,this._entrySessionEnd.bind(this))}leftBorderOfDailyBar(e){const t=this._getEntriesForDay(e);return 0===t.length?null:(t.sort(o),this._getLeftEntryBorder(e,t[0]))}bordersOfDailyBar(e){const t=this._getEntriesForDay(e);if(0===t.length)return null;t.sort(o);const i=this._getLeftEntryBorder(e,t[0]),r=t[t.length-1],n=s.clone(e);let a=60*(r.startOffset()+r.length())-1;const l=Math.floor(a/3600);return a-=3600*l,s.set_hms(n,l,a/60,a%60,0,s.get_timezone(this._timezone)),{from:i,to:n}}getEntriesForWeekByCalendar(e){const t=this.getWeekIndex(e);return this._getEntriesForWeek(t)}_getEntriesForWeek(e){let t=this._entriesHash.get(e);if(void 0===t)return this._entries;if(null!==t)return t;const i=s.get_timezone(this._timezone);t=this._entries.slice();const r=this._weekIndexToCalendar(e),a=this._weekIndexToCalendar(e+1),l=n.BusinessDay.fromCalendar(r),c=n.BusinessDay.fromCalendar(a),h=this._selectHolidays(l,c);for(const e of h){const r=e.day.toCalendar(i),n=s.get_day_of_week(r);t=t.filter((e=>e.dayOfWeek()!==n)),t=t.concat(e.sessions)}return t.sort(o),this._entriesHash.set(e,t),t}_selectHolidays(e,t){const i=[];let s=e;for(;;){const e=g(this._holidaySessions,s);if(null===e)return i;if(!e.day.before(t))return i;i.push(e),s=e.day.addDays(1)}}_weekIndexToCalendar(e){const t=1e3*(86400*e*7+86400)-f,i=s.get_cal_from_unix_timestamp_ms(s.get_timezone("Etc/UTC"),t),r=s.get_timezone("Etc/UTC");return s.get_cal(r,s.get_year(i),s.get_month(i),s.get_day_of_month(i))}_alignToNearestSessionValue(e,t,i){const r=s.get_day_of_week(e),n=60*s.get_hours(e)+s.get_minutes(e),o=this.getWeekIndex(e);let a=this.findSession(o,r,n);if(a.getEntry().contains(e)&&o===a.weekIndex||1===t)return i(a,s.clone(e),t);const c=a.getEntry(),h=c.contains(e),d=o===a.weekIndex,u=c.sessionStartDaysOffset()-c.dayOfWeek()>=0;if(h&&(d||u))return i(a,s.clone(e),t);let p=a.entryIndex-1;if(p<0){let e=a.weekIndex,t=a.entries;for(;p<0;)e--,t=this._getEntriesForWeek(e),p+=t.length;a=new l(e,p,t)}else a=new l(a.weekIndex,p,a.entries);return i(a,s.clone(e),t)}_entrySessionStart(e,t,i){return this._entrySessionValue(e,t,i,(e=>60*e.start()))}_entrySessionEnd(e,t,i){return this._entrySessionValue(e,t,i,(e=>60*(e.start()+e.length())-1))}_entrySessionValue(e,t,i,r){let n=s.get_day_of_week(t);const o=e.getEntry();let a=o.dayOfWeek()-o.sessionStartDaysOffset();const l=this.getWeekIndex(t);let c=e.weekIndex-l,h=!1;if(a0&&i>=0||c<0&&i<0)&&s.add_date(t,7*c),!o.contains(t)){let e=a-n;h&&i<0&&(e=-(7-a+n)),s.add_date(t,e),n=s.get_day_of_week(t)}o.isOvernight()&&n===o.dayOfWeek()&&s.add_date(t,-o.sessionStartDaysOffset());let d=r(o);const u=Math.floor(d/3600);return d-=3600*u,s.set_hms(t,u,d/60,d%60,0,s.get_timezone(this._timezone)),t}_getEntriesForDay(e){const t=s.get_day_of_week(e);return this._getEntriesForWeek(this.getWeekIndex(e)).filter((e=>e.dayOfWeek()===t))}
_getLeftEntryBorder(e,t){const i=s.clone(e),r=t.startOffset();return s.set_hms(i,r/60,r%60,0,0,s.get_timezone(this._timezone)),i}}},81049:(e,t,i)=>{"use strict";i.d(t,{barFunctionByStyle:()=>r});var s=i(13497);function r(e,t){switch(e){case 12:return(0,s.barFunction)("low","low","close");case 2:case 14:case 15:case 3:case 10:case 13:return(0,s.barFunction)(null!=t?t:"close");default:return(0,s.barFunction)("close","open")}}},36112:(e,t,i)=>{"use strict";i.d(t,{BarsMarksContainer:()=>m});var s=i(50151),r=i(59224),n=i(56840),o=i.n(n),a=i(14483),l=i(36274),c=i(1722),h=i(42960),d=i(14292),u=i(28558);const p=(0,r.getLogger)("Chart.BarsMarksContainer"),_=Math.round(new Date(2037,0,1).getTime()/1e3);class m extends d.DataSource{constructor(e,t,i){const r=e.onWidget();let n;n=r?!e.hideIdeas():!!a.enabled("bars_marks")&&o().getBool("BarsMarksContainer.visibile",!1),t.merge({visible:n}),t.childs().visible.subscribe(null,(t=>{r||e.isSnapshot()||!a.enabled("bars_marks")||o().setValue("BarsMarksContainer.visibile",!!t.value())})),super(i),this._paneViews=[],this._model=e,this._properties=t,this._requests=[],this._marks={},this._loadedRange=null,this._getDataTimeout=null,this._collectedRange=null,this._lastRange=null;const l=this._model.mainSeries();l.onSymbolIntervalChanged().subscribe(this,this.clearMarks),l.dataEvents().symbolResolved().subscribe(this,this.clearMarks),l.dataEvents().completed().subscribe(this,(()=>{var e,t;const i=l.data();if(0===i.size())return;const r=(0,s.ensureNotNull)(i.first()).index,n=(0,s.ensureNotNull)(i.last()).index,o=this.timeScale();this.getData({start:null!==(e=o.indexToTimePoint(r))&&void 0!==e?e:1/0,end:null!==(t=o.indexToTimePoint(n))&&void 0!==t?t:-1/0})})),this._initialize(),this._pinnedTooltips={}}destroy(){const e=this._model.mainSeries();e.onSymbolIntervalChanged().unsubscribeAll(this),e.dataEvents().symbolResolved().unsubscribeAll(this),e.dataEvents().completed().unsubscribeAll(this),super.destroy()}properties(){return this._properties}marks(){return this._marks}pinTooltip(e,t){this._pinnedTooltips[e]=t}timeScale(){return this._model.timeScale()}getIntervalInTicks(){const e=this._model.mainSeries().properties().childs().interval.value(),t=l.Interval.parse(e);if(!t.isValid())throw new TypeError("Unexpected interval");return t.isRange()?60:t.inMilliseconds()/1e3}getVisibleTickMarksRange(){var e,t;if(this.timeScale().isEmpty())return{start:0,end:0};const i=(0,s.ensureNotNull)(this.timeScale().visibleBarsStrictRange()),{firstIndex:r,lastIndex:n}=(0,s.ensureNotNull)(this.timeScale().points().range().value());if(!(i.lastBar()>r&&i.firstBar(){var r,n;const o=this._marks[s],a=o.tickmark
;a>=(null!==(r=t.start)&&void 0!==r?r:1/0)&&a<=(null!==(n=t.end)&&void 0!==n?n:-1/0)+i&&e.push(o)})),e}getPublishedPlates(){const e={};return window.is_authenticated?(this.getVisibleRangePlates().forEach((t=>{t.is_public&&(this._pinnedTooltips[t.id]||t.user__id===window.user.id)&&(e[t.id]=t)})),e):e}filterDisplayedPlates(e){const t=e.reduce(((e,t)=>{const i=this._getIndex(t.tickmark);return null!==i&&(e[i]=e[i]||[],e[i].push(t)),e}),{});return Object.keys(t).reduce(((e,i)=>{let s=t[i];return s=s.sort(((e,t)=>t.views_count-e.views_count)),s=s.slice(0,10),e.concat(s)}),[])}getPlatesViewData(){var e,t,i;const r=this._model.mainSeries();if(r.data().isEmpty())return[];const n=(0,h.isPriceSourceStyle)(r.style())?r.barFunction():null,o=this.filterDisplayedPlates(this.getVisibleRangePlates()),a={},l=null!==(e=this._model.lastHittestData())&&void 0!==e?e:this._model.lastSelectedHittestData();let c=null;null!==l&&this._model.hoveredSource()===this&&(c=null!==(t=l.activeItem)&&void 0!==t?t:null);const d=[];for(const e of o){const t=(0,s.ensureNotNull)(this._getIndex(e.tickmark)),i=this._getBar(t);if(null===i)continue;const r=this._layout(e.direction),o=this._theme(e.direction),l=c===e.id,h=this.timeScale().indexToCoordinate(t),u=this._offset(r,i,n),p=(0,s.ensureNotNull)(this.priceScale()).isInverted();let _=0;t in a||(a[t]={up:0,down:0}),_=a[t][r]++,d.push({id:e.id,x:h,y:u,yInverted:p,order:_,direction:r,theme:o,hovered:l,pinned:!0===this._pinnedTooltips[e.id],user__id:e.user__id,label:e.label,labelFontColor:e.labelFontColor||"#444",minSize:e.minSize||5,...this._plateViewData(e)})}const u=d.filter((e=>!0===e.hovered));for(let e=0;ee.hovered&&!t.hovered?1:0)),d}priceAxisViews(){return null}updateAllViews(e){for(const t of this._paneViews)t.update(e)}updateAllViewsAndRepaint(){this.updateAllViews((0,u.sourceChangeEvent)(this.id())),this._model.updateSource(this)}roundRange(e){return{start:Math.round(e.start),end:Math.round(e.end)}}refreshData(){null!==this._lastRange&&this.getData(this._lastRange)}getData(e){(0,c.isNumber)(e.start)&&(0,c.isNumber)(e.end)?(this._lastRange=e,e.end=_,this._pushGetDataStack(Object.assign({},e))):p.logError("Wrong range")}clearMarks(){this._abortAllRequests(),this._marks={},this._loadedRange=null}isUserDeletable(){return!1}isSavedInChart(e){return!1}isSpeciallyZOrderedSource(){return!0}showInObjectTree(){return!1}_plateViewData(e){return{}}_layout(e){switch(e){default:case 0:case 2:case 3:case 4:case 5:case 6:return"up";case 1:return"down"}}_theme(e){switch(e){default:case 0:return"neutral";case 1:case 5:return"green";case 2:case 6:return"red";case 3:return"yellow";case 4:return"blue"}}_offset(e,t,i){let r;switch(e){default:case"up":r=null===i?t[2]:i(t);break;case"down":r=null===i?t[3]:i(t)}return(0,s.ensureNotNull)(this.priceScale()).priceToCoordinate(r,(0,s.ensureNotNull)((0,s.ensureNotNull)(this.ownerSource()).firstValue()))}_getIndex(e){
return this.timeScale().timePointToIndex(e)}_getBar(e){return this._model.mainSeries().data().valueAt(e)}_rangeDifference(e){return e=Object.assign({start:1/0,end:-1/0},e),this._loadedRange&&(e.startthis._loadedRange.end&&(e.start=this._loadedRange.end)),e}_rangeUnion(e,t){return e=Object.assign({start:1/0,end:-1/0},e),t&&(e.start=Math.min(t.start,e.start),e.end=Math.max(t.end,e.end)),e}_pushGetDataStack(e){(0,c.isNumber)(e.start)&&(0,c.isNumber)(e.end)?(this._getDataTimeout&&clearTimeout(this._getDataTimeout),this._collectedRange=this._rangeUnion(e,this._collectedRange),this._getDataTimeout=setTimeout((()=>{this._getData(this._collectedRange),this._getDataTimeout=this._collectedRange=null}),300)):p.logError("Wrong tickmark range")}_abortAllRequests(){this._requests.forEach((e=>{e.cancel()})),this._requests=[],this._getDataTimeout&&clearTimeout(this._getDataTimeout),this._getDataTimeout=this._collectedRange=null}}},12500:(e,t,i)=>{"use strict";i.d(t,{BarsRange:()=>r});var s=i(50151);class r{constructor(e,t){(0,s.assert)(e<=t,"The last bar in the bars range should be greater than or equal to the first bar"),this._firstBar=e,this._lastBar=t}firstBar(){return this._firstBar}lastBar(){return this._lastBar}count(){return this._lastBar-this._firstBar+1}contains(e){return this._firstBar<=e&&e<=this._lastBar}equals(e){return this._firstBar===e.firstBar()&&this._lastBar===e.lastBar()}static compare(e,t){return null===e||null===t?e===t:e.equals(t)}}},31281:(e,t,i)=>{"use strict";i.d(t,{ChartModelBase:()=>Ss});var s=i(12481),r=i(27788),n=i(50151),o=i(86441),a=i(24377),l=i(33013),c=i(11542),h=i(45345),d=i(11014),u=i(51768),p=i(51608),_=i(76422),m=i(11417),g=i(67980),f=i(3587),v=i(78071),S=i(92249);function y(e){return(0,S.isLineTool)(e)&&e.boundToSymbol()||!1}class b{constructor(){this._items=[],this._set=new Set,this._dataSourcesCache=null,this._customSourcesCache=null,this._lineSourcesCache=null}isEmpty(){return 0===this._items.length}add(e){if(this._items.length>0&&!y(this._items[0])&&this.clear(),y(e)){const t=(0,v.lowerbound)(this._items,e,((e,t)=>e.zorder()!(0,f.isDataSource)(e)))),this._customSourcesCache}checkLineToolSelection(){this._items.forEach((e=>(0,S.isLineTool)(e)&&e.calcIsActualSymbol())),this._items=this._items.filter((e=>!(0,S.isLineTool)(e)||e.isActualSymbol())),this._invalidateCache()}remove(e){
this._items=this._items.filter((t=>t!==e)),this._set.delete(e),this._invalidateCache()}clear(){this._items=[],this._set.clear(),this._invalidateCache()}_invalidateCache(){this._customSourcesCache=null,this._dataSourcesCache=null,this._lineSourcesCache=null}}var w=i(6674),C=i(33703),P=i(52329),x=i(56827),T=i(36274),I=i(46100),M=i(88640),A=i(29764),L=i(46501);class k{constructor(e){this._rendererOptions={borderSize:1,additionalPaddingInner:0,fontSize:NaN,font:"",color:"",paneBackgroundColor:"",paddingBottom:0,paddingInner:0,paddingOuter:0,paddingTop:0,lineSpacing:0},this._chartModel=e}options(){const e=this._rendererOptions,t=this._chartModel.properties().childs(),i=t.scalesProperties.childs().fontSize.value();return e.fontSize!==i&&(e.fontSize=i,e.font=(0,A.makeFont)(i,L.CHART_FONT_FAMILY,""),e.paddingTop=i/12*2.5,e.paddingBottom=i/12*2.5,e.paddingInner=i/12*4,e.additionalPaddingInner=i/12*4,e.paddingOuter=i/12*4,e.lineSpacing=i/12*2),e.color=t.scalesProperties.childs().textColor.value(),e.paneBackgroundColor=t.paneProperties.childs().background.value(),this._rendererOptions}}var D=i(74970),E=i(94739),V=i(12442),B=i(71766),R=i(85804),N=i(15742),O=i(14483),F=i(42960),W=i(16776),H=i(28558);const z=new B.PriceFormatter,U="sessions";class j extends N.CustomSourceBase{constructor(e,t,i){super(e,t),this._studySource=null,this._paneViews=[],this._metaInfo=null,this._destroyed=!1,this._isStarted=!1,this._loadedGraphics=null,this._doubleClickHandler=i,this._properties=new I.DefaultProperty("sessions"),(0,R.applyDefaultsOverrides)(this._properties.childs().graphics,void 0,!1,U),this._removeDuplicateProperties(),this._properties.subscribe(this,this._onPropertiesChanged),this._requestAndProcessMetaInfo(),t.timeScale().onReset().subscribe(this,this._clearData),t.timeScale().logicalRangeChanged().subscribe(this,this.updateAllViews.bind(this,(0,H.viewportChangeEvent)())),t.mainSeries().sessionIdProxyProperty().subscribe(this,this._updateVisibleOfPreAndPostMarketBackground),t.mainSeries().properties().childs().interval.subscribe(this,this._processHibernate),this._updateVisibleOfPreAndPostMarketBackground(t.mainSeries().properties().childs().sessionId)}applyOverrides(e){(0,R.applyPropertiesOverrides)(this._properties.childs().graphics,void 0,!1,e,U),this._model.updateSource(this)}start(){this._isStarted=!0,this._processHibernate()}restart(){this._clearData(),O.enabled("stop_study_on_restart")&&this.stop(),this.start()}isStarted(){return this._isStarted}stop(){this._isStarted=!1,null!==this._studySource&&this._studySource.stop()}isHoveredEnabled(){return!1}paneViews(e){return this._paneViews}updateAllViews(e){this._paneViews.forEach((t=>t.update(e)))}updateViewsForPane(e,t){this.updateAllViews(t)}destroy(){this._destroyed=!0,null!==this._studySource&&(this._studySource.dataCleared().unsubscribeAll(this),this._studySource.dataUpdated().unsubscribeAll(this),this._studySource.destroy(),this._studySource=null),this._model.timeScale().logicalRangeChanged().unsubscribeAll(this),this._model.timeScale().onReset().unsubscribeAll(this),
this._model.mainSeries().sessionIdProxyProperty().unsubscribeAll(this),this._model.mainSeries().properties().childs().interval.unsubscribeAll(this),this._properties.unsubscribeAll(this)}series(){return this._model.mainSeries()}priceScale(){return this.series().priceScale()}graphics(){return this._loadedGraphics||(0,n.ensureNotNull)(this._studySource).graphics()}valueAt(e,t){return null}properties(){return this._properties}graphicsInfo(){return(0,n.ensureNotNull)(this._metaInfo).graphics}firstValue(e){return this._model.mainSeries().firstValue()}formatter(){return z}state(e){const t={properties:this._properties.state()};return e&&null!==this._metaInfo&&(t.data={graphics:(0,V.saveStudyGraphics)(this.graphics(),this._model.timeScale().visibleBarsStrictRange()),metaInfo:this._metaInfo}),t}restoreState(e,t){const i=e.properties;this._migrateOutOfSessionProperty(i),this._properties.mergeAndFire(i),this._removeDuplicateProperties(),this._updateVisibleOfPreAndPostMarketBackground(this._model.mainSeries().properties().childs().sessionId),void 0!==e.data&&t&&(this._loadStudyGraphics(e.data.graphics),this._setMetaInfo(e.data.metaInfo),this._createPaneViews())}restoreOldState(e,t){const i={properties:{graphics:e.state.graphics}};void 0!==e.data&&void 0!==e.metaInfo&&t&&(i.data={metaInfo:e.metaInfo,graphics:e.data.graphics}),this.restoreState(i,t)}applyPreferences(e){this._properties.mergePreferences(e)}metaInfo(){return(0,n.ensureNotNull)(this._metaInfo)}async _requestAndProcessMetaInfo(){if(this._model.isSnapshot())return;const e=await(0,D.studyMetaInfoRepository)().findById({type:"java",studyId:"Sessions@tv-basicstudies"});this._destroyed||null===this._loadedGraphics&&(this._setMetaInfo(e),null!==this._metaInfo&&(this._studySource=new E.StudyDataSource(this._model.chartApi(),this._model.mainSeries().seriesSource(),"sessions_",this._metaInfo),this._createPaneViews(),this._studySource.dataCleared().subscribe(this,this.updateAllViews.bind(this,(0,H.sourceChangeEvent)(this.id()))),this._studySource.dataUpdated().subscribe(this,this.updateAllViews.bind(this,(0,H.sourceChangeEvent)(this.id()))),this._studySource.setInputs({}),this._processHibernate()))}_loadStudyGraphics(e){const t=e.backgrounds;if(void 0!==t){const e=t.findIndex((e=>"inSession"===e.styleId));-1!==e&&t.splice(e,1)}this._loadedGraphics=(0,V.loadStudyGraphics)(e)}_setMetaInfo(e){const t=e.graphics.backgrounds;void 0!==t&&void 0!==t.inSession&&delete t.inSession,this._metaInfo=e}_updateVisibleOfPreAndPostMarketBackground(e){const t=!(0,F.isRegularSessionId)(e.value());this._outOfSessionVisibilityProperty().setValue(t),this._preMarketVisibilityProperty().setValue(t),this._postMarketVisibilityProperty().setValue(t)}_clearData(){null!==this._studySource&&this._studySource.clearData()}_createPaneViews(){const e={doubleClickHandler:this._doubleClickHandler};(0,V.createGraphicsPaneViews)(this,this._model,e).then((e=>{this._paneViews=e,this._model.lightUpdate()}))}_onPropertiesChanged(){this._processHibernate(),this.updateAllViews((0,H.sourceChangeEvent)(this.id()))}
_processHibernate(){if(null!==this._studySource){const e=this._canBeHibernated(),t=this._isHibernated(),i=this._studySource.isStarted();!t&&e&&i?this._studySource.stop():!t||e||i||this._studySource.start()}}_canBeHibernated(){const e=this._model.mainSeries(),t=this._preMarketVisibilityProperty().value()&&this._postMarketVisibilityProperty().value()&&this._outOfSessionVisibilityProperty().value();return e.isDWM()||!t&&!this._vertLinesVisibleProperty().value()}_isHibernated(){return this._isStarted&&(null===this._studySource||!this._studySource.isStarted())}_outOfSessionVisibilityProperty(){return this._properties.childs().graphics.childs().backgrounds.childs().outOfSession.childs().visible}_preMarketVisibilityProperty(){return this._properties.childs().graphics.childs().backgrounds.childs().preMarket.childs().visible}_postMarketVisibilityProperty(){return this._properties.childs().graphics.childs().backgrounds.childs().postMarket.childs().visible}_vertLinesVisibleProperty(){return this._properties.childs().graphics.childs().vertlines.childs().sessBreaks.childs().visible}_removeDuplicateProperties(){this._properties.hasChild("properties")&&(this._properties.removeProperty("properties"),(0,I.saveDefaultProperties)(!0),this._properties.childChanged(null,""),(0,I.saveDefaultProperties)(!1))}_migrateOutOfSessionProperty(e){const t=e.graphics.backgrounds;if(void 0!==t){const i=t.outOfSession;i.color===(0,n.ensureDefined)(W.sessionsPreferencesDefault.graphics.backgrounds).outOfSession.color||"postMarket"in t||(e.graphics.backgrounds={...t,postMarket:{color:i.color,transparency:i.transparency,visible:i.visible},preMarket:{color:i.color,transparency:i.transparency,visible:i.visible}})}}}var G=i(28853),q=i(57898),$=i(97145),Y=i(83669),K=i(91280),Z=i(42226),X=i(39875),J=i(59224),Q=i(36174),ee=i(12812),te=i(49535),ie=i(42856),se=i(1722),re=i(29921),ne=i(80842),oe=i(98517);const ae=new Map([["price",e=>(0,ne.isPriceDataSource)(e)],["trading",e=>(0,S.isTrading)(e)],["drawing",e=>(0,S.isLineTool)(e)&&!(0,S.isTrading)(e)&&!e.isPhantom()],["drawingsForAllSymbols",e=>(0,S.isLineTool)(e)&&!(0,S.isTrading)(e)&&!e.isPhantom()],["phantom",e=>(0,S.isLineTool)(e)&&e.isPhantom()],["restRowSources",e=>!(0,S.isLineTool)(e)&&!(0,S.isTrading)(e)],["legendViewSources",e=>(0,ne.isPriceDataSource)(e)||(0,S.isStudyLineTool)(e)],["leftPriceScale",(e,t)=>"left"===ce(e,t)],["rightPriceScale",(e,t)=>"right"===ce(e,t)],["overlayPriceScale",(e,t)=>"overlay"===ce(e,t)]]),le=new Map([["price","visibleSorted"],["trading","visibleSorted"],["drawing","visibleSorted"],["drawingsForAllSymbols","allSorted"],["phantom","visibleSorted"],["restRowSources","visibleSorted"],["legendViewSources","visibleSorted"],["leftPriceScale","visibleSorted"],["rightPriceScale","visibleSorted"],["overlayPriceScale","visibleSorted"]]);function ce(e,t){const i=e.priceScale();return null===i?"overlay":t.priceScalePosition(i)}class he{constructor(e){this._groupedSources=new Map,this._sources=null,this._pane=e}clear(){this._groupedSources.clear(),this._sources=null}destroy(){this.clear()
}all(){return this._groupedSources.has("visibleSorted")||this._sortSources(),(0,n.ensureDefined)(this._groupedSources.get("visibleSorted"))}allIncludingHidden(){return this._groupedSources.has("allSorted")||this._sortSources(),(0,n.ensureDefined)(this._groupedSources.get("allSorted"))}allExceptSpecialSources(){if(!this._groupedSources.has("exceptSpecial")){const e=this.allIncludingHidden().filter((e=>!e.isSpeciallyZOrderedSource()));this._groupedSources.set("exceptSpecial",e)}return(0,n.ensureDefined)(this._groupedSources.get("exceptSpecial"))}tradingSources(){return this._getSourcesByGroupType("trading")}priceSources(){return this._getSourcesByGroupType("price")}lineSources(){return this._getSourcesByGroupType("drawing")}lineSourcesForAllSymbols(){return this._getSourcesByGroupType("drawingsForAllSymbols")}phantomSources(){return this._getSourcesByGroupType("phantom")}allExceptLineAndTradingSources(){return this._getSourcesByGroupType("restRowSources")}hitTestSources(){if(!this._groupedSources.has("hitTest")){const e=this.allExceptLineAndTradingSources().concat(this.lineSources());this._groupedSources.set("hitTest",e)}return(0,n.ensureDefined)(this._groupedSources.get("hitTest"))}generalSources(){if(!this._groupedSources.has("general")){const e=this.allExceptLineAndTradingSources().concat(this.lineSources());this._groupedSources.set("general",(0,oe.sortSources)(e))}return(0,n.ensureDefined)(this._groupedSources.get("general"))}leftPriceScalesSources(){return this._getSourcesByGroupType("leftPriceScale")}rightPriceScalesSources(){return this._getSourcesByGroupType("rightPriceScale")}overlayPriceScaleSources(){return this._getSourcesByGroupType("overlayPriceScale")}legendViewSources(){return this._getSourcesByGroupType("legendViewSources")}_getSourcesByGroupType(e){const t=(0,n.ensureDefined)(le.get(e));return this._groupedSources.has(t)?this._groupedSources.has(e)||this._groupSources(e):(this._sortSources(),this._groupSources(e)),(0,n.ensureDefined)(this._groupedSources.get(e))}_sortSources(){null===this._sources&&(this._sources=this._pane.dataSources());const e=(0,oe.sortSources)(this._sources),t=e.filter((e=>!(0,S.isLineTool)(e)||e.isActualSymbol()&&e.isActualCurrency()&&e.isActualUnit()));this._groupedSources.set("allSorted",e),this._groupedSources.set("visibleSorted",t)}_groupSources(e){const t=(0,n.ensureDefined)(le.get(e)),i=ae.get(e);if(void 0!==i){const s=(0,n.ensureDefined)(this._groupedSources.get(t)).filter((e=>i(e,this._pane)));this._groupedSources.set(e,s)}}}var de=i(15367),ue=i(34256),pe=i(78211),_e=i(76544),me=i(18611),ge=i(26512),fe=i(60521),ve=i(37160);function Se(e,t,i){const s=e.div(t).toNumber();return Math.abs(Math.round(s)-s)100)throw new Error("something wrong with base")}}}tickSpan(e,t,i){const s=0===this._base?0:1/this._base,r=Math.min(1e-14,(e-t)/1e3);let n=Math.pow(10,Math.max(0,Math.ceil((0,ve.log10)(e-t)))),o=0,a=this._integralDividers[0];for(;;){const e=(0,ve.greaterOrEqual)(n,s,r)&&n>s+r,t=(0,ve.greaterOrEqual)(n,i*a,r),l=(0,ve.greaterOrEqual)(n,1,r),c=new fe.Big(n).div(a),h=0===s||Se(c,s,r);if(!(e&&t&&l&&h))break;n=c.toNumber(),a=this._integralDividers[++o%this._integralDividers.length]}if(n<=s+r&&(n=s),n=Math.max(1,n),this._fractionalDividers.length>0&&(0,ve.equal)(n,1,r))for(o=0,a=this._fractionalDividers[0];;){const e=(0,ve.greaterOrEqual)(n,i*a,r)&&n>s+r,t=new fe.Big(n).div(a),l=0===s||Se(t,s,r);if(!e||!l)break;n=t.toNumber(),a=this._fractionalDividers[++o%this._fractionalDividers.length]}return n}}class Ce{constructor(e,t,i,s){this._marks=null,this._priceScale=e,this._base=t,this._coordinateToLogicalFunc=i,this._logicalToCoordinateFunc=s}base(){return this._base}setBase(e){if(e<0)throw new Error("base < 0");this._base=e}tickSpan(e,t,i=0){if(e{const o=r.tickSpan(e,t,n);return o>i?Math.min(o,s):s}),1/0);return o>0&&isFinite(o)?o:e-t}rebuildTickMarks(){this._marks=null}marks(){return null===this._marks&&(this._marks=this._rebuildTickMarksImpl()),this._marks}_fontHeight(){return this._priceScale.fontSize()}_tickMarkHeight(){return Math.ceil(2.5*this._fontHeight())}_rebuildTickMarksImpl(){const e=this._priceScale,t=[],i=e.mainSource();if(e.isEmpty()||null===i)return t;let s=i.firstValue();null===s&&(s=0);const r=e.height(),n=this._coordinateToLogicalFunc(r-1,s),o=this._coordinateToLogicalFunc(0,s),a=Math.max(n,o),l=Math.min(n,o);if(a===l)return t;let c=this.tickSpan(a,l),h=a%c;h+=h<0?c:0;const d=a>=l?1:-1;let u=null;const p=e.formatter();let _=NaN;for(let i=a-h;i>l;i-=c){i===_&&(c=this.tickSpan(a,l,c)),_=i;const r=this._logicalToCoordinateFunc(i,s);null!==u&&Math.abs(r-u){const e=this.mainSource();if(e&&e.model()){const t=e.model().paneForSource(e);t&&e.model().updatePane(t)}})),this._scalesProperties.subscribe(this,(()=>{this._marksCache=null})),this._properties.childs().lockScale.subscribe(this,this._updateResetAvailableValue),this._properties.childs().autoScale.subscribe(this,this._updateResetAvailableValue),this._updateResetAvailableValue(),this.setId((0,Q.randomHash)())}id(){return this._id}setId(e){this._id=e}isLog(){return this._properties.childs().log.value()}isPercentage(){return this._properties.childs().percentage.value()}isInverted(){return this._properties.childs().isInverted.value()}isIndexedTo100(){return this._properties.childs().indexedTo100.value()}isAutoScale(){return this._properties.childs().autoScale.value()&&!this.isLockScale()}isLockScale(){return this._properties.childs().lockScale.value()}isRegular(){return!this.isPercentage()&&!this.isLog()&&!this.isIndexedTo100()}properties(){return this._properties}height(){return this.m_height}setHeight(e){this.m_height!==e&&(this.m_height=e,this._invalidateInternalHeightCache(),this._marksCache=null)}internalHeight(){if(this._internalHeightCache)return this._internalHeightCache;const e=this.height()-this.topPixelMargin()-this.bottomPixelMargin();return this._internalHeightCache=e,e}fontSize(){return this._scalesProperties.childs().fontSize.value()}priceRange(){return this._makeSureItIsValid(),this.m_priceRange}setPriceRange(e,t,i){if(!(e instanceof ue.PriceRange))throw new TypeError("incorrect price range");const s=this.m_priceRange;if(!t&&ue.PriceRange.compare(s,e))return;const r=null!==this._maxPriceRange&&this._maxPriceRange.containsStrictly(e),n=null!==this._minPriceRange&&e.containsStrictly(this._minPriceRange)
;this.isLockScale()&&!t&&(r||n)||(this._marksCache=null,this.m_priceRange=e,i||this._priceRangeChanged.fire(s,e))}setMinPriceRange(e){this._minPriceRange=e}setMaxPriceRange(e){this._maxPriceRange=e}recalculatePriceRangeOnce(){this._recalculatePriceRangeOnce=!0}priceRangeShouldBeRecalculatedOnce(){if(!this._recalculatePriceRangeOnce||this.isLockScale())return!1;const e=this.mainSource();return null!==e&&e.priceRangeReady()}priceRangeChanged(){return this._priceRangeChanged}mode(){const e=this._properties.childs();return{autoScale:e.autoScale.value(),lockScale:e.lockScale.value(),percentage:e.percentage.value(),indexedTo100:e.indexedTo100.value(),log:e.log.value()}}setMode(e){const t={},i=this.mode(),s=this._properties.state();let r=null;void 0!==e.autoScale&&e.autoScale!==s.autoScale&&(t.autoScale=e.autoScale,this._setAutoScaleValueWithDependentProperties(e.autoScale)),void 0!==e.lockScale&&e.lockScale!==s.lockScale&&(t.lockScale=e.lockScale,this._setLockScaleValueWithDependentProperties(e.lockScale)),void 0!==e.percentage&&e.percentage!==s.percentage&&(t.percentage=e.percentage,this._setPercentageValueWithDependentProperties(e.percentage),this._invalidatedForRange.isValid=!1),void 0!==e.indexedTo100&&e.indexedTo100!==s.indexedTo100&&(t.indexedTo100=e.indexedTo100,this._setIndexedTo100ValueWithDependentProperties(e.indexedTo100),this._invalidatedForRange.isValid=!1),void 0!==e.log&&e.log!==s.log&&(t.log=e.log,this._setLogValueWithDependentProperties(e.log));const n=this._properties.childs();s.log&&!n.log.value()&&(this._canConvertPriceRangeFromLog(this.m_priceRange)?(r=this._convertPriceRangeFromLog(this.m_priceRange),null!==r&&this.setPriceRange(r)):n.autoScale.setValue(!0)),!s.log&&n.log.value()&&(r=this._convertPriceRangeToLog(this.m_priceRange),null!==r&&this.setPriceRange(r)),s.autoScale!==n.autoScale.value()&&n.autoScale.listeners().fire(n.autoScale,""),s.autoScaleDisabled!==n.autoScaleDisabled.value()&&n.autoScaleDisabled.listeners().fire(n.autoScaleDisabled,""),s.lockScale!==n.lockScale.value()&&n.lockScale.listeners().fire(n.lockScale,""),s.percentage!==n.percentage.value()&&(n.percentage.listeners().fire(n.percentage,""),this.updateFormatter()),s.indexedTo100!==n.indexedTo100.value()&&(n.indexedTo100.listeners().fire(n.indexedTo100,""),this.updateFormatter()),s.percentageDisabled!==n.percentageDisabled.value()&&n.percentageDisabled.listeners().fire(n.percentageDisabled,""),s.log!==n.log.value()&&n.log.listeners().fire(n.log,""),s.logDisabled!==n.logDisabled.value()&&n.logDisabled.listeners().fire(n.logDisabled,""),void 0===t.log&&void 0===t.percentage&&void 0===t.lockScale&&void 0===t.autoScale&&void 0===t.indexedTo100||this._modeChanged.fire(i,this.mode())}modeChanged(){return this._modeChanged}isEmpty(){return this._makeSureItIsValid(),0===this.m_height||!this.m_priceRange||this.m_priceRange.isEmpty()}canDetachSource(e){return this.m_dataSources.some((t=>t!==e&&(0,ne.isPriceDataSource)(t)&&!((0,G.isStudy)(t)&&t.isLinkedToSeries())))}updateAllViews(e){const t=this._getSourcesToUpdateViews()
;for(const i of t)i.updateAllViews(e)}logFormula(){return this._logFormula}state(){var e;const t=this._properties.childs();return{id:this._id,m_priceRange:this.isAutoScale()?null:(null===(e=this.priceRange())||void 0===e?void 0:e.serialize())||null,m_isAutoScale:this.isAutoScale(),m_isPercentage:t.percentage.value(),m_isIndexedTo100:t.indexedTo100.value(),m_isLog:t.log.value(),m_isLockScale:this.isLockScale(),m_isInverted:this.isInverted(),m_topMargin:this._margins.top,m_bottomMargin:this._margins.bottom,alignLabels:t.alignLabels.value(),logFormula:(0,se.clone)(this._logFormula)}}restoreState(e){let t=e.m_priceRange;if(void 0===t)throw new TypeError("invalid state");if(void 0===e.m_isAutoScale)throw new TypeError("invalid state");void 0!==e.id&&(this._id=e.id);const i={autoScale:e.m_isAutoScale};void 0!==e.m_isPercentage&&(i.percentage=e.m_isPercentage),void 0!==e.m_isIndexedTo100&&(i.indexedTo100=e.m_isIndexedTo100),void 0!==e.m_isLog&&(i.log=e.m_isLog),void 0!==e.m_isLockScale&&(i.lockScale=e.m_isLockScale),void 0!==e.m_isInverted&&this._properties.childs().isInverted.setValue(e.m_isInverted),this.setMode(i),t?(t instanceof ue.PriceRange||(t=new ue.PriceRange(t)),this.setPriceRange(t,!0)):this.clearPriceRange(),e.logFormula&&(this._logFormula=e.logFormula),void 0!==e.m_topMargin&&(this._margins.top=e.m_topMargin),void 0!==e.m_bottomMargin&&(this._margins.bottom=e.m_bottomMargin),void 0!==e.alignLabels&&this._properties.childs().alignLabels.setValue(e.alignLabels),this._mainSource=null,this._scaleSeriesOnly=!1}priceToLogical(e){return this.isLog()&&e?(0,pe.toLog)(e,this._logFormula):e}logicalToPrice(e){return this.isLog()?(0,pe.fromLog)(e,this._logFormula):e}priceToCoordinate(e,t){const i=this._priceToPercentOrIndexedTo100IfNeeded(e,t);return this._logicalToCoordinate(i)}coordinateToPrice(e,t){let i=this._coordinateToLogical(e);return this.isPercentage()?i=(0,pe.fromPercent)(i,t):this.isIndexedTo100()&&(i=(0,pe.fromIndexedTo100)(i,t)),i}mainSource(){if(null!==this._mainSource)return this._mainSource;let e;for(const t of this._priceDataSources){if(t instanceof _e.Series){e=t;break}e||(e=t)}return this._mainSource=e||null,this._correctedMarginsCache=null,this._mainSource}priceToCoordinateFn(e){this._makeSureItIsValid();const t=this.bottomPixelMargin(),i=(0,n.ensureNotNull)(this.priceRange()),s=i.minValue(),r=i.maxValue(),o=this.internalHeight()-1,a=this.isInverted(),l=o/(r-s),c=this.m_height,h=e=>{const i=t+l*(e-s);return a?i:c-1-i};return this.isPercentage()?t=>h((0,pe.toPercent)(t,e)):this.isIndexedTo100()?t=>h((0,pe.toIndexedTo100)(t,e)):this.isLog()?e=>h((0,pe.toLog)(e,this._logFormula)):e=>h(e)}pricesArrayToCoordinates(e,t,i){this._makeSureItIsValid();const s=this.bottomPixelMargin(),r=(0,n.ensureNotNull)(this.priceRange()),o=r.minValue(),a=r.maxValue(),l=this.internalHeight()-1,c=this.isInverted(),h=l/(a-o);void 0===i&&(i=e.length);const d=this.isPercentage(),u=this.isIndexedTo100(),p=this.isLog(),_=this.m_height;let m,g;for(let r=0;re?(0,pe.toLog)(e,this._logFormula):e),0===s.length)return;const h="open"in s[0],d="close"in s[0];if(null!==c)for(let e=0;e0){const t=(0,ge.unitConvertibleGroups)(d,p,e);l=(0,v.intersect)(l,new Set(t))}h+=1}if(null!==t)for(const i of this._priceDataSources){if(u.includes(i))continue;const c=i;if(!c.isUnitSource()||!c.isVisible())continue;const h=c.unit();if(null===h){t=null;break}s.add(h),d+=1;const p=(0,n.ensureNotNull)(c.symbolSource()),_=p.symbolInfo();if(null===_){t=null;break}if(l.size>0){const t=(0,ge.unitConvertibleGroups)(_,h,e);l=(0,v.intersect)(l,new Set(t))}if(r.set(h,e.name(h)),o.set(h,e.description(h)),u.includes(p)||(l=new Set),void 0===a)a=h;else if(null!==a&&a!==h){a=null;break}}if(void 0===t)if(0===h&&0===d)t=null;else{t={availableGroups:l,selectedUnit:a||null,units:s,originalUnits:i,symbolSourceCount:h,allUnitsAreOriginal:c,names:r,descriptions:o}}return this._unitCache={value:t,availableUnitsCount:e.size()},t}measureUnitId(e){if(null!==this._measureUnitIdCache&&e.size()===this._measureUnitIdCache.availableUnitsCount)return this._measureUnitIdCache.value;let t,i;const s=new Map,r=new Map,n=new Set;let o=0;const a=this._seriesLikeSources.filter(me.isActingAsSymbolSource);for(const l of a){if(!l.isVisible())continue;const a=l.measureUnitId();if(null===a){t=null;break}n.add(a),s.set(a,e.name(a)),r.set(a,e.description(a)),void 0===i?i=a:null!==i&&i!==a&&(i=null),o+=1}return void 0===t&&(t=0===o?null:{selectedMeasureUnitId:i||null,measureUnitIds:n,names:s,descriptions:r,symbolSourceCount:o}),this._measureUnitIdCache={value:t,availableUnitsCount:e.size()},t}setMargins(e){if(!(0,se.isNumber)(e.top)||!(0,se.isNumber)(e.bottom))throw new TypeError("invalid margin");if(e.top<0||e.top>30||e.bottom<0||e.bottom>30)throw new RangeError("invalid margin")
;this._margins.top===e.top&&this._margins.bottom===e.bottom||(this._margins=e,this._correctedMarginsCache=null,this._invalidateInternalHeightCache(),this._marksCache=null)}topMargin(){return this._correctedMargins().top}bottomMargin(){return this._correctedMargins().bottom}invalidateMargins(){this._correctedMarginsCache=null}topPixelMargin(){return this.isInverted()?this.bottomMargin()*this.height()+this._bottomPixelMargin:this.topMargin()*this.height()+this._topPixelMargin}bottomPixelMargin(){return this.isInverted()?this.topMargin()*this.height()+this._topPixelMargin:this.bottomMargin()*this.height()+this._bottomPixelMargin}marks(){return this.isEmpty()?(this._marksCache=null,[]):(null===this._marksCache&&(this._markBuilder.rebuildTickMarks(),this._marksCache=this._markBuilder.marks(),this._onMarksChanged.fire()),this._marksCache)}onMarksChanged(){return this._onMarksChanged}priceRangeInPrice(){if(this.isEmpty())return null;const e=this.mainSource();if(null===e)return null;const t=(0,n.ensureNotNull)(e.firstValue()),i=this.height();return{from:this.coordinateToPrice(i-1,t),to:this.coordinateToPrice(0,t)}}setPriceRangeInPrice(e){if(this.isPercentage()||this.isIndexedTo100())return;const t=this.isInverted(),i=t?this.bottomMargin():this.topMargin(),s=t?this.topMargin():this.bottomMargin(),r=this.isLog();let n=r?(0,pe.toLog)(e.from,this._logFormula):e.from,o=r?(0,pe.toLog)(e.to,this._logFormula):e.to;const a=o-n;n+=s*a,o-=i*a,this.setMode({autoScale:!1}),this.setPriceRange(new ue.PriceRange(n,o)),this._marksCache=null,this._onMarksChanged.fire()}hasMainSeries(){return this._hasSeries}getStudies(){return this.dataSources().filter(G.isStudy)}lastSourceRemoved(){return this._lastSourceRemoved}sourcesForAutoscale(){return this._mainSource&&this._scaleSeriesOnly!==this._scalesProperties.childs().scaleSeriesOnly.value()&&(this._sourcesForAutoscale=null),this._sourcesForAutoscale||(this._sourcesForAutoscale=this._recalculateSourcesForAutoscale()),this._sourcesForAutoscale}recalculatePriceRange(e){this._invalidatedForRange={visibleBars:e,isValid:!1}}internalHeightChanged(){return this._internalHeightChanged}orderedSources(){if(this._cachedOrderedSoruces)return this._cachedOrderedSoruces;let e=this.m_dataSources.slice();return e=(0,oe.sortSources)(e),this._cachedOrderedSoruces=e,this._cachedOrderedSoruces}invalidateSourcesCache(){this._cachedOrderedSoruces=null,this._sourcesToUpdateViews=null}startScale(e){var t,i;this.isEmpty()||this.isPercentage()||this.isIndexedTo100()||null!==this._scaleStartPoint||null!==this._priceRangeSnapshot||(this._scaleStartPoint=this.m_height-e,this._priceRangeSnapshot=null!==(i=null===(t=this.priceRange())||void 0===t?void 0:t.clone())&&void 0!==i?i:null)}scaleTo(e){if(this.isPercentage()||this.isIndexedTo100()||null===this._scaleStartPoint)return;this.setMode({autoScale:!1}),(e=this.m_height-e)<0&&(e=0);let t=(this._scaleStartPoint+.2*(this.m_height-1))/(e+.2*(this.m_height-1));const i=(0,n.ensureNotNull)(this._priceRangeSnapshot).clone();t=Math.max(t,.1),i.scaleAroundCenter(t),
this.setPriceRange(i)}endScale(){this.isPercentage()||this.isIndexedTo100()||null!==this._scaleStartPoint&&(this._scaleStartPoint=null,this._priceRangeSnapshot=null)}startTwoPointsScale(e,t){if(this.isEmpty()||this.isPercentage()||this.isIndexedTo100()||null!==this._twoPointsScaleStartPosition)return;const i=Math.min(e,t),s=Math.max(e,t);this._twoPointsScaleStartPosition={topLogical:this._coordinateToLogical(i),bottomLogical:this._coordinateToLogical(s)}}twoPointsScale(e,t){if(this.isPercentage()||this.isIndexedTo100()||null===this._twoPointsScaleStartPosition)return;this.setMode({autoScale:!1});const i=Math.min(e,t),s=Math.max(e,t),{topLogical:r,bottomLogical:n}=this._twoPointsScaleStartPosition,o=this.bottomPixelMargin(),a=this.internalHeight()-1,l=(this._invertedCoordinate(i)-o)/a,c=(n-r)/((this._invertedCoordinate(s)-o)/a-l);if(!Number.isFinite(c))return;const h=r-c*l,d=h+c;this.setPriceRange(new ue.PriceRange(this.priceToLogical(h),this.priceToLogical(d)))}endTwoPointsScale(){this._twoPointsScaleStartPosition=null}startScroll(e){var t,i;this.isAutoScale()||null===this._scrollStartPoint&&null===this._priceRangeSnapshot&&(this.isEmpty()||(this._scrollStartPoint=e,this._priceRangeSnapshot=null!==(i=null===(t=this.priceRange())||void 0===t?void 0:t.clone())&&void 0!==i?i:null))}scrollTo(e){if(this.isAutoScale())return;if(null===this._scrollStartPoint||null===this._priceRangeSnapshot)return;const t=this.priceRange();if(null===t)return;let i=e-this._scrollStartPoint;this.isInverted()&&(i*=-1);const s=i*(t.length()/(this.internalHeight()-1)),r=this._priceRangeSnapshot.clone();r.shift(s),this.setPriceRange(r,!0),this._marksCache=null}endScroll(){this.isAutoScale()||null!==this._scrollStartPoint&&(this._scrollStartPoint=null,this._priceRangeSnapshot=null)}clearPriceRange(){this.m_priceRange=null,this.recalculatePriceRangeOnce()}isVisible(){return this._isVisible}_addDataSourceImpl(e,t,i){if(t||-1===this.m_dataSources.indexOf(e)){if((0,ne.isPriceDataSource)(e)){if(void 0===i?this._priceDataSources.push(e):this._priceDataSources.splice(i,0,e),e.currencyChanged().subscribe(this,(()=>this._currencyCache=null)),e.unitChanged().subscribe(this,(()=>this._unitCache=null)),(0,me.isSymbolSource)(e)&&(this._seriesLikeSources.push(e),e.symbolResolved().subscribe(this,(()=>{this._currencyCache=null,this._unitCache=null,this._measureUnitIdCache=null})),e.isActingAsSymbolSource().subscribe(this._boundOnSourceIsActingAsSymbolSourceChanged),e instanceof _e.Series)){const t=e.properties();this._hasSeries||(t.childs().lockScale&&(this.setMode({lockScale:t.childs().lockScale.value()}),t.removeProperty("lockScale")),t.childs().pnfStyle.child("lockScale")&&t.childs().pnfStyle.removeProperty("lockScale")),this._hasSeries=!0}e.isSpeciallyZOrderedSource()||(this._sourcesThatAffectVisibility.push(e),e.properties().childs().visible.listeners().subscribe(this,this._onSourceVisibilityChanged))}(0,G.isStudy)(e)&&(e.onIsActualIntervalChange().subscribe(this,this._dropScaleCache),e.onHibernationStateChange().subscribe(this,this._dropScaleCache),
0===this._studiesCount&&(0,Pe.hideAllIndicators)().subscribe(this,this._dropScaleCache),this._studiesCount++),(0,S.isLineTool)(e)&&(0===this._drawingCount&&(0,Pe.hideAllDrawings)().subscribe(this,this._dropScaleCache),this._drawingCount++),this.m_dataSources.push(e),this._mainSource=null,this.mainSource()===e&&(this._correctedMarginsCache=null,this._internalHeightCache=null,this._marksCache=null),this._dropScaleCache(),this.updateFormatter(),this._initScaleProperties(),this.invalidateSourcesCache(),this._updateIsVisible()}}_recalculateSourcesForAutoscale(){this._mainSource&&(this._scaleSeriesOnly=this._scalesProperties.childs().scaleSeriesOnly.value());const e=this._scaleSeriesOnly&&this._hasSeries;return this.m_dataSources.filter((t=>!!(t.properties().visible.value()||t instanceof _e.Series)&&(e?t instanceof _e.Series:(0,G.isStudy)(t)?!t.isSourceHidden()&&t.isIncludedInAutoScale():t.isIncludedInAutoScale())))}_updateAutoScaleDisabledProperty(e){const t=this._properties.childs(),i=t.indexedTo100.value()||t.percentage.value()||t.lockScale.value();e?t.autoScaleDisabled.setValueSilently(i):t.autoScaleDisabled.setValue(i)}_setAutoScaleValueWithDependentProperties(e){const t=this._properties.childs();t.autoScale.setValueSilently(e),e&&(t.percentage.setValueSilently(!1),t.indexedTo100.setValueSilently(!1),t.lockScale.setValueSilently(!1),t.logDisabled.setValueSilently(!1)),this._updateAutoScaleDisabledProperty(!0)}_setLockScaleValueWithDependentProperties(e){const t=this._properties.childs();t.lockScale.setValueSilently(e),e&&(t.autoScale.setValueSilently(!1),t.percentage.setValueSilently(!1),t.indexedTo100.setValueSilently(!1),t.log.setValueSilently(!1)),t.percentageDisabled.setValueSilently(e),t.logDisabled.setValueSilently(e),this._updateAutoScaleDisabledProperty(!0)}_setPercentageValueWithDependentProperties(e){const t=this._properties.childs();t.percentage.setValueSilently(e),e&&(t.autoScale.setValueSilently(!0),t.log.setValueSilently(!1),t.lockScale.setValueSilently(!1),t.indexedTo100.setValueSilently(!1)),this._updateAutoScaleDisabledProperty(!0)}_setIndexedTo100ValueWithDependentProperties(e){const t=this._properties.childs();t.indexedTo100.setValueSilently(e),e&&(t.autoScale.setValueSilently(!0),t.log.setValueSilently(!1),t.lockScale.setValueSilently(!1),t.percentage.setValueSilently(!1)),this._updateAutoScaleDisabledProperty(!0)}_setLogValueWithDependentProperties(e){const t=this._properties.childs();t.log.setValueSilently(e),e&&(t.lockScale.setValueSilently(!1),t.percentage.setValueSilently(!1),t.indexedTo100.setValueSilently(!1)),this._updateAutoScaleDisabledProperty(!0)}_recalculatePriceRangeImpl(){const e=this._invalidatedForRange.visibleBars;if(null===e)return;let t=null;const i=this.sourcesForAutoscale(),s=this.isPercentage(),r=this.isIndexedTo100();let n=0,o=0;for(const a of i){if(!a.properties().visible.value())continue;const i=a.firstValue();if(null===i||s&&0===i)continue;const l=e.firstBar(),c=e.lastBar(),h=a.autoScaleInfo(l,c);let d=h.range;d&&(s?d=(0,pe.toPercentRange)(d,i):r&&(d=(0,
pe.toIndexedTo100Range)(d,i)),t=null===t?d:t.merge(d)),void 0!==h.topPixelMargin&&(n=Math.max(n,h.topPixelMargin)),void 0!==h.bottomPixelMargin&&(o=Math.max(o,h.bottomPixelMargin))}if((Math.abs(n-this._topPixelMargin)>0||Math.abs(o-this._bottomPixelMargin)>0)&&(this._bottomPixelMargin=o,this._topPixelMargin=n,this._marksCache=null,this._invalidateInternalHeightCache()),t){if(t.minValue()===t.maxValue()&&(t=new ue.PriceRange(t.minValue()-.5,t.maxValue()+.5)),this.isLog()){const e=this._convertPriceRangeFromLog(t),i=(0,pe.logFormulaForPriceRange)(e);if(!(0,pe.logFormulasAreSame)(i,this._logFormula)){const s=this._priceRangeSnapshot?this._convertPriceRangeFromLog(this._priceRangeSnapshot):null;this._logFormula=i,t=this._convertPriceRangeToLog(e),s&&(this._priceRangeSnapshot=this._convertPriceRangeToLog(s))}}this.setPriceRange(t)}else this.m_priceRange||(this.setPriceRange(new ue.PriceRange(-.5,.5)),this._logFormula=(0,pe.logFormulaForPriceRange)(null));this._invalidatedForRange.isValid=!0;const a=this.mainSource();null!==a&&this._recalculatePriceRangeOnce&&(this._recalculatePriceRangeOnce=!a.priceRangeReady())}_makeSureItIsValid(){this._invalidatedForRange.isValid||(this._invalidatedForRange.isValid=!0,this._recalculatePriceRangeImpl())}_invalidateInternalHeightCache(){this._internalHeightCache=null,this._internalHeightChanged.fire()}_coordinateToLogical(e){if(this._makeSureItIsValid(),this.isEmpty())return 0;const t=this._invertedCoordinate(e),i=(0,n.ensureNotNull)(this.priceRange()),s=i.minValue()+(i.maxValue()-i.minValue())*((t-this.bottomPixelMargin())/(this.internalHeight()-1));return this.logicalToPrice(s)}_logicalToCoordinate(e){if(this._makeSureItIsValid(),this.isEmpty())return 0;e=this.priceToLogical(e);const t=(0,n.ensureNotNull)(this.priceRange()),i=this.bottomPixelMargin()+(this.internalHeight()-1)*(e-t.minValue())/(t.maxValue()-t.minValue());return this._invertedCoordinate(i)}_convertPriceRangeFromLog(e){if(null===e)return null;const t=(0,pe.fromLog)(e.minValue(),this._logFormula),i=(0,pe.fromLog)(e.maxValue(),this._logFormula);return new ue.PriceRange(t,i)}_convertPriceRangeToLog(e){if(null===e)return null;const t=(0,pe.toLog)(e.minValue(),this._logFormula),i=(0,pe.toLog)(e.maxValue(),this._logFormula);return new ue.PriceRange(t,i)}_canConvertPriceRangeFromLog(e){if(null===e)return!1;const t=(0,pe.fromLog)(e.minValue(),this._logFormula),i=(0,pe.fromLog)(e.maxValue(),this._logFormula);return isFinite(t)&&isFinite(i)}_onSourceVisibilityChanged(){this._dropScaleCache(),this._updateIsVisible()}_dropScaleCache(){this._sourcesForAutoscale=null,this._currencyCache=null,this._unitCache=null,this._measureUnitIdCache=null}_updateIsVisible(){if(!Te)return void this._isVisible.setValue(!0);const e=this._sourcesThatAffectVisibility.some((e=>e.isVisible()));this._isVisible.setValue(e)}_invertedCoordinate(e){return this.isInverted()?e:this.height()-1-e}_initScaleProperties(){const e=this.isLockScale(),t=this.properties().childs();e&&(t.percentage.setValue(!1),t.indexedTo100.setValue(!1),t.log.setValue(!1),
t.autoScale.setValue(!1)),t.percentageDisabled.setValue(e),t.logDisabled.setValue(e),this._updateAutoScaleDisabledProperty(!1),t.percentage.value()&&(t.log.setValue(!1),t.indexedTo100.setValue(!1)),t.indexedTo100.value()&&(t.log.setValue(!1),t.percentage.setValue(!1))}_correctedMargins(){if(null===this._correctedMarginsCache){const e=this.mainSource();this._correctedMarginsCache=null!==e?e.correctScaleMargins(this._margins):this._margins}return this._correctedMarginsCache}_getSourcesToUpdateViews(){return this._sourcesToUpdateViews||(this._sourcesToUpdateViews=this.m_dataSources.filter((e=>!(0,S.isLineTool)(e)||e.isActualSymbol()&&e.isActualCurrency()))),this._sourcesToUpdateViews}_mainSourceFormatter(){const e=this.mainSource();return(null==e?void 0:e.formatter())||Me}_priceToPercentOrIndexedTo100IfNeeded(e,t){return this.isPercentage()?(0,pe.toPercent)(e,t):this.isIndexedTo100()?(0,pe.toIndexedTo100)(e,t):e}_onSourceIsActingAsSymbolSourceChanged(){this._dropScaleCache()}_onIsInvertedChanged(){this._marksCache=null,this._markBuilder.rebuildTickMarks()}_updateResetAvailableValue(){this._resetScaleAvailable.setValue(!this.isLockScale()&&!this.isAutoScale())}}var ke=i(29541),De=i(63009),Ee=i(53588),Ve=i(88732),Be=i(13333);const Re=[],Ne=[];class Oe{constructor(e){this._studies={},this._deferreds={},this._container=e,Re.push(e),Ne.push(this)}add(e,t){this._deferreds[e]&&(this._deferreds[e].resolve(t),delete this._deferreds[e]),this._studies[e]=t}get(e){return this._studies[e]?Promise.resolve(this._studies[e]):(this._deferreds[e]||(this._deferreds[e]=(0,p.createDeferredPromise)()),this._deferreds[e].promise)}reset(){const e=Re.indexOf(this._container);~e&&(Re.splice(e,1),Ne.splice(e,1))}static instance(e){const t=Re.indexOf(e);return~t?Ne[t]:new Oe(e)}}var Fe=i(99366);var We=i(4949),He=i(2823),ze=i(53086),Ue=i(78856),je=i(44010),Ge=i(87440),qe=i(16410);const $e=O.enabled("clear_price_scale_on_error_or_empty_bars"),Ye=(0,J.getLogger)("Chart.Pane");function Ke(e,t,i){e.setMargins({top:t,bottom:i})}const Ze="chart.pane";class Xe{constructor(e,t,i,s){this.m_dataSources=[],this._sourceWatchedValuesSubscriptions=new Map,this.m_mainDataSource=null,this._cachedOrderedSources=new he(this),this._sourcesById=new Map,this._priceSourcesById=new Map,this._sourcePropertiesChanged=new q.Delegate,this._sourcesZOrderChanged=new q.Delegate,this._tagsChanged=new q.Delegate,this._stretchFactor=1e3,this._isInInsertManyDataSourcesState=!1,this._lastLineDataSourceZOrder=null,this._rightPriceScales=[],this._leftPriceScales=[],this._lockedPriceScale=null,this._currentPriceScaleRatio=null,this._onPriceScalesChanged=new q.Delegate,this._isRecalculatingScales=!1,this._priceDataSources=[],this._symbolSources=[],this._lollipopDataSources=[],this._symbolSourceResolved=new q.Delegate,this._symbolSourceResolvingActive=new $.WatchedValue(!1),this._bulkActions={activeCounter:0},this._height=0,this._width=0,this._sizeChanged=new q.Delegate,this._dataSourcesCollectionChanged=new q.Delegate,this._symbolSourceCollectionChanged=new q.Delegate,
this._priceSourcesCollectionChanged=new q.Delegate,this._maximized=new $.WatchedValue(!1),this._collapsed=new $.WatchedValue(!1),this._resetPriceScalesAvailable=new $.WatchedValue(!1),this._destroyed=new q.Delegate,this._executionsPositionController=null,this._seriesDisplayError=null,this._onPriceScaleIsVisibleChanged=()=>{this._model.fullUpdate()},this._recalcSymbolSourceResolvingActive=()=>{for(const e of this._symbolSources)if(e.symbolResolvingActive().value())return void this._symbolSourceResolvingActive.setValue(!0);this._symbolSourceResolvingActive.setValue(!1)},this._onSymbolSourceCollectionChanged=()=>{0===this._bulkActions.activeCounter?this._symbolSourceCollectionChanged.fire():this._bulkActions.symbolSourceCollectionChanged=!0},this._onSeriesDisplayError=e=>{if(null!==e){for(const e of this._leftPriceScales)e.clearPriceRange();for(const e of this._rightPriceScales)e.clearPriceRange()}},this._updateResetPriceScalesAvailableValue=()=>{const e=e=>e.resetScaleAvailable().value(),t=this._leftPriceScales.some(e)||this._rightPriceScales.some(e);this._resetPriceScalesAvailable.setValue(t)},this._priceScaleSelectionStrategy=(0,te.createPriceScaleSelectionStrategy)(i.properties().childs().priceScaleSelectionStrategyName.value()),this._id=null!=s?s:(0,Q.randomHashN)(6),this._timeScale=e,this.m_mainDataSource=null,this._properties=t,this._model=i,i.properties().childs().priceScaleSelectionStrategyName.subscribe(null,(e=>{this._priceScaleSelectionStrategy=(0,te.createPriceScaleSelectionStrategy)(e.value()),this._priceScaleSelectionStrategy.apply(this)})),this._timeScale.barSpacingChanged().subscribe(this,(()=>{this.m_mainDataSource===this._model.mainSeries()&&this._recalculatePriceScaleByScaleRatio(this.m_mainDataSource.priceScale())})),$e&&(this._seriesDisplayError=(0,F.getSeriesDisplayErrorWV)(this._model.mainSeries()),this._seriesDisplayError.subscribe(this._onSeriesDisplayError)),t.childs().topMargin.subscribe(this,this._updateMargins),t.childs().bottomMargin.subscribe(this,this._updateMargins),this._updateMargins()}destroy(){var e;this._properties.childs().topMargin.unsubscribeAll(this),this._properties.childs().bottomMargin.unsubscribeAll(this),this._model.properties().childs().priceScaleSelectionStrategyName.unsubscribeAll(this),this._timeScale.barSpacingChanged().unsubscribeAll(this),this._leftPriceScales.concat(this._rightPriceScales).forEach((e=>{e.modeChanged().unsubscribeAll(this),e.priceRangeChanged().unsubscribeAll(this),e.internalHeightChanged().unsubscribeAll(this),e.isVisible().unsubscribe(this._onPriceScaleIsVisibleChanged),e.resetScaleAvailable().unsubscribe(this._updateResetPriceScalesAvailableValue)}));for(const e of this.m_dataSources)this.removeSourceFromPriceScale(e),e.destroy&&e.destroy();null===(e=this._seriesDisplayError)||void 0===e||e.destroy(),this._destroyed.fire()}id(){return this._id}bulkActionMacro(e){const t=this._bulkActions;t.activeCounter+=1,e(),t.activeCounter-=1,0===t.activeCounter&&(this._dataSourcesCollectionChanged.fire(),
t.symbolSourceCollectionChanged&&(this._symbolSourceCollectionChanged.fire(),t.symbolSourceCollectionChanged=!1),t.priceSourcesCollectionChanged&&(this._priceSourcesCollectionChanged.fire(),t.priceSourcesCollectionChanged=!1))}defaultPriceScale(){var e,t;const i=null!==(t=null===(e=this.m_mainDataSource)||void 0===e?void 0:e.priceScale())&&void 0!==t?t:null;if(null!==i)return i;const s=this.properties().childs().axisProperties.state();return s.autoScale=!0,new Le(this._model.properties().childs().scalesProperties,s)}leftPriceScales(){return this._leftPriceScales}rightPriceScales(){return this._rightPriceScales}visibleLeftPriceScales(){var e;const t=this._model.priceScaleSlotsCount(),i=this._leftPriceScales.filter((e=>e.isVisible().value())),s=null===(e=this.mainDataSource())||void 0===e?void 0:e.priceScale();if(i.length>t.left&&(null==s?void 0:s.isVisible().value())){const e=(0,v.moveToHead)(i,s);return e.splice(t.left),e}return i}visibleRightPriceScales(){var e;const t=this._model.priceScaleSlotsCount(),i=this._rightPriceScales.filter((e=>e.isVisible().value())),s=null===(e=this.mainDataSource())||void 0===e?void 0:e.priceScale();if(i.length>t.right&&(null==s?void 0:s.isVisible().value())){const e=(0,v.moveToHead)(i,s);return e.splice(t.right),e}return i}clearSeries(e){const t=this._model.mainSeries();for(let i=this.m_dataSources.length-1;i>=0;i--)this.m_dataSources[i]===t&&this._removeSourceFromCollections(i,e)}sourcesByGroup(){return this._cachedOrderedSources}dataSourceForId(e){return this._sourcesById.get(e)||null}changeSourceId(e,t){var i;e===this._model.mainSeries()&&(null===(i=(0,ee.getPersistentLogger)())||void 0===i||i.addPersistentLogEntry(`changeSourceId for series from ${e.id()} to ${t}`,J.LOGLEVEL.INFO,Ze)),(0,n.assert)(this.hasDataSource(e));const s=e.id();e.setId(t),this._sourcesById.delete(s),this._sourcesById.set(t,e),(0,ne.isPriceDataSource)(e)&&(this._priceSourcesById.delete(s),this._priceSourcesById.set(t,e))}movePriceScale(e,t,i){const s=this.priceScalePosition(e);if(s!==t)this.removePriceScale(e),this._placePriceScale(e,t,i),e.invalidateMargins(),this._invalidateSourcesCache();else if(void 0!==i&&"overlay"!==s){const t="left"===s?this._leftPriceScales:this._rightPriceScales,r=t.indexOf(e);t.splice(r,1),t.splice(i,0,e)}}mainDataSource(){return this.m_mainDataSource}isEmpty(){return null===this.m_mainDataSource}recalculatePriceScale(e,t){if(!e)return;const i=e.sourcesForAutoscale();if((e.isAutoScale()||e.priceRangeShouldBeRecalculatedOnce())&&i&&i.length>0&&!this.timeScale().isEmpty()){const t=this.timeScale().visibleBarsStrictRange();e.recalculatePriceRange(t)}e.updateAllViews(t)}onSourceTagsChanged(){this._tagsChanged.fire()}insertDataSource(e,t,i,s){e.setZorder(i),t||(s=!1,t=this.findSuitableScale(e)),this._addSourceToCollections(e);let r=!1;e===this.model().mainSeries()?(this.m_mainDataSource=this.model().mainSeries(),r=!0):null===this.m_mainDataSource&&(0,ne.isPriceDataSource)(e)&&(this.m_mainDataSource=e,r=!0),s||t.addDataSource(e,this._isInInsertManyDataSourcesState),e.setPriceScale(t),
t.invalidateMargins(),e.onTagsChanged&&e.onTagsChanged().subscribe(this,this.onSourceTagsChanged),r&&this._processMainSourceChange(),this._tagsChanged.fire(),(0,ne.isPriceDataSource)(e)&&this.recalculatePriceScale(t,(0,H.sourceChangeEvent)(e.id())),this._invalidateSourcesCache()}addDataSource(e,t,i){let s=e.zorder();i||((0,S.isLineTool)(e)&&!e.isSpeciallyZOrderedSource()?(s=null!==this._lastLineDataSourceZOrder?this._lastLineDataSourceZOrder+1:this.newLineToolZOrder(),this._isInInsertManyDataSourcesState&&(this._lastLineDataSourceZOrder=s)):(0,G.isStudy)(e)&&!e.isSpeciallyZOrderedSource()&&(s=this.newStudyZOrder())),this.insertDataSource(e,t,s)}removeDataSource(e,t,i,s){const r=this.m_dataSources.indexOf(e);if(-1===r)return void Ye.logDebug("removeDataSource: invalid data source");this._removeSourceFromCollections(r,!!i),e!==this.m_mainDataSource||t||(this.m_mainDataSource=null);const n=e.priceScale();s||this.removeSourceFromPriceScale(e),e.onTagsChanged&&e.onTagsChanged().unsubscribe(this,this.onSourceTagsChanged),(0,ne.isPriceDataSource)(e)&&!t&&this._processMainSourceChange(),this._tagsChanged.fire(),n&&(0,ne.isPriceDataSource)(e)&&this.recalculatePriceScale(n,(0,H.sourceChangeEvent)(e.id())),this._invalidateSourcesCache()}hasDataSource(e){return this._sourcesById.has(e.id())}hasPriceDataSource(e){return this._priceSourcesById.has(e.id())}dataSources(){return this.m_dataSources}priceDataSources(){return this._priceDataSources}lollipopDataSources(){return this._lollipopDataSources}symbolSources(){return this._symbolSources}replaceSource(e,t,i){const s=this.m_mainDataSource===e,r=e.zorder(),n=null==i?void 0:i.replaceSource(e,t);this.insertDataSource(t,i,r,n),this.removeDataSource(e,s,void 0,n),this._sourcesById.set(t.id(),t),(0,ne.isPriceDataSource)(t)&&this._priceSourcesById.set(t.id(),t),s&&(this.m_mainDataSource=t,this._processMainSourceChange())}findSuitableScale(e,t,i){return this._priceScaleSelectionStrategy.findSuitableScale(this,e,t,i)}createNewPriceScaleIfPossible(){return this._priceScaleSelectionStrategy.createNewPriceScaleIfPossible(this)}canCreateNewPriceScale(){return this._priceScaleSelectionStrategy.canCreateNewPriceScale(this)}isOverlay(e){const t=e.priceScale();return null===t||"overlay"===this.priceScalePosition(t)}recalculate(e){this._leftPriceScales.forEach((t=>this.recalculatePriceScale(t,e))),this._rightPriceScales.forEach((t=>this.recalculatePriceScale(t,e)));for(const t of this.m_dataSources)this.isOverlay(t)&&!(0,S.isLineTool)(t)&&this.recalculatePriceScale(t.priceScale(),e);this.updateAllViews(e),this._model.updatePane(this)}updateAllViews(e){for(const t of this.m_dataSources)t.updateAllViews(e);for(const t of this.model().customSources())t.updateViewsForPane(this,e)}updateLollipopViews(e){}priceScalePosition(e){return this._leftPriceScales.includes(e)?"left":this._rightPriceScales.includes(e)?"right":"overlay"}createPriceScaleAtPosition(e,t){const i=this.properties().childs().axisProperties.state();i.autoScale=!0;const s=new Le(this.model().properties().childs().scalesProperties,i)
;return s.setHeight(this.height()),Ke(s,this._defaultTopMargin(),this._defaultBottomMargin()),this._placePriceScale(s,e,t),s}removePriceScale(e){e.modeChanged().unsubscribeAll(this),e.priceRangeChanged().unsubscribeAll(this),e.internalHeightChanged().unsubscribeAll(this),e.isVisible().unsubscribe(this._onPriceScaleIsVisibleChanged),e.resetScaleAvailable().unsubscribe(this._updateResetPriceScalesAvailableValue),e===this._lockedPriceScale&&(this._lockedPriceScale=null,this._currentPriceScaleRatio=null);const t=this._leftPriceScales.indexOf(e);-1!==t&&(this._leftPriceScales[t].invalidateMargins(),this._leftPriceScales.splice(t,1));const i=this._rightPriceScales.indexOf(e);if(-1!==i&&(this._rightPriceScales[i].invalidateMargins(),this._rightPriceScales.splice(i,1)),null===e.mainSource()){const t=e.dataSources().length;0!==t&&Ye.logError("Invalid priceScale state: empty mainSource but non-empty data sources="+t)}this._onPriceScalesChanged.fire(),this._updateResetPriceScalesAvailableValue()}priceScaleIndex(e,t){switch(t){case"left":return this.leftPriceScales().indexOf(e);case"right":return this.rightPriceScales().indexOf(e)}}move(e,t,i){const s=e.priceScale();this.removeSourceFromPriceScale(e),t.addDataSource(e),e.setPriceScale(t),t.invalidateMargins(),this._processMainSourceChange(),this._invalidateSourcesCache(),e.isIncludedInAutoScale()&&(null!==s&&this.recalculatePriceScale(s,(0,H.sourceChangeEvent)(e.id())),this.recalculatePriceScale(t,(0,H.sourceChangeEvent)(e.id()))),this._onPriceScalesChanged.fire()}setZOrders(e){e.forEach(((e,t)=>{t.setZorder(e)})),this._invalidateSourcesCache(),0===this._bulkActions.activeCounter&&this._dataSourcesCollectionChanged.fire(),this.model().lightUpdate()}isMainPane(){return this.hasDataSource(this.model().mainSeries())}isLast(){const e=this.model().panes();return e[e.length-1]===this}newStudyZOrder(){return(0,De.newStudyZOrder)(this._priceDataSources)}newLineToolZOrder(e){return(0,De.newLineToolZOrder)(this.m_dataSources,e)}model(){return this._model}containsMainSeries(){return this._sourcesById.has(this.model().mainSeries().id())}applyPriceScaleRatio(e,t){var i;null!==this._lockedPriceScale&&this._lockedPriceScale!==e||this._currentPriceScaleRatio===t||!this.isMainPane()||null===this._lockedPriceScale&&e!==(null===(i=this.mainDataSource())||void 0===i?void 0:i.priceScale())||(this._setNewPriceRangeByScaleRatio(e,t,this._mainSourceVisiblePriceRange(e),!0,!0),null!==this._lockedPriceScale?this._tryToApplyNewPriceScaleRatio():e.isLog()||this.model().mainSeriesScaleRatioPropertyOnChanged())}sendToBack(e){const t=this.sourcesByGroup().allExceptSpecialSources();this._batchReorder(e,t[0],De.moveBeforeSource)}bringToFront(e){const t=this.sourcesByGroup().allExceptSpecialSources();this._batchReorder(e,t[t.length-1],De.moveAfterSource)}sendBackward(e){const t=this.sourcesByGroup().allIncludingHidden(),i=t.indexOf(e[0]);if(0===i)this.bringToFront(e);else{const s=t[i-1];this.insertBefore(e,s)}}bringForward(e){const t=this.sourcesByGroup().allExceptSpecialSources(),i=t.indexOf(e[e.length-1])
;if(i===t.length-1)this.sendToBack(e);else{const s=t[i+1];this.insertAfter(e,s)}}insertAfter(e,t){this._batchReorder(e,t,De.moveAfterSource)}insertBefore(e,t){this._batchReorder(e,t,De.moveBeforeSource)}maximized(){return this._maximized}collapsed(){return this._collapsed}getPriceScaleById(e){const t=this.m_dataSources.find((t=>{var i;return(null===(i=t.priceScale())||void 0===i?void 0:i.id())===e}));return void 0===t?null:t.priceScale()}priceScaleSelectionStrategy(){return this._priceScaleSelectionStrategy}setPriceScaleSelectionStrategy(e){this._priceScaleSelectionStrategy=e,e.apply(this)}findTargetPriceAxisViews(e,t,i,s){if((0,f.isDataSource)(e)&&this.model().paneForSource(e)!==this)return[];const r=e.priceScale();if(t===r)return i;if(null===r)return[];if("overlay"===this.priceScalePosition(r))return t===this.defaultPriceScale()?i:[];const n=this.priceScalePosition(t);if(n!==this.priceScalePosition(r))return[];const o="left"===n?this.leftPriceScales():this.rightPriceScales();return o.indexOf(t)1}properties(){return this._properties}setPriceAutoScale(e,t){e.setMode({autoScale:t}),this.timeScale().isEmpty()||this.recalculatePriceScale(e,(0,H.viewportChangeEvent)())}state(e,t,i,s,r,n){var o,a;const l={sources:[],mainSourceId:null===(o=this.m_mainDataSource)||void 0===o?void 0:o.id(),stretchFactor:this._stretchFactor,leftAxisesState:[],rightAxisesState:[],overlayPriceScales:{},priceScaleRatio:this._currentPriceScaleRatio,isCollapsed:this._collapsed.value()},c=new Map,h=e=>{if(c.has(e))return c.get(e);let o=null;const a=i&&!e.isSavedInStudyTemplates()||!e.state||(0,S.isLineTool)(e)&&n||!e.isSavedInChart(Boolean(t))||!(o=e.state(t,r))||s&&(0,S.isLineTool)(e)&&e.isActualSymbol&&!e.isActualSymbol()||e.isPhantom()?null:o;return c.set(e,a),a};if(e){l.sources=[];for(let e=0;enull!==c.get(e),u=e=>!n||!(0,S.isLineTool)(e);l.leftAxisesState=this._leftPriceScales.map((e=>({state:e.state(),sources:e.dataSources().filter(d).filter(u).map((e=>e.id()))}))),l.rightAxisesState=this._rightPriceScales.map((e=>({state:e.state(),sources:e.dataSources().filter(d).filter(u).map((e=>e.id()))}))),l.overlayPriceScales={};for(const e of this.m_dataSources)if(this.isOverlay(e)&&e.isSavedInChart(Boolean(t))){const t=e.priceScale();l.overlayPriceScales[e.id()]=null!==(a=null==t?void 0:t.state())&&void 0!==a?a:null}return l}restoreState(e){var t;const{state:i,withData:s,version:r,seriesId:o=this._model.mainSeries().id(),settingsMigration:a={},contentOverrides:l,restoreSilently:c,reason:h=0}=e;null===(t=(0,ee.getPersistentLogger)())||void 0===t||t.addPersistentLogEntry(`Restoring pane with seriesId ${o}`,J.LOGLEVEL.INFO,Ze),i.stretchFactor&&(this._stretchFactor=i.stretchFactor);const d={};if(i.sources){const e=i.sources.filter((e=>{var t
;return!!e&&("MainSeries"===e.type||(!(null===(t=e.points)||void 0===t?void 0:t.some((e=>null===e.time_t||!isFinite(e.time_t))))||(Ye.logNormal("Dropped invalid "+e.type+". Reason: non-numeric point time"),!1)))})),t=e.findIndex(Ee.isMainSeriesState);-1!==t&&this.model().mainSeries().setObsoleteZOrder(e[t].zorder),r<3&&(0,De.reorderDataSourcesStateZOrder)(e);const n=-1!==this.m_dataSources.indexOf(this._model.mainSeries());this.clearSeries(Boolean(c)),this.m_mainDataSource=null,n&&this._addSourceToCollections(this._model.mainSeries(),c),(()=>{const t=e.find((e=>e.id===i.mainSourceId));if(void 0===t)return void Ye.logWarn("There is no main source with id "+i.mainSourceId+", total sources="+e.length);if(!window.TradingView[t.type]||!(0,de.isLineToolName)(t.type))return void Ye.logNormal("The type of main source is not line tool - fix is unnecessary");let s=null;for(const i of e)if(!window.TradingView[t.type]||!(0,de.isLineToolName)(i.type)){if(null!==s)return void Ye.logWarn("Pane contains more than 1 possibly main sources - auto fix cannot be applied");s=i}if(null===s)return void Ye.logWarn("Pane contains only line tools - possible we need to remove this pane?");const r=i.mainSourceId;let n=0;i.mainSourceId=s.id,e.forEach((e=>{e.ownerSource===r&&(e.ownerSource=null==s?void 0:s.id,n+=1)})),Ye.logNormal("Auto fix broken pane is applied, changed line tools="+n+", changed from="+r+" to="+s.id)})();for(const t of e)if("study_Sessions"===t.type){this.model().sessions().restoreOldState(t,s);break}for(const t of e)"study_Sessions"!==t.type&&(null===this._model.dataSourceForId(t.id)||"MainSeries"===t.type?(d[t.id]=t.ownerSource,(0,Ee.isMainSeriesState)(t)?this._restoreMainSeries(t,s,n,a,l,c):(0,Ee.isStudyState)(t)?this.restoreStudy(t,s,o,a,c,h):(0,Ee.isLineToolState)(t)?(t.state&&(t.state.zOrderVersion=2),this.restoreLineTool(t,s,void 0,c)):"ChartEventsSource"===t.type&&this._restoreSpecialSource(t,s,c)):Ye.logError("Duplicate id while restoring pane: "+t.type+","+t.id))}const u=new Set,p=(e,t)=>{e.priceScale()!==t&&(this.removeSourceFromPriceScale(e),e.setPriceScale(t),t.addDataSource(e))},_=(e,t,i)=>{if(u.has(e))return;u.add(e);const s=i.m_showSymbolLabels;void 0!==s&&e===this.model().mainSeries()&&this.model().properties().childs().scalesProperties.childs().showSymbolLabels.setValue(s),this._model.children(e,!0).forEach((e=>_(e,t,i))),p(e,t)},m=e=>{const t=(0,R.defaults)("chartproperties").paneProperties.axisProperties,i=new Le(this.model().properties().childs().scalesProperties,t);return i.restoreState(e.state),i.setHeight(this._height),e.sources.forEach((e=>{const s=this.dataSourceForId(e);s&&_(s,i,t)})),0===i.dataSources().length?null:i},g=e=>e.map(m).filter((e=>null!==e));let f;if(i.leftAxisesState)f=g(i.leftAxisesState);else{const e=m({state:i.leftAxisState,sources:i.leftAxisSources});f=null!==e?[e]:[]}let v;if(this._leftPriceScales.slice().forEach((e=>this.removePriceScale(e))),this._leftPriceScales=[],f.forEach((e=>this._placePriceScale(e,"left"))),i.rightAxisesState)v=g(i.rightAxisesState);else{const e=m({
state:i.rightAxisState,sources:i.rightAxisSources});v=null!==e?[e]:[]}this._rightPriceScales.slice().forEach((e=>this.removePriceScale(e))),this._rightPriceScales=[],v.forEach((e=>this._placePriceScale(e,"right"))),this._currentPriceScaleRatio=i.priceScaleRatio||i.leftPriceScaleRatio||i.rightPriceScaleRatio||null;const y=new Map;for(const e of this.m_dataSources){if(u.has(e))continue;let t;if(i.overlayPriceScales&&i.overlayPriceScales[e.id()]){let s=i.overlayPriceScales[e.id()];y.has(null==s?void 0:s.id)?t=y.get(null==s?void 0:s.id):(s=(0,n.ensure)(s),t=new Le(this._model.properties().childs().scalesProperties),t.setHeight(this._height),s.m_isAutoScale=!0,s.m_isLog=!1,s.m_isPercentage=!1,s.m_isLockScale=!1,t.restoreState(s),y.set(s.id,t))}else t=new Le(this._model.properties().childs().scalesProperties),t.setHeight(this._height);p(e,t)}for(const e of Object.keys(d)){const t=d[e],i=this.dataSourceForId(e);t&&i&&null===i.ownerSource()&&i.setOwnerSource(this.dataSourceForId(t))}if(i.mainSourceId&&!this.containsMainSeries()&&(this.m_mainDataSource=this.dataSourceForId(i.mainSourceId)),!this.m_mainDataSource)for(const e of this.m_dataSources)if((0,ne.isPriceDataSource)(e)){this.m_mainDataSource=e;break}for(const e of this.m_dataSources)(0,S.isLineTool)(e)?(e.ownerSource()||e.setOwnerSource(this.mainDataSource()),e.isFixed()&&e.restoreFixedPoint()):(0,G.isStudy)(e)&&!e.ownerSource()&&e.isLinkedToSeries()&&e.setOwnerSource(this.model().mainSeries());this._updateMargins(),this._cachedOrderedSources.clear()}onPriceScalesChanged(){return this._onPriceScalesChanged}setPaneSize(e){let t;switch(e){case"large":t=1;break;case"medium":t=.6;break;case"small":t=.3;break;case"tiny":t=.15;break;default:throw new Error("Unknown size enum value: "+e)}this._stretchFactor=1e3*t}stretchFactor(){return this._stretchFactor}setStretchFactor(e){this._stretchFactor=e}customSources(e){return this.model().customSources(e)}createDrawingsCaches(){re.ExecutionsPositionController.recreateOrderedByBarsSourcesCache(this)}clearDrawingCaches(){re.ExecutionsPositionController.clearOrderedByBarsSourcesCache()}executionsPositionController(){return this._executionsPositionController||(this._executionsPositionController=new re.ExecutionsPositionController(this)),this._executionsPositionController}width(){return this._width}height(){return this._height}setHeight(e){if(this._height!==e){this._height=e,this._leftPriceScales.forEach((t=>t.setHeight(e))),this._rightPriceScales.forEach((t=>t.setHeight(e)));for(let t=0;t(e.paneViews(this)||[]).some((e=>{const r=e.renderer(t,i);return r&&r.doesIntersectWithBox&&r.doesIntersectWithBox(s)}))))}logicalRectToPixels(e){const t=this.defaultPriceScale(),i=this.timeScale(),s=(0,n.ensureNotNull)((0,n.ensureNotNull)(t.mainSource()).firstValue()),r=t.priceToCoordinate(e.p1.price,s),a=i.indexToCoordinate(e.p1.index),l=t.priceToCoordinate(e.p2.price,s),c=i.indexToCoordinate(e.p2.index),h=new o.Point(Math.min(a,c),Math.min(r,l)),d=new o.Point(Math.max(a,c),Math.max(r,l));return(0,o.box)(h,d)}timeScale(){return this._timeScale}restoreLineTool(e,t,i,s,r){var o,a,l,c,h,d,u,p,_,m,g;delete e.state.lastUpdateTime,e.state.intervalsVisibilities=(0,We.mergeIntervalVisibilitiesDefaults)(e.state.intervalsVisibilities),i=void 0===i||i,Fe.LineToolElliott.migrateState(e),"LineToolGannComplex"!==(g=e).type||void 0!==g.version&&1!==g.version||(g.type="LineToolGannFixed"),Array.isArray(e.positionPercents)&&(e.positionPercents=e.positionPercents[0]);const f=e.type,v=e.id,y=e.state,b=i?e.zorder:this.newLineToolZOrder();(0,n.assert)((0,de.isLineToolName)(f),"invalid data source type:"+f+" (expected to be a Line Tool)");let w,C,P=null;if((0,Ee.isStudyLineToolState)(e)){P=this._model.studyVersioning();const t=P.patchPointsBasedStudyState(e);e=t;const i=t.metaInfo;Object.assign(i,ie.StudyMetaInfo.parseIdString(null==i?void 0:i.fullId));const s=P.updateMetaInfo(i)||i;C=(0,S.createStudyLineToolProperties)(f,i,s,y,P),w=(0,S.createLineTool)(f,this._model,C,s,!0)}else C=(0,S.createLineToolProperties)(f,y,this._model,!1),t?null===(o=C.child("fixedSize"))||void 0===o||o.setValue(!1):null===(a=C.child("fixedSize"))||void 0===a||a.setValue(!0),w=(0,S.createLineTool)(f,this._model,C,null,!0);w.setId(v),w.linkKey().setValue(e.linkKey||null);e.alertId&&w.canHasAlert();let x=null!==(l=e.indexes)&&void 0!==l?l:[];if(x=x.slice(0,null!==(h=null===(c=e.points)||void 0===c?void 0:c.length)&&void 0!==h?h:x.length),w.isFixed()?void 0!==e.positionPercents?w.restorePositionPercents(e.positionPercents):w.restorePositionPercents({x:.5,y:.5}):e.points&&w.restorePoints(e.points,x,t),w instanceof He.LineToolBarsPattern||w instanceof ze.LineToolCallout||w instanceof Ue.LineToolTrendAngle||w instanceof je.LineToolGhostFeed||w instanceof Ge.LineToolParallelChannel)null===(u=(d=w).restoreData)||void 0===u||u.call(d,e);else if(t&&(0,Ee.isStudyLineToolState)(e)&&w.restoreData){const t=e;P&&(t.graphics=P.patchPointsBasedStudyData(t.metaInfo,t.graphics)),
null===(p=w.restoreData)||void 0===p||p.call(w,t)}const T=null==e.version?1:e.version,I=null==w.version?1:w.version;if(T!==I&&(null===(m=(_=w).migrateVersion)||void 0===m||m.call(_,T,I,{pane:this,model:this._model,properties:C})),void 0!==b&&w.setZorder(b),r)(0,S.prepareLineToolPropertiesByOwnerSource)(w.properties(),r),w.setOwnerSource(r);else{const t=e.ownerSource?this.dataSourceForId(e.ownerSource):null;w.setOwnerSource(t)}return w.isFixed()&&w.restoreFixedPoint(),void 0!==e.userEditEnabled&&w.setUserEditEnabled(e.userEditEnabled),void 0!==e.isSelectionEnabled&&w.setSelectionEnabled(e.isSelectionEnabled),this._addSourceToCollections(w,s),this._cachedOrderedSources.clear(),w}restoreStudy(e,t,s,r,n,o){var a;if(t&&void 0===e.data&&void 0===e.nonSeriesData&&void 0===e.indexes)return Ye.logError("Cannot restore (skipping) study without data "+e.id+", "+e.metaInfo.id),null;const l=e.id,h=e.state,d=e.zorder;s=null!=s?s:this._model.mainSeries().id();const u=(null!==(a=e.parentSources)&&void 0!==a?a:e.ownerSource?[e.ownerSource]:[]).filter((e=>e!==s));let p=(0,se.clone)(e.metaInfo);if(Object.assign(p,ie.StudyMetaInfo.parseIdString(p.id)),function(e){return"Script$TV_EARNINGS@tv-scripting"===e||"Script$TV_DIVIDENDS@tv-scripting"===e||"Script$TV_SPLITS@tv-scripting"===e||"ESD$TV_EARNINGS@tv-scripting"===e||"ESD$TV_DIVIDENDS@tv-scripting"===e||"ESD$TV_SPLITS@tv-scripting"===e||"Earnings@tv-basicstudies"===e||"Dividends@tv-basicstudies"===e||"Splits@tv-basicstudies"===e||"BarSetContinuousRollDates@tv-corestudies"===e}(p.id)&&!t)return Ye.logNormal("Skipping study "+p.id),null;let _=h;const m=this._model.studyVersioning(),g=m.patchPropsStateAndMetaInfo(_,p,{oldShowStudyLastValueProperty:t&&!(null==r?void 0:r.showStudyLastValueProperty)});_=g.propsState,p=g.metaInfo;const f=new P.StudyStub(this._model,e,p.shortDescription);let v;f.setId(l),f.setZorder(d);let S=!1;const y=i=>{if(S&&this._model.dataSourceForId(l)!==f)return;f.setStatus({type:Be.StudyStatusType.Undefined});const s=i||new ie.StudyMetaInfo(p),r=Oe.instance(this._model),n=n=>{var a;const c=(0,x.prepareStudyPropertiesForLoadChart)(p,i,_,m),h=(0,G.createStudy)(this._model,c,n,s,void 0,o);if(h.setId(l),h.setOwnFirstValue(null!==(a=e.ownFirstValue)&&void 0!==a?a:null),e.customFields&&h.restoreStateCustomFields(e.customFields),t){const t=e,{data:i,nsData:s,indexes:r}=m.patchStudyData(p,t.data,t.nonSeriesData,t.indexes);h.restoreData(i,s,r)}this._model.replaceStudyStub(f,h)||(v=h),r.add(l,h)};if(u.length>0){const e=u.map((e=>r.get(e)));Promise.all(e).then(n)}else n([])};if(t)y(null);else{let e=null;0;const t=e=>{const t=m.updateMetaInfoAsync(e);t.sync?y(t.result):t.result.then(y).catch((e=>f.setFailed("error: "+e)))};e?e.then(t).catch((()=>f.setFailed(c.t(null,void 0,i(28523))))):t(p)}const b=null!=v?v:f;if(b){b.setZorder(d);const t=e.metaInfo.linkedToSeries?this._model.mainSeries():u.length?this.dataSourceForId(u[0]):null;b.setOwnerSource(t),this._addSourceToCollections(b,n),this._processMainSourceChange(),S=b===f}return this._cachedOrderedSources.clear(),b}
clipboardLineToolOwnerSource(e){const t=this.dataSourceForId(e);if(null!==t){const e=t.ownerSource();if(null!==e&&null!==e.firstValue())return e}const i=this.mainDataSource();if(null!==i&&null!==i.firstValue())return i;for(const e of this.dataSources())if((0,ne.isPriceDataSource)(e)&&null!==e.firstValue())return e;return null}realignLineTools(e){var t;let i=!1;for(const s of this.m_dataSources)!(0,S.isLineTool)(s)||void 0!==e&&(null===(t=null==s?void 0:s.ownerSource())||void 0===t?void 0:t.symbolSource())!==e&&(0,me.isActingAsSymbolSource)(e)||(s.realign(),s.updateAllViews((0,H.sourceChangeEvent)(s.id())),i=!0);return i&&this._invalidateSourcesCache(),i}startScalePrice(e,t){e.startScale(t)}scalePriceTo(e,t){e.scaleTo(t),this.updateAllViews((0,H.viewportChangeEvent)())}endScalePrice(e){e.endScale()}startScrollPrice(e,t){e.startScroll(t)}scrollPriceTo(e,t){e.scrollTo(t),this.updateAllViews((0,H.viewportChangeEvent)())}endScrollPrice(e){e.endScroll()}resetPriceScale(e){const t=this.timeScale().visibleBarsStrictRange();e.resetScaleAvailable().value()&&e.resetScale(),e.recalculatePriceRange(t),this.updateAllViews((0,H.viewportChangeEvent)())}resetPriceScalesAvailable(){return this._resetPriceScalesAvailable.readonly()}restorePriceScaleState(e,t){e.restoreState(t),this.updateAllViews((0,H.viewportChangeEvent)())}beginInsertManyLineDataSources(){this._isInInsertManyDataSourcesState=!0,this._lastLineDataSourceZOrder=null}endInsertManyLineDataSources(){this._isInInsertManyDataSourcesState=!1,this._lastLineDataSourceZOrder=null}removeSourceFromPriceScale(e){const t=e.priceScale();if(null!==t){const i=t.dataSources();i.indexOf(e)>=0&&t.removeDataSource(e),0===i.length&&this.removePriceScale(t)}}_invalidateSourcesCache(){this._cachedOrderedSources.clear(),this._leftPriceScales.forEach((e=>e.invalidateSourcesCache())),this._rightPriceScales.forEach((e=>e.invalidateSourcesCache()))}_processMainSourceChange(){let e=!1;if(null===this.m_mainDataSource)for(const t of this.m_dataSources)if((0,ne.isPriceDataSource)(t)&&!this.isOverlay(t)&&(!(0,G.isStudy)(t)||!t.isLinkedToSeries())){this.m_mainDataSource=t,e=!0;break}if(this.m_mainDataSource&&e){let e=this.m_dataSources.filter(S.isLineTool);e=(0,oe.sortSources)(e);for(const t of e)this.move(t,(0,n.ensureNotNull)(this.m_mainDataSource.priceScale()),!0)}else if(!this.m_mainDataSource||this.isOverlay(this.m_mainDataSource)&&0===this._nonOverlayPricesSourcesCount()){let e=null;if(this.m_dataSources.includes(this._model.mainSeries()))e=this._model.mainSeries();else for(const t of this.m_dataSources)if((0,ne.isPriceDataSource)(t)&&this.isOverlay(t)&&t.showInObjectTree()){e=t;break}if(null!==e){const t=this.m_mainDataSource===e;this.m_mainDataSource=e;const i=this.createNewPriceScaleIfPossible();if(t&&e===this._model.mainSeries()){const t=(0,n.ensureNotNull)(e.priceScale());this._model.children(e,!0).forEach((e=>{this.removeSourceFromPriceScale(e),i.addDataSource(e),e.setPriceScale(i)})),this.removePriceScale(t)}this.move(e,i,!0),this.recalculatePriceScale(e.priceScale(),(0,
H.globalChangeEvent)())}}}_addSourceToCollections(e,t){this.m_dataSources.push(e),this._sourcesById.set(e.id(),e),this._invalidateSourcesCache();const i=()=>{this._sourcePropertiesChanged.fire(e)};e.properties().subscribe(this,i),e.zOrderChanged().subscribe(this,(t=>this._sourcesZOrderChanged.fire(e,t))),(0,S.isLineTool)(e)&&(e.normalizedPointsChanged().subscribe(this,i),e.fixedPointChanged().subscribe(this,i),e.hasAlert().subscribe(i),e.sharingMode().subscribe(i),e.linkKey().subscribe(i),this._sourceWatchedValuesSubscriptions.set(e.id(),i));const s=(0,me.isSymbolSource)(e)?e:null;(0,ne.isPriceDataSource)(e)&&(this._priceSourcesById.set(e.id(),e),e.currencyChanged().subscribe(this,(()=>this._invalidateSourcesCache())),e.unitChanged().subscribe(this,(()=>this._invalidateSourcesCache())),this._priceDataSources.push(e),this._onPriceSourcesCollectionChanged(),null!==s&&(this._symbolSources.push(s),s.symbolResolved().subscribe(this,(()=>this._symbolSourceResolved.fire(e))),s.symbolResolvingActive().subscribe(this._recalcSymbolSourceResolvingActive),s.symbolHibernated().subscribe(this._onSymbolSourceCollectionChanged),this._recalcSymbolSourceResolvingActive(),this._onSymbolSourceCollectionChanged())),e.isMultiPaneAvailable()&&this.model().addMultiPaneSource(e),t||0!==this._bulkActions.activeCounter||this._dataSourcesCollectionChanged.fire()}_removeSourceFromCollections(e,t){const i=this.m_dataSources[e];i.properties().unsubscribeAll(this),i.zOrderChanged().unsubscribeAll(this),this.m_dataSources.splice(e,1),this._sourcesById.delete(i.id());const s=i.id();if((0,S.isLineTool)(i)&&(i.normalizedPointsChanged().unsubscribeAll(this),i.fixedPointChanged().unsubscribeAll(this),this._sourceWatchedValuesSubscriptions.has(s))){const e=this._sourceWatchedValuesSubscriptions.get(s);i.hasAlert().unsubscribe(e),i.linkKey().unsubscribe(e)}this._invalidateSourcesCache();const r=(0,me.isSymbolSource)(i)?i:null;(0,ne.isPriceDataSource)(i)&&(this._priceSourcesById.delete(i.id()),i.currencyChanged().unsubscribeAll(this),i.unitChanged().unsubscribeAll(this),(0,v.removeItemFromArray)(this._priceDataSources,i),this._onPriceSourcesCollectionChanged(),null!==r&&((0,v.removeItemFromArray)(this._symbolSources,r),r.symbolResolved().unsubscribeAll(this),r.symbolResolvingActive().unsubscribe(this._recalcSymbolSourceResolvingActive),r.symbolHibernated().unsubscribe(this._onSymbolSourceCollectionChanged),this._recalcSymbolSourceResolvingActive(),this._onSymbolSourceCollectionChanged())),i.isMultiPaneAvailable()&&this.model().removeMultiPaneSource(i),t||0!==this._bulkActions.activeCounter||this._dataSourcesCollectionChanged.fire()}_recalculatePriceScaleByScaleRatio(e){this.isMainPane()&&e===this._lockedPriceScale&&(null!==this._currentPriceScaleRatio?this._applyOldScaleRatioToPriceScale():this._tryToApplyNewPriceScaleRatio())}_defaultBottomMargin(){return.01*this.properties().childs().bottomMargin.value()}_defaultTopMargin(){return.01*this.properties().childs().topMargin.value()}_updateMargins(){
const e=this._defaultTopMargin(),t=this._defaultBottomMargin();for(const i of this._leftPriceScales)Ke(i,e,t);for(const i of this._rightPriceScales)Ke(i,e,t);for(const i of this.m_dataSources)if(this.isOverlay(i)){const s=i.priceScale();null!==s&&(Ke(s,e,t),this.recalculatePriceScale(s,(0,H.viewportChangeEvent)()))}for(const e of this._leftPriceScales)this.recalculatePriceScale(e,(0,H.viewportChangeEvent)());for(const e of this._rightPriceScales)this.recalculatePriceScale(e,(0,H.viewportChangeEvent)());this.updateAllViews((0,H.viewportChangeEvent)())}_batchReorder(e,t,i){i(this.sourcesByGroup().allExceptSpecialSources(),e,t),this._invalidateSourcesCache(),this._dataSourcesCollectionChanged.fire(),this.model().fullUpdate()}_placePriceScale(e,t,i){if("overlay"===t)return void e.invalidateMargins();const s="left"===t?this._leftPriceScales:this._rightPriceScales,r=void 0===i?s.length:i;s.splice(r,0,e),e.modeChanged().subscribe(this,this._onPriceScaleModeChanged.bind(this,e)),e.internalHeightChanged().subscribe(this,this._recalculatePriceScaleByScaleRatio.bind(this,e)),e.priceRangeChanged().subscribe(this,this._recalculateTimeScaleByScaleRatio.bind(this,e)),e.priceRangeChanged().subscribe(this,this._onPriceScaleSetMinMaxPriceRange.bind(this,e)),e.isVisible().subscribe(this._onPriceScaleIsVisibleChanged),e.resetScaleAvailable().subscribe(this._updateResetPriceScalesAvailableValue),e.isLockScale()&&((0,n.assert)(null===this._lockedPriceScale),this._lockedPriceScale=e,this._currentPriceScaleRatio=null),e.invalidateMargins(),this._onPriceScalesChanged.fire(),this._updateResetPriceScalesAvailableValue()}_onPriceScaleModeChanged(e,t,i){if(i.lockScale&&(this._lockedPriceScale!==e&&null!==this._lockedPriceScale&&this._lockedPriceScale.setMode({lockScale:!1}),this._lockedPriceScale=e,this._currentPriceScaleRatio=(0,ke.scaleRatio)(this.timeScale(),e)),t.lockScale&&!i.lockScale&&(this._lockedPriceScale=null,this._currentPriceScaleRatio=null),t.percentage===i.percentage&&t.indexedTo100===i.indexedTo100)return;const s=this.timeScale().visibleBarsStrictRange();null!==s&&(e.recalculatePriceRange(s),e.updateAllViews((0,H.viewportChangeEvent)()))}_applyOldScaleRatioToPriceScale(){this._isRecalculatingScales||null===this._currentPriceScaleRatio||null===this._lockedPriceScale||(this._isRecalculatingScales=!0,this._setNewPriceRangeByScaleRatio(this._lockedPriceScale,this._currentPriceScaleRatio,this._mainSourceVisiblePriceRange(this._lockedPriceScale)),this._isRecalculatingScales=!1)}_setNewPriceRangeByScaleRatio(e,t,i,s,r){const n=(0,ke.priceRangeByScaleRatio)(e,this.timeScale().barSpacing(),t);e.setPriceRange(null!==n?n:i,s,r)}_applyOldScaleRatioToTimeScale(){this._isRecalculatingScales||null===this._currentPriceScaleRatio||(this._isRecalculatingScales=!0,this._setNewBarSpacingByScaleRatio(),this._isRecalculatingScales=!1)}_tryToApplyNewPriceScaleRatio(){const e=(0,n.ensureNotNull)(this._lockedPriceScale),t=(0,ke.scaleRatio)(this.timeScale(),e);this._currentPriceScaleRatio===t||e.isLog()||(this._currentPriceScaleRatio=t,
this.model().mainSeriesScaleRatioPropertyOnChanged())}_recalculateTimeScaleByScaleRatio(e){e===this._lockedPriceScale&&(null!==this._currentPriceScaleRatio?this._applyOldScaleRatioToTimeScale():this._tryToApplyNewPriceScaleRatio())}_setNewBarSpacingByScaleRatio(){const e=this.timeScale().getValidBarSpacing((0,ke.barSpacingByScaleRatio)((0,n.ensureNotNull)(this._lockedPriceScale),this._currentPriceScaleRatio));this.timeScale().isValidBarSpacing(e)&&this.timeScale().setBarSpacing(e)}_mainSourceVisiblePriceRange(e){const t=this.timeScale().visibleBarsStrictRange();return null!==t?(0,n.ensureNotNull)((0,n.ensureNotNull)(e.mainSource()).priceRange(t.firstBar(),t.lastBar())):new ue.PriceRange(-.5,.5)}_setMinMaxPriceRange(){const e=(0,n.ensureNotNull)(this._lockedPriceScale),t=(0,ke.priceRangeByScaleRatio)(e,this.timeScale().maxBarSpacing(),this._currentPriceScaleRatio),i=(0,ke.priceRangeByScaleRatio)(e,this.timeScale().minBarSpacing(),this._currentPriceScaleRatio);null!==t&&e.setMaxPriceRange(t),null!==i&&e.setMinPriceRange(i)}_onPriceScaleSetMinMaxPriceRange(e){e===this._lockedPriceScale&&this._setMinMaxPriceRange()}_onPriceSourcesCollectionChanged(){0===this._bulkActions.activeCounter?this._priceSourcesCollectionChanged.fire():this._bulkActions.priceSourcesCollectionChanged=!0}_nonOverlayPricesSourcesCount(){return this.m_dataSources.filter((e=>(!(0,G.isStudy)(e)||!e.isLinkedToSeries())&&((0,ne.isPriceDataSource)(e)&&e.showInObjectTree()&&!this.isOverlay(e)))).length}_restoreMainSeries(e,t,i,s,r,n){var o,a,l;const c=e.id,h=e.state;if(h&&r&&(h.style=null!==(o=r.style)&&void 0!==o?o:h.style,h.interval=r.interval||h.interval,r.symbol&&r.symbol!==h.symbol&&(h.symbol=r.symbol,delete h.currencyId,delete h.unitId)),h&&["candleStyle","hollowCandleStyle","haStyle"].forEach((e=>{h[e]&&(h[e].wickUpColor=h[e].wickUpColor||h[e].wickColor,h[e].wickDownColor=h[e].wickDownColor||h[e].wickColor)})),h&&(h.statusViewStyle=h.statusViewStyle||{},!h.statusViewStyle.symbolTextSource)){const e=!!h.statusViewStyle.showSymbolAsDescription;h.statusViewStyle.symbolTextSource=e?"ticker":"description"}if(h){h.extendedHours?h.sessionId="extended":h.sessionId||(h.sessionId="regular"),delete h.extendedHours,(0,qe.allChartStyles)().includes(h.style)||(h.style=2);const e=h.lineStyle.styleType;let t;delete h.lineStyle.styleType,0===e&&(t=14,h.lineWithMarkersStyle=(0,se.clone)(h.lineStyle)),1===e&&(t=15,h.steplineStyle=(0,se.clone)(h.lineStyle)),void 0!==t&&2===h.style&&(h.style=t)}if(!i){const e=this._model.mainSeries();this._model.mainPane().removeDataSource(e,!1,n),this._addSourceToCollections(e,n)}const d=this.model().mainSeries(),u=d.properties().childs();this.m_mainDataSource=d;const p=h&&h.style?h.style:void 0;if(6===p&&"ATR"===u.pnfStyle.childs().inputs.childs().style.value()?u.pnfStyle.childs().inputs.childs().style.setValueSilently("Traditional"):4===p&&"ATR"===u.renkoStyle.childs().inputs.childs().style.value()&&u.renkoStyle.childs().inputs.childs().style.setValueSilently("Traditional"),h&&!h.hasOwnProperty("showSessions")&&(h.showSessions=!1),
h&&void 0===h.settlementAsClose&&(h.settlementAsClose=!1),h&&t&&(h.showCountdown=!1),h&&(t&&!("showSeriesLastValueProperty"in s)&&"showLastValue"in h&&this._model.properties().childs().scalesProperties.childs().showSeriesLastValue.setValue(h.showLastValue),delete h.showLastValue),h){const t={haStyle:(0,F.chartStyleStudyId)(8,!0),renkoStyle:(0,F.chartStyleStudyId)(4,!0),pbStyle:(0,F.chartStyleStudyId)(7,!0),kagiStyle:(0,F.chartStyleStudyId)(5,!0),pnfStyle:(0,F.chartStyleStudyId)(6,!0),rangeStyle:(0,F.chartStyleStudyId)(11,!0),volFootprintStyle:(0,F.chartStyleStudyId)(17,!0)},i=this._model.studyVersioning(),s=d.styleStudyInfos(),r=Object.keys(Ve.SYMBOL_STRING_DATA);for(let n=0;nthis._right+.5?!0===t&&2:!0!==t||0}before(e){return ethis._right+.5}intersects(e){return!(this.after(e.left())||this.before(e.right()))}equals(e){return this._left===e.left()&&this._right===e.right()}static compare(e,t){return null===e||null===t?e===t:e.equals(t)}}const it=(0,J.getLogger)("Chart.TimePoints");function st(e,t){return null===e||null===t?e===t:e.firstIndex===t.firstIndex&&e.lastIndex===t.lastIndex}class rt{constructor(){this._zoffset=0,this._items=[],this._range=new Y.WatchedObject(null,st)}clear(){this._zoffset=0,this._items=[],this._range.setValue(null)}size(){return this._items.length}range(){return this._range.readonly()}merge(e,t,i){const s=this._mergeImpl(e,t,i);return this._updateFirstAndLastIndex(),s}addTail(e,t){for(let i=t?1:0;ithis._items[this._items.length-1])return t?this._validOffsetToIndex(this._items.length-1):null
;for(let i=0;io){const i=e-o;if(i<500&&null!=t)return t(l,i);return l+i*c}return null}roughIndex(e,t=null){const i=this._items;if(!i.length||i.length<2)return null;const s=i.length-1,r=this._validOffsetToIndex(0),n=this._validOffsetToIndex(s),o=i[0],a=i[s];if(e>=o&&e<=a)return this.closestIndexLeft(e);const l=(a-o)/(n-r);if(ea){const i=e-a;let s=Math.trunc(i/l);if(s<500&&null!==t){const i=t(a,e);i.success&&(s=i.result)}return n+s}return null}closestIndexLeft(e){const t=this._items;if(!t.length)return null;if(Number.isNaN(e))return null;let i=t.length-1;if(e>=t[i])return this._validOffsetToIndex(i);let s=0;const r=t[s];if(es+1;){const r=s+i>>1,n=t[r];if(n>e)i=r;else{if(!(nthis._zoffset&&e+t>0)return it.logError("merge: when the first time point index is updated, we should fill the time points starting from the first one"),[];if(0===this._items.length)return this._items=i.slice(),this._zoffset=t,[{change:"rebuild",index:this._validOffsetToIndex(0)}];const s=e+this._zoffset;if(s<0){const r=Math.abs(s);if(i.lengththis._items.length){const e=o-this._items.length;for(let t=n;t=this._options.duration?1:t/this._options.duration}}class yt{constructor(){this._baseIndex=0}setBaseIndex(e){this._baseIndex=e}indexToTotalWeight(e){return e-this._baseIndex}totalWeightToIndex(e){return this._baseIndex+e}indexRangeToWeights(e,t,i){const s=e-this._baseIndex;return[{left:s-.5,center:s,right:s+.5,timePointIndex:e}]}}const bt={preserveBarSpacing:!1,lockVisibleTimeRangeOnResize:!1,rightBarStaysOnScroll:!0,minBarSpacing:.5},wt=O.enabled("low_density_bars"),Ct=wt?1:2,Pt=(0,J.getLogger)("Chart.TimeScale");class xt{constructor(e,t){this._width=0,this._widthChanged=new q.Delegate,this._rightOffset=10,
this._rightOffsetChanged=new q.Delegate,this._maxRightOffsetChanged=new q.Delegate,this._defaultRightOffset=new $.WatchedValue(10),this._defaultRightOffsetPercentage=new $.WatchedValue(5),this._usePercentageRightOffset=new $.WatchedValue(!1),this._lastDefaultRightOffset=void 0,this._baseIndex=null,this._leftEdgeIndex=null,this._barSpacingChanged=new q.Delegate,this._barSpacing=6,this._visibleBars=at.invalid(),this._visibleBarsInvalidated=!0,this._visibleBarsChanged=new q.Delegate,this._logicalRangeChanged=new q.Delegate,this._points=new rt,this._tickMarks=new lt.Tickmarks,this._onScroll=new q.Delegate,this._resetDelegate=new q.Delegate,this._scrollStartPoint=null,this._scaleStartPoint=null,this._commonTransitionStartState=null,this._formattedBySpan=new Map,this._requestingMoreData=!1,this._requestedTickmarksCount=0,this._endOfData=!1,this._lockBarsAndLogicalRangeEvents=!1,this._timeout=void 0,this._prevRO=void 0,this._resetAvailable=new $.WatchedValue(!1),this._pointWeights=new yt,this._weightedPointsCache=[],this._options=(0,Qe.deepExtend)({},bt,t),this._model=e,this._scalesProperties=e.properties().childs().scalesProperties,this._defaultRightOffset.subscribe((()=>{this._usePercentageRightOffset.setValue(!1),this._defaultRightOffsetOptionsUpdated()})),this._defaultRightOffsetPercentage.subscribe((e=>{if(e>=100||e<0){const t=Math.max(0,Math.min(e,99));this._defaultRightOffsetPercentage.setValue(t)}else this._usePercentageRightOffset.setValue(!0),this._defaultRightOffsetOptionsUpdated()})),this._usePercentageRightOffset.subscribe((()=>{this._defaultRightOffsetOptionsUpdated()})),this._options.preserveBarSpacing&&(this._barSpacing=this._scalesProperties.childs().barSpacing.value()||6),this._barSpacingChanged.subscribe(this,this._maxRightOffsetOnChanged),this._barSpacingChanged.subscribe(this,this._updateResetAvailableValue),this._rightOffsetChanged.subscribe(this,this._updateResetAvailableValue),this._widthChanged.subscribe(this,this._maxRightOffsetOnChanged),this._updateResetAvailableValue()}destroy(){this._barSpacingChanged.unsubscribeAll(this),this._barSpacingChanged.destroy(),this._widthChanged.unsubscribeAll(this),this._widthChanged.destroy()}isEmpty(){return 0===this._width||!this.canNormalize()}canNormalize(){return this._points.size()>0}update(e,t,i,s){this._visibleBarsInvalidated=!0,i.length>0&&this._points.merge(e,t,i),this._tickMarks.merge(s),this.correctOffset()}addTail(e,t,i){this._tickMarks.removeTail(t);const s=e.params,r=(0,n.ensureDefined)(this._tickMarks.maxIndex)+(i?0:1);for(let e=0;e0&&(i*=this._width/e.width)),this._tryToUpdateBarSpacing(this._barSpacing,i),this.correctOffset(),this._usePercentageRightOffset.value()&&(this._rightOffset=this.percentsToBarIndexLength(this._defaultRightOffsetPercentage.value())),this._rightOffsetChanged.fire(this._rightOffset)}marks(){if(this.isEmpty())return null;const e=this._barSpacing,t=5*((this._scalesProperties.childs().fontSize.value()||0)+4),i=Math.round(t/e),s=(0,n.ensureNotNull)(this.visibleBarsStrictRange()),r=Math.max(s.firstBar(),s.firstBar()-i),o=Math.max(s.lastBar(),s.lastBar()-i),a=this._tickMarks.build(e,t),l=[];for(const e of a){if(!(r<=e.index&&e.index<=o))continue;const t=this._tickMarks.indexToTime(e.index);null!==t&&l.push({coord:this.indexToCoordinate(e.index),label:this.formatLabel(t,e.span),span:e.span,major:e.label>=ct.DAY_SPAN})}return l}visibleBarsStrictRange(){return this._visibleBarsInvalidated&&(this._visibleBarsInvalidated=!1,this._updateVisibleBars()),this._visibleBars.strictRange()}visibleBarsStrictRangeChanged(){return this._visibleBarsChanged}visibleStrictDataRange(e){const t=this.visibleBarsStrictRange();if(null===t)return null;const i=e.search(t.firstBar(),gt.PlotRowSearchMode.NearestRight),s=e.search(t.lastBar(),gt.PlotRowSearchMode.NearestLeft);return null===i||null===s?null:new et.BarsRange(i.index,s.index)}visibleExtendedDataRange(e,t){const i=this.visibleBarsStrictRange();if(null===i)return null;let s=1===t?null:e.search(i.firstBar()-1,gt.PlotRowSearchMode.NearestLeft),r=0===t?null:e.search(i.lastBar()+1,gt.PlotRowSearchMode.NearestRight);return null===s&&(s=e.search(i.firstBar(),gt.PlotRowSearchMode.NearestRight)),null===r&&(r=e.search(i.lastBar(),gt.PlotRowSearchMode.NearestLeft)),null===s||null===r?null:new et.BarsRange(s.index,r.index)}logicalRangeChanged(){return this._logicalRangeChanged}tickMarks(){return this._tickMarks}points(){return this._points}width(){return this._width}setWidth(e,t){if(!Number.isFinite(e)||e<=0)return void Pt.logWarn(`setWidth: invalid argument: ${e}`);if(this._width===e)return
;const i=this._usePercentageRightOffset.value()&&this._rightOffset>0?this.barIndexLengthToPercents(this._rightOffset):-1;if(this._visibleBarsInvalidated=!0,(t||this._options.lockVisibleTimeRangeOnResize)&&this._width){const t=this._barSpacing*e/this._width;this._tryToUpdateBarSpacing(this._barSpacing,t)}else this._width&&this.setBarSpacing(this._barSpacing);if(null!==this._leftEdgeIndex){if((0,n.ensureNotNull)(this.visibleBarsStrictRange()).firstBar()<=this._leftEdgeIndex){const t=this._width-e;this._rightOffset-=Math.round(t/this._barSpacing)+1}}this._width=e,this._widthChanged.fire(e);const s=this._rightOffset;i>0?this._rightOffset=this.percentsToBarIndexLength(i):this.correctOffset(),this._rightOffset!==s&&this._rightOffsetChanged.fire(this._rightOffset),this._requestMoreData()}setLeftEdgeFix(e){this._leftEdgeIndex=e;const t=this.visibleBarsStrictRange();if(null===t)return;const i=t.firstBar()-e;if(i<0){const e=this._rightOffset-i-1;this.scrollToOffsetAnimated(e,500)}}indexToCoordinate(e){if(this.isEmpty())return 0;const t=this.baseIndex(),i=this._pointWeights.indexToTotalWeight(t+this._rightOffset+.5)-this._pointWeights.indexToTotalWeight(e);return this._width-i*this._barSpacing}indexToUserTime(e){return this._tickMarks.indexToTime(e)}timePointToIndex(e,t){switch(t){case 0:return this._points.indexOf(e,!1);case 1:return this._points.closestIndexLeft(e);default:return this._points.indexOf(e,!0)}}indexToTimePoint(e){return this._points.valueAt(e)}timeToCoordinate(e){const t=this._points.closestIndexLeft(e);if(null===t)return null;const i=(0,n.ensureNotNull)(this._points.valueAt(t)),s=this.indexToCoordinate(t);if(s<=0||s>=this._width)return null;const r=this.barSpacing(),o=this.baseIndex(),a=s+(e-i)/((0,n.ensureNotNull)(this._points.valueAt(o))-(0,n.ensureNotNull)(this._points.valueAt(o-1)))*r+1;return a<=0||a>=this._width?null:a}barIndexesToCoordinates(e){const t=this._pointWeights.indexToTotalWeight(this.baseIndex()+this._rightOffset+.5);for(const i of e){const e=i.time,s=t-this._pointWeights.indexToTotalWeight(e);i.time=this._width-s*this._barSpacing}}fillBarBorders(e,t,i){var s,r;if(0===e.length)return;let o=null!==(s=null==t?void 0:t.startItemIndex)&&void 0!==s?s:0;const a=(null!==(r=null==t?void 0:t.endItemIndex)&&void 0!==r?r:e.length)-1;!0===i&&(o=(0,v.upperbound)(e,nt.UNPLOTTABLE_TIME_POINT_INDEX,((e,t)=>ep.timePointIndex)g=p.right+(i.timePointIndex-p.timePointIndex),m=g-.5,_=g-1;else for(f&&(_=d.left,m=d.center,g=d.right,f=!1);d.timePointIndexe{void 0!==t&&t(),this._requestMoreData()};if(e){const e=this._rightOffset,t=this.maxRightOffset();return t>0&&i>t&&(i=t),void this._model.setTimeScaleAnimation(new St({from:e,to:i,duration:1e3,easing:Je.easingFunc.easeInOutQuint,onFinish:s}))}this._visibleBarsInvalidated=!0,this._updateRightOffset(i),this._onScroll.fire(),s()}scrollToFirstBar(e=(()=>{})){this._model.gotoTime(new Date("1800-01-01").getTime()).then(e),this._onScroll.fire()}scrollToOffsetAnimated(e,t){if(!isFinite(e))throw new RangeError("offset is required and must be finite number");const i=void 0===t?400:t;if(!isFinite(i)||i<=0)throw new RangeError("animationDuration (optional) must be finite positive number");const s=this._rightOffset,r=Date.now(),n=()=>{this._visibleBarsInvalidated=!0;const t=(Date.now()-r)/i;if(t>=1)return this._updateRightOffset(e),this._visibleBarsInvalidated=!0,this._model.recalculateAllPanes((0,H.viewportChangeEvent)()),void this._model.lightUpdate();const o=s+(e-s)*t;this._updateRightOffset(o),this._model.recalculateAllPanes((0,H.viewportChangeEvent)()),setTimeout(n,20)};n()}defaultRightOffset(){return this._defaultRightOffset}rightOffsetDefaultValue(){return 10}defaultRightOffsetPercentage(){return this._defaultRightOffsetPercentage}usePercentageRightOffset(){return this._usePercentageRightOffset}barSpacing(){return this._barSpacing}setBarSpacing(e){Number.isFinite(e)?(e=this.getValidBarSpacing(e),this._tryToUpdateBarSpacing(this._barSpacing,e)&&(this.correctOffset(),this._options.preserveBarSpacing&&((0,I.saveDefaultProperties)(!0),this._scalesProperties.childs().barSpacing.setValue(this._barSpacing),(0,I.saveDefaultProperties)(!1)),this._model.recalculateAllPanes((0,H.viewportChangeEvent)()),this._model.lightUpdate())):Pt.logWarn(`setBarSpacing: invalid argument: ${e}`)}barSpacingChanged(){return this._barSpacingChanged}getValidBarSpacing(e){return null==e&&(e=this.barSpacing()),ethis.maxBarSpacing()?this.maxBarSpacing():e}isValidBarSpacing(e){return e>=this.minBarSpacing()&&e<=this.maxBarSpacing()}preserveBarSpacing(){return this._options.preserveBarSpacing}
normalizeBarIndex(e){let t=0,i=0;const s=this.baseIndex(),r=(0,n.ensureNotNull)(this._points.range().value()).firstIndex;return es?(t=(0,n.ensureNotNull)(this._points.valueAt(s)),i=e-s):(t=(0,n.ensureNotNull)(this._points.valueAt(e)),i=0),{time_t:t,offset:i}}denormalizeTimePoint(e){const t=this._points.indexOf(e.time_t,!1);if(null!==t)return t+e.offset}rightOffset(){return this._rightOffset}rightOffsetChanged(){return this._rightOffsetChanged}minRightOffset(){var e;const t=null===(e=this.points().range().value())||void 0===e?void 0:e.firstIndex,i=this._baseIndex;if(void 0===t||null===i)return null;if(null!==this._leftEdgeIndex){const e=this.width()/this._barSpacing;return this._leftEdgeIndex-i+e-1}return t-i-1+Ct}maxRightOffset(){return this.width()/this._barSpacing-Ct}maxRightOffsetChanged(){return this._maxRightOffsetChanged}onReset(){return this._resetDelegate}scrollStartPoint(){return this._scrollStartPoint}baseIndex(){return this._baseIndex||0}zoom(e,t,i){if(!Number.isFinite(e)||!Number.isFinite(t))return void Pt.logWarn(`zoom: invalid arguments: ${e}, ${t}, ${i}`);const s=this.rightOffset(),r=void 0!==i?!i:this._options.rightBarStaysOnScroll,n=r&&this.usePercentageRightOffset().value()&&s>=0,o=n?this.barIndexLengthToPercents(s):void 0,a=this.coordinateToIndex(e),l=this.barSpacing(),c=l+t*(l/10);this.setBarSpacing(c),r||this.setRightOffset(s-.5+(a-this.coordinateToFloatIndex(e))),n&&void 0!==o&&this.setRightOffset(this.percentsToBarIndexLength(o)),this._requestMoreData()}zoomToBarsRange(e,t){if(null!==this._leftEdgeIndex&&(e=Math.max(e,this._leftEdgeIndex)),t<=e)return;const i=this.baseIndex(),s=this._rightOffset;this._rightOffset=t-i;const r=e-.5,n=t+.5,o=Math.max(this._pointWeights.indexToTotalWeight(n)-this._pointWeights.indexToTotalWeight(r),Ct);this.setBarSpacing(this.width()/o),this._visibleBarsInvalidated=!0,this.correctOffset(),this._rightOffset!==s&&this._rightOffsetChanged.fire(this._rightOffset),this._requestMoreData()}coordinateToIndex(e){return Math.round(this.coordinateToFloatIndex(e))}coordinateToFloatIndex(e){const t=(e-this._baseIndexBarCenterCoordinate())/this._barSpacing,i=this._pointWeights.totalWeightToIndex(t);return Math.round(1e6*i)/1e6}coordinateToVisibleIndex(e){let t=this.coordinateToIndex(e);const i=this.visibleBarsStrictRange();return null===i||i.contains(t)||(t=Math.min(Math.max(i.firstBar(),t),i.lastBar())),t}canZoomIn(){return this.barSpacing()this._options.minBarSpacing}minBarSpacing(){return this._options.minBarSpacing}maxBarSpacing(){const e=this.width();return wt?e:e/Ct}minVisibleBarCount(){return Ct}resetRightOffset(){this.setRightOffset(this.targetDefaultRightOffset())}reset(){this._visibleBarsInvalidated=!0,this._points.clear(),this._scrollStartPoint=null,this._scaleStartPoint=null,this._clearCommonTransitionsStartState(),this._tickMarks.reset(),this._leftEdgeIndex=null,this._resetDelegate.fire(),this.disconnect()}resetAvailable(){
return this._resetAvailable.readonly()}disconnect(){this._requestingMoreData=!1,this._requestedTickmarksCount=0,this._endOfData=!1}setBaseIndex(e){Number.isFinite(e)?(this._visibleBarsInvalidated=!0,this._baseIndex=e,this._pointWeights.setBaseIndex(this._baseIndex),this.correctOffset()):Pt.logDebug(`setBaseIndex: invalid argument: ${e}`)}resetBaseIndex(){this._visibleBarsInvalidated=!0,this._baseIndex=null}setRightOffset(e){Number.isFinite(e)?(this._visibleBarsInvalidated=!0,this._updateRightOffset(e)):Pt.logWarn(`setRightOffset: invalid argument: ${e}`)}correctBarSpacing(){this.isEmpty()||this.points().size()e&&(this._rightOffset=e,this._visibleBarsInvalidated=!0);const t=this.minRightOffset();null!==t&&this._rightOffset=0&&this.setRightOffset(this.percentsToBarIndexLength(s))}endScale(){null!==this._scaleStartPoint&&(this._scaleStartPoint=null,this._clearCommonTransitionsStartState(),this._requestMoreData())}startScroll(e){null===this._scrollStartPoint&&null===this._commonTransitionStartState&&(this.isEmpty()||(this._scrollStartPoint=e,this._saveCommonTransitionsStartState()))}scrollTo(e){if(this._visibleBarsInvalidated=!0,null===this._scrollStartPoint)return;const t=(this._scrollStartPoint-e)/this.barSpacing(),i=(0,n.ensureNotNull)(this._commonTransitionStartState).rightOffset+t;this._updateRightOffset(i),this._onScroll.fire()}endScroll(){if(null===this._scrollStartPoint)return clearInterval(this._timeout),void(this._prevRO=void 0);this._scrollStartPoint=null,this._clearCommonTransitionsStartState(),this._requestMoreData(),
this._timeout=setInterval((()=>{this._prevRO!==this.rightOffset()&&(this._prevRO=this.rightOffset(),this._requestMoreData())}),100)}formatLabel(e,t){const i="24-hours"===pt.timeHoursFormatProperty.value()?t.toString():`${t}_ampm`;let s=this._formattedBySpan.get(i);return void 0===s&&(s=new ht((e=>this.formatLabelImpl(e,t))),this._formattedBySpan.set(i,s)),s.format(new Date(e))}formatLabelImpl(e,t){if(!(e&&e instanceof Date))return"incorrect time";const s=function(e,t){if(e===ct.MILLISECOND_SPAN&&t)return"TimeWithMilliseconds";if(e=0){const e=this._defaultRightOffsetPercentage.value(),t=this._usePercentageRightOffset.value()&&this._rightOffset>=0?Math.round(this.barIndexLengthToPercents(this._rightOffset)):-1;if(this._lastDefaultRightOffset!==e&&t===this._lastDefaultRightOffset){const t=this._barSpacing*(100-e)/(100-this._lastDefaultRightOffset);this._tryToUpdateBarSpacing(this._barSpacing,t)}}this.setRightOffset(this.targetDefaultRightOffset()),this._updateResetAvailableValue(),this._lastDefaultRightOffset=this._defaultRightOffsetPercentage.value()}_updateResetAvailableValue(){
this._resetAvailable.setValue(6!==this.barSpacing()||this.rightOffset()!==this.targetDefaultRightOffset())}}var Tt,It=i(34928),Mt=i(53741),At=i(83407),Lt=i(35588);class kt{constructor(e){this._onChanged=new q.Delegate,this._groups=[],this._groups=e||[],this._groups.forEach((e=>{e.onChanged().subscribe(null,(t=>this._onChanged.fire(e.id,t)))}))}groups(){return this._groups.filter((e=>e.isActualSymbol()))}groupsForAllSymbols(){return this._groups}createGroup(e,t,i){t=t||this._generateNextName();const s=new Lt.LineToolsGroup(e,t,i);this._groups.push(s),s.onChanged().subscribe(null,(e=>this._onChanged.fire(s.id,e)));const r={visibilityChanged:!1,lockedChanged:!1,isActualIntervalChanged:!1,affectedLineTools:e.map((e=>e.id()))};return this._onChanged.fire(s.id,r),s}addGroup(e){this._groups.push(e),e.onChanged().subscribe(null,(t=>this._onChanged.fire(e.id,t))),this._onChanged.fire(e.id)}removeGroup(e){const t=this._groups.findIndex((t=>t.id===e.id));this._groups.splice(t,1),this._onChanged.fire(e.id)}groupForId(e){return this._groups.find((t=>t.id===e))||null}groupForLineTool(e){return this._groups.find((t=>t.containsLineTool(e)))||null}removeLineTools(e){const t=new Set;this._groups.forEach((i=>{const s=e.filter(i.containsLineTool.bind(i));s.length&&(i.excludeLineTools(s),t.add(i.id))}));return this._groups.filter((e=>0===e.lineTools().length)).forEach((e=>this.removeGroup(e))),Array.from(t)}state(e){return{groups:(e?this._groups.filter((e=>e.isActualSymbol())):this._groups).map((e=>e.state()))}}onChanged(){return this._onChanged}fireChangedAll(){this._groups.forEach((e=>{this._onChanged.fire(e.id)}))}static fromState(e,t){const i=[];for(const s of t.groups){const t=Lt.LineToolsGroup.fromState(e,s);null!==t&&i.push(t)}return new kt(i)}_generateNextName(){const e=new Set(this.groups().map((e=>e.name().value())));for(let t=1;;t++){const i=`Group ${t}`,s=`Group_${t}`;if(!e.has(i)&&!e.has(s))return i}}}!function(e){e[e.Undefined=0]="Undefined",e[e.PointSelect=1]="PointSelect",e[e.AutoPlay=2]="AutoPlay",e[e.Pause=3]="Pause"}(Tt||(Tt={}));var Dt=i(41249),Et=i.n(Dt),Vt=i(60156);let Bt=null;function Rt(e){return Boolean(e.symbolInfo.timezone)&&Boolean(e.symbolInfo.session)}class Nt{constructor(e,t){var i,s;this._sourceTargetBarBuilder=null,this._cache=new Map,this._source=e,this._sourceSession=Vt.SessionInfo.fromState(e.session),this._target=t,this._targetSession=Vt.SessionInfo.fromState(t.session),this._isResolutionTheSame=T.Interval.isEqual(e.resolution,t.resolution)||T.Interval.isTicks(e.resolution)&&T.Interval.isTicks(t.resolution),this._isSessionTheSame=(i=e.symbolInfo,s=t.symbolInfo,i.timezone===s.timezone&&i.session===s.session&&i.session_holidays===s.session_holidays&&i.corrections===s.corrections),this._shouldCorrectTradingDay=T.Interval.isDWM(e.resolution)&&!this._isSessionTheSame}sourceTimeToTargetTime(e){if(this._isSessionTheSame&&this._isResolutionTheSame)return e;if(!Rt(this._source)||!Rt(this._target))return e;let t=this._cache.get(e);if(void 0===t){let i=1e3*e;if(this._shouldCorrectTradingDay){
let e=Et().utc_to_cal(this._sourceSession.timezone,i);e=this._sourceSession.spec.correctTradingDay(e);const t=new Date(e);Et().set_hms(t,0,0,0,0,this._sourceSession.timezone),i=t.valueOf()}const s=this._sourceTargetBuilder();s.moveTo(i);const r=s.indexOfBar(i);t=s.startOfBar(Math.max(0,r))/1e3,this._cache.set(e,t)}return t}_sourceTargetBuilder(){if(null===this._sourceTargetBarBuilder){const e=this._isSessionTheSame?this._targetSession:(null===Bt&&(Bt=new Vt.SessionInfo("Etc/UTC","24x7")),Bt);this._sourceTargetBarBuilder=(0,Vt.newBarBuilder)(this._target.resolution,this._targetSession,e)}return this._sourceTargetBarBuilder}}var Ot=i(18807),Ft=i(87095),Wt=i(36112),Ht=i(93613);function zt(e,t){return e.codet.code?1:0}class Ut{constructor(e){this._convertibleItems=e,this._idsToItems=new Map;for(const t of e)this._idsToItems.set(t.id,t)}convertible(e){return void 0!==this._idsToItems.get(e)}item(e){var t;return null!==(t=this._idsToItems.get(e))&&void 0!==t?t:null}size(){return this._convertibleItems.length}filterConvertible(e,t){const i=this._convertibleItems.filter(function(e,t){return i=>!e.has(i.id)&&t(i.id)}(e,t));return i.sort(zt),i}getItems(){return this._convertibleItems.map((e=>e.id))}}class jt{constructor(e){this._allGroups=new Set,this._idToName=new Map,this._idToDescription=new Map,this._groupedUnitIds=new Map,this._groupedUnits=new Map,this._groupById=new Map,this._size=0,this._units=e;for(const t in e)if(e.hasOwnProperty(t)){this._allGroups.add(t),this._groupedUnitIds.set(t,new Set(e[t].map((e=>e.id)))),this._groupedUnits.set(t,e[t]);for(const i of e[t])this._size++,this._idToName.set(i.id,i.name),this._idToDescription.set(i.id,i.description),this._groupById.set(i.id,t)}}unitsChanged(e){return this._units!==e}size(){return this._size}name(e){return this._idToName.get(e)||e}description(e){return this._idToDescription.get(e)||e}unitGroupById(e){return this._groupById.get(e)||null}allGroups(){return new Set(this._allGroups)}unitsByGroups(e){const t=[];return e.forEach((e=>{const i=this._groupedUnits.get(e);void 0!==i&&t.push({name:e,units:i})})),t}convertible(e,t){for(const i of t){const t=this._groupedUnitIds.get(i);if(void 0!==t&&t.has(e))return!0}return!1}}var Gt=i(50335);class qt{constructor(e){this._source=null,this._sourcePane=null,this._currentToolSupportsPhantomMode=!1,this._model=e}destroy(){this._source=null,this._sourcePane=null}source(){return this._source}onToolChanged(){this._removeSource();const e=this._model.currentTool();this._currentToolSupportsPhantomMode=(0,de.isLineToolName)(e)&&(0,S.supportsPhantomMode)(e)}onCursorPositionUpdated(){if(!this._currentToolSupportsPhantomMode)return;const e=this._model.crossHairSource();if(this._sourcePane!==e.pane&&this._removeSource(),null===e.pane||!(0,Gt.isNumber)(e.index)||!(0,Gt.isNumber)(e.price))return void this._removeSource();const t={index:e.index,price:e.price};null!==this._source?this._source.setPoint(0,t):(this._source=this._model.createLineTool(e.pane,t,this._model.currentTool(),void 0,null,0),this._sourcePane=e.pane)}
_removeSource(){null!==this._source&&(this._model.removeSource(this._source),this._source=null,this._sourcePane=null)}}var $t=i(17133),Yt=i(36147),Kt=i(18540);class Zt{constructor(){this._lastValue=null}align(e,t,i){this._lastValue=null;let s=e;if(!(0,Kt.magnetEnabled)().value())return s;const r=i.mainDataSource();if(null===r)return s;const o=r.model().mainSeries();if(r!==o)return s;const a=o.priceScale();if(a.isEmpty())return s;const l=function(e,t){const i=e.bars().valueAt(t);if(null===i)return;let s;if(null!==e.priceSource())s=[e.barFunction()(i)];else switch(e.style()){case 12:s=[i[2],i[3]];break;case 16:s=[i[2],i[4],i[3]];break;default:s=[i[1],i[2],i[3],i[4]]}return s}(o,t);if(!l)return s;const c=(0,n.ensure)(o.firstValue()),h=l.map((e=>({y:a.priceToCoordinate(e,c),price:e}))),d=a.priceToCoordinate(e,c);h.sort(((e,t)=>Math.abs(e.y-d)-Math.abs(t.y-d)));const u=h[0];return((0,Kt.magnetMode)().value()===Yt.MagnetMode.StrongMagnet||Math.abs(u.y-d)<50)&&(s=u.price,this._lastValue=s),s}lastValue(){return this._lastValue}resetLastValue(){this._lastValue=null}}var Xt=i(77475),Jt=i(14292),Qt=i(68441),ei=i(59590);class ti extends ei.BitmapCoordinatesPaneRenderer{constructor(){super(...arguments),this._data=null}setData(e){this._data=e}hitTest(e){return null}_drawImpl(e){if(null===this._data)return;const{context:t,verticalPixelRatio:i,horizontalPixelRatio:s,bitmapSize:r}=e,n=Math.max(1,Math.floor(s));t.lineWidth=n;const o=Math.ceil(r.height*i),a=Math.ceil(r.width*s);if(t.lineCap="butt",this._data.vertLinesVisible){t.strokeStyle=this._data.vertLinesColor,(0,Qt.setLineStyle)(t,this._data.vertLineStyle);for(const e of this._data.timeMarks){const i=Math.round(e.coord*s);(0,Qt.drawVerticalLine)(t,i,0,o)}}if(this._data.horzLinesVisible){t.strokeStyle=this._data.horzLinesColor,(0,Qt.setLineStyle)(t,this._data.horzLineStyle);for(const e of this._data.priceMarks){const s=Math.round(e.coord*i);(0,Qt.drawHorizontalLine)(t,s,0,a)}}}}class ii{constructor(e){this._renderer=new ti,this._pane=e}update(){}renderer(){const e=this._pane.defaultPriceScale(),t=this._pane.model().timeScale();if(e.isEmpty()||t.isEmpty())return null;const i=this._pane.model().properties().childs().paneProperties.childs(),s=t.marks(),r=i.gridLinesMode.value(),n={horzLinesVisible:"both"===r||"horz"===r,vertLinesVisible:"both"===r||"vert"===r,horzLinesColor:i.horzGridProperties.childs().color.value(),vertLinesColor:i.vertGridProperties.childs().color.value(),horzLineStyle:i.horzGridProperties.childs().style.value(),vertLineStyle:i.vertGridProperties.childs().style.value(),priceMarks:e.marks(),timeMarks:null!==s?s:[]};return this._renderer.setData(n),this._renderer}}class si extends Jt.DataSource{id(){return"grid"}paneViews(e){return[new ii(e)]}name(){return"Grid"}}var ri=i(42275);class ni extends ri.PriceAxisView{constructor(e,t,i,s){super(),this._source=e,this._pane=t,this._priceScale=i,this._priceProvider=s,this._properties=e.model().properties().childs().scalesProperties}setHitTestData(e){this._hitTestData=e}setXCoord(e){this._xCoord=e}additionalPadding(e){
return 0}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const s=this._priceScale,r=s.mainSource(),n=null!==r?r.firstValue():null;if(!this._isVisible()||s.isEmpty()||null===n)return;const o=this._currentPrice(s);if(null===o)return;i.background=(0,Ft.resetTransparency)(this._bgColor()),i.textColor=this.generateTextColor(i.background);const a=this.additionalPadding(s.fontSize());i.additionalPaddingTop=a,i.additionalPaddingBottom=a,i.coordinate=s.priceToCoordinate(o,n),e.text=s.formatPrice(o,n),e.visible=!0,t.visible=!0,t.hitTestData=this._hitTestData,t.xCoord=this._xCoord}_currentPrice(e){return this._priceProvider(e)}}class oi extends ni{additionalPadding(e){return 2/12*e}_isVisible(){const e=this._source.lockedPane();return this._properties.childs().showPriceScaleCrosshairLabel.value()&&(this._source.visible||null!==e)&&(null!=e?e:this._source.pane)===this._pane}_currentPrice(e){const t=Pe.crosshairLock.value();return null!==t&&1===t.type?this._pane===this._source.lockedPane()?t.price:null:super._currentPrice(e)}_bgColor(){const e=this._properties.childs();return this._source.model().dark().value()?e.crosshairLabelBgColorDark.value():e.crosshairLabelBgColorLight.value()}_updateRendererData(e,t,i){const s=t.visible;super._updateRendererData(e,t,i),this._source.isHovered()?t.backgroung=this._source.model().dark().value()?l.colorsPalette["color-cold-gray-600"]:l.colorsPalette["color-cold-gray-650"]:t.backgroung=void 0,s||(t.visible=s)}}class ai extends ni{_isVisible(){return null!==this._source.measurePane().value()}_bgColor(){return this._properties.childs().axisLineToolLabelBackgroundColorCommon.value()}}var li=i(43493),ci=(i(39347),i(10643)),hi=(i(37591),i(11095));i(86909);function di(e){const t=e.priceScale();return null===t?0:t.isPercentage()||t.isIndexedTo100()?2:1}class ui extends li.PanePriceAxisView{constructor(e,t,i,s,r){super(e,t,s),this._crossHairMenuCachedState=null,this._hasActions=!1,this._gaOrigin="CH menu",this._crosshairPriceAxisView=e,e.setPaneRendererLabelIcon(0),this._crosshair=t,this._scale=i,this._options=r,this._updateGaOrigin()}_updateImpl(e,t){const i=this._crosshair.y,s=this._chartModel.properties().childs().scalesProperties.childs().fontSize.value(),r=this._chartModel.timeScale().width(),n=this._crosshair.model().priceAxisRendererOptions(),a=s+2*this._crosshairPriceAxisView.additionalPadding(s)+n.paddingTop+n.paddingBottom,l=a,c=i-a/2,h=this._crosshair.pane,d=this._mainDataSourceOnPane(),u=d&&d.symbolSource(),p=!!u&&(u.isConvertedToOtherCurrency()||u.isConvertedToOtherUnit());if(this._updateGaOrigin(),null!==d){const e=di(d),t=d.idForAlert(),i=this._chartModel.isInReplay(),s=this._crossHairMenuCachedState,r=O.enabled("chart_crosshair_menu");null!==s&&s.id===t&&s.priceScale===e&&s.isCurrencyOrUnitConverted===p&&s.isInReplay===i&&s.isMenuEnabled===r||(this._updateTooltipAndActionsAvailability(d,e,p),this._crossHairMenuCachedState={id:t,priceScale:e,isCurrencyOrUnitConverted:p,isInReplay:i,isMenuEnabled:r})}const _=null!==d&&(0,
me.isActingAsSymbolSource)(d)?d.symbol():null,m=null!==h&&(h.maximized().value()||!h.collapsed().value())&&(Boolean(_)||!1);this._crosshairPriceAxisView.setPaneLabelVisible(m);const g=this._position();if(null!==g){const e=0,t=r-l,i=Boolean(hi.showPlusButtonOnCursor.value()),s=i?this._crosshair.x:void 0,n=void 0!==s?s-l/2:"left"===g?e:t,h=void 0!==s?s+l/2:"left"===g?e+l:t+l,d=(0,o.box)(new o.Point(n,c),new o.Point(h,c+a));this._data={itemBox:d,clickHandler:this._handleClick.bind(this,g,i,d)},this._crosshairPriceAxisView.setHitTestData(this._data),this._crosshairPriceAxisView.setXCoord(s)}super._updateImpl(e,t)}_priceScale(){return this._scale}_updateGaOrigin(){this._gaOrigin=Boolean(hi.showPlusButtonOnCursor.value())?"CH menu cursor":"CH menu"}_updateTooltipAndActionsAvailability(e,t,i){this._hasActions=!1;if(!(1===t))return;this._chartModel.isInReplay();this._hasActions=!1}_handleClick(e,t,i,s,r){(0,u.trackEvent)(this._gaOrigin,"click");const n=this._mainDataSourceOnPane(),o=null!==n&&(0,me.isActingAsSymbolSource)(n)?n.symbol():null,a={pageX:r.pageX,pageY:r.pageY,clientX:r.clientX,clientY:r.clientY,screenX:r.screenX,screenY:r.screenY,price:this._crosshair.price,symbol:o};_.emit("onPlusClick",a)}_getMenuItems(e){return Promise.resolve([])}_createAlertMenuItems(e){return Promise.resolve([])}_createTradingMenuItems(){return Promise.resolve([])}_createAddHorizontalLineMenuItem(){return[]}_getActionAddAlert(e){return null}_getActionAddHorizontalLine(e){return null}_getValue(e,t){const i=e.priceScale(),s=e.firstValue();if(null===i||null===s)return null;return i.isPercentage()||i.isIndexedTo100()?null:i.coordinateToPrice(t,s)}_formatValue(e,t){return t.formatter().format(e)}async _addAlert(e,t){}_addHorizontalLineTool(e,t){}_showContextMenu(e,t,i,s,r){const o="left"===r;setTimeout((()=>{const r=s.clientX-s.localX,a=s.clientY-s.localY,l=i.min.x+r,c=i.max.x+r,h=i.min.y+a,d=c-l,u=i.max.y+a-h,p=t?Pe.crosshairLock.value():void 0;if(void 0!==p){const e=(0,n.ensureNotNull)(this._chartModel.timeScale().points().roughTime(this._crosshair.index));Pe.crosshairLock.setValue({type:1,price:this._crosshair.price,time:e,modelId:this._chartModel.id(),paneId:(0,n.ensureNotNull)(this._crosshair.pane).id()})}ci.ContextMenuManager.showMenu(e,{clientX:s.clientX,clientY:s.clientY,box:{x:l,w:d,y:h,h:u},attachToXBy:t?"auto":o?"left":"right",attachToYBy:"auto-strict",marginX:t?0:-d},void 0,{menuName:"CrosshairMenuView"},(()=>{void 0!==p&&Pe.crosshairLock.setValue(p)}))}))}_mainDataSourceOnPane(){const e=this._crosshair.pane;return null!==e?e.mainDataSource():null}}var pi=i(79849),_i=i(38325);class mi extends ei.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e}hitTest(e){return void 0===this._data.clickHandler?null:new Ot.HitTestResult(Ot.HitTarget.Custom,{clickHandler:this._data.clickHandler,tapHandler:this._data.clickHandler})}_drawImpl(e){const t=this._data.vertLinesVisible,i=this._data.horzLinesVisible;if(!t&&!i)return;const{context:s,horizontalPixelRatio:r,verticalPixelRatio:n,bitmapSize:o}=e
;s.lineWidth=Math.max(1,Math.floor(this._data.lineWidth*r)),s.strokeStyle=this._data.color,s.fillStyle=this._data.color,s.lineCap="butt",(0,Qt.setLineStyle)(s,this._data.lineStyle);const a=Math.round(this._data.x*r),l=Math.round(this._data.y*n),c=Math.ceil(o.width*r),h=Math.ceil(o.height*n);t&&a>=0&&(0,Qt.drawVerticalLine)(s,a,0,h),i&&l>=0&&(0,Qt.drawHorizontalLine)(s,l,0,c),this._data.drawCenter&&(s.beginPath(),s.arc(a,l,Math.round(3*r),0,2*Math.PI,!0),s.fillStyle=this._data.color,s.fill()),this._data.scissors&&function(e,t,i){const{context:s,bitmapSize:r,horizontalPixelRatio:n,verticalPixelRatio:o}=e,a=24*n,l=Math.round(t-a/2);let c=Math.round(i-a/2);if(c<0)c=0;else{const e=r.height-a;c>e&&(c=e)}s.translate(l,c),s.scale(n,o),s.fillStyle="#131722",s.fill(gi),s.strokeStyle="#fff",s.lineWidth=1,s.stroke(gi)}(e,a,l)}}const gi=new Path2D("m15.68 3.72-3.82 5.52-3.83-5.52-.28-.42-.42.3a2.84 2.84 0 0 0-.68 3.92l3.27 4.73-1.16 1.68a3.34 3.34 0 0 0-4.26 3.22 3.34 3.34 0 0 0 3.32 3.35 3.34 3.34 0 0 0 3.08-4.6l1-1.44 1.13 1.62a3.34 3.34 0 0 0 3.15 4.42c1.84 0 3.32-1.5 3.32-3.35a3.34 3.34 0 0 0-4.42-3.17l-1.23-1.78 3.22-4.65a2.86 2.86 0 0 0-.69-3.96l-.41-.29-.29.42ZM7.82 16.27c.47 0 .86.39.86.88 0 .48-.39.87-.86.87a.87.87 0 0 1-.86-.87c0-.5.4-.88.86-.88Zm8.36 0c.47 0 .86.39.86.88 0 .48-.4.87-.86.87a.87.87 0 0 1-.86-.87c0-.5.39-.88.86-.88Z");const fi=l.colorsPalette["color-tv-blue-500"];class vi{constructor(e,t){this._rendererData={},this._renderer=new mi(this._rendererData),this._source=e,this._pane=t}update(){}renderer(e,t){var i,s;const r=this._source.selectPointMode().value()!==Pe.SelectPointMode.None,o=this._source.lockedPane(),a=(this._source.visible||null!==o)&&(this._source.areLinesVisible||r)&&!this._source.linesShouldBeHidden(),l=this._rendererData;if(!a||null===this._pane)return null;const c=this._source.paneForPointSelect(),h=this._source.isReplaySelection(),d=null!=o?o:this._source.pane,u=this._pane===d,p=h||(null!==c?d===c&&this._pane===c:u);if(l.scissors=!1,r&&(h||this._source.isOnHoveredChartWidget())&&p){const e=(0,n.ensureNotNull)(this._source.pointToSelect());l.color=this._source.lineColor()||fi,h?(l.lineWidth=2,l.scissors=u):l.lineWidth=1,l.lineStyle=pi.LINESTYLE_SOLID,l.horzLinesVisible=!0,l.vertLinesVisible=!0,l.drawCenter=!1,"time"===e?l.horzLinesVisible=!1:"price"===e&&(l.vertLinesVisible=!1)}else{const e=this._source.properties(),t=this._source.model().currentTool(),i=(0,_i.lastMouseOrTouchEventInfo)(),s=i.isTouch&&!i.stylus&&((0,de.isLineToolName)(t)||(0,Pe.toolIsMeasure)(t));let r;r=s?fi:e.childs().color.value();const n=e.childs().transparency.value();!s&&n>0&&(r=(0,Ft.generateColor)(r,n)),l.color=r,l.horzLinesVisible=this._pane===d&&(this._pane.maximized().value()||!this._pane.collapsed().value()),l.vertLinesVisible=!0,l.lineWidth=e.childs().width.value(),l.lineStyle=e.childs().style.value(),l.drawCenter=s&&this._pane===d}return l.x=null!==(i=this._source.lockedX())&&void 0!==i?i:this._source.x,l.y=null!==(s=this._source.lockedY())&&void 0!==s?s:this._source.y,this._renderer}}var Si=i(72739)
;const yi={backgroundColor:(0,Ft.generateColor)(l.colorsPalette["color-tv-blue-500"],70),borderColor:(0,Ft.generateColor)(l.colorsPalette["color-tv-blue-500"],20)};class bi{constructor(e){this._renderer=new Si.RectangleRenderer,this._rectangle=null,this._crosshair=e}update(){const e=this._crosshair.selection();null!==e&&null!==this._crosshair.pane?this._rectangle=this._crosshair.pane.logicalRectToPixels(e):this._rectangle=null}renderer(e,t){if(!this._rectangle)return null;const i={backcolor:yi.backgroundColor,color:yi.borderColor,fillBackground:!0,linewidth:1,points:[this._rectangle.min,this._rectangle.max],extendLeft:!1,extendRight:!1};return this._renderer.setData(i),this._renderer}}var wi=i(38223),Ci=i(57322),Pi=i(2043),xi=i(98596),Ti=i(99031),Ii=i(80657),Mi=i(19266),Ai=i(73436);const Li=c.t(null,void 0,i(33355)),ki=c.t(null,{context:"study"},i(32819)),Di=new xe.PercentageFormatter,Ei=new Pi.TimeSpanFormatter,Vi=new xi.VolumeFormatter,Bi=(0,l.getHexColorByName)("color-tv-blue-500"),Ri=(0,l.getHexColorByName)("color-ripe-red-400"),Ni={bgColorPositive:(0,Ft.generateColor)(Bi,80),bgColorNegative:(0,Ft.generateColor)(Ri,80),colorPositive:(0,l.getHexColorByName)("color-tv-blue-600"),colorNegative:(0,l.getHexColorByName)("color-ripe-red-400"),labelBgColorPositive:Bi,labelBgColorNegative:Ri};class Oi{constructor(e,t){this._pipFormatter=null,this._lastSymbolInfo=null,this._horzTrenRenderer=new Ti.TrendLineRenderer,this._vertTrenRenderer=new Ti.TrendLineRenderer,this._bgRenderer=new Si.RectangleRenderer,this._labelRenderer=new Ii.TextRenderer,this._p1=null,this._p2=null,this._label=null,this._source=e,this._pane=t}update(e){var t,i;const[s,r]=this._source.measurePoints();if(void 0===r)return this._p1=null,void(this._p2=null);const a=(0,n.ensureNotNull)(this._source.measurePane().value()),l=s.price,c=r.price,h=r.index-s.index,d=(0,wi.forceLTRStr)(""+h),u=(0,n.ensureNotNull)(a.mainDataSource()),p=(0,n.ensureNotNull)(u.formatter()),_=r.price-l;let m=null!==(i=null===(t=p.formatChange)||void 0===t?void 0:t.call(p,r.price,l))&&void 0!==i?i:p.format(_);if(Math.abs(l)>1e-8){const e=_/Math.abs(l);m+=" ("+Di.format(100*e)+")"}const g=(0,wi.forceLTRStr)(m);this._label=g+"\n"+Li.format({count:d});const f=(0,n.ensureNotNull)(u.firstValue()),v=this._source.model().timeScale().indexToCoordinate(s.index),S=this._source.model().timeScale().indexToCoordinate(r.index),y=a.defaultPriceScale().priceToCoordinate(l,f),b=a.defaultPriceScale().priceToCoordinate(c,f);this._p1=new o.Point(v,y),this._p2=new o.Point(S,b);const w=this._source.model().timeScale().indexToUserTime(s.index),C=this._source.model().timeScale().indexToUserTime(r.index);let P=null;if(null!==w&&null!==C){const e=this._pane.model().mainSeries().symbolInfo();null!==e&&e!==this._lastSymbolInfo&&(this._pipFormatter=new Ci.PipFormatter(e.pricescale,e.minmov,e.type,e.minmove2,e.typespecs),this._lastSymbolInfo=e),P=(C.valueOf()-w.valueOf())/1e3}const x=this._pipFormatter?this._pipFormatter.format(_):null,T=null!==x?" , "+x:"",I=null!==P?Ei.format(P):null,M=null!==I?", "+(0,
wi.startWithLTR)(I):"";this._label=(0,wi.forceLTRStr)(g+T)+"\n"+Li.format({count:d})+M;const A=this._source.measureVolume();Number.isNaN(A)||(this._label+=`\n${ki} ${Vi.format(A)}`);const k=c=50?Ai.LineEnd.Arrow:Ai.LineEnd.Normal};this._horzTrenRenderer.setData(s)}{const e=Math.round(B.x),t=new o.Point(e,this._p1.y),i=new o.Point(e,this._p2.y),s={points:[t,i],color:D,linewidth:1,linestyle:pi.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:Ai.LineEnd.Normal,rightend:Math.abs(t.y-i.y)>=50?Ai.LineEnd.Arrow:Ai.LineEnd.Normal};this._vertTrenRenderer.setData(s)}const R={x:0,y:10},N=.5*(this._p1.x+this._p2.x),O=this._p2.y,F=new o.Point(N,O),W=(H=(0,n.ensureNotNull)(this._label),{points:[F],text:H,color:"#FFFFFF",horzAlign:"center",vertAlign:"middle",font:L.CHART_FONT_FAMILY,offsetX:R.x,offsetY:R.y,bold:!1,italic:!1,fontsize:12,padding:8,highlightBorder:!1,backgroundColor:E,backgroundTransparency:10,backgroundVertInflate:5,backgroundHorzInflate:5,backgroundRoundRect:4});var H;this._labelRenderer.setData(W);const z=this._labelRenderer.measure(),U=(0,Ii.calculateLabelPosition)(z,this._p1,this._p2,R,this._pane.height());this._labelRenderer.setPoints([U])}renderer(){if(null===this._p1||null===this._p2)return null;const e=new Mi.CompositeRenderer;return e.append(this._bgRenderer),e.append(this._horzTrenRenderer),e.append(this._vertTrenRenderer),e.append(this._labelRenderer),e}}var Fi=i(15187);class Wi extends Fi.MediaCoordinatesPaneRenderer{constructor(e){super(),this._data=e}hitTest(e){return null}_drawImpl(e){const t=e.context;t.translate(this._data.x-this._data.width/2,this._data.y-this._data.height/2),t.strokeStyle="rgba(153,153,153,.3)",t.lineWidth=2,t.beginPath(),this._drawShackle(t),t.stroke(),t.closePath(),t.strokeStyle="rgba(153,153,153,.7)",t.lineWidth=1,t.beginPath(),t.rect(0,this._data.height-this._data.bodyHeight+.5,this._data.width,this._data.bodyHeight),t.closePath(),t.stroke(),t.translate(0,-1),t.strokeStyle="#777",t.beginPath(),this._drawShackle(t),t.stroke(),t.closePath(),t.fillStyle="rgba(255,255,255,.7)",t.beginPath(),t.rect(1,this._data.height-this._data.bodyHeight+1.5,this._data.width-2,this._data.bodyHeight-2),t.fill(),t.beginPath(),t.rect(.5,this._data.height-this._data.bodyHeight+1,this._data.width-1,this._data.bodyHeight-1),t.stroke(),t.closePath(),t.fillStyle="#777",t.fillRect(this._data.width/2-.5,this._data.height-this._data.bodyHeight/2,1,2)}_drawShackle(e){const t=(this._data.width-3)/2,i=this._data.height-this._data.bodyHeight;e.moveTo(1.5,t),
e.arc(this._data.width/2,t,t,Math.PI,2*Math.PI),i>t&&(e.moveTo(1.5,t),e.lineTo(1.5,i),e.moveTo(this._data.width-1.5,t),e.lineTo(this._data.width-1.5,i))}}class Hi{constructor(e,t,i){this._horzVisible=!1,this._source=e,this._pane=t,this._axis=i||"x"}update(){}renderer(e,t){var i;const s=this._source.visible&&this._source.areLinesVisible,r=0===(null===(i=Pe.crosshairLock.value())||void 0===i?void 0:i.type),o=s&&this._horzVisible,a=s||r;if("y"===this._axis&&!o||!a)return null;const l="y"===this._axis?this._pane.width()-4.5:(0,n.ensureNotNull)(this._source.lockedX())+1,c="y"===this._axis?this._source.y:this._pane.height()-5.5-1;return new Wi({x:l,y:c,width:9,height:11,bodyHeight:7})}}var zi=i(49483),Ui=i(93835),ji=i(88546);class Gi extends Ui.DataWindowView{constructor(e){super(),this._invalidated=!0,this._dateItem=new Ui.DataWindowItem("",c.t(null,void 0,i(76912)),""),this._timeItem=new Ui.DataWindowItem("",c.t(null,void 0,i(31976)),""),this._model=e,this._items.push(this._dateItem),this._items.push(this._timeItem)}update(){this._invalidated=!0}items(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items}_updateImpl(){const e=this._model.mainSeries().isDWM();if(this._timeItem.setVisible(!e),this._timeItem.setValue(ji.notAvailable),this._dateItem.setValue(ji.notAvailable),this._model.timeScale().isEmpty())return;let t=this._model.crossHairSource().appliedIndex();if(!(0,Gt.isNumber)(t)){const e=this._model.mainSeries().data().last();if(null===e)return;t=e.index}const i=this._model.timeScale().indexToUserTime(t);null!==i&&(this._dateItem.setValue(this._model.dateFormatter().format(i)),e||this._timeItem.setValue(this._model.timeFormatter().format(i)))}}var qi=i(34951);const $i=l.colorsPalette["color-tv-blue-500"],Yi=c.t(null,{context:"Replay"},i(20747));class Ki extends qi.TimeAxisView{constructor(e,t,i,s=!1){super(e),this._indexProvider=i,this._highlighted=s,this._source=t,this._properties=e.properties().childs().scalesProperties}_getText(e){if(this._source.isReplaySelection()){const t=this._model.timeScale().indexToUserTime(e);return null!==t?`${Yi}: ${this._model.dateTimeFormatter().format(t)}`:""}return super._getText(e)}_getBgColor(){if(this._source.isReplaySelection())return $i;const e=this._properties.childs();return this._highlighted?e.axisLineToolLabelBackgroundColorCommon.value():this._model.dark().value()?e.crosshairLabelBgColorDark.value():e.crosshairLabelBgColorLight.value()}_getIndex(){return this._model.crossHairSource().visible||null!==this._source.lockedPane()?this._indexProvider():null}_isVisible(){return this._properties.childs().showTimeScaleCrosshairLabel.value()}}var Zi=i(96280),Xi=i(94025);const Ji={menuEnabled:!1,menuForMainSourceOnly:!1,disableTradingMenuActions:!1,disableDrawHorizLineMenuAction:!1};let Qi=0;const es=(0,J.getLogger)("Chart.Crosshair");class ts extends Jt.DataSource{constructor(e,t,i){super(),this.pane=null,this.price=NaN,this.index=NaN,this.visible=!0,this.areLinesVisible=!0,this.x=NaN,this.y=NaN,this._lockData=null,
this._measurePane=new $.WatchedValue(null),this._measurePaneViewCache=new WeakMap,this._startMeasurePoint=null,this._endMeasurePoint=null,this._lastValidMeasurePoint=null,this._isOnHoveredChartWidget=!1,this._crossHairSelectPointMode=new $.WatchedValue(Pe.SelectPointMode.None),this._selectionPane=null,this._selectionView=new bi(this),this._selectionStartPoint=null,this._timeLockPaneView=null,this._crosshairPaneViewCache=new WeakMap,this._pointSelectionPaneViewCache=new WeakMap,this._priceAxisViews=new Map,this._panePriceAxisViews=new Map,this._startMeasurePriceAxisViews=new Map,this._endMeasurePriceAxisViews=new Map,this._originX=NaN,this._originY=NaN,this._subscribed=!1,this._movedDelegate=new q.Delegate,this._pointSelectedDelegate=new q.Delegate,this._requestedPoint=null,this._paneForRequestedPoint=null,this._selectLineColor=null,this._volumeCalculator=null,this._selectFromAllChartsIfOutOfData=null,this._currentMeasurePointsetAndSymbolId=null,this._model=e,this._options=Object.assign({},Ji,i||{}),this._linesShouldBeHidden=this._model.readOnly(),this._dataWindowView=new Gi(e),this.setSelectionEnabled(!1);const s=e=>t=>t===(0,n.ensureNotNull)(this._measurePane.value()).defaultPriceScale()?e():null;this._currentPosPriceProvider=e=>{const t=(0,n.ensureNotNull)(this.pane);if(e===t.defaultPriceScale())return this.price;const i=(0,n.ensureNotNull)(t.defaultPriceScale().mainSource()).firstValue();if(null===i)return null;const s=t.defaultPriceScale().priceToCoordinate(this.price,i),r=(0,n.ensureNotNull)(e.mainSource()).firstValue();return null===r?null:e.coordinateToPrice(s,r)},this._startMeasurePriceProvider=s((()=>(0,n.ensureNotNull)(this._startMeasurePoint).price)),this._endMeasurePriceProvider=s((()=>(0,n.ensureNotNull)(this._lastMeasurePoint()).price)),this._properties=t;this._timeAxisView=new Ki(e,this,(()=>this.appliedIndex()),!1),this._startMeasureTimeAxisView=new Ki(e,this,(()=>(0,n.ensureNotNull)(this._startMeasurePoint).index),!0),this._endMeasureTimeAxisView=new Ki(e,this,(()=>(0,n.ensureNotNull)(this._lastMeasurePoint()).index),!0),e.readOnly()||Pe.cursorTool.subscribe((e=>this.areLinesVisible="arrow"!==e),{callWithLast:!0}),this._crosshairLock=Pe.crosshairLock.spawn(),this._showPlusButtonOnCursor=hi.showPlusButtonOnCursor.spawn();const r=()=>{this.updateAllViews((0,H.sourceChangeEvent)(this.id())),this._model.lightUpdate()};this._crosshairLock.subscribe(r),this._showPlusButtonOnCursor.subscribe(r)}destroy(){null!==this._volumeCalculator&&this._volumeCalculator.destroy(),this._measurePane.setValue(null),this._crosshairLock.destroy(),this._showPlusButtonOnCursor.destroy(),this._removeMeasurePointset(),super.destroy()}name(){return"Crosshair"}moved(){return this._movedDelegate}originX(){return this._originX}originY(){return this._originY}saveOriginCoords(e,t){this._originX=e,this._originY=t}clearOriginCoords(){this._originX=NaN,this._originY=NaN}currentPoint(){return new o.Point(this.x,this.y)}model(){return this._model}appliedIndex(){var e;return null!==(e=this._getLockData().index)&&void 0!==e?e:this.index}
lockedX(){var e;return null!==(e=this._getLockData().xCoord)&&void 0!==e?e:null}lockedY(){var e;return null!==(e=this._getLockData().yCoord)&&void 0!==e?e:null}lockedPane(){const e=Pe.crosshairLock.value();return null===e||1!==e.type?null:this._model.id()===e.modelId?this._model.paneForId(e.paneId):this._model.mainPane()}invalidateLockPosition(){this._lockData=null}startMeasurePoint(){return this._startMeasurePoint||null}endMeasurePoint(){return this._endMeasurePoint||null}measureVolume(){if(null===this._volumeCalculator)return NaN;const[e,t]=this.measurePoints();return void 0===t?NaN:this._volumeCalculator.volume(e.index,t.index)}measurePane(){return this._measurePane.readonly()}startMeasuring(e,t){this._startMeasurePoint=e,this._measurePane.setValue(t),t.containsMainSeries()&&((0,n.assert)(null===this._volumeCalculator),this._volumeCalculator=new Zi.SeriesTimeRangeVolumeCalculator(this.model().mainSeries())),this._model.updatePane(t)}finishMeasure(e){this._endMeasurePoint=e,this._createMeasurePointset((0,n.ensureNotNull)(this._startMeasurePoint),this._endMeasurePoint)}clearMeasure(){this._removeMeasurePointset(),this._measurePane.setValue(null),delete this._startMeasurePoint,delete this._endMeasurePoint,delete this._lastValidMeasurePoint,this._model.lightUpdate(),null!==this._volumeCalculator&&(this._volumeCalculator.destroy(),this._volumeCalculator=null)}measurePoints(){const e=[(0,n.ensureNotNull)(this._startMeasurePoint)],t=this._lastMeasurePoint();return null!==t&&e.push(t),e}startSelection(e){this._selectionStartPoint=this.currentLogicalPoint(),this._selectionPane=e}clearSelection(){this._selectionStartPoint=null,this._selectionPane=null}selection(){return this._selectionStartPoint?{p1:this._selectionStartPoint,p2:this.currentLogicalPoint()}:null}currentLogicalPoint(){return{index:this.appliedIndex(),price:this.price}}selectPointMode(){return this._crossHairSelectPointMode}lineColor(){return this._selectLineColor}cancelRequestSelectPoint(){this._crossHairSelectPointMode.value()!==Pe.SelectPointMode.None&&this._setSelectPointModeState(Pe.SelectPointMode.None),this._selectFromAllChartsIfOutOfData=null}requestSelectPoint(e){(0,n.assert)(this._crossHairSelectPointMode.value()===Pe.SelectPointMode.None,"Point already requested");const{pointType:t,pane:i,lineColor:s=null,selectFromAllChartsIfOutOfData:r,selectPointMode:o=Pe.SelectPointMode.Study}=e;i&&((0,n.assert)(-1!==this._model.panes().indexOf(i),"Chartmodel doesn't contains specified pane"),this._paneForRequestedPoint=i,this._model.panesCollectionChanged().subscribe(this,this._paneCollectionChanged)),this._selectLineColor=s,this._requestedPoint=t,this._selectFromAllChartsIfOutOfData=null!=r?r:null,this._setSelectPointModeState(o)}onPointSelected(){return this._pointSelectedDelegate}trySelectCurrentPoint(){var e;const t=(0,n.ensureNotNull)(this._requestedPoint);let i=null
;if(!this._model.mainSeries().bars().search(this.index,gt.PlotRowSearchMode.Exact)&&"price"!==t&&(this._selectFromAllChartsIfOutOfData&&(i=null!==(e=Math.min(...Array.from(Pe.barTimesUnderCursor.values())))&&void 0!==e?e:null),null===i))return;const s=(0,n.ensureNotNull)(this.pane);if(this._paneForRequestedPoint&&this._paneForRequestedPoint!==s)return;let r,o=i;if("price"===t||null!==i||(o=this._model.timeScale().indexToTimePoint(this.index),null!==o)){if("time"!==t){const e=s.mainDataSource();if(null===e)return;const t=e.firstValue(),i=e.priceScale();if(null===t||null===i)return;r=i.coordinateToPrice(this.y,t)}this._setSelectPointModeState(Pe.SelectPointMode.None),this._pointSelectedDelegate.fire({time:null!=o?o:void 0,price:r},s)}}isOnHoveredChartWidget(){return this._isOnHoveredChartWidget}setOnHoveredChartWidget(e){this._isOnHoveredChartWidget=e}isReplaySelection(){return!1}clearPosition(){this.visible=!1,this.index=NaN,this.price=NaN,this.x=NaN,this.y=NaN,this.pane=null,this.clearOriginCoords(),this._updateVisibilityDependentPaneViews()}setPosition(e,t,i){this._subscribed||(this._model.mainSeries().onRestarted().subscribe(this,this.clearMeasure),this._subscribed=!0),this.visible=!0;const s=this._model.id(),r=this._model.mainSeries().bars().search(this.index,gt.PlotRowSearchMode.NearestRight);return r&&Pe.barTimesUnderCursor.set(s,r.value[0]),this._tryToUpdateViews(e,t,i)}setLinesShouldBeHidden(e){this._linesShouldBeHidden=e}linesShouldBeHidden(){return this._linesShouldBeHidden}handleContextMenuEvent(e){this._crossHairSelectPointMode.value()!==Pe.SelectPointMode.None&&this._setSelectPointModeState(Pe.SelectPointMode.None)}properties(){return this._properties}priceAxisViews(e,t){var i;const s=null===this._requestedPoint||"time"!==this._requestedPoint||!this._isOnHoveredChartWidget,r=[];return(null!==(i=this.lockedPane())&&void 0!==i?i:this.pane)===e&&s&&r.push(this._createPriceAxisViewOnDemand(this._priceAxisViews,this._panePriceAxisViews,e,t,this._currentPosPriceProvider,oi,!0)[0]),this._startMeasurePoint&&r.push(this._createPriceAxisViewOnDemand(this._startMeasurePriceAxisViews,null,e,t,this._startMeasurePriceProvider,ai)[0]),this._lastMeasurePoint()&&r.push(this._createPriceAxisViewOnDemand(this._endMeasurePriceAxisViews,null,e,t,this._endMeasurePriceProvider,ai)[0]),r}timeAxisViews(){const e=[],t=null===this._requestedPoint||"price"!==this._requestedPoint||!this._isOnHoveredChartWidget;return this._linesShouldBeHidden||!this.visible&&null===Pe.crosshairLock.value()||!t||e.push(this._timeAxisView),this._startMeasurePoint&&e.push(this._startMeasureTimeAxisView),this._lastMeasurePoint()&&e.push(this._endMeasureTimeAxisView),e}paneViews(e){var t,i;if(void 0===e)return null;const s=[];if(this.isReplaySelection()){let t=this._pointSelectionPaneViewCache.get(e);t||(t=new CrosshairPointSelectionPaneView(this,e,this._model),this._pointSelectionPaneViewCache.set(e,t)),s.push(t)}let r=this._crosshairPaneViewCache.get(e);if(r||(r=new vi(this,e),this._crosshairPaneViewCache.set(e,r)),s.push(r),
e===this._selectionPane&&s.push(this._selectionView),e===this._measurePane.value()){let t=this._measurePaneViewCache.get(e);t||(t=new Oi(this,e),this._measurePaneViewCache.set(e,t)),t.update((0,H.sourceChangeEvent)(this.id())),s.push(t)}if((hi.addPlusButtonProperty.value()||this._showPlusButtonOnCursor.value())&&1!==(null===(t=Pe.crosshairLock.value())||void 0===t?void 0:t.type)){const t=e===this.pane,i=!zi.CheckMobile.any()||window.screen.width>=320,r=Pe.tool.value(),n=(0,de.isLineToolName)(r),o=null!==this._model.lineBeingEdited()||null!==this._model.lineBeingCreated()||this._model.sourcesBeingMoved().length>0||null!==this._model.customSourceBeingMoved()||(0,Pe.toolIsMeasure)(r);if(t&&this._isOnHoveredChartWidget&&this._crossHairSelectPointMode.value()===Pe.SelectPointMode.None&&i&&!n&&!o){const t=e.mainDataSource();if(null!==t){const i=t.priceScale();if(null!==i){const t=this._createPriceAxisViewOnDemand(this._priceAxisViews,this._panePriceAxisViews,e,i,this._currentPosPriceProvider,oi,!0)[1];null!==t&&s.push(t)}}}}return 0===(null===(i=Pe.crosshairLock.value())||void 0===i?void 0:i.type)&&(null===this._timeLockPaneView&&(this._timeLockPaneView=new Hi(this,e)),s.push(this._timeLockPaneView)),s}dataWindowView(){return this._dataWindowView}updateAllViews(e){this._priceAxisViews.forEach((t=>{t.forEach((t=>t.update(e)))})),this._panePriceAxisViews.forEach((t=>{t.forEach((t=>t.update(e)))})),this._startMeasurePoint&&(this._startMeasurePriceAxisViews.forEach((t=>{t.forEach((t=>t.update(e)))})),this._startMeasureTimeAxisView.update(e)),this._lastMeasurePoint()&&(this._endMeasurePriceAxisViews.forEach((t=>{t.forEach((t=>t.update(e)))})),this._endMeasureTimeAxisView.update(e)),this._timeAxisView.update(e),this._selectionView.update(),this._dataWindowView.update(),this._updateVisibilityDependentPaneViews()}isMenuEnabled(){return!0}isHoveredEnabled(){return hi.addPlusButtonProperty.value()||this._showPlusButtonOnCursor.value()}isHovered(){return this._model.hoveredSource()===this}pointToSelect(){return this._requestedPoint}paneForPointSelect(){return this._paneForRequestedPoint}_lastMeasurePoint(){return this._endMeasurePoint?this._endMeasurePoint:(null!==this.pane&&this._measurePane.value()===this.pane&&(this._lastValidMeasurePoint={price:this._model.magnet().align(this.price,this.index,this.pane),index:this.index}),this._lastValidMeasurePoint||null)}_createPriceAxisViewOnDemand(e,t,i,s,r,o,a=!1){let l=e.get(i),c=null!==t?t.get(i):void 0;void 0===l&&(l=new Map,e.set(i,l),this.isMenuEnabled()&&null!==t&&(c=new Map,t.set(i,c)),a&&i.onDestroyed().subscribe(this,(()=>this._onPaneDestroyed(i))));let h=l.get(s);if(void 0===h){if(h=new o(this,i,s,r),l.set(s,h),void 0!==c){const e=new ui(h,this,s,this._model,this._options);c.set(s,e)}a&&s.lastSourceRemoved().subscribe(this,(()=>this._onPriceScaleCleared(s)))}let d=null;return void 0!==c&&(d=(0,n.ensureDefined)(c.get(s))),[h,d]}_onPaneDestroyed(e){e.onDestroyed().unsubscribeAll(this),this._priceAxisViews.delete(e),this._panePriceAxisViews.delete(e),
this._startMeasurePriceAxisViews.delete(e),this._endMeasurePriceAxisViews.delete(e)}_onPriceScaleCleared(e){e.lastSourceRemoved().unsubscribeAll(this),this._priceAxisViews.forEach((t=>t.delete(e))),this._panePriceAxisViews.forEach((t=>t.delete(e))),this._startMeasurePriceAxisViews.forEach((t=>t.delete(e))),this._endMeasurePriceAxisViews.forEach((t=>t.delete(e)))}_tryToUpdateViews(e,t,i){return!!this._tryToUpdateData(e,t,i)&&(this.updateAllViews((0,H.sourceChangeEvent)(this.id())),this._movedDelegate.fire({index:this.index,price:this.price}),!0)}_tryToUpdateData(e,t,i){const s=this.x,r=this.y,o=this.price,a=this.index,l=this.pane,c=this._priceScaleByPane(i);if(this.index=e,this.x=isNaN(e)?NaN:this._model.timeScale().indexToCoordinate(e),null!==c&&null!==i){this.pane=i,this.price=t;const e=(0,n.ensureNotNull)(i.mainDataSource()).firstValue();this.y=null===e?NaN:c.priceToCoordinate(t,e)}else this.pane=null,this.price=NaN,this.y=NaN;return s!==this.x||r!==this.y||a!==this.index||o!==this.price||l!==this.pane}_priceScaleByPane(e){return e&&!e.defaultPriceScale().isEmpty()?e.defaultPriceScale():null}_setSelectPointModeState(e){e===Pe.SelectPointMode.None&&(this._requestedPoint=null,this._selectLineColor=null,this._paneForRequestedPoint&&(this._paneForRequestedPoint=null,this._model.panesCollectionChanged().unsubscribe(this,this._paneCollectionChanged))),Pe.activePointSelectionMode.setValue(e),this._crossHairSelectPointMode.setValue(e),this._model.lightUpdate()}_paneCollectionChanged(e){const t=this._paneForRequestedPoint;null!==t&&-1===e.indexOf(t)&&this.cancelRequestSelectPoint()}_updateVisibilityDependentPaneViews(){var e;for(const t of this.model().panes())null===(e=this._pointSelectionPaneViewCache.get(t))||void 0===e||e.update()}_getLockData(){var e;if(null===this._lockData){const t=Pe.crosshairLock.value();if(null===t)this._lockData={};else{const i=this._model.timeScale(),s=null!==(e=i.points().roughIndex(t.time))&&void 0!==e?e:void 0,r=void 0===s?void 0:i.indexToCoordinate(s);switch(t.type){case 0:this._lockData={index:s,xCoord:r};break;case 1:{let e;const i=this.lockedPane();if(null!==i){const s=i.mainDataSource();if(null!==s){const i=s.firstValue(),r=s.priceScale();null!==r&&null!==i&&(e=r.priceToCoordinate(t.price,i))}}this._lockData={index:s,xCoord:r,yCoord:e}}}}}return this._lockData}_createMeasurePointset(e,t){const i=this._normalizePoint(e),s=this._normalizePoint(t),r=[[i.time_t,i.offset],[s.time_t,s.offset]];this._removeMeasurePointset(),++Qi,this._currentMeasurePointsetAndSymbolId={measurePointsetId:Qi,symbolId:(0,n.ensureNotNull)(this._model.mainSeries().seriesSource().symbolInstanceId())};const o=(0,Xi.getServerInterval)(this._model.mainSeries().interval());this._model.chartApi().createPointset(this._currentMeasurePointsetIdWithPrefix(),"turnaround",this._currentMeasurePointsetAndSymbolId.symbolId,o,r,this._onPointsetResponse.bind(this))}_removeMeasurePointset(){
null!==this._currentMeasurePointsetAndSymbolId&&this._model.chartApi().isConnected().value()&&this._model.chartApi().removePointset(this._currentMeasurePointsetIdWithPrefix()),this._currentMeasurePointsetAndSymbolId=null}_currentMeasurePointsetIdWithPrefix(){return"pointsetMeasure_"+(0,n.ensureNotNull)(this._currentMeasurePointsetAndSymbolId).measurePointsetId}_normalizePoint(e){return{...this._model.timeScale().normalizeBarIndex(e.index),price:e.price}}_onPointsetResponse(e){if("pointset_error"===e.method)return void es.logError(`Error getting pointset: ${e.params[0]} ${e.params[1]}`);if(e.params.customId!==this._currentMeasurePointsetIdWithPrefix())return;if(null===this._startMeasurePoint||null===this._endMeasurePoint)return;const t=e.params.plots;if(2!==t.length)return;const i=t[0].value[0],s=t[1].value[0];this._startMeasurePoint.index=i,this._endMeasurePoint.index=s,this.updateAllViews((0,H.sourceChangeEvent)(this.id())),this._model.updateSource(this)}}var is=i(50146),ss=i(12416),rs=i(17236),ns=i(36298),os=i(39262),as=i(26426),ls=i(56840);class cs{constructor(e){this._priceSourceNamesById=new Map,e.forEach((e=>this._priceSourceNamesById.set(e.id,e.name)))}name(e){var t;return null!==(t=this._priceSourceNamesById.get(e))&&void 0!==t?t:null}priceSourcesChanged(e){return e.length!==this._priceSourceNamesById.size}}var hs=i(97906),ds=i(90194);const us=new ns.TranslatedString("remove deselected empty line tools",c.t(null,void 0,i(59211))),ps=O.enabled("auto_enable_symbol_labels"),_s=O.enabled("saveload_separate_drawings_storage"),ms=(0,J.getLogger)("Chart.ChartModel");function gs(e,t){const i=e.indexOf(t);return-1!==i&&(e.splice(i,1),!0)}function fs(e){var t,i;for(let s=e.length;s--;){const r=e[s].dataSources();for(let e=r.length;e--;)null===(t=r[e].dataWindowView())||void 0===t||t.update();const n=e[s].priceDataSources();for(let e=n.length;e--;)null===(i=n[e].legendView())||void 0===i||i.update()}}const vs={isSnapshot:!1,readOnly:!1,watermarkEnabled:!0,shiftVisibleRangeOnNewBar:!0,currencyConversionEnabled:!1,unitConversionEnabled:!1,countdownEnabled:!0,lastPriceAnimationEnabled:!0,onWidget:!1,hideIdeas:!1};class Ss{constructor(e,t,i,r,n,o,a,l,c,d){this._onRearrangePanes=new q.Delegate,this._lineToolsGroupModel=new kt,this._sourcesBeingMoved=[],this._activeItemBeingMoved=null,this._lineBeingEdited=null,this._linePointBeingEdited=null,this._linePointBeingChanged=null,this._customSourceBeingMovedHitTestData=null,this._customSourceBeingMoved=null,this._dataSourceCollectionChanged=new q.Delegate,this._sourceProperitesChanged=new q.Delegate,this._sourceZOrderChanged=new q.Delegate,this._symbolSourceResolved=new q.Delegate,this._symbolSourceResolvingActive=new $.WatchedValue(!1),this._adjustForDividendsAvailability=new $.WatchedValue(0),this._adjustForDividendsEnabled=new $.WatchedValue(!1),this._sessions=null,this._currentTool="",this._lineBeingCreated=null,this._paneBeingCreatedLineOn=null,this._lineCancelled=new q.Delegate,this._phantomSourceContainer=new qt(this),this._destroyed=!1,this._isSettingsExternalPosition=!1,
this._isTimeScrolling=!1,this._magnet=new Zt,this._scrollingState=null,this._modelIntervals=[],this._rendererOptionsProvider=new k(this),this._studyInserted=new q.Delegate,this._cachedStudiesMaxOffset=0,this._replayStatus=new $.WatchedValue(Tt.Undefined),this._panes=[],this._tagsChanged=new q.Delegate,this._strategySources=[],this._strategySourcesChange=new q.Delegate,this._activeStrategySource=new $.WatchedValue(null),this._paneCollapsingAvailable=new $.WatchedValue(!1),this._panesCollectionChanged=new q.Delegate,this._scrollEnabled=O.enabled("chart_scroll"),this._zoomEnabled=O.enabled("chart_zoom"),this._lollipopSourcesWatcher=null,this._alertsWatcher=null,this._hoveredSource=null,this._hoveredSourceChanged=new q.Delegate,this._lastHoveredHittestData=null,this._lastSelectedHittestData=null,this._topmostCustomSources=[],this._fgCustomSources=[],this._bgCustomSources=[],this._allCustomSources=[],this._customSourcesMap=new Map,this._multiPaneSources=[],this._showLegendProperty=new M.default,this._id=(0,Q.guid)(),this._chartSaveTime=null,this._availableCurrenciesList=null,this._availableCurrencies=new Ut([]),this._availablePriceSources=new cs([]),this._availableUnitsObject=null,this._availableUnits=new jt({}),this._availablePriceSourcesBySymbol=new Map,this._shouldBeSavedEvenIfHidden=!1,this._watchedThemeSpawn=h.watchedTheme.spawn(),this._gradientColorsCache=null,this._studiesWV=new Y.WatchedObject([],v.compareTwoCollectionsByIds),this._studiesExcludeInternalWV=new Y.WatchedObject([],v.compareTwoCollectionsByIds),this._resetScalesAvailable=new $.WatchedValue(!1),this._recalcVRStudiesParams={},this._recalcColorStudiesParams={},this._recalcVisibleRangeStudiesImplDebounced=(0,s.default)(this._recalcVisibleRangeStudiesImpl.bind(this,this._recalcVRStudiesParams),500),this._recalcColorStudiesImplDebounced=(0,s.default)(this._recalcColorStudiesImpl.bind(this,this._recalcColorStudiesParams),250),this._width=0,this._resetScales=new q.Delegate,this._chartThemeLoaded=new q.Delegate,this._selection=new b,this._selectedSourceChanged=new q.Delegate,this._symbolSourceCollectionChanged=new q.Delegate,this._gridSource=new si,this._visibleRangeStudiesInputs=new Y.WatchedObject(null),this._syncPointCache=new Map,this._lastAppliedGotoTimeRange=null,this._lastGotoTimeRange=null,this._lollipopSourcesWatcherLoader=null,this._clearSelection=()=>{this._lastSelectedHittestData=null,this._selection.clear()},this._removeSourceFromSelection=e=>{this._selection.remove(e)},this._addSourceToSelection=(e,t)=>{const i=this._selection.isSelected(e);i&&this._lastSelectedHittestData===t||e&&!e.isSelectionEnabled()||(this._lastSelectedHittestData=t||null,i||this._selection.add(e))},this._recalcSymbolResolvingActive=()=>{for(const e of this._panes)if(e.symbolSourceResolvingActive().value())return void this._symbolSourceResolvingActive.setValue(!0);this._symbolSourceResolvingActive.setValue(!1)},this._recalcAdjustForDividendsAvailability=()=>{var e,t,i,s;if(this._symbolSourceResolvingActive.value())return;const r=this.mainSeries()
;switch(null!==(t=null===(e=r.symbolInfo())||void 0===e?void 0:e.allowed_adjustment)&&void 0!==t?t:"none"){case"dividends":return void this._adjustForDividendsAvailability.setValue(2);case"splits":return void this._adjustForDividendsAvailability.setValue(1);case"any":return void this._adjustForDividendsAvailability.setValue(3)}for(const e of this.symbolSources().filter(me.isActingAsSymbolSource)){if(e.symbolHibernated().value()||e===r)continue;if("any"===(null!==(s=null===(i=e.symbolInfo())||void 0===i?void 0:i.allowed_adjustment)&&void 0!==s?s:"none"))return void this._adjustForDividendsAvailability.setValue(3)}this._adjustForDividendsAvailability.setValue(0)},this._recalcAdjustForDividendsEnabled=()=>{switch(this._adjustForDividendsAvailability.value()){case 2:return void this._adjustForDividendsEnabled.setValue(!0);case 0:case 1:return void this._adjustForDividendsEnabled.setValue(!1)}this._adjustForDividendsEnabled.setValue(this.mainSeries().properties().childs().dividendsAdjustment.value())},this._recalcPaneCollapsingAvailable=e=>{let t=this._panes.filter((e=>!e.collapsed().value())).length;0===t&&e&&this._panes.length>0&&(this._panes[0].collapsed().setValue(!1),t=1),this._paneCollapsingAvailable.setValue(t>1)},this._updateResetScalesAvailableValue=()=>{const e=this._timeScale.resetAvailable().value()||this._panes.some((e=>e.resetPriceScalesAvailable().value()));this._resetScalesAvailable.setValue(e)},this._chartApi=e,this._invalidateHandler=t,this._undoModel=n,this._properties=i,this._options=(0,se.merge)((0,se.clone)(vs),a),this._hibernateWV=l,this._linkingGroupIndex=c,this._isAutoSaveEnabled=d,this._readOnly=this._options.readOnly,this._isSnapshot=this._options.isSnapshot,this._chartSaveTime=(new Date).valueOf(),this._backgroundColor=new $.WatchedValue(this._getBackgroundColor()),this._backgroundTopColor=new $.WatchedValue(this._getBackgroundColor(!0)),this._properties.childs().paneProperties.childs().background.subscribe(this,this._updateBackgroundColor),this._properties.childs().paneProperties.childs().backgroundType.subscribe(this,this._updateBackgroundColor),this._properties.childs().paneProperties.childs().backgroundGradientStartColor.subscribe(this,this._updateBackgroundColor),this._properties.childs().paneProperties.childs().backgroundGradientEndColor.subscribe(this,this._updateBackgroundColor),this._backgroundColor.subscribe(this.recalcColorStudies.bind(this,!1)),this._backgroundTopColor.subscribe(this.recalcColorStudies.bind(this,!1)),this._backgroundCounterColor=new $.WatchedValue(this._getBackgroundCounterColor()),this._backgroundColor.subscribe((()=>this._backgroundCounterColor.setValue(this._getBackgroundCounterColor()))),this._isDark=(0,hs.combine)((e=>"white"===e),this._backgroundCounterColor.weakReference()),this._watchedThemeSpawn.subscribe(this._updateBackgroundColor.bind(this)),this._symbolSourceResolvingActive.subscribe(this._recalcAdjustForDividendsAvailability),this.setStudiesMetaData((0,D.studyMetaInfoRepository)().getInternalMetaInfoArray(),(0,
D.studyMetaInfoRepository)().getMigrations()),(0,Pe.init)();const u=this._readOnly?new M.default((0,R.defaults)("chartproperties.paneProperties.crossHairProperties")):this._properties.childs().paneProperties.childs().crossHairProperties;this.m_crossHairSource=new ts(this,u,this._options.crossHair),this._crossHairSelectPointMode=this.m_crossHairSource.selectPointMode().spawn(),this._crossHairSelectPointMode.subscribe((e=>{if(e!==Pe.SelectPointMode.None&&this.lineBeingCreated()){const e=Pe.tool.value();this.cancelCreatingLine(),Pe.tool.setValue(e)}})),this._tagsChanged=new q.Delegate;const p=new I.DefaultProperty("chartproperties.mainSeriesProperties");p.addExclusion("priceAxisProperties.lockScale"),p.addExclusion("priceAxisProperties.percentage"),p.addExclusion("priceAxisProperties.indexedTo100"),p.addExclusion("priceAxisProperties.isInverted"),p.addExclusion("priceAxisProperties.log"),p.addExclusion("priceAxisProperties.logDisabled"),p.addExclusion("priceAxisProperties.percentageDisabled"),p.addExclusion("priceAxisProperties.autoScaleDisabled"),p.merge(i.childs().mainSeriesProperties.state()),this._timeScale=new xt(this,this._options.timeScale),this._timeScale.resetAvailable().subscribe(this._updateResetScalesAvailableValue);const _={countdownEnabled:this._options.countdownEnabled,lastPriceAnimationEnabled:this._options.lastPriceAnimationEnabled};this.m_mainSeries=new _e.Series(this,p,_,r),this.m_mainSeries.onStyleChanged().subscribe(this._timeScale,this._timeScale.invalidateVisibleBars);const m=()=>this.fullUpdate();this.m_mainSeries.properties().childs().showCountdown.subscribe(this,(()=>{this.m_mainSeries.updateAllViews((0,H.sourceChangeEvent)(this.m_mainSeries.id())),m()})),(0,Z.currencyUnitVisibilityProperty)().subscribe(this,m),(0,X.autoLogButtonsVisibilityProperty)().subscribe(this,m),this._timeScale.visibleBarsStrictRangeChanged().subscribe(this.m_mainSeries,this.m_mainSeries.clearHighLowPriceCache),this._timeScale.visibleBarsStrictRangeChanged().subscribe(this.m_mainSeries,this.m_mainSeries.clearAveragePriceCache),this.createPane(void 0,{axisProperties:p.childs().priceAxisProperties.state(["autoScale"])}),this._adjustForDividendsAvailability.subscribe(this._recalcAdjustForDividendsEnabled),this.mainSeries().properties().childs().dividendsAdjustment.subscribe(this,this._recalcAdjustForDividendsEnabled),this._recalcAdjustForDividendsEnabled(),this._boundUpdateStudiesMaxOffset=this._updateStudiesMaxOffset.bind(this),this.mainSeries().dataEvents().seriesTimeFrame().subscribe(this,((e,t,i,s)=>{if(null!==this._lastAppliedGotoTimeRange&&null!==i&&s&&(0,$t.areEqualTimeFrames)(this._lastAppliedGotoTimeRange.range,i)){const e=this.appliedTimeFrame().value();null!==e&&!this._lastAppliedGotoTimeRange.actual&&(0,$t.areEqualTimeFrames)(this._lastAppliedGotoTimeRange.range,e.val)&&this.appliedTimeFrame().setValue(null),this._lastAppliedGotoTimeRange=null}})),this.mainSeries().dataEvents().completed().subscribe(this,(e=>{
null===this._lastAppliedGotoTimeRange&&null!==this._lastGotoTimeRange&&(this.gotoTimeRange(this._lastGotoTimeRange.from,this._lastGotoTimeRange.to),this._lastGotoTimeRange=null)}));const g=this._panes[0];g.setStretchFactor(2*g.stretchFactor()),this._properties.listeners().subscribe(this,this.lightUpdate),this._properties.childs().timezone.subscribe(null,(()=>{this._chartApi&&this._chartApi.isConnected().value()&&this._chartApi.switchTimezone(this.timezone())})),g.addDataSource(this.m_mainSeries,g.findSuitableScale(this.m_mainSeries),!1),this._barsMarksSources=o(this);for(const e of this._barsMarksSources)e.setOwnerSource(this.m_mainSeries),g.addDataSource(e,this.m_mainSeries.priceScale(),!0);this.m_mainSeries.symbolResolved().subscribe(this,this._clearAvailablePriceSources),this._createLollipopSourcesWatcher()}setStudiesMetaData(e,t){this._studiesMetaData=e,this._studyVersioning=new w.StudyVersioning(this._studiesMetaData,t)}restart(){this._chartApi.switchTimezone(this.timezone()),this._timeScale.reset(),this.m_mainSeries.restart();for(const e of this.dataSources())e.restart&&e!==this.m_mainSeries&&e.restart();this.sessions().restart()}version(){return 3}collapsed(){return this._hibernateWV}visibleRangeStudiesInputs(){return this._visibleRangeStudiesInputs.readonly()}chartSaveTime(){return this._chartSaveTime}setChartSaveTime(e){this._chartSaveTime=e}destroy(){var e;this._phantomSourceContainer.destroy(),this._hoveredSourceChanged.destroy(),null!==this._watermarkSource&&(this._watermarkSource.destroy(),this._watermarkSource=null),Array.from(this._customSourcesMap.keys()).forEach(this._removeCustomSource,this),(0,n.assert)(0===this._topmostCustomSources.length),(0,n.assert)(0===this._fgCustomSources.length),(0,n.assert)(0===this._bgCustomSources.length),(0,n.assert)(0===this._allCustomSources.length),(0,n.assert)(0===this._customSourcesMap.size),null!==this._lollipopSourcesWatcher&&(this._lollipopSourcesWatcher.destroy(),this._lollipopSourcesWatcher=null),null!==this._alertsWatcher&&this._alertsWatcher.destroy(),this._properties.childs().paneProperties.childs().background.unsubscribeAll(this),this._properties.childs().paneProperties.childs().backgroundType.unsubscribeAll(this),this._properties.childs().paneProperties.childs().backgroundGradientEndColor.unsubscribeAll(this),this._properties.childs().paneProperties.childs().backgroundGradientStartColor.unsubscribeAll(this),this._watchedThemeSpawn.destroy(),this._lastHoveredHittestData=null,this._lastSelectedHittestData=null,(0,Z.currencyUnitVisibilityProperty)().unsubscribeAll(this),(0,X.autoLogButtonsVisibilityProperty)().unsubscribeAll(this),this._crossHairSelectPointMode.destroy(),this.m_mainSeries.symbolResolved().unsubscribe(this,this._clearAvailablePriceSources),null===(e=this._lollipopSourcesWatcherLoader)||void 0===e||e.destroy(),this._destroyed=!0}undoModel(){return this._undoModel}onData(e){switch(e.method){case"timescale_update":{const t=e.params;this._updateTimeScale({index:t.index,zoffset:t.zoffset,values:t.changes,indexDiffs:t.index_diff,
baseIndex:t.baseIndex,marks:t.marks,clearFlag:t.clear});break}case"timescale_completed":{const t=Boolean(e.params[0]);this._timeScale.onTimeScaleCompleted(t);break}}}addStrategySource(e,t){1!==t&&-1===this._strategySources.indexOf(e)&&(this._strategySources.push(e),this._strategySourcesChange.fire(t),this.setActiveStrategySource(e))}removeStrategySource(e,t){if(1===t)return;const i=this._strategySources.indexOf(e);if(-1!==i){if(this._strategySources.splice(i,1)[0]===this._activeStrategySource.value()&&this.unsetActiveStrategySource(),this._strategySources.length>0){const e=this._strategySources[this._strategySources.length-1];this.setActiveStrategySource(e)}this._strategySourcesChange.fire(t)}}setActiveStrategySource(e){-1!==this._strategySources.indexOf(e)&&this._activeStrategySource.setValue(e)}unsetActiveStrategySource(){this._activeStrategySource.setValue(null)}activeStrategySource(){return this._activeStrategySource}strategySources(){return this._strategySources}strategySourcesChange(){return this._strategySourcesChange}setScrollEnabled(e){this._scrollEnabled=e}scrollEnabled(){return this._scrollEnabled}setZoomEnabled(e){this._zoomEnabled=e}zoomEnabled(){return this._zoomEnabled}zoomToViewport(e,t,i,s,r){this.setTimeViewport(e,t);let n=Math.min(i,s),o=Math.max(i,s);const a=r.defaultPriceScale();a.isPercentage()||a.setMode({autoScale:!1}),a.isLog()&&(n=a.priceToLogical(n),o=a.priceToLogical(o)),a.setPriceRange(new ue.PriceRange(n,o)),this.recalculateAllPanes((0,H.viewportChangeEvent)()),this.invalidate(this._paneInvalidationMask(r,K.InvalidationLevel.Light))}setTimeViewport(e,t){const i=this.appliedTimeFrame().value();null!==this._lastAppliedGotoTimeRange&&null!==i&&(0,$t.areEqualTimeFrames)(this._lastAppliedGotoTimeRange.range,i.val)&&!this._lastAppliedGotoTimeRange.actual||(this.timeScale().zoomToBarsRange(e,t),this.recalculateAllPanes((0,H.viewportChangeEvent)()),this.recalcVisibleRangeStudies(),this.lightUpdate())}onTagsChanged(){return this._tagsChanged}canZoomIn(){return this._timeScale.canZoomIn()&&this._zoomEnabled}canZoomOut(){return this._timeScale.canZoomOut()&&this._zoomEnabled}onPaneTagsChanged(){this._tagsChanged.fire()}panesCollectionChanged(){return this._panesCollectionChanged}dataSourceCollectionChanged(){return this._dataSourceCollectionChanged}symbolSourceCollectionChanged(){return this._symbolSourceCollectionChanged}symbolSourceResolved(){return this._symbolSourceResolved}symbolSourceResolvingActive(){return this._symbolSourceResolvingActive}adjustForDividendsAvailability(){return this._adjustForDividendsAvailability}adjustForDividendsEnabled(){return this._adjustForDividendsEnabled}paneCollapsingAvailable(){return this._paneCollapsingAvailable}sourcePropertiesChanged(){return this._sourceProperitesChanged}sourceZOrderChanged(){return this._sourceZOrderChanged}zoomTime(e,t,i){if(!this._zoomEnabled)return;const s=this.timeScale();if(s.isEmpty()||0===t)return;const r=s.width();e=Math.max(1,Math.min(e,r-2)),s.zoom(e,t,i),this.recalculateAllPanes((0,H.viewportChangeEvent)()),this.lightUpdate(),
this.recalcVisibleRangeStudies()}lineBeingEdited(){return this._lineBeingEdited}linePointBeingEdited(){return this._linePointBeingEdited}activeItemBeingMoved(){return this._activeItemBeingMoved}linePointBeingChanged(){return this._linePointBeingChanged}updateAllPaneViews(e){for(const t of this._panes)t.updateAllViews(e)}dataSources(){const e=[this.crossHairSource()];for(const t of this._panes)for(const i of t.dataSources())e.push(i);return e}priceDataSources(){const e=[];for(const t of this._panes)for(const i of t.priceDataSources())e.push(i);return e}symbolSources(){const e=[];for(const t of this._panes)for(const i of t.symbolSources())e.push(i);return e}selection(){return this._selection}selectionMacro(e,t=!1){const i=this.selection().allSources();e({removeSourceFromSelection:this._removeSourceFromSelection,addSourceToSelection:this._addSourceToSelection,clearSelection:this._clearSelection,selection:this.selection.bind(this)});const s=(0,v.subtract)(i,this.selection().allSources()),r=(0,v.subtract)(this.selection().allSources(),i);r.concat(i).forEach((e=>e.updateAllViews((0,H.selectionChangeEvent)())));let n=[];s.forEach((e=>{if((0,S.isLineTool)(e)){const i=e.hasAlert().value()&&e.getAlertSync();i&&!i.isPrice()&&i.setSelected(!1),!t&&e.shouldBeRemovedOnDeselect()&&n.push(e)}})),r.forEach((e=>{const t=(0,S.isLineTool)(e)&&e.hasAlert&&e.hasAlert().value()&&e.getAlertSync();t&&t.setSelected(!0)})),n=n.filter((e=>null!==this.dataSourceForId(e.id()))),n.length>0&&this._undoModel.removeSources(n,!1,us),this.lightUpdate(),(s.length>0||r.length>0)&&this._selectedSourceChanged.fire()}onSelectedSourceChanged(){return this._selectedSourceChanged}checkLineToolSelection(){const e=this.selection().allSources();this._selection.checkLineToolSelection(),e.length!==this.selection().allSources().length&&this._selectedSourceChanged.fire()}lineToolsGroupModel(){return this._lineToolsGroupModel}restoreLineToolsGroups(e){this._lineToolsGroupModel=kt.fromState(this,e)}realignLineTools(e){for(const t of this._panes)(void 0===e||t.hasDataSource(e))&&t.realignLineTools(e)&&this._dataSourceCollectionChanged.fire(t)}copyToOtherCharts(e,t){const i=this.mainSeries(),s=i.syncModel(),r=this.timeScale();if(s)for(const o of e){if(!o.isSynchronizable())continue;const e=o.linkKey().value()||(0,Q.randomHash)();o.linkKey().setValue(e);const a=o.state(!1),l=o.normalizedPoints(),c=o.properties().interval.value(),h=i.interval();let d;if(T.Interval.isEqual(c,h))d=l.map((e=>{const t=(0,n.ensureNotNull)(r.timePointToIndex(e.time_t))+e.offset;return{price:e.price,timeStamp:(0,n.ensureNotNull)(this.externalTimeStamp(t))}}));else{const e=s.createNewModelWithResolution(c);d=l.map((t=>({price:t.price,timeStamp:0===t.offset?t.time_t:e.projectTime(t.time_t,t.offset)})))}const u={...a,id:o.id(),linkKey:e,points:d,linetool:o.toolname,model:this,symbol:i.symbol(),withUndo:t,zOrder:o.zorder(),finalState:{points:l,interval:c},pointPositionPercents:o.isFixed()?o.calcPositionPercents():void 0,sharingMode:o.sharingMode().value()};(0,Pe.copyLineTool)(u)}}isSnapshot(){
return this._isSnapshot}onWidget(){return this._options.onWidget}hideIdeas(){return this._options.hideIdeas}updateSource(e){const t=this._invalidationMaskForSource(e);null!==t&&this.invalidate(t)}updateSourcePriceScale(e){const t=this._invalidationMaskForSourcePriceScale(e);null!==t&&this.invalidate(t)}updatePane(e){this.invalidate(this._paneInvalidationMask(e))}updateTimeScaleBaseIndex(e){const t=this.mainSeries().bars();t.isEmpty()||this._updateBaseIndex((0,n.ensureNotNull)(t.lastIndex()),!!(e&&e.index>0))}setInterval(e,t){const i=setInterval(e,t);return this._modelIntervals.push(i),i}clearInterval(e){clearInterval(e);const t=this._modelIntervals.indexOf(e);t>-1&&this._modelIntervals.splice(t,1)}clearIntervals(){for(let e=0;e{i.ownerSource()===e&&i.setOwnerSource(t)})),this._invalidateBarColorerCaches(),t.start(),this.recalculatePane(i,(0,H.sourceChangeEvent)(t.id())),this.fullUpdate(),!0}insertStudyStub(e,t){const i=void 0!==t,s=new P.StudyStub(this,null,e,i);let r;if(t||!i){r=this.mainPane();const e=r.createPriceScaleAtPosition("overlay");r.addDataSource(s,e,!1)}else r=this.createPane(),r.addDataSource(s,null,!1);return this.recalculatePane(r,(0,H.sourceChangeEvent)(s.id())),this.fullUpdate(),s}removeStudyStub(e){const t=this.dataSourceForId(e);return null===t?(ms.logNormal("StudyStub id="+e+" is not found in chart model"),!1):(this.removeSource(t),!0)}allLineTools(){return this._getAllSources(S.isLineTool)}setHoveredSource(e,t=null){const i=this._hoveredSource!==e;if(!i&&(0,Ot.hitTestResultDataAreEqual)(this._lastHoveredHittestData,t))return;this._lastHoveredHittestData=t;let s=null;if(this._hoveredSource){this._hoveredSource.updateAllViews((0,H.selectionChangeEvent)()),s=new K.InvalidationMask(K.InvalidationLevel.Cursor);const e=this._invalidationMaskForSource(this._hoveredSource,K.InvalidationLevel.Light);null!==e&&s.merge(e)}if(this._hoveredSource=e,e){e.updateAllViews((0,H.selectionChangeEvent)()),s||(s=new K.InvalidationMask(K.InvalidationLevel.Cursor));const t=this._invalidationMaskForSource(e,K.InvalidationLevel.Light);null!==t&&s.merge(t)}s&&this.invalidate(s),i&&this._hoveredSourceChanged.fire(e)}properties(){return this._properties}chartApi(){return this._chartApi}disconnect(){this.sessions().stop();for(const e of this.dataSources())e.disconnect&&e.disconnect();this._timeScale.disconnect()}crossHairSource(){return this.m_crossHairSource}gridSource(){return this._gridSource}publishedChartsTimelineSource(){return null}hoveredSource(){return this._hoveredSource}hoveredSourceChanged(){return this._hoveredSourceChanged}lastHittestData(){return this._lastHoveredHittestData}lastSelectedHittestData(){return this._lastSelectedHittestData}lightUpdate(){this.invalidate(K.InvalidationMask.light())}fullUpdate(){this.invalidate(K.InvalidationMask.full())}syncTimeWithModel(e,t){const i=this.mainSeries().syncModel();if(null===i)return;const s=1e3*this.createSyncPoint(e,i.syncSourceTarget()).sourceTimeToTargetTime(t/1e3),r=(0,Dt.get_timezone)(this.timezone());let n=(0,Dt.utc_to_cal)(r,s);this.mainSeries().isDWM()&&(n=i.getSession().spec.correctTradingDay(n),(0,Dt.set_hms)(n,0,0,0,0,(0,Dt.get_timezone)("Etc/UTC"))),this._gotoTimeImpl(n.getTime(),{centerIfVisible:!1})}gotoTime(e){return this._gotoTimeImpl(e,{centerIfVisible:!0})}recalculatePane(e,t){null==e||e.recalculate(t)}recalculateAllPanes(e){this._panes.forEach((t=>t.recalculate(e))),this.updateAllPaneViews(e),this.crossHairSource().updateAllViews(e)}gotoTimeRange(e,t){const i=this.timeScale(),s=i.tickMarks(),r=this.mainSeries();if(void 0===s.minIndex)return void(this._lastGotoTimeRange={from:e,to:t});let o=e,a=t
;const l=r.symbolInfo();if(null!==l){let i=this.properties().childs().timezone.value();"exchange"===i&&(i=l.timezone);const s=(0,Dt.get_timezone)(i),n=(0,Dt.utc_to_cal)(s,e),c=(0,Dt.utc_to_cal)(s,t);if(r.isDWM()){const e=(0,Dt.get_timezone)("Etc/UTC");(0,Dt.set_hms)(n,0,0,0,0,e),(0,Dt.set_hms)(c,0,0,0,0,e)}o=n.getTime(),a=c.getTime()}const c=(0,n.ensureDefined)(s.maxIndex),h=(0,n.ensureDefined)(s.minIndex);if(o>=(0,n.ensureNotNull)(s.indexToTime(h)).valueOf()||r.endOfData()){const e=(e,t)=>e(0,n.ensureNotNull)(s.indexToTime(e)).valueOf(),l=(0,v.lowerboundExt)(t,o,e,s.nearestIndex(o),c);let d=o===a?l:(0,v.lowerboundExt)(t,a,e,s.nearestIndex(a),c);this._lastGotoTimeRange=null,null!==this._lastAppliedGotoTimeRange&&(this._lastAppliedGotoTimeRange.actual=!1);const u=i.baseIndex();if(l+Math.max(d-l+1,i.minVisibleBarCount())>u){const e=i.targetDefaultRightOffset();d-u=0;t--)if(this._panes[t].hasDataSource(e))return this._panes[t];return e instanceof Wt.BarsMarksContainer?this.paneForSource(this.mainSeries()):null}mainPane(){for(const e of this._panes)if(e.isMainPane())return e;throw new Error("Main pane is not found")}lastPane(){return this._panes[this._panes.length-1]}removeSource(e,t){this.selectionMacro((t=>t.removeSourceFromSelection(e)),!0),this._hoveredSource===e&&(this._hoveredSource=null,this._lastHoveredHittestData=null),this._sourcesBeingMoved.includes(e)&&(this._sourcesBeingMoved=this._sourcesBeingMoved.filter((t=>t!==e)),this._sourcesBeingMoved.length||(this._activeItemBeingMoved=null)),e===this._lineBeingEdited&&(this._lineBeingEdited=null,Pe.isToolEditingNow.setValue(!1)),e===this._lineBeingCreated&&(this._lineBeingCreated=null,Pe.isToolCreatingNow.setValue(!1)),!t&&e.stop&&e.stop();const i=this.detachSource(e),s=this.mainSeries().priceScale();return(0,G.isStudy)(e)&&(0,me.isActingAsSymbolSource)(e)&&e.priceScale()===s&&s.isPercentage()&&1===s.seriesLikeSources().filter(me.isActingAsSymbolSource).length&&s.setMode({percentage:!1}),this.fullUpdate(),this._invalidateBarColorerCaches(),(0,G.isStudy)(e)&&((0,_.emit)("study_event",e.id(),"remove"),e.isChildStudy()&&e.parentSources().forEach((t=>t.unsetChild(e))),e.maxOffset().unsubscribe(this._boundUpdateStudiesMaxOffset)),!t&&e.destroy&&e.destroy(),(0,S.isLineTool)(e)&&(e.removeAlert(),(0,_.emit)("drawing_event",e.id(),"remove")),i}
allStudies(e){const t=e?e=>(0,G.isStudy)(e)&&!0:G.isStudy;return this._getAllSources(t)}studiesWV(e){return e?this._studiesExcludeInternalWV.readonly():this._studiesWV.readonly()}findNonOverlayStudyWithGroupingKey(e,t){const i=void 0!==t?[t]:this._panes;for(const t of i){const i=t.dataSources().find((i=>(0,G.isStudy)(i)&&i.metaInfo().groupingKey===e&&!t.isOverlay(i)));if(void 0!==i)return{pane:t,study:i}}return null}movePaneUp(e){this.movePane(e,e-1)}movePaneDown(e){this.movePane(e,e+1)}movePane(e,t){const i=this._panes[e];this._panes.splice(e,1),this._panes.splice(t,0,i),this._panesCollectionChanged.fire(this._panes),this._onRearrangePanes.fire(),this.invalidate(K.InvalidationMask.panesOrder())}toggleCollapsedPane(e){const t=this._panes[e];t.collapsed().setValue(!t.collapsed().value()),this.fullUpdate()}backgroundColor(){return this._backgroundColor}backgroundTopColor(){return this._backgroundTopColor}backgroundColorAtYPercentFromTop(e){const t=this.backgroundColor().value(),i=this.backgroundTopColor().value();if(t===i)return t;if(e=Math.max(0,Math.min(100,Math.round(100*e))),null===this._gradientColorsCache||this._gradientColorsCache.topColor!==i||this._gradientColorsCache.bottomColor!==t)this._gradientColorsCache={topColor:i,bottomColor:t,colors:new Map};else{const t=this._gradientColorsCache.colors.get(e);if(void 0!==t)return t}const s=(0,Ft.gradientColorAtPercent)(i,t,e/100);return this._gradientColorsCache.colors.set(e,s),s}backgroundCounterColor(){return this._backgroundCounterColor.readonly()}dark(){return this._isDark}defaultResolutions(){return this.chartApi().defaultResolutions()}availableCurrencies(){const e=this._getAvailableCurrencies();return e.length!==this._availableCurrencies.size()&&(this._availableCurrencies=new Ut(e)),this._availableCurrencies}currencyConversionEnabled(){return this._options.currencyConversionEnabled}availableUnits(){const e=this._getAvailableUnits();return this._availableUnits.unitsChanged(e)&&(this._availableUnits=new jt(e)),this._availableUnits}unitConversionEnabled(){return this._options.unitConversionEnabled}availablePriceSources(e){const t=this._getAvailablePriceSources(e);return null!==t&&this._availablePriceSources.priceSourcesChanged(t)&&(this._availablePriceSources=new cs(t)),this._availablePriceSources}resetDeferredStudies(){Oe.instance(this).reset()}isJustClonedChart(){return this._undoModel.isJustClonedChart()}studyTemplate(e,t,i){const s={panes:[],version:this.version()};for(const e of this.panes())s.panes.push(e.state(!0,!1,!0));const r=this.mainSeries();return e&&(s.symbol=r.symbol(),this.currencyConversionEnabled()&&i&&(s.currency=r.currency()),this.unitConversionEnabled()&&i&&(s.unit=r.unit())),t&&(s.interval=r.interval()),s}getStudyById(e){const t=this.dataSourceForId(e);return null!==t&&(0,G.isStudy)(t)?t:null}getLineToolById(e){const t=this.dataSourceForId(e);return null!==t&&(0,S.isLineTool)(t)?t:null}restoreLineToolState(e,t,i){var s;e.restorePoints(t.points,t.indexes||[]),t.state.intervalsVisibilities=(0,
We.mergeIntervalVisibilitiesDefaults)(t.state.intervalsVisibilities),e.properties().merge(t.state),e.restoreData&&e.restoreData(t),e.linkKey().setValue(t.linkKey||null),e.createServerPoints(),e.setZorder(null!==(s=t.zorder)&&void 0!==s?s:e.zorder()),this.fullUpdate();const r=e.linkKey().value();null!==r&&i&&(0,Pe.restoreLineToolState)({model:this,linkKey:r,state:t})}preferences(){return(0,ss.preferencesByWhiteList)(this,this.mainSeries())}restoreTheme(e,t,i){e.mainSourceProperties.hollowCandleStyle||(e.mainSourceProperties.hollowCandleStyle=e.mainSourceProperties.candleStyle),this._undoModel.chartLoadTheme(e,t,i)}onResetScales(){return this._resetScales}startMovingSources(e,t,i,s,r,o){this._sourcesBeingMoved=e,this._activeItemBeingMoved=i;let a=!1;if(this._sourcesBeingMoved.forEach((e=>{!a&&(0,G.isStudy)(e)&&(a=!0);const l=(0,n.ensureNotNull)(this.paneForSource(e)),c=(0,S.isLineTool)(e),h=c&&e.linkKey().value();if(!1!==h&&null!==h&&s.has(h)&&c&&e.isFixed()){const t=(0,n.ensureDefined)(s.get(h)),a={screen:this._percentPositionToPoint(t,l)};e.startMoving(a,i,r,o)}else e.startMoving(t,i,r,o);const d=this._paneInvalidationMask(l,K.InvalidationLevel.Light);this.invalidate(d)})),!o){const s=e.filter(S.isLineTool).filter((e=>e.linkKey().value()&&e.isSynchronizable())).map((e=>e.linkKey().value()));if(s.length&&t.logical){const o=this.externalTimeStamp(t.logical.index),a={linkKeys:s,model:this,symbol:this.mainSeries().symbol(),point:{price:t.logical.price,timeStamp:o},activeItem:null!==i?i:void 0,envState:r,pointPositionPercents:new Map};e.forEach((e=>{if((0,S.isLineTool)(e)){const i=e.linkKey().value();if(i&&e.isSynchronizable()&&e.isFixed()){const s=(0,n.ensureNotNull)(this.paneForSource(e));a.pointPositionPercents.set(i,this._pointToPercentPosition((0,n.ensureDefined)(t.screen),s))}}})),(0,Pe.startMovingLineTool)(a)}}Pe.isToolMovingNow.setValue(!0),a&&Pe.isStudyEditingNow.setValue(!0)}moveSources(e,t,i,s){if(this._sourcesBeingMoved.filter((e=>!e.isLocked||!e.isLocked())).forEach((r=>{const o=(0,S.isLineTool)(r)?r.linkKey().value():null;if(null!==o&&t.has(o)){const e=(0,n.ensureNotNull)(this.paneForSource(r)),a=(0,n.ensureDefined)(t.get(o)),l={screen:this._percentPositionToPoint(a,e)};r.move(l,this._activeItemBeingMoved,i,s)}else r.move(e,this._activeItemBeingMoved,i,s)})),this.lightUpdate(),!s&&e.logical){const t=this._sourcesBeingMoved.filter(S.isLineTool).filter((e=>e.isSynchronizable()&&!!e.linkKey().value())).map((e=>e.linkKey().value())),s=this.externalTimeStamp(e.logical.index),r={linkKeys:t,model:this,point:{price:e.logical.price,timeStamp:s},envState:i,pointPositionPercents:new Map};this._sourcesBeingMoved.filter(S.isLineTool).forEach((t=>{if(t.linkKey().value()&&t.isSynchronizable()&&t.isFixed()){const i=(0,n.ensureNotNull)(this.paneForSource(t));r.pointPositionPercents.set(t.linkKey().value(),this._pointToPercentPosition((0,n.ensureDefined)(e.screen),i))}})),(0,Pe.moveLineTool)(r)}}endMovingSources(e,t,i){const s=this._sourcesBeingMoved.map((s=>{const r=(0,
n.ensureNotNull)(this.paneForSource(s)),o=s.endMoving(e,t,i),a=this._paneInvalidationMask(r,K.InvalidationLevel.Light);return a.invalidateAll(K.InvalidationLevel.Light),this.invalidate(a),o})),r=this._sourcesBeingMoved.filter(S.isLineTool).filter((e=>e.isSynchronizable()&&!!e.linkKey().value())).map((e=>e.linkKey().value())),o=this._sourcesBeingMoved.filter(S.isLineTool).filter((e=>e.isSynchronizable()&&!!e.linkKey)).map((e=>{const t={points:e.normalizedPoints(),interval:this.mainSeries().interval()};return e.isFixed()&&(t.pointPositionPercents=e.calcPositionPercents()),t}));r.length&&(0,Pe.finishMovingLineTool)({linkKeys:r,model:this,finalStates:o,changes:s}),this._sourcesBeingMoved=[],this._activeItemBeingMoved=null,Pe.isToolMovingNow.setValue(!1),Pe.isStudyEditingNow.setValue(!1)}sourcesBeingMoved(){return this._sourcesBeingMoved}setMovingCustomSource(e,t){this._customSourceBeingMoved=e,this._customSourceBeingMovedHitTestData=null!==t?{beingMoved:!1,cancelled:!1,...t}:null}processingCustomSourceMove(){null!==this._customSourceBeingMovedHitTestData&&(this._customSourceBeingMovedHitTestData.beingMoved=!0)}customSourceMovingHitTestData(){return this._customSourceBeingMovedHitTestData}customSourceBeingMoved(){return null!==this._customSourceBeingMovedHitTestData&&this._customSourceBeingMovedHitTestData.beingMoved?this._customSourceBeingMoved:null}lineToolsSynchronizer(){return this._lineToolsSynchronizer}setLineToolsSynchronizer(e){this._lineToolsSynchronizer=e}width(){return this._width}setWidth(e,t){this._width=e,this._timeScale.setWidth(e,t);for(const t of this._panes)t.setWidth(e);this.recalculateAllPanes((0,H.viewportChangeEvent)()),this.recalcVisibleRangeStudies()}setPaneHeight(e,t){e.setHeight(t),this.recalculateAllPanes((0,H.viewportChangeEvent)()),this.lightUpdate()}resetScalesAvailable(){return this._resetScalesAvailable.readonly()}panes(){return this._panes}paneForId(e){return this._panes.find((t=>t.id()===e))||null}createPane(e,t,i){const s=this._undoModel.chartWidget();s.isMaximizedPane()&&s.toggleMaximizePane(null);const r=this._properties.childs().paneProperties;t&&r.merge(t);const n=new Xe(this._timeScale,r,this,i);return void 0!==e?this._panes.splice(e,0,n):this._panes.push(n),n.onTagsChanged().subscribe(this,Ss.prototype.onPaneTagsChanged),n.dataSourcesCollectionChanged().subscribe(this,(()=>this._dataSourceCollectionChanged.fire(n))),n.symbolSourceCollectionChanged().subscribe(this,(()=>this._onSymbolSourceCollectionChanged(n))),n.priceSourcesCollectionChanged().subscribe(this,(()=>this._onPriceSourcesCollectionChanged(n))),n.sourcePropertiesChanged().subscribe(this,(e=>this._sourceProperitesChanged.fire(n,e))),n.sourceZOrderChanged().subscribe(this,(e=>this._sourceZOrderChanged.fire(n,e))),n.symbolSourceResolved().subscribe(this,(e=>this._symbolSourceResolved.fire(n,e))),n.symbolSourceResolvingActive().subscribe(this._recalcSymbolResolvingActive),n.collapsed().subscribe(this._recalcPaneCollapsingAvailable),n.resetPriceScalesAvailable().subscribe(this._updateResetScalesAvailableValue,{
callWithLast:!0}),this._recalcPaneCollapsingAvailable(),this._panesCollectionChanged.fire(this._panes),this.invalidate(K.InvalidationMask.panesOrder()),n}removePane(e){const t=this._undoModel.chartWidget();t.isMaximizedPane()&&t.toggleMaximizePane(null);const i=e;i.destroy();const s=this._panes.indexOf(i);-1!==s&&(this._panes.splice(s,1),e.dataSourcesCollectionChanged().unsubscribeAll(this),e.symbolSourceCollectionChanged().unsubscribeAll(this),e.priceSourcesCollectionChanged().unsubscribeAll(this),e.sourcePropertiesChanged().unsubscribeAll(this),e.onTagsChanged().unsubscribeAll(this),e.symbolSourceResolved().unsubscribeAll(this),i.symbolSourceResolvingActive().unsubscribe(this._recalcSymbolResolvingActive),e.collapsed().unsubscribe(this._recalcPaneCollapsingAvailable),e.resetPriceScalesAvailable().unsubscribe(this._updateResetScalesAvailableValue),this._recalcPaneCollapsingAvailable(!0)),this._updateResetScalesAvailableValue();this.crossHairSource().pane===e&&this.clearCurrentPosition(),this._panesCollectionChanged.fire(this._panes),this.invalidate(K.InvalidationMask.panesOrder())}changePanesHeight(e,t){if(this._panes.length<2)return;(0,n.assert)(e>=0&&ee+t.stretchFactor()),0),r=this._panes.reduce(((e,t)=>e+t.height()),0),o=r-30*(this._panes.length-1);t=Math.min(o,Math.max(30,t));const a=s/r,l=i.height();i.setStretchFactor(t*a);let c=t-l,h=this._panes.length-1;for(const e of this._panes)if(e!==i){const t=Math.min(o,Math.max(30,e.height()-c/h));c-=e.height()-t,h-=1;const i=t*a;e.setStretchFactor(i)}this.fullUpdate()}clearCurrentPosition(){const e=this.crossHairSource();e.clearPosition(),(0,n.ensureNotNull)(e.dataWindowView()).update(),fs(this._panes),this.invalidate(K.InvalidationMask.cursor());const t=this._undoModel.chartWidget();t.chartWidgetCollection().syncCrosshair(null,t.id()),this._phantomSourceContainer.onCursorPositionUpdated()}setAndSaveCurrentPosition(e,t,i,s){this.crossHairSource().saveOriginCoords(e,t),this.setCurrentPosition(e,t,i,s)}setCurrentPosition(e,t,i,s){var r,o,a,l,c,h;let d=NaN;const u=this._timeScale.coordinateToVisibleIndex(e),p=null!==(a=null===(o=null!==(r=this._lineBeingEdited)&&void 0!==r?r:this._lineBeingCreated)||void 0===o?void 0:o.priceScale())&&void 0!==a?a:i.defaultPriceScale();let _=null;!p.isEmpty()&&Number.isFinite(t)&&(_=(0,n.ensureNotNull)(i.mainDataSource()).firstValue(),null!==_&&(d=p.coordinateToPrice(t,_)));const m=this._crossHairSelectPointMode.value()!==Pe.SelectPointMode.None,g=this.currentTool(),f=this.mainSeries(),v=this.crossHairSource(),S=v.index,y=v.price,b=m||Pe.isStudyEditingNow.value(),w=p===this.m_mainSeries.priceScale()&&(this._lineBeingCreated||this._lineBeingEdited||(0,de.isLineToolName)(g)||(0,Pe.toolIsMeasure)(g)||b);!this._isSettingsExternalPosition&&w?(d=this._magnet.align(d,u,i),null!==_&&this._setCorrectedPositionToCrosshair(u,d,i)):this._magnet.resetLastValue();let C=null;if(isNaN(d)||(C=i),this._isTimeScrolling){if(!this._isSettingsExternalPosition&&m){
const e=f.bars().firstIndex(),t=f.bars().lastIndex();if(null!==e&&null!==t){const s=Math.min(Math.max(u,e),t);s!==u&&this._setCorrectedPositionToCrosshair(s,d,i)}}else v.setPosition(v.index,d,C);return}v.setOnHoveredChartWidget(!0),v.setPosition(u,d,C),(0,n.ensureNotNull)(v.dataWindowView()).update(),fs(this._panes);const P=f.syncModel();if(this.crossHairSource().startMeasurePoint()||this._lineBeingCreated?this.lightUpdate():this.invalidate(K.InvalidationMask.cursor()),this._lineBeingCreated){const e=this._lineBeingCreated.linkKey().value();if(!this._isSettingsExternalPosition){const t=this._lineBeingCreated.setLastPoint({index:u,price:d},s);if(this._lineBeingCreated.updateAllViews((0,H.sourceChangeEvent)(this._lineBeingCreated.id())),t.price===d&&t.index===u||this._setCorrectedPositionToCrosshair(t.index,t.price,i),P&&e){const i=this._timeScale.points().roughTime(t.index,P.projectTime.bind(P));(0,Pe.setLineToolLastPoint)({model:this,linkKey:e,point:{timeStamp:(0,n.ensureNotNull)(i),price:t.price}})}}}if(!this._isSettingsExternalPosition&&null!==this._lineBeingEdited&&null!==this._linePointBeingEdited){const e={index:u,price:d};if(null===(l=this._linePointBeingChanged)||void 0===l?void 0:l.nonDiscreteIndex){const t=this.crossHairSource().originX();Number.isFinite(t)&&(e.index=this._timeScale.coordinateToFloatIndex(t))}this.changeLinePoint(e,s);const t=this._lineBeingEdited.alignCrossHairToAnchor(this._linePointBeingEdited)?this._lineBeingEdited.getPoint(this._linePointBeingEdited):e;null!==t&&this._setCorrectedPositionToCrosshair(t.index,t.price,i)}if(!this._isSettingsExternalPosition&&1===this._sourcesBeingMoved.length){const e=this._sourcesBeingMoved[0];if(null===(c=e.alignCrossHairToMovePoint)||void 0===c?void 0:c.call(e)){const t=null===(h=e.currentMovingPoint)||void 0===h?void 0:h.call(e);t&&t.logical&&this._setCorrectedPositionToCrosshair(t.logical.index,t.logical.price,i)}}if(!this._isSettingsExternalPosition&&b){const e=f.bars().firstIndex(),t=f.bars().lastIndex();if(null!==e&&null!==t){const s=Math.min(Math.max(u,e),t);s!==u&&this._setCorrectedPositionToCrosshair(s,d,i)}}(S!==u||y!==d)&&this._syncCrosshair(s)}setExternalPosition(e,t){let i;const s=this.crossHairSource();if(s.setOnHoveredChartWidget(!1),null!==e&&(0,se.isNumber)(e.timeStamp)){const t=this.mainSeries().syncModel();if(t){const s=this.createSyncPoint(e.syncSourceTarget,t.syncSourceTarget()).sourceTimeToTargetTime(e.timeStamp);i=this._timeScale.points().roughIndex(s,t.distance.bind(t))}}if(null!==e&&null!=i&&Number.isFinite(i)){this._isSettingsExternalPosition=!0;const r=(0,n.ensureNotNull)(this.paneForSource(this.mainSeries())),o=this._timeScale.indexToCoordinate(i),a=(0,n.ensureNotNull)(r.mainDataSource()).firstValue();if(null!==a){let i=NaN;void 0!==e.price&&Number.isFinite(e.price)&&(i=this.mainSeries().priceScale().priceToCoordinate(e.price,a)),s.clearOriginCoords(),this.setCurrentPosition(o,i,r,t)}return s.setOnHoveredChartWidget(!1),void(this._isSettingsExternalPosition=!1)}s.clearPosition(),(0,
n.ensureNotNull)(s.dataWindowView()).update(),fs(this._panes),this.invalidate(K.InvalidationMask.cursor())}startScaleTime(e){this._timeScale.startScale(e)}scaleTimeTo(e){this._timeScale.scaleTo(e),this.recalculateAllPanes((0,H.viewportChangeEvent)()),this.lightUpdate()}endScaleTime(){this._timeScale.endScale(),this.lightUpdate(),this.recalcVisibleRangeStudies()}resetTimeScale(){this._timeScale.restoreDefault(),this.recalculateAllPanes((0,H.viewportChangeEvent)()),this.recalcVisibleRangeStudies(),this.lightUpdate(),this._resetScales.fire()}startScalePrice(e,t,i){e.startScalePrice(t,i)}scalePriceTo(e,t,i){e.scalePriceTo(t,i),this.mainSeries().priceScale().isLockScale()?this.lightUpdate():this.invalidate(this._paneInvalidationMask(e,K.InvalidationLevel.Light))}endScalePrice(e,t){e.endScalePrice(t),this.invalidate(this._paneInvalidationMask(e,K.InvalidationLevel.Light))}startTwoPointsScalePrice(e,t,i,s){t.startTwoPointsScale(i,s)}twoPointsScalePriceTo(e,t,i,s){t.twoPointsScale(i,s),this.invalidate(this._paneInvalidationMask(e))}endTwoPointsScalePrice(e,t){t.endTwoPointsScale(),this.invalidate(this._paneInvalidationMask(e))}resetPriceScale(e,t){e.resetPriceScale(t),this.invalidate(this._paneInvalidationMask(e,K.InvalidationLevel.Light))}restorePriceScaleState(e,t,i){e.restorePriceScaleState(t,i),this.invalidate(this._paneInvalidationMask(e,K.InvalidationLevel.Light))}currentTool(){return this._currentTool}setCurrentTool(e){this._currentTool!==e&&((0,de.isLineToolName)(e)&&this.selectionMacro((e=>{e.clearSelection()})),this._currentTool=e,this._phantomSourceContainer.onToolChanged())}detachSource(e){const t=this.paneForSource(e);return!!t&&(t.removeDataSource(e),t.isEmpty()?(this._lineBeingCreated&&t===this._paneBeingCreatedLineOn&&this.cancelCreatingLine(),this.removePane(t),!0):(this.fullUpdate(),!1))}children(e,t){return this.dataSources().filter((i=>(0,G.isStudy)(i)?!t&&i.parentSources().includes(e):i.ownerSource()===e))}onRearrangePanes(){return this._onRearrangePanes}finishLineTool(e){const t=e.linkKey().value();(0,Pe.drawOnAllCharts)().value()&&null!==t&&e.isSynchronizable()&&(0,Pe.finishLineTool)({linkKey:t,model:this})}startChangingLinetool(e,t,i,s,r){this._lineBeingEdited=e,this._linePointBeingChanged=t||null,this._linePointBeingEdited=void 0===i?null:i,this._lineBeingEdited.startChanging(i,t,r),Pe.isToolEditingNow.setValue(!0);const o=(0,n.ensureNotNull)(this.paneForSource(e));this._lineBeingEdited.startDragPoint&&void 0!==i&&void 0!==t&&this._lineBeingEdited.startDragPoint(i,t),r||void 0===i||void 0===t||this._lineBeingEdited.setPoint(i,t,s,r),this._lineBeingEdited.updateAllViews((0,H.sourceChangeEvent)(this._lineBeingEdited.id()));const a=this._paneInvalidationMask(o,K.InvalidationLevel.Light);this.invalidate(a);const l=e.linkKey().value();if(l&&e.isSynchronizable()&&void 0!==i&&void 0!==t){const e=(0,n.ensureNotNull)(this.externalTimeStamp(t.index));(0,Pe.startChangingLineTool)({linkKey:l,model:this,symbol:this.mainSeries().symbol(),point:{price:t.price,timeStamp:e},pointIndex:i,envState:s||null})}}
createLineTool(e,t,i,s,r,a,l,c){if((0,n.assert)((0,de.isLineToolName)(i),`Cannot create unknown line tool: ${i}`),s){const e={...rs.intervalsVisibilitiesDefaults},t=s.childs().intervalsVisibilities.state();(0,se.merge)(e,null!=t?t:{});const r=s.state();r.intervalsVisibilities=e,s=(0,S.createLineToolProperties)(i,r,this)}const h=(0,S.createLineTool)(i,this,s,null,void 0,c);if("LineToolExecution"!==i){let e;switch(i){case"LineToolIcon":e=h.properties().childs().icon.value().toString(16).toUpperCase();break;case"LineToolEmoji":e=h.properties().childs().emoji.value();break;case"LineToolSticker":e=h.properties().childs().sticker.value()}(0,u.trackEvent)("drawings","Study_Drawing_"+i,e)}(0,S.isStudyLineTool)(h)&&(0,u.trackEvent)("studies",`Study_${h.metaInfo().id}`);const d=!h.linkKey().value()&&!r;l=(0,n.ensureDefined)(l||(0,n.ensureNotNull)(e.mainDataSource())),s||(0,S.prepareLineToolPropertiesByOwnerSource)(h.properties(),l),h.setOwnerSource(l);const p=l.priceScale();if(h.setPriceScale(p),_s&&l===this.mainSeries()&&h.share(a),e.addDataSource(h,p,!1),null!==h.preferredZOrder()&&e.insertAfter([h],this.mainSeries()),(0,Pe.drawOnAllCharts)().value()){const e=h.isSynchronizable()?r||(0,Q.randomHash)():null;h.linkKey().setValue(e)}else h.linkKey().setValue(r);let _;if(h.isFixed()){const i=(0,n.ensureNotNull)((0,n.ensureNotNull)(e.mainDataSource()).firstValue()),s=this._timeScale.indexToCoordinate(t.index),r=(0,n.ensureNotNull)(p).priceToCoordinate(t.price,i);_=h.addFixedPoint(new o.Point(s,r))}else _=h.addPoint(t);return _||(this._lineBeingCreated=h,this._paneBeingCreatedLineOn=e,Pe.isToolCreatingNow.setValue(!0)),d&&h.enableCurrentIntervalVisibility(),this.fullUpdate(),h}endChangingLinetool(e,t){const i=(0,n.ensureNotNull)(this._lineBeingEdited),s=i.endChanging(!1,e,t);this._lineBeingEdited=null,Pe.isToolEditingNow.setValue(!1),this._linePointBeingEdited=null,this._linePointBeingChanged=null,this.lightUpdate();const r={points:i.normalizedPoints(),interval:this.mainSeries().interval()},o=i.linkKey().value();null!==o&&i.isSynchronizable()&&!t&&(0,Pe.finishChangingLineTool)({model:this,linkKey:o,symbol:this.mainSeries().symbol(),finalState:r,changes:s})}continueCreatingLine(e,t,i,s){const r=(0,n.ensureNotNull)(this._lineBeingCreated),o=r.addPoint(e,t,i);r.updateAllViews((0,H.sourceChangeEvent)(r.id()));const a=new K.InvalidationMask(K.InvalidationLevel.Light);return o&&(this._paneBeingCreatedLineOn=null,this._lineBeingCreated=null,Pe.isToolCreatingNow.setValue(!1)),this.invalidate(a),o}cancelCreatingLine(){if(!this._lineBeingCreated)return;const e=this._lineBeingCreated;this.removeSource(this._lineBeingCreated),this._lineBeingCreated=null,this._lineCancelled.fire(),Pe.isToolCreatingNow.setValue(!1),(0,Pe.drawOnAllCharts)().value()&&e.isSynchronizable()&&(0,Pe.cancelLineTool)({model:this})}lineBeingCreated(){return this._lineBeingCreated}paneBeingCreatedLineOn(){return this._paneBeingCreatedLineOn}lineCancelled(){return this._lineCancelled}isPhantomLine(e){return this._phantomSourceContainer.source()===e}changeLinePoint(e,t,i){
const s=(0,n.ensureNotNull)(this._lineBeingEdited),r=(0,n.ensureNotNull)(this._linePointBeingEdited);let o=e.price,a=e.index;if(s.setPoint(r,e,t,i),!i){const t=s.alignCrossHairToAnchor(r)?s.getPoint(r):e;null!==t&&(a=t.index,o=t.price)}s.updateAllViews((0,H.sourceChangeEvent)(s.id())),this.lightUpdate();const l=s.linkKey().value();if(!i&&null!==l&&s.isSynchronizable()){const e=(0,n.ensureNotNull)(this._linePointBeingChanged),i={indexesChanged:a!==e.index,pricesChanged:o!==e.price},c=s.getChangePointForSync(r);if(null!==c){const e=this.externalTimeStamp(a);null!==e&&(o=c.price,(0,Pe.changeLineTool)({linkKey:l,model:this,symbol:this.mainSeries().symbol(),point:{price:o,timeStamp:e},envState:t,changes:i}))}}}changeLinePoints(e,t,i){const s=e.points(),r=e.linkKey().value();!i&&r&&e.isSynchronizable()&&t.forEach(((t,i)=>{const o=s[i],a=o.price!==t.price,l=o.index!==t.index;if(e.getChangePointForSync(i)){const e=(0,n.ensureNotNull)(this.externalTimeStamp(t.index));(0,Pe.changeLineTool)({linkKey:r,model:this,symbol:this.mainSeries().symbol(),point:{price:t.price,timeStamp:e},changes:{pricesChanged:a,indexesChanged:l}})}})),e.setPoints(t),e.updateAllViews((0,H.sourceChangeEvent)(e.id())),this.lightUpdate()}startScrollTime(e){this._timeScale.startScroll(e),this._isTimeScrolling=!0,this.mainSeries().clearGotoDateResult()}scrollTimeTo(e){this._timeScale.scrollTo(e),this.recalculateAllPanes((0,H.viewportChangeEvent)()),this.lightUpdate()}endScrollTime(){this._timeScale.endScroll(),this.lightUpdate(),this.recalcVisibleRangeStudies(),this._isTimeScrolling=!1}startScrollPrice(e,t,i){e.startScrollPrice(t,i)}scrollPriceTo(e,t,i){e.scrollPriceTo(t,i),this.invalidate(this._paneInvalidationMask(e,K.InvalidationLevel.Light))}endScrollPrice(e,t){e.endScrollPrice(t),this.invalidate(this._paneInvalidationMask(e,K.InvalidationLevel.Light))}addCustomSource(e,t,i=g.CustomSourceLayer.Foreground){this._customSourcesMap.has(e)&&ms.logWarn(`Attempt to add the same custom source multiple time "${e}"`),ms.logNormal(`Adding custom source "${e}"`);const s=t(e,this);switch(i){case g.CustomSourceLayer.Background:this._bgCustomSources.push(s);break;case g.CustomSourceLayer.Foreground:this._fgCustomSources.push(s);break;case g.CustomSourceLayer.Topmost:this._topmostCustomSources.push(s);break;default:throw new Error(`Unknown custom sources layer ${i}`)}this._allCustomSources.push(s),this._customSourcesMap.set(e,s),this.lightUpdate()}removeCustomSource(e){this._removeCustomSource(e),this.lightUpdate()}hasCustomSource(e){return this._customSourcesMap.has(e)}customSourceForName(e){return this._customSourcesMap.get(e)||null}customSourceName(e){let t=null;return this._customSourcesMap.forEach(((i,s)=>{i===e&&(t=s)})),t}customSources(e){switch(e){case g.CustomSourceLayer.Background:return this._bgCustomSources;case g.CustomSourceLayer.Foreground:return this._fgCustomSources;case g.CustomSourceLayer.Topmost:return this._topmostCustomSources;default:return this._allCustomSources}}addMultiPaneSource(e){this._multiPaneSources.push(e),this.lightUpdate()}
removeMultiPaneSource(e){const t=this._multiPaneSources.indexOf(e);-1===t?ms.logWarn("Attempt to remove multi-pane source which does not exist in the model"):this._multiPaneSources.splice(t,1),this.lightUpdate()}multiPaneSources(e){return this._multiPaneSources.filter((t=>!e.hasDataSource(t)))}magnet(){return this._magnet}dateTimeFormatter(){return this._dateTimeFormatter}dateFormatter(){return this._dateFormatter}timeFormatter(){return this._timeFormatter}isUnmergeAvailableForSource(e){if(!this._unmergeAvailable(e))return!1;return(0,n.ensureNotNull)(this.paneForSource(e)).dataSources().filter(this._unmergeAvailable,this).length>1}isMergeDownAvailableForSource(e){if(!this._unmergeAvailable(e))return!1;const t=this.paneForSource(e),i=this.panes();return t!==i[i.length-1]}isMergeUpAvailableForSource(e){if(!this._unmergeAvailable(e))return!1;return this.paneForSource(e)!==this.panes()[0]}sessions(){return(0,n.ensureNotNull)(this._sessions)}createSessions(e){(0,n.assert)(null===this._sessions,"Sessions are already created"),this.addCustomSource("sessions",((t,i)=>(this._sessions=new j(t,i,e),this._sessions.start(),this._sessions)),g.CustomSourceLayer.Background)}createPrePostMarket(e){this.addCustomSource("prePostMarket",((t,i)=>new PrePostMarket(t,i,e)))}watermarkContentProvider(){return ds.WatermarkApi.getInstance().provider()}replayStatus(){return this._replayStatus}setReplayStatus(e){this._replayStatus.setValue(e)}isInReplay(){return this.m_mainSeries.isInReplay()}getSymbolString(){return this.m_mainSeries.getSymbolString()}interval(){return this.m_mainSeries.interval()}switchToReplay(e,t){0}switchToRealtime(){0}theme(){const e=this.properties().childs().paneProperties.state(["horzGridProperties.style","vertGridProperties.style"]);delete e.topMargin,delete e.bottomMargin;const t=this.mainSeries().state().state;t&&(delete t.symbol,delete t.interval,delete t.currencyId,delete t.unitId);const i={mainSourceProperties:t,sessions:this.sessions().properties().state(),chartProperties:{paneProperties:e,scalesProperties:this.properties().childs().scalesProperties.state()},version:this.version()};return i.version=this.version(),i}onChartThemeLoaded(){return this._chartThemeLoaded}chartThemeLoaded(){this._chartThemeLoaded.fire()}async colorStudiesPropertiesReady(){this._recalcColorStudiesImpl(this._recalcVRStudiesParams);const e=this.allStudies(!0).filter((e=>e.metaInfo().inputs.filter(C.isStudyInputDependsOnChartColors).length>0));await Promise.all(e.map((e=>e.propertiesPatched())))}state(e,t,i,s){var r;const n=this.publishedChartsTimelineSource(),o=this.properties().childs(),a=o.tradingProperties.state(),l={panes:this._panes.map((r=>r.state(!0,e,!1,t,i,s))),timeScale:this._timeScale.state(e),chartProperties:{paneProperties:o.paneProperties.state(["horzGridProperties.style","vertGridProperties.style"]),scalesProperties:o.scalesProperties.state(),publishedChartsTimelineProperties:n?n.state(e):void 0,chartEventsSourceProperties:null===(r=o.chartEventsSourceProperties)||void 0===r?void 0:r.state(),tradingProperties:a,
priceScaleSelectionStrategyName:o.priceScaleSelectionStrategyName.value()},sessions:this.sessions().state(e),version:this.version(),timezone:this.timezone(),shouldBeSavedEvenIfHidden:this._shouldBeSavedEvenIfHidden,linkingGroup:this._linkingGroupIndex.value()};return s||(l.lineToolsGroups=this.lineToolsGroupModel().state(t)),l}restoreState(e,t,i){var s;Oe.instance(this).reset();const r={};if(!e.panes)return void ms.logDebug("ChartModel.restoreState: invalid state");if(!Array.isArray(e.panes))return void ms.logDebug("ChartModel.restoreState: invalid state");if(e.panes.length<1)return void ms.logDebug("ChartModel.restoreState: invalid state");for(const e of this._barsMarksSources)this.detachSource(e);if(this._shouldBeSavedEvenIfHidden=void 0===e.shouldBeSavedEvenIfHidden||e.shouldBeSavedEvenIfHidden,e.chartProperties&&!e.chartProperties.timezone&&(e.chartProperties.timezone=e.timezone),e.chartProperties){const i=(0,R.factoryDefaults)("chartproperties").scalesProperties;(0,se.merge)(i,e.chartProperties.scalesProperties),!("showLastValue"in i)||"showSeriesLastValue"in i||"showStudyLastValue"in i||(i.showSeriesLastValueProperty=i.showLastValue,i.showStudyLastValueProperty=i.showLastValue),"showSeriesLastValue"in i&&(r.showSeriesLastValueProperty=!0),"showStudyLastValue"in i&&(r.showStudyLastValueProperty=!0),(!this.isSnapshot()&&!this.readOnly()&&"showCurrency"in i||"showUnit"in i)&&((0,Z.migrateShowCurrencyAndShowUnitProperties)(i.showCurrency,i.showUnit),delete i.showCurrency,delete i.showUnit);{const{paneProperties:t}=e.chartProperties;t.vertGridProperties=t.vertGridProperties||(0,se.clone)(t.gridProperties),t.horzGridProperties=t.horzGridProperties||(0,se.clone)(t.gridProperties),"backgroundType"in t||(t.backgroundType=Ht.ColorType.Solid),"separatorColor"in t||(t.separatorColor=(0,d.getThemedColor)("color-chart-page-bg")),this._properties.childs().paneProperties.mergeAndFire(t)}this._properties.childs().scalesProperties.mergeAndFire(i),e.chartProperties.timezone&&this._properties.childs().timezone.setValue(e.chartProperties.timezone),e.chartProperties.chartEventsSourceProperties&&this._properties.hasChild("chartEventsSourceProperties")&&this._properties.childs().chartEventsSourceProperties.mergeAndFire(e.chartProperties.chartEventsSourceProperties),e.chartProperties.tradingProperties&&this._properties.hasChild("tradingProperties")&&(void 0===e.chartProperties.tradingProperties.horizontalAlignment&&(e.chartProperties.tradingProperties.horizontalAlignment=(n=e.chartProperties.tradingProperties.lineLength)<=40?g.TradedGroupHorizontalAlignment.Right:n>=60?g.TradedGroupHorizontalAlignment.Left:g.TradedGroupHorizontalAlignment.Center),this._properties.childs().tradingProperties.mergeAndFire(e.chartProperties.tradingProperties)),this._timeScale.restoreState(e.timeScale,t),this._updateDateTimeFormatter()}var n;if(e.timeScale&&this._timeScale.restoreState(e.timeScale,t),!this.readOnly()){const t=this._getExceedingChildStudies(e.panes);if(t.length){for(let i=e.panes.length-1;i>=0;--i){const s=e.panes[i]
;for(let e=s.sources.length-1;e>=0;--e){const i=s.sources[e];~t.indexOf(i)&&s.sources.splice(e,1)}s.sources.length||e.panes.splice(i,1)}0}}const o=e.version||0,a=e.panes;let l="_seriesId";for(const e of a){const t=e.sources.find((e=>"MainSeries"===e.type));if(t){l=t.id;break}}this.panes()[0].restoreState({state:a[0],withData:t,version:o,seriesId:l,settingsMigration:r,contentOverrides:i,restoreSilently:true,reason:2});let c=1;for(let s=1;s_&&u%100==0?{lines_limit_exceeded:!0,line_tools_count:u}:(this.panes().forEach((e=>this._dataSourceCollectionChanged.fire(e))),this._lineToolsGroupModel.fireChangedAll(),this._linkingGroupIndex.setValue(null!==(s=e.linkingGroup)&&void 0!==s?s:null),{})}shouldBeSavedEvenIfHidden(){return this._shouldBeSavedEvenIfHidden}setShouldBeSavedEvenIfHidden(e){this._shouldBeSavedEvenIfHidden=e}externalTimeStamp(e){const t=this.mainSeries().syncModel();return this.timeScale().points().roughTime(e,t&&t.projectTime.bind(t))}syncLollipopSources(){var e;null===(e=this._lollipopSourcesWatcherLoader)||void 0===e||e.callFunction((()=>{null!==this._lollipopSourcesWatcher&&this._lollipopSourcesWatcher.syncSources()}))}restoreChartEvents(e){var t;null===(t=this._lollipopSourcesWatcherLoader)||void 0===t||t.callFunction((()=>{null!==this._lollipopSourcesWatcher&&this._options.chartEventsEnabled&&this._lollipopSourcesWatcher.restoreChartEvents(e)}))}recalcVisibleRangeStudies(e){this._recalcVRStudiesParams.force=this._recalcVRStudiesParams.force||Boolean(e),this.m_mainSeries.isStarted()&&this.m_mainSeries.isCompleted()?this._recalcVisibleRangeStudiesImplDebounced():this._recalcVisibleRangeStudiesImpl(this._recalcVRStudiesParams)}recalcColorStudies(e){this._recalcColorStudiesParams.force=this._recalcColorStudiesParams.force||Boolean(e),this._recalcColorStudiesImplDebounced()}
recalcStudyBasedLineTools(){this.dataSources().forEach((e=>{(0,S.isStudyLineTool)(e)&&e.recalcStudyIfNeeded()}))}alertsWatcher(){return this._alertsWatcher}showLegend(){return this._showLegendProperty}id(){return this._id}selectPointMode(){return this._crossHairSelectPointMode}cancelRequestSelectPoint(){this.m_crossHairSource.cancelRequestSelectPoint()}requestSelectPoint(e){return this.m_crossHairSource.requestSelectPoint(e)}onPointSelected(){return this.m_crossHairSource.onPointSelected()}recalculatePriceRangeOnce(){const e=this.mainSeries();for(const t of this._panes)for(const i of t.priceDataSources())i.symbolSource()===e&&i.disablePriceRangeReady()}invalidate(e){var t;null===(t=this._invalidateHandler)||void 0===t||t.call(this,e)}appliedTimeFrame(){return this._appliedTimeFrame.appliedTimeFrame()}barsMarksSources(){return this._barsMarksSources}createSyncPoint(e,t){return(0,is.getDefault2Lazy)(this._syncPointCache,e.uniqueId,t.uniqueId,(()=>new Nt(e,t)))}isAutoSaveEnabled(){return this._isAutoSaveEnabled}linkingGroupIndex(){return this._linkingGroupIndex}studyAwareDefaultRightOffset(){return this._timeScale.usePercentageRightOffset().value()?this._timeScale.percentsToBarIndexLength(this.studyAwareDefaultRightOffsetPercentage()):Math.max(this._timeScale.defaultRightOffset().value(),this._cachedStudiesMaxOffset)}studyAwareDefaultRightOffsetPercentage(){return this._timeScale.usePercentageRightOffset().value()?Math.max(this._timeScale.defaultRightOffsetPercentage().value(),this._timeScale.barIndexLengthToPercents(this._cachedStudiesMaxOffset)):this._timeScale.barIndexLengthToPercents(this.studyAwareDefaultRightOffset())}clearAllStudies(){this.dataSources().forEach((e=>{var t;return null===(t=e.clearData)||void 0===t?void 0:t.call(e)}))}setTimeScaleAnimation(e){const t=K.InvalidationMask.light();t.setTimeScaleAnimation(e),this.invalidate(t)}stopTimeScaleAnimation(){const e=K.InvalidationMask.light();e.stopTimeScaleAnimation(),this.invalidate(e)}lollipopSourcesOptions(){const e=this._options;return{chartEventsEnabled:!this._options.isSnapshot&&this._options.chartEventsEnabled,esdEnabled:e.esdEnabled,newsNotificationsEnabled:e.newsNotificationsEnabled,continuousContractSwitchesEnabled:e.continuousContractSwitchesEnabled,futuresContractExpirationEnabled:e.futuresContractExpirationEnabled,latestUpdatesEnabled:e.latestUpdatesEnabled}}_initAlertsList(){throw new Error("Not implemented")}_updateStudiesMaxOffset(){const e=Math.max(...this.allStudies().map((e=>e.maxOffset().value())));this._cachedStudiesMaxOffset=e;const t=this._timeScale.rightOffset();if(t<0)return;if(e<=t)return;const i=this._timeScale.logicalRange();i?this._timeScale.zoomToBarsRange(i.left(),this._timeScale.baseIndex()+Math.max(this._timeScale.rightOffset(),e)):this._timeScale.setRightOffset(Math.max(t,e))}_updateBaseIndex(e,t){const i=this._timeScale,s=i.baseIndex(),r=i.logicalRange();if(null!==r&&t){const t=r.contains(s),n=e-s,o=t?null:i.rightOffset()-n;if(!this._options.shiftVisibleRangeOnNewBar&&t){
const e=i.width()/i.barSpacing(),t=e/(e+n),s=Math.max(i.minBarSpacing(),i.barSpacing()*t);i.setBarSpacing(s)}null!==o&&i.setRightOffset(o)}i.setBaseIndex(e)}async _createLollipopSourcesWatcher(){}_updateDateTimeFormatter(){const e=At.dateFormatProperty.value(),t=void 0;if(this._dateFormatter=new Mt.DateFormatter(e,t),this.mainSeries().isDWM())this._dateTimeFormatter=new Mt.DateFormatter(e,t),this._timeFormatter=new _t.TimeFormatter((0,mt.getHourMinuteFormat)(pt.timeHoursFormatProperty.value()));else{const i=T.Interval.parse(this.mainSeries().interval()),s=(0,mt.getTimeFormatForInterval)(i,pt.timeHoursFormatProperty.value());this._dateTimeFormatter=new It.DateTimeFormatter({dateFormat:e,withWeekday:t,timeFormat:s,dateTimeSeparator:" "}),this._timeFormatter=new _t.TimeFormatter(s)}}_invalidationMaskForSource(e,t=K.InvalidationLevel.Light){if(e===this.crossHairSource())return K.InvalidationMask.cursor();if(this._watermarkSource===e)return this._paneInvalidationMask((0,n.ensureNotNull)(this.paneForSource(this.mainSeries())),t);if(-1!==this._allCustomSources.indexOf(e)){const e=new K.InvalidationMask;return e.invalidateAll(t),e}if(!(0,f.isDataSource)(e))return null;if(e.isMultiPaneEnabled())return new K.InvalidationMask(t);const i=this.paneForSource(e);return null!==i?this._paneInvalidationMask(i,t):null}_paneInvalidationMask(e,t=K.InvalidationLevel.Light){const i=new K.InvalidationMask,s=this._panes.indexOf(e);return i.invalidateAllPane(s,t),i}_invalidationMaskForSourcePriceScale(e,t=K.InvalidationLevel.Light){if(!(0,f.isDataSource)(e))return new K.InvalidationMask(t);const i=this.paneForSource(e);if(null===i)return null;let s=e.priceScale();if(null===s)return null;const r=this._panes.indexOf(i);let n=i.priceScalePosition(s);if("overlay"===n){const e=this._panes[r].defaultPriceScale();s=e,n=i.priceScalePosition(e)}const o=i.priceScaleIndex(s,n);if(void 0===o)return null;const a=new K.InvalidationMask;return a.invalidatePriceScale(r,n,o,t),a}_removeCustomSource(e){const t=this._customSourcesMap.get(e);if(void 0===t)return void ms.logWarn(`Attempt to remove custom source which does not exist in the model - "${e}"`);ms.logNormal(`Removing custom source "${e}"`),this.selectionMacro((e=>{e.removeSourceFromSelection(t)})),this._hoveredSource===t&&this.setHoveredSource(null),this._customSourceBeingMoved===t&&this.setMovingCustomSource(null,null);const i=gs(this._bgCustomSources,t),s=gs(this._fgCustomSources,t),r=gs(this._topmostCustomSources,t),o=gs(this._allCustomSources,t);(0,n.assert)(i||s||r,"Source should be presented in one of the layers"),(0,n.assert)(o,"Source should be presented in the array"),this._customSourcesMap.delete(e),t.destroy()}_updateShowLegendProperty(){const e=this._properties.childs().paneProperties.childs().legendProperties.childs().showLegend,t=this._showLegendProperty;if(e.value())t.setValue(!0);else{for(const e of this._panes){let i=0;for(const s of e.priceDataSources())if(null!==s.statusView()&&(i++,i>=2))return void t.setValue(!1)}t.setValue(!0)}}_pointToPercentPosition(e,t){return{
x:e.x/this._timeScale.width(),y:e.y/(0,n.ensureNotNull)((0,n.ensureNotNull)(t.mainDataSource()).priceScale()).height()}}_percentPositionToPoint(e,t){const i=e.x*this._timeScale.width(),s=e.y*(0,n.ensureNotNull)((0,n.ensureNotNull)(t.mainDataSource()).priceScale()).height();return new o.Point(i,s)}_recalcVisibleRangeStudiesImpl(e){var t,i;if(!this.m_mainSeries.isStarted()||!this.m_mainSeries.isCompleted())return void this._visibleRangeStudiesInputs.setValue(null);if(this.timeScale().isEmpty())return;const s=this.timeScale().visibleBarsStrictRange();if(null===s)return;const r=this.m_mainSeries.bars(),n=r.search(s.firstBar(),gt.PlotRowSearchMode.NearestRight),o=r.search(s.lastBar(),gt.PlotRowSearchMode.NearestLeft),a=r.lastIndex(),l=n?n.index:void 0,c=o?o.index:void 0,h=l===e.oldStartVisibleIndex,d=c===e.oldEndVisibleIndex;h&&d&&!e.force||(e.force=!1,e.oldStartVisibleIndex=void 0!==l?l:NaN,e.oldEndVisibleIndex=void 0!==c?c:NaN,this._visibleRangeStudiesInputs.setValue({firstVisibleBarTime:1e3*(null!==(t=null==n?void 0:n.value[0])&&void 0!==t?t:0),lastVisibleBarTime:1e3*(null!==(i=null==o?void 0:o.value[0])&&void 0!==i?i:0),subscribeRealtime:(null==o?void 0:o.index)===a}))}_recalcColorStudiesImpl(e){var t;const i=this.backgroundColorAtYPercentFromTop(.5),s=this.dark().value()?l.colorsPalette["color-cold-gray-200"]:l.colorsPalette["color-cold-gray-900"],r=i===e.oldBgColor,n=s===e.oldFgColor;if(r&&n&&!e.force)return;e.force=!1,e.oldBgColor=i,e.oldFgColor=s;const o=null!==(t=e.studies)&&void 0!==t?t:this.priceDataSources();e.studies=void 0;for(const e of o)if((0,G.isStudy)(e)){const t=e.metaInfo().inputs.filter(C.isStudyInputDependsOnChartColors),r=e.properties().childs().inputs;t.forEach((e=>{const t=e.id===C.ChartColorDependentStudyInputNames.FgColor?s:i;r.childs()[e.id].setValueSilently(t)})),t.length>0&&r.listeners().fire(r,"")}}_getAllSources(e){const t=[];for(const i of this._panes){const s=i.sourcesByGroup().all();for(const i of s)e(i)&&t.push(i)}return t}_invalidateBarColorerCaches(){this.mainSeries().invalidateBarColorerCache()}_addAlertLabelToChart(e){throw new Error("Not implemented")}_removeAlertLabelFromChart(e){throw new Error("Not implemented")}_removeAllAlertLabelsFromChart(){throw new Error("Not implemented")}_updateTimeScale(e){var t,i,s,r;const{index:n,zoffset:o,values:a,indexDiffs:l,baseIndex:c,marks:h,clearFlag:d}=e;if(d){this._timeScale.reset();for(const e of this.dataSources())null===(t=e.clearData)||void 0===t||t.call(e)}if(l.length>0)for(const e of this.dataSources())null===(i=e.moveData)||void 0===i||i.call(e,l);const u=this._timeScale.indexToTimePoint(this._timeScale.baseIndex()),p=this._timeScale.canNormalize();this._timeScale.update(n,o,a,h);const _=this._timeScale.points().range().value();let m="ChartModel.prototype._updateTimeScale("+n+","+o+","+a.length+","+l.length+","+h.length+","+d+")";if(m+="TimeScale: {first:"+(null!==(s=null==_?void 0:_.firstIndex)&&void 0!==s?s:null)+",last:"+(null!==(r=null==_?void 0:_.lastIndex)&&void 0!==r?r:null)+"}",null===c){this._timeScale.resetBaseIndex()
;const e=this._timeScale.rightOffset();e<0?this._timeScale.setRightOffset(this.studyAwareDefaultRightOffset()):this._timeScale.setRightOffset(Math.max(e,this._cachedStudiesMaxOffset))}else if(void 0!==c){const e=this._timeScale.indexToTimePoint(c),t=null!==u&&null!==e&&e>u;this._updateBaseIndex(c,t)}if(ms.logDebug(m),!p&&p!==this._timeScale.canNormalize())for(const e of this.dataSources())!(0,S.isLineTool)(e)||e.isFixed()||e.isSourceHidden()||e.processHibernate();for(const e of this.dataSources())e.updateAllViews({type:"data-source-change",sourceId:e.id(),clearData:!0});this.recalculateAllPanes((0,H.globalChangeEvent)()),this.lightUpdate()}_getAvailableCurrencies(){return!this.currencyConversionEnabled()||this.isSnapshot()?[]:(0,se.isArray)(this._availableCurrenciesList)?this._availableCurrenciesList:(null!==this._availableCurrenciesList||(this._availableCurrenciesList=this.chartApi().availableCurrencies(),this._availableCurrenciesList.then((e=>{this._destroyed||(this._availableCurrenciesList=e,this.fullUpdate())})).catch((e=>{ms.logWarn(`An error occurred while getting currencies config: ${e}`)}))),[])}_getAvailableUnits(){return!this.unitConversionEnabled()||this.isSnapshot()?{}:this._availableUnitsObject instanceof Promise||null===this._availableUnitsObject?(null!==this._availableUnitsObject||(this._availableUnitsObject=this.chartApi().availableUnits(),this._availableUnitsObject.then((e=>{this._destroyed||(this._availableUnitsObject=e,this.fullUpdate())})).catch((e=>{ms.logWarn(`An error occurred while getting units config: ${e}`)}))),{}):this._availableUnitsObject}_getAvailablePriceSources(e){const t=this._availablePriceSourcesBySymbol.get(e);if(Array.isArray(t))return t;if((0,se.isPromise)(t))return[];const i=this.chartApi().availablePriceSources(e);return this._availablePriceSourcesBySymbol.set(e,i),i.then((t=>{this._destroyed||(this._availablePriceSourcesBySymbol.set(e,t),this.fullUpdate())})).catch((e=>{ms.logWarn(`An error occurred while getting price sources config: ${e}`)})),[]}_clearAvailablePriceSources(){this._availablePriceSourcesBySymbol.clear()}_getBackgroundColor(e){const t=this._properties.childs().paneProperties.childs();if(t.backgroundType.value()===Ht.ColorType.Gradient){const i=t.backgroundGradientStartColor.value(),s=t.backgroundGradientEndColor.value();return e?i:s}return t.background.value()}_getBackgroundCounterColor(){const e=this.backgroundColor().value();return"black"===(0,a.rgbToBlackWhiteString)((0,a.parseRgb)(e),150)?"white":"black"}_updateBackgroundColor(){this._backgroundColor.setValue(this._getBackgroundColor()),this._backgroundTopColor.setValue(this._getBackgroundColor(!0))}_syncCrosshair(e){if(!this._isSettingsExternalPosition){const t=this._undoModel.chartWidget(),i=this._undoModel.mainSeries(),s=i.syncModel(),r=this._undoModel.crossHairSource(),n=r.pane;if(null!==s&&null!==n){const o={timeStamp:this._timeScale.points().roughTime(r.index,s.projectTime.bind(s)),syncSourceTarget:s.syncSourceTarget()};n.mainDataSource()===i&&(o.price=r.price,o.symbol=i.symbol())
;let a=this._lineBeingCreated||null!==this._linePointBeingEdited||Boolean(this._sourcesBeingMoved.length);a=a&&(0,Pe.drawOnAllCharts)().value(),t.chartWidgetCollection().syncCrosshair(o,t.id(),a,e)}this._phantomSourceContainer.onCursorPositionUpdated()}}_gotoTimeImpl(e,t){const i=this.timeScale(),s=this.mainSeries();let r;if(void 0!==e){if(this._scrollingState&&this._scrollingState.deferred.reject(),r=(0,p.createDeferredPromise)(),r.promise.catch((()=>{})),!s.isDWM()){const t=s.symbolInfo();if(null!==t){let i=this.properties().childs().timezone.value();"exchange"===i&&(i=t.timezone);const r=(0,Dt.cal_to_utc)((0,Dt.get_timezone)(i),new Date(e)),n=(0,Xt.createTimeToBarTimeAligner)(s.interval(),t)(r);e=(0,Dt.utc_to_cal)((0,Dt.get_timezone)(i),n).getTime()}}this._scrollingState={targetDate:e,deferred:r,centerIfVisible:t.centerIfVisible}}else{if(!this._scrollingState)return ms.logError("scrollTo called without an argument"),Promise.reject();e=this._scrollingState.targetDate,r=this._scrollingState.deferred}if(void 0===i.tickMarks().minIndex)return r.resolve(void 0),r.promise;this.stopTimeScaleAnimation();let o=((e,t)=>{if((e=>(0,n.ensureNotNull)(i.tickMarks().indexToTime((0,n.ensureDefined)(i.tickMarks().minIndex))).valueOf()-e)(t)<0){let r=i.tickMarks().nearestIndex(t);const o=s.bars().lastIndex();if(null===o)return null;r=Math.min(r,o);let a=(0,n.ensureNotNull)(i.tickMarks().indexToTime(r)).valueOf();for(;a1&&s.push(e)),n=(n+1)%t.length}return s}}},16410:(e,t,i)=>{"use strict";i.d(t,{allChartStyles:()=>r});var s=i(14483);function r(){return function(){const e=[0,1,9,13,2,14,15,3,16,10];return s.enabled("chart_style_hilo")&&e.push(12),e}().concat((s.enabled("japanese_chart_styles"),[8]))}},89858:(e,t,i)=>{"use strict";i.d(t,{ChartUndoModelBase:()=>ts});var s=i(85459),r=i.n(s),n=i(16230),o=i(50151),a=i(86441),l=i(11542),c=i(61345),h=i(21866),d=i(42856),u=i(17133),p=i(36274);function _(e,t){return!!p.Interval.isEqual(e.res,t.res)&&(0,u.areEqualTimeFrames)(e.val,t.val)}var m=i(93244),g=i(69618),f=i(92249),v=i(88275),S=i(51768),y=i(39262),b=i(14483),w=i(59224),C=i(28853),P=i(62591),x=i(36298);const T=new x.TranslatedString("toggle collapsed pane state",l.t(null,void 0,i(74724)));class I extends P.UndoCommand{constructor(e,t){super(T),this._chartModel=e,this._paneIndex=t}redo(){this._chartModel.toggleCollapsedPane(this._paneIndex)}undo(){this._chartModel.toggleCollapsedPane(this._paneIndex)}}var M=i(1722);const A=new x.TranslatedString("move all scales to left",l.t(null,void 0,i(81898))),L=new x.TranslatedString("move all scales to right",l.t(null,void 0,i(22863))),k=(0,w.getLogger)("Chart.MergeAllScales");class D extends P.UndoCommand{constructor(e,t,i,s,r,n){super(n),this._model=e,this._paneIndex=e.panes().indexOf(t),this._targetPosition=s,this._targetIndex=r,this._scaleId=i.id(),this._sourcePosition=t.priceScalePosition(i),"overlay"!==this._sourcePosition&&(this._sourceIndex=t.priceScaleIndex(i,this._sourcePosition))}redo(){const e=this._model.panes()[this._paneIndex],t=(0,o.ensureNotNull)(e.getPriceScaleById(this._scaleId));e.movePriceScale(t,this._targetPosition,this._targetIndex),this._model.fullUpdate()}undo(){const e=this._model.panes()[this._paneIndex],t=(0,o.ensureNotNull)(e.getPriceScaleById(this._scaleId));e.movePriceScale(t,this._sourcePosition,this._sourceIndex),this._model.fullUpdate()}}class E extends P.UndoCommand{constructor(e,t,i,s){super(s),this._createdIds=[],this._model=e,this._withoutShift=i,this._origStates=t.map((e=>e.state(!0)));const r=e.lineToolsGroupModel();this._origGroups=t.map((e=>{const t=r.groupForLineTool(e);return t&&t.id}))}redo(){const e=this._model.lineToolsGroupModel(),t=this._origStates.map(((t,i)=>{const s=(0,o.ensureNotNull)(this._model.dataSourceForId(t.id)),r=0===this._createdIds.length?void 0:(0,o.ensureDefined)(this._createdIds[i]),n=(0,f.cloneLineTool)(this._model,s,!this._withoutShift,r);void 0!==t.sharingMode&&n.share(t.sharingMode);const a=(0,o.ensureNotNull)(s.priceScale());(0,o.ensureNotNull)(this._model.paneForSource(s)).addDataSource(n,a,!1);const l=this._origGroups[i];if(null!==l){const t=e.groupForId(l);t&&t.addLineTools([n])}return this._model.updateSource(n),n}))
;0===this._createdIds.length&&(this._createdIds=t.map((e=>e.id()))),this._model.selectionMacro((e=>{e.clearSelection(),t.forEach((t=>{e.addSourceToSelection(t)}))})),this._model.setShouldBeSavedEvenIfHidden(!0)}undo(){const e=this._model.lineToolsGroupModel();this._createdIds.forEach((t=>{const i=(0,o.ensureNotNull)(this._model.dataSourceForId(t)),s=e.groupForLineTool(i);null!==s&&s.excludeLineTool(i),this._model.removeSource(i)}))}newIds(){return this._createdIds}}var V=i(47513),B=i(93562);class R extends P.UndoCommand{constructor(e,t,i,s=!0){super(i,s),this._newStates=[],this._model=e,this._savedStates=t.map((e=>e.state(!1)))}redo(){this._applyState(this._newStates)}undo(){0===this._newStates.length&&this.saveNewState(),this._applyState(this._savedStates)}saveNewState(){const e=this._savedStates.filter(M.notNull).map((e=>(0,o.ensureNotNull)(this._model.dataSourceForId(e.id))));this._newStates=e.map((e=>e.state(!1)))}_applyState(e){for(const t of e)if(null!==t){const e=this._model.dataSourceForId(t.id);if(null!==e)if((0,C.isStudy)(e)){const i=t.state.inputs,s=e.properties().childs().inputs.childs();for(const e in i)s[e]&&s[e].setValue(i[e])}else this._model.restoreLineToolState(e,t,!0)}}}var N=i(95529),O=i(11235),F=i(98517),W=i(14292),H=i(74007),z=i(37591);const U=new x.TranslatedString("bring {title} to front",l.t(null,void 0,i(78246))),j=new x.TranslatedString("send {title} to back",l.t(null,void 0,i(66781))),G=new x.TranslatedString("insert {title} after {targetTitle}",l.t(null,void 0,i(53146))),q=new x.TranslatedString("insert {title} before {targetTitle}",l.t(null,void 0,i(67176))),$=new x.TranslatedString("send {title} backward",l.t(null,void 0,i(16259))),Y=new x.TranslatedString("bring {title} forward",l.t(null,void 0,i(56763))),K=new x.TranslatedString("send group {title} backward",l.t(null,void 0,i(4998))),Z=new x.TranslatedString("bring group {title} forward",l.t(null,void 0,i(27195)));function X(e){return new x.TranslatedString(e.name(),e.title(z.TitleDisplayTarget.StatusLine))}class J extends P.UndoCommand{constructor(e,t,i){super(i),this._sourcesByPanes=new Map,this._originalState=new Map,this._model=e,t.forEach((t=>{const i=(0,o.ensureNotNull)(e.paneForSource(t)),s=e.panes().indexOf(i),r=this._sourcesByPanes.get(s)||[];r.push(t.id()),this._sourcesByPanes.set(s,r)})),Array.from(this._sourcesByPanes.keys()).forEach((t=>{const i=e.panes()[t],s=new Map;i.sourcesByGroup().allIncludingHidden().forEach((e=>{s.set(e.id(),e.zorder())})),this._originalState.set(t,s)}))}undo(){this._originalState.forEach(((e,t)=>{const i=this._model.panes()[t],s=new Map;e.forEach(((e,t)=>{const r=(0,o.ensureNotNull)(i.dataSourceForId(t));s.set(r,e)})),i.setZOrders(s)}))}redo(){this._sourcesByPanes.forEach(((e,t)=>{const i=this._model.panes()[t],s=e.map((e=>(0,o.ensureNotNull)(i.dataSourceForId(e))));this._paneOperation(i,s)}))}}class Q extends J{constructor(e,t){super(e,t,U.format({title:X(t[0])}))}_paneOperation(e,t){e.bringToFront(t)}}class ee extends J{constructor(e,t){super(e,t,j.format({title:X(t[0])}))}_paneOperation(e,t){
e.sendToBack(t)}}class te extends J{constructor(e,t,i,s){super(e,t,s),this._targetSource=i}_paneOperation(e,t){e.insertAfter(t,this._targetSource)}}class ie extends te{constructor(e,t,i){super(e,t,i,G.format({title:X(t[0]),targetTitle:X(i)}))}}class se extends J{constructor(e,t,i,s){super(e,t,s),this._targetSource=i}_paneOperation(e,t){e.insertBefore(t,this._targetSource)}}class re extends se{constructor(e,t,i){super(e,t,i,q.format({title:X(t[0]),targetTitle:X(i)}))}}function ne(e,t){const i=t[0],s=e.sourcesByGroup().all().filter((e=>e.zorder()e.zorder()>i.zorder()));if(0===s.length)throw new Error("Cannot bring forward source that alreadt on back");let r=s[0];if((0,f.isLineTool)(r)){const t=e.model().lineToolsGroupModel().groupForLineTool(r);if(null!==t){const e=t.lineTools();r=e[e.length-1]}}return r}class le extends te{constructor(e,t,i){super(e,i,ae(t,i),Y.format({title:X(i[0])}))}}function ce(e,t){return(0,o.ensureNotNull)(e.paneForSource(t.lineTools()[0]))}class he extends se{constructor(e,t){super(e,t.lineTools(),ne(ce(e,t),t.lineTools()),K.format({title:t.name().value()}))}}class de extends te{constructor(e,t){super(e,t.lineTools(),ae(ce(e,t),t.lineTools()),Z.format({title:t.name().value()}))}}const ue=new x.TranslatedString("rearrange panes",l.t(null,void 0,i(33348)));class pe extends P.UndoCommand{constructor(e,t,i){super(ue),this._chartModel=e,this._index=t,(0,M.isNumber)(i)?this._dstIndex=i:this._dstIndex="up"===i?t-1:t+1}redo(){this._checkIndices()&&this._chartModel.movePane(this._index,this._dstIndex)}undo(){this._checkIndices()&&this._chartModel.movePane(this._dstIndex,this._index)}_checkIndices(){const e=this._chartModel.panes().length;return this._index>=0&&this._index=0&&this._dstIndexe.id()))}redo(){const e=(0,o.ensureNotNull)(this._model.lineToolsGroupModel().groupForId(this._groupId));this._model.lineToolsGroupModel().removeGroup(e)}undo(){const e=this._lineToolsIds.map((e=>this._model.dataSourceForId(e))),t=new Pe.LineToolsGroup(e,this._groupName,this._groupId);this._model.lineToolsGroupModel().addGroup(t)}}const Te=new x.TranslatedString("create line tools group",l.t(null,void 0,i(3195)));class Ie extends P.UndoCommand{constructor(e,t){super(Te),this._groupId=null,this._model=e,this._sourcesIds=t.map((e=>e.id()))}redo(){const e=this._sourcesIds.map((e=>this._model.dataSourceForId(e))),t=null===this._groupId?void 0:this._groupId;this._groupId=this._model.lineToolsGroupModel().createGroup(e,this._title,t).id}undo(){const e=(0,o.ensureNotNull)(this._model.lineToolsGroupModel().groupForId((0,o.ensureNotNull)(this._groupId)));this._model.lineToolsGroupModel().removeGroup(e)}createdGroupId(){return this._groupId}}
const Me=new x.TranslatedString("add line tool(s) to group {group}",l.t(null,void 0,i(40242)));class Ae extends P.UndoCommand{constructor(e,t,i){super(Me.format({group:t.name().value()})),this._model=e,this._groupId=t.id,this._lineToolsIds=i.map((e=>e.id()))}redo(){const e=(0,o.ensureNotNull)(this._model.lineToolsGroupModel().groupForId(this._groupId)),t=this._lineToolsIds.map((e=>this._model.dataSourceForId(e)));e.addLineTools(t)}undo(){const e=this._lineToolsIds.map((e=>this._model.dataSourceForId(e)));(0,o.ensureNotNull)(this._model.lineToolsGroupModel().groupForId(this._groupId)).excludeLineTools(e)}}class Le extends P.UndoCommand{constructor(e,t,i,s,r){super(i),this._targetObj=e,this._newValue=t,this._oldValue=this._targetObj.value(),this._model=s,r&&this.setCustomFlag("doesnt_affect_save",!0)}redo(){(0,ge.saveDefaultProperties)(!0),this._targetObj.setValue(this._newValue),(0,ge.saveDefaultProperties)(!1),this._model.recalculateAllPanes((0,ye.globalChangeEvent)()),this._model.lightUpdate()}undo(){(0,ge.saveDefaultProperties)(!0),this._targetObj.setValue(this._oldValue),(0,ge.saveDefaultProperties)(!1),this._model.recalculateAllPanes((0,ye.globalChangeEvent)()),this._model.lightUpdate()}}class ke extends P.UndoCommand{constructor(e,t,i,s){super(s),this._chartModel=e,this._groupId=t.id,this._oldName=t.name().value(),this._newName=i}redo(){(0,o.ensureNotNull)(this._chartModel.lineToolsGroupModel().groupForId(this._groupId)).setName(this._newName)}undo(){(0,o.ensureNotNull)(this._chartModel.lineToolsGroupModel().groupForId(this._groupId)).setName(this._oldName)}}var De=i(88348);const Ee=new x.TranslatedString("create line tools group from selection",l.t(null,void 0,i(92659))),Ve=new x.TranslatedString("removing line tools group {name}",l.t(null,void 0,i(78811))),Be=new x.TranslatedString("add line tool {lineTool} to group {name}",l.t(null,void 0,i(99113))),Re=new x.TranslatedString("make group {group} visible",l.t(null,void 0,i(87927))),Ne=new x.TranslatedString("make group {group} invisible",l.t(null,void 0,i(45223))),Oe=new x.TranslatedString("lock group {group}",l.t(null,void 0,i(4963))),Fe=new x.TranslatedString("unlock group {group}",l.t(null,void 0,i(51114))),We=new x.TranslatedString("rename group {group} to {newName}",l.t(null,void 0,i(16338))),He=!1;class ze{constructor(e){this._environment=e}createGroupFromSelection(){const e=this._environment.model();(0,o.assert)(!e.selection().isEmpty(),"Cannot create group from empty selection");const t=(0,F.sortSources)(e.selection().lineDataSources());(0,o.assert)(t.length===e.selection().allSources().length,"A group could contain line tools only");const i=t.length>1||null!==this._environment.model().lineToolsGroupModel().groupForLineTool(t[0]),s=t.reduce(((e,t)=>e.zorder()>t.zorder()?e:t),t[0]);let r=s;const n=e.lineToolsGroupModel().groupForLineTool(s);if(null!==n){const e=n.lineTools();r=e[e.length-1]}this._environment.beginUndoMacro(Ee,He);const a=new Map,l=new Set;t.forEach((t=>{const i=this._groupForLineTool(t);if(null===i)return;const s=a.get(i)||[];s.push(t),
a.set(i,s);const r=(0,o.ensureNotNull)(e.paneForSource(t));l.add(r)})),(0,o.assert)(l.size<=1,"All selected sources should be on the same pane"),a.forEach(((t,i)=>{const s=new B.ExcludeLineToolsFromGroupUndoCommand(e,i,t);this._environment.pushUndoCommand(s)}));const c=new Ie(e,(0,F.sortSources)(t));if(this._environment.pushUndoCommand(c),i){const i=new ie(e,t,r);this._environment.pushUndoCommand(i)}this._environment.endUndoMacro();const h=(0,o.ensureNotNull)(c.createdGroupId());return(0,o.ensureNotNull)(e.lineToolsGroupModel().groupForId(h))}removeGroup(e){const t=this._environment.model(),i=e.lineTools();this._environment.beginUndoMacro(Ve.format({name:e.name().value()}),He);const s=new xe(t,e,null);this._environment.pushUndoCommand(s);const r=new V.RemoveSourcesUndoCommand(t,i,null);this._environment.pushUndoCommand(r);const n=t.mainSeries().symbol();i.forEach((e=>{null!==e.linkKey().value()&&(0,De.removeLineTool)({withUndo:!0,model:t,symbol:n,sourceTitle:new x.TranslatedString(e.name(),e.title(z.TitleDisplayTarget.DataWindow)),lineToolState:e.state(!1),linkKey:(0,o.ensureNotNull)(e.linkKey().value())})})),this._environment.endUndoMacro()}groups(){return this._environment.model().lineToolsGroupModel().groups()}excludeLineToolFromGroup(e,t){const i=this._environment.model(),s=new B.ExcludeLineToolsFromGroupUndoCommand(i,e,[t]);s.setCustomFlag("doesnt_affect_save",He),this._environment.pushUndoCommand(s)}addLineToolToGroup(e,t){const i=this._environment.model(),s=i.lineToolsGroupModel().groupForLineTool(t);if(s===e)return;const r=Be.format({lineTool:new x.TranslatedString(t.name(),t.title(z.TitleDisplayTarget.StatusLine)),name:e.name().value()});this._environment.beginUndoMacro(r,He),null!==s&&this._environment.pushUndoCommand(new B.ExcludeLineToolsFromGroupUndoCommand(i,s,[t]));if(b.enabled("saveload_separate_drawings_storage")){const s=e.sharingMode().value();t.sharingMode().value()!==s&&this._environment.pushUndoCommand(new SetLineSharingModeUndoCommand(t,s,i,null))}this._environment.pushUndoCommand(new Ae(i,e,[t])),this._environment.endUndoMacro()}bringToFront(e){const t=this._environment.model(),i=new Q(t,e.lineTools());i.setCustomFlag("doesnt_affect_save",He),this._environment.pushUndoCommand(i),this._environment.emitEvent("changeZOrder",[e.lineTools()])}sendToBack(e){const t=this._environment.model(),i=new ee(t,e.lineTools());i.setCustomFlag("doesnt_affect_save",He),this._environment.pushUndoCommand(i),this._environment.emitEvent("changeZOrder",[e.lineTools()])}bringForward(e){const t=this._environment.model(),i=new de(t,e);i.setCustomFlag("doesnt_affect_save",He),this._environment.pushUndoCommand(i),this._environment.emitEvent("changeZOrder",[e.lineTools()])}sendBackward(e){const t=this._environment.model(),i=new he(t,e);i.setCustomFlag("doesnt_affect_save",He),this._environment.pushUndoCommand(i),this._environment.emitEvent("changeZOrder",[e.lineTools()])}insertAfter(e,t){const i=this._environment.model();let s;if(t instanceof Pe.LineToolsGroup){const e=t.lineTools();s=e[e.length-1]}else s=t
;const r=new ie(i,e.lineTools(),s);this._environment.pushUndoCommand(r),this._environment.emitEvent("changeZOrder",[e.lineTools()])}insertBefore(e,t){const i=this._environment.model();let s;if(t instanceof Pe.LineToolsGroup){s=t.lineTools()[0]}else s=t;const r=new re(i,e.lineTools(),s);this._environment.pushUndoCommand(r),this._environment.emitEvent("changeZOrder",[e.lineTools()])}availableZOrderOperations(e){const t=this._environment.model(),i=e.lineTools(),s=i[0],r=i[i.length-1],n=(0,o.ensureNotNull)(t.paneForSource(i[0])).sourcesByGroup().allExceptSpecialSources(),a=n[0],l=n[n.length-1];return{bringForwardEnabled:r!==l,bringToFrontEnabled:r!==l,sendBackwardEnabled:s!==a,sendToBackEnabled:s!==a}}setGroupVisibility(e,t){const i=(t?Re:Ne).format({group:e.name().value()}),s=this._environment.model();this._environment.beginUndoMacro(i,He),e.lineTools().forEach((e=>{const i=e.properties().visible,r=new Le(i,t,null,s);this._environment.pushUndoCommand(r)})),this._environment.endUndoMacro()}setGroupLock(e,t){const i=(t?Oe:Fe).format({group:e.name().value()}),s=this._environment.model();this._environment.beginUndoMacro(i,He),e.lineTools().forEach((e=>{const i=e.properties().frozen,r=new Le(i,t,null,s);this._environment.pushUndoCommand(r)})),this._environment.endUndoMacro()}setGroupName(e,t){const i=this._environment.model(),s=We.format({group:e.name().value(),newName:t}),r=new ke(i,e,t,s);r.setCustomFlag("doesnt_affect_save",He),this._environment.pushUndoCommand(r)}canBeGroupped(e){const t=this._environment.model();return new Set(e.map((e=>t.paneForSource(e)))).size<=1}_groupForLineTool(e){return this._environment.model().lineToolsGroupModel().groups().find((t=>t.containsLineTool(e)))||null}}var Ue=i(14314),je=i(35115),Ge=i(53588),qe=i(63009);const $e=new x.TranslatedString("apply study template {template}",l.t(null,void 0,i(26065)));function Ye(e){for(const t of e.panes)for(const e of t.sources)if((0,Ge.isMainSeriesState)(e))return e.id;return null}class Ke extends P.UndoCommand{constructor(e,t,i){var s,r;super($e.format({template:i})),this._newSymbolParams={},this._model=e,this._templateContent=function(e,t){const i=(0,Ue.default)({},e),s=(0,o.ensureNotNull)(Ye(i));for(const e of i.panes){e.mainSourceId===s&&(e.mainSourceId=t);for(const i of e.sources)if(i.id===s){i.id=t;const r=e=>{const i=e.indexOf(s);-1!==i&&e.splice(i,1,t)};if(e.leftAxisesState&&e.rightAxisesState?(e.leftAxisesState.forEach((e=>r(e.sources))),e.rightAxisesState.forEach((e=>r(e.sources)))):(r(e.leftAxisSources),r(e.rightAxisSources)),e.overlayPriceScales){const i=e.overlayPriceScales[s];i&&(delete e.overlayPriceScales[s],e.overlayPriceScales[t]=i)}}else i.ownerSource===s&&(i.ownerSource=t)}return i}(t,e.mainSeries().id()),this._initialState=e.studyTemplate(!0,!0,!0);const n=e.mainSeries();t.symbol&&(this._newSymbolParams={symbol:t.symbol,currency:null!==(s=t.currency)&&void 0!==s?s:null,unit:null!==(r=t.unit)&&void 0!==r?r:null}),t.interval&&(this._newSymbolParams.interval=t.interval,this._newSymbolParams.style=(0,
fe.getChartStyleByResolution)(t.interval,n.style())),this._initialSymbolParams={symbol:n.symbol(),currency:n.currency(),unit:n.unit(),interval:n.interval(),style:n.style()},this._initialState=e.studyTemplate(),this._initialGroupsState=e.lineToolsGroupModel().state()}redo(){this._model.mainSeries().setSymbolParams(this._newSymbolParams);const e=this._merge(this._templateContent).filter(f.isLineTool);this._model.lineToolsGroupModel().removeLineTools(e);const t=this._model.mainSeries().properties();(0,fe.preparePriceAxisProperties)(t),this._model.recalcVisibleRangeStudies(!0),this._model.setShouldBeSavedEvenIfHidden(!0)}undo(){this._model.mainSeries().setSymbolParams(this._initialSymbolParams),this._merge(this._initialState)}_merge(e){const t=e.version||0,i=this._model,s=i.mainSeries();(0,o.assert)(s.id()===Ye(e)),s.priceScale().properties().childs().lockScale.setValue(!1);const r=i.panes(),n=[];for(let e=r.length;e--;){const t=r[e],i=t.containsMainSeries(),s=t.dataSources();for(let e=s.length;e--;){const t=s[e];(!i||((0,C.isStudy)(t)||(0,C.isStudyStub)(t))&&t.isRemovedByStudyTemplates())&&n.push(t)}}i.resetDeferredStudies();const a=(0,je.closeSourcesSet)(i,n);for(let e=0;ee.zorder-t.zorder));for(let e=0;e-1,a=o?r[e]:i.createPane(e);o&&t<3&&(0,qe.reorderDataSourcesStateZOrder)(n.sources),a.restoreState({state:n,withData:!1,version:t}),null!==a.mainDataSource()||i.removePane(a)}return i.syncLollipopSources(),s.priceScale().setMode({autoScale:!0}),i.startNotStartedStudies(),i.recalculateAllPanes((0,ye.globalChangeEvent)()),i.fullUpdate(),a}}var Ze=i(36174),Xe=i(18611);const Je=(0,w.getLogger)("Chart.ChartUndoModel"),Qe=new x.TranslatedString("paste drawing",l.t(null,void 0,i(96916)));class et extends P.UndoCommand{constructor(e,t,i,s,r){super(Qe),this._needCopyToOtherCharts=!1,this._sourceState=null,this._model=e,this._clipboardData=t,this._paneIndex=this._model.panes().indexOf(i||(0,o.ensureNotNull)(this._model.paneForSource(this._model.mainSeries()))),this._pasteWithData=!!s,this._keepZIndex=!!r}redo(){const e=this._model.panes()[this._paneIndex],t=(0,o.ensureNotNull)(e.clipboardLineToolOwnerSource(this._clipboardData.source.id)),i=t===this._model.mainSeries();null===this._sourceState&&(this._sourceState=this._getSourceState(t,i));const s=(0,o.ensureNotNull)(e.restoreLineTool(this._sourceState,this._pasteWithData,this._keepZIndex,void 0,t));(0,o.ensureNotNull)(t.priceScale()).addDataSource(s),this._clipboardData.centeredOnChart&&s.centerPosition&&s.centerPosition(),s.restoreFixedPoint(),s.createServerPoints(),this._needCopyToOtherCharts=Boolean(i&&s.isSynchronizable()&&0!==s.sharingMode().value()),this._model.setShouldBeSavedEvenIfHidden(!0)}undo(){if(!this._sourceState)return void Je.logError("This command was never executed - nothing to undo");const e=this.source()
;this._clipboardData.centeredOnChart&&(this._clipboardData.centeredOnChart=!1,this._sourceState.points=e.normalizedPoints()),this._model.removeSource(e)}source(){return(0,o.ensureNotNull)(this._model.dataSourceForId((0,o.ensureNotNull)(this._sourceState).id))}needCopyToOtherCharts(){return this._needCopyToOtherCharts}_getSourceState(e,t){const i=(0,M.clone)(this._clipboardData.source);delete i.state.symbol,t?(null!=i.linkKey||void 0!==i.sharingMode&&0!==i.sharingMode)&&(i.linkKey=(0,Ze.randomHash)()):(i.linkKey=null,i.sharingMode=0);const s=(0,o.ensureNotNull)(e.priceScale()),r=this._model,{symbol:n,currencyId:l,unitId:c}=this._clipboardData.source.state,h=(0,o.ensureNotNull)(e.symbolSource());let d=!1;!h.symbolSameAsCurrent(n)||(null!==l?l!==(0,fe.symbolCurrency)(h.symbolInfo(),void 0,!0):h.isConvertedToOtherCurrency())||(null!==c?c!==(0,fe.symbolUnit)(h.symbolInfo(),this._model.unitConversionEnabled()):h.isConvertedToOtherUnit())||((0,Xe.isActingAsSymbolSource)(e)?d=!0:(0,C.isStudy)(e)&&(d=Boolean(e.metaInfo().is_price_study)));const u=e=>{const t=e.x*r.timeScale().width(),i=e.y*s.height()-40;return new a.Point(t,i)},p=(0,o.ensureNotNull)(e.firstValue());if(this._model.id()===this._clipboardData.modelId||!d){for(let e=0;e{this._symbolSource(e).setSymbolParams(e.newSymbolParams),e.showFade&&e.chartWidget.screen.show(!0)})),this._firstRedo||(0,rt.muteLinkingGroup)(this._linkingGroupIndex,!1),this._firstRedo=!1}undo(){(0,rt.muteLinkingGroup)(this._linkingGroupIndex,!0),this._charts.forEach((e=>{this._symbolSource(e).setSymbolParams(e.prevSymbolParams),e.showFade&&e.chartWidget.screen.show(!0)})),(0,rt.muteLinkingGroup)(this._linkingGroupIndex,!1)}canMerge(e){if(!(e instanceof nt)||e._linkingGroupIndex!==this._linkingGroupIndex||!this._containsMainSeriesOnly()||!e._containsMainSeriesOnly()||e._creationTime-this._creationTime>500)return!1;for(const[t]of e._charts)if(this._charts.has(t))return!1;return!0}merge(e){if(e instanceof nt)for(const[t,i]of e._charts)this._charts.set(t,i)}_showFade(e,t){return e===t.model().mainSeries()}_symbolSource(e){return(0,o.ensureNotNull)(e.chartWidget.model().model().dataSourceForId(e.sourceId))}_containsMainSeriesOnly(){
for(const[e,t]of this._charts)if(t.sourceId!==e.model().mainSeries().id())return!1;return!0}}const ot=new x.TranslatedString("change symbol",l.t(null,void 0,i(526)));class at extends nt{constructor(e,t,i){super(ot,e,{symbol:t,currency:null,unit:null},i),this._symbol=t}canMerge(e){return e instanceof at&&e._symbol===this._symbol&&super.canMerge(e)}}const lt=(0,w.getLogger)("Chart.ChartUndoModel"),ct=new x.TranslatedString("paste indicator",l.t(null,void 0,i(80611)));class ht extends P.UndoCommand{constructor(e,t,i){super(ct),this._sourceState=null,this._model=e,this._clipboardData=t,this._paneId=i}redo(){if(!this._sourceState){const e=(0,M.clone)(this._clipboardData.source);e.id=(0,Ze.randomHashN)(6),this._sourceState=e}let e,t;e=this._paneId?(0,o.ensureNotNull)(this._model.paneForId(this._paneId)):this._sourceState.metaInfo.is_price_study?(0,o.ensureNotNull)(this._model.paneForSource(this._model.mainSeries())):this._model.createPane();const i=!e.mainDataSource();this._sourceState.zorder=e.newStudyZOrder();const s=(0,o.ensureNotNull)(e.restoreStudy(this._sourceState,!1));i||(t=this._sourceState.metaInfo.is_price_study?t=this._model.mainSeries().priceScale():this._paneId?e.findSuitableScale(s):e.defaultPriceScale(),t!==s.priceScale()&&e.move(s,t)),(0,C.isStudy)(s)&&s.start()}undo(){if(null===this._sourceState)return void lt.logError("This command was never executed - nothing to undo");const e=(0,o.ensureNotNull)(this._model.dataSourceForId(this._sourceState.id));this._model.removeSource(e)}state(){return this._sourceState}}class dt extends P.UndoCommand{constructor(e,t,i,s,r){super(null,!1),this._model=e,this._paneA=t,this._paneB=i,this._prevStretchA=s,this._currStretchA=r}redo(){const e=this._paneA.stretchFactor()+this._paneB.stretchFactor();this._paneA.setStretchFactor(this._currStretchA),this._paneB.setStretchFactor(e-this._currStretchA),this._model.fullUpdate()}undo(){const e=this._paneA.stretchFactor()+this._paneB.stretchFactor();this._paneA.setStretchFactor(this._prevStretchA),this._paneB.setStretchFactor(e-this._prevStretchA),this._model.fullUpdate()}}var ut=i(81155);const pt=new x.TranslatedString("move",l.t(null,void 0,i(47107)));class _t extends P.UndoCommand{constructor(e,t,i,s){super(pt,!1),this._endEvent=null,this._model=e,this._sourceId=t.id(),this._itemIndex=i,this._startEvent=s}move(e){this._endEvent=e,this._move(e)}hasChanges(){return null!==this._endEvent}undo(){this._move(this._startEvent)}redo(){this._move((0,o.ensureNotNull)(this._endEvent))}_move(e){const t=(0,o.ensureNotNull)(this._model.dataSourceForId(this._sourceId));(0,o.assert)(void 0!==t.moveItem,'The method "moveItem" is not defined'),t.moveItem&&t.moveItem(new a.Point(e.localX,e.localY),this._itemIndex,new ut.EnvironmentState(e))}}class mt extends P.UndoCommand{constructor(e,t,i,s,r,n,o,a,l,c,h,d,u){super(u),this._paneState=null,this._lastInsertionStartPromise=null,this._additionalStudiesIds=[],this._chartModel=e,this._studyMetaInfo=t,this._props=s,this._addAsOverlay=r,this._parentIds=n.map((e=>e.id())),this._inputs=i,
this._targetZOrder=h,this._preferredPriceScale=o,this._allowChangeCurrency=a,this._allowChangeUnit=l,this._paneSize=c,this._studyId=null!=d?d:null}redo(){const e=this._parentIds.map((e=>this._chartModel.dataSourceForId(e))),t=this._chartModel.insertStudyWithParams(this._studyMetaInfo,this._inputs,this._targetZOrder,this._props,this._addAsOverlay,e,this._preferredPriceScale,this._allowChangeCurrency,this._allowChangeUnit,this._paneSize,null===this._studyId?void 0:this._studyId),i=t.study;if(this._lastInsertionStartPromise=t.startPromise,this._studyId=i.id(),i.childStudyByRebind().subscribe(null,(()=>(0,S.trackEvent)("SOS","Apply SOS","Rebind SOS"))),this._chartModel.setShouldBeSavedEvenIfHidden(!0),null!==this._paneState){(0,o.ensureNotNull)(this._chartModel.paneForSource(i)).restoreState({state:this._paneState,withData:!1,version:this._chartModel.version()}),this._paneState=null}}undo(){const e=(0,o.ensureNotNull)(this._chartModel.dataSourceForId((0,o.ensureNotNull)(this._studyId)));(0,Xe.isSymbolSource)(e)&&e.symbolResolved().unsubscribeAll(this);const t=(0,o.ensureNotNull)(this._chartModel.paneForSource(e)).state();this._additionalStudiesIds.forEach((e=>{const t=(0,o.ensureNotNull)(this._chartModel.dataSourceForId(e));this._chartModel.removeSource(t)})),this._additionalStudiesIds=[],this._chartModel.removeSource(e)&&(this._paneState=t)}insertedStudy(){return this._chartModel.dataSourceForId((0,o.ensureNotNull)(this._studyId))}lastInsertionStartPromise(){var e;return null!==(e=this._lastInsertionStartPromise)&&void 0!==e?e:Promise.resolve()}_createCopiesOfNewFundamentalForAllStocks(){}_createCopiesOfExistingFundamentalsForNewStock(){}}var gt=i(95367),ft=i(20585),vt=i.n(ft),St=i(59656),yt=i(26512),bt=i(67521);const wt=new x.TranslatedString("zoom",l.t(null,void 0,i(59833)));class Ct extends P.UndoCommand{constructor(e,t,i,s,r,n){super(wt),this._barSpacing=null,this._rightBarsOffset=null,this._leftBarsOffset=null,this._priceMode=null,this._model=e,this._startBar=t,this._endBar=i,this._startPrice=s,this._endPrice=r,this._pane=n}redo(){const e=(0,o.ensureNotNull)(this._model.timeScale().visibleBarsStrictRange());this._leftBarsOffset=e.firstBar()-this._startBar,this._rightBarsOffset=e.lastBar()-this._endBar,this._barSpacing=this._model.timeScale().barSpacing(),this._priceMode=this._pane.defaultPriceScale().mode(),this._model.zoomToViewport(this._startBar,this._endBar,this._startPrice,this._endPrice,this._pane)}undo(){const e=this._model.timeScale(),t=this._pane.defaultPriceScale(),i=(0,o.ensureNotNull)(e.visibleBarsStrictRange());e.setBarSpacing((0,o.ensureNotNull)(this._barSpacing)),e.zoomToBarsRange(i.firstBar()+(0,o.ensureNotNull)(this._leftBarsOffset),i.lastBar()+(0,o.ensureNotNull)(this._rightBarsOffset)),t.setMode((0,o.ensureNotNull)(this._priceMode)),t.recalculatePriceRange((0,o.ensureNotNull)(e.visibleBarsStrictRange())),this._model.recalculateAllPanes((0,ye.viewportChangeEvent)()),this._model.lightUpdate()}}const Pt=(0,
w.getLogger)("Chart.ChartUndoModel"),xt=new x.TranslatedString("zoom",l.t(null,void 0,i(59833)));class Tt extends P.UndoCommand{constructor(e,t,i){super(xt),this._baseCmd=e,this._zoomStack=t,this._inOut=i}undo(){if(this._inOut){if(this._baseCmd!==this._zoomStack.head())return void Pt.logDebug("zoom stack inconsistency");this._baseCmd.undo(),this._zoomStack.pop()}else this._baseCmd.redo(),this._zoomStack.push(this._baseCmd)}redo(){if(this._inOut)this._baseCmd.redo(),this._zoomStack.push(this._baseCmd);else{if(this._baseCmd!==this._zoomStack.head())return void Pt.logDebug("zoom stack inconsistency");this._baseCmd.undo(),this._zoomStack.pop()}}}const It=new x.TranslatedString("stop syncing drawing",l.t(null,void 0,i(98784)));class Mt extends P.UndoCommand{constructor(e,t){super(It),this._model=e,this._sourceId=t.id(),this._linkKey=t.linkKey().value()}redo(){(0,o.ensureNotNull)(this._model.dataSourceForId(this._sourceId)).linkKey().setValue(null)}undo(){(0,o.ensureNotNull)(this._model.dataSourceForId(this._sourceId)).linkKey().setValue(this._linkKey)}}const At=new x.TranslatedString("restore defaults",l.t(null,void 0,i(9608)));class Lt extends P.UndoCommand{constructor(e,t,i=At){super(i),this._chartModel=e,this._defaultProperty=t,this._state=t.state()}redo(){this._chartModel.restoreFactoryDefaults(this._defaultProperty)}undo(){this._defaultProperty.mergeAndFire(this._state),this._chartModel.mainSeries().onChartStyleChanged()}}var kt=i(17236);class Dt extends Lt{redo(){this._defaultProperty.hasChild("intervalsVisibilities")&&this._defaultProperty.childs().intervalsVisibilities.mergeAndFire(kt.intervalsVisibilitiesDefaults),super.redo()}}const Et=new x.TranslatedString("restore study defaults",l.t(null,void 0,i(30107)));class Vt extends Dt{constructor(e,t,i=Et){super(e,t.properties(),i),this._study=t}redo(){super.redo(),this._chartModel.recalcColorStudies(!0),this._patchProperties()}undo(){super.undo(),this._chartModel.recalcColorStudies(!0),this._patchProperties()}_patchProperties(){0}}var Bt=i(4949),Rt=i(30888),Nt=i(85804);function Ot(e){const{visible:t,...i}=e;return i}function Ft(e){const{visible:t,...i}=e;return i}function Wt(e){const{drawWick:t,drawBorder:i,drawBody:s,barColorsOnPrevClose:r,...n}=e;return n}function Ht(e){const{drawWick:t,drawBorder:i,drawBody:s,...r}=e;return r}function zt(e){const{drawWick:t,drawBorder:i,drawBody:s,showRealLastPrice:r,inputs:n,...o}=e;return o}function Ut(e){const{barColorsOnPrevClose:t,dontDrawOpen:i,thinBars:s,...r}=e;return r}function jt(e){const{showBorders:t,showLabels:i,drawBody:s,...r}=e;return r}function Gt(e){const{linestyle:t,linewidth:i,priceSource:s,...r}=e;return r}function qt(e){const{linestyle:t,linewidth:i,priceSource:s,...r}=e;return r}function $t(e){const{inputs:t,...i}=e;return i}function Yt(e){const{inputs:t,...i}=e;return i}function Kt(e){const{inputs:t,...i}=e;return i}function Zt(e){const{inputs:t,...i}=e;return i}function Xt(e){const{topLineWidth:t,bottomLineWidth:i,baseLevelPercentage:s,priceSource:r,...n}=e;return n}function Jt(e){
const{thinBars:t,inputs:i,...s}=e;return s}function Qt(e){return{bgColors:e.bgColors}}function ei(e){const{visible:t,style:i,symbol:s,interval:r,sessionId:n,highLowAvgPrice:o,showCountdown:a,bidAsk:l,prePostMarket:c,priceAxisProperties:h,candleStyle:d,hollowCandleStyle:u,haStyle:p,barStyle:_,hiloStyle:m,lineStyle:g,lineWithMarkersStyle:f,steplineStyle:v,areaStyle:S,renkoStyle:y,pbStyle:b,kagiStyle:w,pnfStyle:C,baselineStyle:P,rangeStyle:x,volFootprintStyle:T,esdShowDividends:I,esdShowSplits:M,esdShowEarnings:A,esdShowBreaks:L,showContinuousContractSwitches:k,showContinuousContractSwitchesBreaks:D,showFuturesContractExpiration:E,showLastNews:V,...B}=e;return{bidAsk:Ot(l),prePostMarket:Ft(c),candleStyle:Wt(d),hollowCandleStyle:Ht(u),haStyle:zt(p),barStyle:Ut(_),hiloStyle:jt(m),lineStyle:Gt(g),lineWithMarkersStyle:Gt(f),steplineStyle:Gt(v),areaStyle:qt(S),renkoStyle:$t(y),pbStyle:Yt(b),kagiStyle:Kt(w),pnfStyle:Zt(C),baselineStyle:Xt(P),rangeStyle:Jt(x),volFootprintStyle:Qt(T),...B}}function ti(e){const{scaleSeriesOnly:t,showSeriesLastValue:i,showStudyLastValue:s,showSymbolLabels:r,showBidAskLabels:n,showPrePostMarketPriceLabel:o,showStudyPlotLabels:a,showFundamentalNameLabel:l,showFundamentalLastValue:c,seriesLastValueMode:h,...d}=e;return d}function ii(e){const{topMargin:t,bottomMargin:i,...s}=e;return s}const si=new x.TranslatedString("apply chart theme",l.t(null,void 0,i(66568)));class ri extends P.UndoCommand{constructor(e,t,i){var s,r,n;super(si),this._model=e,this._newSessionProps=t.sessions||(0,Nt.factoryDefaults)("sessions"),["candleStyle","hollowCandleStyle","haStyle"].forEach((e=>{t.mainSourceProperties[e].wickUpColor=t.mainSourceProperties[e].wickUpColor||t.mainSourceProperties[e].wickColor,t.mainSourceProperties[e].wickDownColor=t.mainSourceProperties[e].wickDownColor||t.mainSourceProperties[e].wickColor})),t.chartProperties=null!==(s=t.chartProperties)&&void 0!==s?s:{paneProperties:{},scalesProperties:void 0},t.chartProperties.paneProperties.vertGridProperties=null!==(r=t.chartProperties.paneProperties.vertGridProperties)&&void 0!==r?r:t.chartProperties.paneProperties.gridProperties,t.chartProperties.paneProperties.horzGridProperties=null!==(n=t.chartProperties.paneProperties.horzGridProperties)&&void 0!==n?n:t.chartProperties.paneProperties.gridProperties;const o=this._model.properties().state().paneProperties.legendProperties;delete o.backgroundTransparency,t.chartProperties.paneProperties.legendProperties={...t.chartProperties.paneProperties.legendProperties,...o};const a=(0,Nt.factoryDefaults)("chartproperties"),l=(0,Rt.deepExtend)({},a,t.chartProperties);this._newChartProps={paneProperties:ii(l.paneProperties),scalesProperties:ti(l.scalesProperties)},e.timeScale().preserveBarSpacing()&&delete this._newChartProps.scalesProperties.barSpacing;const c=(0,Nt.factoryDefaults)("chartproperties.mainSeriesProperties"),h=(0,Rt.deepExtend)({},c,t.mainSourceProperties);this._newSeriesProps=i?h:ei(h);const d=e.properties().state();this._oldChartProps={paneProperties:ii(d.paneProperties),
scalesProperties:ti(d.scalesProperties)};const u=e.mainSeries().properties().state();this._oldSeriesProps=i?u:ei(u),this._oldSessionProps=this._model.sessions().properties().state()}undo(){this._merge(this._oldChartProps,this._oldSeriesProps,this._oldSessionProps),this._model.mainSeries().onChartStyleChanged(),this._model.updateScales(),this._model.chartThemeLoaded()}redo(){this._merge(this._newChartProps,this._newSeriesProps,this._newSessionProps),this._model.mainSeries().onChartStyleChanged(),this._model.updateScales(),this._model.chartThemeLoaded()}_merge(e,t,i){var s,r,n,o;const a=this._model;(0,ge.saveDefaultProperties)(!0),e&&(a.properties().childs().paneProperties.mergeAndFire(e.paneProperties),a.properties().childs().scalesProperties.mergeAndFire(e.scalesProperties)),"priceAxisProperties"in t&&a.mainSeries().priceScale().setMode({autoScale:null===(s=t.priceAxisProperties)||void 0===s?void 0:s.autoScale,percentage:null===(r=t.priceAxisProperties)||void 0===r?void 0:r.percentage,log:null===(n=t.priceAxisProperties)||void 0===n?void 0:n.log,lockScale:null===(o=t.priceAxisProperties)||void 0===o?void 0:o.lockScale}),a.mainSeries().properties().mergeAndFire(t),a.mainSeries().properties().saveDefaults(),a.mainSeries().createPaneView(),a.mainSeries().invalidateBarStylesCache(),a.recalculateAllPanes((0,ye.globalChangeEvent)()),a.fullUpdate(),a.properties().saveDefaults(),a.sessions().restoreState({properties:i},!1),(0,ge.saveDefaultProperties)(!1)}}const ni=new x.TranslatedString("change resolution",l.t(null,void 0,i(32303)));class oi extends nt{constructor(e,t,i){super(ni,e,function(e,t){let i;const s=(0,fe.isRangeStyle)(e.style()),r=p.Interval.isRange(t);return!s&&r?i=11:s&&!r&&(i=(0,fe.getLastUsedStyle)()),{interval:t,style:i}}(e,t),i),this._resolution=t}canMerge(e){return e instanceof oi&&e._resolution===this._resolution&&super.canMerge(e)}_showFade(e,t){return!0}}var ai=i(69718);class li extends ai.SetWatchedValueCommand{constructor(){super(...arguments),this._firstRedo=!0}redo(){this._firstRedo||(0,rt.muteLinkingGroup)(this._newValue,!0),(0,rt.muteLinkingGroup)(this._oldValue,!0),super.redo(),this._firstRedo||(0,rt.muteLinkingGroup)(this._newValue,!1),(0,rt.muteLinkingGroup)(this._oldValue,!1),this._firstRedo=!1}undo(){(0,rt.muteLinkingGroup)(this._newValue,!0),(0,rt.muteLinkingGroup)(this._oldValue,!0),super.undo(),(0,rt.muteLinkingGroup)(this._newValue,!1),(0,rt.muteLinkingGroup)(this._oldValue,!1)}}var ci=i(97340),hi=i(76422)
;const di=new x.TranslatedString("send {title} backward",l.t(null,void 0,i(16259))),ui=new x.TranslatedString("bring {title} forward",l.t(null,void 0,i(56763))),pi=new x.TranslatedString("insert {title} after {target}",l.t(null,void 0,i(74055))),_i=new x.TranslatedString("insert {title} before {target}",l.t(null,void 0,i(11231))),mi=new x.TranslatedString("cut {title}",l.t(null,void 0,i(78755))),gi=new x.TranslatedString("cut sources",l.t(null,void 0,i(63649))),fi=new x.TranslatedString("remove {title}",l.t(null,void 0,i(39859))),vi=new x.TranslatedString("remove drawings group",l.t(null,void 0,i(70653))),Si=new x.TranslatedString("move scale",l.t(null,void 0,i(4184))),yi=new x.TranslatedString("stop syncing line tool(s)",l.t(null,void 0,i(57011))),bi=new x.TranslatedString("zoom out",l.t(null,void 0,i(9645))),wi=new x.TranslatedString("zoom in",l.t(null,void 0,i(19813))),Ci=new x.TranslatedString("move drawing(s)",l.t(null,void 0,i(45356))),Pi=new x.TranslatedString("load default drawing template",l.t(null,void 0,i(54597))),xi=new x.TranslatedString("apply factory defaults to selected sources",l.t(null,void 0,i(96996))),Ti=new x.TranslatedString("change currency",l.t(null,void 0,i(22641))),Ii=new x.TranslatedString("change unit",l.t(null,void 0,i(39028))),Mi=new x.TranslatedString("clone line tools",l.t(null,void 0,i(5179))),Ai=new x.TranslatedString("merge up",l.t(null,void 0,i(66143))),Li=new x.TranslatedString("merge down",l.t(null,void 0,i(62153))),ki=new x.TranslatedString("merge to pane",l.t(null,void 0,i(70746))),Di=new x.TranslatedString("unmerge up",l.t(null,void 0,i(52540))),Ei=new x.TranslatedString("unmerge down",l.t(null,void 0,i(86949))),Vi=new x.TranslatedString("unmerge to new bottom pane",l.t(null,void 0,i(20057))),Bi=new x.TranslatedString("move {title} to new right scale",l.t(null,void 0,i(45544))),Ri=new x.TranslatedString("move {title} to new left scale",l.t(null,void 0,i(11303))),Ni=new x.TranslatedString("make {title} no scale (Full screen)",l.t(null,void 0,i(74642))),Oi=new x.TranslatedString("scroll time",l.t(null,void 0,i(70009))),Fi=new x.TranslatedString("scale time",l.t(null,void 0,i(35962))),Wi=new x.TranslatedString("reset time scale",l.t(null,void 0,i(55064))),Hi=new x.TranslatedString("reset scales",l.t(null,void 0,i(21948))),zi=new x.TranslatedString("create {tool}",l.t(null,void 0,i(81791))),Ui=new x.TranslatedString("change {pointIndex} point",l.t(null,void 0,i(72032))),ji=new x.TranslatedString("paste {title}",l.t(null,void 0,i(41601))),Gi=new x.TranslatedString("insert {title}",l.t(null,void 0,i(90743))),qi=new x.TranslatedString("remove all studies",l.t(null,void 0,i(15516))),$i=new x.TranslatedString("remove drawings",l.t(null,void 0,i(44656))),Yi=new x.TranslatedString("remove all studies and drawing tools",l.t(null,void 0,i(80171))),Ki=(new x.TranslatedString("turn line tools sharing off",l.t(null,void 0,i(28068))),new x.TranslatedString("share line tools in layout",l.t(null,void 0,i(77554))),new x.TranslatedString("share line tools globally",l.t(null,void 0,i(64704))),
new x.TranslatedString("change linking group",l.t(null,void 0,i(23783)))),Zi=(l.t(null,void 0,i(75139)),(0,w.getLogger)("Chart.ChartUndoModel")),Xi=!1;function Ji(e,t){return{bringForwardEnabled:e.bringForwardEnabled||t.bringForwardEnabled,bringToFrontEnabled:e.bringToFrontEnabled||t.bringToFrontEnabled,sendBackwardEnabled:e.sendBackwardEnabled||t.sendBackwardEnabled,sendToBackEnabled:e.sendToBackEnabled||t.sendToBackEnabled}}const Qi=(0,b.enabled)("saveload_separate_drawings_storage");function es(){return Qi?(0,De.drawOnAllCharts)().value()?1===(0,De.drawOnAllChartsMode)().value()?1:2:0:(0,De.drawOnAllCharts)().value()?1:0}class ts extends(r()){constructor(e,t,i,s,r,n,o,a,l,c,h){super(),this._createLineCommand=null,this._initialTimeScrollState=null,this._initialTimeScrollPos=null,this._scalePriceInfo=null,this._currentSourceMoveCommand=null,this._currentLineChangeCommand=null,this._currentCustomMoveCommand=null,this._zoomStack=new m.UndoStack,this._chartWidget=r,this.m_model=new(vt())(e,t,i,s,this,o,a,l,c,h),this._undoHistory=n,this._lineToolsGroupController=new ze({model:this._model.bind(this),pushUndoCommand:this._pushUndoCommand.bind(this),beginUndoMacro:(e,t)=>{this._undoHistory.beginUndoMacro(e).setCustomFlag("doesnt_affect_save",!!t)},endUndoMacro:this._undoHistory.endUndoMacro.bind(this._undoHistory),emitEvent:this.emitEvent.bind(this)})}id(){return this._model().id()}undoHistory(){return this._undoHistory}setWatchedValue(e,t,i){this._undoHistory.setWatchedValue(e,t,i)}lineToolsGroupController(){return this._lineToolsGroupController}mergeAllScales(e){!function(e,t){e.beginUndoMacro("left"===t?A:L),e.model().panes().forEach((i=>{const s="left"===t?i.rightPriceScales():i.leftPriceScales(),r=("left"===t?i.leftPriceScales():i.rightPriceScales()).concat(s),n="overlay"===i.priceScalePosition(i.defaultPriceScale())?r[0]:i.defaultPriceScale();e.movePriceScale(i,n,t,0),r.forEach((t=>{if(t===n)return;let s=t.mainSource();for(;null!==s;){e.moveToScale(s,i,n,null,!0);const r=t.mainSource();if(r===s){k.logError("Loop detected while trying to merge scales");break}s=r}}))})),e.endUndoMacro(),e.model().fullUpdate()}(this,e)}movePriceScale(e,t,i,s){const r=new D(this._model(),e,t,i,s,Si);this._pushUndoCommand(r)}createLineTool({pane:e,point:t,linetool:i,properties:s,linkKey:r,ownerSource:n,disableSynchronization:a,sharingMode:l=es(),id:c}){if(("LineToolRegressionTrend"===i||"LineToolAnchoredVWAP"===i)&&!this.canCreateStudy())return(0,h.showTooManyStudiesNotice)(),null;const d=zi.format({tool:new x.TranslatedString(i,St.lineToolsLocalizedNames[i])});this.beginUndoMacro(d,Xi);const u=!a;this._createLineCommand=new H.CreateLineToolUndoCommand({model:this._model(),pane:e,lineTool:i,ownerSource:n||(0,o.ensureNotNull)(e.mainDataSource()),drawOnAllChartsMode:l,id:c});const p=this._createLineCommand.startCreatingLine(t,s,r||null,l),_=(0,o.ensureNotNull)(this._createLineCommand.line());let m=null;if(p&&(u&&this.finishLineTool(_),this._pushUndoCommand(this._createLineCommand),this._createLineCommand=null,m={points:_.normalizedPoints(),
interval:this.mainSeries().interval()}),u&&void 0===r&&(0,De.drawOnAllCharts)().value()&&_.isSynchronizable()){const e=(0,o.ensureNotNull)(this.model().externalTimeStamp(t.index)),s={point:{price:t.price,timeStamp:e},linetool:i,properties:_.properties(),symbol:this.mainSeries().symbol(),model:this.model(),linkKey:(0,o.ensureNotNull)(_.linkKey().value()),finalState:m,id:_.id(),sharingMode:_.sharingMode().value()};_.isFixed()&&(s.pointPositionPercents=_.calcPositionPercents()),(0,De.createLineTool)(s)}return this.endUndoMacro(),_}continueCreatingLine(e,t,i,s){const r=(0,o.ensureNotNull)(this._createLineCommand);this.beginUndoMacro(r.text(),Xi);const n=(0,o.ensureNotNull)(this._model().lineBeingCreated()),a=r.continueCreatingLine(e,t,i,s);let l=null;if(a&&(this.finishLineTool(n),this._pushUndoCommand(r),this._createLineCommand=null,l={points:n.normalizedPoints(),interval:this.mainSeries().interval()}),r.drawOnAllCharts()&&n.isSynchronizable()){const i=(0,o.ensureNotNull)(this._model().externalTimeStamp(e.index));(0,De.continueLineTool)({point:{price:e.price,timeStamp:i},envState:t,finalState:l,model:this._model()})}return this.endUndoMacro(),a}continueExternalLine(e,t,i){const s=(0,o.ensureNotNull)(this._createLineCommand),r=s.continueCreatingLine(e,t,i);return r&&(this._pushUndoCommand(s),this._createLineCommand=null),r}finishLineTool(e){this._model().finishLineTool(e)}pasteImageAsLineTool(e,t,i,s){return null}loadRange(e){const t=this._model(),i=t.mainSeries().getSupportedResolution(e.res),s={val:e.val,res:i},r=t.appliedTimeFrame().value();return(null===r||!_(r,s))&&(this._pushUndoCommand(new Ce(t,s)),!0)}unlinkLines(e){const t=this.model();this.beginUndoMacro(yi,Xi);for(const i of e)null!==i.linkKey().value()&&(0,De.removeLineTool)({withUndo:!0,model:this.model(),symbol:i.symbol(),linkKey:(0,o.ensureNotNull)(i.linkKey().value()),sourceTitle:(0,W.getTranslatedStringForSource)(z.TitleDisplayTarget.StatusLine,i),lineToolState:i.state(!1),unlink:!0}),this._pushUndoCommand(new Mt(t,i));this.endUndoMacro()}zoomFromViewport(){const e=new Tt((0,o.ensureDefined)(this._zoomStack.head()),this._zoomStack,!1);this._pushUndoCommand(e)}zoomToViewport(e,t,i,s,r){const n=new Ct(this.m_model,e,t,i,s,r),o=new Tt(n,this._zoomStack,!0);this._pushUndoCommand(o)}zoomStack(){return this._zoomStack}hoveredSource(){return this.m_model.hoveredSource()}setProperty(e,t,i,s){if(e&&e.value()!==t){const r=new Le(e,t,i,this.m_model,s);this._pushUndoCommand(r),this.emitEvent("setProperty")}}withMacro(e,t,i){const s=this.beginUndoMacro(e,i);try{t()}finally{this.endUndoMacro()}return s}barsMarksSources(){return this.m_model.barsMarksSources()}removeAllDrawingTools(){this.beginUndoMacro($i,!1),this._removeAllDrawingToolsImpl(),this.endUndoMacro()}removeAllStudiesAndDrawingTools(){this.beginUndoMacro(Yi),this._removeAllDrawingToolsImpl(),this._removeAllStudiesImpl(),this.endUndoMacro()}removeAllStudies(){this.beginUndoMacro(qi),this._removeAllStudiesImpl(),this.endUndoMacro()}scrollChartByBar(e){if(!this.m_model.scrollEnabled())return
;const t=e*this.m_model.timeScale().barSpacing();this.startScrollTime(0),this.scrollTimeTo(t),this.endScrollTime()}canZoomIn(){return this.model().canZoomIn()}canZoomOut(){return this.model().canZoomOut()}zoomOut(){const e=this.timeScale().width();if(this.canZoomOut()){try{this.beginUndoMacro(bi)}catch(e){return}(0,v.doAnimate)({to:e/5,onStep:e=>{this.startScaleTime(0),this.scaleTimeTo(e),this.endScaleTime()},onComplete:()=>this.endUndoMacro()})}}zoomIn(){const e=this.timeScale().width();if(this.canZoomIn()){try{this.beginUndoMacro(wi)}catch(e){return}(0,v.doAnimate)({to:e/5,onStep:e=>{this.startScaleTime(e),this.scaleTimeTo(0),this.endScaleTime()},onComplete:()=>this.endUndoMacro()})}}startMovingSources(e,t,i,s){e.filter((e=>e.doesMovingAffectsUndo())).length&&(this._currentSourceMoveCommand=new R(this.model(),e,Ci,!1),e.every(f.isLineTool)&&this._currentSourceMoveCommand.setCustomFlag("doesnt_affect_save",Xi)),this.model().startMovingSources(e,t,i,new Map,s)}moveSources(e,t){this.model().moveSources(e,new Map,t)}endMovingSource(e,t){this.model().endMovingSources(e,void 0,t),null!==this._currentSourceMoveCommand&&(this._currentSourceMoveCommand.saveNewState(),this._pushUndoCommand(this._currentSourceMoveCommand)),this._currentSourceMoveCommand=null}startChangingLinetool(e,t,i,s,r){this._currentLineChangeCommand=new R(this.model(),[e],Ui.format({pointIndex:i}),!1),this._currentLineChangeCommand.setCustomFlag("doesnt_affect_save",Xi),this.model().startChangingLinetool(e,t,i,s,r)}changeLinePoint(e,t){this.model().changeLinePoint(e,t)}endChangingLinetool(e){this.model().endChangingLinetool(e),null!==this._currentLineChangeCommand&&(this._currentLineChangeCommand.saveNewState(),this._pushUndoCommand(this._currentLineChangeCommand)),this._currentLineChangeCommand=null}setChartStyleProperty(e,t,i){if(e.value()!==t){const s=new be(e,t,this.mainSeries(),i,this.model(),this.chartWidget());this._pushUndoCommand(s),this.emitEvent("setChartStyleProperty"),(0,me.trackChartStyleChanged)(e.value())}}restorePropertiesForSource(e){(0,f.isLineTool)(e)?this._restoreLineToolFactoryDefaults(e):this._restoreStudyFactoryDefaults(e)}restoreLineToolsFactoryDefaults(e){1===e.length?this._restoreLineToolFactoryDefaults(e[0]):(this.beginUndoMacro(xi),e.forEach((e=>this._restoreLineToolFactoryDefaults(e))),this.endUndoMacro())}restoreState(e,t,i){return this.m_model.restoreState(e,t,i)}async clipboardCopy(e,t=this.selection().dataSources()){if(!(0,b.enabled)("datasource_copypaste"))return;const i=t.filter((e=>e.copiable()));if(0===i.length)return;for(const e of i)if((0,C.isStudy)(e)&&e.isChildStudy())throw new Error("Can not copy child study");const s=(0,g.clipboardDataForSources)(this._model().id(),i);return null!==s?e.write({app:JSON.stringify(s),text:s.title}):void 0}async clipboardCut(e,t=this.selection().dataSources()){if(!(0,b.enabled)("datasource_copypaste"))return;const i=t.filter((e=>e.copiable()));if(0===i.length)return;await this.clipboardCopy(e,i);const s=i.filter((e=>e.isUserDeletable()));if(0===s.length)return
;const r=(1===s.length?mi:gi).format({title:(0,W.getTranslatedStringForSource)(z.TitleDisplayTarget.StatusLine,s[0])});this.beginUndoMacro(r),this.m_model.selectionMacro((()=>this.removeSources(s,!1,r)),!0),this.endUndoMacro()}async clipboardPaste(e,t){let i=null;if((0,b.enabled)("datasource_copypaste")&&(i=i||await e.read(),i.app)){const e=JSON.parse(i.app);if(null!==await this.pasteSourceFromClip(t,e))return}await this._processSpecialLineToolsContents(e,i,t)}applyStudyTemplate(e,t){const i=new Ke(this._model(),e,t);this._pushUndoCommand(i),(0,hi.emit)("load_study_template")}createStudyInserter(e,t,i={}){const{stubTitle:s,isOverlay:r}=i,n={createStudy:(e,t,i,s,r,n,o,a,l,c,h)=>this.checkIfFeatureAvailable(e,n)?((0,S.trackEvent)("studies","Study_"+e.id),"Compare@tv-basicstudies"===e.id&&(0,S.trackEvent)("compare","symbol:"+t.symbol),this._insertStudy(e,t,s,r,n,o,a,l,c,null,h)):(Zi.logNormal("Cannot insert study "+e.id),null)};void 0!==s&&(n.createStub=()=>this.m_model.insertStudyStub(s,r).id(),n.removeStub=e=>this.m_model.removeStudyStub(e));const o=new ci.StudyInserter(e,n);return o.setParentSources(t),o}replayStatus(){return this.m_model.replayStatus()}setReplayStatus(e){return this.m_model.setReplayStatus(e)}getSymbolString(){return this.m_model.getSymbolString()}interval(){return this.m_model.interval()}startCustomMoving(e,t,i){this._currentCustomMoveCommand=new _t(this.model(),e,t,i)}customMoveBeingProcessed(){return null!==this._currentCustomMoveCommand}processCustomMove(e){(0,o.ensureNotNull)(this._currentCustomMoveCommand).move(e)}endCustomMoving(){null!==this._currentCustomMoveCommand&&this._currentCustomMoveCommand.hasChanges()&&(this._pushUndoCommand(this._currentCustomMoveCommand),this._currentCustomMoveCommand=null)}panes(){return this.m_model.panes()}cloneLineTools(e,t){for(let t=0;t(0,o.ensureNotNull)(this.model().dataSourceForId(e)))).filter((e=>0!==e.sharingMode().value()));return s.length&&this._model().copyToOtherCharts(s,!0),this.endUndoMacro(),this.emitEvent("cloneLineTools"),i.newIds()}removeSource(e,t,i){this.lineBeingCreated()!==e?this.removeSources([e],t,fi.format({title:(0,W.getTranslatedStringForSource)(z.TitleDisplayTarget.StatusLine,e)}),i):this.cancelCreatingLine()}removeSelectedSources(){const e=this._model().selection().dataSources();if(!e.length)return;const t=(e.length>1?vi:fi).format({title:(0,W.getTranslatedStringForSource)(z.TitleDisplayTarget.StatusLine,e[0])});this.removeSources(e,!1,t)}removeSources(e,t,i,s){s||(e=e.filter((e=>e.isUserDeletable())));const r=this._model(),n=r.lineToolsGroupModel(),a=e.every(f.isLineTool)&Ξthis.beginUndoMacro(i,a),r.selectionMacro((s=>{const a=new Map;e.forEach((e=>{if((0,f.isLineTool)(e)){const t=n.groupForLineTool(e);if(null!==t){const i=a.get(t)||[];i.push(e),a.set(t,i)}null!==e.linkKey().value()&&(0,De.removeLineTool)({withUndo:!0,model:this.model(),linkKey:(0,
o.ensureNotNull)(e.linkKey().value()),symbol:this.model().mainSeries().symbol(),lineToolState:e.state(!1),sourceTitle:(0,W.getTranslatedStringForSource)(z.TitleDisplayTarget.StatusLine,e)})}}));const l=new V.RemoveSourcesUndoCommand(r,e,i),c=l.removedIds();this._pushUndoCommand(l),!t&&c.length>0&&(1===c.length?this.emitEvent("removeSource",[c[0]]):this.emitEvent("removeSources",[c]))}),!0),this.endUndoMacro()}removeUnloadedLineTool({sourceTitle:e,linkKey:t,symbol:i,state:s,withUndo:r,unlink:n}){}async scrollToLineTool(e){const t=this.timeScale().logicalRange();if(null===t)return;const i=this.timeScale().barSpacing();let s=t.left();const r=e.points().map((e=>e.index)),n=this.timeScale().points().range().value();if(null===n)return;let a=n.firstIndex;const l=n.lastIndex,h=t.length()/2;if(0===r.length||r.some((e=>t.contains(e))))return;const d=()=>{const t=e.points().map((e=>e.index)),i=t.filter((e=>e<=l)).reduce(((e,t)=>null===e?t:Math.max(e,t)),null);return null!==i?i:t.reduce(((e,t)=>Math.min(e,t)))};let u,p=d();if(a-h>p){const t=e.points().map((e=>e.time)).filter(M.notUndefined).map((e=>e.valueOf()));if(0===t.length)return;const i=t.reduce(((e,t)=>Math.min(e,t)),t[0]);await this.model().gotoTime(i),p=d();const r=(0,o.ensureNotNull)(this.timeScale().logicalRange());if(r.contains(p))return;s=r.left(),a=(0,o.ensureNotNull)(this.timeScale().points().range().value()).firstIndex}a-h>p?(u=(s-a+h)*i,this.mainSeries().setGotoDateResult({timestamp:(0,o.ensureNotNull)(this.timeScale().points().valueAt(a)),eod:!0})):u=(s-p+1+h)*i,this.startScrollTime(0),(0,v.doAnimate)({onStep:(e,t)=>this.scrollTimeTo(t),from:0,to:Math.round(u),easing:c.easingFunc.easeInOutCubic,duration:c.dur,onComplete:()=>this.endScrollTime()})}mergeSourceUp(e){const t=new O.MergeUpUndoCommand(this._model(),e,Ai);this._mergeUnmergeSource(e,t)}mergeSourceDown(e){const t=new O.MergeDownUndoCommand(this._model(),e,Li);this._mergeUnmergeSource(e,t)}mergeToPane(e,t,i){const s=this._model().panes().indexOf(t),r=new O.MergeToTargetPane(this._model(),e,s,ki,i);this._mergeUnmergeSource(e,r)}unmergeSourceUp(e){const t=new N.UnmergeUpUndoCommand(this._model(),e,Di);this._mergeUnmergeSource(e,t)}unmergeSourceDown(e){const t=new N.UnmergeDownUndoCommand(this._model(),e,Ei);this._mergeUnmergeSource(e,t)}unmergeToNewBottomPane(e){const t=new N.UnmergeToNewBottomPane(this._model(),e,Vi);this._mergeUnmergeSource(e,t)}availableZOrderOperations(e){const t=this._model().lineToolsGroupModel(),i=e.filter(f.isLineTool),s=i.map((e=>t.groupForLineTool(e)));(0,o.assert)(new Set(s).size<=1,"Cannot move line tools from different group");const r=0===s.length?null:s[0];let n={bringForwardEnabled:!1,bringToFrontEnabled:!1,sendBackwardEnabled:!1,sendToBackEnabled:!1};const a=new Set(i);for(const t of(0,F.sortSources)(e)){if((0,f.isLineTool)(t)&&null!==r){const e=(0,F.sortSources)(r.lineTools().filter((e=>!a.has(e)||e===t)));n=Ji(n,{bringForwardEnabled:t!==e[e.length-1],bringToFrontEnabled:t!==e[e.length-1],sendBackwardEnabled:t!==e[0],sendToBackEnabled:t!==e[0]});continue}const e=(0,
o.ensureNotNull)(this._model().paneForSource(t)).sourcesByGroup().allExceptSpecialSources();if(0===e.length)continue;const i=t.zorder(),s=e[0].zorder(),l=e[e.length-1].zorder();n=Ji(n,{bringForwardEnabled:i!==l,bringToFrontEnabled:i!==l,sendBackwardEnabled:i!==s,sendToBackEnabled:i!==s})}return n}sendToBack(e){if(!this.availableZOrderOperations(e).sendToBackEnabled)throw new Error("Send to back operation is unavailable");let t=null;const i=e[0];if((0,f.isLineTool)(i)){const s=this._model().lineToolsGroupModel().groupForLineTool(i);if(null!==s){const i=s.lineTools();t=new re(this.model(),(0,F.sortSources)(e),i[0])}}null===t&&(t=new ee(this.model(),(0,F.sortSources)(e))),this._pushUndoCommand(t),this.emitEvent("changeZOrder",[e])}bringToFront(e){if(!this.availableZOrderOperations(e).bringToFrontEnabled)throw new Error("Bring to front operation is unavailable");let t=null;const i=e[0];if((0,f.isLineTool)(i)){const s=this._model().lineToolsGroupModel().groupForLineTool(i);if(null!==s){const i=s.lineTools();t=new ie(this.model(),(0,F.sortSources)(e),i[i.length-1])}}null===t&&(t=new Q(this.model(),(0,F.sortSources)(e))),this._pushUndoCommand(t),this.emitEvent("changeZOrder",[e])}sendBackward(e){if(!this.availableZOrderOperations(e).sendBackwardEnabled)throw new Error("Send backward operation is unavailable");const t=di.format({title:(0,W.getTranslatedStringForSource)(z.TitleDisplayTarget.StatusLine,e[0])});this._sendBackOrBringForward(t,(0,F.sortSources)(e),((e,t)=>new oe(this.model(),e,t)))}bringForward(e){if(!this.availableZOrderOperations(e).bringForwardEnabled)throw new Error("Bring forward operation is unavailable");const t=ui.format({title:(0,W.getTranslatedStringForSource)(z.TitleDisplayTarget.StatusLine,e[0])});this._sendBackOrBringForward(t,(0,F.sortSources)(e),((e,t)=>new le(this.model(),e,t)))}insertAfter(e,t){e=(0,F.sortSources)(e);const i=pi.format({title:(0,W.getTranslatedStringForSource)(z.TitleDisplayTarget.StatusLine,e[0]),target:(0,W.getTranslatedStringForSource)(z.TitleDisplayTarget.StatusLine,t)});this._insertAfterOrBefore(i,e,t,(()=>new ie(this.model(),e,t)))}insertBefore(e,t){e=(0,F.sortSources)(e);const i=_i.format({title:(0,W.getTranslatedStringForSource)(z.TitleDisplayTarget.StatusLine,e[0]),target:(0,W.getTranslatedStringForSource)(z.TitleDisplayTarget.StatusLine,t)});this._insertAfterOrBefore(i,e,t,(()=>new re(this.model(),e,t)))}detachToRight(e,t){(0,S.trackEvent)("Chart","Move to new right scale");const i=Bi.format({title:(0,W.getTranslatedStringForSource)(z.TitleDisplayTarget.StatusLine,e)}),s=new st.MoveToNewPriceScaleUndoCommand(this.model(),e,t,"right",i);this._pushUndoCommand(s),this.emitEvent("moveSource",[e])}detachToLeft(e,t){(0,S.trackEvent)("Chart","Move to new left scale");const i=Ri.format({title:(0,W.getTranslatedStringForSource)(z.TitleDisplayTarget.StatusLine,e)}),s=new st.MoveToNewPriceScaleUndoCommand(this.model(),e,t,"left",i);this._pushUndoCommand(s),this.emitEvent("moveSource",[e])}detachNoScale(e,t){(0,S.trackEvent)("Chart","Make source no scale");const i=Ni.format({
title:(0,W.getTranslatedStringForSource)(z.TitleDisplayTarget.StatusLine,e)}),s=new st.MoveToNewPriceScaleUndoCommand(this.model(),e,t,"overlay",i);this._pushUndoCommand(s),this.emitEvent("moveSource",[e])}moveToScale(e,t,i,s,r){(0,S.trackEvent)("Chart","Move source to target scale"),this.beginUndoMacro(s);const n=new st.MoveToExistingPriceScaleUndoCommand(this.model(),e,t,i,s),o=r?null:(0,y.sourceNewCurrencyOnPinningToPriceScale)(e,i,this._model()),a=r?null:(0,yt.sourceNewUnitOnPinningToPriceScale)(e,i,this._model());this._pushUndoCommand(n),null!==o&&this.setPriceScaleCurrency(i,o),null!==a&&this.setPriceScaleUnit(i,a),this.endUndoMacro(),this.emitEvent("moveSource",[e])}setLinkingGroupIndex(e){this._undoHistory.beginUndoMacro(Ki),this._pushUndoCommand(new li(this.model().linkingGroupIndex(),e,Ki)),this._model().setShouldBeSavedEvenIfHidden(!0),this._undoHistory.endUndoMacro()}startScrollTime(e){const t=this.timeScale();this._initialTimeScrollState={rightOffset:t.rightOffset(),barSpacing:t.barSpacing()},this._initialTimeScrollPos=e,this.model().startScrollTime(e)}scrollTimeTo(e){null!==this._initialTimeScrollPos&&null!==this._initialTimeScrollState&&Math.abs(e-this._initialTimeScrollPos)>20&&(this._pushUndoCommand(new _e.TimeScaleChangeUndoCommand(this.model(),this._initialTimeScrollState,Oi)),this._initialTimeScrollPos=null,this._initialTimeScrollState=null),this.model().scrollTimeTo(e)}endScrollTime(){this.model().endScrollTime(),this._initialTimeScrollPos=null,this._initialTimeScrollState=null}startScaleTime(e){this.changeTimeScale(Fi),this.model().startScaleTime(e)}scaleTimeTo(e){this.model().scaleTimeTo(e)}endScaleTime(){this.model().endScaleTime()}resetTimeScale(){this.changeTimeScale(Wi),this.model().resetTimeScale()}changeTimeScale(e){const t=this.timeScale(),i={rightOffset:t.rightOffset(),barSpacing:t.barSpacing()};this._pushUndoCommand(new _e.TimeScaleChangeUndoCommand(this.model(),i,e))}startScalePrice(e,t,i,s){this._scalePriceInfo={priceScaleState:t.state(),tryMergeConsecutiveScales:s},this.model().startScalePrice(e,t,i)}scalePriceTo(e,t,i){this.model().scalePriceTo(e,t,i)}endScalePrice(e,t){this.model().endScalePrice(e,t);const i=(0,o.ensureNotNull)(this._scalePriceInfo);(0,n.default)(i.priceScaleState,t.state())||this._pushUndoCommand(new bt.PriceScaleChangeUndoCommand(this.model(),e,t,i.priceScaleState,i.tryMergeConsecutiveScales)),this._scalePriceInfo=null}startTwoPointsScalePrice(e,t,i,s,r){this._scalePriceInfo={priceScaleState:t.state(),tryMergeConsecutiveScales:r},this.model().startTwoPointsScalePrice(e,t,i,s)}twoPointsScalePriceTo(e,t,i,s){this.model().twoPointsScalePriceTo(e,t,i,s)}endTwoPointsScalePrice(e,t){this.model().endTwoPointsScalePrice(e,t);const i=(0,o.ensureNotNull)(this._scalePriceInfo);(0,n.default)(i.priceScaleState,t.state())||this._pushUndoCommand(new bt.PriceScaleChangeUndoCommand(this.model(),e,t,i.priceScaleState,i.tryMergeConsecutiveScales)),this._scalePriceInfo=null}resetPriceScale(e,t){const i=t.state();this.model().resetPriceScale(e,t),(0,
n.default)(i,t.state())||this._pushUndoCommand(new bt.PriceScaleChangeUndoCommand(this.m_model,e,t,i))}rearrangePanes(e,t){const i=new pe(this._model(),e,t);this._pushUndoCommand(i)}movePane(e,t){const i=new pe(this._model(),e,t);this._pushUndoCommand(i)}toggleCollapsedPane(e){const t=this.panes().findIndex((t=>t===e));t<0||this._pushUndoCommand(new I(this._model(),t))}readOnly(){return this.m_model.readOnly()}checkIfFeatureAvailable(e,t){let i=this.canCreateStudy();const s=t.length>0;window.user.pro_plan;return!this.readOnly()&&s&&(i=this.canCreateStudy(!0)),!!i||(s||(0,h.showTooManyStudiesNotice)(),!1)}async pasteSourceFromClip(e,t,i){const s=t;if(!s||0===s.sources.length)return null;const r=e||(0,o.ensureNotNull)(this.model().paneForSource(this.mainSeries()));if(!s.sources.some((e=>"drawing"!==e.type||null!==r.clipboardLineToolOwnerSource(e.source.id))))return null;const n=Array.from(new Set(s.sources.filter(g.isLineToolClipboardData).map((e=>e.source.type))));await Promise.all(n.map((e=>(0,f.initLineTool)(e)))),this.beginUndoMacro(ji.format({title:s.title}));let a=0;const l=[],c=[];for(const t of s.sources)if("drawing"===t.type&&null!==r.clipboardLineToolOwnerSource(t.source.id)){const e=this.pasteLineTool(r,t);a<5&&((0,me.trackDrawingPasted)(e),a+=1),c.push(e),l.push(e)}else"study"===t.type&&t.source&&t.source.metaInfo&&this.checkIfFeatureAvailable(new d.StudyMetaInfo(t.source.metaInfo),[])&&l.push(this.pasteStudy(t,i?e:void 0));return c.length&&this.selectionMacro((e=>{e.clearSelection(),c.forEach((t=>{e.addSourceToSelection(t,null)}))})),this.endUndoMacro(),l}pasteLineTool(e,t,i,s){t.source.state.intervalsVisibilities=(0,Bt.mergeIntervalVisibilitiesDefaults)(t.source.state.intervalsVisibilities),(0,Bt.makeIntervalsVisibilitiesVisibleAtInterval)(t.source.state.intervalsVisibilities,p.Interval.parse(this.model().mainSeries().interval()));const r=new et(this.model(),t,e,i,s);this._pushUndoCommand(r);const n=r.source();return r.needCopyToOtherCharts()&&this._model().copyToOtherCharts([n],!0),this.selectionMacro((e=>{e.clearSelection(),e.addSourceToSelection(n,null)})),n}pasteStudy(e,t){const i=new ht(this.model(),e,null==t?void 0:t.id());this._pushUndoCommand(i);const s=(0,o.ensureNotNull)(i.state()).id;return(0,hi.emit)("study_event",s,"paste_study"),(0,o.ensureNotNull)(this._model().dataSourceForId(s))}setPriceScaleCurrency(e,t){const i=new tt.SetPriceScaleCurrencyUndoCommand(e,t,this.chartWidget(),Ti);this._pushUndoCommand(i)}setPriceScaleUnit(e,t){const i=new it.SetPriceScaleUnitUndoCommand(e,t,this.chartWidget(),Ii);this._pushUndoCommand(i)}setSymbol(e,t){e.symbolSameAsResolved(t)||this._pushUndoCommand(new at(e,t,this.chartWidget()))}setResolution(e,t){e===this.mainSeries()&&(t=e.getSupportedResolution(t)),p.Interval.isEqual(e.interval(),t)||this._pushUndoCommand(new oi(e,t,this.chartWidget()))}chartLoadTheme(e,t,i){const s=new ri(this.model(),e,t);i?s.redo():this._pushUndoCommand(s)}isJustClonedChart(){return this._chartWidget.isJustClonedChart()}isMultipleLayout(){
return this._chartWidget.isMultipleLayout()}addPaneStretchFactorUndoCommand(e,t,i,s){const r=new dt(this.model(),e,t,i,s);this._pushUndoCommand(r)}paneForSource(e){return this.m_model.paneForSource(e)}destroy(){this.m_model.destroy()}moveSelectedToolsLeft(){return this._moveSelectedTools(2)}moveSelectedToolsUp(){return this._moveSelectedTools(0)}moveSelectedToolsRight(){return this._moveSelectedTools(3)}moveSelectedToolsDown(){return this._moveSelectedTools(1)}insertStudyWithoutCheck(e,t,i,s){return this._insertStudy(e,t,{},!1,[],void 0,void 0,void 0,void 0,null!=i?i:null,void 0,s)}saveLineToolState(e,t){this._pushUndoCommand(new R(this.m_model,[e],t))}resetScales(){this._model().stopTimeScaleAnimation(),this.beginUndoMacro(Hi),this.resetTimeScale();for(const e of this.m_model.panes()){for(const t of e.leftPriceScales())this.resetPriceScale(e,t);for(const t of e.rightPriceScales())this.resetPriceScale(e,t)}this.endUndoMacro(),this.m_model.recalculateAllPanes((0,ye.viewportChangeEvent)())}shareLineTools(e,t){}canCreateStudy(e){return this.model().chartApi().canCreateStudy(e)}studiesMetaData(){return this.m_model.studiesMetaData()}fullSourceId(e){return this._chartWidget.fullSourceId(e)}chartWidgetCollectionLock(){return this._chartWidget.chartWidgetCollection().lock}_isCountedStudy(e){throw new Error("Not implemented")}_mergeUnmergeSource(e,t){this.beginUndoMacro(t.text());const i=(0,o.ensureNotNull)(this._model().paneForSource(e)),s=new Set(i.sourcesByGroup().lineSources().filter((t=>t.ownerSource()===e)));this._model().lineToolsGroupModel().groups().filter((e=>{const t=e.lineTools().some((e=>s.has(e))),i=e.lineTools().some((e=>!s.has(e)));return t&&i})).forEach((e=>{this._pushUndoCommand(new B.ExcludeLineToolsFromGroupUndoCommand(this._model(),e,e.lineTools()))})),this._pushUndoCommand(t),this.endUndoMacro()}_insertStudy(e,t,i,s,r,n,a,l,c,h,d,u){const p=Gi.format({title:e.description});this.beginUndoMacro(p);const _=new mt(this.model(),e,t,i,s,r,n,a,l,c,h||null,u,p);this._pushUndoCommand(_);const m=_.insertedStudy();if(void 0!==d){const e=new gt.SetPriceScaleModeCommand(d,(0,o.ensureNotNull)(m.priceScale()),null,this.model());this._pushUndoCommand(e)}return this.endUndoMacro(),{study:m,startPromise:_.lastInsertionStartPromise()}}async _processSpecialLineToolsContents(e,t,i){0}_insertAfterOrBefore(e,t,i,s){const r=(0,o.ensureNotNull)(this._model().paneForSource(i));if(t.some((e=>(0,f.isLineTool)(e)&&this._model().paneForSource(e)!==r)))throw new Error("Cannot insert line tool after target on another pane");this.beginUndoMacro(e),t.forEach((e=>{(0,o.ensureNotNull)(this.model().paneForSource(e))!==r&&this.mergeToPane(e,r)}));const n=s();this._pushUndoCommand(n),this.emitEvent("changeZOrder",[t]),this.endUndoMacro()}_sendBackOrBringForward(e,t,i){const s=new Map;t.forEach((e=>{const t=(0,o.ensureNotNull)(this._model().paneForSource(e)),i=s.get(t)||[];i.push(e),s.set(t,i)})),this.beginUndoMacro(e),s.forEach(((e,t)=>{this._pushUndoCommand(i(t,e))})),this.endUndoMacro(),this.emitEvent("changeZOrder",[t])}
_moveSelectedTools(e){const t=this.model().selection().lineDataSources();if(0===t.length)return!1;if((0,De.lockDrawings)().value())return!0;const i=this.timeScale().visibleBarsStrictRange();if(null===i)return!1;const s=function(e){const t=new Map;for(const i of e){const e=i.ownerSource();if(null===e)continue;let s=t.get(e);if(void 0===s){const r=e.priceScale(),n=e.priceStep(),o=e.firstValue();if(null===r||null===n||null===o)continue;if(null===r.priceRange())continue;s={sources:[],priceScale:r,priceStep:n,startPrice:i.points()[0].price,firstValue:o},t.set(e,s)}s.sources.push(i)}return t}(t);if(0===s.size)return!1;this.beginUndoMacro(Ci,Xi);const r=i.firstBar(),n=this.timeScale().indexToCoordinate(r),o=r+(3===e?1:2===e?-1:0),l=this.timeScale().indexToCoordinate(o);return De.isDirectionalMovementActive.setValue(!0),s.forEach((t=>{const{startPrice:i,priceStep:s,priceScale:c,firstValue:h}=t,d=i+(0===e?s:1===e?-s:0),u=c.priceToCoordinate(i,h),p=c.priceToCoordinate(d,h),_={logical:{index:r,price:i},screen:new a.Point(n,u)},m={logical:{index:o,price:d},screen:new a.Point(l,p)};this.startMovingSources(t.sources,_,null),this.moveSources(m),this.endMovingSource(!1,!0)})),De.isDirectionalMovementActive.setValue(!1),this.endUndoMacro(),!0}_restoreStudyFactoryDefaults(e){const t=new Vt(this.m_model,e);this._pushUndoCommand(t)}_restoreLineToolFactoryDefaults(e){this.beginUndoMacro(Pi,Xi),this.saveLineToolState(e,Pi);const t=new Dt(this.m_model,e.properties(),Pi);this._pushUndoCommand(t),this.saveLineToolState(e,Pi),this.endUndoMacro(),this.model().updateSource(e)}_removeAllDrawingToolsImpl(e){this.selectionMacro((()=>{this.lineBeingCreated()&&this.cancelCreatingLine();this.dataSources().filter(f.isLineTool).filter((e=>e.isActualSymbol()&&e.isUserDeletable())).filter((t=>!e||e===t.toolname)).forEach((e=>this.removeSource(e,!1)))}),!0)}_removeAllStudiesImpl(){const e=this.dataSources(),t=e.filter(C.isStudy).filter((e=>!e.isChildStudy()&&e.removeByRemoveAllStudies())),i=e.filter(C.isStudyStub);t.concat(i).forEach((e=>this.removeSource(e,!1)))}}},20585:(e,t,i)=>{"use strict";var s=i(50151).assert,r=i(31281).ChartModelBase,n=i(92249).isLineTool,o=i(30255).Watermark,a=i(49483).CheckMobile,l=i(91280).InvalidationLevel,c=i(57898).Delegate;const{globalChangeEvent:h,sourceChangeEvent:d}=i(28558);var u=i(28853),p=u.isStudy,_=u.isFundamentalStudy,m=i(88348),g=i(90565).MainSeriesScaleRatioProperty,f=i(29541).scaleRatio,v=i(97340).StudyInserter,S=i(83407).dateFormatProperty,y=i(16164).timeHoursFormatProperty,b=i(76422),w=i(65379).StudyColorRotatorFactory,C=i(14483),P=i(28640).AppliedTimeFrame;C.enabled("fix_left_edge");class x extends r{constructor(e,t,i,s,r,n,a,l,c,h){super(e,t,i,s,r,n,a,l,c,h);var d=this;this._mainSeriesScaleRatioProperty=new g(this),this.m_mainSeries.dataEvents().completed().subscribe(this,function(){this._scrollingState&&this.gotoTime()}.bind(this)),this.m_mainSeries.onIntervalChanged().subscribe(this,(function(){this._recalcVRStudiesParams.oldStartVisibleIndex=NaN,this._recalcVRStudiesParams.oldEndVisibleIndex=NaN})),
this._readOnly||(this.m_mainSeries.properties().addChild("priceAxisProperties",this.m_mainSeries.priceScale().properties()),this._properties.paneProperties.legendProperties.showStudyTitles.listeners().subscribe(this,(function(e){e.value()||d._properties.paneProperties.legendProperties.showStudyArguments.setValue(!1)}))),this._watermarkSource=this._options.watermarkEnabled?new o(this,this.m_mainSeries):null,m.hideAllDrawings().subscribe(this,this._onDrawingsVisibilityChanged),m.hideAllIndicators().subscribe(this,this._onIndicatorsVisibilityChanged),this._properties.scalesProperties.listeners().subscribe(this,x.prototype.fullUpdate),this._studyShiftColorStartOffset=void 0,S.subscribe(this,this._updateDateTimeFormatter),y.subscribe(this,this._updateDateTimeFormatter),this.mainSeries().properties().interval.subscribe(this,this._updateDateTimeFormatter),this._updateDateTimeFormatter(),this._studyColorRotatorFactory=new w(this),this._dataSourceCollectionChanged.subscribe(this,this._updateShowLegendProperty.bind(this)),this._properties.paneProperties.legendProperties.showLegend.subscribe(this,this._updateShowLegendProperty),this._appliedTimeFrame=new P(this),this.mainSeries().onTimeFrameApplied().subscribe(this,(function(e){var t=null!==e?{res:this.mainSeries().interval(),val:e}:null;this.appliedTimeFrame().setValue(t)}))}applyPreferences(e){for(var t in e)void 0!==this._properties[t]&&"m_mainSeries"!==this._properties[t]&&this._properties[t].mergeAndFire(e[t]);void 0!==e.timeScale&&(this._timeScale.defaultRightOffset().setValue(e.timeScale.defaultRightOffset),this._timeScale.defaultRightOffsetPercentage().setValue(e.timeScale.defaultRightOffsetPercentage),this._timeScale.usePercentageRightOffset().setValue(e.timeScale.usePercentageRightOffset)),this._properties.saveDefaults(),this.m_mainSeries.applyPreferences(e.mainSeries),this.sessions().applyPreferences(e.sessions),this.recalculateAllPanes(h()),this.fullUpdate()}timezone(){return this._properties.timezone.value()}initConnection(){this._chartApi.switchTimezone(this.timezone())}updatePane(e){var t=this._paneInvalidationMask(e);this.invalidate(t)}studiesMetaData(){return this._studiesMetaData}studyVersioning(){return this._studyVersioning}startNotStartedStudies(){if(!this.m_mainSeries.isStarted())throw new Error("Cannot start studies: main series is not started");for(var e=this.dataSources(),t=0;t0),n?{left:0,right:1,totallySlots:i}:{left:1,right:0,totallySlots:i}}return{left:e,right:t,totallySlots:e+t}}setPriceAutoScale(e,t,i){e.setPriceAutoScale(t,i),this.invalidate(this._paneInvalidationMask(e,l.Light))}updateScales(e,t){this._undoModel._chartWidget._updateScalesActions()}mainSeriesScaleRatioProperty(){return this._mainSeriesScaleRatioProperty}mainSeriesScaleRatioPropertyOnChanged(){this._mainSeriesScaleRatioProperty.listeners().fire(this._mainSeriesScaleRatioProperty)}mainSeriesScaleRatio(){return f(this._timeScale,this.m_mainSeries.priceScale())}setMainSeriesScaleRatio(e){this.paneForSource(this.m_mainSeries).applyPriceScaleRatio(this.m_mainSeries.priceScale(),e)}restoreFactoryDefaults(e){e.restoreFactoryDefaults(),this.recalcVisibleRangeStudies(!0)}orderedDataSources(e){var t=[];t.push(this.m_crossHairSource);for(var i=0;ithis.removeSource(e))),Array.from(this._customSourcesMap.keys()).forEach(this._removeCustomSource,this),s(0===this._topmostCustomSources.length),
s(0===this._fgCustomSources.length),s(0===this._bgCustomSources.length),s(0===this._allCustomSources.length),s(0===this._customSourcesMap.size);for(var e=0;e{"use strict";var s=i(29764).makeFont,r=i(29764).parseFont,n=i(59224).getLogger;const{drawPoly:o}=i(68441);var a=n("Model.ChartTradingUtils"),l={_fontHeightCache:{},_parsedColorCache:{},_parseColor:function(e){if(this._parsedColorCache[e])return this._parsedColorCache[e];var t=document.createElement("div");t.style.color=e;var i=t.style.color.match(/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i)||t.style.color.match(/^rgba\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d*\.?\d+)\s*\)$/i),s={r:i[1],g:i[2],b:i[3],a:i[4]||"1"};return this._parsedColorCache[e]=s,s},getColorFromProperties:function(e,t){var i=1-t.value()/100,s=this._parseColor(e.value());return"rgba("+s.r+","+s.g+","+s.b+","+i+")"},setColorToProperties:function(e,t,i){var s=this._parseColor(e);t.setValue("rgb("+s.r+","+s.g+","+s.b+")");var r=100*(1-s.a);i.setValue(Math.max(0,Math.min(r,100)))},getFontFromProperties:function(e,t,i,r){return s(t.value(),e.value(),r.value()?"italic":"",i.value()?"bold":"")},setFontToProperties:function(e,t,i,s,n){var o=r(e);null!==o?(o.family.length>0&&t.setValue(o.family),i.setValue(o.size),s.setValue(o.bold),n.setValue(o.italic)):a.logError("Invalid font: "+e)},fontHeight:function(e){if(!this._fontHeightCache[e]){var t=document.createElement("span");t.appendChild(document.createTextNode("height")),document.body.appendChild(t),t.style.cssText="font: "+e+"; white-space: nowrap; display: inline;";var i=t.offsetHeight;document.body.removeChild(t),this._fontHeightCache[e]=Math.ceil(i)}return this._fontHeightCache[e]},drawPolyHoverOrPress:function(e,t,i,s){s?(e.save(),e.fillStyle="rgba(0, 0, 0, 0.15)",o(e,t,!0),e.restore()):i&&(e.save(),e.fillStyle="rgba(0, 0, 0, 0.1)",o(e,t,!0),e.restore())},repaint:function(e){e.lightUpdate()},roundToMinTick:function(e,t){var i=1/e.mainSource().base();return i*Math.round(t/i)}};e.exports=l},94792:(e,t,i)=>{"use strict";var s=i(36298).TranslatedString,r=i(88275).doAnimate,n=i(89858).ChartUndoModelBase,o=(i(46100).saveDefaultProperties,i(62591).UndoCommand,
i(37846).ApplyLineToolTemplateUndoCommand),a=i(53051).SetPriceScaleSelectionStrategyCommand,l=i(610).SetScaleRatioPropertiesCommand,c=i(51768).trackEvent,h=i(4505).RestoreDefaultsPreferencesUndoCommand,d=i(95367).SetPriceScaleModeCommand,u=i(67521).PriceScaleChangeUndoCommand,p=new s("move left",i.tf(null,void 0,i(15086))),_=new s("move right",i.tf(null,void 0,i(61711))),m=new s("toggle auto scale",i.tf(null,void 0,i(63060))),g=new s("toggle lock scale",i.tf(null,void 0,i(21203))),f=new s("toggle regular scale",i.tf(null,void 0,i(33714))),v=new s("toggle indexed to 100 scale",i.tf(null,void 0,i(98860))),S=new s("toggle percentage scale",i.tf(null,void 0,i(68642))),y=new s("toggle log scale",i.tf(null,void 0,i(60166))),b=new s("invert scale",i.tf(null,void 0,i(94245))),w=new s("remove pane",i.tf(null,void 0,i(47637))),C=(new s("apply all chart properties",i.tf(null,void 0,i(64034))),new s("set price scale selection strategy to {title}",i.tf(null,void 0,i(69485))));t.ChartUndoModel=class extends n{constructor(e,t,i,s,r,n,o,a,l,c,h){super(e,t,i,s,r,n,o,a,l,c,h),this.beginUndoMacro=(e,t)=>{var i=n.beginUndoMacro(e);return i.setCustomFlag("doesnt_affect_save",t),i},this.endUndoMacro=n.endUndoMacro.bind(n),this.createUndoCheckpoint=n.createUndoCheckpoint.bind(n),this.undoToCheckpoint=n.undoToCheckpoint.bind(n)}version(){return this.m_model.version()}createPane(e){return this.m_model.createPane(e)}restart(){this.m_model.restart()}disconnect(){this.m_model.disconnect()}studyVersioning(){return this.m_model.studyVersioning()}chartModel(){return this._model()}_model(){return this.m_model}pushUndoCommand(e){this._pushUndoCommand(e)}_pushUndoCommand(e){this._undoHistory.pushUndoCommand(e)}startScrollPrice(e,t,i){t.isAutoScale()||(this._initialPriceScrollState=t.state(),this._initialPriceScrollPos=i,this.chartModel().startScrollPrice(e,t,i))}scrollPriceTo(e,t,i){t.isAutoScale()||(this._initialPriceScrollPos&&Math.abs(this._initialPriceScrollPos-i)>20&&(this.pushUndoCommand(new u(this.m_model,e,t,this._initialPriceScrollState)),delete this._initialPriceScrollState,delete this._initialPriceScrollPos),this.chartModel().scrollPriceTo(e,t,i))}endScrollPrice(e,t){t.isAutoScale()||(delete this._initialPriceScrollState,delete this._initialPriceScrollPos,this.chartModel().endScrollPrice(e,t))}setPriceAutoScale(e,t,i){this.pushUndoCommand(new u(this.m_model,e,t,t.state())),this.chartModel().setPriceAutoScale(e,t,i)}setWidth(e){this.m_model.setWidth(e)}setPaneHeight(e,t){this.m_model.setPaneHeight(e,t)}gridSource(){return this.m_model.gridSource()}watermarkSource(){return this.m_model.watermarkSource()}publishedChartsTimelineSource(){return this.m_model.publishedChartsTimelineSource()}crossHairSource(){return this.m_model.crossHairSource()}model(){return this.m_model}chartWidget(){return this._chartWidget}mainSeries(){return this.m_model.m_mainSeries}mainSeriesScaleRatioProperty(){return this.m_model.mainSeriesScaleRatioProperty()}timeScale(){return this.m_model.timeScale()}selectionMacro(e,t){return this.m_model.selectionMacro(e,t)}
setHoveredSource(e,t){this.m_model.setHoveredSource(e,t)}selection(){return this.m_model.selection()}onSelectedSourceChanged(){return this.m_model.onSelectedSourceChanged()}activeStrategySource(){return this.m_model.activeStrategySource()}invalidate(e){this.m_model.invalidate(e)}setCurrentPosition(e,t,i,s){this.m_model.setCurrentPosition(e,t,i,s)}setAndSaveCurrentPosition(e,t,i,s){this.m_model.setAndSaveCurrentPosition(e,t,i,s)}setProperties(e,t,i){var s=this;this.beginUndoMacro(i),this.m_model.selectionMacro((function(){for(var r=0;r{"use strict";var s;i.d(t,{ColorType:()=>s}),function(e){e.Solid="solid",e.Gradient="gradient"}(s||(s={}))},42226:(e,t,i)=>{"use strict";i.d(t,{currencyUnitVisibilityOptions:()=>a,currencyUnitVisibilityProperty:()=>o,migrateShowCurrencyAndShowUnitProperties:()=>h,restoreCurrencyUnitVisibilitySettingsValue:()=>l});var s=i(29542),r=i(56840),n=i.n(r);const{property:o,availableValues:a,restoreDefaultValue:l}=(0,s.createVisibilityController)("PriceAxisCurrencyAndUnit.visibility");let c=!1;function h(e,t){c||(c=!0,void 0===n().getValue("PriceAxisCurrencyAndUnit.visibility")&&o().setValue(e||t?"alwaysOn":"alwaysOff"))}},39262:(e,t,i)=>{"use strict";i.d(t,{sourceNewCurrencyOnPinningToPriceScale:()=>r});var s=i(18611);function r(e,t,i,r){let n=null;if(i.currencyConversionEnabled()&&(0,s.isActingAsSymbolSource)(e)){const s=i.availableCurrencies(),o=t.currency(s),a=e.currency();null!==o&&null!==o.selectedCurrency&&!o.allCurrenciesAreOriginal&&o.selectedCurrency!==a&&(r&&null===a||null!==a&&s.convertible(a))&&(n=o.selectedCurrency)}return n}},15742:(e,t,i)=>{"use strict";i.d(t,{CustomSourceBase:()=>s});class s{constructor(e,t){this._id=e,this._model=t}id(){return this._id}isHoveredEnabled(){return!0}isSelectionEnabled(){return!1}priceScale(){return null}paneViews(e){return[]}labelPaneViews(e){return[]}priceAxisViews(e,t){return[]}updateViewsForPane(e,t){e.containsMainSeries()&&this.updateAllViews(t)}}},53588:(e,t,i)=>{"use strict";i.d(t,{isLineToolState:()=>o,isMainSeriesState:()=>r,isStudyLineToolState:()=>a,isStudyState:()=>n});var s=i(15367);function r(e){return"MainSeries"===e.type}function n(e){return Boolean(e.type)&&e.type.toLowerCase().startsWith("study")}function o(e){return Boolean(e.type)&&(0,s.isLineToolName)(e.type)}function a(e){return Boolean(e.type)&&(0,s.isStudyLineToolName)(e.type)}},14292:(e,t,i)=>{"use strict";i.d(t,{DataSource:()=>l,getTranslatedStringForSource:()=>a});var s=i(36298),r=i(36174),n=i(57898),o=i(97145);function a(e,t){return new s.TranslatedString(t.name(),t.title(e))}class l{constructor(e){this._isDestroyed=!1,this._hasAlert=new o.WatchedValue(!1),this._alertCreationAvailable=new o.WatchedValue(!1),this._zorder=0,this._priceScale=null,this._ownerSource=null,this._userEditEnabled=!0,this._priceScaleChanged=new n.Delegate,this._isSelectionEnabled=!0,this._instanceId=(0,r.randomHashN)(6),this._ownerSourceChanged=new n.Delegate,
this._zOrderChanged=new n.Delegate,this._id=null!=e?e:(0,r.randomHashN)(6)}destroy(){this._isDestroyed=!0}id(){return this._id}instanceId(){return this._instanceId}preferNoScale(){return!1}setId(e){this._id=e}zorder(){return this._zorder}setZorder(e){"number"==typeof e&&this._zorder!==e&&(this._zorder=e,this._zOrderChanged.fire(e))}preferredZOrder(){return null}isSpeciallyZOrderedSource(){return!1}title(e){return this.name()}priceScale(){return this._priceScale}setPriceScale(e){this._priceScale=e,this._priceScaleChanged.fire(e)}priceScaleChanged(){return this._priceScaleChanged}ownerSource(){return this._ownerSource}setOwnerSource(e){const t=this._ownerSource;this._ownerSource=e,this._ownerSourceChanged.fire(t,e)}ownerSourceChanged(){return this._ownerSourceChanged}zOrderChanged(){return this._zOrderChanged}isSavedInChart(e){return!0}isSavedInStudyTemplates(){return!0}isRemovedByStudyTemplates(){return!0}hasContextMenu(){return!0}showInObjectTree(){return!0}setUserEditEnabled(e){this._userEditEnabled=e}userEditEnabled(){return this._userEditEnabled}canBeHidden(){return this.userEditEnabled()}isUserDeletable(){return this.userEditEnabled()}properties(){return null}isVisible(){return this.properties().visible.value()}dataWindowView(){return null}priceAxisViews(e,t){return null}timeAxisViews(){return null}updateAllViews(e){}paneViews(e){return null}labelPaneViews(){return null}isFailed(){return!1}isLoading(){return!1}isPhantom(){return!1}isChildStudy(){return!1}hasChildren(){return!1}canHaveChildren(){return!1}onClickOutside(e){}getSourceIcon(){return null}state(e){return null}doesMovingAffectsUndo(){return!0}isMultiPaneAvailable(){return!1}isMultiPaneEnabled(){return!1}copiable(){return!1}cloneable(){return!1}movable(){return!1}isIncludedInAutoScale(){return!1}isHoveredEnabled(){return this.isSelectionEnabled()}showOnTopOnHovering(){return!0}isSelectionEnabled(){return this._isSelectionEnabled}setSelectionEnabled(e){this._isSelectionEnabled=e}firstValue(){return null}priceRange(e,t){return null}autoScaleInfo(e,t){return{range:this.priceRange(e,t)}}stateForAlert(){return null}canHasAlert(){return!1}hasAlert(){return this._hasAlert.readonly()}alertCreationAvailable(){return this._alertCreationAvailable.readonly()}hasStateForAlert(){return!1}idForAlert(){return this._id}_getAlertCreationAvailable(){return!1}_updateAlertCreationAvailable(){0}}},93835:(e,t,i)=>{"use strict";i.d(t,{DataWindowItem:()=>s,DataWindowView:()=>r});class s{constructor(e,t,i,s=!1){this._visible=!0,this._id=e,this._title=t,this._value=i,this._unimportant=s}id(){return this._id}title(){return this._title}setTitle(e){this._title=e}text(){return this._value}value(){return this._value}setValue(e){this._value=e}visible(){return this._visible}setVisible(e){this._visible=e}color(){return this._color}setColor(e){this._color=e}unimportant(){return this._unimportant}}class r{constructor(){this._items=[],this._header="",this._title=""}header(){return this._header}title(){return this._title}items(){return this._items}update(){}}},83407:(e,t,i)=>{"use strict"
;i.d(t,{dateFormatProperty:()=>l,restoreDateFormatSettingsValue:()=>c});var s=i(56840),r=i(59680),n=i(15879);const o="date_format";function a(){return s.getValue(o,(0,n.defaultDateFormat)())}const l=(0,r.createPrimitiveProperty)(a());function c(){l.setValue((0,n.defaultDateFormat)()),s.remove(o)}s.onSync.subscribe(null,(()=>l.setValue(a()))),l.subscribe(null,(()=>s.setValue(o,l.value())))},46100:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DefaultProperty:()=>p,createDefaultsState:()=>h,saveDefaultProperties:()=>u});var s=i(27788),r=i(14314),n=i(40405),o=i(85804),a=i(88640),l=i(57898);function c(e,t){const i=(0,s.default)(e);return t.forEach((e=>(0,n.default)(i,e.split(".")))),i}function h(e,t,i,n){const a=e?o.defaults:o.factoryDefaults,l=t.startsWith("study_")?(0,s.default)(a("study")):{};let h=(0,s.default)(a(t,n));return t.startsWith("study_")&&h.inputs&&delete h.inputs.symbol,"linetoolicon"===t&&e&&(h.icon=(0,o.defaults)(t).icon),"linetooemoji"===t&&e&&(h.emoji=(0,o.defaults)(t).emoji),"linetoolsticker"===t&&e&&(h.sticker=(0,o.defaults)(t).sticker),h=c(h,i),(0,r.default)(l,h),l}let d=!1;function u(e){d=e}class p extends a.default{constructor(e,t,i,s){super(function(e,t,i,s){let n;return void 0===s&&(s=!0),i?n=t:(n=h(s,e,[],null),t&&(0,r.default)(n,t)),n}(e,t,i,s)),this._exclusions=[],this._restoreFactoryDefaultsEvent=new l.Delegate,this._defaultName=e,this._useUserPreferences=null==s||s,this.listeners().subscribe(this,p.prototype.onPropertyChanged),this._restoreFactoryDefaultsEvent=new l.Delegate}applyTemplate(e,t){this.mergePreferences((0,r.default)((0,s.default)(t),e))}preferences(){return this.state(this._exclusions)}mergePreferences(e){this.mergeAndFire(c(e,this._exclusions))}addExclusion(e){this._exclusions.indexOf(e)<0&&this._exclusions.push(e)}removeExclusion(e){const t=this._exclusions.indexOf(e);-1!==t&&this._exclusions.splice(t,1)}restoreFactoryDefaults(){const e=h(!1,this._defaultName,this._exclusions,null);this.mergeAndFire(e),this._defaultName.startsWith("study_")&&!this._defaultName.startsWith("study_VbPFixed")||(0,o.saveDefaults)(this._defaultName,void 0),this._restoreFactoryDefaultsEvent.fire()}onRestoreFactoryDefaults(){return this._restoreFactoryDefaultsEvent}onPropertyChanged(e,t){this._exclusions.includes(t)||!d||this._defaultName.startsWith("study_")&&!this._defaultName.startsWith("study_VbPFixed")||this.saveDefaults()}saveDefaults(){this._useUserPreferences&&(0,o.saveDefaults)(this._defaultName,this.preferences())}clone(e){const t=new p(this._defaultName,this.state(),null==e?void 0:e.replaceByState,this._useUserPreferences);for(let e=0;e{"use strict";var s=i(67980).PlDisplay;const{getHexColorByName:r}=i(33013),{generateColor:n}=i(87095)
;var o=i(67980).TradedGroupHorizontalAlignment,a=i(88732),l=i(90095).LineToolPitchforkStyle,c=i(99987).LineToolBarsPatternMode,h=i(72877),d=h.LineStudyPlotStyle,u=h.STUDYPLOTDISPLAYTARGET,p=i(42609),_=i(74304).PriceAxisLastValueMode,m=i(9482).StoriesTimeLineItemType,g=i(36147).MagnetMode,f=i(73436).LineEnd,v=i(93613).ColorType,S=i(62615).RangeBarStyle;const{LineStyle:y}=i(95586);var b=i(92291).VolumeFootprintTypeValues,w=i(9155).StatsPosition,C=i(16776).sessionsPreferencesDefault,P=i(81580).axisLabelBackgroundColor;const{LINESTYLE_SOLID:x,LINESTYLE_DOTTED:T,LINESTYLE_DASHED:I}=i(79849);var M=i(59224).getLogger("Chart.Defaults");const A=r("color-black"),L=r("color-white"),k=n(L,75),D=r("color-tv-blue-50"),E=r("color-tv-blue-500"),V=n(E,30),B=n(E,70),R=n(E,72),N=n(E,75),O=n(E,80),F=r("color-tv-blue-600"),W=r("color-deep-blue-200"),H=r("color-deep-blue-300"),z=r("color-deep-blue-500"),U=n(z,80),j=r("color-sky-blue-500"),G=n(j,80),q=r("color-sky-blue-700"),$=n(q,30),Y=r("color-youtube"),K=r("color-ripe-red-200"),Z=r("color-ripe-red-300"),X=r("color-ripe-red-400"),J=n(X,95),Q=r("color-ripe-red-500"),ee=n(Q,70),te=n(Q,80),ie=n(Q,72),se=n(Q,95),re=r("color-ripe-red-600"),ne=r("color-grapes-purple-500"),oe=n(ne,100),ae=n(ne,80),le=n(ne,30),ce=r("color-berry-pink-500"),he=n(ce,80),de=r("color-minty-green-100"),ue=r("color-minty-green-500"),pe=n(ue,80),_e=n(ue,72),me=n(ue,95),ge=r("color-iguana-green-300"),fe=r("color-iguana-green-500"),ve=n(fe,80),Se=r("color-tan-orange-300"),ye=r("color-tan-orange-500"),be=n(ye,80),we=r("color-tan-orange-600"),Ce=r("color-tan-orange-700"),Pe=r("color-cold-gray-150"),xe=r("color-cold-gray-300"),Te=r("color-cold-gray-400"),Ie=r("color-cold-gray-450"),Me=r("color-cold-gray-500"),Ae=r("color-cold-gray-800"),Le=n(Ae,94),ke=n(Ae,100),De=r("color-cold-gray-900"),Ee=r("color-cold-gray-750"),Ve=r("color-forest-green-300"),Be=n(Ve,95);var Re=function(e){var t=function(e,t){return{color:e,visible:t}},i=function(e,t,i){return{coeff:e,color:t,visible:i}},r=function(e,t,i,s,r){return{coeff:e,color:t,visible:i,linestyle:void 0===s?x:s,linewidth:void 0===r?2:r}},h=function(e,t,i){return{color:e,width:void 0===i?2:i,visible:t}},M=function(e,t,i,s,r){return{color:e,visible:t,width:i,x:s,y:r}},Ae=function(e,t,i,s,r,n){return{coeff1:e,coeff2:t,color:i,visible:s,linestyle:void 0===r?x:r,linewidth:void 0===n?2:n}};if(void 0===TradingView.defaultProperties){var Re;switch(window.locale){case"ar_AE":Re="Asia/Dubai";break;case"au":Re="Australia/Sydney";break;case"br":Re="America/Sao_Paulo";break;case"ca":Re="America/Toronto";break;case"de_DE":case"it":Re="Europe/Berlin";break;case"es":Re="Europe/Madrid";break;case"fa_IR":Re="Asia/Tehran";break;case"fr":case"sv_SE":Re="Europe/Paris";break;case"he_IL":case"tr":Re="Europe/Athens";break;case"hu_HU":case"pl":Re="Europe/Warsaw";break;case"id":case"th_TH":case"vi_VN":Re="Asia/Bangkok";break;case"in":Re="Asia/Kolkata";break;case"ja":case"kr":Re="Asia/Tokyo";break;case"ms_MY":Re="Asia/Singapore";break;case"ru":Re="Europe/Moscow";break;case"uk":Re="Europe/London";break
;case"zh_CN":case"zh_TW":Re="Asia/Shanghai";break;default:Re="Etc/UTC"}TradingView.defaultProperties={chartproperties:{timezone:Re,priceScaleSelectionStrategyName:"auto",paneProperties:{backgroundType:v.Solid,background:L,backgroundGradientStartColor:L,backgroundGradientEndColor:L,gridLinesMode:"both",vertGridProperties:{color:Le,style:x},horzGridProperties:{color:Le,style:x},crossHairProperties:{color:Te,style:I,transparency:0,width:1},topMargin:10,bottomMargin:8,axisProperties:{autoScale:!0,autoScaleDisabled:!1,lockScale:!1,percentage:!1,percentageDisabled:!1,indexedTo100:!1,log:!1,logDisabled:!1,alignLabels:!0,isInverted:!1},legendProperties:{showStudyArguments:!0,showStudyTitles:!0,showStudyValues:!0,showSeriesTitle:!0,showSeriesOHLC:!0,showLegend:!0,showLastDayChange:!1,showBarChange:!0,showVolume:!1,showBackground:!0,showPriceSource:!0,backgroundTransparency:50,showLogo:!0},separatorColor:Pe},scalesProperties:{backgroundColor:L,lineColor:ke,textColor:De,fontSize:12,scaleSeriesOnly:!1,showSeriesLastValue:!0,seriesLastValueMode:_.LastValueAccordingToScale,showSeriesPrevCloseValue:!1,showStudyLastValue:!0,showSymbolLabels:!1,showStudyPlotLabels:!1,showBidAskLabels:!1,showPrePostMarketPriceLabel:!0,showFundamentalNameLabel:!1,showFundamentalLastValue:!0,barSpacing:p.DEFAULT_BAR_SPACING,axisHighlightColor:N,axisLineToolLabelBackgroundColorCommon:P.common,axisLineToolLabelBackgroundColorActive:P.active,showPriceScaleCrosshairLabel:!0,showTimeScaleCrosshairLabel:!0,crosshairLabelBgColorLight:De,crosshairLabelBgColorDark:Ee},mainSeriesProperties:{style:a.STYLE_CANDLES,esdShowDividends:!0,esdShowSplits:!0,esdShowEarnings:!0,esdShowBreaks:!1,esdFlagSize:2,showContinuousContractSwitches:!0,showContinuousContractSwitchesBreaks:!1,showFuturesContractExpiration:!0,showLastNews:!0,showCountdown:!0,bidAsk:{visible:!1,lineStyle:T,lineWidth:1,bidLineColor:E,askLineColor:X},prePostMarket:{visible:!0,lineStyle:T,lineWidth:1,preMarketColor:we,postMarketColor:E},highLowAvgPrice:{highLowPriceLinesVisible:!1,highLowPriceLabelsVisible:!1,averageClosePriceLineVisible:!1,averageClosePriceLabelVisible:!1,highLowPriceLinesColor:"",highLowPriceLinesWidth:1,averagePriceLineColor:"",averagePriceLineWidth:1},visible:!0,showPriceLine:!0,priceLineWidth:1,priceLineColor:"",baseLineColor:xe,showPrevClosePriceLine:!1,prevClosePriceLineWidth:1,prevClosePriceLineColor:"#555555",minTick:"default",dividendsAdjustment:void 0,backAdjustment:!1,settlementAsClose:!0,sessionId:"regular",sessVis:!1,useVolumeWeightBars:!1,statusViewStyle:{fontSize:16,showExchange:!0,showInterval:!0,symbolTextSource:"description"},candleStyle:{upColor:ue,downColor:Q,drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:ue,borderDownColor:Q,wickColor:"#737375",wickUpColor:ue,wickDownColor:Q,barColorsOnPrevClose:!1,drawBody:!0},hollowCandleStyle:{upColor:ue,downColor:Q,drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:ue,borderDownColor:Q,wickColor:"#737375",wickUpColor:ue,wickDownColor:Q,drawBody:!0},haStyle:{upColor:ue,downColor:Q,drawWick:!0,drawBorder:!0,
borderColor:"#378658",borderUpColor:ue,borderDownColor:Q,wickColor:"#737375",wickUpColor:ue,wickDownColor:Q,showRealLastPrice:!1,barColorsOnPrevClose:!1,inputs:{},inputInfo:{},drawBody:!0},barStyle:{upColor:ue,downColor:Q,barColorsOnPrevClose:!1,dontDrawOpen:!1,thinBars:!0},hiloStyle:{color:E,showBorders:!0,borderColor:E,showLabels:!0,labelColor:E,drawBody:!0},columnStyle:{upColor:n(ue,50),downColor:n(Q,50),barColorsOnPrevClose:!0,priceSource:"close"},lineStyle:{color:E,linestyle:x,linewidth:2,priceSource:"close"},lineWithMarkersStyle:{color:E,linestyle:x,linewidth:2,priceSource:"close"},steplineStyle:{color:E,linestyle:x,linewidth:2,priceSource:"close"},areaStyle:{color1:R,color2:E,linecolor:E,linestyle:x,linewidth:2,priceSource:"close",transparency:100},hlcAreaStyle:{highLineColor:ue,highLineStyle:x,highLineWidth:2,lowLineColor:Q,lowLineStyle:x,lowLineWidth:2,closeLineColor:Ie,closeLineStyle:x,closeLineWidth:2,highCloseFillColor:pe,closeLowFillColor:te},priceAxisProperties:{autoScale:!0,autoScaleDisabled:!1,lockScale:!1,percentage:!1,percentageDisabled:!1,indexedTo100:!1,log:!1,logDisabled:!1,isInverted:!1,alignLabels:!0},renkoStyle:{upColor:ue,downColor:Q,borderUpColor:ue,borderDownColor:Q,upColorProjection:"#a9dcc3",downColorProjection:"#f5a6ae",borderUpColorProjection:"#a9dcc3",borderDownColorProjection:"#f5a6ae",wickUpColor:ue,wickDownColor:Q,inputs:{source:"close",sources:"Close",boxSize:3,style:"ATR",atrLength:14,wicks:!0},inputInfo:{source:{name:"Source"},sources:{name:"Source"},boxSize:{name:"Box size"},style:{name:"Style"},atrLength:{name:"ATR length"},wicks:{name:"Wicks"}}},pbStyle:{upColor:ue,downColor:Q,borderUpColor:ue,borderDownColor:Q,upColorProjection:"#a9dcc3",downColorProjection:"#f5a6ae",borderUpColorProjection:"#a9dcc3",borderDownColorProjection:"#f5a6ae",inputs:{source:"close",lb:3},inputInfo:{source:{name:"Source"},lb:{name:"Number of line"}}},kagiStyle:{upColor:ue,downColor:Q,upColorProjection:"#a9dcc3",downColorProjection:"#f5a6ae",inputs:{source:"close",style:"ATR",atrLength:14,reversalAmount:1},inputInfo:{source:{name:"Source"},style:{name:"Style"},atrLength:{name:"ATR length"},reversalAmount:{name:"Reversal amount"}}},pnfStyle:{upColor:ue,downColor:Q,upColorProjection:"#a9dcc3",downColorProjection:"#f5a6ae",inputs:{sources:"Close",reversalAmount:3,boxSize:1,style:"ATR",atrLength:14,oneStepBackBuilding:!1},inputInfo:{sources:{name:"Source"},boxSize:{name:"Box size"},reversalAmount:{name:"Reversal amount"},style:{name:"Style"},atrLength:{name:"ATR length"},oneStepBackBuilding:{name:"One step back building"}}},baselineStyle:{baselineColor:Ie,topFillColor1:_e,topFillColor2:me,bottomFillColor1:se,bottomFillColor2:ie,topLineColor:ue,bottomLineColor:Q,topLineWidth:2,bottomLineWidth:2,priceSource:"close",transparency:50,baseLevelPercentage:50},rangeStyle:{barStyle:S.Bars,upColor:ue,downColor:Q,upColorProjection:"#a9dcc3",downColorProjection:"#f5a6ae",thinBars:!0,candlesUpColor:ue,candlesDownColor:Q,candlesBorderUpColor:ue,candlesBorderDownColor:Q,candlesWickUpColor:ue,candlesWickDownColor:Q,
inputs:{range:10,phantomBars:!1},inputInfo:{range:{name:"Range"},phantomBars:{name:"Phantom bars"}}},volFootprintStyle:{upColor:ue,downColor:Q,drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:ue,borderDownColor:Q,wickColor:"#737375",wickUpColor:ue,wickDownColor:Q,barColorsOnPrevClose:!1,drawBody:!0,deltaAdjust:!0,showSummary:!0,type:b.BuyAndSell,pointOfControl:!0,imbalanceHighlight:{buyColor:ue,sellColor:Q,visible:!0},stackedLevels:{visible:!0,count:3},inputs:{rowSize:"Auto",atrLength:14,imbalancePercent:300,ticksPerRow:100,showVA:!0,vaPercent:70}}},chartEventsSourceProperties:{visible:!0,futureOnly:!0,breaks:{color:"#555555",visible:!1,style:I,width:1}},tradingProperties:{showPositions:!0,positionPL:{visibility:!0,display:s.Money},bracketsPL:{visibility:!0,display:s.Money},showOrders:!0,showExecutions:!0,showExecutionsLabels:!1,showReverse:!0,horizontalAlignment:o.Right,extendLeft:!0,lineLength:5,lineWidth:1,lineStyle:x},editorFontsList:["Verdana","Courier New","Times New Roman","Arial"],volumePaneSize:"large"},sessions:C,drawings:{magnet:!1,magnetMode:g.WeakMagnet,stayInDrawingMode:!1,drawOnAllCharts:!0,drawOnAllChartsMode:1},linetoolorder:{extendLeft:"inherit",lineLength:"inherit",lineLengthUnit:"percentage",lineColor:Y,lineActiveBuyColor:"#4094e8",lineInactiveBuyColor:"rgba(64, 148, 232, 0.5)",lineActiveSellColor:"#e75656",lineInactiveSellColor:"rgba(231, 86, 86, 0.5)",lineStyle:"inherit",lineWidth:"inherit",bodyBorderActiveBuyColor:"#4094e8",bodyBorderInactiveBuyColor:"rgba(64, 148, 232, 0.5)",bodyBorderActiveSellColor:"#e75656",bodyBorderInactiveSellColor:"rgba(231, 86, 86, 0.5)",bodyBackgroundColor:k,bodyBackgroundTransparency:25,bodyTextInactiveLimitColor:"rgba(38, 140, 2, 0.5)",bodyTextActiveLimitColor:"#268c02",bodyTextInactiveStopColor:"rgba(231, 86, 86, 0.5)",bodyTextActiveStopColor:"#e75656",bodyTextInactiveBuyColor:"rgba(64, 148, 232, 0.5)",bodyTextActiveBuyColor:"#4094e8",bodyTextInactiveSellColor:"rgba(231, 86, 86, 0.5)",bodyTextActiveSellColor:"#e75656",bodyFontFamily:"Verdana",bodyFontSize:9,bodyFontBold:!0,bodyFontItalic:!1,quantityBorderActiveBuyColor:"#4094e8",quantityBorderInactiveBuyColor:"rgba(64, 148, 232, 0.5)",quantityBorderActiveSellColor:"#e75656",quantityBorderInactiveSellColor:"rgba(231, 86, 86, 0.5)",quantityBackgroundInactiveBuyColor:"rgba(64, 148, 232, 0.5)",quantityBackgroundActiveBuyColor:"#4094e8",quantityBackgroundInactiveSellColor:"rgba(231, 86, 86, 0.5)",quantityBackgroundActiveSellColor:"#e75656",quantityTextColor:L,quantityTextTransparency:0,quantityFontFamily:"Verdana",quantityFontSize:9,quantityFontBold:!0,quantityFontItalic:!1,cancelButtonBorderActiveBuyColor:"#4094e8",cancelButtonBorderInactiveBuyColor:"rgba(64, 148, 232, 0.5)",cancelButtonBorderActiveSellColor:"#e75656",cancelButtonBorderInactiveSellColor:"rgba(231, 86, 86, 0.5)",cancelButtonBackgroundColor:k,cancelButtonBackgroundTransparency:25,cancelButtonIconActiveBuyColor:"#4094e8",cancelButtonIconInactiveBuyColor:"rgba(64, 148, 232, 0.5)",cancelButtonIconActiveSellColor:"#e75656",
cancelButtonIconInactiveSellColor:"rgba(231, 86, 86, 0.5)",tooltip:"",modifyTooltip:"",cancelTooltip:""},linetoolposition:{extendLeft:"inherit",lineLength:"inherit",lineLengthUnit:"percentage",lineBuyColor:"#4094e8",lineSellColor:"#e75656",lineStyle:"inherit",lineWidth:"inherit",bodyBorderBuyColor:"#4094e8",bodyBorderSellColor:"#e75656",bodyBackgroundColor:k,bodyBackgroundTransparency:25,bodyTextPositiveColor:"#268c02",bodyTextNeutralColor:"#646464",bodyTextNegativeColor:"#e75656",bodyFontFamily:"Verdana",bodyFontSize:9,bodyFontBold:!0,bodyFontItalic:!1,quantityBorderBuyColor:"#4094e8",quantityBorderSellColor:"#e75656",quantityBackgroundBuyColor:"#4094e8",quantityBackgroundSellColor:"#e75656",quantityTextColor:L,quantityTextTransparency:0,quantityFontFamily:"Verdana",quantityFontSize:9,quantityFontBold:!0,quantityFontItalic:!1,reverseButtonBorderBuyColor:"#4094e8",reverseButtonBorderSellColor:"#e75656",reverseButtonBackgroundColor:k,reverseButtonBackgroundTransparency:25,reverseButtonIconBuyColor:"#4094e8",reverseButtonIconSellColor:"#e75656",closeButtonBorderBuyColor:"#4094e8",closeButtonBorderSellColor:"#e75656",closeButtonBackgroundColor:k,closeButtonBackgroundTransparency:25,closeButtonIconBuyColor:"#4094e8",closeButtonIconSellColor:"#e75656",tooltip:"",protectTooltip:"",closeTooltip:"",reverseTooltip:""},linetoolexecution:{direction:"buy",arrowHeight:8,arrowSpacing:1,arrowBuyColor:"#4094e8",arrowSellColor:"#e75656",text:"",textColor:A,textTransparency:0,fontFamily:"Verdana",fontSize:10,fontBold:!1,fontItalic:!1,tooltip:""},linetoolicon:{color:E,size:40,icon:61720,angle:.5*Math.PI},linetoolemoji:{size:40,emoji:"😀",angle:.5*Math.PI},linetoolsticker:{size:110,sticker:"bitcoin",angle:.5*Math.PI},linetoolimage:{transparency:0,cssWidth:0,cssHeight:0,angle:0},linetoolbezierquadro:{linecolor:E,linewidth:2,fillBackground:!1,backgroundColor:O,transparency:50,linestyle:x,extendLeft:!1,extendRight:!1,leftEnd:f.Normal,rightEnd:f.Normal},linetoolbeziercubic:{linecolor:z,linewidth:2,fillBackground:!1,backgroundColor:U,transparency:80,linestyle:x,extendLeft:!1,extendRight:!1,leftEnd:f.Normal,rightEnd:f.Normal},linetooltrendline:{linecolor:E,linewidth:2,linestyle:x,extendLeft:!1,extendRight:!1,leftEnd:f.Normal,rightEnd:f.Normal,showLabel:!1,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:E,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showPercentPriceRange:!1,showPipsPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1,statsPosition:w.Right},linetoolinfoline:{linecolor:E,linewidth:2,linestyle:x,extendLeft:!1,extendRight:!1,leftEnd:f.Normal,rightEnd:f.Normal,showLabel:!1,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:E,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!0,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!0,showPercentPriceRange:!0,showPipsPriceRange:!0,showBarsRange:!0,showDateTimeRange:!0,showDistance:!0,showAngle:!0,statsPosition:w.Center},linetooltimecycles:{linecolor:"#159980",linewidth:2,
fillBackground:!0,backgroundColor:"rgba(106, 168, 79, 0.5)",transparency:50,linestyle:x},linetoolsineline:{linecolor:"#159980",linewidth:2,linestyle:x},linetooltrendangle:{linecolor:E,linewidth:2,linestyle:x,textcolor:E,fontsize:12,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showPercentPriceRange:!1,showPipsPriceRange:!1,showBarsRange:!1,extendRight:!1,extendLeft:!1,statsPosition:w.Right},linetooldisjointangle:{linecolor:ue,linewidth:2,linestyle:x,fillBackground:!0,backgroundColor:pe,transparency:20,extendLeft:!1,extendRight:!1,leftEnd:f.Normal,rightEnd:f.Normal,textcolor:ue,fontsize:12,bold:!1,italic:!1,showPrices:!1,showPriceRange:!1,showDateTimeRange:!1,showBarsRange:!1,labelVisible:!1,labelHorzAlign:"left",labelVertAlign:"bottom",labelTextColor:ue,labelFontSize:14,labelBold:!1,labelItalic:!1},linetoolflatbottom:{linecolor:ye,linewidth:2,linestyle:x,fillBackground:!0,backgroundColor:be,transparency:20,extendLeft:!1,extendRight:!1,leftEnd:f.Normal,rightEnd:f.Normal,textcolor:ye,fontsize:12,bold:!1,italic:!1,showPrices:!1,showPriceRange:!1,showDateTimeRange:!1,showBarsRange:!1,labelVisible:!1,labelHorzAlign:"left",labelVertAlign:"bottom",labelTextColor:ye,labelFontSize:14,labelBold:!1,labelItalic:!1},linetoolriskrewardshort:{linecolor:Me,linewidth:1,textcolor:L,fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"#585858",fillBackground:!0,stopBackground:te,profitBackground:pe,stopBackgroundTransparency:80,profitBackgroundTransparency:80,drawBorder:!1,borderColor:"#667b8b",compact:!1,riskDisplayMode:"percents",accountSize:1e3,lotSize:1,risk:25,alwaysShowStats:!1,showPriceLabels:!0},linetoolriskrewardlong:{linecolor:Me,linewidth:1,textcolor:L,fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"#585858",fillBackground:!0,stopBackground:te,profitBackground:pe,stopBackgroundTransparency:80,profitBackgroundTransparency:80,drawBorder:!1,borderColor:"#667b8b",compact:!1,riskDisplayMode:"percents",accountSize:1e3,lotSize:1,risk:25,alwaysShowStats:!1,showPriceLabels:!0},linetoolarrow:{linecolor:E,linewidth:2,linestyle:x,extendLeft:!1,extendRight:!1,leftEnd:f.Normal,rightEnd:f.Arrow,showLabel:!1,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:E,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showPercentPriceRange:!1,showPipsPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1,statsPosition:w.Right},linetoolray:{linecolor:E,linewidth:2,linestyle:x,extendLeft:!1,extendRight:!0,leftEnd:f.Normal,rightEnd:f.Normal,showLabel:!1,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:E,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showPercentPriceRange:!1,showPipsPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1,statsPosition:w.Right},linetoolextended:{linecolor:E,linewidth:2,linestyle:x,extendLeft:!0,extendRight:!0,leftEnd:f.Normal,rightEnd:f.Normal,showLabel:!1,horzLabelsAlign:"center",
vertLabelsAlign:"bottom",textcolor:E,fontsize:14,bold:!1,italic:!1,alwaysShowStats:!1,showMiddlePoint:!1,showPriceLabels:!1,showPriceRange:!1,showPercentPriceRange:!1,showPipsPriceRange:!1,showBarsRange:!1,showDateTimeRange:!1,showDistance:!1,showAngle:!1,statsPosition:w.Right},linetoolhorzline:{linecolor:E,linewidth:2,linestyle:x,showPrice:!0,showLabel:!1,textcolor:E,fontsize:12,bold:!1,italic:!1,horzLabelsAlign:"center",vertLabelsAlign:"top"},linetoolhorzray:{linecolor:E,linewidth:2,linestyle:x,showPrice:!0,showLabel:!1,textcolor:E,fontsize:12,bold:!1,italic:!1,horzLabelsAlign:"center",vertLabelsAlign:"top"},linetoolvertline:{linecolor:E,linewidth:2,linestyle:x,extendLine:!0,showTime:!0,showLabel:!1,horzLabelsAlign:"right",vertLabelsAlign:"top",textcolor:E,textOrientation:"vertical",fontsize:14,bold:!1,italic:!1},linetoolcrossline:{linecolor:E,linewidth:2,linestyle:x,showPrice:!0,showTime:!0},linetoolfibtimezone:{horzLabelsAlign:"right",vertLabelsAlign:"bottom",baselinecolor:"#808080",linecolor:"#0055db",linewidth:2,linestyle:x,showLabels:!0,fillBackground:!1,transparency:80,trendline:{visible:!0,color:"#808080",linewidth:1,linestyle:I},level1:r(0,Me,!0),level2:r(1,E,!0),level3:r(2,E,!0),level4:r(3,E,!0),level5:r(5,E,!0),level6:r(8,E,!0),level7:r(13,E,!0),level8:r(21,E,!0),level9:r(34,E,!0),level10:r(55,E,!0),level11:r(89,E,!0)},linetooltext:{color:E,fontsize:14,fillBackground:!1,backgroundColor:"rgba(91, 133, 191, 0.3)",backgroundTransparency:70,drawBorder:!1,borderColor:"#667b8b",bold:!1,italic:!1,fixedSize:!0,wordWrap:!1,wordWrapWidth:200},linetooltextabsolute:{color:E,fontsize:14,fillBackground:!1,backgroundColor:"rgba(155, 190, 213, 0.3)",backgroundTransparency:70,drawBorder:!1,borderColor:"#667b8b",bold:!1,italic:!1,fixedSize:!1,wordWrap:!1,wordWrapWidth:200},linetoolballoon:{color:L,backgroundColor:le,borderColor:oe,fontsize:14,transparency:30},linetoolcomment:{color:L,backgroundColor:E,borderColor:E,fontsize:16,transparency:0},linetoolbrush:{linecolor:j,linewidth:2,linestyle:x,smooth:5,fillBackground:!1,backgroundColor:j,transparency:50,leftEnd:f.Normal,rightEnd:f.Normal},linetoolhighlighter:{linecolor:te,smooth:5,transparency:80},linetoolpolyline:{linecolor:j,linewidth:2,linestyle:x,fillBackground:!0,backgroundColor:G,transparency:80,filled:!1},linetoolsignpost:{itemType:m.Emoji,emoji:"🙂",showImage:!1,plateColor:E,fontSize:12,bold:!1,italic:!1},linetoolpath:{lineColor:E,lineWidth:2,lineStyle:x,leftEnd:f.Normal,rightEnd:f.Arrow},linetoolarrowmarkleft:{color:E,arrowColor:E,fontsize:14,bold:!1,italic:!1,showLabel:!0},linetoolarrowmarkup:{color:ue,arrowColor:ue,fontsize:14,bold:!1,italic:!1,showLabel:!0},linetoolarrowmarkright:{color:E,arrowColor:E,fontsize:14,bold:!1,italic:!1,showLabel:!0},linetoolarrowmarkdown:{color:re,arrowColor:re,fontsize:14,bold:!1,italic:!1,showLabel:!0},linetoolflagmark:{flagColor:E},linetoolnote:{markerColor:E,textColor:L,backgroundColor:V,backgroundTransparency:0,borderColor:E,fontSize:14,bold:!1,italic:!1,fixedSize:!0},linetoolnoteabsolute:{markerColor:E,textColor:L,
backgroundColor:V,backgroundTransparency:0,borderColor:E,fontSize:14,bold:!1,italic:!1,fixedSize:!0},linetoolpricelabel:{color:L,backgroundColor:E,borderColor:E,fontWeight:"bold",fontsize:14,transparency:0},linetoolarrowmarker:{backgroundColor:F,textColor:F,bold:!0,italic:!1,fontsize:16,showLabel:!0},linetoolrectangle:{color:ne,fillBackground:!0,backgroundColor:ae,linewidth:2,transparency:50,showLabel:!1,horzLabelsAlign:"left",vertLabelsAlign:"bottom",textColor:ne,fontSize:14,bold:!1,italic:!1,extendLeft:!1,extendRight:!1,middleLine:{showLine:!1,lineWidth:1,lineColor:ne,lineStyle:y.Dashed}},linetoolrotatedrectangle:{color:fe,fillBackground:!0,backgroundColor:ve,transparency:50,linewidth:2},linetoolcircle:{color:ye,backgroundColor:be,fillBackground:!0,linewidth:2,showLabel:!1,textColor:ye,fontSize:14,bold:!1,italic:!1},linetoolellipse:{color:Q,fillBackground:!0,backgroundColor:te,transparency:50,linewidth:2,showLabel:!1,textColor:Q,fontSize:14,bold:!1,italic:!1},linetoolarc:{color:ce,fillBackground:!0,backgroundColor:he,transparency:80,linewidth:2},linetoolprediction:{linecolor:E,linewidth:2,sourceBackColor:E,sourceTextColor:L,sourceStrokeColor:E,targetStrokeColor:E,targetBackColor:E,targetTextColor:L,successBackground:fe,successTextColor:L,failureBackground:Q,failureTextColor:L,intermediateBackColor:"#ead289",intermediateTextColor:"#6d4d22",transparency:10,centersColor:"#202020"},linetooltriangle:{color:ue,fillBackground:!0,backgroundColor:pe,transparency:80,linewidth:2},linetoolcallout:{color:L,backgroundColor:$,transparency:50,linewidth:2,fontsize:14,bordercolor:q,bold:!1,italic:!1,wordWrap:!1,wordWrapWidth:200},linetoolparallelchannel:{linecolor:E,linewidth:2,linestyle:x,extendLeft:!1,extendRight:!1,fillBackground:!0,backgroundColor:O,transparency:20,showMidline:!0,midlinecolor:E,midlinewidth:1,midlinestyle:I,labelVisible:!1,labelHorzAlign:"left",labelVertAlign:"bottom",labelTextColor:E,labelFontSize:14,labelBold:!1,labelItalic:!1},linetoolelliottimpulse:{degree:7,showWave:!0,color:"#3d85c6",linewidth:2},linetoolelliotttriangle:{degree:7,showWave:!0,color:ye,linewidth:2},linetoolelliotttriplecombo:{degree:7,showWave:!0,color:"#6aa84f",linewidth:2},linetoolelliottcorrection:{degree:7,showWave:!0,color:"#3d85c6",linewidth:2},linetoolelliottdoublecombo:{degree:7,showWave:!0,color:"#6aa84f",linewidth:2},linetoolbarspattern:{color:E,mode:c.Bars,mirrored:!1,flipped:!1},linetoolghostfeed:{averageHL:20,variance:50,candleStyle:{upColor:de,downColor:K,drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:ue,borderDownColor:Q,wickColor:Me},transparency:50},study:{inputs:{},styles:{},bands:{},graphics:{},ohlcPlots:{},palettes:{},filledAreasStyle:{},filledAreas:{},visible:!0,showLegendValues:!0,showLabelsOnPriceScale:!0,precision:"default"},linetoolpitchfork:{fillBackground:!0,transparency:80,style:l.Original,median:{visible:!0,color:Q,linewidth:2,linestyle:x},extendLines:!1,level0:r(.25,Se,!1),level1:r(.382,ge,!1),level2:r(.5,ue,!0),level3:r(.618,ue,!1),level4:r(.75,j,!1),level5:r(1,E,!0),level6:r(1.5,ne,!1),
level7:r(1.75,ce,!1),level8:r(2,Z,!1)},linetoolpitchfan:{fillBackground:!0,transparency:80,median:{visible:!0,color:Q,linewidth:2,linestyle:x},level0:r(.25,Se,!1),level1:r(.382,ge,!1),level2:r(.5,j,!0),level3:r(.618,ue,!1),level4:r(.75,j,!1),level5:r(1,E,!0),level6:r(1.5,ne,!1),level7:r(1.75,ce,!1),level8:r(2,Z,!1)},linetoolgannfan:{linewidth:2,showLabels:!0,fillBackground:!0,transparency:80,level1:Ae(1,8,ye,!0),level2:Ae(1,4,ue,!0),level3:Ae(1,3,fe,!0),level4:Ae(1,2,ue,!0),level5:Ae(1,1,j,!0),level6:Ae(2,1,E,!0),level7:Ae(3,1,ne,!0),level8:Ae(4,1,ce,!0),level9:Ae(8,1,Q,!0)},linetoolganncomplex:{fillBackground:!1,arcsBackground:{fillBackground:!0,transparency:80},reverse:!1,scaleRatio:"",showLabels:!0,labelsStyle:{fontSize:12,bold:!1,italic:!1},levels:[h(Me,!0),h(ye,!0),h(j,!0),h(fe,!0),h(ue,!0),h(Me,!0)],fanlines:[M(W,!1,2,8,1),M(Q,!1,2,5,1),M(Me,!1,2,4,1),M(ye,!1,2,3,1),M(j,!0,2,2,1),M(fe,!0,2,1,1),M(ue,!0,2,1,2),M(ue,!1,2,1,3),M(E,!1,2,1,4),M(H,!1,2,1,5),M(W,!1,2,1,8)],arcs:[M(ye,!0,2,1,0),M(ye,!0,2,1,1),M(ye,!0,2,1.5,0),M(j,!0,2,2,0),M(j,!0,2,2,1),M(fe,!0,2,3,0),M(fe,!0,2,3,1),M(ue,!0,2,4,0),M(ue,!0,2,4,1),M(E,!0,2,5,0),M(E,!0,2,5,1)]},linetoolgannfixed:{fillBackground:!1,arcsBackground:{fillBackground:!0,transparency:80},reverse:!1,levels:[h(Me,!0),h(ye,!0),h(j,!0),h(fe,!0),h(ue,!0),h(Me,!0)],fanlines:[M(W,!1,2,8,1),M(Q,!1,2,5,1),M(Me,!1,2,4,1),M(ye,!1,2,3,1),M(j,!0,2,2,1),M(fe,!0,2,1,1),M(ue,!0,2,1,2),M(ue,!1,2,1,3),M(E,!1,2,1,4),M(H,!1,2,1,5),M(W,!1,2,1,8)],arcs:[M(ye,!0,2,1,0),M(ye,!0,2,1,1),M(ye,!0,2,1.5,0),M(j,!0,2,2,0),M(j,!0,2,2,1),M(fe,!0,2,3,0),M(fe,!0,2,3,1),M(ue,!0,2,4,0),M(ue,!0,2,4,1),M(E,!0,2,5,0),M(E,!0,2,5,1)]},linetoolgannsquare:{color:"rgba(21, 56, 153, 0.8)",linewidth:2,linestyle:x,showTopLabels:!0,showBottomLabels:!0,showLeftLabels:!0,showRightLabels:!0,fillHorzBackground:!0,horzTransparency:80,fillVertBackground:!0,vertTransparency:80,reverse:!1,fans:t(Te,!1),hlevel1:i(0,Me,!0),hlevel2:i(.25,ye,!0),hlevel3:i(.382,j,!0),hlevel4:i(.5,fe,!0),hlevel5:i(.618,ue,!0),hlevel6:i(.75,E,!0),hlevel7:i(1,Me,!0),vlevel1:i(0,Me,!0),vlevel2:i(.25,ye,!0),vlevel3:i(.382,j,!0),vlevel4:i(.5,fe,!0),vlevel5:i(.618,ue,!0),vlevel6:i(.75,E,!0),vlevel7:i(1,Me,!0)},linetoolfibspeedresistancefan:{fillBackground:!0,transparency:80,grid:{color:"rgba(21, 56, 153, 0.8)",linewidth:1,linestyle:x,visible:!0},linewidth:2,linestyle:x,showTopLabels:!0,showBottomLabels:!0,showLeftLabels:!0,showRightLabels:!0,reverse:!1,hlevel1:i(0,Me,!0),hlevel2:i(.25,ye,!0),hlevel3:i(.382,j,!0),hlevel4:i(.5,fe,!0),hlevel5:i(.618,ue,!0),hlevel6:i(.75,E,!0),hlevel7:i(1,Me,!0),vlevel1:i(0,Me,!0),vlevel2:i(.25,ye,!0),vlevel3:i(.382,j,!0),vlevel4:i(.5,fe,!0),vlevel5:i(.618,ue,!0),vlevel6:i(.75,E,!0),vlevel7:i(1,Me,!0)},linetoolfibretracement:{showCoeffs:!0,showPrices:!0,fillBackground:!0,transparency:80,extendLines:!1,extendLinesLeft:!1,horzLabelsAlign:"left",vertLabelsAlign:"bottom",reverse:!1,coeffsAsPercents:!1,fibLevelsBasedOnLogScale:!1,labelFontSize:12,trendline:{visible:!0,color:Me,linewidth:2,linestyle:I},levelsStyle:{linewidth:2,linestyle:x
},level1:i(0,Me,!0),level2:i(.236,Q,!0),level3:i(.382,ye,!0),level4:i(.5,fe,!0),level5:i(.618,ue,!0),level6:i(.786,j,!0),level7:i(1,Me,!0),level8:i(1.618,E,!0),level9:i(2.618,Q,!0),level10:i(3.618,ne,!0),level11:i(4.236,ce,!0),level12:i(1.272,ye,!1),level13:i(1.414,Q,!1),level16:i(2,ue,!1),level14:i(2.272,ye,!1),level15:i(2.414,fe,!1),level17:i(3,j,!1),level18:i(3.272,Me,!1),level19:i(3.414,E,!1),level20:i(4,Q,!1),level21:i(4.272,ne,!1),level22:i(4.414,ce,!1),level23:i(4.618,ye,!1),level24:i(4.764,ue,!1)},linetoolfibchannel:{showCoeffs:!0,showPrices:!0,fillBackground:!0,transparency:80,extendLeft:!1,extendRight:!1,horzLabelsAlign:"left",vertLabelsAlign:"middle",coeffsAsPercents:!1,labelFontSize:12,levelsStyle:{linewidth:2,linestyle:x},level1:i(0,Me,!0),level2:i(.236,Q,!0),level3:i(.382,ye,!0),level4:i(.5,fe,!0),level5:i(.618,ue,!0),level6:i(.786,j,!0),level7:i(1,Me,!0),level8:i(1.618,E,!0),level9:i(2.618,Q,!0),level10:i(3.618,ne,!0),level11:i(4.236,ce,!0),level12:i(1.272,ye,!1),level13:i(1.414,Q,!1),level16:i(2,ue,!1),level14:i(2.272,ye,!1),level15:i(2.414,fe,!1),level17:i(3,j,!1),level18:i(3.272,Me,!1),level19:i(3.414,E,!1),level20:i(4,Q,!1),level21:i(4.272,ne,!1),level22:i(4.414,ce,!1),level23:i(4.618,ye,!1),level24:i(4.764,ue,!1)},linetoolprojection:{showCoeffs:!0,fillBackground:!0,transparency:80,color1:O,color2:ae,linewidth:2,trendline:{visible:!0,color:Te,linestyle:x},level1:r(1,"#808080",!0)},linetool5pointspattern:{color:E,textcolor:L,fillBackground:!0,backgroundColor:E,fontsize:12,bold:!1,italic:!1,transparency:85,linewidth:2},linetoolcypherpattern:{color:E,textcolor:L,fillBackground:!0,backgroundColor:E,fontsize:12,bold:!1,italic:!1,transparency:85,linewidth:2},linetooltrianglepattern:{color:z,textcolor:L,fillBackground:!0,backgroundColor:z,fontsize:12,bold:!1,italic:!1,transparency:85,linewidth:2},linetoolabcd:{color:ue,textcolor:L,fontsize:12,bold:!1,italic:!1,linewidth:2},linetoolthreedrivers:{color:z,textcolor:L,fillBackground:!0,backgroundColor:"rgba(149, 40, 204, 0.5)",fontsize:12,bold:!1,italic:!1,transparency:50,linewidth:2},linetoolheadandshoulders:{color:ue,textcolor:L,fillBackground:!0,backgroundColor:ue,fontsize:12,bold:!1,italic:!1,transparency:85,linewidth:2},linetoolfibwedge:{showCoeffs:!0,fillBackground:!0,transparency:80,trendline:{visible:!0,color:"#808080",linewidth:2,linestyle:x},level1:r(.236,Q,!0),level2:r(.382,ye,!0),level3:r(.5,fe,!0),level4:r(.618,ue,!0),level5:r(.786,j,!0),level6:r(1,Me,!0),level7:r(1.618,E,!1),level8:r(2.618,Q,!1),level9:r(3.618,z,!1),level10:r(4.236,ce,!1),level11:r(4.618,ce,!1)},linetoolfibcircles:{showCoeffs:!0,fillBackground:!0,transparency:80,coeffsAsPercents:!1,trendline:{visible:!0,color:Me,linewidth:2,linestyle:I},level1:r(.236,Q,!0),level2:r(.382,ye,!0),level3:r(.5,ue,!0),level4:r(.618,fe,!0),level5:r(.786,j,!0),level6:r(1,Me,!0),level7:r(1.618,E,!0),level8:r(2.618,ce,!0),level9:r(3.618,E,!0),level10:r(4.236,ce,!0),level11:r(4.618,Q,!0)},linetoolfibspeedresistancearcs:{showCoeffs:!0,fillBackground:!0,transparency:80,fullCircles:!1,trendline:{visible:!0,
color:Me,linewidth:2,linestyle:I},level1:r(.236,Q,!0),level2:r(.382,ye,!0),level3:r(.5,ue,!0),level4:r(.618,fe,!0),level5:r(.786,j,!0),level6:r(1,Me,!0),level7:r(1.618,E,!0),level8:r(2.618,ce,!0),level9:r(3.618,E,!0),level10:r(4.236,ce,!0),level11:r(4.618,Q,!0)},linetooltrendbasedfibextension:{showCoeffs:!0,showPrices:!0,fillBackground:!0,transparency:80,extendLines:!1,extendLinesLeft:!1,horzLabelsAlign:"left",vertLabelsAlign:"bottom",reverse:!1,coeffsAsPercents:!1,fibLevelsBasedOnLogScale:!1,labelFontSize:12,trendline:{visible:!0,color:Me,linewidth:2,linestyle:I},levelsStyle:{linewidth:2,linestyle:x},level1:i(0,Me,!0),level2:i(.236,Q,!0),level3:i(.382,ye,!0),level4:i(.5,fe,!0),level5:i(.618,ue,!0),level6:i(.786,j,!0),level7:i(1,Me,!0),level8:i(1.618,E,!0),level9:i(2.618,Q,!0),level10:i(3.618,ne,!0),level11:i(4.236,ce,!0),level12:i(1.272,ye,!1),level13:i(1.414,Q,!1),level16:i(2,ue,!1),level14:i(2.272,ye,!1),level15:i(2.414,fe,!1),level17:i(3,j,!1),level18:i(3.272,Me,!1),level19:i(3.414,E,!1),level20:i(4,Q,!1),level21:i(4.272,ne,!1),level22:i(4.414,ce,!1),level23:i(4.618,ye,!1),level24:i(4.764,ue,!1)},linetooltrendbasedfibtime:{showCoeffs:!0,fillBackground:!0,transparency:80,horzLabelsAlign:"right",vertLabelsAlign:"bottom",trendline:{visible:!0,color:Me,linewidth:2,linestyle:I},level1:r(0,Me,!0),level2:r(.382,Q,!0),level3:r(.5,ge,!1),level4:r(.618,fe,!0),level5:r(1,ue,!0),level6:r(1.382,j,!0),level7:r(1.618,Me,!0),level8:r(2,E,!0),level9:r(2.382,ce,!0),level10:r(2.618,ne,!0),level11:r(3,z,!0)},linetoolschiffpitchfork:{fillBackground:!0,transparency:80,style:l.Schiff,median:{visible:!0,color:Q,linewidth:2,linestyle:x},extendLines:!1,level0:r(.25,Se,!1),level1:r(.382,ge,!1),level2:r(.5,ue,!0),level3:r(.618,ue,!1),level4:r(.75,j,!1),level5:r(1,E,!0),level6:r(1.5,ne,!1),level7:r(1.75,ce,!1),level8:r(2,Z,!1)},linetoolschiffpitchfork2:{fillBackground:!0,transparency:80,style:l.Schiff2,median:{visible:!0,color:Q,linewidth:2,linestyle:x},extendLines:!1,level0:r(.25,Se,!1),level1:r(.382,ge,!1),level2:r(.5,ue,!0),level3:r(.618,ue,!1),level4:r(.75,j,!1),level5:r(1,E,!0),level6:r(1.5,ne,!1),level7:r(1.75,ce,!1),level8:r(2,Z,!1)},linetoolinsidepitchfork:{fillBackground:!0,transparency:80,style:l.Inside,median:{visible:!0,color:Q,linewidth:2,linestyle:x},extendLines:!1,level0:r(.25,Se,!1),level1:r(.382,ge,!1),level2:r(.5,ue,!0),level3:r(.618,ue,!1),level4:r(.75,j,!1),level5:r(1,E,!0),level6:r(1.5,ne,!1),level7:r(1.75,ce,!1),level8:r(2,Z,!1)},linetoolregressiontrend:{linewidth:1,linestyle:x,styles:{upLine:{display:u.All,color:B,linestyle:x,linewidth:2},downLine:{display:u.All,color:B,linestyle:x,linewidth:2},baseLine:{display:u.All,color:ee,linestyle:I,linewidth:1},extendLines:!1,showPearsons:!0,transparency:70}}},Oe(TradingView.defaultProperties.chartproperties),We()}if(void 0===TradingView.defaultProperties["study_MA@tv-basicstudies"]&&(TradingView.defaultProperties["study_MA@tv-basicstudies"]={description:"Moving Average",shortDescription:"MA",inputs:{length:9,source:"close"},styles:{MovAvg:{display:u.All,color:E,linestyle:x,
linewidth:1,plottype:d.Line,histogramBase:0,title:"MA"}}}),void 0===TradingView.defaultProperties["study_PivotPointsHighLow@tv-basicstudies"]&&(TradingView.defaultProperties["study_PivotPointsHighLow@tv-basicstudies"]={fontsize:10,borderColor:E,backColor:D,textColor:De}),void 0===TradingView.defaultProperties["study_PivotPointsStandard@tv-basicstudies"]){var Ne=!0;TradingView.defaultProperties["study_PivotPointsStandard@tv-basicstudies"]={_hardCodedDefaultsVersion:1,fontsize:11,levelsStyle:{showLabels:!0,visibility:{P:Ne,"S1/R1":Ne,"S2/R2":Ne,"S3/R3":Ne,"S4/R4":Ne,"S5/R5":Ne},colors:{P:we,"S1/R1":we,"S2/R2":we,"S3/R3":we,"S4/R4":we,"S5/R5":we},widths:{P:1,"S1/R1":1,"S2/R2":1,"S3/R3":1,"S4/R4":1,"S5/R5":1}}}}if(void 0===TradingView.defaultProperties["study_ZigZag@tv-basicstudies"]&&(TradingView.defaultProperties["study_ZigZag@tv-basicstudies"]={color:E,linewidth:2}),void 0===TradingView.defaultProperties["study_TPOPeriodic@tv-volumebyprice"]&&(TradingView.defaultProperties["study_TPOPeriodic@tv-volumebyprice"]={styles:{splitByBlocks:!1}}),void 0===TradingView.defaultProperties["study_ElliottWave@tv-basicstudies"]&&(TradingView.defaultProperties["study_ElliottWave@tv-basicstudies"]={inputs:{},level0:t(Y,!1),level1:t("#008000",!1),level2:t("#0000ff",!1),level3:t("#ff00ff",!1),level4:t("#0080ff",!0),level5:t(Y,!0),level6:t("#008000",!0),level7:t("#0000ff",!0),level8:t("#ff00ff",!0)}),void 0===TradingView.defaultProperties["study_LinearRegression@tv-basicstudies"]&&(TradingView.defaultProperties["study_LinearRegression@tv-basicstudies"]={styles:{upLine:{display:u.All,color:B,linestyle:x,linewidth:1},downLine:{display:u.All,color:B,linestyle:x,linewidth:1},baseLine:{display:u.All,color:ee,linestyle:x,linewidth:1},extendLines:!0,showPearsons:!0,backgroundColor:"rgba(153, 21, 21, 0.3)",transparency:70}}),void 0===TradingView.defaultProperties["study_Compare@tv-basicstudies"]&&(TradingView.defaultProperties["study_Compare@tv-basicstudies"]={minTick:"default"}),void 0===TradingView.defaultProperties["study_Overlay@tv-basicstudies"]){TradingView.defaultProperties["study_Overlay@tv-basicstudies"]={style:a.STYLE_LINE,allowExtendTimeScale:!1,showPriceLine:!1,minTick:"default",candleStyle:{upColor:"#6ba583",downColor:"#d75442",drawWick:!0,drawBorder:!0,drawBody:!0,borderColor:"#378658",borderUpColor:"#225437",borderDownColor:"#5b1a13",wickColor:"#737375",wickUpColor:"#737375",wickDownColor:"#737375",barColorsOnPrevClose:!1},hollowCandleStyle:{upColor:"#6ba583",downColor:"#d75442",drawWick:!0,drawBorder:!0,drawBody:!0,borderColor:"#378658",borderUpColor:"#225437",borderDownColor:"#5b1a13",wickColor:"#737375",wickUpColor:"#737375",wickDownColor:"#737375",barColorsOnPrevClose:!1},barStyle:{upColor:"#6ba583",downColor:"#d75442",barColorsOnPrevClose:!1,dontDrawOpen:!1,thinBars:!0},lineStyle:{color:Ce,linestyle:x,linewidth:2,priceSource:"close"},lineWithMarkersStyle:{color:Ce,linestyle:x,linewidth:2,priceSource:"close"},steplineStyle:{color:Ce,linestyle:x,linewidth:2,priceSource:"close"},areaStyle:{color1:E,color2:E,linecolor:E,
linestyle:x,linewidth:2,priceSource:"close",transparency:95},baselineStyle:{baselineColor:Ie,topFillColor1:Be,topFillColor2:Be,bottomFillColor1:J,bottomFillColor2:J,topLineColor:Ve,bottomLineColor:X,topLineWidth:2,bottomLineWidth:2,priceSource:"close",transparency:50,baseLevelPercentage:50},hiloStyle:{color:E,showBorders:!0,borderColor:E,showLabels:!0,labelColor:E,drawBody:!0},columnStyle:{upColor:n(ue,50),downColor:n(Q,50),barColorsOnPrevClose:!0,priceSource:"close"},hlcAreaStyle:{highLineColor:ue,highLineStyle:x,highLineWidth:2,lowLineColor:Q,lowLineStyle:x,lowLineWidth:2,closeLineColor:Ie,closeLineStyle:x,closeLineWidth:2,highCloseFillColor:pe,closeLowFillColor:te},styles:{open:{display:u.All,color:Y,linestyle:x,linewidth:1,plottype:d.Line,histogramBase:0},high:{display:u.All,color:Y,linestyle:x,linewidth:1,plottype:d.Line,histogramBase:0},low:{display:u.All,color:Y,linestyle:x,linewidth:1,plottype:d.Line,histogramBase:0},close:{display:u.All,color:Y,linestyle:x,linewidth:1,plottype:d.Line,histogramBase:0}}}}for(var Fe=e.split("."),He=TradingView.defaultProperties,ze=0;ze1?h(e[r],t.slice(1),i):(e[r]&&e[r].setValue?e[r].setValue(i):e[r]=i,!0))}function d(e){i||M.logWarn("Path `"+e+"` does not exist.")}}function Oe(e,t,i,s){window.__defaultsOverrides&&Ne(e,t,i,window.__defaultsOverrides,s)}function Fe(e,t){window.__settingsOverrides&&Ne(e,null,!1,window.__settingsOverrides,t)}function We(){var e=/^linetool.+/;Object.keys(TradingView.defaultProperties).forEach((function(t){e.test(t)&&Oe(TradingView.defaultProperties[t],null,!1,t)}))}function He(e,t){return t?function(e,t){var i=Re(e);if(!window._UNIT_TESTS){var s=TradingView.clone(TVSettings.getJSON(e,null));if(function(e){var t=new Set(["linetoolregressiontrend"]);return e.startsWith("study_")||t.has(e)}(e)&&s&&function(e){if(!e)return!1;e=e.toString();var t=new RegExp("\\d+").exec(e);return null!==t&&t[0]===e}(s.version)){var r=s.inputs,n=t.updateStudyInputs(s.id,s.version,"last",r,null);s.inputs=n,s=t.updateStudyState(s,s)}TradingView.merge(i,s),Fe(i,e)}return i}(e,t):function(e){var t=Re(e);if(!window._UNIT_TESTS){var i=TradingView.clone(TVSettings.getJSON(e,null));if(i){TradingView.merge(t,i);const s=e.split(".");Fe(t,void 0===s[1]?e:s[1])}}return t}(e)}He.create=function(e,t){if(t){var i=Re(e);TradingView.defaultProperties[e]=Object.assign(t,i)}},He.remove=function(e){TradingView.defaultProperties[e]=void 0},TradingView.saveDefaults=function(e,t){void 0===t?TVSettings.remove(e):TVSettings.setJSON(e,t)},TradingView.factoryDefaults=Re,window.applyDefaultOverridesToLinetools=We,window.applyDefaultsOverrides=Oe,window.applyPropertiesOverrides=Ne,window.defaults=He,
t.applyDefaultOverridesToLinetools=We,t.applyDefaultsOverrides=Oe,t.applyPropertiesOverrides=Ne,t.defaults=He,t.factoryDefaults=Re,t.saveDefaults=TradingView.saveDefaults},88348:(e,t,i)=>{"use strict";i.r(t),i.d(t,{SelectPointMode:()=>s,activePointSelectionMode:()=>q,barTimesUnderCursor:()=>Y,beenSetLineToolLastPoint:()=>E,cancelLineTool:()=>Q,cancelledLineTool:()=>D,changeLineStyle:()=>ce,changeLineTool:()=>ne,changedLineStyle:()=>z,changedLineTool:()=>O,continueLineTool:()=>J,continuedLineTool:()=>k,copiedLineTool:()=>U,copyLineTool:()=>he,createLineTool:()=>X,createdLineTool:()=>L,crosshairLock:()=>y,cursorTool:()=>x,drawOnAllCharts:()=>we,drawOnAllChartsMode:()=>Ce,emojiTool:()=>C,finishChangingLineTool:()=>oe,finishLineTool:()=>le,finishMovingLineTool:()=>se,finishedChangingLineTool:()=>F,finishedLineTool:()=>H,finishedMovingLineTool:()=>R,hideAllDrawings:()=>ve,hideAllIndicators:()=>Se,hideMarksOnBars:()=>be,iconTool:()=>w,init:()=>me,isDirectionalMovementActive:()=>A,isStudyEditingNow:()=>$,isToolCreatingNow:()=>T,isToolEditingNow:()=>I,isToolMovingNow:()=>M,lockDrawings:()=>ye,moveLineTool:()=>ie,movedLineTool:()=>B,properties:()=>fe,removeLineTool:()=>ae,removedLineTool:()=>W,resetToCursor:()=>_,restoreLineTool:()=>de,restoreLineToolState:()=>ue,restoredLineTool:()=>j,restoredLineToolState:()=>G,runOnDrawingStateReady:()=>ge,setLineToolLastPoint:()=>ee,startChangingLineTool:()=>re,startMovingLineTool:()=>te,startedChangingLineTool:()=>N,startedMovingLineTool:()=>V,stickerTool:()=>P,tool:()=>b,toolIsCursor:()=>u,toolIsMeasure:()=>p});var s,r=i(50151),n=i(59680),o=i(46100),a=i(97145),l=i(83669),c=i(57898),h=i(56840),d=i(76422);function u(e){return"cursor"===e||"arrow"===e||"dot"===e||"performance"===e}function p(e){return"measure"===e}function _(e=!1){if(!e&&m){if(m.childs().stayInDrawingMode.value())return}b.setValue(x.value())}!function(e){e[e.None=0]="None",e[e.Replay=1]="Replay",e[e.Study=2]="Study"}(s||(s={}));let m=null,g=null,f=null,v=null,S=null;const y=new l.WatchedObject(null),b=new a.WatchedValue,w=new a.WatchedValue,C=new a.WatchedValue,P=new a.WatchedValue,x=new a.WatchedValue,T=new a.WatchedValue(!1),I=new a.WatchedValue(!1),M=new a.WatchedValue(!1),A=new a.WatchedValue(!1),L=new c.Delegate,k=new c.Delegate,D=new c.Delegate,E=new c.Delegate,V=new c.Delegate,B=new c.Delegate,R=new c.Delegate,N=new c.Delegate,O=new c.Delegate,F=new c.Delegate,W=new c.Delegate,H=new c.Delegate,z=new c.Delegate,U=new c.Delegate,j=new c.Delegate,G=new c.Delegate,q=new a.WatchedValue(s.None),$=new a.WatchedValue(!1),Y=new Map;function K(e,t){const i=t||{value:!1};return t=>{i.value||(i.value=!0,e.fire(t),i.value=!1)}}const Z={value:!1},X=K(L,Z),J=K(k,Z),Q=K(D,Z),ee=K(E,Z),te=K(V),ie=K(B),se=K(R),re=K(N),ne=K(O),oe=K(F),ae=K(W),le=K(H),ce=K(z,Z),he=K(U,Z),de=K(j),ue=K(G);let pe=!1,_e=[];function me(){pe||(b.setValue(h.getValue("chart.cursorPreference","cursor")),b.subscribe((e=>u(e)&&x.setValue(e)),{callWithLast:!0}),x.subscribe((e=>{e&&"performance"!==e&&h.setValue("chart.cursorPreference",e)})),
m=new o.DefaultProperty("drawings"),g=(0,n.createPrimitiveProperty)(),f=(0,n.createPrimitiveProperty)(),v=(0,n.createPrimitiveProperty)(),S=(0,n.createPrimitiveProperty)(),g.setValue(!1),f.setValue(!1),v.setValue(!1),S.setValue(!1),b.subscribe((e=>{(0,d.emit)("onSelectedLineToolChanged")})),pe=!0,_e.forEach((e=>e())),_e=[])}function ge(e){pe?e():_e.push(e)}function fe(){return(0,r.ensureNotNull)(m)}function ve(){return(0,r.ensureNotNull)(g)}function Se(){return(0,r.ensureNotNull)(f)}function ye(){return(0,r.ensureNotNull)(v)}function be(){return(0,r.ensureNotNull)(S)}function we(){return fe().childs().drawOnAllCharts}function Ce(){return fe().childs().drawOnAllChartsMode}},81155:(e,t,i)=>{"use strict";i.d(t,{EnvironmentState:()=>r});var s=i(49483);class r{constructor(e,t=!1){this._shift=!1,this._mod=!1,this._alt=!1,void 0!==e&&(this._shift=Boolean(e.shiftKey),this._mod=Boolean((0,s.isMac)()?e.metaKey:e.ctrlKey),this._alt=Boolean(e.altKey)),this._isApiEvent=t}shift(){return this._shift}mod(){return this._mod}alt(){return this._alt}shiftOnly(){return this._shift&&!this._mod&&!this._alt}modOnly(){return this._mod&&!this._shift&&!this._alt}altOnly(){return this._alt&&!this._shift&&!this._mod}modShift(){return this._shift&&this._mod&&!this._alt}isApiEvent(){return this._isApiEvent}static create(e=!1,t=!1,i=!1){return new r({shiftKey:e,ctrlKey:t,metaKey:t,altKey:i})}}},27856:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DEFAULT_ADJUSTMENT:()=>r,DEFAULT_SESSION:()=>s,DEFAULT_SETTLEMENT_AS_CLOSE:()=>n,compareSymbols:()=>m,decodeExtendedSymbol:()=>u,encodeExtendedSymbolOrGetSimpleSymbolString:()=>h,isEncodedExtendedSymbol:()=>d,isReplaySymbol:()=>c,isStudySymbol:()=>l,unwrapSimpleSymbol:()=>p});const s="regular",r="splits",n=!0;function o(e){return"="+JSON.stringify(a(e))}function a(e){return Object.keys(e).sort().reduce(((t,i)=>("[object Object]"===Object.prototype.toString.call(e[i])?t[i]=a(e[i]):t[i]=e[i],t)),{})}function l(e){return Boolean(e.inputs)}function c(e){return Boolean(e.replay)}function h(e){return o(e)}function d(e){return"="===e[0]}function u(e){if(!d(e))return{symbol:e};try{return JSON.parse(e.slice(1))}catch(t){return{symbol:e}}}function p(e){return"string"==typeof e?e:p(e.symbol)}const _=["symbol","session","unit-id","currency-id","adjustment","backadjustment","settlement-as-close"];function m(e,t){return _.every((i=>e[i]===t[i]))}},1763:(e,t,i)=>{"use strict";i.d(t,{customFormatters:()=>s});const s={dateFormatter:null,timeFormatter:null,tickMarkFormatter:null,priceFormatterFactory:null,studyFormatterFactory:null}},15879:(e,t,i)=>{"use strict";i.d(t,{availableDateFormats:()=>f,dateFormatFunctions:()=>m,defaultDateFormat:()=>v,getDateFormatWithWeekday:()=>g});var s=i(11542),r=i(28865),n=i(83854);const o={1:()=>s.t(null,void 0,i(95425)),2:()=>s.t(null,void 0,i(35050)),3:()=>s.t(null,void 0,i(51369)),4:()=>s.t(null,void 0,i(42762)),5:()=>s.t(null,{context:"short"},i(27991)),6:()=>s.t(null,void 0,i(15224)),7:()=>s.t(null,void 0,i(6215)),8:()=>s.t(null,void 0,i(38465)),9:()=>s.t(null,void 0,i(57902)),
10:()=>s.t(null,void 0,i(73546)),11:()=>s.t(null,void 0,i(71230)),12:()=>s.t(null,void 0,i(92203))},a=(e,t)=>(t?e.getMonth():e.getUTCMonth())+1,l=(e,t)=>t?e.getFullYear():e.getUTCFullYear(),c=e=>e.toLocaleDateString(window.language?(0,r.getIsoLanguageCodeFromLanguage)(window.language):void 0,{weekday:"short",timeZone:"UTC"}),h=(e,t)=>(0,n.numberToStringWithLeadingZero)(((e,t)=>t?e.getDate():e.getUTCDate())(e,t),2),d=(e,t)=>o[a(e,t)](),u=(e,t)=>(0,n.numberToStringWithLeadingZero)(a(e,t),2),p=(e,t)=>(0,n.numberToStringWithLeadingZero)(l(e,t)%100,2),_=(e,t)=>(0,n.numberToStringWithLeadingZero)(l(e,t),4),m={"dd MMM 'yy":(e,t)=>`${h(e,t)} ${d(e,t)} '${p(e,t)}`,"MMM 'yy":(e,t)=>`${d(e,t)} '${p(e,t)}`,"MMM dd, yyyy":(e,t)=>`${d(e,t)} ${h(e,t)}, ${_(e,t)}`,"MMM yyyy":(e,t)=>`${d(e,t)} ${_(e,t)}`,"MMM dd":(e,t)=>`${d(e,t)} ${h(e,t)}`,"dd MMM":(e,t)=>`${h(e,t)} ${d(e,t)}`,"yyyy-MM-dd":(e,t)=>`${_(e,t)}-${u(e,t)}-${h(e,t)}`,"yy-MM-dd":(e,t)=>`${p(e,t)}-${u(e,t)}-${h(e,t)}`,"yy/MM/dd":(e,t)=>`${p(e,t)}/${u(e,t)}/${h(e,t)}`,"yyyy/MM/dd":(e,t)=>`${_(e,t)}/${u(e,t)}/${h(e,t)}`,"dd-MM-yyyy":(e,t)=>`${h(e,t)}-${u(e,t)}-${_(e,t)}`,"dd-MM-yy":(e,t)=>`${h(e,t)}-${u(e,t)}-${p(e,t)}`,"dd/MM/yy":(e,t)=>`${h(e,t)}/${u(e,t)}/${p(e,t)}`,"dd/MM/yyyy":(e,t)=>`${h(e,t)}/${u(e,t)}/${_(e,t)}`,"MM/dd/yy":(e,t)=>`${u(e,t)}/${h(e,t)}/${p(e,t)}`,"MM/dd/yyyy":(e,t)=>`${u(e,t)}/${h(e,t)}/${_(e,t)}`};function g(e){return"ja"===window.language?(t,i)=>`${m[e](t,i)} (${c(t)})`:(t,i)=>`${c(t)} ${m[e](t,i)}`}const f=Object.keys(m),v=()=>-1!==["ja","ko","zh","zh_TW"].indexOf(window.language||"")?"yyyy-MM-dd":"dd MMM 'yy"},53741:(e,t,i)=>{"use strict";i.d(t,{DateFormatter:()=>n});var s=i(1763),r=i(15879);class n{constructor(e="yyyy-MM-dd",t=!1){this._dateFormatFunc=t?(0,r.getDateFormatWithWeekday)(e):r.dateFormatFunctions[e]}format(e){return s.customFormatters&&s.customFormatters.dateFormatter?s.customFormatters.dateFormatter.format(e):this._dateFormatFunc(e,!1)}formatLocal(e){return s.customFormatters.dateFormatter?s.customFormatters.dateFormatter.formatLocal?s.customFormatters.dateFormatter.formatLocal(e):s.customFormatters.dateFormatter.format(e):this._dateFormatFunc(e,!0)}}},34928:(e,t,i)=>{"use strict";i.d(t,{DateTimeFormatter:()=>o});var s=i(79206),r=i(53741);const n={dateFormat:"yyyy-MM-dd",withWeekday:!1,timeFormat:s.hourMinuteSecondFormat,dateTimeSeparator:" "};class o{constructor(e={}){const t=Object.assign({},n,e);this._dateFormatter=new r.DateFormatter(t.dateFormat,t.withWeekday),this._timeFormatter=new s.TimeFormatter(t.timeFormat),this._separator=t.dateTimeSeparator}format(e){return`${this._dateFormatter.format(e)}${this._separator}${this._timeFormatter.format(e)}`}formatLocal(e){return`${this._dateFormatter.formatLocal(e)}${this._separator}${this._timeFormatter.formatLocal(e)}`}}},83854:(e,t,i)=>{"use strict";i.d(t,{formatterOptions:()=>r,numberToStringWithLeadingZero:()=>n});var s=i(1722);const r={decimalSign:".",decimalSignFractional:"'"};function n(e,t){if(!(0,s.isNumber)(e))return"n/a";if(!(0,
s.isInteger)(t))throw new TypeError("invalid length");if(t<0||t>24)throw new TypeError("invalid length");if(0===t)return e.toString();return("0000000000000000"+e.toString()).slice(-t)}},10786:(e,t,i)=>{"use strict";i.d(t,{LimitedPrecisionNumericFormatter:()=>r});var s=i(1722);class r{constructor(e=1){this._precision=e}format(e){(0,s.isNumber)(e)||(e=parseFloat(e));const t=e.toFixed(this._precision),i=Math.pow(10,-this._precision);return Math.max(parseFloat(t),i)+""}parse(e){const t=parseFloat(e);return isNaN(t)?{res:!1}:{res:!0,value:t,suggest:this.format(t)}}}},87663:(e,t,i)=>{"use strict";i.d(t,{NumericFormatter:()=>n});var s=i(60521),r=i(83854);class n{constructor(e){this._precision=e}format(e){return(void 0!==this._precision?e.toFixed(this._precision):n.formatNoE(e)).replace(".",r.formatterOptions.decimalSign)}parse(e){const t=e.replace(r.formatterOptions.decimalSign,".");let i=parseFloat(t);return this._precision&&(i=+i.toFixed(this._precision)),i}static formatNoE(e){if(!Number.isFinite(e))return String(e);const t=new s.Big(e);return t.lt(1)?t.toFixed():t.toString()}}},93572:(e,t,i)=>{"use strict";i.d(t,{PercentageFormatter:()=>n});var s=i(71766),r=i(38223);class n extends s.PriceFormatter{constructor(e){super(e),this.type="percentage"}state(){const e=s.PriceFormatter.prototype.state.call(this);return e.percent=!0,e}parse(e){return e=e.replace("%",""),super.parse(e)}format(e,t,i,s,n=!0){const o=super.format(e,t,i,s,!1)+"%";return n?(0,r.forceLTRStr)(o):o}static serialize(e){return e.state()}static deserialize(e){return new n(e.priceScale)}}},57322:(e,t,i)=>{"use strict";i.d(t,{PipFormatter:()=>n});var s=i(91349),r=i(71766);class n extends r.PriceFormatter{constructor(e,t,i,r,n){t||(t=1),("forex"===i||(0,s.isCFDSymbol)(i,n))&&r?(super(r),this._isForex=!0):(super(1),this._isForex=!1),this._pipPriceScale=e,this._pipMinMove=t,this._pipMinMove2=r}format(e,t,i){let s=this._isForex?this._pipMinMove2:this._pipMinMove;return void 0===s&&(s=NaN),super.format(e*this._pipPriceScale/s,t,i)}}},71766:(e,t,i)=>{"use strict";i.d(t,{PriceFormatter:()=>x});var s=i(1722),r=i(60521),n=i(59224),o=i(50151),a=i(11542),l=i(50335);function c(e){return e?(0,r.Big)(e.minMove).div(e.priceScale).toNumber():NaN}function h(e){const{minTick:t,price:i,variableMinTickData:s,shouldCheckForEquality:r}=e,n=(0,l.isNumber)(t)?d(t):t;return void 0===s?n:function(e,t,i=!1){for(let s=0;s(0,s.isEven)(t)?function(e){const t=Number(e);if(Number.isFinite(t))return d(t);{const t=e.split("/");if(t.length<2||t.length>3)throw new Error(`Unexpected mintick: ${e}`);const i=Number(t[1]),s=Number(t[0])
;if(!Number.isFinite(i)||!Number.isFinite(s))throw new Error(`Unexpected mintick: ${e}`);const r=3===t.length?Number(t[2]):void 0;if(void 0!==r&&!Number.isFinite(r))throw new Error(`Unexpected mintick: ${e}`);const n={priceScale:i,minMove:s};return void 0!==r&&(n.minMove2=r),n}}(e):function(e){const t=Number(e);if(Number.isNaN(t))throw new Error(`Unexpected price limit: ${e}`);return t}(e)));if((0,s.isEven)(e.length))throw new Error("Theme must not be event number of elements");const l=[];for(let t=0;t0&&t>0){let t=e;for(i&&s&&(t/=s);t>1;)t/=10,r++}return r}function g(e,t,i){const s=(0,o.ensureNotNull)(h({price:i,minTick:null,variableMinTickData:t,shouldCheckForEquality:!0})),{priceScale:r,minMove:n,minMove2:a}=s;return{priceScale:r,minMove:n,fractionalLength:m(r,n,e,a)}}class f{constructor(e,t,s,r,n,o){this._formatterErrors={custom:a.t(null,void 0,i(32061)),fraction:a.t(null,void 0,i(42015)),secondFraction:a.t(null,void 0,i(43247))},this._priceScale=e,this._minMove=t,this._minMove2=s,this._ignoreMinMove=n,this._variableMinTickData=void 0===r?void 0:u({priceScale:e,minMove:t,minMove2:s},r),this._fractionalLength=o}formatImpl(e,t,i,s=!0,r=!0,n=!1,o){let a="";e<0?a=!1===s?"":"−":e&&!0===t&&(a="+");const l=a+this._formatUnsigned(Math.abs(e),i,n,o);return r?(0,p.forceLTRStr)(l):l}parse(e){return"+"===(e=(e=(0,p.stripLTRMarks)(e)).replace("−","-"))[0]&&(e=e.substring(1)),this._parseUnsigned(e)}_removeEndingZeros(e,t){for(let i=0;i1e15)return this._formatAsExponential(t);const l=Math.pow(10,o)*i/(a?1:s),c=1/l;let h
;if(l>1)h=Math.floor(t);else{const e=Math.floor(Math.round(t/c)*c);h=0===Math.round((t-e)/c)?e:e+c}let d="";if(l>1){let e=a?new r.Big(t).mul(l).round(void 0,0).minus(new r.Big(h).mul(l)).toNumber():parseFloat((Math.round(t*l)-h*l).toFixed(n));e>=l&&(e-=l,h+=1);const i=a?new r.Big(e).round(n,0).toNumber():parseFloat(e.toFixed(n))*s;d=v.formatterOptions.decimalSign+(0,v.numberToStringWithLeadingZero)(i,n+o),d=this._removeEndingZeros(d,o)}return h.toString()+d}_parseAsDecimal(e){if(e.includes("e")){if(function(e){let t=S.get(e);return t||(t=new RegExp("^(-?)[0-9]+\\"+e+"[0-9]*e(-?)[0-9]+$"),S.set(e,t)),t}(v.formatterOptions.decimalSign).exec(e)){const t=parseFloat(e.replace(v.formatterOptions.decimalSign,"."));return{value:t,res:!0,suggest:this.formatImpl(t)}}return{error:this._formatterErrors.custom,res:!1}}let t=_.exec(e);if(t){const t=parseFloat(e);return{value:t,res:!0,suggest:this.formatImpl(t)}}if(t=function(e){let t=y.get(e);return t||(t=new RegExp("^(-?)[0-9]+\\"+v.formatterOptions.decimalSign+"[0-9]*$"),y.set(e,t)),t}(v.formatterOptions.decimalSign).exec(e),t){const t=parseFloat(e.replace(v.formatterOptions.decimalSign,"."));return{value:t,res:!0,suggest:this.formatImpl(t)}}return{error:this._formatterErrors.custom,res:!1}}}const C=(0,n.getLogger)("Chart.FractionalPriceFormatter");class P extends f{constructor(e,t,i,s,r,n){super(e,t,i,s,r,n),void 0!==i&&i>0&&2!==i&&4!==i&&8!==i&&C.logDebug("invalid minmove2")}hasForexAdditionalPrecision(){return!1}_parseUnsigned(e){return this._minMove2?this._parseAsDoubleFractional(e):this._parseAsSingleFractional(e)}_formatUnsigned(e,t,i,s){const r={price:Math.abs(e),priceScale:this._priceScale,minMove:this._minMove,minMove2:this._minMove2,fractionalLength:(0,o.ensureDefined)(this._fractionalLength),tailSize:t};return void 0!==this._variableMinTickData&&Object.assign(r,g(!0,this._variableMinTickData,null!=s?s:r.price)),this._formatAsFractional(r)}_parseAsSingleFractional(e){let t=_.exec(e);if(t){const t=parseFloat(e);return{value:t,res:!0,suggest:this.formatImpl(t)}}if(t=new RegExp("^(-?)([0-9]+)\\"+v.formatterOptions.decimalSignFractional+"([0-9]+)$").exec(e),t){const e=!!t[1],i=parseInt(t[2]),s=this._priceScale,r=this._patchFractPart(parseInt(t[3]),1,s);if(r>=s||r<0)return{error:this._formatterErrors.fraction,res:!1};let n=i+r/s;return e&&(n=-n),{value:n,res:!0,suggest:this.formatImpl(n)}}return{error:this._formatterErrors.custom,res:!1}}_parseAsDoubleFractional(e){let t=_.exec(e);if(t){const t=parseFloat(e);return{value:t,res:!0,suggest:this.formatImpl(t)}}if(t=new RegExp("^(-?)([0-9]+)\\"+v.formatterOptions.decimalSignFractional+"([0-9]+)\\"+v.formatterOptions.decimalSignFractional+"([0-9]+)$").exec(e),t){const e=!!t[1],i=parseInt(t[2]),s=void 0!==this._minMove2?this._minMove2:NaN,r=this._priceScale/s,n=this._minMove2,o=this._patchFractPart(parseInt(t[3]),1,r),a=this._patchFractPart(parseInt(t[4]),2,n);if(o>=r||o<0)return{error:this._formatterErrors.fraction,res:!1};if(void 0!==n&&a>=n||a<0)return{error:this._formatterErrors.secondFraction,res:!1}
;let l=void 0!==n?i+o/r+a/(r*n):NaN;return e&&(l=-l),{value:l,res:!0,suggest:this.formatImpl(l)}}return{error:this._formatterErrors.custom,res:!1}}_patchFractPart(e,t,i){const s={0:0,5:1},r={0:0,2:1,5:2,7:3},n={0:0,1:1,2:2,3:3,5:4,6:5,7:6,8:7};return 2===i?void 0===s[e]?-1:s[e]:4===i?void 0===r[e]?-1:r[e]:8===i&&2===t?void 0===n[e]?-1:n[e]:e}_formatAsFractional(e){const{price:t,tailSize:i,priceScale:s,minMove:r,minMove2:n,fractionalLength:o}=e,a=s/r;let l=Math.floor(t),c=i?Math.floor(t*a)-l*a:Math.round(t*a)-l*a;c===a&&(c=0,l+=1);let h="";if(i){let e=(t-l-c/a)*a;e=Math.round(e*Math.pow(10,i)),h=(0,v.numberToStringWithLeadingZero)(e,i),h=this._removeEndingZeros(h,i)}if(!o)throw new Error("_fractionalLength is not calculated");let d="";if(n){const e=c%n;c=(c-e)/n;const t=(0,v.numberToStringWithLeadingZero)(c,o),i=this._getFractPart(e,2,n);d=t+v.formatterOptions.decimalSignFractional+i}else c=this._getFractPart(c,1,s),d=(0,v.numberToStringWithLeadingZero)(c*r,o);return l.toString()+v.formatterOptions.decimalSignFractional+d+h}_getFractPart(e,t,i){const s=[0,5],r=[0,2,5,7],n=[0,1,2,3,5,6,7,8];return 2===i?void 0===s[e]?-1:s[e]:4===i?void 0===r[e]?-1:r[e]:8===i&&2===t?void 0===n[e]?-1:n[e]:e}}class x{constructor(e,t,i,r,n,o){if(this.type="price",t&&!o||(t=1),(0,s.isNumber)(e)&&(0,s.isInteger)(e)||(e=100),e<0)throw new TypeError("invalid base");this._priceScale=e,this._minMove=t,this._minMove2=r,this._fractional=i,this._variableMinTick=n,this._ignoreMinMove=o,this._fractionalLength=m(this._priceScale,this._minMove,this._fractional,this._minMove2),this._implementation=i?new P(e,t,r,n,o,this._fractionalLength):new w(e,t,r,n,o,this._fractionalLength)}isFractional(){return!!this._fractional}state(){return{minMove:this._minMove,minMove2:this._minMove2,priceScale:this._priceScale,variableMinTick:this._variableMinTick,ignoreMinMove:this._ignoreMinMove,fractional:this._fractional,fractionalLength:this._fractionalLength}}formatChange(e,t,i){return this._implementation.formatImpl(e-t,i,void 0,void 0,void 0,void 0,Math.min(Math.abs(e),Math.abs(t)))}format(e,t,i,s=!0,r=!0,n=!1){return this._implementation.formatImpl(e,t,i,s,r,n)}parse(e){return this._implementation.parse(e)}hasForexAdditionalPrecision(){return this._implementation.hasForexAdditionalPrecision()}static serialize(e){return e.state()}static deserialize(e){return new x(e.priceScale,e.minMove,e.fractional,e.minMove2,e.variableMinTick,e.ignoreMinMove)}}},79206:(e,t,i)=>{"use strict";i.d(t,{TimeFormatter:()=>u,hourMinuteFormat:()=>l,hourMinuteNonZeroSecondFormat:()=>o,hourMinuteSecondFormat:()=>n,hourMinuteSecondMillisecFormat:()=>a,twelveHourMinuteFormat:()=>d,twelveHourMinuteNonZeroSecondFormat:()=>h,twelveHourMinuteSecondFormat:()=>c});var s=i(1763),r=i(83854);const n="%h:%m:%s",o="%h:%m:%s+",a="%h:%m:%s.%ss+",l="%h:%m",c="%h:%m:%s %ampm",h="%h:%m:%s+ %ampm",d="%h:%m %ampm";class u{constructor(e){this._isTwelveHoursFormat=!1,this._valuesAndDelimeters=[];const t=e||n,i=new RegExp("%h|%m|%s\\+|%ss\\+|%ss|%ampm|%s","g");let s=i.exec(t),r=0;for(;null!==s;){const e=s[0]
;"%ampm"===e&&(this._isTwelveHoursFormat=!0);const n=t.substring(r,s.index);""!==n&&this._valuesAndDelimeters.push(n),this._valuesAndDelimeters.push(e),r=s.index+e.length,s=i.exec(t)}}format(e){return s.customFormatters.timeFormatter?s.customFormatters.timeFormatter.format(e):this._formatTime(e,!1)}formatLocal(e){return s.customFormatters.timeFormatter?s.customFormatters.timeFormatter.formatLocal?s.customFormatters.timeFormatter.formatLocal(e):s.customFormatters.timeFormatter.format(e):this._formatTime(e,!0)}_formatTime(e,t){let i=t?e.getHours():e.getUTCHours();const s=t?e.getMinutes():e.getUTCMinutes(),n=t?e.getSeconds():e.getUTCSeconds(),o=t?e.getMilliseconds():e.getUTCMilliseconds();let a="";this._isTwelveHoursFormat&&(a=i>=12?"PM":"AM",i%=12,i=i||12);let l="",c=!1;for(let e=this._valuesAndDelimeters.length-1;e>=0;e--){const t=this._valuesAndDelimeters[e];let h;switch(t){case"%h":h=(0,r.numberToStringWithLeadingZero)(i,2);break;case"%m":h=(0,r.numberToStringWithLeadingZero)(s,2);break;case"%s+":0!==n?h=(0,r.numberToStringWithLeadingZero)(n,2):(h="",c=!0);break;case"%s":h=(0,r.numberToStringWithLeadingZero)(n,2);break;case"%ss":h=(0,r.numberToStringWithLeadingZero)(o,3);break;case"%ss+":0!==o?h=(0,r.numberToStringWithLeadingZero)(o,3):(h="",c=!0);break;case"%ampm":h=a;break;default:if(c){c=!1;continue}h=t}l=h+l}return l}}},2043:(e,t,i)=>{"use strict";i.d(t,{TimeSpanFormatter:()=>r});var s=i(11542);class r{format(e){const t=e<0;e=Math.abs(e);const r=Math.floor(e/86400);e-=86400*r;const n=Math.floor(e/3600);e-=3600*n;const o=Math.floor(e/60);e-=60*o;let a="";return r&&(a+=r+s.t(null,{context:"dates"},i(97840))+" "),n&&(a+=n+s.t(null,{context:"dates"},i(64302))+" "),o&&(a+=o+s.t(null,{context:"dates"},i(79442))+" "),e&&(a+=e+s.t(null,{context:"dates"},i(22448))+" "),t&&(a="-"+a),a.trim()}}},98596:(e,t,i)=>{"use strict";i.d(t,{VolumeFormatter:()=>o});var s=i(11542),r=i(87663),n=i(1722);class o{constructor(e){this.type="volume",this._numericFormatter=new r.NumericFormatter,this._fractionalValues=void 0!==e&&e>0,this._precision=e}state(){return{precision:this._precision}}format(e,t){if(!(0,n.isNumber)(e))return"---";let r="";return e<0?(r="−",e=-e):e>0&&t&&(r="+"),e>=1e100?s.t(null,void 0,i(43088)):(!this._fractionalValues||e>=995?e=Math.round(e):this._fractionalValues&&(e=+e.toFixed(this._precision)),e<995?r+this._formatNumber(e):e<999995?r+this._formatNumber(e/1e3)+"K":e<999999995?(e=1e3*Math.round(e/1e3),r+this._formatNumber(e/1e6)+"M"):e<999999999995?(e=1e6*Math.round(e/1e6),r+this._formatNumber(e/1e9)+"B"):(e=1e9*Math.round(e/1e9),r+this._formatNumber(e/1e12)+"T"))}parse(e){if("---"===e)return{error:"not a number",res:!1,value:NaN};const t={K:1e3,M:1e6,B:1e9,T:1e12},i=e.slice(-1);if(t.hasOwnProperty(i)){const s=this._numericFormatter.parse(e.slice(0,-1));return(0,n.isNumber)(s)?{res:!0,value:s*t[i]}:{error:"not a number",res:!1,value:NaN}}{const t=this._numericFormatter.parse(e);return(0,n.isNumber)(t)?{res:!0,value:t}:{error:"not a number",res:!1,value:NaN}}}static serialize(e){return e.state()}
static deserialize(e){return new o(e.precision)}_formatNumber(e){if(this._fractionalValues&&0!==e){const t=14-Math.ceil(Math.log10(e)),i=Math.pow(10,t);e=Math.round(e*i)/i}return this._numericFormatter.format(e).replace(/(\.[1-9]*)0+$/,((e,t)=>t))}}},92052:(e,t,i)=>{"use strict";i.d(t,{getPriceValueFormatterForSource:()=>l,getPriceValueFormatterForStudy:()=>c,shouldBeFormattedAsIndexedTo100:()=>o,shouldBeFormattedAsPercent:()=>n});var s=i(42960),r=i(18611);function n(e){const t=e.priceScale();return!(null===t||!t.isPercentage())&&(!(0,r.isActingAsSymbolSource)(e)||(0,s.isPriceSourceStyle)(e.style()))}function o(e){const t=e.priceScale();return!(null===t||!t.isIndexedTo100())&&(!(0,r.isActingAsSymbolSource)(e)||(0,s.isPriceSourceStyle)(e.style()))}function a(e){const t=e.priceScale();return o(e)&&null!==t?i=>{var s;return t.formatPriceIndexedTo100(i,null!==(s=e.firstValue())&&void 0!==s?s:100)}:n(e)&&null!==t?i=>{var s;return t.formatPricePercentage(i,null!==(s=e.firstValue())&&void 0!==s?s:100)}:null}function l(e){const t=a(e);if(t)return t;const i=e.formatter();return i.format.bind(i)}function c(e,t){const i=a(e);if(i)return i;const s=e.plotFormatter(t);return s.format.bind(s)}},18807:(e,t,i)=>{"use strict";function s(e,t,i){if(e.isTouch){if(void 0!==i)return i(e),!0}else if(void 0!==t)return t(e),!0;return!1}function r(e,t,i,s){return void 0!==t.executeDefaultAction&&(e.isTouch?Boolean(t.executeDefaultAction[s]):Boolean(t.executeDefaultAction[i]))}var n,o;function a(e,t){return e&&t&&e.equals&&t.equals?e.equals(t):e===t}i.d(t,{AreaName:()=>n,HitTarget:()=>o,HitTestResult:()=>l,hitTestResultDataAreEqual:()=>a,shouldDefaultActionBeExecuted:()=>r,tryCallHandler:()=>s}),function(e){e.Style="Style",e.Text="Text",e.Line="Line",e.Tooltip="Tooltip",e.Button="Button",e.SourceItemMove="SourceItemMove"}(n||(n={})),function(e){e[e.MovePointBackground=1]="MovePointBackground",e[e.Regular=2]="Regular",e[e.MovePoint=3]="MovePoint",e[e.ChangePoint=4]="ChangePoint",e[e.Custom=5]="Custom"}(o||(o={}));class l{constructor(e,t,i){this._target=e,this._data=t||null,this._eraseMarker=i}target(){return this._target}data(){return this._data}hasPressedMoveHandler(e){return null!==this._data&&function(e,t,i){if(e.isTouch){if(void 0!==i)return!0}else if(void 0!==t)return!0;return!1}(e,this._data.pressedMouseMoveHandler,this._data.touchMoveHandler)}tryCallMouseDownOrTouchStartHandler(e){return null!==this._data&&s(e,this._data.mouseDownHandler,this._data.touchStartHandler)}tryCallMouseUpOrTouchEndHandler(e){return null!==this._data&&s(e,this._data.mouseUpHandler,this._data.touchEndHandler)}tryCallMouseEnterHandler(e){return null!==this._data&&s(e,this._data.mouseEnterHandler)}tryCallMouseLeaveHandler(e){return null!==this._data&&s(e,this._data.mouseLeaveHandler)}tryCallMouseMoveHandler(e){return null!==this._data&&s(e,this._data.mouseMoveHandler)}tryCallClickOrTapHandler(e){return null!==this._data&&s(e,this._data.clickHandler,this._data.tapHandler)}tryCallDblClickOrDblTapHandler(e){
return null!==this._data&&s(e,this._data.doubleClickHandler,this._data.doubleTapHandler)}tryCallContextMenuHandler(e){return null!==this._data&&s(e,this._data.contextMenuHandler,this._data.touchContextMenuHandler)}eraseMarker(){return this._eraseMarker}}},38003:(e,t,i)=>{"use strict";i.d(t,{HorizontalLinePaneView:()=>n});var s=i(74997),r=i(79849);class n{constructor(){this._lineRendererData={y:0,color:"rgba(0, 0, 0, 0)",linewidth:1,linestyle:r.LINESTYLE_SOLID,visible:!1},this._lineRenderer=new s.HorizontalLineRenderer,this._invalidated=!0,this._lineRenderer.setData(this._lineRendererData)}update(e){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._lineRenderer}}},67980:(e,t,i)=>{"use strict";var s,r;i.d(t,{CustomSourceLayer:()=>o,PlDisplay:()=>s,TradedGroupHorizontalAlignment:()=>r,tradingPreferencesDefault:()=>n}),function(e){e[e.Money=0]="Money",e[e.Pips=1]="Pips",e[e.Percentage=2]="Percentage"}(s||(s={})),function(e){e[e.Left=0]="Left",e[e.Center=1]="Center",e[e.Right=2]="Right"}(r||(r={}));const n={showPositions:!1,positionPL:{visibility:!1,display:s.Money},bracketsPL:{visibility:!1,display:s.Money},showOrders:!1,showExecutions:!1,showExecutionsLabels:!1,showReverse:!1,extendLeft:!1,lineLength:0,horizontalAlignment:r.Right,lineWidth:0,lineStyle:0};var o;!function(e){e[e.Background=0]="Background",e[e.Foreground=1]="Foreground",e[e.Topmost=2]="Topmost"}(o||(o={}))},37591:(e,t,i)=>{"use strict";var s;i.d(t,{TitleDisplayTarget:()=>s}),function(e){e[e.DataWindow=2]="DataWindow",e[e.StatusLine=8]="StatusLine"}(s||(s={}))},36274:(e,t,i)=>{"use strict";i.d(t,{Interval:()=>h,ResolutionKind:()=>n,SpecialResolutionKind:()=>o,isHour:()=>u});const s=/^(\d*)([TSHDWMR])$/,r=/^(\d+)$/;var n,o;!function(e){e.Ticks="ticks",e.Seconds="seconds",e.Minutes="minutes",e.Days="days",e.Weeks="weeks",e.Months="months",e.Range="range",e.Invalid="invalid"}(n||(n={})),function(e){e.Hours="hours"}(o||(o={}));const a={};a[n.Ticks]=1e3,a[n.Seconds]=1e3,a[n.Minutes]=60*a[n.Seconds],a[n.Days]=1440*a[n.Minutes],a[n.Weeks]=7*a[n.Days];const l={T:n.Ticks,S:n.Seconds,D:n.Days,W:n.Weeks,M:n.Months,R:n.Range},c=new Set([n.Ticks,n.Seconds,n.Minutes]);class h{constructor(e,t){this._kind=n.Invalid,this._multiplier=0,e!==n.Invalid&&t>0&&(this._kind=e,this._multiplier=t)}kind(){return this._kind}multiplier(){return this._multiplier}isValid(){return this.kind()!==n.Invalid&&this.multiplier()>0}isDWM(){return this.isValid()&&!this.isRange()&&!this.isIntraday()&&!this.isTicks()}isIntraday(){const e=c.has(this.kind());return this.isValid()&&e}isSeconds(){return this.kind()===n.Seconds}isMinutes(){return this.kind()===n.Minutes}isMinuteHours(){return this.kind()===n.Minutes&&u(this.multiplier())}isDays(){return this.kind()===n.Days}isWeeks(){return this.kind()===n.Weeks}isMonths(){return this.kind()===n.Months}isRange(){return this.kind()===n.Range}isTicks(){return this.kind()===n.Ticks}isTimeBased(){return!this.isRange()}letter(){
return this.isValid()&&this.kind()!==n.Minutes?this.kind()[0].toUpperCase():""}value(){return this.isValid()?this.kind()===n.Minutes?this.multiplier()+"":this.multiplier()+this.letter():""}isEqualTo(e){if(!(e instanceof h))throw new Error("Argument is not an Interval");return!(!this.isValid()||!e.isValid())&&(this.kind()===e.kind()&&this.multiplier()===e.multiplier())}inMilliseconds(e=Date.now()){if(!this.isValid()||this.isRange())return NaN;if(this.isMonths()){const t=new Date(e);t.setUTCMonth(t.getUTCMonth()+(this.multiplier()||1));return+t-e}const t=this.multiplier();return a[this.kind()]*t}static isEqual(e,t){return e===t||h.parse(e).isEqualTo(h.parse(t))}static parseExt(e){e=(e+"").toUpperCase().split(",")[0];let t=s.exec(e);return null!==t?"H"===t[2]?{interval:new h(n.Minutes,60*d(t[1])),guiResolutionKind:o.Hours}:{interval:new h(l[t[2]],d(t[1])),guiResolutionKind:l[t[2]]}:(t=r.exec(e),null!==t?{interval:new h(n.Minutes,d(t[1])),guiResolutionKind:n.Minutes}:{interval:new h(n.Invalid,0),guiResolutionKind:n.Invalid})}static parse(e){return h.parseExt(e).interval}static kind(e){return h.parse(e).kind()}static isValid(e){return h.parse(e).isValid()}static isDWM(e){return h.parse(e).isDWM()}static isIntraday(e){return h.parse(e).isIntraday()}static isSeconds(e){return h.parse(e).isSeconds()}static isMinutes(e){return h.parse(e).isMinutes()}static isMinuteHours(e){return h.parse(e).isMinuteHours()}static isDays(e){return h.parse(e).isDays()}static isWeeks(e){return h.parse(e).isWeeks()}static isMonths(e){return h.parse(e).isMonths()}static isRange(e){return h.parse(e).isRange()}static isTicks(e){return h.parse(e).isTicks()}static isTimeBased(e){return h.parse(e).isTimeBased()}static normalize(e){const t=h.parse(e);return t.isValid()?t.value():null}}function d(e){return 0===e.length?1:parseInt(e,10)}function u(e){return e>=60&&!(e%60)}},17236:(e,t,i)=>{"use strict";i.d(t,{intervalsVisibilitiesDefaults:()=>s});const s={ticks:!0,seconds:!0,secondsFrom:1,secondsTo:59,minutes:!0,minutesFrom:1,minutesTo:59,hours:!0,hoursFrom:1,hoursTo:24,days:!0,daysFrom:1,daysTo:366,weeks:!0,weeksFrom:1,weeksTo:52,months:!0,monthsFrom:1,monthsTo:12,ranges:!0}},38349:(e,t,i)=>{"use strict";i.d(t,{IntervalsVisibilitiesProperty:()=>r});var s=i(88640);i(4949);class r extends s.default{state(e){return super.state(e)}storeStateIfUndefined(){return!1}}},4949:(e,t,i)=>{"use strict";i.d(t,{getIntervalsVisibilitiesForMode:()=>u,isActualInterval:()=>h,makeIntervalsVisibilitiesVisibleAtInterval:()=>l,mergeIntervalVisibilitiesDefaults:()=>d});var s=i(14314),r=i(27788),n=i(50151),o=i(36274),a=i(17236);function l(e,t){let i=t.multiplier();if(t.isTicks()&&(e.ticks=!0),t.isSeconds()&&(i<60?(e.seconds=!0,e.secondsFrom=Math.min(e.secondsFrom,i),e.secondsTo=Math.max(e.secondsTo,i)):(i=Math.floor(i/60),t=new o.Interval(o.ResolutionKind.Minutes,i))),t.isMinutes())if(i<60)e.minutes=!0,e.minutesFrom=Math.min(e.minutesFrom,i),e.minutesTo=Math.max(e.minutesTo,i);else{const t=Math.floor(i/60);e.hours=!0,e.hoursFrom=Math.min(e.hoursFrom,t),
e.hoursTo=Math.max(e.hoursTo,t)}t.isDays()&&(e.days=!0,e.daysFrom=Math.min(e.daysFrom,i),e.daysTo=Math.max(e.daysTo,i)),t.isWeeks()&&(e.weeks=!0,e.weeksFrom=Math.min(e.weeksFrom,i),e.weeksTo=Math.max(e.weeksTo,i)),t.isMonths()&&(e.months=!0,e.monthsFrom=Math.min(e.monthsFrom,i),e.monthsTo=Math.max(e.monthsTo,i)),t.isRange()&&(e.ranges=!0)}function c(e,t,i,s){return e&&s>=t&&s<=i}function h(e,t){const i=t.childs();switch(e.kind()){case o.ResolutionKind.Ticks:return i.ticks.value();case o.ResolutionKind.Seconds:if(e.multiplier()<60)return c(i.seconds.value(),i.secondsFrom.value(),i.secondsTo.value(),e.multiplier());{const t=Math.floor(e.multiplier()/60);return c(i.minutes.value(),i.minutesFrom.value(),i.minutesTo.value(),t)}case o.ResolutionKind.Minutes:if(e.multiplier()<60)return c(i.minutes.value(),i.minutesFrom.value(),i.minutesTo.value(),e.multiplier());{const t=Math.floor(e.multiplier()/60);return c(i.hours.value(),i.hoursFrom.value(),i.hoursTo.value(),t)}case o.ResolutionKind.Days:return c(i.days.value(),i.daysFrom.value(),i.daysTo.value(),e.multiplier());case o.ResolutionKind.Weeks:return c(i.weeks.value(),i.weeksFrom.value(),i.weeksTo.value(),e.multiplier());case o.ResolutionKind.Months:return c(i.months.value(),i.monthsFrom.value(),i.monthsTo.value(),e.multiplier());case o.ResolutionKind.Range:return i.ranges.value()}return(0,n.assert)(!1,`Unsupported resolution: ${e.value()}`),!1}function d(e){return(0,s.default)((0,r.default)(a.intervalsVisibilitiesDefaults),null!=e?e:{})}function u(e,t){if(0===t||e.isTicks()&&3===t||e.isRange()&&2===t)return d();let i=!1;const s={ticks:!1,seconds:!1,minutes:!1,hours:!1,days:!1,weeks:!1,months:!1,ranges:!1},r=e=>e.multiplier();return[{checker:e=>e.isTicks(),getIntervalMultiplier:r,markIntervalAsVisible:(e,t)=>{s.ticks=!0}},{checker:e=>e.isSeconds()&&e.multiplier()<60,getIntervalMultiplier:r,markIntervalAsVisible:(e,t)=>{s.seconds=!0,s.secondsFrom=e,s.secondsTo=t}},{checker:e=>e.isSeconds()&&e.multiplier()>=60,getIntervalMultiplier:e=>Math.floor(e.multiplier()/60),markIntervalAsVisible:(e,t)=>{s.minutes=!0,s.minutesFrom=e,s.minutesTo=t}},{checker:e=>e.isMinutes()&&e.multiplier()<60,getIntervalMultiplier:r,markIntervalAsVisible:(e,t)=>{s.minutes=!0,s.minutesFrom=e,s.minutesTo=t}},{checker:e=>e.isMinutes()&&e.multiplier()>=60,getIntervalMultiplier:e=>Math.floor(e.multiplier()/60),markIntervalAsVisible:(e,t)=>{s.hours=!0,s.hoursFrom=e,s.hoursTo=t}},{checker:e=>e.isDays(),getIntervalMultiplier:r,markIntervalAsVisible:(e,t)=>{s.days=!0,s.daysFrom=e,s.daysTo=t}},{checker:e=>e.isWeeks(),getIntervalMultiplier:r,markIntervalAsVisible:(e,t)=>{s.weeks=!0,s.weeksFrom=e,s.weeksTo=t}},{checker:e=>e.isMonths(),getIntervalMultiplier:r,markIntervalAsVisible:(e,t)=>{s.months=!0,s.monthsFrom=e,s.monthsTo=t}},{checker:e=>e.isRange(),getIntervalMultiplier:r,markIntervalAsVisible:(e,t)=>{s.ranges=!0}}].forEach((s=>{if(s.checker(e)){i=!0;const r=s.getIntervalMultiplier(e);1===t?s.markIntervalAsVisible(r,r):3===t?s.markIntervalAsVisible(r,void 0):s.markIntervalAsVisible(void 0,r)
}else(!i&&2===t||i&&3===t)&&s.markIntervalAsVisible(void 0,void 0)})),d(s)}},86094:(e,t,i)=>{"use strict";var s;i.d(t,{PlotRowSearchMode:()=>s}),function(e){e[e.NearestLeft=-1]="NearestLeft",e[e.Exact=0]="Exact",e[e.NearestRight=1]="NearestRight"}(s||(s={}))},3587:(e,t,i)=>{"use strict";function s(e){return Boolean(e.showInObjectTree)}i.d(t,{isDataSource:()=>s})},1803:(e,t,i)=>{"use strict";var s;i.d(t,{SymbolErrorPermissionDeniedReason:()=>s,invalidSymbol:()=>n,permissionDenied:()=>r}),function(e){e.Symbol="symbol",e.GroupPermission="group"}(s||(s={}));const r="permission denied",n="invalid symbol"},18611:(e,t,i)=>{"use strict";function s(e){const t=(null==e?void 0:e.symbolSource)&&e.symbolSource()===e,i=void 0!==(null==e?void 0:e.isActingAsSymbolSource);return t||i}function r(e){return s(e)&&"quotesProvider"in e}function n(e){return s(e)&&e.isActingAsSymbolSource().value()}i.d(t,{isActingAsSymbolSource:()=>n,isSymbolSource:()=>s,isSymbolSourceWithQuotesProvider:()=>r})},32818:(e,t,i)=>{"use strict";i.d(t,{alwaysShowLastPriceAndLastDayChange:()=>s,lastDayChangeAvailable:()=>r});i(14483);const s=!1,r=!1},53801:(e,t,i)=>{"use strict";i.d(t,{LevelsProperty:()=>m});var s=i(27788),r=i(14314),n=i(1722),o=i(46100),a=i(85804);const l={prefixes:[""],range:[0,0],names:["coeff","color","visible","linestyle","linewidth"],typecheck:{pack:()=>Object(),unpack:()=>[]}};function c(e,t,i,s){return s.push(i[t]),s}function h(e,t,i,s){return s[t]=i[e],s}function d(){return[]}function u(){return{}}function p(e,t,i){return i.prefixes.forEach((s=>{const r=s+"level";for(let s=i.range[0];s<=i.range[1];s++)if(e[r+s]&&(0,n.isSameType)(e[r+s],t.typecheck())){let n=t.tpl();i.names.forEach(((i,o)=>{n=t.fill(""+o,i,e[r+s],n)})),e[r+s]=n}})),e}function _(e,t,i){return i(e,{tpl:u,fill:h,typecheck:t.typecheck.unpack},t)}class m extends o.DefaultProperty{constructor(e,t,i,s,r){r=null!=r?r:p;const n={...l,...null!=s?s:{}};super(e,t?_(t,n,r):t,i),this._map=n,this._levelsIterator=r}state(e,t){const i=super.state(e);return t?i:(s=i,r=this._map,(0,this._levelsIterator)(s,{tpl:d,fill:c,typecheck:r.typecheck.pack},r));var s,r}applyTemplate(e,t){this.mergePreferences((0,r.default)((0,s.default)(t),_(e,this._map,this._levelsIterator)))}saveDefaults(){this._useUserPreferences&&(0,a.saveDefaults)(this._defaultName,this.state(this._exclusions,!0))}clone(){const e=this.state(),t=new m(this._defaultName,e);for(let e=0;e{"use strict";i.d(t,{LineToolsGroup:()=>l});var s=i(57898),r=i(97145),n=i(36174);function o(e){return e.properties().visible.value()}function a(e){return!o(e)}class l{constructor(e,t,i){this._instanceId=(0,n.randomHashN)(6),this._onChanged=new s.Delegate,this._lineToolsSet=new Set,this._lineTools=[...e],this._lineToolsSet=new Set(this._lineTools),this._name=new r.WatchedValue(t),this.id=i||(0,n.randomHashN)(6)}instanceId(){return this._instanceId}lineTools(){return this._lineTools}name(){
return this._name}setName(e){this._doAndFireOnChange((()=>{this._name.setValue(e)}))}isActualSymbol(){return this._lineTools.length>0&&this._lineTools[0].isActualSymbol()&&this._lineTools[0].isActualCurrency()&&this._lineTools[0].isActualUnit()}symbol(){return this._lineTools[0].symbol()}currencyId(){var e;return null!==(e=this._lineTools[0].properties().childs().currencyId.value())&&void 0!==e?e:null}unitId(){var e;return null!==(e=this._lineTools[0].properties().childs().unitId.value())&&void 0!==e?e:null}sharingMode(){return this._lineTools[0].sharingMode()}share(e){this._lineTools.forEach((t=>t.share(e)))}containsLineTool(e){return this._lineToolsSet.has(e)}addLineTools(e){this._doAndFireOnChange((t=>{e.forEach((e=>this._lineToolsSet.add(e))),this._lineTools.push(...e),t.push(...e.map((e=>e.id())))}))}excludeLineTool(e){this._doAndFireOnChange((t=>{this._lineToolsSet.delete(e);const i=this._lineTools.indexOf(e);this._lineTools.splice(i,1),t.push(e.id())}))}excludeLineTools(e){this._doAndFireOnChange((t=>{const i=new Set(e);e.forEach((e=>this._lineToolsSet.delete(e))),this._lineTools=this._lineTools.filter((e=>!i.has(e))),t.push(...e.map((e=>e.id())))}))}state(){return{id:this.id,name:this._name.value(),tools:this._lineTools.map((e=>e.id()))}}visibility(){const e=this._lineTools.some(o),t=this._lineTools.some(a);return e&&!t?"Visible":t&&!e?"Invisible":"Partial"}locked(){const e=this._lineTools.some((e=>e.properties().frozen.value())),t=this._lineTools.some((e=>!e.properties().frozen.value()));return e&&!t?"Locked":t&&!e?"Unlocked":"Partial"}isActualInterval(){const e=this._lineTools.some((e=>e.isActualInterval())),t=this._lineTools.some((e=>!e.isActualInterval()));return e&&!t?"IsActualInterval":t&&!e?"IsNotActualInterval":"Partial"}onChanged(){return this._onChanged}static fromState(e,t){const i=[];for(const s of t.tools){const t=e.dataSourceForId(s);null!==t&&i.push(t)}return i.length>0?new l(i,t.name,t.id):null}_doAndFireOnChange(e){const t=[],i=this.visibility(),s=this.locked(),r=this.isActualInterval();e(t),this._onChanged.fire({affectedLineTools:t,visibilityChanged:i!==this.visibility(),lockedChanged:s!==this.locked(),isActualIntervalChanged:r!==this.isActualInterval()})}}},71902:(e,t,i)=>{"use strict";i.d(t,{LineTool5PointsPattern:()=>a});var s=i(50151),r=i(46100),n=i(13087),o=i(68806);class a extends n.LineDataSource{constructor(e,t,i,s){super(e,t||a.createProperties(),i,s),this._loadPaneViews(e)}pointsCount(){return 5}name(){return"XABCD Pattern"}static createProperties(e){const t=new r.DefaultProperty("linetool5pointspattern",e);return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,25107)).then((e=>e.PatternWithBackgroundDefinitionViewModel))}_loadPaneViews(e){i.e(1583).then(i.bind(i,24424)).then((t=>{this._setPaneViews([new t.Pattern5pointsPaneView(this,e)])}))}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new o.LineToolColorsProperty([(0,
s.ensureDefined)(e.child("color"))])),e.addChild("textsColors",new o.LineToolColorsProperty([(0,s.ensureDefined)(e.child("textcolor"))]))}}},19194:(e,t,i)=>{"use strict";i.d(t,{LineToolABCD:()=>a});var s=i(50151),r=i(46100),n=i(13087),o=i(68806);class a extends n.LineDataSource{constructor(e,t,s,r){const n=t||a.createProperties();super(e,n,s,r),i.e(1583).then(i.bind(i,5480)).then((t=>{this._setPaneViews([new t.ABCDPaneView(this,e)])}))}pointsCount(){return 4}name(){return"ABCD Pattern"}static createProperties(e){const t=new r.DefaultProperty("linetoolabcd",e);return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,63311)).then((e=>e.PatternWithoutBackgroundDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new o.LineToolColorsProperty([(0,s.ensureDefined)(e.child("color"))])),e.addChild("textsColors",new o.LineToolColorsProperty([(0,s.ensureDefined)(e.child("textcolor"))]))}}},86902:(e,t,i)=>{"use strict";i.d(t,{LineToolArc:()=>h});var s=i(50151),r=i(4652),n=i(86441),o=i(25422),a=i(46100),l=i(13087),c=i(68806);class h extends l.LineDataSource{constructor(e,t,s,r){const n=t||h.createProperties();super(e,n,s,r),this.version=2,this._dist=null,i.e(1583).then(i.bind(i,37803)).then((({ArcPaneView:t})=>{const i=[new t(this,e)];this._setPaneViews(i)}))}startChanging(e,t){if(super.startChanging(e,t),0===e||1===e){const e=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),t=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[2]));this._dist=(0,r.distanceToLine)(e,t,i).distance;const o=t.subtract(e),a=new n.Point(-o.y,o.x),l=e.add(t).scaled(.5);i.subtract(l).dotProduct(a)<0&&(this._dist=-this._dist)}}endChanging(e,t){return this._dist=null,super.endChanging(e,t)}pointsCount(){return 3}name(){return"Arc"}hasEditableCoordinates(){return!1}setPoint(e,t){const i={...t},a=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),l=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1]));switch(e){case 0:{const e=(0,s.ensureNotNull)(this._dist),t=(0,s.ensureNotNull)(this.pointToScreenPoint(i)),r=l.subtract(t),o=t.add(l).scaled(.5);let a=new n.Point(-r.y,r.x);a=a.normalized();const c=o.add(a.scaled(e));this._points[0]=i,this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(c));break}case 1:{const e=(0,s.ensureNotNull)(this._dist),t=(0,s.ensureNotNull)(this.pointToScreenPoint(i)),r=t.subtract(a),o=a.add(t).scaled(.5),l=new n.Point(-r.y,r.x).normalized(),c=o.add(l.scaled(e));this._points[1]=i,this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(c));break}case 2:{let e=(0,s.ensureNotNull)(this.pointToScreenPoint(i));const t=(0,r.distanceToLine)(a,l,e).distance,c=l.subtract(a),h=a.add(l).scaled(.5),d=new n.Point(-c.y,c.x).normalized(),u=h.add(d.scaled(t)),p=h.add(d.scaled(-t)),_=c.length(),m=c.x/_,g=c.y/_;let f=Math.acos(m);g<0&&(f=-f);let v=(0,o.translationMatrix)(-h.x,-h.y)
;e=(0,o.transformPoint)(v,e);let S=(0,o.transformPoint)(v,u);v=(0,o.rotationMatrix)(-f),e=(0,o.transformPoint)(v,e),S=(0,o.transformPoint)(v,S),v=(0,o.scalingMatrix)(1,_/(2*t)),e=(0,o.transformPoint)(v,e),S=(0,o.transformPoint)(v,S);const y=e.y*S.y>=0?new n.Point(u.x,u.y):new n.Point(p.x,p.y);this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(y));break}}this.normalizePoints()}migrateVersion(e,t,i){if(1===e&&2===this._points.length){const e=(2*this._points[0].price+3*this._points[1].price)/5;this._points.push({price:e,index:this._points[1].index})}if(1===e&&2===this._timePoint.length){const e={price:(2*this._timePoint[0].price+3*this._timePoint[1].price)/5,offset:this._timePoint[1].offset,time_t:this._timePoint[1].time_t};this._timePoint.push(e)}}static createProperties(e){const t=new a.DefaultProperty("linetoolarc",e);return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,20061))).GeneralFiguresDefinitionsViewModelBase}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new c.LineToolColorsProperty([e.childs().color]))}}},20521:(e,t,i)=>{"use strict";i.d(t,{LineToolArrowMark:()=>a,LineToolArrowMarkDown:()=>d,LineToolArrowMarkLeft:()=>l,LineToolArrowMarkRight:()=>h,LineToolArrowMarkUp:()=>c});var s=i(46100),r=i(13087),n=i(88640),o=i(68806);class a extends r.LineDataSource{constructor(e,t,s,r,n){const o=t||a.createProperties(null,s);super(e,o,r,n),this._textPaneView=null,i.e(1583).then(i.bind(i,93011)).then((({ArrowMarkPaneView:t})=>{const i=[new t(this,e)];this._setPaneViews(i)}))}paneViews(e){const t=super.paneViews();return null!==t&&this._textPaneView&&t.push(this._textPaneView),t}pointsCount(){return 1}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}static createProperties(e,t){const i=new s.DefaultProperty(t,e);return this._configureProperties(i),i}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,73896)).then((e=>e.ArrowMarkDefinitionsViewModel))}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new o.LineToolColorsProperty([e.childs().arrowColor])),e.addChild("textsColors",new o.LineToolColorsProperty([e.childs().color])),e.hasChild("text")||e.addChild("text",new n.default("")),e.addExclusion("text")}}a.version=2;class l extends a{constructor(e,t,i,s){super(e,t,"linetoolarrowmarkleft",i,s)}direction(){return"left"}name(){return"Arrow Mark Left"}textAlignParams(){return{horzAlign:"left",vertAlign:"middle",offsetX:22,offsetY:3}}static createProperties(e){return super.createProperties(e,"linetoolarrowmarkleft")}}class c extends a{constructor(e,t,i,s){super(e,t,"linetoolarrowmarkup",i,s)}direction(){return"up"}name(){return"Arrow Mark Up"}textAlignParams(){return{horzAlign:"center",vertAlign:"top",
offsetX:0,offsetY:20}}static createProperties(e){return super.createProperties(e,"linetoolarrowmarkup")}}class h extends a{constructor(e,t,i,s){super(e,t,"linetoolarrowmarkright",i,s)}direction(){return"right"}name(){return"Arrow Mark Right"}textAlignParams(){return{horzAlign:"right",vertAlign:"middle",offsetX:22,offsetY:3,forceTextAlign:!0}}static createProperties(e){return super.createProperties(e,"linetoolarrowmarkright")}}class d extends a{constructor(e,t,i,s){super(e,t,"linetoolarrowmarkdown",i,s)}direction(){return"down"}name(){return"Arrow Mark Down"}textAlignParams(){return{horzAlign:"center",vertAlign:"bottom",offsetX:0,offsetY:20}}static createProperties(e){return super.createProperties(e,"linetoolarrowmarkdown")}}},91439:(e,t,i)=>{"use strict";i.d(t,{LineToolArrowMarker:()=>o});var s=i(13087),r=i(46100),n=i(88640);class o extends s.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:o.createProperties(),s,r),i.e(1583).then(i.bind(i,97747)).then((({ArrowMarkerPaneView:e})=>{this._setPaneViews([new e(this,this.model())])}))}pointsCount(){return 2}name(){return"Trend Line"}static createProperties(e){const t=new r.DefaultProperty("linetoolarrowmarker",e);return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,57239)).then((e=>e.ArrowMarkerDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new n.default("")),e.addExclusion("text")}}},36992:(e,t,i)=>{"use strict";i.d(t,{LineToolArrow:()=>r});var s=i(47246);class r extends s.LineToolTrendLine{constructor(e,t,i,s){super(e,null!=t?t:r.createProperties(),i,s)}name(){return"Arrow"}static createProperties(e){const t=s.LineToolTrendLine._createPropertiesImpl("linetoolarrow",e);return r._configureProperties(t),t}}},38440:(e,t,i)=>{"use strict";i.d(t,{LineToolBalloon:()=>c});var s=i(11542),r=i(46100),n=i(13087),o=i(88640),a=i(68806);const l=s.t(null,void 0,i(19372));class c extends n.LineDataSource{constructor(e,t,i,s){super(e,t||c.createProperties(),i,s),this._createPaneView()}pointsCount(){return 1}name(){return"Balloon"}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}shouldBeRemovedOnDeselect(){return""===this._properties.childs().text.value().trim()}static createProperties(e){const t=new r.DefaultProperty("linetoolballoon",e);return this._configureProperties(t),t}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,38534)).then((e=>e.BalloonDefinitionsViewModel))}_createPaneView(){i.e(1583).then(i.bind(i,74718)).then((e=>{this._setPaneViews([new e.BalloonPaneView(this,this._model)])}))}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new o.default(l)),e.addExclusion("text"),
e.addChild("linesColors",new a.LineToolColorsProperty([e.childs().borderColor])),e.addChild("textsColors",new a.LineToolColorsProperty([e.childs().color]))}}},99987:(e,t,i)=>{"use strict";var s;i.d(t,{LineToolBarsPatternMode:()=>s}),function(e){e[e.Bars=0]="Bars",e[e.Line=1]="Line",e[e.OpenClose=2]="OpenClose",e[e.LineOpen=3]="LineOpen",e[e.LineHigh=4]="LineHigh",e[e.LineLow=5]="LineLow",e[e.LineHL2=6]="LineHL2"}(s||(s={}))},2823:(e,t,i)=>{"use strict";i.d(t,{LineToolBarsPattern:()=>S});var s=i(50151),r=i(11542),n=i(36298),o=i(1722),a=i(39347),l=i(46100),c=i(86094),h=i(13087),d=i(99987),u=i(28558);const p=new n.TranslatedString("mirror bars pattern",r.t(null,void 0,i(81870))),_=new n.TranslatedString("flip bars pattern",r.t(null,void 0,i(59942))),m=r.t(null,void 0,i(63158)),g=r.t(null,void 0,i(92754)),f={0:2,1:4,2:1,3:1,4:2,5:3,6:-1},v={0:3,1:4,2:4,3:1,4:2,5:3,6:-1};class S extends h.LineDataSource{constructor(e,t=S.createProperties(),s,r){super(e,t,s,r),this._pattern=[],this._scale=1,this._pointsCoordinatePricesDiff=null;const n=t.childs().mode.value();(0,o.isString)(n)&&t.childs().mode.setValue(parseInt(n)),t.childs().mirrored.listeners().subscribe(this,this._mirror),t.childs().flipped.listeners().subscribe(this,this._flip),t.childs().mode.subscribe(this,this._updateLastPoint),this.version=2,i.e(1583).then(i.bind(i,45371)).then((t=>{this._setPaneViews([new t.BarsPatternPaneView(this,e)])}))}pattern(){return this._pattern}isSynchronizable(){return!1}additionalActions(e){return[new a.Action({actionId:"Chart.LineTool.BarsPattern.ToggleMirrored",options:{checked:this.properties().childs().mirrored.value(),checkable:!0,label:m,onExecute:()=>{e.setProperty(this.properties().childs().mirrored,!this.properties().childs().mirrored.value(),p),this.updateAllViews((0,u.sourceChangeEvent)(this.id())),this._model.updateSource(this)}}}),new a.Action({actionId:"Chart.LineTool.BarsPattern.ToggleFlipped",options:{checked:this.properties().childs().flipped.value(),checkable:!0,label:g,onExecute:()=>{e.setProperty(this.properties().childs().flipped,!this.properties().childs().flipped.value(),_),this.updateAllViews((0,u.sourceChangeEvent)(this.id())),this._model.updateSource(this)}}})]}pointsCount(){return 2}state(e){return{...super.state(e),pattern:this._pattern,scale:this._scale,diff:this._pointsCoordinatePricesDiff}}restoreData(e){const{pattern:t=this._pattern,scale:i=this._scale,diff:s=this._pointsCoordinatePricesDiff}=e;this._pattern=t,this._scale=i,this._pointsCoordinatePricesDiff=s}name(){return"Bars Pattern"}hasEditableCoordinates(){return!1}cloneData(e){this._pattern=(0,o.clone)(e._pattern),this._scale=e._scale,this._pointsCoordinatePricesDiff=e._pointsCoordinatePricesDiff}firstPatternPrice(){const{mode:e,flipped:t}=this.properties().childs(),i=this._pattern[0];return e.value()===d.LineToolBarsPatternMode.LineHL2?(i[2]+i[3])/2:t.value()?i[v[e.value()]]:i[f[e.value()]]}lastPatternPrice(){const{mode:e,flipped:t}=this.properties().childs(),i=this._pattern[this._pattern.length-1]
;return e.value()===d.LineToolBarsPatternMode.LineHL2?(i[2]+i[3])/2:t.value()?i[f[e.value()]]:i[v[e.value()]]}addPoint(e,t,i){const r=super.addPoint(e,t,!0);if(r){const e=this._model.mainSeries(),[{index:t},{index:i}]=this.points(),r=(0,s.ensureDefined)(e.nearestIndex(Math.min(t,i),c.PlotRowSearchMode.NearestRight)),n=(0,s.ensureDefined)(e.nearestIndex(Math.max(t,i),c.PlotRowSearchMode.NearestLeft));this._pattern=this._createPattern(r,n),this._pattern.length>0&&(t>i&&this._points.reverse(),this._points[1].price=this._points[0].price+this._patternPriceDiff(),this._points[1].index=this._points[0].index+(n-r),this.normalizePoints(),this.createServerPoints()),this._updatePointsCoordinatePricesDiff()}return r}setPoint(e,t,i,s){1===e&&t.index<=this._points[0].index&&(t.index=this._points[0].index+1),0===e&&t.index>=this._points[1].index&&(t.index=this._points[1].index-1),super.setPoint(e,t,i),this._updatePointsCoordinatePricesDiff()}move(e,t,i,s){super.move(e,t,i,s),this._updatePointsCoordinatePricesDiff()}migrateVersion(e,t,i){if(1===e&&this._pattern.length>0){const e=this._patternPriceDiff();2===this._timePoint.length&&(this._timePoint[1].price=this._timePoint[0].price+e),2===this._points.length&&(this._points[1].price=this._points[0].price+e)}}getScale(){return this._scale=this._calculateScale()}static createProperties(e){const t=new l.DefaultProperty("linetoolbarspattern",e);return this._configureProperties(t),t}_preparePoint(e,t){var i;const r=this._alignPointToRangeOfActualData(e),n=this._model.mainSeries(),o=(0,s.ensureNotNull)(n.bars().valueAt(r.index));this.properties().childs().mode.value()===d.LineToolBarsPatternMode.Bars?r.price=(0,s.ensure)(o[2]):r.price=(0,s.ensure)(o[4]);const a=(0,s.ensureNotNull)(this.priceScale()),l=(0,s.ensure)(null===(i=this.ownerSource())||void 0===i?void 0:i.firstValue()),c=.05*a.height(),h=a.priceToCoordinate(r.price,l)-c;return r.price=a.coordinateToPrice(h,l),super._preparePoint(r,t)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,266))).BarsPatternDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.addExclusion("mirrored"),e.addExclusion("flipped")}_calculatePatternCoordinatePricesDiff(){var e;return this._pattern.length>0&&null!==(e=this._priceCoordinateDiff([this.firstPatternPrice(),this.lastPatternPrice()]))&&void 0!==e?e:null}_updatePointsCoordinatePricesDiff(){this._pointsCoordinatePricesDiff=this._calculatePointsCoordinatePricesDiff()}_calculatePointsCoordinatePricesDiff(){var e;if(2===this._points.length){const[{price:t},{price:i}]=this.points();return null!==(e=this._priceCoordinateDiff([t,i]))&&void 0!==e?e:null}return null}_createPattern(e,t){const i=this._model.mainSeries().data(),r=[];for(let n=e;n<=t;n++)r.push((0,o.clone)((0,s.ensureNotNull)(i.valueAt(n))));return r}_switchPointsPrice(){const e=this._points[0].price;this._timePoint[0].price=this._points[0].price=this._points[1].price,this._timePoint[1].price=this._points[1].price=e}_mirror(){
const e=this._pattern;let t=Math.min(e[0][3],e[0][2]),i=Math.max(e[0][3],e[0][2]);for(let s=1;ss-(e-s);for(let t=0;ts.priceToCoordinate(e,r)))}_priceCoordinateDiff(e){const t=this._pricesToCoordinates(e);if(t)return t[1]-t[0]}_calculateScale(){let e=1;if(2===this._points.length){const t=this._calculatePatternCoordinatePricesDiff();if(!t)return e;const i=this._calculatePointsCoordinatePricesDiff();if(t&&null!==i&&(e=+(i/t).toFixed(8)),this._pointsCoordinatePricesDiff!==i){if(this._scale!==e)return this._updateLastPoint(),this._scale;this._updatePointsCoordinatePricesDiff()}}return e}_updateLastPoint(){var e,t;if(this._points.length<2)return;const i=this.priceScale(),s=null!==(t=null===(e=this.ownerSource())||void 0===e?void 0:e.firstValue())&&void 0!==t?t:null;if(null===s||null===i||i.isEmpty())return;const r=this._calculatePatternCoordinatePricesDiff(),n=this._pricesToCoordinates([this.points()[0].price]);null!==r&&n&&(this._timePoint[1].price=this._points[1].price=i.coordinateToPrice(+(this._scale*r).toFixed(8)+n[0],s),this._updatePointsCoordinatePricesDiff())}}},48218:(e,t,i)=>{"use strict";i.d(t,{LineToolBezierCubic:()=>o});var s=i(50151),r=i(46100),n=i(13087);class o extends n.LineDataSource{constructor(e,t,s,r){const n=t||o.createProperties();super(e,n,s,r),this._controlPoints=null,i.e(1583).then(i.bind(i,56853)).then((t=>{this._setPaneViews([new t.BezierCubicPaneView(this,e)])}))}pointsCount(){return 2}name(){return"Double Curve"}setLastPoint(e,t){const i=super.setLastPoint(e,t);return this._controlPoints=this._calculateControlPoints(),i}addPoint(e,t,i){const s=super.addPoint(e,t,i);if(s){const e=this._calculateControlPoints();this._controlPoints=null,this._points.push(e[0]),this._points.push(e[1]),i||(this.normalizePoints(),this.createServerPoints()),this._createPointProperty(2),this._createPointProperty(3)}return s}restorePoints(e,t,i){super.restorePoints(e,t,i),this._createPointProperty(2),this._createPointProperty(3)}controlPoints(){return this._controlPoints}static createProperties(e){const t=new r.DefaultProperty("linetoolbeziercubic",e);return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,84070)).then((e=>e.GeneralBezierDefinitionsViewModel))}_calculateControlPoints(){const e=(0,
s.ensureNotNull)(this.pointToScreenPoint(this.points()[0])),t=(0,s.ensureNotNull)(this.pointToScreenPoint(this.points()[1])),i=t.subtract(e).scaled(.5).transposed().scaled(.3),r=e.add(t).scaled(.33),n=e.add(t).scaled(.67),o=r.add(i),a=n.subtract(i);return[(0,s.ensureNotNull)(this.screenPointToPoint(o)),(0,s.ensureNotNull)(this.screenPointToPoint(a))]}}},60041:(e,t,i)=>{"use strict";i.d(t,{LineToolBezierQuadro:()=>o});var s=i(50151),r=i(46100),n=i(13087);class o extends n.LineDataSource{constructor(e,t,s,r){const n=t||o.createProperties();super(e,n,s,r),this._controlPoint=null,i.e(1583).then(i.bind(i,33730)).then((t=>{this._setPaneViews([new t.BezierQuadroPaneView(this,e)])}))}pointsCount(){return 2}name(){return"Curve"}setLastPoint(e,t){const i=super.setLastPoint(e,t);return this._controlPoint=this._calculateControlPoint(),i}addPoint(e,t,i){const s=super.addPoint(e,t,i);if(s){const e=this._calculateControlPoint();this._points.push(e),this._controlPoint=null,i||(this.normalizePoints(),this.createServerPoints()),this._createPointProperty(2)}return s}restorePoints(e,t,i){super.restorePoints(e,t,i),this._createPointProperty(2)}controlPoint(){return this._controlPoint}static createProperties(e){const t=new r.DefaultProperty("linetoolbezierquadro",e);return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,84070)).then((e=>e.GeneralBezierDefinitionsViewModel))}_calculateControlPoint(){const e=(0,s.ensureNotNull)(this.pointToScreenPoint(this.points()[0])),t=(0,s.ensureNotNull)(this.pointToScreenPoint(this.points()[1])),i=t.subtract(e).scaled(.5).transposed().scaled(.3),r=e.add(t).scaled(.5).add(i);return(0,s.ensureNotNull)(this.screenPointToPoint(r))}}},46235:(e,t,i)=>{"use strict";i.d(t,{LineToolBrushBase:()=>n});var s=i(50151),r=i(13087);class n extends r.LineDataSource{constructor(){super(...arguments),this._finished=!1}pointsCount(){return-1}finished(){return this._finished}finish(){this._finished=!0,this._lastPoint=null,this.normalizePoints(),this.createServerPoints()}hasEditableCoordinates(){return!1}addPoint(e,t,i){if(this._finished)return!0;if(this._lastPoint=null,this._points.length>0){const t=this._points[this._points.length-1],i=(0,s.ensureNotNull)(this.pointToScreenPoint(t));if((0,s.ensureNotNull)(this.pointToScreenPoint(e)).subtract(i).length()<2)return this._finished}return super.addPoint(e),this._finished}restorePoints(e,t,i){super.restorePoints(e,t,i),this._finished=!0}}},16642:(e,t,i)=>{"use strict";i.d(t,{LineToolBrush:()=>o});var s=i(46100),r=i(46235),n=i(68806);class o extends r.LineToolBrushBase{constructor(e,t,i,s){super(e,t||o.createProperties(),i,s),this._loadPaneViews(e)}smooth(){return this.properties().childs().smooth.value()}name(){return"Brush"}hasEditableCoordinates(){return!1}static createProperties(e){const t=new s.DefaultProperty("linetoolbrush",e);return this._configureProperties(t),t}_loadPaneViews(e){i.e(1583).then(i.bind(i,48188)).then((t=>{
this._setPaneViews([new t.BrushPaneView(this,e)])}))}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,26430)).then((e=>e.BrushDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.addChild("backgroundsColors",new n.LineToolColorsProperty([e.childs().backgroundColor],e.childs().fillBackground))}}},53086:(e,t,i)=>{"use strict";i.d(t,{LineToolCallout:()=>l});var s=i(11542),r=i(88640),n=i(46100),o=i(68806),a=i(13087);class l extends a.LineDataSource{constructor(e,t,s,r){super(e,t||l.createProperties(),s,r),this._barOffset=0,this._dragStartLeftEdgeIndex=NaN,this._timeScale=e.timeScale(),i.e(1583).then(i.bind(i,70326)).then((e=>{this._setPaneViews([new e.CalloutPaneView(this,this._model)])}))}pointsCount(){return 2}name(){return"Callout"}getBarOffset(){return this._barOffset}shouldBeRemovedOnDeselect(){return""===this._properties.childs().text.value().trim()}addPoint(e){const t=super.addPoint(e);return t&&this._calculateBarOffset(),t}setLastPoint(e){const t=super.setLastPoint(e);return 2===this.points().length&&this._calculateBarOffset(),t}setPoint(e,t){switch(e){case 0:super.setPoint(e,t),this._calculateBarOffset();break;case 1:const i=this.properties().childs();if(!i.wordWrapWidth)return;const s=this._points,r=this._dragStartLeftEdgeIndex,n=Math.round((t.index-r)/2);if(isFinite(r)&&isFinite(n)){s[1]={index:r+n,price:s[1].price},this._calculateBarOffset(),this.normalizePoints();const e=this._timeScale.indexToCoordinate(r+2*n)-this._timeScale.indexToCoordinate(r)-8-2;if(!isFinite(e))return;i.wordWrapWidth.setValue(Math.max(100,e));break}s[1]=t,this._calculateBarOffset(),this.normalizePoints()}}setPoints(e){super.setPoints(e);const t=this.properties().childs();if(!t.wordWrapWidth)return;const i=this._dragStartLeftEdgeIndex,s=Math.round((e[1].index-i)/2);if(this._calculateBarOffset(),this.normalizePoints(),isFinite(i)&&isFinite(s)){const e=this._timeScale.indexToCoordinate(i+2*s)-this._timeScale.indexToCoordinate(i)-8-2;if(!isFinite(e))return;t.wordWrapWidth.setValue(Math.max(100,e))}}move(e,t,i){super.move(e,t,i),this._calculateBarOffset()}state(e){const t=super.state(e);return t.barOffset=this._barOffset,t}restoreData(e){e.barOffset?this._barOffset=e.barOffset:this._calculateBarOffset(),this.calculatePoint2()}setPriceScale(e){super.setPriceScale(e),e&&e.priceRange()&&this.calculatePoint2()}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}calculatePoint2(){if(this._model.lineBeingEdited()===this||this._model.sourcesBeingMoved().includes(this))return;if(this._points.length<2)return;const[e,t]=this.points();this._points[1]={price:t.price,index:e.index+this._barOffset}}static createProperties(e){const t=new n.DefaultProperty("linetoolcallout",e);return this._configureProperties(t),t}_applyTemplateImpl(e){this.properties().childs().text.setValue(e.text),super._applyTemplateImpl(e)}_correctPoints(e,t){
if(null===this._currentMovingPoint||void 0===this._currentMovingPoint.logical||null===this._startMovingPoint||void 0===this._startMovingPoint.logical)return!1;const i=this._currentMovingPoint.logical.index-this._startMovingPoint.logical.index,s=this._currentMovingPoint.logical.price-this._startMovingPoint.logical.price,r=e[1];return r.index=r.index+i,r.price+=s,e[1]=r,!0}_onPointsetUpdated(e){super._onPointsetUpdated(e),0!==e.length&&(this._dragStartLeftEdgeIndex=this.points()[1].index)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,2813))).CalloutDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new r.default(s.t(null,void 0,i(37229)))),e.addExclusion("text"),e.addChild("textsColors",new o.LineToolColorsProperty([e.childs().color]))}_calculateBarOffset(){this.points().length>1&&(this._barOffset=this.points()[1].index-this.points()[0].index)}}},34588:(e,t,i)=>{"use strict";i.d(t,{LineToolCircle:()=>a});var s=i(88640),r=i(46100),n=i(13087),o=i(68806);class a extends n.LineDataSource{constructor(e,t,s,r){const n=t||a.createProperties();super(e,n,s,r),i.e(1583).then(i.bind(i,79104)).then((({CirclePaneView:t})=>{const i=[new t(this,e)];this._setPaneViews(i)}))}pointsCount(){return 2}name(){return"Circle"}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}static createProperties(e){const t=new r.DefaultProperty("linetoolcircle",e);return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,82300))).EllipseCircleDefinitionsViewModel}_snapTo45DegreesAvailable(){return!0}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new s.default("")),e.addChild("linesColors",new o.LineToolColorsProperty([e.childs().color])),e.addChild("linesWidths",new o.LineToolWidthsProperty([e.childs().linewidth])),e.addChild("backgroundsColors",new o.LineToolColorsProperty([e.childs().backgroundColor])),e.addChild("textsColors",new o.LineToolColorsProperty([e.childs().textColor],e.childs().showLabel)),e.addExclusion("linesColors"),e.addExclusion("linesWidths"),e.addExclusion("backgroundsColors"),e.addExclusion("text")}}},6908:(e,t,i)=>{"use strict";i.d(t,{LineToolComment:()=>n});var s=i(46100),r=i(38440);class n extends r.LineToolBalloon{constructor(e,t,i,s){super(e,t||n.createProperties(),i,s)}name(){return"Comment"}static createProperties(e){const t=new s.DefaultProperty("linetoolcomment",e);return n._configureProperties(t),t}_createPaneView(){i.e(1583).then(i.bind(i,37662)).then((e=>{this._setPaneViews([new e.CommentPaneView(this,this._model)])}))}}},28861:(e,t,i)=>{"use strict";i.d(t,{LineToolCrossLine:()=>a});var s=i(46100),r=i(46927),n=i(26642),o=i(13087);class a extends o.LineDataSource{
constructor(e,t,s,o){super(e,t||a.createProperties(),s,o),this._priceAxisView=new r.LineToolHorzLinePriceAxisView(this),this._timeAxisView=new n.LineToolVertLineTimeAxisView(this),i.e(1583).then(i.bind(i,51084)).then((({CrossLinePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}pointsCount(){return 1}name(){return"Cross Line"}priceAxisViews(e,t){return this.isSourceHidden()?null:t===this.priceScale()&&this.properties().childs().showPrice.value()&&this._model.paneForSource(this)===e?[this._priceAxisView]:null}timeAxisViews(){return this.isSourceHidden()?null:this.properties().childs().showTime.value()?[this._timeAxisView]:null}updateAllViews(e){super.updateAllViews(e),this._priceAxisView.update(e),this._timeAxisView.update()}canHasAlert(){return!1}lineColor(){return this.properties().childs().linecolor.value()}lineWidth(){return this.properties().childs().linewidth.value()}lineStyle(){return this.properties().childs().linestyle.value()}static createProperties(e){const t=new s.DefaultProperty("linetoolcrossline",e);return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,70007)).then((e=>e.CrossLineDefinitionsViewModel))}}},38762:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LineToolCyclicLines:()=>S});var s=i(13087),r=i(50151),n=i(79849),o=i(17236),a=i(32430),l=i(26843),c=i(13637),h=i(77680),d=i(68806);const u={intervalsVisibilities:{...o.intervalsVisibilitiesDefaults},linewidth:2,linestyle:n.LINESTYLE_SOLID},p={linecolor:"#80ccdb"},_=new Map([[l.StdTheme.Light,p],[l.StdTheme.Dark,p]]),m=(0,c.extractAllPropertiesKeys)((0,r.ensureDefined)(_.get(l.StdTheme.Light))),g=(0,c.extractAllPropertiesKeys)(u),f=[...m,...g,...a.commonLineToolPropertiesStateKeys];class v extends h.LineDataSourceThemedProperty{constructor(e){super(e),this.addChild("linesColors",new d.LineToolColorsProperty([(0,r.ensureDefined)(this.child("linecolor"))])),this.addChild("linesWidths",new d.LineToolWidthsProperty([(0,r.ensureDefined)(this.child("linewidth"))]))}static create(e){return new this({defaultName:"linetoolcirclelines",defaultsSupplier:()=>(0,c.factoryDefaultsForCurrentTheme)(u,_),nonThemedDefaultsKeys:g,themedDefaultsKeys:m,allStateKeys:f,state:e})}}class S extends s.LineDataSource{constructor(e,t,s,r){super(e,t||S.createProperties(),s,r),i.e(1583).then(i.bind(i,47346)).then((({LineToolCyclicLinesPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}pointsCount(){return 2}name(){return"Cyclic Lines"}template(){return this._properties.template()}static createProperties(e){const t=v.create(e);return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,15673))).CyclicAndSineLinesPatternDefinitionsViewModel}static _addCollectedProperties(e){}}},99636:(e,t,i)=>{"use strict";i.d(t,{LineToolCypherPattern:()=>n});var s=i(71902),r=i(46100);class n extends s.LineTool5PointsPattern{constructor(e,t,i,s){
super(e,t||n.createProperties(),i,s)}name(){return"Cypher Pattern"}static createProperties(e){const t=new r.DefaultProperty("linetoolcypherpattern",e);return this._configureProperties(t),t}_loadPaneViews(e){i.e(1583).then(i.bind(i,25615)).then((t=>{this._setPaneViews([new t.CypherPaneView(this,e)])}))}}},30541:(e,t,i)=>{"use strict";i.d(t,{DateAndPriceBaseProperties:()=>p,allPropertiesStateKeysBase:()=>u,nonThemedFactoryDefaultsBase:()=>h,themedFactoryDefaultsBase:()=>d});var s=i(33013),r=i(24633),n=i(87095),o=i(17236),a=i(88640),l=i(77680);const c=(0,s.getHexColorByName)("color-tv-blue-500"),h={linewidth:2,fontsize:12,fillLabelBackground:!0,fillBackground:!0,backgroundTransparency:60,intervalsVisibilities:{...o.intervalsVisibilitiesDefaults},customText:{visible:!1,fontsize:12,bold:!1,italic:!1}},d=new Map([[r.StdTheme.Light,{textcolor:(0,s.getHexColorByName)("color-black"),labelBackgroundColor:(0,s.getHexColorByName)("color-white"),linecolor:c,backgroundColor:(0,n.generateColor)(c,85),shadow:"rgba(0, 0, 0, 0.2)",customText:{color:c}}],[r.StdTheme.Dark,{textcolor:(0,s.getHexColorByName)("color-white"),labelBackgroundColor:(0,s.getHexColorByName)("color-cold-gray-800"),linecolor:c,backgroundColor:(0,n.generateColor)(c,85),shadow:"rgba(0, 0, 0, 0.4)",customText:{color:c}}]]),u=["customText.text"];class p extends l.LineDataSourceThemedProperty{constructor({nonThemedDefaultsKeys:e,themedDefaultsKeys:t,...i}){var s,r,n,o;super({nonThemedDefaultsKeys:e,themedDefaultsKeys:t,templateKeys:[...e,...t,...u],...i}),this._textProperty=new a.default(null!==(n=null===(r=null===(s=i.state)||void 0===s?void 0:s.customText)||void 0===r?void 0:r.text)&&void 0!==n?n:""),null===(o=this.childs().customText)||void 0===o||o.addChild("text",this._textProperty)}template(){const e=super.template();return e.customText.text=this._textProperty.value(),e}}},53312:(e,t,i)=>{"use strict";i.d(t,{LineToolDateAndPriceRange:()=>v});var s=i(50151),r=i(13087),n=i(96280),o=i(24633),a=i(33013),l=i(13637),c=i(32430),h=i(30541);const d=(0,a.getHexColorByName)("color-tv-blue-500"),u={...h.nonThemedFactoryDefaultsBase,drawBorder:!1,borderWidth:1},p=new Map([[o.StdTheme.Light,{...h.themedFactoryDefaultsBase.get(o.StdTheme.Light),borderColor:d}],[o.StdTheme.Dark,{...h.themedFactoryDefaultsBase.get(o.StdTheme.Dark),borderColor:d}]]),_=(0,l.extractAllPropertiesKeys)((0,s.ensureDefined)(p.get(o.StdTheme.Light))),m=(0,l.extractAllPropertiesKeys)(u),g=[..._,...m,...c.commonLineToolPropertiesStateKeys,...h.allPropertiesStateKeysBase];class f extends h.DateAndPriceBaseProperties{static create(e){return new this({defaultName:"linetooldateandpricerange",defaultsSupplier:()=>(0,l.factoryDefaultsForCurrentTheme)(u,p),nonThemedDefaultsKeys:m,themedDefaultsKeys:_,allStateKeys:g,state:e})}}class v extends r.LineDataSource{constructor(e,t,s,r){super(e,t||v.createProperties(),s,r),this._volumeCalculator=null,i.e(1583).then(i.bind(i,54306)).then((e=>{this._setPaneViews([new e.DateAndPriceRangePaneView(this,this._model)])}))}destroy(){super.destroy(),
null!==this._volumeCalculator&&this._volumeCalculator.destroy()}pointsCount(){return 2}name(){return"Date and Price Range"}template(){return this._properties.template()}volume(){if(null===this._volumeCalculator)return NaN;const e=this.points();return this._volumeCalculator.volume(e[0].index,e[1].index)}setOwnerSource(e){e===this._model.mainSeries()&&((0,s.assert)(null===this._volumeCalculator),this._volumeCalculator=new n.SeriesTimeRangeVolumeCalculator(this._model.mainSeries())),super.setOwnerSource(e)}static createProperties(e){const t=f.create(e);return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,83115))).GeneralDatePriceRangeDefinitionsViewModel}}},43485:(e,t,i)=>{"use strict";i.d(t,{LineToolDateRange:()=>g});var s=i(50151),r=i(13087),n=i(96280),o=i(24633),a=i(13637),l=i(30541),c=i(32430);const h={...l.nonThemedFactoryDefaultsBase,extendTop:!1,extendBottom:!1},d=l.themedFactoryDefaultsBase,u=(0,a.extractAllPropertiesKeys)((0,s.ensureDefined)(d.get(o.StdTheme.Light))),p=(0,a.extractAllPropertiesKeys)(h),_=[...u,...p,...c.commonLineToolPropertiesStateKeys,...l.allPropertiesStateKeysBase];class m extends l.DateAndPriceBaseProperties{static create(e){return new this({defaultName:"linetooldaterange",defaultsSupplier:()=>(0,a.factoryDefaultsForCurrentTheme)(h,d),nonThemedDefaultsKeys:p,themedDefaultsKeys:u,allStateKeys:_,state:e})}}class g extends r.LineDataSource{constructor(e,t,s,r){super(e,t||g.createProperties(),s,r),this._volumeCalculator=null,i.e(1583).then(i.bind(i,55762)).then((e=>{this._setPaneViews([new e.DateRangePaneView(this,this._model)])}))}destroy(){super.destroy(),null!==this._volumeCalculator&&this._volumeCalculator.destroy()}pointsCount(){return 2}name(){return"Date Range"}template(){return this._properties.template()}volume(){if(null===this._volumeCalculator)return NaN;const e=this.points();return this._volumeCalculator.volume(e[0].index,e[1].index)}setOwnerSource(e){e===this._model.mainSeries()&&((0,s.assert)(null===this._volumeCalculator),this._volumeCalculator=new n.SeriesTimeRangeVolumeCalculator(this._model.mainSeries())),super.setOwnerSource(e)}static createProperties(e){const t=m.create(e);return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,83115))).GeneralDatePriceRangeDefinitionsViewModel}}},58786:(e,t,i)=>{"use strict";i.d(t,{LineToolDisjointChannel:()=>a});var s=i(13087),r=i(46100),n=i(1722),o=i(88640);class a extends s.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:a.createProperties(),s,r),this.version=1,i.e(1583).then(i.bind(i,53288)).then((e=>{this._setPaneViews([new e.DisjointChannelPaneView(this,this._model)])}))}pointsCount(){return 3}name(){return"Disjoint Channel"}hasEditableCoordinates(){return!1}addPoint(e,t,i){return t&&t.shift()&&2===this.points().length&&this._snapPoint45Degree(e,this.points()[this.points().length-2]),
super.addPoint(e)}setLastPoint(e,t){return t&&t.shift()&&2===this.points().length&&this._snapPoint45Degree(e,this.points()[this.points().length-2]),super.setLastPoint(e)}setPoint(e,t,i,s){const r=.5*(this._points[1].price+this._points[2].price);if(i&&i.shift()&&1===e){const e=0;this._snapPoint45Degree(t,this.points()[e])}if(e<3&&super.setPoint(e,t),0!==e&&2!==e){if(1===e){const e=this._points[1].price-r;this._points[2].price=this._points[1].price-2*e}else if(3===e){const e=t.price-this._points[2].price;this._points[0].price=this._points[1].price-e,this._points[0].index=t.index}this.normalizePoints()}}getPoint(e){if(e<3)return super.getPoint(e);const t=this._points[0].price-this._points[2].price;return{index:this._points[0].index,price:this._points[1].price-t}}canHasAlert(){return!0}template(){const e=super.template();return e.labelText=this.properties().childs().labelText.value(),e}static createProperties(e){const t=new r.DefaultProperty("linetooldisjointangle",e);return this._configureProperties(t),t}_applyTemplateImpl(e){var t;super._applyTemplateImpl(e),this.properties().childs().labelText.setValue(null!==(t=e.labelText)&&void 0!==t?t:"")}_getAlertPlots(){const e=this._points[0],t=this._points[1],i=[];e.index<=t.index?(i.push(e),i.push(t)):(i.push(t),i.push(e));const s=this._points[2];s.time=t.time,s.index=t.index;const r={price:s.price+(t.price-e.price),time:e.time,index:e.index},o=[];let a,l,c,h;s.index<=r.index?(o.push(s),o.push(r)):(o.push(r),o.push(s)),i[0].price>o[0].price?(a=i,l=o):o[0].price>i[0].price||o[1].price>i[1].price?(a=o,l=i):(a=i,l=o);const d=this.properties().childs().extendLeft.value(),u=this.properties().childs().extendRight.value();return e.index<=t.index?(c=d,h=u):(c=u,h=d),[this._linePointsToAlertPlot(a,"Upper",c,h),this._linePointsToAlertPlot(l,"Lower",c,h)].filter(n.notNull)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,28578))).GeneralTrendFiguresDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.hasChild("labelText")||e.addChild("labelText",new o.default("")),e.addExclusion("labelText")}}},99366:(e,t,i)=>{"use strict";i.d(t,{LineToolElliott:()=>u,LineToolElliottCorrection:()=>w,LineToolElliottDoubleCombo:()=>P,LineToolElliottImpulse:()=>m,LineToolElliottTriangle:()=>f,LineToolElliottTripleCombo:()=>S});var s=i(11542),r=i(36298),n=i(13087),o=i(39347),a=i(46100),l=i(68806);const c=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],h=new r.TranslatedString("change Elliott degree",s.t(null,void 0,i(76020))),d=[{value:0,title:s.t(null,void 0,i(33820))},{value:1,title:s.t(null,void 0,i(58397))},{value:2,title:s.t(null,void 0,i(9753))},{value:3,title:s.t(null,void 0,i(18367))},{value:4,title:s.t(null,void 0,i(91889))},{value:5,title:s.t(null,void 0,i(95176))},{value:6,title:s.t(null,void 0,i(48404))},{value:7,title:s.t(null,void 0,i(71778))},{value:8,title:s.t(null,{context:"wave"},i(66051))},{value:9,title:s.t(null,{context:"wave"},i(86054))},{value:10,title:s.t(null,void 0,i(85884))
},{value:11,title:s.t(null,void 0,i(71722))},{value:12,title:s.t(null,void 0,i(10931))},{value:13,title:s.t(null,void 0,i(29662))},{value:14,title:s.t(null,void 0,i(9632))}];class u extends n.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:u.createProperties(),s,r),this.version=4,i.e(1583).then(i.bind(i,14417)).then((e=>{this._setPaneViews([new e.ElliottLabelsPaneView(this,this._model)])}))}migrateVersion(e,t,i){if(i.properties.hasChild("background")&&i.properties.removeProperty("background"),i.properties.hasChild("backgroundColor")&&i.properties.removeProperty("backgroundColor"),i.properties.hasChild("showBackground")&&i.properties.removeProperty("showBackground"),1===e){const e=Object.assign({},this._timePoint[0]);if(this._timePoint.unshift(e),this._points.length>0){const e=Object.assign({},this._points[0]);this._points.unshift(e)}}}applyTemplate(e){const t=e;delete t.background,delete t.backgroundColor,delete t.showBackground,super.applyTemplate(e)}name(){return"Elliott Labels"}additionalActions(e){return[new o.Action({actionId:"Chart.LineTool.Elliot.ChangeDegreeProperty",options:{label:s.t(null,void 0,i(69479)),subItems:c.map((t=>{const i=d.filter((e=>e.value===t))[0];return new o.Action({actionId:"Chart.LineTool.Elliot.ChangeDegreeProperty",options:{label:i.title,checkable:!0,checked:this.properties().childs().degree.value()===t,onExecute:()=>{e.setProperty(this.properties().childs().degree,t,h)}}})}))}})]}label(e){const t=c.length-this.properties().childs().degree.value()-1,i=Math.floor(t/3);return{group:i,bold:!!(i%2),decoration:["","brackets","circle"][t%3],label:this.labelsGroup()[i][e]}}availableDegreesValues(){return d}static createProperties(e){const t=new a.DefaultProperty("linetoolelliott",e);return this._configureProperties(t),t}static migrateState(e){const t={0:11,1:10,2:9,3:8,4:7,5:6,6:5,7:4,8:3},i={0:11,1:8};"LineToolElliottSubminuette"===e.type&&(e.type="LineToolElliottImpulse",e.state.degree=t[e.state.wavesize]),"LineToolElliottMinor"===e.type&&(e.type="LineToolElliottImpulse",e.state.degree=t[e.state.wavesize]),"LineToolElliottCircle"===e.type&&(e.type="LineToolElliottImpulse",e.state.degree=t[e.state.wavesize]),"LineToolElliottMinorRetr"===e.type&&(e.type="LineToolElliottCorrection",e.state.degree=i[e.state.wavesize]),"LineToolElliottMajorRetr"===e.type&&(e.type="LineToolElliottCorrection",e.state.degree=i[e.state.wavesize])}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,92383))).ElliottPatternDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new l.LineToolColorsProperty([e.childs().color])),e.addExclusion("linesColors")}}class p extends u{pointsCount(){return 6}}const _=[["0","1","2","3","4","5"],["0","i","ii","iii","iv","v"],["0","1","2","3","4","5"],["0","I","II","III","IV","V"],["0","1","2","3","4","5"]];class m extends p{constructor(e,t,i,s){super(e,t||m.createProperties(),i,s)}name(){return"Elliott Impulse Wave (12345)"}labelsGroup(){
return _}static createProperties(e){const t=new a.DefaultProperty("linetoolelliottimpulse",e);return this._configureProperties(t),t}}const g=[["0","A","B","C","D","E"],["0","a","b","c","d","e"],["0","A","B","C","D","E"],["0","a","b","c","d","e"],["0","A","B","C","D","E"]];class f extends p{constructor(e,t,i,s){super(e,t||f.createProperties(),i,s)}name(){return"Elliott Triangle Wave (ABCDE)"}labelsGroup(){return g}static createProperties(e){const t=new a.DefaultProperty("linetoolelliotttriangle",e);return this._configureProperties(t),t}}const v=[["0","W","X","Y","X","Z"],["0","w","x","y","x","z"],["0","W","X","Y","X","Z"],["0","w","x","y","x","z"],["0","W","X","Y","X","Z"]];class S extends p{constructor(e,t,i,s){super(e,null!=t?t:S.createProperties(),i,s)}name(){return"Elliott Triple Combo Wave (WXYXZ)"}labelsGroup(){return v}static createProperties(e){const t=new a.DefaultProperty("linetoolelliotttriplecombo",e);return this._configureProperties(t),t}}class y extends u{pointsCount(){return 4}}const b=[["0","A","B","C"],["0","a","b","c"],["0","A","B","C"],["0","a","b","c"],["0","A","B","C"]];class w extends y{constructor(e,t,i,s){super(e,null!=t?t:w.createProperties(),i,s)}name(){return"Elliott Correction Wave (ABC)"}labelsGroup(){return b}static createProperties(e){const t=new a.DefaultProperty("linetoolelliottcorrection",e);return this._configureProperties(t),t}}const C=[["0","W","X","Y"],["0","w","x","y"],["0","W","X","Y"],["0","w","x","y"],["0","W","X","Y"]];class P extends y{constructor(e,t,i,s){super(e,null!=t?t:P.createProperties(),i,s)}name(){return"Elliott Double Combo Wave (WXY)"}labelsGroup(){return C}static createProperties(e){const t=new a.DefaultProperty("linetoolelliottdoublecombo",e);return this._configureProperties(t),t}}},56905:(e,t,i)=>{"use strict";i.d(t,{LineToolEllipse:()=>h});var s=i(50151),r=i(4652),n=i(86441),o=i(88640),a=i(13087),l=i(46100),c=i(68806);class h extends a.LineDataSource{constructor(e,t,s,r){super(e,t||h.createProperties(),s,r),this.version=2,this._dist=null,this._fakePointAdded=!1,i.e(1583).then(i.bind(i,11756)).then((({EllipsePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}startChanging(e,t){if(super.startChanging(e,t),0===e||1===e){const e=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),t=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[2]));this._dist=(0,r.distanceToLine)(e,t,i).distance||0}}addPoint(e,t,i){const s=super.addPoint(e,t,i);return s&&(this._fakePointAdded=!1),s}setPoint(e,t,i,o){const a={...t};let l=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),c=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),h=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[2]));switch(e){case 0:{if(i&&i.shift()){this._snapPoint45Degree(a,this._points[1]),this._points[0]=a,this._points[2]=this._preparePointInternal(this._points[2],i,!0),
this._points[0].index===this._points[1].index&&this._fixVerticalDiameterPoints(this._points[0],this._points[1],this._points[2]);break}l=(0,s.ensureNotNull)(this.pointToScreenPoint(a));const e=c.subtract(l),t=l.add(c).scaled(.5),r=new n.Point(-e.y,e.x).normalized();h=t.add(r.scaled((0,s.ensureNotNull)(this._dist))),this._points[0]=a,this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(h));break}case 1:{if(i&&i.shift()){this._snapPoint45Degree(a,this._points[0]),this._points[1]=a,this._points[2]=this._preparePointInternal(this._points[2],i,!0),this._points[0].index===this._points[1].index&&this._fixVerticalDiameterPoints(this._points[1],this._points[0],this._points[2]);break}c=(0,s.ensureNotNull)(this.pointToScreenPoint(a));const e=c.subtract(l),t=l.add(c).scaled(.5),r=new n.Point(-e.y,e.x).normalized();h=t.add(r.scaled((0,s.ensureNotNull)(this._dist))),this._points[1]=a,this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(h));break}case 2:{const e=(0,s.ensureNotNull)(this.pointToScreenPoint(a)),t=(0,r.distanceToLine)(l,c,e).distance,i=c.subtract(l),o=l.add(c).scaled(.5),d=new n.Point(-i.y,i.x).normalized();h=o.add(d.scaled(t)),this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(h));break}case 3:{const e=(0,s.ensureNotNull)(this.pointToScreenPoint(a)),t=(0,r.distanceToLine)(l,c,e).distance,i=c.subtract(l),o=l.add(c).scaled(.5),d=new n.Point(-i.y,i.x).normalized();h=o.add(d.scaled(t)),this._points[2]=(0,s.ensureNotNull)(this.screenPointToPoint(h));break}}this.normalizePoints()}pointsCount(){return 3}name(){return"Ellipse"}hasEditableCoordinates(){return!1}migrateVersion(e,t,i){if(1===e&&2===this._points.length){const e=this._points[0].price,t=.5*(this._points[0].price+this._points[1].price);this._points[0]={price:t,index:this._points[0].index},this._points[1]={price:t,index:this._points[1].index},this._points.push({price:e,index:this._points[0].index})}if(1===e&&2===this._timePoint.length){const e=this._timePoint[0].price,t=.5*(this._timePoint[0].price+this._timePoint[1].price);this._timePoint[0].price=t,this._timePoint[1].price=t;const i={price:e,offset:this._timePoint[0].offset,time_t:this._timePoint[0].time_t};this._timePoint.push(i)}}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}static createProperties(e){const t=new l.DefaultProperty("linetoolellipse",e);return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,82300))).EllipseCircleDefinitionsViewModel}_preparePoint(e,t){const i=this._preparePointInternal(e,t,!1);return t&&t.shift()&&this._points[0].index===this._points[1].index&&this._fixVerticalDiameterPoints(this._points[1],this._points[0],i),i}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new o.default("")),
e.addChild("linesColors",new c.LineToolColorsProperty([e.childs().color])),e.addChild("textsColors",new c.LineToolColorsProperty([e.childs().textColor],e.childs().showLabel)),e.addExclusion("text")}_preparePointInternal(e,t,i){let r={...e};if(t&&t.shift()){const t=this.points().length;if(!this._fakePointAdded&&3===t&&!i)return r;if(this._fakePointAdded||2===t||i){this._snapPoint45Degree(e,this._points[0]),this._fakePointAdded?this._points[1]=e:i||(this._fakePointAdded=!0,super._addPointIntenal(e));const t=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),o=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1])),a=o.x-t.x,l=o.y-t.y,c=Math.sqrt(a*a+l*l)/2,h=o.subtract(t),d=t.add(o).scaled(.5),u=new n.Point(-h.y,h.x).normalized(),p=d.add(u.scaled(c));r=(0,s.ensureNotNull)(this.screenPointToPoint(p)),(isNaN(r.price)||isNaN(r.index))&&(r=(0,s.ensureNotNull)(this.screenPointToPoint(d)))}}else this._fakePointAdded&&(this._points.splice(1,1),this._fakePointAdded=!1);return r}_fixVerticalDiameterPoints(e,t,i){const r=(0,s.ensureNotNull)(this.pointToScreenPoint(e)),o=(0,s.ensureNotNull)(this.pointToScreenPoint(t)),a=this._model.timeScale(),l=a.indexToCoordinate(e.index),c=a.indexToCoordinate(i.index);let h=2*Math.abs(l-c);h*=t.price>e.price?1:-1,e.price=(0,s.ensureNotNull)(this.screenPointToPoint(new n.Point(r.x,o.y+h))).price}}},80058:(e,t,i)=>{"use strict";i.d(t,{LineToolEmoji:()=>b});var s=i(68616),r=i(59224),n=i(69798),o=i(88348),a=i(8459),l=i(27788),c=i(14314),h=i(77680),d=i(17236),u=i(13637),p=i(32430);const _={intervalsVisibilities:{...d.intervalsVisibilitiesDefaults},size:40},m={emoji:"😀",angle:.5*Math.PI},g=(0,u.extractAllPropertiesKeys)(_),f=(0,u.extractAllPropertiesKeys)(m),v=[...g,...f,...p.commonLineToolPropertiesStateKeys];class S extends h.LineDataSourceThemedProperty{constructor(e){super(e)}static create(e,t){return new this({defaultName:"linetoolemoji",defaultsSupplier:()=>(0,l.default)(_),nonThemedDefaultsKeys:g,themedDefaultsKeys:[],state:(0,c.default)({},m,{emoji:t},null!=e?e:{}),allStateKeys:v})}}const y=(0,r.getLogger)("Chart.LineToolEmoji");class b extends a.LineToolSvgIconBase{constructor(e,t,i,s){super(e,t||b.createProperties(),i,s),this.version=1,this._loadViews()}name(){return"Emoji"}template(){return this.properties().template()}static createProperties(e){const t=S.create(e,o.emojiTool.value());return b._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,85766))).LineDataSourceDefinitionsViewModel}async _loadViews(){const e=this._properties.childs().emoji.value(),t=(0,s.getTwemojiUrl)(e,"svg");try{const[s,{EmojiPaneView:r},{svgRenderer:o}]=await Promise.all([(0,n.fetch)(t).then((e=>e.text())),i.e(1583).then(i.bind(i,63451)),i.e(2616).then(i.bind(i,50765))]);if(!this._isDestroyed){this._svgContent=s,this._onIconChanged.fire();const t=o(s);null===t&&y.logWarn(`Couldn't create svg renderer for emoji ${e}`),this._setPaneViews([new r(this,this._model,t)])}}catch(t){
y.logWarn(`An error ocurred while loading emoji content ${e}: ${t}`)}}}},29921:(e,t,i)=>{"use strict";i.d(t,{ExecutionsPositionController:()=>u,LineToolExecution:()=>_});var s=i(50151),r=i(13087),n=i(47043),o=i(46100),a=i(86094),l=i(14483),c=i(98517),h=i(28558);const d=c.sortSourcesPreOrdered.LineToolExecution;class u{constructor(e){this._pane=e}getXYCoordinate(e,t,i){let r=0;const n=e.getDirection(),o="buy"===n,l=this._pane.model().mainSeries();if(l.bars){const e=o?10:-10,t=l.bars().search(i,a.PlotRowSearchMode.NearestLeft);if(null!==t){i=t.index;const n=o?t.value[3]:t.value[2],a=l.priceScale(),c=(0,s.ensureNotNull)(l.firstValue());r=a.priceToCoordinate(n,c)+e}}e.setAlignedTimePointIndex(i);const c=t.visibleBarsStrictRange();if(!isFinite(i)||null===c||i>c.lastBar()||i=0;--t){const s=h[t];if(!(s instanceof _)||s.adapter().alignedTimePointIndex()!==i||s.adapter().getDirection()!==n)continue;if(s===e.line())break;const a=s.adapter().height();r=o?r+a:r-a}return{x:t.indexToCoordinate(i),y:r}}static recreateOrderedByBarsSourcesCache(e){this.clearOrderedByBarsSourcesCache();const t=e.sourcesByGroup().all();for(const e of t){if(!(e instanceof _))continue;const t=e.adapter().alignedTimePointIndex();if(void 0===t)continue;const i=u._cachedByBarIndexOrderedExecutions[t]||[];u._cachedByBarIndexOrderedExecutions[t]=i,i.push(e)}}static clearOrderedByBarsSourcesCache(){u._cachedByBarIndexOrderedExecutions={}}}u._cachedByBarIndexOrderedExecutions={};class p{constructor(e,t){this._unixtime=NaN,this._line=e,this._model=t}alignedTimePointIndex(){return this._alignedTimePointIndex}setAlignedTimePointIndex(e){this._alignedTimePointIndex=e}line(){return this._line}getIndex(){return this._model.timeScale().baseIndex()-this._line.points()[0].index}setIndex(e){const t=this._model.timeScale().baseIndex()-Math.abs(e);this._line.startMoving({logical:this._line.points()[0]});const i={...this._line.points()[0]};return i.index=t,this._line.move({logical:i}),this._line.endMoving(!1),this}getTime(){return this._unixtime}setTime(e){return this._unixtime=e,this._line.restorePoints([{offset:0,price:this.getPrice(),time_t:this._unixtime}],[]),this._line.createServerPoints(),this}getPrice(){return this._line.points().length>0?this._line.points()[0].price:this._line.normalizedPoints().length>0?this._line.normalizedPoints()[0].price:NaN}setPrice(e){return this._line.points().length>0&&(this._line.points()[0].price=e),this._line.normalizedPoints().length>0&&(this._line.normalizedPoints()[0].price=e),this}getText(){return this._line.properties().childs().text.value()}setText(e){return this._line.properties().childs().text.setValue(e||""),this._line.updateAllViewsAndRedraw((0,h.sourceChangeEvent)(this._line.id())),this}getArrowHeight(){return this._line.properties().childs().arrowHeight.value()}setArrowHeight(e){return this._line.properties().childs().arrowHeight.setValue(e||5),this}getArrowSpacing(){
return this._line.properties().childs().arrowSpacing.value()}setArrowSpacing(e){return this._line.properties().childs().arrowSpacing.setValue(e||1),this}getDirection(){return this._line.properties().childs().direction.value()}setDirection(e){return this._line.properties().childs().direction.setValue(e||"buy"),this}getArrowColor(){const e=this._line.properties().childs();return"buy"===this.getDirection()?e.arrowBuyColor.value():e.arrowSellColor.value()}setArrowColor(e){return"buy"===this.getDirection()?this.setArrowBuyColor(e):this.setArrowSellColor(e),this}setArrowBuyColor(e){return this._line.properties().childs().arrowBuyColor.setValue(e),this}setArrowSellColor(e){return this._line.properties().childs().arrowSellColor.setValue(e),this}getTextColor(){const e=this._line.properties().childs();return n.getColorFromProperties(e.textColor,e.textTransparency)}setTextColor(e){const t=this._line.properties().childs();return n.setColorToProperties(e,t.textColor,t.textTransparency),this}getFont(){const e=this._line.properties().childs();return n.getFontFromProperties(e.fontFamily,e.fontSize,e.fontBold,e.fontItalic)}setFont(e){const t=this._line.properties().childs();return n.setFontToProperties(e,t.fontFamily,t.fontSize,t.fontBold,t.fontItalic),this}setTooltip(e){return null==e?e="":e+="",this._line.properties().childs().tooltip.setValue(e),this}getTooltip(){return this._line.properties().childs().tooltip.value()}remove(){this._model.removeSource(this._line)}getPoints(){return this._line.points()}height(){const e=this.getArrowHeight(),t=this.getArrowSpacing();let i=0;this.getText()&&(i=n.fontHeight(this.getFont()));return e+t+i+10}}class _ extends r.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:_.createProperties(),s,r),this._adapter=new p(this,e),this.customization.forcePriceAxisLabel=!1,this.customization.disableErasing=!0,this.setSelectionEnabled(!1),i.e(1583).then(i.bind(i,82080)).then((e=>{this._setPaneViews([new e.ExecutionPaneView(this,this._model)])}))}adapter(){return this._adapter}zorder(){return d}isSpeciallyZOrderedSource(){return!0}pointsCount(){return 1}name(){return"Execution"}hasContextMenu(){return!1}state(){return{}}updateAllViews(e){if(this._isVisible())return super.updateAllViews(e)}priceAxisViews(e,t){return this._isVisible()?super.priceAxisViews(e,t):null}paneViews(){return window.TradingView.printing&&!l.enabled("snapshot_trading_drawings")?null:this._isVisible()?super.paneViews():null}userEditEnabled(){return!1}showInObjectTree(){return!1}cloneable(){return!1}copiable(){return!1}isSynchronizable(){return!1}static createProperties(e){const t=new o.DefaultProperty("linetoolexecution",e,!1,!1);return _._configureProperties(t),t}_isVisible(){return this._model.properties().childs().tradingProperties.childs().showExecutions.value()}}},40934:(e,t,i)=>{"use strict";i.d(t,{LineToolExtended:()=>r});var s=i(47246);class r extends s.LineToolTrendLine{constructor(e,t,i,s){super(e,null!=t?t:r.createProperties(),i,s)}name(){return"Extended Line"}static createProperties(e){
const t=s.LineToolTrendLine._createPropertiesImpl("linetoolextended",e);return r._configureProperties(t),t}}},40634:(e,t,i)=>{"use strict";i.d(t,{LineToolFibChannel:()=>h});var s=i(50151),r=i(11542),n=i(36298),o=i(13087),a=i(53801),l=i(68806);const c=new n.TranslatedString("erase level line",r.t(null,void 0,i(12962)));class h extends o.LineDataSource{constructor(e,t,s,r){super(e,t||h.createProperties(),s,r),this.version=2,i.e(1583).then(i.bind(i,46406)).then((({FibChannelPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}levelsCount(){return 24}migrateVersion(e,t,i){i.properties.removeProperty("reverse")}pointsCount(){return 3}name(){return"Fib Channel"}processErase(e,t){const i="level"+t,s=this.properties().child(i).childs().visible;e.setProperty(s,!1,c)}static createProperties(e){const t=new a.LevelsProperty("linetoolfibchannel",e,!1,{range:[1,24],names:["coeff","color","visible"]});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,56194))).FibDrawingsWith24LevelsDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);const t=[];for(let i=1;i<=24;i++){const r=(0,s.ensureDefined)(e.child("level"+i));t.push((0,s.ensureDefined)(r.child("color")))}e.addChild("linesColors",new l.LineToolColorsProperty(t))}}},27046:(e,t,i)=>{"use strict";var s=i(36298).TranslatedString,r=i(13087).LineDataSource,n=i(53801).LevelsProperty,o=i(68806),a=o.LineToolWidthsProperty,l=o.LineToolColorsProperty,c=new s("erase level line",i.tf(null,void 0,i(12962)));class h extends r{constructor(e,t,s,r){super(e,t||h.createProperties(),s,r),i.e(1583).then(i.t.bind(i,13616,19)).then((({FibCirclesPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}levelsCount(){return h.LevelsCount}pointsCount(){return 2}name(){return"Fib Circles"}processErase(e,t){var i="level"+t,s=this.properties()[i].visible;e.setProperty(s,!1,c)}static createProperties(e){var t=new n("linetoolfibcircles",e,!1,{range:[1,11]});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,7044))).FibCirclesDefinitionsViewModel}_snapTo45DegreesAvailable(){return!0}static _configureProperties(e){super._configureProperties(e);for(var t=[e.child("trendline").child("linewidth")],i=[e.child("trendline").child("color")],s=1;s<=this.LevelsCount;s++)t.push(e.child("level"+s).child("linewidth")),i.push(e.child("level"+s).child("color"));e.addChild("linesColors",new l(i)),e.addChild("linesWidths",new a(t))}}h.LevelsCount=11,t.LineToolFibCircles=h},21558:(e,t,i)=>{"use strict";i.d(t,{LineToolFibRetracement:()=>c});var s=i(11542),r=i(36298),n=i(53801),o=i(13087),a=i(68806);const l=new r.TranslatedString("erase level line",s.t(null,void 0,i(12962)));class c extends o.LineDataSource{constructor(e,t,s,r){super(e,t||c.createProperties(),s,r),this.version=2,i.e(1583).then(i.bind(i,95994)).then((e=>{
this._setPaneViews([new e.FibRetracementPaneView(this,this._model)])}))}levelsCount(){return 24}pointsCount(){return 2}name(){return"Fib Retracement"}migrateVersion(e){1===e&&this.properties().childs().extendLines.setValue(!0)}processErase(e,t){const i="level"+t,{visible:s}=this.properties().childs()[i].childs();e.setProperty(s,!1,l)}fibLevelsBasedOnLogScale(){var e;return this.properties().childs().fibLevelsBasedOnLogScale.value()&&!!(null===(e=this.priceScale())||void 0===e?void 0:e.isLog())}static createProperties(e){const t=new n.LevelsProperty("linetoolfibretracement",e,!1,{range:[1,24],names:["coeff","color","visible"]});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,56194))).FibDrawingsWith24LevelsDefinitionsViewModel}static _configureProperties(e){var t;const i=e;super._configureProperties(i);const s=[i.childs().trendline.childs().linewidth,i.childs().levelsStyle.childs().linewidth],r=[i.childs().trendline.childs().color];for(let e=1;e<=24;e++){const s=null===(t=i.child("level"+e))||void 0===t?void 0:t.child("color");r.push(s)}i.addChild("linesColors",new a.LineToolColorsProperty(r)),i.addChild("linesWidths",new a.LineToolWidthsProperty(s))}}},28918:(e,t,i)=>{"use strict";var s=i(36298).TranslatedString,r=i(13087).LineDataSource,n=i(53801).LevelsProperty,o=i(68806),a=o.LineToolWidthsProperty,l=o.LineToolColorsProperty,c=new s("erase level line",i.tf(null,void 0,i(12962)));class h extends r{constructor(e,t,s,r){super(e,t||h.createProperties(),s,r),i.e(1583).then(i.bind(i,91331)).then((({FibSpeedResistanceArcsPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}levelsCount(){return h.LevelsCount}pointsCount(){return 2}name(){return"Fib Speed Resistance Arcs"}processErase(e,t){var i="level"+t,s=this.properties()[i].visible;e.setProperty(s,!1,c)}static createProperties(e){var t=new n("linetoolfibspeedresistancearcs",e,!1,{range:[1,11]});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,13972))).FibSpeedResistanceArcsDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);for(var t=[e.child("trendline").child("linewidth")],i=[e.child("trendline").child("color")],s=1;s<=this.LevelsCount;s++)t.push(e.child("level"+s).child("linewidth")),i.push(e.child("level"+s).child("color"));e.addChild("linesColors",new l(i)),e.addChild("linesWidths",new a(t))}}h.LevelsCount=11,t.LineToolFibSpeedResistanceArcs=h},88815:(e,t,i)=>{"use strict";var s=i(36298).TranslatedString,r=i(13087).LineDataSource,n=i(53801).LevelsProperty,o=i(68806).LineToolColorsProperty,a=new s("erase level line",i.tf(null,void 0,i(12962)));class l extends r{constructor(e,t,s,r){super(e,t||l.createProperties(),s,r),i.e(1583).then(i.bind(i,80724)).then((({FibSpeedResistanceFanPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}hLevelsCount(){return l.HLevelsCount}
vLevelsCount(){return l.VLevelsCount}pointsCount(){return 2}name(){return"Fib Speed Resistance Fan"}processErase(e,t){var i="h"===t.type?"hlevel"+t.index:"vlevel"+t.index,s=this.properties()[i].visible;e.setProperty(s,!1,a)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,4841))).FibSpeedResistanceFanDefinitionsViewModel}_snapTo45DegreesAvailable(){return!0}static createProperties(e){void 0!==e&&void 0===e.reverse&&(e.reverse=!0);var t=new n("linetoolfibspeedresistancefan",e,!1,{range:[1,7],prefixes:["h","v"],names:["coeff","color","visible"]});return this._configureProperties(t),t}static _configureProperties(e){super._configureProperties(e);var t=[e.child("grid").child("color")];for(let i=1;i<=this.HLevelsCount;i++)t.push(e.child("hlevel"+i).child("color"));for(let i=1;i<=this.VLevelsCount;i++)t.push(e.child("vlevel"+i).child("color"));e.addChild("linesColors",new o(t)),e.addExclusion("linesColors")}}l.HLevelsCount=7,l.VLevelsCount=7,t.LineToolFibSpeedResistanceFan=l},83101:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LineToolFibSpiral:()=>y});var s=i(13087),r=i(79849),n=i(17236),o=i(32430),a=i(33013),l=i(26843),c=i(13637),h=i(50151),d=i(77680),u=i(68806);const p={intervalsVisibilities:{...n.intervalsVisibilitiesDefaults},counterclockwise:!1,linewidth:2,linestyle:r.LINESTYLE_SOLID},_={linecolor:(0,a.getHexColorByName)("color-sky-blue-500")},m=new Map([[l.StdTheme.Light,_],[l.StdTheme.Dark,_]]),g=(0,c.extractAllPropertiesKeys)((0,h.ensureDefined)(m.get(l.StdTheme.Light))),f=(0,c.extractAllPropertiesKeys)(p),v=[...g,...f,...o.commonLineToolPropertiesStateKeys];class S extends d.LineDataSourceThemedProperty{constructor(e){super(e),this.addChild("linesColors",new u.LineToolColorsProperty([(0,h.ensureDefined)(this.child("linecolor"))])),this.addChild("linesWidths",new u.LineToolWidthsProperty([(0,h.ensureDefined)(this.child("linewidth"))]))}static create(e){return new this({defaultName:"linetoolfibspiral",defaultsSupplier:()=>(0,c.factoryDefaultsForCurrentTheme)(p,m),nonThemedDefaultsKeys:f,themedDefaultsKeys:g,allStateKeys:v,state:e})}}class y extends s.LineDataSource{constructor(e,t,s,r){super(e,t||y.createProperties(),s,r),i.e(1583).then(i.bind(i,47056)).then((({FibSpiralPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}pointsCount(){return 2}name(){return"Fib Spiral"}template(){return this._properties.template()}static createProperties(e){const t=S.create(e);return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,90448))).FibSpiralDefinitionsViewModel}static _addCollectedProperties(e){}}},7226:(e,t,i)=>{"use strict";i.d(t,{LineToolFibTimeZone:()=>c});var s=i(11542),r=i(36298),n=i(68806),o=i(53801),a=i(13087);const l=new r.TranslatedString("erase level line",s.t(null,void 0,i(12962)));class c extends a.LineDataSource{constructor(e,t,s,r){super(e,t||c.createProperties(),s,r),this.version=2,
i.e(1583).then(i.bind(i,54498)).then((({FibTimeZonePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}levelsCount(){return 11}migrateVersion(e,t,i){if(1===e){const e=i.properties.childs(),t=i.properties,s=t.baselinecolor.value(),r=t.linecolor.value(),n=t.linewidth.value(),o=t.linestyle.value();e.level1.childs().color.setValue(s);for(let t=2;t<=11;t++)e["level"+t].childs().color.setValue(r);for(let t=1;t<=11;t++)e["level"+t].childs().linewidth.setValue(n),e["level"+t].childs().linestyle.setValue(o)}}pointsCount(){return 2}name(){return"Fib Time Zone"}processErase(e,t){const i="level"+t,s=this.properties().childs()[i].childs().visible;e.setProperty(s,!1,l)}static createProperties(e){const t=new o.LevelsProperty("linetoolfibtimezone",e,!1,{range:[1,11]});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,18505))).FibTimezoneDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);const t=[],i=[];for(let s=1;s<=11;s++){const r=e.childs()["level"+s].childs();t.push(r.linewidth),i.push(r.color)}e.addChild("linesColors",new n.LineToolColorsProperty(i)),e.addChild("linesWidths",new n.LineToolWidthsProperty(t))}}},37122:(e,t,i)=>{"use strict";i.d(t,{LineToolFibWedgeBase:()=>o});var s=i(50151),r=i(86441),n=i(13087);class o extends n.LineDataSource{pointsCount(){return 3}hasEditableCoordinates(){return!1}setPoint(e,t){if(super.setPoint(e,t),!this._recursiveGuard)try{if(this._recursiveGuard=!0,2===e){const e=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0]));let t=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1]));const i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[2])).subtract(e).length();let n=t.subtract(e);n.length()<=0&&(n=new r.Point(1,0)),t=e.add(n.normalized().scaled(i));const o=(0,s.ensureNotNull)(this.screenPointToPoint(t)),a=this._pointsProperty.childs().points[1];a.childs().price.setValue(o.price),a.childs().bar.setValue(o.index)}else{const e=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),t=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1]));let i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[2]));const n=t.subtract(e).length();let o=i.subtract(e);o.length()<=0&&(o=new r.Point(1,0)),i=e.add(o.normalized().scaled(n));const a=(0,s.ensureNotNull)(this.screenPointToPoint(i)),l=this._pointsProperty.childs().points[2];l.childs().price.setValue(a.price),l.childs().bar.setValue(a.index)}}finally{this._recursiveGuard=!1}}addPoint(e){if(2===this._points.length){const t=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[0])),i=(0,s.ensureNotNull)(this.pointToScreenPoint(this._points[1]));let r=(0,s.ensureNotNull)(this.pointToScreenPoint(e));const n=i.subtract(t).length(),o=r.subtract(t).normalized();r=t.add(o.scaled(n));const a=(0,s.ensureNotNull)(this.ownerSource()),l=(0,s.ensureNotNull)(a.firstValue()),c=(0,s.ensureNotNull)(this.priceScale()).coordinateToPrice(r.y,l);e={
index:Math.round(this._model.timeScale().coordinateToIndex(r.x)),price:c}}return super.addPoint(e)}}},96837:(e,t,i)=>{"use strict";i.d(t,{LineToolFibWedge:()=>h});var s=i(50151),r=i(11542),n=i(36298),o=i(37122),a=i(53801),l=i(68806);const c=new n.TranslatedString("erase level line",r.t(null,void 0,i(12962)));class h extends o.LineToolFibWedgeBase{constructor(e,t,s,r){super(e,null!=t?t:h.createProperties(),s,r),i.e(1583).then(i.bind(i,60322)).then((e=>{this._setPaneViews([new e.FibWedgePaneView(this,this._model)])}))}levelsCount(){return 11}isSynchronizable(){return!1}name(){return"Fib Wedge"}processErase(e,t){const i=(0,s.ensureDefined)(this.properties().child(`level${t}`));e.setProperty(i.childs().visible,!1,c)}static createProperties(e){const t=new a.LevelsProperty("linetoolfibwedge",e,!1,{range:[1,11]});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,89478))).FibWedgeDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);const t=[e.childs().trendline.childs().linewidth],i=[e.childs().trendline.childs().color];for(let r=1;r<=11;r++){const n=(0,s.ensureDefined)(e.child(`level${r}`));t.push(n.childs().linewidth),i.push(n.childs().color)}e.addChild("linesColors",new l.LineToolColorsProperty(i)),e.addChild("linesWidths",new l.LineToolWidthsProperty(t))}}},62575:(e,t,i)=>{"use strict";i.d(t,{LineToolFlagMark:()=>a});var s=i(86441),r=i(13087),n=i(46100),o=i(68806);class a extends r.LineDataSource{constructor(e,t,r,n){super(e,t||a.createProperties(),r,n),i.e(1583).then(i.bind(i,13227)).then((({FlagMarkPaneView:e})=>{const t=new e(this,this.model());t.setAnchors(new s.Point(0,0)),this._setPaneViews([t])}))}pointsCount(){return 1}name(){return"Flag Mark"}static createProperties(e){e&&void 0===e.flagColor&&(e.flagColor="#318757");const t=new n.DefaultProperty("linetoolflagmark",e);return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,42923)).then((e=>e.FlagMarkDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.addChild("backgroundsColors",new o.LineToolColorsProperty([e.childs().flagColor])),e.addExclusion("backgroundsColors")}}a.version=2},35629:(e,t,i)=>{"use strict";i.d(t,{LineToolFlatBottom:()=>a});var s=i(13087),r=i(46100),n=i(1722),o=i(88640);class a extends s.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:a.createProperties(),s,r),this.version=1,i.e(1583).then(i.bind(i,85377)).then((e=>{this._setPaneViews([new e.FlatBottomPaneView(this,this._model)])}))}pointsCount(){return 3}name(){return"Flat Bottom"}hasEditableCoordinates(){return!1}addPoint(e,t,i){return t&&t.shift()&&2===this.points().length&&this._snapPoint45Degree(e,this.points()[this.points().length-2]),super.addPoint(e)}setLastPoint(e,t){return t&&t.shift()&&2===this.points().length&&this._snapPoint45Degree(e,this.points()[this.points().length-2]),
super.setLastPoint(e)}setPoint(e,t,i,s){if(i&&i.shift()&&1===e){const e=0;this._snapPoint45Degree(t,this.points()[e])}if(2===e)this._points[1].index=t.index;else if(3===e)return this._points[0].index=t.index,this._points[2].price=t.price,void this.normalizePoints();super.setPoint(e,t)}getPoint(e){return e<3?super.getPoint(e):3===e?{index:this._points[0].index,price:this._points[2].price}:null}canHasAlert(){return!0}template(){const e=super.template();return e.labelText=this.properties().childs().labelText.value(),e}static createProperties(e){const t=new r.DefaultProperty("linetoolflatbottom",e);return this._configureProperties(t),t}_applyTemplateImpl(e){var t;super._applyTemplateImpl(e),this.properties().childs().labelText.setValue(null!==(t=e.labelText)&&void 0!==t?t:"")}_getAlertPlots(){const e=this._points[0],t=this._points[1],i=[];e.index<=t.index?(i.push(e),i.push(t)):(i.push(t),i.push(e));const s=this._points[2];s.time=t.time,s.index=t.index;const r={price:s.price,time:e.time,index:e.index},o=[];let a,l,c,h;s.index<=r.index?(o.push(s),o.push(r)):(o.push(r),o.push(s)),i[0].price>o[0].price?(a=i,l=o):o[0].price>i[0].price||o[1].price>i[1].price?(a=o,l=i):(a=i,l=o);const d=this.properties().childs().extendLeft.value(),u=this.properties().childs().extendRight.value();return e.index<=t.index?(c=d,h=u):(c=u,h=d),[this._linePointsToAlertPlot(a,"Upper",c,h),this._linePointsToAlertPlot(l,"Lower",d,h)].filter(n.notNull)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,28578))).GeneralTrendFiguresDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.hasChild("labelText")||e.addChild("labelText",new o.default("")),e.addExclusion("labelText")}}},52788:(e,t,i)=>{"use strict";i.d(t,{createPropertiesObject:()=>a});var s=i(1722),r=i(53801);function n(e,t,i){var r;for(const n of Object.keys(null!==(r=e.levels)&&void 0!==r?r:{}))if(e.levels[n]&&(0,s.isSameType)(e.levels[n],t.typecheck())){let s=t.tpl();i.names.forEach(((i,r)=>{s=t.fill(""+r,i,e.levels[n],s)})),e.levels[n]=s}return e}class o extends r.LevelsProperty{constructor(e,t){super(e,t,!1,{names:["width","color","visible"]},n)}}function a(e,t){return new o(e,t)}},49809:(e,t,i)=>{"use strict";i.d(t,{LineToolGannComplex:()=>d});var s=i(86441),r=i(50151),n=i(10786),o=i(13087),a=i(29541),l=i(52788),c=i(68806),h=i(46501);class d extends o.LineDataSource{constructor(e,t,s,r){super(e,t||d.createProperties(),s,r),this.version=2,this._scaleRatioFormatter=new n.LimitedPrecisionNumericFormatter(7),this.version=2,i.e(1583).then(i.bind(i,99631)).then((({GannComplexPaneView:e})=>{this._setPaneViews([new e(this,this.model())])}));const o=this.properties();this._adjustScaleRatio(o),o.subscribe(this,this._adjustScaleRatio),o.childs().scaleRatio.subscribe(this,this._correctFirstPoint),this._syncStateExclusions=["scaleRatio"],o.onRestoreFactoryDefaults().subscribe(this,this._handleRestoringFactoryDefaults),this._onTemplateApplying.subscribe(this,this._handleTemplateApplying),
this._onTemplateApplied.subscribe(this,this._correctFirstPoint)}migrateVersion(e,t,i){1===e&&(this._points.length>=this.pointsCount()?setTimeout((()=>this._migratePoint())):this._timePoint.length>=this.pointsCount()&&this._pointAdded.subscribe(this,this._migratePoint))}destroy(){const e=this.properties();e.unsubscribe(this,this._adjustScaleRatio),e.childs().scaleRatio.unsubscribe(this,this._correctFirstPoint),e.onRestoreFactoryDefaults().unsubscribe(this,this._handleRestoringFactoryDefaults),this._onTemplateApplying.unsubscribe(this,this._handleTemplateApplying),this._onTemplateApplied.unsubscribe(this,this._correctFirstPoint),super.destroy()}pointsCount(){return 2}name(){return"Gann Square"}addPoint(e,t,i){this._points.length>1&&this._points.pop();const s=super.addPoint(e,t,i),n=this.priceScale();return!(0,r.ensureNotNull)(n).isLog()&&s&&this._correctFirstPoint(),s}setPoint(e,t,i){super.setPoint(e,t,i),void 0!==i&&i.shift()?this._correctPoint(e):this._correctScaleRatio()}setLastPoint(e,t){const i=this.priceScale();return(0,r.ensureNotNull)(i).isLog()||(this._points[1]=e,this._correctPoint(1)),super.setLastPoint(e,t)}isReversed(){return this.properties().childs().reverse.value()}levelsCount(){return this.properties().childs().levels.childCount()}levels(){const e=[],t=this.properties().childs(),i=t.levels.childCount();for(let s=0;se.GannComplexAndFixedDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.addExclusion("scaleRatio");const t=[],i=[],s=e.childs();{const e=s.levels.childCount();for(let r=0;r0,o=s.index-r.index>0;let a=n&&!o||!n&&o?-1:1;0===e&&(a=-a),s.price=r.price+a*t*i,this._pointChanged.fire(e)}this.normalizePoints()}_correctFirstPoint(){this._correctPoint(this.isReversed()?0:1)}_handleRestoringFactoryDefaults(){this.properties().childs().scaleRatio.setValue(this._getAdjustedScaleRatio())}_handleTemplateApplying(e){""===e.scaleRatio&&(e.scaleRatio=this._getAdjustedScaleRatio())}_migratePoint(){if(this.points().length0){s=s.normalized();let e=Math.acos(s.x);return s.y>0&&(e=-e),e}return null}}},21608:(e,t,i)=>{"use strict"
;var s=i(36298).TranslatedString,r=i(13087).LineDataSource,n=i(53801).LevelsProperty,o=i(68806),a=o.LineToolWidthsProperty,l=o.LineToolColorsProperty,c=new s("erase level line",i.tf(null,void 0,i(12962)));class h extends r{constructor(e,t,s,r){super(e,t||h.createProperties(),s,r),i.e(1583).then(i.bind(i,25438)).then((({GannFanPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}levelsCount(){return h.LevelsCount}pointsCount(){return 2}name(){return"Gann Fan"}processErase(e,t){var i="level"+t,s=this.properties()[i].visible;e.setProperty(s,!1,c)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,95399))).GannFanDefinitionsViewModel}static createProperties(e){var t=new n("linetoolgannfan",e,!1,{range:[1,9]});return this._configureProperties(t),t}static _configureProperties(e){super._configureProperties(e);for(var t=[],i=[],s=1;s<=this.LevelsCount;s++)t.push(e.child("level"+s).child("linewidth")),i.push(e.child("level"+s).child("color"));e.addChild("linesColors",new l(i)),e.addChild("linesWidths",new a(t))}}h.LevelsCount=9,t.LineToolGannFan=h},76124:(e,t,i)=>{"use strict";i.d(t,{LineToolGannFixed:()=>l});var s=i(86441),r=i(50151),n=i(13087),o=i(68806),a=i(52788);class l extends n.LineDataSource{constructor(e,t,s,r){super(e,t||l.createProperties(),s,r),this._constructor="LineToolGannFixed",i.e(1583).then(i.bind(i,57583)).then((({GannFixedPaneView:e})=>{this._setPaneViews([new e(this,this.model())])})),this.properties().childs().reverse.subscribe(this,this._reversePoints)}pointsCount(){return 2}name(){return"Gann Square Fixed"}axisPoints(){const e=this.points(),t=this.getScreenPoints();return e.length<2||t.length<2?[]:[e[0],(0,r.ensureNotNull)(this.screenPointToPoint(t[1]))]}getScreenPoints(){const e=this.points();if(e.length<2)return[];const t=this._calcAngle();if(null===t)return[];const[i,n]=e,o=(0,r.ensureNotNull)(this.pointToScreenPoint(i)),a=(0,r.ensureNotNull)(this.pointToScreenPoint(n)),l=Math.sqrt(Math.pow(o.x-a.x,2)+Math.pow(o.y-a.y,2)),c=new s.Point(Math.cos(t),-Math.sin(t)),h=c.normalized(),d=h.x<0?-1:1,u=h.y<0?-1:1;return[o.addScaled(c,l),o.add(new s.Point(5*l*d,5*l*u))]}levelsCount(){return this.properties().childs().levels.childCount()}levels(){const e=[],t=this.properties().childs(),i=t.levels.childCount();for(let s=0;se.GannComplexAndFixedDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e);const t=[],i=[],s=e.childs();{const e=s.levels.childCount();for(let r=0;r0&&(o=-o),o}_reversePoints(){const[e,t]=this._points;this._points[0]=t,this._points[1]=e,this.normalizePoints(),this.restart()}}},86325:(e,t,i)=>{"use strict";var s=i(13087).LineDataSource,r=i(53801).LevelsProperty,n=i(68806).LineToolColorsProperty,o=[4.5,9,11.25,18,22.5,36,45],a=function(){for(var e=[],t=o.length-1,i=1,s=0,r=0;r<1e10;)r=o[s]*i,e.push(Math.round(r)),e.push(Math.ceil(-r)),s===t-1&&(i*=10),s=(s+1)%t;return e.sort((function(e,t){return et?1:0})),e}();class l extends s{constructor(e,t,s,r){super(e,t||l.createProperties(),s,r),i.e(1583).then(i.t.bind(i,97449,19)).then((({GannSquarePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}hLevelsCount(){return l.HLevelsCount}vLevelsCount(){return l.VLevelsCount}pointsCount(){return 2}name(){return"Gann Box"}_alignPriceOnPattern(e,t){var i=Math.round(1e6*(e.price-t.price))/1e6;if(0===i)return t.price;for(var s=o[0],r=o[o.length-1],n=1,a=Math.abs(i);a=0&&!(o[c]*n=0?l:-l),e}_alignTimeOnPattern(e,t){var i=e.index-t.index;if(0===i)return 0;for(var s=a.length-2;s>=0&&!(a[s]0?1:0,e.index=t.index+a[s],e}_alignPointsFixedIncrement(e,t){return this._alignTimeOnPattern(e,t),this._alignPriceOnPattern(e,t),e}_preparePoint(e,t){return t&&t.shift()&&0!==this._points.length&&this._alignPointsFixedIncrement(e,this._points[0]),super._preparePoint(e,t)}getPoint(e){if(e<2)return super.getPoint(e);var t=null;switch(e){case 2:case 3:var i=this.points();if(i.length===this.pointsCount()){
var s=i[0].index,r=i[1].price;3===e&&(s=i[1].index,r=i[0].price),t={index:s,price:r}}}return t}setPoint(e,t,i){if(i&&i.shift()){var s=e%2==0?this._points[1]:this._points[0];this._alignPointsFixedIncrement(t,s)}switch(e){case 2:this._points[0].index=t.index,this._points[1].price=t.price;break;case 3:this._points[1].index=t.index,this._points[0].price=t.price;break;default:super.setPoint(e,t,i)}}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(2285),i.e(344),i.e(8882),i.e(8167),i.e(8537)]).then(i.bind(i,41854))).GannSquareDefinitionsViewModel}static createProperties(e){var t=new r("linetoolgannsquare",e,!1,{range:[1,7],prefixes:["h","v"],names:["coeff","color","visible"]});return this._configureProperties(t),t}static _configureProperties(e){super._configureProperties(e);for(var t=[e.child("color"),e.child("fans").child("color")],i=1;i<=this.HLevelsCount;i++)t.push(e.child("hlevel"+i).child("color"));for(i=1;i<=this.VLevelsCount;i++)t.push(e.child("vlevel"+i).child("color"));e.addChild("linesColors",new n(t)),e.addExclusion("linesColors")}}l.HLevelsCount=7,l.VLevelsCount=7,t.LineToolGannSquare=l},44010:(e,t,i)=>{"use strict";i.d(t,{LineToolGhostFeed:()=>c});var s=i(46100),r=i(13087),n=i(50151),o=i(1722);class a{constructor(e,t,i){this._source=e,this._segmentIndex=t,this._bars=null!=i?i:[]}setBars(e){this._bars=e}clone(e){return new a(e,this._segmentIndex,(0,o.clone)(this._bars))}generate(){this._bars=[];const e=this._source.points(),t=e[this._segmentIndex],i=e[this._segmentIndex+1];if(!t||!i||t.index===i.index)return;const s=this._segmentIndex?t.index+1:t.index,r=Math.sign(i.index-t.index);for(let e=s;e!==i.index;e+=r)this._bars.push(this._createBar())}bars(){return this._bars}setSize(e){if(e{this._setPaneViews([new t.GhostFeedPaneView(this,e)])}))}isSynchronizable(){return!1}destroy(){
this.properties().onRestoreFactoryDefaults().unsubscribe(this,this._handleRestoringFactoryDefaults),super.destroy()}propertiesChanged(){super.propertiesChanged(),this._currentAverageHL===this.properties().childs().averageHL.value()&&this._currentVariance===this.properties().childs().variance.value()||this._regenerate()}pointsCount(){return-1}name(){return"Ghost Feed"}segmentBars(e){return this._segments[e].bars()}segments(){return this._segments}generateBars(e){this._segments.length<=e&&this._segments.push(new a(this,e)),this._segments[e].generate()}addPoint(e,t,i){if(this._finished)return!0;if(this._points.length>0){const i=this._points[this._points.length-1];if(!(null==t?void 0:t.isApiEvent())&&i.index===e.index){this._lastPoint=null,this.normalizePoints(),this.createServerPoints();for(let e=0;e1&&this.generateBars(this._points.length-2),s}finish(){this._finished=!0,this._lastPoint=null,this.normalizePoints(),this.createServerPoints()}setPoint(e,t,i,s){if(super.setPoint(e,t,i),e>0){const i=this.points()[e-1],s=t.index-i.index;this._segments[e-1].setSize(Math.abs(s))}if(e