(self.webpackChunktradingview=self.webpackChunktradingview||[]).push([[1297],{93344:e=>{e.exports={}},7727:e=>{e.exports={"tv-spinner__container-rotate":"tv-spinner__container-rotate-aLqboHuu"}},33633: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"}},66316:e=>{e.exports={screen:"screen-otjoFNF2",fade:"fade-otjoFNF2",screenfade:"screenfade-otjoFNF2"}},27437:e=>{e.exports={}},25313: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"}},11710:e=>{e.exports={}},8406:e=>{e.exports={}},53473:e=>{e.exports={"css-value-chart-controls-bar-height-with-border":"39px","css-value-chart-controls-bar-border":"1px"}},61442:e=>{e.exports={}},32160:e=>{e.exports={}},23524: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,{Hardcode:()=>s,Modifiers:()=>o,hashFromEvent:()=>l,hashShiftPlusEnter:()=>c,hotkeyHashToAriaKeyshortcuts:()=>m,humanReadableHash:()=>p,humanReadableModifiers:()=>h,isMacKeyboard:()=>n,modifiersFromEvent:()=>a});var s,r=i(5325);!function(e){e[e.KeyCode=255]="KeyCode",e[e.Control=256]="Control",e[e.Alt=512]="Alt",e[e.Shift=1024]="Shift",e[e.Meta=2048]="Meta"}(s||(s={}));const n=r.isMac||r.isIOS;var o;function a(e){let t=0;return e.shiftKey&&(t+=1024),e.altKey&&(t+=512),e.ctrlKey&&(t+=256),e.metaKey&&(t+=2048),t}function l(e){return a(e)|e.keyCode}!function(e){e[e.None=0]="None",e[e.Alt=512]="Alt",e[e.Shift=1024]="Shift",e[e.Mod=n?2048:256]="Mod",e[e.Control=256]="Control",e[e.Meta=2048]="Meta"}(o||(o={}));const c=1037;function h(e,t=!n){let i="";return 256&e&&(i+=_(n?"^":"Ctrl",t)),512&e&&(i+=_(n?"⌥":"Alt",t)),1024&e&&(i+=_(n?"⇧":"Shift",t)),2048&e&&(i+=_(n?"⌘":"Win",t)),i}const d={9:"⇥",13:"↵",27:"Esc",8:n?"⌫":"Backspace",32:"Space",35:"End",36:"Home",37:"←",38:"↑",39:"→",40:"↓",45:"Ins",46:"Del",188:",",191:"/"},u={9:"Tab",13:"Enter",27:"Esc",8:"Backspace",32:"Space",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Ins",46:"Del",188:",",191:"/"};for(let e=1;e<=16;e++)d[e+111]=`F${e}`,u[e+111]=`F${e}`;function p(e){let t=h(e);const i=255&e;return t+=i in d?d[i]:String.fromCharCode(i),t}function _(e,t){return`${e}${t?" + ":n?" ":""}`}function m(e){const t=[];256&e&&t.push("Ctrl"),512&e&&t.push("Alt"),1024&e&&t.push("Shift"),2048&e&&t.push("Meta");const i=255&e;return i in d?t.push(d[i]):t.push(String.fromCharCode(i)),t.join("+")}},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:()=>y,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)),y=_||m||g||f},7029:(e,t,i)=>{"use strict";i.d(t,{t:()=>s});const s=i.i18next},19625:(e,t,i)=>{"use strict";i.r(t),i.d(t,{colorsPalette:()=>d,findHexColorByName:()=>h,getHexColorByName:()=>u});var s=i(23420),r=i(579),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){if(c.test(e))return e;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"}},76460:(e,t,i)=>{"use strict";function s(e){return 0===e.detail}i.d(t,{isKeyboardClick:()=>s})},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(49406);function r(e){return(0,s.htmlEscape)(JSON.stringify(e))}function n(e){return JSON.parse((0,s.decodeHTMLEntities)(e))}},38780:(e,t,i)=>{"use strict";i.d(t,{hide:()=>q,show:()=>j,showOnElement:()=>U});var s=i(32563),r=i(50151),n=i(4741);let o=0,a=0,l=0;function c(){clearTimeout(o),clearTimeout(a),clearTimeout(l)}function h(e,t){o=setTimeout(e,t)}const d="tooltip-root-element";let u;function p(){const e=document.getElementById(d);e?u=e:(u=document.createElement("div"),u.id=d,document.body.appendChild(u))}function _(){u&&(u.innerHTML="")}"interactive"===document.readyState?p():document.addEventListener("DOMContentLoaded",p);var m=i(49481),g=i(63273),f=(i(21251),i(14729)),v=i(9859),y=i(49483);const S={default:"",white:"theme-white",chart:"theme-chart","round-shadow":"theme-round-shadow"},b=Object.keys(S);var w,C=i(94194),P=i(61814),x=i(23524);function T(e){const t=function(e){const t=e.hasAttribute("data-tooltip")?e.getAttribute("data-tooltip"):e.getAttribute("title");return t&&((0,C.setTooltipData)(e,"text",t),e.removeAttribute("title")),(0,C.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 I(e){const t=(0,r.ensureNotNull)(V).cloneNode(!0),i=N(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=(0,r.ensureNotNull)(R).cloneNode(!0);e.innerText=s.data,i.appendChild(e)}else i.innerText=s.data}if(e.hotkey){const t="none"!==s.type,n=(0,r.ensureNotNull)(B).cloneNode(!0),o=(0,
P.hotKeyDeserialize)(e.hotkey),a=o.keys.map((e=>`<span class="${x["common-tooltip__hotkey-button"]}">${e}</span>`));n.innerHTML=function(e,t){const i=/{\d}|{hotkey_\d}/gi;return e.replace(i,(e=>{const i=Number(e.match(/\d/));return t[i]}))}(o.text,a).replace(/\s\+\s/g,`<span class="${x["common-tooltip__plus-sign"]}">+</span>`),i.classList.add(x["common-tooltip__body--with-hotkey"]),t&&n.classList.add(x["common-tooltip__hotkey-block--divider"]),i.appendChild(n)}return t.addEventListener("contextmenu",f.preventDefault),t}function M(e,t){const i=t.rect;if(!i)return;!function(e,t){const i=b.includes(t)?S[t]:"";e.classList.remove(...b.map((e=>S[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=N(e),r=e.querySelector(`.${x["common-tooltip__button-container"]}`);s.classList.toggle(x["common-tooltip__body--width_wide"],Boolean(t.wide)),s.classList.toggle(x["common-tooltip__body--no-padding"],Boolean(t.noPadding)),s.classList.toggle(x["common-tooltip__body--width_narrow"],Boolean(t.narrow)),s.classList.toggle(x["common-tooltip__body--no-buttons"],!0),s.style.left=L(0),s.style.width=L(s.clientWidth+(Boolean(t.noPadding)?0:2));const n=document.body.clientWidth,o=y.CheckMobile.iOS()||y.CheckMobile.Android()||(0,y.supportTouch)()&&(0,y.isMac)()?window.innerHeight:document.body.clientHeight,a=t.vertical,l=t.extendMargin||a&&i.w<20||!a&&i.h<20;e.classList.toggle(x["common-tooltip--farther"],l),e.classList.toggle(x["common-tooltip--vertical"],a),e.classList.toggle(x["common-tooltip--horizontal"],!a);const c=function(e){return e.querySelector(`.${x["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,v.clamp)(i.y+i.h/2,u,p)-h/2,m=_+h;e.style.left=L(i.x+i.w),e.style.top=L(_),_<a?s.style.top=r.style.top=L(a-_):m>l&&(s.style.top=r.style.top=L(l-m));const{right:f}=(e.querySelector(":last-child")||s).getBoundingClientRect(),y=f+10>n;e.classList.toggle(x["common-tooltip--direction_reversed"],y),e.classList.toggle(x["common-tooltip--direction_normal"],!y);let S=y?"after":"before";(0,g.isRtl)()?(S=t.otr?"after":S,S=t.otl?"before":S):(S=t.otr?"before":S,S=t.otl?"after":S),c.classList.toggle(x["common-tooltip__ear-holder--before"],"before"===S),c.classList.toggle(x["common-tooltip__ear-holder--after"],"after"===S),"after"===S&&(e.style.left="auto",e.style.right=L(n-i.x))}else{const a=i.x-(s.offsetWidth-i.w)/2,l=n-e.offsetWidth-20<=0?(n-e.offsetWidth)/2:10,d=n-l-e.offsetWidth,u=Math.max(l,Math.min(a,d));e.style.left=L(u);const p=d<a;e.classList.toggle(x["common-tooltip--direction_reversed"],p),e.classList.toggle(x["common-tooltip--direction_normal"],!p);const _=function(e,t,i,s){if(e.above)return O(t,s)?"above":"below";if(e.below)return function(e,t,i){return i.y+i.h+t+10<e}(t,i,s)?"below":"above";return O(i,s)?"above":"below"}(t,o,h,i);"above"===_?e.style.bottom=L(o-i.y):e.style.top=L(i.y+i.h),c.classList.add("above"===_?x["common-tooltip__ear-holder--above"]:x["common-tooltip__ear-holder--below"])
;const{left:m}=s.getBoundingClientRect();let g=Math.trunc(i.x+i.w/2-(m+s.clientWidth/2));e.style.left=L(u+g),e.style.width=L(s.clientWidth+r.clientWidth),g=p?Math.max(0,g):Math.min(0,g),r.style.left=L(-g),s.style.left=L(-g)}}function A(e){e.classList.toggle(x["common-tooltip--hidden"],!0)}function L(e){return`${Math.floor(e)}px`}!function(e){e[e.ViewportPadding=10]="ViewportPadding"}(w||(w={}));const k=`\n\t<div id="common-tooltip-wrapper" class="${x["common-tooltip"]}">\n\t\t<div class="${x["common-tooltip__ear-holder"]}" >\n\t\t\t<div class="${x["common-tooltip__body"]} js-tooltip-body"></div>\n\t\t</div>\n\t\t<div class="${x["common-tooltip__button-container"]}"></div>\n\t</div>\n`,D=`\n\t<div class="${x["common-tooltip__hotkey-block"]}"></div>\n`,E=`\n\t<div class="${x["common-tooltip__hotkey-text"]}"></div>\n`,V=(0,m.parseHtmlElement)(k),B=(0,m.parseHtmlElement)(D),R=(0,m.parseHtmlElement)(E);function N(e){return e.querySelector(`.${x["common-tooltip__body"]}`)}function O(e,t){return 10+e<t.y}let F=!1,W=null,H=null;s.mobiletouch||document.addEventListener("mouseover",(function(e){var t;if(null===(t=e.sourceCapabilities)||void 0===t?void 0:t.firesTouchEvents)return;const i=e.target,s=e.currentTarget,r=function(e,t,i){const s=[];for(;e&&e!==t;)e.classList&&e.classList.contains(i)&&s.push(e),e=e.parentElement||K(e.parentNode);return s}(i,s,"apply-common-tooltip"),o=()=>{H&&(H.destroy(),H=null)};for(const t of r){if("buttons"in e){if(1&e.buttons)continue}else if(1===e.which)continue;const i=()=>U(t);if(i()){const e=e=>s(null,!0),s=(r,n=!1)=>{t.removeEventListener("common-tooltip-update",i),t.removeEventListener("mouseleave",s),t.removeEventListener("mousedown",s),document.removeEventListener("scroll",e,{capture:!0}),o(),q(n)};t.addEventListener("common-tooltip-update",i),t.addEventListener("mouseleave",s),t.addEventListener("mousedown",s),document.addEventListener("scroll",e,{capture:!0}),null===H&&(H=(0,n.createGroup)({desc:"Tooltip"}),H.add({desc:"Hide",hotkey:27,handler:s}));break}}}),!0);const z=new MutationObserver((()=>{if(W&&W.options.target){let e;e="isConnected"in W.options.target?W.options.target.isConnected:document.body.contains(W.options.target),e||q()}})),U=(e,t={})=>{const{content:i,...s}=Y(t),r=T(e),n=Object.assign(r,s);return"none"!==i.type&&(n.content=i),!("none"===n.content.type&&!n.hotkey)&&(n.target=e,j(n),!0)},j=e=>{const t=Y(e),i=I(t);var s;if(W={options:t,element:i},s=i,_(),u&&u.appendChild(s),c(),!F)return A(i),void h((()=>$(i)),function(e){return"number"!=typeof e.tooltipDelay||isNaN(e.tooltipDelay)?500:e.tooltipDelay}(t));const{tooltipDebounce:r}=e;"number"!=typeof r||isNaN(r)?$(i):h((()=>$(i)),r)};function G(){_(),F=!1,W=null}const q=(e,t)=>{if(c(),(0,r.ensureNotNull)(z).disconnect(),!W)return;if(!e&&!F)return;const{element:i,options:s}=W,n=()=>{i.removeEventListener("mouseleave",n),A(i),e?G():l=setTimeout((()=>{G()}),250),null==t||t()};var o,h;s.tooltipHideDelay?(o=()=>{i.querySelector(":hover")?i.addEventListener("mouseleave",n):n()},h=s.tooltipHideDelay,a=setTimeout(o,h)):n()}
;function $(e){const{options:t}=(0,r.ensureNotNull)(W);if(M(e,t),function(e){e.classList.toggle(x["common-tooltip--hidden"],!1)}(e),(0,r.ensureNotNull)(z).observe(document,{childList:!0,subtree:!0}),F=!0,t.forceHideOnMove){const e=()=>{document.removeEventListener("mousemove",e),document.removeEventListener("touchmove",e),q()};document.addEventListener("mousemove",e),document.addEventListener("touchmove",e)}}function K(e){return e&&(e.nodeType===Node.ELEMENT_NODE?e:null)}function Y(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(64147);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())}}},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(32856)):""})))}},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(64289);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,11777));r=new e}return null===r&&(r=new ChartStorageHttp),r}},38881:(e,t,i)=>{"use strict";i.d(t,{ChunkLoader:()=>r});var s=i(14051);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+)/);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={}))},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||"<unknown url>"}, 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||"<unknown url>"}, 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:()=>u,emitOnce:()=>p,on:()=>c,subscribe:()=>h,subscribeToAll:()=>d,unsubscribe:()=>a,unsubscribeAll:()=>l});var s=i(52033);const r={},n=[],o={};function a(e,t,i){r[e].unsubscribe(i,t)}function l(e,t){r[e].unsubscribeAll(t)}function c(e,t,i){h(e,t,i)}function h(e,t,i,n){r.hasOwnProperty(e)||(r[e]=new s.Delegate),o[e]?t.call(i):r[e].subscribe(i,t,n)}function d(e){n.push(e)}function u(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 p(e){o[e]&&console.warn(`Something went wrong: emitOnce called multiple times with same event (${e})`),o[e]=!0,u.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(){for(const[,e]of this._actions)for(const t of e)t.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,{Hardcode:()=>s.Hardcode,Modifiers:()=>s.Modifiers,hashFromEvent:()=>s.hashFromEvent,hashShiftPlusEnter:()=>s.hashShiftPlusEnter,
hotkeyHashToAriaKeyshortcuts:()=>s.hotkeyHashToAriaKeyshortcuts,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)},71382:(e,t,i)=>{"use strict";i.d(t,{isTouchEvent:()=>r});var s=i(32563);function r(e){const t=e.sourceCapabilities;let i=t&&t.firesTouchEvents;return void 0===i&&(i=s.touch),i}},82992:(e,t,i)=>{"use strict";i.d(t,{linking:()=>m});var s=i(12481),r=i(50151),n=i(64147),o=(i(56570),i(85049)),a=i(68805),l=i(31955),c=i(42989),h=i(69109);const d=(0,l.getLogger)("Linking");var u,p;!function(e){e[e.NotBound=0]="NotBound",e[e.BoundToWidget=1]="BoundToWidget",e[e.BoundToModel=2]="BoundToModel"}(u||(u={})),function(e){e[e.Symbol=0]="Symbol",e[e.Resolution=1]="Resolution"}(p||(p={}));class _{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),(0,r.ensureNotNull)(this._chartWidgetCollection).setResolution(e,this._groupIndex).finally((()=>{if(this._boundChartWidget){const t=this._boundChartWidget.resolutionWV().value();o.Interval.isEqual(t,e)||this.watchedInterval.setValue(t)}})),this.mute(!1)}_needApplyInterval(e){return this._chartsForLock(1).some((t=>!o.Interval.isEqual(t.resolutionWV().value(),e)))}}const m=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 _(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:m})},11417:(e,t,i)=>{"use strict";const{getLogger:s}=i(31955),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;e<this.localStorage.length;e++){const i=this.key(e);t.push({key:i,length:String(this.getItem(i)).length})}t.sort(((e,t)=>t.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(92184);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)}}},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(67580).fetch;var s=i(66800).regExpEscape,r=i(21097).TVXWindowEvents,n=i(11417).TVLocalStorage,o=i(52033).Delegate,a=i(56570),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 y(e){return g+e}function S(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(y(e)):n.setItem(y(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<v.length;++t)if(v[t].exec(e))return!0;return!1}function M(e){return e.substring(0,g.length)===g}function A(e){f={};const t=0===Object.keys(e).length;t||function(e){Object.keys(e).forEach((function(t){f[t]=e[t]+""}))}(e),function(e){for(var t=n.length;t--;){var i=n.key(t);i&&M(i)&&(e&&w(S(i),n.getItem(i)),n.removeItem(i))}}(t)}r.on("settings",(function(e){var t=JSON.parse(e);null==t.value?delete f[t.key]:f[t.key]=t.value}));var L=new o;return{loaded:!1,loadedModel:!1,getValue:b,getJSON:function(e,t){var i=b(e,void 0);if(null==i)return t;try{return JSON.parse(i)}catch(i){return C(e),t}},getBool:function(e,t){var i=b(e);return null==i?t:!(!i||"false"===i||0==+i)},getFloat:function(e,t,i){var s=b(e,void 0);if(null==s)return t;var r=parseFloat(s);if(!isFinite(r))throw new TypeError('"'+s+'" is not float (key: "'+e+'")');return r},getInt:function(e,t,i){var s=b(e,void 0);if(null==s)return t;var r=parseInt(s,10)
;if(!isFinite(r))throw new TypeError('"'+s+'" is not int (key: "'+e+'")');return r},setValue:w,setJSON:function(e,t,i){return w(e,JSON.stringify(t),i),h},remove:C,keys:T,keysMask:function(e,t){for(var i=T(),r=[],n=(e=new RegExp("^"+s(e).replace(/\\\*\\\*/gi,".+").replace(/\\\*/gi,"[^.]+")+"$","gi"),i.length-1);n>=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"))}function n(e){var t;return null!==(t=null==e?void 0:e.includes("discontinued"))&&void 0!==t&&t}i.d(t,{hasCryptoTypespec:()=>s,isSymbolDelisted:()=>n,isYield:()=>r})},26843:(e,t,i)=>{"use strict";i.d(t,{StdTheme:()=>a.StdTheme,getStdChartTheme:()=>m,getStdThemeNames:()=>_,isStdTheme:()=>f,overrideStdTheme:()=>d,restoreStdThemes:()=>u,translateThemeName:()=>g});var s=i(24377),r=i(11542)
;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"}}}},"mainSourceProperties":{"baseLineColor":"#B2B5BE","prevClosePriceLineColor":"#555555","priceLineColor":"","highLowAvgPrice":{"highLowPriceLinesColor":"","averagePriceLineColor":""},"bidAsk":{"bidLineColor":"#2962FF","askLineColor":"#F7525F"},"prePostMarket":{"preMarketColor":"#FB8C00","postMarketColor":"#2962FF"},"candleStyle":{"borderColor":"#378658","upColor":"#089981","wickColor":"#737375","wickUpColor":"#089981","wickDownColor":"#F23645","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645"},"volCandlesStyle":{"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"},"hollowCandleStyle":{"upColor":"#089981","downColor":"#F23645","borderColor":"#378658","borderUpColor":"#089981","borderDownColor":"#F23645","wickColor":"#737375","wickUpColor":"#089981","wickDownColor":"#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"},"hiloStyle":{"color":"#2962FF","borderColor":"#2962FF","labelColor":"#2962FF"},"columnStyle":{"upColor":"rgba(8, 153, 129, 0.5)","downColor":"rgba(242, 54, 69, 0.5)"},"renkoStyle":{"upColor":"#089981","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645","upColorProjection":"#a9dcc3","downColorProjection":"#f5a6ae","borderUpColorProjection":"#a9dcc3","borderDownColorProjection":"#f5a6ae","wickUpColor":"#089981","wickDownColor":"#F23645"},"lineStyle":{"color":"#2962FF"},"lineWithMarkersStyle":{"color":"#2962FF"},"steplineStyle":{"color":"#2962FF"},"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"},"tpoStyle":{"color":"#2962ff","tpo":{"colors":{"gradientColors":["#e91e63","#00c853","#00bcd4","#651FFF"]}},"volumeProfile":{"valuesColor":"#089981","vah":{"color":"#3179F5"},"val":{"color":"#3179F5"},"poc":{"color":"#F23645"},"volumeColor":"rgba(41, 98, 255, 0.3)","valueAreaColor":"rgba(41, 98, 255, 0.7)"}}}}}'),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"}}}},"mainSourceProperties":{"baseLineColor":"#5d606b","prevClosePriceLineColor":"#555555","priceLineColor":"","highLowAvgPrice":{"highLowPriceLinesColor":"","averagePriceLineColor":""},"bidAsk":{"bidLineColor":"#2962FF","askLineColor":"#F7525F"},"prePostMarket":{"preMarketColor":"#FB8C00","postMarketColor":"#2962FF"},"candleStyle":{"borderColor":"#378658","upColor":"#089981","wickColor":"#737375","wickUpColor":"#089981","wickDownColor":"#F23645","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645"},"volCandlesStyle":{"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"},"hollowCandleStyle":{"upColor":"#089981","downColor":"#F23645","borderColor":"#378658","borderUpColor":"#089981","borderDownColor":"#F23645","wickColor":"#737375","wickUpColor":"#089981","wickDownColor":"#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"},"hiloStyle":{"color":"#2962FF","borderColor":"#2962FF","labelColor":"#2962FF"},"columnStyle":{"upColor":"rgba(8, 153, 129, 0.5)","downColor":"rgba(242, 54, 69, 0.5)"},"renkoStyle":{"upColor":"#089981","downColor":"#F23645","borderUpColor":"#089981","borderDownColor":"#F23645","upColorProjection":"#336854","downColorProjection":"#7f323f","borderUpColorProjection":"#336854","borderDownColorProjection":"#7f323f","wickUpColor":"#089981","wickDownColor":"#F23645"},"lineStyle":{"color":"#2962FF"},"lineWithMarkersStyle":{"color":"#2962FF"},"steplineStyle":{"color":"#2962FF"},"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"},"tpoStyle":{"color":"#2962ff","tpo":{"colors":{"gradientColors":["#e91e63","#00c853","#00bcd4","#651FFF"]}},"volumeProfile":{"valuesColor":"#089981","vah":{"color":"#3179F5"},"val":{"color":"#3179F5"},"poc":{"color":"#F23645"},"volumeColor":"rgba(41, 98, 255, 0.3)","valueAreaColor":"rgba(41, 98, 255, 0.7)"}}}}}')
;var a=i(24633);let l=n,c=o;function h(e,t){const i={...e};for(const s in t)"object"!=typeof e[s]||null===e[s]||Array.isArray(e[s])?void 0!==t[s]&&(i[s]=t[s]):i[s]=h(e[s],t[s]);return i}function d(e,t){switch(e){case a.StdTheme.Light:l=h(l,t);break;case a.StdTheme.Dark:c=h(c,t)}}function u(){l=JSON.parse(JSON.stringify(n)),c=JSON.parse(JSON.stringify(o))}function p(){return{[a.StdTheme.Light]:JSON.parse(JSON.stringify(l)),[a.StdTheme.Dark]:JSON.parse(JSON.stringify(c))}}function _(){return[a.StdTheme.Light,a.StdTheme.Dark]}function m(e){return p()[e]}function g(e){return{[a.StdTheme.Light]:r.t(null,{context:"colorThemeName"},i(96870)),[a.StdTheme.Dark]:r.t(null,{context:"colorThemeName"},i(85119))}[e]||e}function f(e){const t=p();return _().some((i=>v(t[i],e)))}function v(e,t){let i=e.content===t.content;return function(e,t){try{y(null!=e?e:{},[],t)}catch(e){return}}(e.content,((e,r)=>{const n=function(e,t){let i=null!=t?t:{};for(let t=0;t<e.length;t++){if(!i||"object"!=typeof i)return;i=i[e[t]]}if("string"==typeof i||"number"==typeof i)return i;return}(e,t.content);return i=function(e,t){if(e===t)return!0;if("string"!=typeof e||"string"!=typeof t)return!1;try{return function(e,t){return Math.hypot(e[3]*e[0]-t[3]*t[0],e[3]*e[1]-t[3]*t[1],e[3]*e[2]-t[3]*t[2],255*e[3]-255*t[3])<48}((0,s.parseRgba)(e),(0,s.parseRgba)(t))}catch(e){}return!1}(r,n),!i})),i}function y(e,t,i){for(const s in e)if(e.hasOwnProperty(s)){const r=t.concat(s);if("object"==typeof e[s])y(e[s],r,i);else if(i(r,e[s]))throw new Error("exit")}}},24633:(e,t,i)=>{"use strict";var s;i.d(t,{StdTheme:()=>s}),function(e){e.Light="light",e.Dark="dark"}(s||(s={}))},85662:(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:()=>y,saveTheme:()=>A,savedThemeName:()=>S,syncTheme:()=>b,themes:()=>_,translateStdThemeName:()=>D});var s=i(24377),r=i(35039),n=i(56840);function o(){return(0,n.getValue)("current_theme.name")||null}const a=i(64289);var l=i(26843),c=i(45345);const h="light";var d=i(11542),u=i(20913),p=i(19625);const _={[l.StdTheme.Light]:{name:l.StdTheme.Light,label:()=>d.t(null,{context:"colorThemeName"},i(96870)),order:2,getThemedColor:e=>(0,p.getHexColorByName)(e)},[l.StdTheme.Dark]:{name:l.StdTheme.Dark,label:()=>d.t(null,{context:"colorThemeName"},i(85119)),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 y(){(0,c.setTheme)(o()||h)}function S(){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){var t,i;return{content:{chartProperties:{paneProperties:e.model().properties().childs().paneProperties.state(),scalesProperties:e.model().properties().childs().scalesProperties.state()},sessions:null!==(i=null===(t=e.model().sessions().state())||void 0===t?void 0:t.properties)&&void 0!==i?i:(0,r.factoryDefaults)("sessions"),mainSourceProperties:e.model().mainSeries().properties().state(),version:e.model().version()}}}},45345:(e,t,i)=>{"use strict";i.d(t,{setTheme:()=>o,watchedTheme:()=>n});var s,r=i(64147);!function(e){e.ThemeClassPrefix="theme-"}(s||(s={}));const n=new r.WatchedValue;function o(e){n.setValue(e)}n.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(56570);const n=(0,i(31955).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<o.length;e++){const i=t.match(o[e]);if(i&&3===i.length){t=i[1],r=i[2];break}}(0,s.emit)(t.toLowerCase().replace(" ","_"),{category:e,label:i,value:r})})(e,t,i);let l=(e?e+":":"")+t;i&&(l+=" "+i),n.logNormal(l),r.enabled("widget")||!window._UNIT_TESTS&&window.gtag&&window.gtag("event",t,{event_category:e,event_label:i})};function c(){a=!0}var h,d,u;"undefined"!=typeof window&&(window.TradingView=window.TradingView||{},window.TradingView.trackEvent=l),function(e){e.GUI="GUI"}(h||(h={})),function(e){e.ChartHeaderToolbar="Chart Header Toolbar",e.ChartBottomToolbar="Chart Bottom Toolbar",e.ChartLeftToolbar="Chart Left Toolbar",e.TimeInterval="Time Interval",e.LoadChartLayout="Load chart layout"}(d||(d={})),
function(e){e.Range="range",e.GoTo="go to",e.ChartProperties="chart properties",e.Compare="compare",e.SelectLayout="select layout",e.MagnetMode="magnet mode",e.DrawingMode="drawing mode",e.LockAllDrawing="lock all drawing",e.RemoveDrawing="remove drawing",e.RemoveIndicator="remove indicator",e.RemoveAll="remove all",e.HideDrawings="hide drawings",e.HideIndicators="hide indicators",e.HidePositions="hide positions",e.HideAll="hide all",e.Sync="sync",e.SyncMode="sync mode",e.SwitchChartLayout="Switch chart layout",e.DeleteChartLayout="Delete chart layout",e.LoadChartLayout="Load chart layout",e.AddToFavorites="Add to favorites",e.Sort="Sort"}(u||(u={}))},21097:(e,t,i)=>{"use strict";i.d(t,{TVXWindowEvents:()=>o});i(21251);var s=i(31955),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<r.TVLocalStorage.length;i++){const s=r.TVLocalStorage.key(i);s.startsWith(t)&&e.push(s)}const s=r.TVLocalStorage.length;for(const t of e)r.TVLocalStorage.removeItem(t);const o=performance.now()-i;n.logNormal(`Total keys amount in local storage on operation start: ${s}`),n.logNormal(`Keys amount in local storage to be deleted: ${e.length}`),n.logNormal(`Keys to be deleted from local storage: ${JSON.stringify(e)}`),n.logNormal(`Removing keys from local storage took ${o} ms`)}()):window.addEventListener("storage",(function(e){const{newValue:s,key:n}=e;if(null===s||!n||!n.startsWith(t))return;const o=n.substring(t.length);i[o]&&i[o].forEach((t=>{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={}))},58473:(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<s.length;t++)if(s[t].name===e)return t;return-1}function o(e){if(!r)for(let t=s.length-1;t>=0&&!0!==s[t].func(e);t--);}window.addEventListener("keypress",o,!1);var a=i(79652),l=i(56570),c=i(86235),h=i(86001),d=i(50340),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";var r;!function(e){e[e.Mobile=0]="Mobile",e[e.TabletSmall=480]="TabletSmall",e[e.Tablet=768]="Tablet",e[e.TabletLarge=1024]="TabletLarge",e[e.DesktopSmall=1280]="DesktopSmall",e[e.Desktop=1440]="Desktop",e[e.DesktopLarge=1920]="DesktopLarge"}(r||(r={}))},42120:(e,t,i)=>{"use strict";i.d(t,{CompareDialogRenderer:()=>n});var s=i(29280);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([Promise.all([i.e(4040),i.e(7271)]).then(i.bind(i,56217)),Promise.all([i.e(6703),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(7399),i.e(2248),i.e(7769),i.e(7125),i.e(8077),i.e(5546),i.e(3114),i.e(5666),i.e(3204),i.e(1729),i.e(9486),i.e(4959),i.e(2208),i.e(3538),i.e(2227),i.e(3443),i.e(6014),i.e(361),i.e(2079),i.e(3098),i.e(2751),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(877),i.e(3060),i.e(7528),i.e(6246),i.e(2248),i.e(6625),i.e(55),i.e(4392),i.e(8073),i.e(8722),i.e(7092),i.e(2227),i.e(6014),i.e(4804),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(877),i.e(3060),i.e(7528),i.e(6246),i.e(2248),i.e(6625),i.e(55),i.e(4392),i.e(8073),i.e(8722),i.e(7092),i.e(2227),i.e(6014),i.e(4804),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(877),i.e(3060),i.e(7528),i.e(6246),i.e(2248),i.e(6625),i.e(55),i.e(4392),i.e(8073),i.e(8722),i.e(7092),i.e(2227),i.e(6014),i.e(4804),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:()=>n});var s,r=i(52033);!function(e){e.Drawings="drawings",e.Indicators="indicators",e.Positions="positions",e.All="all"}(s||(s={}));const n=new r.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(79320),a=i(928),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(3217)),dataName:"hide-drawing-tools",tooltip:{active:r.t(null,void 0,i(85891)),inactive:r.t(null,void 0,i(52563))},getBoxedValue:()=>(0,a.hideAllDrawings)(),trackLabel:"hide drawings"}],["indicators",{label:r.t(null,void 0,i(72351)),dataName:"hide-indicators",tooltip:{active:r.t(null,void 0,i(98753)),inactive:r.t(null,void 0,i(78525))},getBoxedValue:()=>(0,a.hideAllIndicators)(),trackLabel:"hide indicators"}],["positions",{label:r.t(null,void 0,i(92226)),dataName:"hide-positions-and-orders",tooltip:{active:r.t(null,void 0,i(20506)),inactive:r.t(null,void 0,i(42164))},getBoxedValue:()=>(0,s.ensureNotNull)(e).showTradedSources,inverted:!0,trackLabel:"hide positions"}],["all",{label:r.t(null,void 0,i(47074)),dataName:"hide-all",tooltip:{active:e?r.t(null,void 0,i(86738)):r.t(null,void 0,i(25881)),inactive:e?r.t(null,void 0,i(18216)):r.t(null,void 0,i(90763))},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(29280);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(2257),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(7399),i.e(2248),i.e(7769),i.e(7125),i.e(8077),i.e(6625),i.e(5546),i.e(55),i.e(4392),i.e(3114),i.e(5666),i.e(8432),i.e(3204),i.e(1729),i.e(9486),i.e(4959),i.e(6107),i.e(6665),i.e(4447),i.e(8065),i.e(3762),i.e(3645),i.e(1259),i.e(7902),i.e(6955),i.e(5622),i.e(2417),i.e(3925),i.e(1398),i.e(8596),i.e(2038),i.e(2227),i.e(3443),i.e(6014),i.e(2079),i.e(3098),i.e(2751),i.e(2264),i.e(7223),i.e(4774),i.e(6408),i.e(9370),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(52033).Delegate);function r(){s.fire()}},76384:e=>{e.exports={"css-value-header-toolbar-height":"38px"}},75162:e=>{e.exports={chartsSplitter:"chartsSplitter-L0xapso5",hovered:"hovered-L0xapso5","i-active":"i-active-L0xapso5"}},80747:e=>{e.exports={"css-value-pane-controls-padding-left":"1px","css-value-pane-controls-padding-right":"4px"}},37702:e=>{e.exports={paneSeparator:"paneSeparator-uqBaC1Ki",handle:"handle-uqBaC1Ki",hovered:"hovered-uqBaC1Ki",active:"active-uqBaC1Ki"}},64176:e=>{e.exports={priceScaleModeButtons:"priceScaleModeButtons-PEm49B2T",priceScaleModeButtons__buttonWrapper:"priceScaleModeButtons__buttonWrapper-PEm49B2T",priceScaleModeButtons__button:"priceScaleModeButtons__button-PEm49B2T",priceScaleModeButtons__button_activated:"priceScaleModeButtons__button_activated-PEm49B2T"}},7507:(e,t,i)=>{"use strict";i.d(t,{getLineToolsSynchronizerClass:()=>o,loadLineToolsSynchronizer:()=>n});var s=i(56570);let r=null;async function n(){if(s.enabled("saveload_separate_drawings_storage")){const e=await i.e(7129).then(i.bind(i,49053));return r=e.LineToolsSynchronizer,!0}return!1}function o(){if(!r)throw new Error("LineToolsSynchronizer Class not loaded");return r}},79437:(e,t,i)=>{"use strict";var s=i(37265).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,i){},r.prototype.createStudy=function(e,t,i,s,r,n,o,a){},r.prototype.getStudyCounter=function(e){},r.prototype.getFundamentalCounter=function(e){},r.prototype.removeStudy=function(e,t){},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._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},64289:(e,t,i)=>{"use strict";i.r(t),i.d(t,{favorStandardStudyTemplate:()=>D,favorStudyTemplate:()=>k,getChartContent:()=>P,getCharts:()=>b,getChartsCount:()=>S,getCustomAdapter:()=>f,getDrawingTemplates:()=>R,getStandardStudyTemplateById:()=>E,getStorageURL:()=>m,getStudyTemplateById:()=>I,getStudyTemplatesList:()=>A,initialize:()=>v,invalidateStudyTemplatesList:()=>L,isThemeExist:()=>j,loadChart:()=>x,loadDrawingTemplate:()=>N,loadTheme:()=>W,loadThemes:()=>H,removeChart:()=>w,removeDrawingTemplate:()=>O,removeStudyTemplate:()=>T,removeTheme:()=>U,renameStudyTemplate:()=>V,replaceStudyTemplate:()=>B,saveChart:()=>C,saveDrawingTemplate:()=>F,saveStudyTemplate:()=>M,saveTheme:()=>z,setCustomAdapter:()=>g,updateUser:()=>y});var s=i(76422),r=i(31955),n=i(14712),o=i(56840);const a=(0,r.getLogger)("Chart.SaveloadAdapter.Library"),l={error:""};let c,h,d,u,p=null,_=null;function m(e){return`${d}/${encodeURIComponent(u)}/${e}?client=${encodeURIComponent(c)}&user=${encodeURIComponent(h)}`}function g(e){p=e}function f(){return p}function v(e,t,i,s){c=e,h=t,d=i,u=s}function y(e){h=e}function S(e,t){throw new Error("Not implemented")}async function b(){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(p)return p.getAllCharts().then(e);try{const t=await fetch(`${m("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 a.logWarn((0,n.errorToString)(e)),e}}async function w(e){if(p)return p.removeChart(e);try{const t=await fetch(`${m("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 a.logWarn((0,n.errorToString)(e)),e}}async function C(e,t,i,s,r){var o;const l=r.id.value(),c={name:e,content:JSON.stringify(s),symbol:t,resolution:i};try{if(p){return{result:await p.saveChart({...c,id:l,timestamp:Math.round(Date.now()/1e3)})}}const e=new FormData;for(const t in c)e.append(t,c[t]);let t=m("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{result:(null!==(o=s.id)&&void 0!==o?o:l).toString(),response:i}}catch(e){throw a.logWarn((0,n.errorToString)(e)),e}}async function P(e){const t=t=>{const i=JSON.parse(t);return i.uid=e.id,i};if(p)return p.getChartContent(e.id).then((e=>t(e)));try{const i=await fetch(`${m("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 a.logWarn((0,n.errorToString)(e)),e}}function x(e){P(e).then((e=>{s.emit("chart_load_requested",e)}),(()=>{a.logWarn("Error loading chart")}))}async function T(e){try{const t=G().filter((t=>t!==e));if(p)return q(t),p.removeStudyTemplate({name:e});const i=await fetch(`${m("study_templates")}&template=${encodeURIComponent(e)}`,{method:"DELETE",credentials:"same-origin"});if(!i.ok)throw new Error(`Remove study template response was not OK. Status: ${i.status}.`);const s=await i.json();if("ok"!==s.status)throw new Error("Remove study template request failed: "+s.message);q(t)}catch(e){throw a.logWarn((0,n.errorToString)(e)),e}}async function I(e){try{if(p){return{content:await p.getStudyTemplateContent({name:e})}}const t=await fetch(`${m("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 a.logWarn((0,n.errorToString)(e)),e}}async function M(e){try{if(p)return p.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(m("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 a.logWarn((0,n.errorToString)(e)),e}}async function A(){try{if(_)return _;_=[];const e=e=>(_=e.map((e=>{const t=G().indexOf(e.name);return{id:e.name,is_default:!1,name:e.name,favorite_date:-1!==t?t:null}})),_);if(p)return p.getAllStudyTemplates().then(e)
;const t=await fetch(m("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 a.logWarn((0,n.errorToString)(e)),e}}function L(){_=null}function k(e,t,i){const s=G();q(t?[...s,e]:s.filter((t=>t!==e))),null==i||i(null)}function D(e,t,i){k(e,t,i)}function E(e,t){throw new Error("Not implemented")}function V(e,t,i){throw new Error("Not implemented")}function B(e,t,i){throw new Error("Not implemented")}async function R(e){throw new Error("Not implemented")}async function N(e,t){throw new Error("Not implemented")}async function O(e,t){throw new Error("Not implemented")}async function F(e,t,i){throw new Error("Not implemented")}function W(e){if(null!==p)return p.getChartTemplateContent(e);throw new Error("Not implemented")}function H(){return null!==p?p.getAllChartTemplates():Promise.resolve([])}async function z(e,t){if(null!==p)try{return await p.saveChartTemplate(e,t),l}catch(e){return console.error(e),{error:e instanceof Error?e.message:e.toString()}}throw new Error("Not implemented")}async function U(e){if(null!==p)try{return await p.removeChartTemplate(e),l}catch(e){return console.error(e),{error:e instanceof Error?e.message:e.toString()}}throw new Error("Not implemented")}function j(e){return W(e).then((e=>Boolean(e.content)))}function G(){return o.getJSON("StudyTemplates.quicks",[])}function q(e){o.setJSON("StudyTemplates.quicks",e)}},51243:(e,t,i)=>{"use strict";var s=i(50151).ensureNotNull,r=i(50151).ensureDefined,n=i(14381),o=i(85049).Interval,a=i(80359),l=i(6058),c=i(79437).ChartApiInterface,h=i(18278).HandlerInfo,d=i(37265).requireFullInterfaceImplementation,u=i(31955).getLogger("Chart.ChartApiLocal"),p=i(82783).TIMEFRAMETYPE,_=i(53388).createDwmAligner;TradingView.STUDY_COUNT_LIMIT=210;function m(e,t){return`${e}__${t}`}JSServer.ChartApi=function(e){this._notificationHandlers={},this._sessions={},this.studyCounter=0,this._metadataRequestNextNumber=1,this._connected=!1,this._enabled=!1,this._studyEngine=new a(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={},this._studySpecs=new Map,this._isNonCountedStudy=()=>!0},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;r<s.length;++r)s[r](t)}},JSServer.ChartApi.prototype.chartCreateSession=function(e,t){this._studyEngine.chartCreateSession(e)},JSServer.ChartApi.prototype.chartDeleteSession=function(e){this._studyEngine.chartDeleteSession(e)},JSServer.ChartApi.prototype.createSession=function(e,t){TradingView.ChartapiMessagerInstances[e]=new l(this,e),this._sessions[e]=t,this._notificationHandlers[e]={},this.connected()&&t.onMessage({method:"connected",params:[]})},JSServer.ChartApi.prototype.removeSession=function(e){delete this._sessions[e],delete this._notificationHandlers[e],this._studyEngine.stopSources(e)},JSServer.ChartApi.prototype.connected=function(){return this._connected},JSServer.ChartApi.prototype.connect=function(){if(this._enabled)this.connected()||(this._connected=!0,this.sessionid="dummy session id",this._notifySessions({method:"connected",params:[]}));else{var e=this;this.on("start_enabled",(function(){e.connect()}))}},JSServer.ChartApi.prototype.disconnect=function(){this._connected=!1,this._notifySessions({method:"disconnected",params:[]}),this.purgeCache(),this.studyCounter=0},JSServer.ChartApi.prototype.switchTimezone=function(e,t){this._studyEngine.switchTimezone(e,t)},JSServer.ChartApi.prototype.receiveLocalResponse=function(e){this._dispatchNotification(e),this._fireEvent("message_"+e.method,void 0,!0)},JSServer.ChartApi.prototype.getMarks=function(e,t,i,s,r){this._studyEngine.getMarks(e,t,i,s,r)},JSServer.ChartApi.prototype.getTimescaleMarks=function(e,t,i,s,r){this._studyEngine.getTimescaleMarks(e,t,i,s,r)},JSServer.ChartApi.prototype.resolveSymbol=function(e,t,i,s){this._notificationHandlers[e][t]=new h(s,t),this._studyEngine.resolveSymbol(e,t,i)},JSServer.ChartApi.prototype.createSeries=function(e,t,i,s,r,n,o,a){var l=this;this._notificationHandlers[e][t]=new h((function(r){"series_completed"===r.method&&null!==o&&(l._applyTimeFrame(e,s,t,i,o),o=null),a(r)}),t);const c={
countBack:n||300};null!==o&&o.type===p.TimeRange&&(c.to=1e3*o.to,c.from=1e3*o.from),this._studyEngine.createSeries(e,t,i,s,r,c)},JSServer.ChartApi.prototype.removeSeries=function(e,t){delete this._notificationHandlers[e][t],this._studyEngine.removeSeries(e,t)},JSServer.ChartApi.prototype.setVisibleTimeRange=function(e,t,i,r,n,o,a,l,c){var h=r,d=!0!==(a=a||{}).applyDefaultRightMargin&&void 0===a.percentRightMargin&&void 0!==n?n:null,u=_(this._studyEngine.getSeriesInterval(e,t),this._studyEngine.getSeriesSymbolInfo(e,t));null!==u&&(h=u.timeToSessionStart(1e3*h)/1e3,null!==d&&(d=u.timeToSessionStart(1e3*d)/1e3));var p=this;function m(){var r=p._studyEngine.sessionTimeScale(e);if(null!==r){var n,u=r.indexOfTime(1e3*h);if(null===d)n=r.lastSessionBarIndex();else{var _=r.indexOfTime(1e3*d);n=_&&_.index}if(null!==u&&null!==n){var m=u.index;if(u.timeMs<1e3*h&&(m+=1),!1===o){const e=s(r.firstSessionBarIndex());m<e&&(m=e)}m>n||(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,y,!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,y),m())}function y(e,s){e===t&&s===i&&g.unsubscribe(null,v)}},JSServer.ChartApi.prototype._applyTimeFrame=function(e,t,i,s,r){var a,l,c={},h=!0;if(r.type===p.PeriodBack){var d=this._studyEngine.getSeriesLastBarTime(e,i);if(null===d)return;l=d/1e3;var u=o.parse(r.value),m=this._studyEngine.getSeriesSymbolInfo(e,i);a=n.alignPeriodsBackForVisibleRange(m.session,m.session_holidays,m.corrections,u.letter(),u.multiplier(),1,d)/1e3;var g=_(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=r.from,l=r.to;this.setVisibleTimeRange(e,i,s,a,l,h,c,void 0,r)},JSServer.ChartApi.prototype.modifySeries=function(e,t,i,s,r,n,o,a){var l=this;this._notificationHandlers[e][t]=new h((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.setIsNonCountedStudyFn=function(e){this._isNonCountedStudy=e},JSServer.ChartApi.prototype.canCreateStudy=function(e,t,i){return this._isNonCountedStudy(t.id)||this.studyCounter<TradingView.STUDY_COUNT_LIMIT?{success:!0}:{success:!1,reason:"general",limitValue:TradingView.STUDY_COUNT_LIMIT}},JSServer.ChartApi.prototype.getStudyCounter=function(e){return this.studyCounter},JSServer.ChartApi.prototype.getFundamentalCounter=function(e){return 0},JSServer.ChartApi.prototype.createStudy=function(e,t,i,s,r,n,o,a){if(!this.canCreateStudy(e,a).success){const e=new Error("Exceeded the limit of studies");throw e.cause="TooManyStudies",e}return this._notificationHandlers[e][t]=new h(o,t),this._studySpecs.set(m(e,t),a),this._studyEngine.createStudy(e,t,s,i,r,n),this._isNonCountedStudy(a.id)||this.studyCounter++,!0},JSServer.ChartApi.prototype.removeStudy=function(e,t){if(this._notificationHandlers[e][t]){delete this._notificationHandlers[e][t];const i=m(e,t),s=r(this._studySpecs.get(i));this._studySpecs.delete(i),this._studyEngine.removeStudy(e,t),this._isNonCountedStudy(s.id)||this.studyCounter--}},JSServer.ChartApi.prototype.modifyStudy=function(e,t,i,s,r){this._notificationHandlers[e][t]=new h(r,t),this._studyEngine.modifyStudy(e,t,i,s)},JSServer.ChartApi.prototype.notifyStudy=function(){throw Error("This call is not implemented")},JSServer.ChartApi.prototype.createPointset=function(e,t,i,s,r,n,o){this._notificationHandlers[e][t]=new h(o,t),this._studyEngine.createPointset(e,t,s,r,n)},JSServer.ChartApi.prototype.modifyPointset=function(e,t,i,s,r){throw Error("This call is not implemented")},JSServer.ChartApi.prototype.removePointset=function(e,t,i){this._notificationHandlers[e][t]=null,this._studyEngine.removePointset(e,t)},JSServer.ChartApi.prototype.requestMoreTickmarks=function(e,t,i){this._studyEngine.requestMoreTickmarks(e,i)},JSServer.ChartApi.prototype.requestFirstBarTime=function(e,t,i,s){this._notificationHandlers[e][t]=new h(s,t)},JSServer.ChartApi.prototype._invokeHandler=function(e,t){e&&e(t)},JSServer.ChartApi.prototype._sendRequest=function(e,t){throw Error("This method is not implemented")},JSServer.ChartApi.prototype._onMessage=function(e){throw Error("This method is not implemented")},JSServer.ChartApi.prototype._dispatchNotification=function(e){var t=e.params.shift();if(this._notificationHandlers[t])switch(e.method){case"timescale_update":var i=e.params[0],s=e.params[1];for(var r in s.clear=0===s.changes.length&&0===s.marks.length,this._sessions[t].onMessage({method:"timescale_update",params:s}),i){var n={method:"data_update",params:{customId:r,plots:i[r].series,nonseries:i[r].nonseries,turnaround:i[r].turnaround}};this._invokeNotificationHandler(t,r,n)}break;case"tickmark_update":this._sessions[t].onMessage({method:"timescale_update",params:e.params[0]});break;case"data_update":for(var r in e.params[0]){var o=e.params[0][r];n={method:"data_update",params:{customId:r,
plots:o.series?o.series:o.plots,nonseries:o.nonseries,turnaround:o.turnaround}};this._invokeNotificationHandler(t,r,n)}break;case"index_update":for(var r in e.params[0]){n={method:"index_update",params:e.params[0][r]};this._invokeNotificationHandler(t,r,n)}break;case"critical_error":u.logNormal(new Date+" critical_error session:"+this.sessionid+" reason:"+e.params[0]),this._sessions[t].onMessage({method:"critical_error",params:e.params});break;case"timescale_completed":case"quote_symbol_data":case"quote_list_fields":case"depth_symbol_error":case"depth_symbol_success":case"dd":case"dpu":case"depth_bar_last_value":this._sessions[t].onMessage({method:e.method,params:e.params});break;case"clear_data":for(var a in e.params[0])this._invokeNotificationHandler(t,a,{method:"clear_data",params:e.params[0][a]});break;default:var l=e.params[0];this._invokeNotificationHandler(t,l,e)}},JSServer.ChartApi.prototype._invokeNotificationHandler=function(e,t,i){if(void 0!==t){var s=this._notificationHandlers[e][t];void 0!==s&&s&&this._invokeHandler(s.handler,i)}},JSServer.ChartApi.prototype.searchSymbols=function(e,t,i,s,r,n,o,a,l,c){this._studyEngine.searchSymbols(e,t,i,c)},JSServer.ChartApi.prototype._notifySessions=function(e){for(var t in this._sessions){if(!this._sessions.hasOwnProperty(t))return;var i=this._sessions[t];"function"==typeof i.onMessage&&i.onMessage(e)}},JSServer.ChartApi.prototype.unpack=function(e){throw Error("This method is not implemented")},JSServer.ChartApi.prototype.quoteCreateSession=function(e){return this._studyEngine.quoteCreateSession(e)},JSServer.ChartApi.prototype.quoteDeleteSession=function(e){return this._studyEngine.quoteDeleteSession(e)},JSServer.ChartApi.prototype.quoteSetFields=function(e,t){return this._studyEngine.quoteSetFields(e,t)},JSServer.ChartApi.prototype.quoteAddSymbols=function(e,t){return-1!==t.indexOf(void 0)&&(console.warn("Got undefined in quoteAddSymbols"),t=t.filter((function(e){return!!e}))),this._studyEngine.quoteAddSymbols(e,t)},JSServer.ChartApi.prototype.quoteRemoveSymbols=function(e,t){return this._studyEngine.quoteRemoveSymbols(e,t)},JSServer.ChartApi.prototype.quoteFastSymbols=function(e,t){return this._studyEngine.quoteFastSymbols(e,t)},JSServer.ChartApi.prototype.quoteHibernateAll=function(e){return this._studyEngine.quoteHibernateAll(e)},JSServer.ChartApi.prototype.depthCreateSession=function(e){return this._studyEngine.depthCreateSession(e)},JSServer.ChartApi.prototype.depthDeleteSession=function(e){return this._studyEngine.depthDeleteSession(e)},JSServer.ChartApi.prototype.depthSetSymbol=function(e,t){return this._studyEngine.depthSetSymbol(e,t)},JSServer.ChartApi.prototype.depthClearSymbol=function(e){},JSServer.ChartApi.prototype.depthSetScale=function(e,t){},JSServer.ChartApi.prototype.createStudiesAccessController=function(e,t,i){return new this.StudiesAccessController(this._studyEngine,e&&JSON.parse(e)||{type:"black",tools:[]})},JSServer.ChartApi.prototype.StudiesAccessController=function(e,t){this._studyEngine=e,this._studiesAccess=t},
JSServer.ChartApi.prototype.StudiesAccessController.prototype._findTool=function(e){for(var t=null,i=0;i<this._studiesAccess.tools.length;++i){var s=this._studiesAccess.tools[i];if(s.name===e||s===e){t=s;break}}return t},JSServer.ChartApi.prototype.StudiesAccessController.prototype.getEnabledTools=function(){return this._studyEngine.studiesMetadata().filter((function(e){return this.isToolEnabled(e.description)||e.is_hidden_study}),this)},JSServer.ChartApi.prototype.StudiesAccessController.prototype.isToolEnabled=function(e){var t=this._findTool(e);return"black"===this._studiesAccess.type?!t||t.grayed:!!t},JSServer.ChartApi.prototype.StudiesAccessController.prototype.isToolGrayed=function(e){var t=this._findTool(e);return t&&t.grayed},JSServer.ChartApi.prototype.serverTimeOffset=function(){return this._studyEngine.serverTimeOffset()},JSServer.ChartApi.prototype.serverTime=function(){return this._studyEngine.serverTime()},JSServer.ChartApi.prototype.disconnectCount=function(){return 0},d(JSServer.ChartApi,"JSServer.ChartApi",c,"ChartApiInterface"),e.exports=JSServer.ChartApi},6058:(e,t,i)=>{"use strict";var s=i(52033).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},47282:(e,t,i)=>{"use strict";i.d(t,{DatafeedRequestsCachedProcessor:()=>m});var s,r=i(50151),n=i(85049),o=i(29981),a=i(56570),l=i(14381),c=i(53388),h=i(69748),d=(i(21251),i(85541));function u(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 p(e){return new Date(e).toISOString()}!function(e){e.ThreadKeySeparator="_#_"}(s||(s={})),function(e){e[e.MaxEmptyResponsesInARow=50]="MaxEmptyResponsesInARow",e[e.ResetCacheTimePeriod=1e4]="ResetCacheTimePeriod"}(s||(s={}));class _{constructor(e,t,i,s,r,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=n.Interval.parse(i),this._resolution=this._interval.value(),this._dwmAligner=r,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&&this._logWarning("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}),n.Interval.isDWM(this._resolution)&&void 0!==e.to&&null!==this._dwmAligner&&e.to%864e5&&this._logWarning(`Internal error: invalid date for DWM resolution ${p(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)));this._logWarning("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}`)}_logWarning(e){console.warn(`${this._logMessagePrefix()}${e}`)}_logError(e){console.error(`${this._logMessagePrefix()}${e}`)}_logMessagePrefix(){const e=this._symbolInfo.currency_code,t=this._symbolInfo.unit_id;return`${(new Date).toISOString()} 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,r.ensureNotNull)(this._leftDate))return{countBack:e.countBack,to:t};const i=null!==this._dwmAligner?this._dwmAligner.timeToSessionStart(t):t,s=(0,o.lowerbound)(this._cache.bars,i,((e,t)=>e.time<t));return e.countBack<s?{countBack:0,to:0!==e.countBack&&s<=this._cache.bars.length?this._dealignTime(this._cache.bars[s-e.countBack].time):t}:{countBack:e.countBack-s,to:this._dealignTime(this._cache.bars[0].time)}}_processPendingSubscribers(){const e=this._pendingSubscribers;if(!e.length)return;if(this._requesting)return void this._logMessage("Processing is skipped due active request");if(this._logMessage(`Processing pending subscribers, count=${e.length}`),this._errorMessage){const t=this._errorMessage;return this._logMessage(`Return error: ${t}`),this._pendingSubscribers=[],void e.forEach((e=>{e.onErrorCallback(t)}))}let t=this._normalizeRange(e[0].range);for(const i of e.map((e=>this._normalizeRange(e.range))))(i.to<t.to||i.to===t.to&&i.countBack>t.countBack)&&(t=i);this._logMessage(`Leftmost subscriber requires ${t.countBack} bars prior ${p(t.to)}`);!(null===this._leftDate||t.to<this._leftDate&&(null===this._nextTime||t.to<this._nextTime)||0!==t.countBack)||this._endOfData?(this._pendingSubscribers=[],e.forEach((e=>{
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)}))}),u(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(u(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(),p(s.bars[0].time),p(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,o.lowerbound)(this._cache.bars,t,((e,t)=>e.time<t)),s=new d.BarSet(this._symbolInfo,this._cache.bars.slice(Math.max(0,i-e.countBack)));return 0!==s.bars.length?s.firstLoadedTimeMs=this._dealignTime(s.bars[0].time):0!==this._cache.bars.length?s.firstLoadedTimeMs=this._dealignTime(this._cache.bars[this._cache.bars.length-1].time):s.firstLoadedTimeMs=this._dealignTime((0,r.ensureNotNull)(this._leftDate)),s}_ensureRequestedTo(e){var t;let i;if(this._requesting&&this._logMessage("Internal error: trying to call getBars while the previous request is active",!0),null!==this._leftDate)i=this._leftDate;else{const e=this._now();if(null===this._dwmAligner)i=e;else{let t=this._sessionSpec.alignToNearestSessionStart(new Date(e),1).getTime();if(t<e){const e=this._sessionSpec.alignToNearestSessionEnd(new Date(t),1).getTime();t=this._sessionSpec.alignToNearestSessionStart(new Date(e+1e3),1).getTime()}i=this._dealignTime(t)}}const s=(0,
l.alignPeriodsBackForDataRequest)(this._symbolInfo.session,this._symbolInfo.session_holidays,this._symbolInfo.corrections,this._interval.letter(),this._interval.multiplier(),e.countBack,Math.min(e.to,i,null!==(t=this._nextTime)&&void 0!==t?t:1/0));let r=e.countBack;if(e.to<i){r+=(0,l.getPeriodsBetweenDates)(this._symbolInfo.session,this._symbolInfo.session_holidays,this._symbolInfo.corrections,this._interval.letter(),this._interval.multiplier(),e.to,i)}if(null!==this._leftDate&&this._leftDate<s)return void this._processPendingSubscribers();const n=this._firstDataRequest||(this._isSymbolExpired()?0===this._cache.bars.length:null===this._leftDate);this._firstDataRequest=!1,this._requesting=!0,this._nextTime=null,this._leftDate=s;const o=`[${p(s)} ... ${p(i)}, ${r} bars]`;this._logMessage(`Requesting data: ${o}`);let a=!1;const c=s/1e3,h=i/1e3;this._datafeed.getBars(this._symbolInfo,this._resolution,{from:this._interval.isTicks()?c:Math.floor(c),to:this._interval.isTicks()?h:Math.floor(h),countBack:r,firstDataRequest:n},((e,t)=>{if(!this._destroyed)if(a)this._logMessage("getBars callback is already called before",!0);else{if(a=!0,e.length>0){const t=` [${p(e[0].time)} ... ${p(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(p(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?this._logWarning("nextTime should be set when there is no data in the requested period only"):t&&t.noData&&this._logWarning("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<e.length;i++){if(e[i].time<=e[i-1].time){let s=`Wrong bars time: time ${e[i].time} of bar ${i} should be more than time ${e[i-1].time} of bar ${i-1}`;t&&null!==this._dwmAligner&&(s+="\nCheck that you provide DWM bars without time part, i.e. 00:00 GMT"),this._logError(s)}["high","low","open","close","time"].some((t=>"number"!=typeof e[i][t]||!isFinite(e[i][t])))&&this._logError("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||s<i?this._cache.bars.push(e):s===i?(this._interval.isTicks()&&this._logMessage("Received update for the last tick bar"),this._cache.bars[t-1]=e):this._logError(`putToCacheNewBar: time violation, previous bar time: ${p(s)} should be less or equal to new time: ${p(i)}`)}_alignBarsTime(e){if(this._dwmAligner)for(const t of e)t.time=this._dwmAligner.timeToSessionStart(t.time)}_now(){return Date.now()+1e3*this._serverTimeOffsetGetter()+6e4}}class m{constructor(e,t,i){this._threads={},this._datafeed=e,this._serverTimeOffsetGetter=t,this._resetCacheTimePeriod=i}destroy(){this._forEachThread(((e,t)=>t.destroy())),this._threads={},delete this._datafeed}purgeCache(){this._forEachThread(((e,t)=>t.destroy())),this._threads={}}subscribe(e,t,i,s,r){const n=u(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 this._logWarning("Wrong guid format");const i=t[0],s=parseInt(t[1]);this._threads.hasOwnProperty(i)?this._threads[i].removeSubscription(s):this._logWarning("Data thread doesnt exist: "+e)}_createThread(e,t){return new _(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])))}_logWarning(e){console.warn(`${(new Date).toISOString()} FEED: ${e}`)}}},9447:(e,t,i)=>{"use strict";i.d(t,{barTimeToEndOfPeriod:()=>r,endOfPeriodToBarTime:()=>n});var s=i(83910);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}},30328:(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}},9001:(e,t,i)=>{"use strict";var s=i(56570);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)}},2060:(e,t,i)=>{"use strict";var s,r=i(14381),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"regular":
o=new r.SessionInfo(e.timezone,e.session,e.session_holidays,t["session-correction"]||e["session-correction"]||e.corrections);break;case"premarket":a=new r.SessionInfo(e.timezone,t.session,e.session_holidays,t["session-correction"]||e["session-premarket-correction"]||e.corrections);break;case"postmarket":l=new r.SessionInfo(e.timezone,t.session,e.session_holidays,t["session-correction"]||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}},85541:(e,t,i)=>{"use strict";i.d(t,{BarSet:()=>s});class s{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){const t=this.bars[e];if(void 0===t)throw new Error(`BarSet has no value at index ${e}`);return t}count(){return this.bars.length}emptyBarCount(){return this._emptyBarCount}add(e,t,i){void 0===i&&(i=!1);const s=e,r=this.bars,n=r.length,o=s.time,a=0===n?NaN:r[n-1].time;0===n||a<o?(r.push(s),i&&(this._emptyBarCount+=1,this._lastBarIsEmpty=!0)):a===o?(i!==this._lastBarIsEmpty&&(this._emptyBarCount+=i?1:-1,this._lastBarIsEmpty=i),r[n-1]=s):console.error("time order violation, prev: "+new Date(a).toUTCString()+", cur: "+new Date(o).toUTCString()),this.isBarClosed=!!t}}},36802:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DataFeed:()=>P,setupFeed:()=>S,unsubscribeUnused:()=>b});var s=i(50151),r=i(85049);class n{constructor(){this._listeners=[]}listenersCount(){return this._listeners.reduce(((e,t)=>e+(t?1:0)),0)}addListener(e,t){this._listeners.push({dataListener:e,onErrorCallback:t}),this._barset&&e(this._barset),this._errorMsg&&t(this._errorMsg)}removeListener(e){const t=this._listeners.filter((t=>t&&t.dataListener===e));if(0===t.length)return;const i=this._listeners.indexOf(t[0]);delete this._listeners[i]}onError(e){this._errorMsg=e||"unspecified error";const t=this._listeners,i=t.length;for(let s=0;s<i;s++){const i=t[s];i&&i.onErrorCallback&&i.onErrorCallback(e)}}fire(e,t){t||(this._barset=e);const i=this._listeners,s=i.length;for(let t=0;t<s;t++){const s=i[t];s&&s.dataListener(e)}}}var o=i(73698),a=i(20629),l=i(85541);class c{constructor(e,t,i,s,r,n,o,l,c,h){this.listeners=e,this._isRecalculated=!1,this._symbolInfo=o,this.engine=new a.StudyEngine({tickerid:t,currencyCode:i,unitId:s,subsessionId:h,period:r,body:n,sessionId:c,symbolInfo:o,dataRange:l,forceAlignBars:!1,enableDwmAligning:!1,input:()=>{throw new Error("BarBuildItem scripts should not need to access any input values")},recalc:(e,t)=>{this._recalc(t)},out:(e,t)=>{this._out(e,t)},nonseriesOut:(e,t)=>{
this._nonseriesOut(e,t)},setNoMoreData:()=>{this._barset&&(this._barset.endOfData=!0)},onErrorCallback:e=>{this.listeners.onError(e)}})}stop(){this.engine?this.engine.stop():console.error("Internal library error 0x1")}_recalc(e){this._isRecalculated&&console.error("recalc called twice!"),this._barset||(this._barset=new l.BarSet(this._symbolInfo)),e&&(this._barset.firstLoadedTimeMs=e.firstLoadedTimeMs,this._barset.endOfData=e.endOfData),this.listeners.fire(this._barset),this._isRecalculated=!0}_nonseriesOut(e,t){var i,s;const r=Object.assign({},t);r.nonseries=!0,r.data=t.bars,delete r.bars,r.barsetSize=this._barset?this._barset.count():0,r.lastBar=this._barset&&this._barset.count()>0?this._barset.bar(this._barset.count()-1):null,"number"==typeof t.projectionTime&&(r.lastBar||(r.lastBar={}),null!==(i=(s=r.lastBar).projectionTime)&&void 0!==i||(s.projectionTime=t.projectionTime)),this.listeners.fire(r,!0)}_out(e,t){const i=t[0];if(isNaN(i))return;const r={time:i,open:t[1],high:t[2],low:t[3],close:t[4],volume:t[5],updatetime:t[6]},n=t[7];this._barset||(this._barset=new l.BarSet((0,s.ensureDefined)(e.info,"bar builder item output symbol info")));const o=t[8],a=t[9];if(o instanceof Array&&a)for(let e=0;e<o.length;e++){const t=o[e],i={time:t,open:a,high:a,low:a,close:a,volume:0,updatetime:t};this._barset.add(i,!0,!0),this._isRecalculated&&this.listeners.fire(this._barset)}this._barset.add(r,n),this._barset.isBarClosed=!!n,this._isRecalculated&&this.listeners.fire(this._barset)}}var h=i(73772);class d{main(e){const t=e.new_var(h.Std.open(e)),i=e.new_var(h.Std.close(e)),s=t.get(1),r=i.get(1),n=h.Std.ohlc4(e),o=h.Std.na(t.get(1))?(h.Std.open(e)+h.Std.close(e))/2:(s+r)/2;t.set(o),i.set(n);const a=h.Std.max(h.Std.high(e),h.Std.max(o,n)),l=h.Std.min(h.Std.low(e),h.Std.min(o,n)),c=h.Std.volume(e),d=e.symbol;return[d.time,o,a,l,n,c,d.updatetime,d.isBarClosed,void 0,void 0]}}var u=i(53388),p=i(67153),_=i(91007);class m{constructor(e,t,i,s,r,n,o,a){this.listeners=e,this._host=n,this._host.resolve(t,i,(e=>{r&&e.regular_session&&(e.session=e.regular_session),this._subs=this._host.subscribe(e,s,a,(e=>{this.listeners.fire(e)}),(e=>{this.listeners.onError(e)}))}),(e=>{this.listeners.onError(e)}))}stop(){this._subs&&this._host.unsubscribe(this._subs)}}var g=i(60656),f=i(14381),v=i(40644);class y{constructor(e,t){this._period=e,this._generateEmptyBars=!!t}init(e){this._bb=(0,f.newBarBuilder)(this._period,e.symbol.session,null),this._bbEmptyBars=this._generateEmptyBars?(0,f.newBarBuilder)(this._period,e.symbol.session,null):void 0,e.setMinimumAdditionalDepth(0)}main(e){const t=(0,
s.ensureDefined)(this._bb,"bar builder study bar builder"),i=e.symbol.time,r=t.alignTime(i),n=e.new_var(r),o=h.Std.na(r),a=n.get(1),l=h.Std.na(a)?1:h.Std.neq(r,a),c=e.new_var(),d=e.new_var(),u=e.new_var(),p=e.new_var(),_=c.get(1),m=d.get(1),g=u.get(1),f=p.get(1),v=o?NaN:l?h.Std.open(e):_,y=o?NaN:l?h.Std.high(e):h.Std.max(h.Std.high(e),m),S=o?NaN:l?h.Std.low(e):h.Std.min(h.Std.low(e),g),b=o?NaN:h.Std.close(e),w=o?NaN:l?h.Std.volume(e):h.Std.volume(e)+f,C=o?NaN:i,P=e.symbol.isBarClosed&&t.isLastBar(0,i),x=this._generateEmptyBars&&l?this._extrapolate(a,r):void 0,T=e.new_var(h.Std.close(e)).get(1),I=x instanceof Array?T:NaN;return c.set(v),d.set(y),u.set(S),p.set(w),[r,v,y,S,b,w,C,P,x,I]}_extrapolate(e,t){return isNaN(e)||isNaN(t)?void 0:(0,v.extrapolateBarsFrontToTime)((0,s.ensureDefined)(this._bbEmptyBars,"bar builder study empty bar builder"),e,t,Number.MAX_SAFE_INTEGER,!0).times}}const S=e=>{P.instance=new P(e),(0,g.setupFeed)(P.instance)},b=()=>{P.instance.removeUnused()},w=e=>{console.error(e),h.Std.error(e)},C=r.Interval.parse("1M").inMilliseconds(0);class P{constructor(e){this._host=e,this._cache={}}subscribe(e,t,i,s,r,n,o,a,l,c,h){const d=l(o),u=((e,t,i,s,r,n,o,a,l)=>n+e+s+(t||"")+(i||"")+(l||"")+(r.has_empty_bars?"_":"")+"_"+o.countBack+"_"+o.to+"_"+Boolean(a))(e,t,i,s,o,a,d,c,h);let 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}}unsubscribe(e){const t=this._getCache(e.key);t&&t.listeners.removeListener(e.listener)}removeUnused(){const e=[],t=e=>!!this._cache[e];for(const i in this._cache)if(t(i)){0===(0,s.ensureNotNull)(this._cache[i],`datafeed cache item ${i}`).listeners.listenersCount()&&e.push(i)}if(0!==e.length){for(let t=0;t<e.length;t++){const i=e[t],r=(0,s.ensureNotNull)(this._cache[i],`unused datafeed cache item ${i}`);this._cache[i]=null,r.stop()}this.removeUnused()}}_getCache(e){return this._cache[e]}_putCache(e,t){this._cache[e]=t}_rebuildFrom(e,t){const i=(0,p.findSuitableResolutionToBuildFrom)(e,t);if(i.error)throw w(i.errorMessage),new Error(i.errorMessage);return i.resolution}_createItem(e,t,i,s,a,l,h,p,g){const f=new n,v=(0,o.decodeExtendedSymbol)(e),S="string"!=typeof v.symbol?v.symbol:v;t=S["currency-id"]||t,i=S["unit-id"]||i;const b=S.symbol,P=S.session&&S.session!==_.SubsessionId.Extended;if((g=S.session||g)===_.SubsessionId.Regular&&(g=void 0),"type"in v){const e=Object.assign({},a);return a.has_empty_bars&&(e.has_empty_bars=!1),new c(f,b,t,i,s,function(e){if(0===e.type.indexOf("BarSetHeikenAshi@tv-basicstudies-"))return new d;const t=`unknown builder type: ${e.type}`;throw console.error(t),new Error(t)}(v),e,l,h,g)}p&&!(0,u.isAlignmentEnabled)()&&w("Internal error: rebuilding is requested but it is disabled."),!p&&a.has_empty_bars&&w('Misconfiguration error: attempt to request data for symbol with "has_empty_bars" flag, but "disable_resolution_rebuild" featureset is enabled');const x=this._rebuildFrom(s,a);if(!r.Interval.isTicks(s)&&(!r.Interval.isEqual(s,x)||p)){(0,
u.isAlignmentEnabled)()||w('Misconfiguration error: remove "disable_resolution_rebuild" featureset or provide '+s+" data by yourself");const n=a.has_empty_bars,o=Object.assign({},a);a.has_empty_bars&&(o.has_empty_bars=!1);const d=Math.ceil((T=r.Interval.parse(s),I=r.Interval.parse(x),T.kind()===I.kind()?T.multiplier()/I.multiplier():(T.isMonths()?T.multiplier()*C:T.inMilliseconds())/(I.isMonths()?I.multiplier()*C:I.inMilliseconds())));return l=Object.assign({},l,{countBack:l.countBack*d}),new c(f,e,t,i,x,new y(s,n),o,l,h,g)}var T,I;return new m(f,b,{currency:t,unit:i,session:g},s,!!P,this._host,a,l)}}},39692:(e,t,i)=>{"use strict";let s;function r(e,t,i,r){var n;return null!==(n=null==s?void 0:s(e,t,i,r))&&void 0!==n?n:e}function n(e){s=e}i.d(t,{getVolumeProfileResolutionForPeriod:()=>r,overwriteVolumeProfileResolutionForPeriodGetter:()=>n})},67153:(e,t,i)=>{"use strict";i.d(t,{findSuitableResolutionToBuildFrom:()=>o});var s=i(85049);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)}},60656:(e,t,i)=>{"use strict";i.d(t,{ScriptRunner:()=>C,setupFeed:()=>w});var s=i(50151),r=i(85049),n=i(73698),o=i(2740),a=i(42217),l=i(69748),c=i(14381),h=i(91007),d=i(50335);class u{constructor(e,t,i,s,o,l,c){this.periodBase="";const h=(0,n.decodeExtendedSymbol)(e),d="string"==typeof h.symbol?h:h.symbol;if((0,n.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=s||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,n.encodeExtendedSymbolOrGetSimpleSymbolString)(h)),this.tickerid=e;const _=r.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 a.SessionInfo("Etc/UTC","24x7"),this.regularSubsession=null,this.preMarketSubsession=null,this.postMarketSubsession=null,this.script=o,this.projectionTime=NaN,this.isAdditionalDepthAllowed=!(0,n.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=o.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===h.SubsessionId.Regular)),i=e.subsessions.find((e=>e.id===h.SubsessionId.PreMarket)),s=e.subsessions.find((e=>e.id===h.SubsessionId.PostMarket));void 0!==t&&(this.regularSubsession=new l.SessionSpec(e.timezone,t.session,e.session_holidays,t["session-correction"])),void 0!==i&&(this.preMarketSubsession=new l.SessionSpec(e.timezone,i.session,e.session_holidays,i["session-correction"])),void 0!==s&&(this.postMarketSubsession=new l.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,c.newBarBuilder)(this.period,e,t)}bartime(){const e=this.time;if(!this.isdwm()||isNaN(e))return e;const t=(0,s.ensureDefined)(this.timezone,"symbol instrument timezone"),i=o.utc_to_cal(t,e);return this.session.spec.correctTradingDay(i),o.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=(0,d.isNumber)(e.volume)&&e.volume>=0?e.volume:NaN,this.updatetime=e.updatetime||NaN,this.isNewBar=i,this.isBarClosed=!!e.isBarClosed,this.isLastBar=!!e.isLastBar,this.projectionTime=e.projectionTime||NaN,this.isNewBar&&(this.index++,this.isFirstBar=0===this.index),this.script.calc(this)}}var p=i(29981),_=i(73772);class m{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=_.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=_.Std.na(this.mindepth)?_.Std.max_series_default_size:_.Std.max(this.mindepth+1,1);e=Math.round(e);const t=new Array(e);for(let i=0;i<e;i++)t[i]=NaN;this._hist=t,this._histPos=-1}this._histPos=Math.min(this._histPos+1,this._hist.length),this._histPos===this._hist.length&&(this._histPos=this._hist.length-1,this._hist.shift(),this._hist.push(NaN)),this._hist[this._histPos]=this.original}reset_hist(){this._hist=null,this.add_hist()}adopt(e,t,i){this._hist||(this.mindepth=NaN);const s=t.get();let r=e.indexOf(s);if(0!==i){const i=t.get(1);if(!_.Std.na(i)){r=r===e.indexOf(i)?-1:r}}return r<0?NaN:this._get(r)}indexOf(e){if(!this._hist)return this.mindepth=NaN,-1;if(_.Std.na(e))return-1;const t=this._hist.length,i=this.symbol.index+1,s=Math.min(t,i),r=(0,p.upperbound_int)(this._hist,e,0,s);return 0===r?-1:s-r}_get(e){if(null===this._hist)return NaN;let t=this._histPos-e;return t<0&&(t+=this._hist.length),this._hist[t]}}class g extends m{add_hist(){if(this._hist||(this._hist=new Float64Array(2e3),this._histPos=-1),this._histPos=this._histPos+1,this._histPos===this._hist.length){const e=new Float64Array(2*this._hist.length);e.set(this._hist),this._hist=e}this._hist[this._histPos]=this.original}}class f{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&&_.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 m(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 g(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 f(this.symbol)),this._ctx[this._ctxIndex++]}prepare(e){this._ctxIndex=0,this._varsIndex=0;for(let t=0;t<this._vars.length;t++)this._vars[t].prepare(e);for(let t=0;t<this._ctx.length;t++)this._ctx[t].prepare(e)}maxAdditionalDepth(){if(null!==this.minimumAdditionalDepth)return this.minimumAdditionalDepth;let e=0;for(let t=0;t<this._vars.length;t++){const i=this._vars[t].mindepth;!isNaN(i)&&i>e&&(e=i)}return e}stop(){this.symbol=null,this._vars=null}setMinimumAdditionalDepth(e){this.minimumAdditionalDepth=e}}function v(e){
return!Array.isArray(e)&&"composite"!==e.type&&"non_series_bars"!==e.type&&!!e.nonseries}class y{constructor(e,t,i,s,r,n,o,a,l,c,h){this._body=n,this._symbols=[],this._runner=r,this._inputCallback=a,this._out=o,this._nonseriesOut=l,this._ctx=new f(this.add_sym(e,t,i,s,c,h)),this.init()}calc(e){const t=this._ctx,i=this._body;t.prepare(e);const s=i.main(t,this._inputCallback,e);var r;if(null!=s)if(null===(r=s)||Array.isArray(r)||"composite"!==r.type)this._processResult(s);else for(let e=0;e<s.data.length;++e)this._processResult(s.data[e])}init(){const e=this._ctx,t=this._body;t.init&&t.init(e,this._inputCallback),t.main(e,this._inputCallback)}add_sym(e,t,i,s,r,n){const o=this._runner.add_sym(e,t,i,s,this,r,n);return this._symbols.push(o),o.isdwm()&&this._symbols.length>1&&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;var i;this._out&&e&&(!isNaN(t.symbol.time)||v(e))&&(v(e)?(i=e,Array.isArray(i)||"projection"!==i.type||(e.projectionTime=t.symbol.time),this._nonseriesOut(t.symbol,e)):!function(e){return!Array.isArray(e)&&("non_series_bars"===e.type||"projection"===e.type)}(e)?this._out(t.symbol,e):e.bars.forEach((e=>{this._out(t.symbol,e)})))}}var S=i(53388),b=i(1452);function w(e){C.feed=e}class C{constructor(e){this._nonseriesUpdate=null,this._script=null,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){const a=new u(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){const 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;const e=this.host,t=new y(e.tickerid,e.period,e.currencyCode,e.unitId,this,e.body,this.out.bind(this),e.input,e.nonseriesOut,e.symbolInfo,e.subsessionId);this._script=t;const i=[],n=this._symbols,o=Object.assign({},e.dataRange,{countBack:e.dataRange.countBack+this._script.maxAdditionalDepth()}),a=n[0],l=(t,s,r)=>{i.push(C.feed.subscribe(t.tickerid,t.currencyCode,t.unitId,t.period,r,e.onErrorCallback,e.symbolInfo,e.sessionId,s,e.forceAlignBars,t.subsessionId))},c=(t,i)=>{"series"===(i.nonseries?"nonseries":"series")?this.update(t,i):i.lastBar?(this._nonseriesUpdate=i,i.lastBar.isLastBar=!0,this._symbols[0].lastbar(i.lastBar),this._nonseriesUpdate=null):e.nonseriesOut(n[0],i)},h=()=>o;l(a,h,(e=>{!e.nonseries&&Number.isFinite(e.firstLoadedTimeMs)&&(e=>{function i(i,r){let n=(0,S.createTimeToBarTimeAligner)(i,r)(e);const o=(0,S.createDwmAligner)(i,r);return null!==o&&(n=o.timeToExchangeTradingDay(n)),{to:n,countBack:(0,s.ensureNotNull)(t,"script runner script").maxAdditionalDepth()}}for(let e=1;e<n.length;e++){const t=n[e],s=t.period
;r.Interval.isEqual(s,a.period)||l(t,i.bind(null,s),c.bind(null,e))}})(e.firstLoadedTimeMs),c(0,e)}));for(let e=1;e<n.length;e++){const t=n[e];r.Interval.isEqual(t.period,a.period)&&l(t,h,c.bind(null,e))}this._subscription=i}stop(){var e;const t=this._subscription;if(t||this._script){if(null!==t)for(let e=0;e<(null==t?void 0:t.length);e++)C.feed.unsubscribe(t[e]);this._subscription=null,null===(e=this._script)||void 0===e||e.stop(),this._script=null,this._symbols=null,this.isStarted=!1}else console.warn("Recurring script engine stop happened.")}update(e,t){if(!t)return void console.error("Unexpected barset = null");const i=this._symbols[e];if(this._isRecalculated){const e=t.bar(t.count()-1);e.isBarClosed=t.isLastBarClosed(),e.isLastBar=!0,i.lastbar(e)}else this._barsets[e]||(this._barsets[e]=t,i.set_symbolinfo(t.symbolinfo()),this.recalc())}recalc(){const e=this._symbols;for(let t=0;t<e.length;t++)if(!this._barsets[t])return;try{for(let t=e.length-1;t>=0;t--){const i=e[t],s=this._barsets[t],r=s.count();for(let e=0;e<r;e++){const t=s.bar(e);t.isLastBar=e===r-1,t.isBarClosed=!t.isLastBar||s.isLastBarClosed(),i.lastbar(t)}}this._isRecalculated=!0;const t=this._barsets.every((e=>e.endOfData));t&&this.host.setNoMoreData(),this.host.recalc(this,{endOfData:t,firstLoadedTimeMs:this._barsets[0].firstLoadedTimeMs,emptyBarCount:this._barsets[0].emptyBarCount()})}catch(e){if(!(e instanceof b.StudyError))throw e;this.host.onErrorCallback(e.message)}}}C.feed={subscribe(){throw console.error("must be initialized with setupFeed"),new Error("must be initialized with setupFeed")},unsubscribe(){throw console.error("must be initialized with setupFeed"),new Error("must be initialized with setupFeed")}}},23863:(e,t,i)=>{"use strict";const s=i(56570),r=i(19625).getHexColorByName;var n=i(73772).Std;i(42924);var o=i(69146).pivotPointsStandardStudyItem,a=i(24018).volumeProfileVisibleRangeStudyItem,l=i(92245).volumeProfileFixedRangeVbPStudyItem,c=i(92245).volumeProfileFixedRangeBSStudyItem,h=i(68563).spreadStudyItem,d=i(15497).ratioStudyItem,u=i(65498).regressionTrendStudyItem,p=i(46367).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.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[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.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.open(this._context)),a=this._context.new_unlimited_var(n.high(this._context)),l=this._context.new_unlimited_var(n.low(this._context)),c=this._context.new_unlimited_var(n.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.period(this._context))},this.f_0=function(e,t){return n.gt(e,t)?0:1},this.main=function(e,t){this._context=e,this._input=t;var i=n.volume(this._context),s=n.open(this._context),r=n.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.volume(this._context)),d=this._context.new_var(n.open(this._context)),u=this._context.new_var(n.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.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.ema(f,l,this._context):"WMA"===a?_=n.wma(f,l,this._context):"SMA"===a&&(_=n.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.zigzag(r,o,this._context),n.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.selectSessionBreaks(t,this._times).map(e)},this._getPreAndPostMarketBackgroundsData=function(e){const i=n.selectPreAndPostMarketTimes(e,this._times);return{preMarket:i.preMarket.map(t),postMarket:i.postMarket.map(t)}},this.main=function(e,t){if(n.isdwm(e))return null;var i=n.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.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])},73772:(e,t,i)=>{"use strict";i.d(t,{Std:()=>h});var s=i(14381),r=i(2740);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;l<e.length;l++){const c=e[l],h=(0,
r.utc_to_cal)(this._timezone,c);null!==s&&this._isInPostMarketSession(a)&&!this._isInPostMarketSession(h)&&(i.push({start:s,stop:o}),s=null),null===n&&this._isInPreMarketSession(h)&&(n=c),null===s&&this._isInPostMarketSession(h)&&(s=c),null!==n&&this._isInPreMarketSession(a)&&!this._isInPreMarketSession(h)&&(t.push({start:n,stop:o}),n=null),o=c,a=h}return null!==n&&t.push({start:n,stop:e[e.length-1]}),null!==s&&i.push({start:s,stop:e[e.length-1]}),{preMarket:t,postMarket:i}}_isInPreMarketSession(e){return this._anyEntryContains(this._preMarketSessionEntries,e)}_isInPostMarketSession(e){return this._anyEntryContains(this._postMarketSessionEntries,e)}_anyEntryContains(e,t){if(void 0===e)return!1;for(let i=0;i<e.length;i++)if(e[i].contains(t))return!0;return!1}}var o=i(83910),a=i(1452);const l=1e-10,c=e=>e?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;i<t;++i)s(e.get(i),n)&&(o=i,n=e.get(i));return{index:o,value:n}}h.max_series_default_size=10001,h.n=e=>e.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)&&e<t),h.le=(e,t)=>c(h.isZero(e-t)||e<t),h.and=(e,t)=>isNaN(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;i<e.length;i++)t+=e[i];return t/e.length},h.open=e=>e.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;i<t+1;++i)if(e.get(i)>e.get(0))return 0;return 1},h.falling=(e,t)=>{for(let i=1;i<t+1;++i)if(e.get(i)<e.get(0))return 0;return 1},h.timepart=(e,t,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<a?1:-1;const v=-1===m?a:o
;return g.set(v),h.n(i)<=t?[Number.NaN,0]:[v,m]},h.lowestbars=(e,t,i)=>-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<t;++i){const a=e.get(i),l=t-1-i+1;s+=l,r+=a,n+=l*l,o+=a*l}const a=(t*o-s*r)/(t*n-s*s);return r/t-a*s/t+a+a*(t-1-i)},h.sar=(e,t,i,s)=>{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 y=u.get(1),S=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=y,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,y),h.n(s)>2&&(x=Math.min(x,S))):(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;e<t;++e){const t=Math.exp(-1*Math.pow(e-r,2)/(2*n));a+=t,o.push(t)}for(let e=0;e<t;++e)o[e]/=a;let l=0;for(let i=0;i<t;++i)l+=o[i]*e.get(t-i-1);return l},h.change=e=>e.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<t;r++){const t=e.get(r);s+=h.abs(t-i)}return s/t},h.stdev=(e,t,i)=>{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<i;r++){const i=e.get(r),n=h.abs(i-t);s+=n*n}return s/i},h.percentrank=(e,t)=>{if(h.na(e.get(t-1)))return NaN;let i=0;const s=e.get();for(let r=1;r<t;r++){const t=e.get(r);h.ge(s,t)&&i++}return 100*i/t},
h.createNewSessionCheck=e=>{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.createNthBarInSessionCheck=e=>{if(void 0===e.symbol.session.timezone)return()=>!1;const t=(0,s.newBarBuilder)(e.symbol.period,e.symbol.session,null);return(e,i)=>(t.indexOfBar(e)===o.SessionStage.POST_SESSION&&t.moveTo(e),t.indexOfBar(e)===i)},h.error=e=>{throw new a.StudyError(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():i<this._currentValue.get())}processPoint(e){this.isViolate(e,!1)&&(this._currentValue.set(this._series.get()),this._currentIndex.set(e))}isRestartNeeded(e){return e-this._currentIndex.get()>this._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;t<this._areaLeft;++t)if(this.isViolate(this._currentIndex.get()-1-t,!0)){e=!1;break}e&&this._pivotIndex.set(this._currentIndex.get())}}else-1!==this._pivotIndex.get()&&this._pivotIndex.set(-1);if(this.isRestartNeeded(this._index)){this.reset();for(let e=0;e<=this._areaRight;++e)this.processPoint(this._index-this._areaRight+e)}}}_.LOW=0,_.HIGH=1;class m{constructor(e,t,i){this._deviation=e;const s=i.new_var(h.high(i)),r=i.new_var(h.low(i));s.get(2*t+1),r.get(2*t+1),this._pivotHigh=new _(t,t,p,s,i),this._pivotLow=new _(t,t,u,r,i),this._lastVal=i.new_var(NaN),this._lastIndex=i.new_var(-1),this._lastType=i.new_var(),
this._index=h.n(i),this._isBarClosed=i.symbol.isBarClosed;const n=this._lastIndex.get(1),o=this._lastVal.get(1),a=this._lastType.get(1);this._index>1&&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:t<s)&&this.updatePivot(e,t))}Math.abs(s-t)/t>this._deviation&&this.addPivot(e,t,i)}processPivot(e){e.update(),this._isBarClosed&&e.isPivotFound()&&this.addPoint(e.pivotIndex(),e.currentValue(),e.pivotType())}}},46367:(e,t,i)=>{"use strict";i.d(t,{anchoredVWAPStudyItem:()=>o});const s={_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:{areaBackground:{backgroundColor:"#4caf50",fillBackground:!0,transparency:95},filledAreasStyle:{Background_1:{fillType:void 0,color:"#4caf50",transparency:95,visible:!0}},inputs:{start_time:0,"Bands Calculation Mode":"Standard Deviation",bands_multiplier:1,bands_multiplier_2:2,bands_multiplier_3:3,calculate_stDev:!0,calculate_stDev_2:!1,calculate_stDev_3:!1,source:"hlc3"},styles:{VWAP:{color:"#1e88e5",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,display:15},LowerBand:{display:15,color:"#4caf50",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0},LowerBand_2:{display:15,color:"#808000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0},LowerBand_3:{display:15,color:"#00897b",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0},UpperBand:{display:15,color:"#4caf50",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0},UpperBand_2:{display:15,color:"#808000",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0},UpperBand_3:{display:15,color:"#00897b",linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0}}},inputs:[{defval:0,id:"start_time",isHidden:!0,max:Number.MAX_SAFE_INTEGER,min:-Number.MAX_SAFE_INTEGER,name:"Start time",type:"time"},{defval:"Standard Deviation",group:"Bands Settings",id:"Bands Calculation Mode",name:"Bands Calculation Mode",options:["Standard Deviation","Percentage"],tooltip:"Determines the units used to calculate the distance of the bands. When 'Percentage' is selected, a multiplier of 1 means 1%.",type:"text",display:15},{defval:!0,group:"Bands Settings",id:"calculate_stDev",inline:"band_1",name:" ",type:"bool",display:0},{defval:1,group:"Bands Settings",id:"bands_multiplier",inline:"band_1",max:Number.MAX_VALUE,min:0,name:"Bands Multiplier #1",step:.5,type:"float",display:15},{defval:!1,group:"Bands Settings",id:"calculate_stDev_2",inline:"band_2",name:" ",type:"bool",display:0},{defval:2,group:"Bands Settings",
id:"bands_multiplier_2",inline:"band_2",max:Number.MAX_VALUE,min:0,name:"Bands Multiplier #2",step:.5,type:"float",display:15},{defval:!1,group:"Bands Settings",id:"calculate_stDev_3",inline:"band_3",name:" ",type:"bool",display:0},{defval:3,group:"Bands Settings",id:"bands_multiplier_3",inline:"band_3",max:Number.MAX_VALUE,min:0,name:"Bands Multiplier #3",step:.5,type:"float",display:15},{defval:"hlc3",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"source"}],plots:[{id:"VWAP",type:"line"},{id:"UpperBand",type:"line"},{id:"LowerBand",type:"line"},{id:"UpperBand_2",type:"line"},{id:"LowerBand_2",type:"line"},{id:"UpperBand_3",type:"line"},{id:"LowerBand_3",type:"line"}],styles:{VWAP:{histogramBase:0,title:"VWAP"},LowerBand:{histogramBase:0,title:"Lower Band #1"},LowerBand_2:{histogramBase:0,title:"Lower Band #2"},LowerBand_3:{histogramBase:0,title:"Lower Band #3"},UpperBand:{histogramBase:0,title:"Upper Band #1"},UpperBand_2:{histogramBase:0,title:"Upper Band #2"},UpperBand_3:{histogramBase:0,title:"Upper Band #3"}},filledAreas:[{title:"Background #1",id:"Background_1",objAId:"UpperBand",objBId:"LowerBand",type:"plot_plot"}],area:[{name:"UpperBand",visible:!0},{name:"LowerBand",visible:!0}]};var r=i(50151),n=i(73772);const o={name:"Anchored VWAP",metainfo:s,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,r.assert)(e.symbol.time===i.time);const s=i.time;if(s&&s<this._firstBarTime)return[NaN];const o=n.Std.volume(e),a=n.Std[t(8)](e),l=e.new_unlimited_var(),c=e.new_unlimited_var(),h=e.new_unlimited_var(),d=e.symbol.time;null!==d&&(null===this._isNewSession&&(this._isNewSession=n.Std.createNewSessionCheck(e)),this._isNewSession&&this._isNewSession(d)&&(this._resetHist(l),this._resetHist(c),this._resetHist(h))),l.set(n.Std.nz(l.get())+a*o),c.set(n.Std.nz(c.get())+o),h.set(n.Std.nz(h.get())+a*a*o);const u=l.get()/c.get(),p=h.get()/c.get()-Math.pow(u,2),_=Math.sqrt(Math.max(0,p)),m="Standard Deviation"===t(1)?_:.01*u,g=t(2),f=t(3),v=t(4),y=t(5),S=t(6),b=t(7);return[u,g?u+m*f:NaN,g?u-m*f:NaN,v?u+m*y:NaN,v?u-m*y:NaN,S?u+m*b:NaN,S?u-m*b:NaN]}_resetHist(e){e.reset_hist()}}}},3075:(e,t,i)=>{"use strict";i.d(t,{OHLCV:()=>r});var s=i(73772);class r{main(e){return[s.Std.open(e),s.Std.high(e),s.Std.low(e),s.Std.close(e),s.Std.volume(e),s.Std.updatetime(e),void 0,void 0,void 0,void 0]}}},69146:(e,t,i)=>{"use strict";i.d(t,{pivotPointsStandardStudyItem:()=>p});var s,r,n=i(85049),o=i(67153),a=i(73772);!function(e){e[e.TRADITIONAL=0]="TRADITIONAL",e[e.FIBONACCI=1]="FIBONACCI",e[e.WOODIE=2]="WOODIE",e[e.CLASSIC=3]="CLASSIC",e[e.DEMARK=4]="DEMARK",e[e.CAMARILLA=5]="CAMARILLA",e[e.FLOOR=6]="FLOOR"}(s||(s={})),function(e){e.AUTO="Auto",e.DAILY="Daily",e.WEEKLY="Weekly",e.MONTHLY="Monthly",e.YEARLY="Yearly"}(r||(r={}));class l{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 c{constructor(){this.pivots=[]}}function h(e,t){e.setUTCMonth(e.getUTCMonth()+t)}function d(e,t){if(a.Std.ismonthly(e)){let i=new Date(t);return i.getUTCDay()<function(e,t){return new Date(t,e,0).getDate()}(i.getUTCMonth(),i.getUTCFullYear())?(h(i,a.Std.interval(e)),i=a.Std.add_days_considering_dst("Etc/UTC",i,1-i.getUTCDay())):(i=a.Std.add_days_considering_dst("Etc/UTC",i,1),h(i,a.Std.interval(e))),i.valueOf()}return t+n.Interval.parse(e.symbol.resolution).inMilliseconds(t)}function u(e,t){switch(t){case"Auto":return function(e){const t=n.Interval.parse(e.symbol.interval+e.symbol.resolution);switch(t.kind()){case n.ResolutionKind.Weeks:case n.ResolutionKind.Months:return"12M";case n.ResolutionKind.Days:return"1M";case n.ResolutionKind.Minutes:return t.multiplier()>=1&&t.multiplier()<=15?"1D":"1W";case n.ResolutionKind.Seconds:case n.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 p={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,this._mainSeriesTimes=new Set}init(e,t){const i=t(0),s=t(1),r=t(2),n=t(3);this._data=new c,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=n,this._pivTimeFrame=r,this._isValidResolution=function(e,t){return!(a.Std.isdaily(e)&&"Daily"===t||a.Std.isweekly(e)&&("Daily"===t||"Weekly"===t)||a.Std.ismonthly(e)&&("Daily"===t||"Weekly"===t||"Monthly"===t))}(e,this._pivTimeFrame),this._isValidResolution||a.Std.error("You cannot see this pivot timeframe on this resolution"),this._isValidResolution&&(this._secondaryRes=u(e,this._pivTimeFrame),void 0!==e.symbol.info&&(0,o.findSuitableResolutionToBuildFrom)(this._secondaryRes,e.symbol.info).error&&(this._isValidResolution=!1,
a.Std.error(`Resolution ${this._secondaryRes} is not supported for this symbol`))),this._mainSeriesTimes=new Set,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(e.symbol.time)&&isNaN(e.symbol.projectionTime)&&this._mainSeriesTimes.add(e.symbol.time),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(a.Std.open(e)),r=e.new_var(a.Std.high(e)),n=e.new_var(a.Std.low(e)),o=e.new_var(a.Std.close(e)),c=e.new_var(a.Std.time(e)),h=this._data,u=s.get(0),p=c.get(0),_=s.get(1),m=r.get(1),g=n.get(1),f=o.get(1),v=e.symbol.isLastBar;if(0!==h.pivots.length&&e.symbol.isNewBar){const e=h.pivots[h.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 y=function(e,t,i,s,r,n,o,c){const h=new l;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 n=NaN;n=a.Std.equal(t,r)?i+s+2*r:a.Std.greater(r,t)?2*i+s+r:2*s+i+r,d=n/4,h.p=d,h.r1=n/2-s,h.s1=n/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=n,h.endIndex__t=o,h}(u,_,m,g,f,p,d(e,p),this._kindPP);return e.select_sym(0),this._showHistoricalPivots||(h.pivots=[]),h.pivots.push(y),h.pivots.length>this._historicalPivotsToKeep&&h.pivots.shift(),v?this._createResponse():null}_createResponse(){if(0===this._data.pivots.length||this._mainSeriesTimes.size<=1)return null;if(this._mainSeriesTimes.size<=this._data.pivots.length)return null;const e=Array.from(this._mainSeriesTimes).sort(((e,t)=>e-t)),t=new c;let i=0;for(let s=0;s<this._data.pivots.length;s++){const r=this._data.pivots[s];let n=!1,o=0;const a=i;for(;i<e.length;){const t=e[i];if(t>=r.endIndex__t)break;t>=r.startIndex__t&&(n=!0,o++),i++}if(n){let n=!0;if(s>0&&t.pivots.length>0){const i=t.pivots[t.pivots.length-1];if(i.endIndex__t===r.startIndex__t){const t=e.filter((e=>e>=i.startIndex__t&&e<=i.endIndex__t));1===o&&t[t.length-1]===r.startIndex__t&&(n=!1)}}n?t.pivots.push({...r}):i=a}else t.pivots.length>0&&(t.pivots[t.pivots.length-1].endIndex__t=r.endIndex__t)}
return 0===t.pivots.length&&a.Std.error("Not enough data to calculate all pivot points"),{nonseries:!0,type:"non_series_data",data:{data:t}}}_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)}}}},15497:(e,t,i)=>{"use strict";i.d(t,{ratioStudyItem:()=>n});var s=i(62473);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}},65498:(e,t,i)=>{"use strict";i.d(t,{regressionTrendStudyItem:()=>n});var s=i(73772);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;t<e.length;++t){const o=e[t],a=t+1;i+=a,s+=o,r+=a*a,n+=o*a}t.slope=(e.length*n-i*s)/(e.length*r-i*i),t.average=s/e.length,t.intercept=t.average-t.slope*i/e.length+t.slope}(e,r),function(e,t,i,r){let n=0,o=0,a=0,l=0,c=0,h=0,d=r.intercept;const u=e.length-1,p=r.intercept+r.slope*u/2;for(let s=0;s<=u;++s){let u=t[s]-d;u>n&&(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=[],y=[],S=[];for(let e=m;e>=g;--e)f.push(n.get(e)),v.push(o.get(e)),y.push(a.get(e)),S.push(l.get(e));return this._updateData(f,d,c,u,h,p,_,r(S,v,y)),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}}}},62473:(e,t,i)=>{"use strict";i.d(t,{SpreadRatioBase:()=>l,spreadRatioDefaults:()=>c,spreadRatioFilledAreas:()=>_,spreadRatioInputs:()=>h,spreadRatioPalettes:()=>p,spreadRatioPlots:()=>d,spreadRatioStyles:()=>u});var s=i(19625),r=i(94113),n=i(73772),o=i(19063);const a="rgba(0, 0, 0, 0)";class l{init(e,t){e.new_sym(t(1),n.Std.period(e)),this._source=t(0),this._scaleFactor1=1,this._scaleFactor2=1}main(e,t){const i=e.symbol.time,s=n.Std[this._source](e);e.select_sym(1);const r=n.Std[this._source](e),o=e.new_unlimited_var(r),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),h=this._doCalculation(this._scaleFactor1,s,this._scaleFactor2,c);return[h,0,n.Std.ge(h,0),n.Std.lt(h,0)]}}const c={styles:{plot1:{linestyle:0,linewidth:2,plottype:r.LineStudyPlotStyle.Line,trackPrice:!1,transparency:35,color:"#800080",display:15},plotBaseline:{linestyle:0,linewidth:2,plottype:r.LineStudyPlotStyle.Line,trackPrice:!1,transparency:0,color:a,display:0}},palettes:{negativePalette:{colors:[{color:(0,o.applyAlpha)((0,s.getHexColorByName)("color-ripe-red-500"),.5),style:0,width:0},{color:a,style:0,width:0}]},positivePalette:{colors:[{color:(0,o.applyAlpha)((0,s.getHexColorByName)("color-minty-green-500"),.5),style:0,width:0},{color:a,style:0,width:0}]}},filledAreasStyle:{negativeFill:{color:"",transparency:0,visible:!0,fillType:void 0},positiveFill:{color:"",transparency:0,visible:!0,fillType:void 0}},precision:2,inputs:{source:"close",symbol2:""}},h=[{defval:"close",id:"source",name:"Source",options:["open","high","low","close","hl2","hlc3","ohlc4"],type:"text"},{id:"symbol2",name:"Symbol",type:"symbol",confirm:!0}],d=[{id:"plot1",type:"line"},{id:"plotBaseline",type:"line"},{id:"plotNegativeFill",type:"colorer",target:"negativeFill",palette:"negativePalette"},{id:"plotPositiveFill",type:"colorer",target:"positiveFill",palette:"positivePalette"}],u={plot1:{title:"Plot",histogramBase:0},plotBaseline:{title:"Baseline",isHidden:!0}},p={negativePalette:{
valToIndex:{0:0,1:1},colors:[{name:"Color"}]},positivePalette:{valToIndex:{0:0,1:1},colors:[{name:"Color"}]}},_=[{id:"negativeFill",objAId:"plot1",objBId:"plotBaseline",type:"plot_plot",title:"Negative fill",palette:"negativePalette",fillToIntersection:!0},{id:"positiveFill",objAId:"plot1",objBId:"plotBaseline",type:"plot_plot",title:"Positive fill",palette:"positivePalette",fillToIntersection:!0}]},68563:(e,t,i)=>{"use strict";i.d(t,{spreadStudyItem:()=>n});var s=i(62473);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,palettes:s.spreadRatioPalettes,filledAreas:s.spreadRatioFilledAreas,description:"Spread",shortDescription:"Spread",is_price_study:!1,inputs:s.spreadRatioInputs,id:"Spread@tv-basicstudies-1",format:{type:"price",precision:2}},constructor:r}},56209:(e,t,i)=>{"use strict";i.d(t,{VbPCheckHaveVolumeExpr:()=>r});var s=i(73772);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)}}},43789:(e,t,i)=>{"use strict";i.d(t,{VolumeByPriceExpr:()=>g});var s=i(50151),r=i(9859),n=i(85049),o=i(41978);class a extends o.GraphicsObj{constructor(e,t,i,r,n,o){super(e),(0,s.assert)(t<i),this._priceLow=this._mixinJSONObject.createDoubleField(t,"priceLow"),this._priceHigh=this._mixinJSONObject.createDoubleField(i,"priceHigh"),this._rate=this._mixinJSONObject.createDoubleArrayField(r,"rate"),this._firstBarTime=this._mixinJSONObject.createTimeField(n,"firstBarTime"),this._lastBarTime=this._mixinJSONObject.createTimeField(o,"lastBarTime")}isNaN(){return super.isNaN()||Number.isNaN(this._priceLow.get())||Number.isNaN(this._priceHigh.get())||0===this._rate.get().length}jsonName(){return"hhists"}primitiveData(){return{id:this.id(),priceHigh:this._priceHigh.get(),priceLow:this._priceLow.get(),rate:this._rate.get().slice(),firstBarTime:this._firstBarTime.get(),lastBarTime:this._lastBarTime.get()}}setPriceLow(e){this._priceLow.set(e)&&this._processObjUpdate()}priceLow(){return this._priceLow.get()}priceHigh(){return this._priceHigh.get()}setPriceHigh(e){this._priceHigh.set(e)&&this._processObjUpdate()}rate(){return this._rate.get().slice()}setRate(e){this._rate.set(e)&&this._processObjUpdate()}rateAt(e){return this._rate.get()[e]}ratesSum(){let e=0;for(const t of this._rate.get())!Number.isNaN(t)&&Number.isFinite(t)&&(e+=t);return e}firstBarTime(){return this._firstBarTime.get()}setFirstBarTime(e){this._firstBarTime.set(e)&&this._processObjUpdate()}lastBarTime(){return this._lastBarTime.get()}setLastBarTime(e){this._lastBarTime.set(e)&&this._processObjUpdate()}}var l,c,h=i(61923),d=i(73772);class u{constructor(e,t,i){this.index=e,this.offset=i,this.level=t}isNaN(){
return Number.isNaN(this.level)}equals(e){return e instanceof u&&(!this.isNaN()&&(!e.isNaN()&&(this.index===e.index&&this.offset===e.offset&&d.Std.equal(this.level,e.level))))}getLevel(){return this.level}getIndex(){return this.index}}class p extends o.GraphicsObj{constructor(e,t){super(e),this._points=[],t&&(this._points=t)}addPoint(e){this._processObjUpdate(),this._points.push(e)}addPoints(e){this._processObjUpdate(),this._points.push(...e)}setPoint(e,t){const i=this._points[e];t.equals(i)||(this._processObjUpdate(),this._points[e]=t)}point(e){const t=this._points[e];return new u(t.index,t.level,t.offset)}points(){return this._points}pointsCount(){return this._points.length}setPoints(e){if(e.length===this._points.length){let t=!0;for(let i=0;i<e.length;++i)if(!e[i].equals(this._points[i])){t=!1;break}if(t)return}this._processObjUpdate(),this._points=[],this._points.push(...e)}clearPoints(){this._processObjUpdate(),this._points=[]}isNaN(){return super.isNaN()||this._points.length<3}jsonName(){return"polygons"}primitiveData(){return{id:this.id(),points:this._points.map((e=>({index:e.index,offset:e.offset,level:e.level})))}}}class _ 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()}}!function(e){e[e.AssertAccuracy=.05]="AssertAccuracy"}(l||(l={})),function(e){e[e.START=0]="START",e[e.END=1]="END"}(c||(c={}));class m{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 g{
constructor(e,t,i,r,n,o,a,l,c,d,u,p,_,g,f){this._freezedBoxes=new h.GraphicsList,this._freezedHists=new h.GraphicsList,this._freezedPocs=new h.GraphicsList,this._freezedVAHists=new h.GraphicsList,this._currentHistsGr=new h.GraphicsList,this._currentVAHistsGr=new h.GraphicsList,this._currentHists=[],this._currentHistsMap=new m,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=l,this._vaVolumePercent=c,this._rowsLayoutSupplier=d,this._outHists.addStable(this._freezedHists),this._outVAHists.addStable(this._freezedVAHists),this._maxHHistItems=u,this._layoutIsAutoselected=g,this._leftBoxTimeMutable=p,this._rightBoxTimeMutable=_,this._actualRightBoxTime=null!=f?f:_,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=d.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),
d.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,d.Std.greater(this._minPrice,e.low)&&(this._minPrice=e.low,this._needRecalc=!0),d.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)d.Std.greater(i.ratesSum(),t.ratesSum())?(t=i,e=[t]):d.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];d.Std.lessOrEqual(Math.abs(this._getMidLevel(r)-i),Math.abs(this._getMidLevel(t)-i))&&(t=r)}}return t}_initCurrentPoc(){this._currentPoc=new _(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<this._currentHists.length;e++)if(this._currentHists[e]===this._largestHistItem)return e;return-1}_calculateValueArea(){const e=this._getPocHistItemIndex();(0,s.assert)(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(;d.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._currentVAEnd<this._currentHists.length)if(i=this._currentHists[this._currentVAEnd].ratesSum(),d.Std.greater(t,i))r=t,n=0;else if(d.Std.greater(i,t))r=i,n=1;else{const s=Math.abs(e-this._currentVAStart),o=Math.abs(e-this._currentVAEnd);s<o?(r=t,n=0):o<=s&&(r=i,n=1)}else r=t,n=0;else r=this._currentHists[this._currentVAEnd].ratesSum(),n=1}this._currentVAStart++,this._currentVAEnd--}_isVA(e){return e.priceHigh()>this._getMidLevel(this._currentHists[this._currentVAStart])&&e.priceLow()<this._getMidLevel(this._currentHists[this._currentVAEnd])}_updateValueArea(){if(this._calculateValueArea(),this._needRecalc||this._previousVAStart!==this._currentVAStart||this._previousVAEnd!==this._currentVAEnd){let e=0,t=0;for(;e<this._currentHistsGr.size()&&t<this._currentVAHistsGr.size();){for(;e<this._currentHistsGr.size()&&!this._isVA(this._currentHistsGr.get(e));)e++;for(;t<this._currentVAHistsGr.size()&&this._isVA(this._currentVAHistsGr.get(t));)t++;if(e<this._currentHistsGr.size()&&t<this._currentVAHistsGr.size()){const i=this._currentHistsGr.get(e);this._currentHistsGr.set(e,this._currentVAHistsGr.get(t)),this._currentVAHistsGr.set(t,i)}}for(;e<this._currentHistsGr.size();e++){const t=this._currentHistsGr.get(e);this._isVA(t)&&(this._currentHistsGr.remove(e),e--,this._currentVAHistsGr.add(t))}for(;t<this._currentVAHistsGr.size();t++){const e=this._currentVAHistsGr.get(t);this._isVA(e)||(this._currentVAHistsGr.remove(t),t--,this._currentHistsGr.add(e))}}this._previousVAStart=this._currentVAStart,this._previousVAEnd=this._currentVAEnd}_initCurrentBox(){this._currentBox=new p(this)}_updateCurrentBox(){let e=this._minPrice,t=this._maxPrice;this._currentHists.length>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 u(r,e)),i.push(new u(r,t)),i.push(new u(n,t)),i.push(new u(n,e)),(0,s.ensureNotNull)(this._currentBox).setPoints(i)}_recalculateCurrentResultsOnHistoryBarSet(){for(let e=0;e<this._currentHists.length;++e)this._currentHists[e].erase();this._currentHists=[],this._currentHistsGr.clear(),this._currentVAHistsGr.clear(),this._currentHistsMap.clear();for(let e=0;e<this._historyBarSet.length;e++)this._addHistoryBarToHistogram(this._historyBarSet[e],e,this._currentHists,this._currentHistsMap,1);this._currentHists.length>0&&(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,c=e.isUp,h=(0,s.ensureNotNull)(this._rowsLayout);h.init(this._ctx.symbol.minTick,this._minPrice,this._maxPrice,o,a);const u=h.rowWidth();if(!d.Std.greater(u,0))return;h.calculate();const p=h.getIndexLowVbP(),_=h.getIndexHighVbP(),m=h.getStartPrice();if(p===_){const e=p*u+m,t=(p+1)*u+m;this._updateResult({start:e,end:t},n*l,c,i,r)}else{let e=0;for(let t=p;t<=_;t++){const s=t*u+m,h=(t+1)*u+m,d=this._rowCoeff(s,h,o,a),p=d*l;e+=d,this._updateResult({start:s,end:h},n*p,c,i,r)}(0,s.assert)(d.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),c=(0,s.ensureNotNull)(this._actualRightBoxTime);let h=n.get(e);if(void 0===h)h=new a(this,e.start,e.end,o,l,c),n.set(e,h),this._verifyHistogramSizeIsNotTooLarge(n.size()),this._currentHistsGr.add(h),g._addInOrder(h,r,0,r.length,((e,t)=>{let i=d.Std.compare(e.firstBarTime(),t.firstBarTime());return 0!==i?i:(i=d.Std.compare(e.priceLow(),t.priceLow()),0!==i?i:d.Std.compare(e.priceHigh(),t.priceHigh()))}));else{const e=[];for(let t=0;t<o.length;t++)e[t]=h.rateAt(t)+o[t];h.setRate(e)}}_rebuildOutData(){const e=this._currentHistsMap.size(),t=this._currentHists.length,i=this._currentHistsGr.size(),r=this._currentVAHistsGr.size();(0,s.assert)(e===t&&t===i+r,`Collections of HHistItems are out of sync ${e} ${t} ${i} ${r}`),this._outPocLines.clear(),this._outPocLines.addAll(this._freezedPocs),d.Std.greater(this._getVolume(this._currentHists),0)?(this._outHists.setVariable(this._currentHistsGr),this._outPocLines.add((0,s.ensureNotNull)(this._currentPoc)),this._outVAHists.setVariable(this._currentVAHistsGr)):(this._outHists.setVariable(null),this._outVAHists.setVariable(null)),this._outBoxLines.clear(),this._outBoxLines.addAll(this._freezedBoxes),this._outBoxLines.add((0,s.ensureNotNull)(this._currentBox))}_verifyHistogramSizeIsNotTooLarge(e){if(this._layoutIsAutoselected)return;if(e<=this._maxHHistItems)return;const t=(0,s.ensureNotNull)(this._rowsLayout);0===t.type()?d.Std.error('Histogram is too large, please reduce "Row Size" input.'):((0,s.assert)(1===t.type(),`Unexpected rowsLayout type ${t.type()}`),d.Std.error('Histogram is too large, please increase "Row Size" input.'))}_createRates(e,t){if(1===this._numOfSubHists)return[t];if(2===this._numOfSubHists){const i=[0,0];return i[e?0:1]=t,i}return(0,s.assert)(!1,`Incorrect value of numOfSubHists = ${this._numOfSubHists}`),[]}_updateLastBarTimeInHistogram(e){const t=(0,s.ensureNotNull)(this._actualRightBoxTime);for(const i of e)i.setLastBarTime(t)}_rowCoeff(e,t,i,s){const r=s-i;return(t-e-Math.max(t-s,0)-Math.max(0,i-e))/r}static _addInOrder(e,t,i,s,n){if(i===s)return void t.splice(i,0,e);const o=(0,r.toInt)((i+s)/2),a=t[o]
;n(e,a)<0?g._addInOrder(e,t,i,o,n):n(e,a)>0?g._addInOrder(e,t,o+1,s,n):t.splice(o,0,e)}}},7370:(e,t,i)=>{"use strict";i.d(t,{VolumeProfileBase:()=>_,maxHHistItems:()=>u,numOfSubHists:()=>p});var s,r=i(56570),n=i(85049);!function(e){e[e.NumberOfRows=0]="NumberOfRows",e[e.TicksPerRow=1]="TicksPerRow"}(s||(s={}));class o{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 a extends o{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 l extends o{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 c,h=i(73772),d=i(39692);function u(){return 6e3}function p(e){switch(e){case"Delta":case"Up/Down":return 2;case"Total":return 1;default:h.Std.error(`Invalid study argument value: ${e}`)}}!function(e){e.VolumeUpDown="Up/Down",e.VolumeTotal="Total",e.VolumeDelta="Delta",e.NumberOfRows="Number Of Rows",e.TicksPerRow="Ticks Per Row"}(c||(c={}));class _{findBasicResolutionForFromTo(e,t,i,s){const o=(0,d.getVolumeProfileResolutionForPeriod)(e.value(),t,i,s),a=n.Interval.parse(o);return r.enabled("charting_library_debug_mode")&&console.log(`${(new Date).toISOString()} Selected resolution ${a.value()} for (${e.value()}, ${t}, ${i})`),a}verifyRowSizeInput(e,t){"Number Of Rows"===t&&e>6e3&&h.Std.error('Histogram is too large, please reduce "Row Size" input.')}_getRowsLayout(e,t){return"Number Of Rows"===e?new a(t):new l(t)}}},92245:(e,t,i)=>{"use strict";i.d(t,{volumeProfileFixedRangeBSStudyItem:()=>w,volumeProfileFixedRangeVbPStudyItem:()=>b});var s=i(50151),r=i(7370),n=i(94113),o=i(9233),a=i(85049),l=i(40878),c=i(45382),h=i(32569),d=i(61923),u=i(62628),p=i(56209),_=i(85904),m=i(43789);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._lastBarTime}}var f=i(11694),v=i(73772)
;class y extends r.VolumeProfileBase{constructor(){super(...arguments),this._rowsLayout="Number Of Rows",this._rowSize=24,this._volume="Up/Down",this._firstBarTime=0,this._lastBarTime=0,this._vaVolumePercent=70,this._anInt=0,this._eraseCmds=[]}nextGraphicsObjId(){return++this._anInt}pushEraseObjCmd(e,t){this._eraseCmds.push(new h.EraseObj(e,t))}popEraseCmds(){const e=this._eraseCmds;return this._eraseCmds=[],e}init(e,t){this._studyDataUpdate=new u.JStudyDataUpdate(!0),this._hists=new l.GraphicsListColl,this._boxPolygons=new d.GraphicsList,this._pocLines=new d.GraphicsList,this._valueAreaHists=new l.GraphicsListColl;const i=new c.StudyGraphicsData;i.getObjsContainer("hhists").push(new c.Container("histBars2",this._hists)),i.getObjsContainer("hhists").push(new c.Container("histBarsVA",this._valueAreaHists)),i.getObjsContainer("horizlines").push(new c.Container("pocLines",this._pocLines)),i.getObjsContainer("polygons").push(new c.Container("histBoxBg",this._boxPolygons)),this._studyDataUpdate.init(i),this._rowsLayout=t(0),this._rowSize=t(1),this._volume=t(2),this._firstBarTime=t(3),this._lastBarTime=t(4),this._vaVolumePercent=t(5),this.verifyRowSizeInput(this._rowSize,this._rowsLayout),this._originalResolution=a.Interval.parse(e.symbol.interval+e.symbol.resolution);const n=this._lastBarTime+this._originalResolution.inMilliseconds(this._lastBarTime);0===this._firstBarTime&&0===this._lastBarTime?this._basicResolution=this._originalResolution:this._basicResolution=this.findBasicResolutionForFromTo(this._originalResolution,this._firstBarTime,n,(0,s.ensureDefined)(e.symbol.info)),this._hasSecondarySymbol=!this._originalResolution.isEqualTo(this._basicResolution),this._hasSecondarySymbol&&e.new_sym(e.symbol.tickerid,this._basicResolution.value());const o=this._getRowsLayout(this._rowsLayout,this._rowSize);this._vbPCheckHaveVolumeExpr=new p.VbPCheckHaveVolumeExpr(this),this._volumeByPriceExpr=new g((0,r.numOfSubHists)(this._volume),e,this,this._firstBarTime,n,this._hists,this._boxPolygons,this._pocLines,this._valueAreaHists,this._vaVolumePercent,o,(0,r.maxHHistItems)(),this._lastBarTime),this._volumeByPriceExpr.setIdsGeneratorProxy(this),this._developingPocSeries=new f.VolumeProfileOutputSeries,this._developingVAHighSeries=new f.VolumeProfileOutputSeries,this._developingVALowSeries=new f.VolumeProfileOutputSeries}main(e,t,i){this._hasSecondarySymbol&&e.select_sym(1),this._timeSeries=e.new_unlimited_var(),this._openSeries=e.new_unlimited_var(),this._highSeries=e.new_unlimited_var(),this._lowSeries=e.new_unlimited_var(),this._closeSeries=e.new_unlimited_var(),this._volumeSeries=e.new_unlimited_var();const r={type:"composite",data:[]};if(i&&i.period===this._basicResolution.value()&&(this._timeSeries.set(v.Std.time(e)),this._openSeries.set(v.Std.open(e)),this._highSeries.set(v.Std.high(e)),this._lowSeries.set(v.Std.low(e)),this._closeSeries.set(v.Std.close(e)),this._volumeSeries.set(v.Std.volume(e)),this._developingPocSeries.addHist(v.Std.time(e)),this._developingVAHighSeries.addHist(v.Std.time(e)),
this._developingVALowSeries.addHist(v.Std.time(e)),this._vbPCheckHaveVolumeExpr.update(0,e.symbol.isLastBar),this._volumeByPriceExpr.update(0),this._developingPocSeries.removeLastIfNaN(),this._developingVAHighSeries.removeLastIfNaN(),this._developingVALowSeries.removeLastIfNaN(),e.symbol.isLastBar)){this._studyDataUpdate.setEraseCmds(this.popEraseCmds()),this._studyDataUpdate.update();const e=this._studyDataUpdate.getUpdate();e.json&&r.data.push({nonseries:!0,type:"study_graphics",data:e.json}),e.jsonUpdate&&r.data.push({nonseries:!0,type:"study_graphics",data:e.jsonUpdate})}if(this._hasSecondarySymbol&&e.select_sym(0),i&&i.period===this._originalResolution.value()){(0,s.assert)(e.symbol.time===i.time);const t=i.time,n=t+this._originalResolution.inMilliseconds(t)-1;if(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 S(e){return{constructor:y,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=S({id:"VbPFixed@tv-volumebyprice-57",description:"Volume Profile Fixed Range"}),w=S({id:"VbPFixed@tv-basicstudies-152",description:"Fixed Range",is_hidden_study:!0})},11694:(e,t,i)=>{"use strict";i.d(t,{VolumeProfileOutputSeries:()=>n});var s=i(50151),r=i(29981);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<t),0,this._histPos+1);return 0===t?NaN:this._hist[t-1]}set(e){this._hist[this._histPos]=e}indexOf(e){throw new Error("Not implemented")}adopt(e,t,i){throw new Error("Method not implemented.")}}},24018:(e,t,i)=>{"use strict";i.d(t,{volumeProfileVisibleRangeStudyItem:()=>v});var s=i(50151),r=i(7370),n=i(9233),o=i(85049),a=i(40878),l=i(43789),c=i(61923);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._lastBarTime}}var d=i(45382),u=i(32569),p=i(62628),_=i(56209),m=i(11694),g=i(73772);class f extends r.VolumeProfileBase{constructor(){super(...arguments),this._rowsLayout="Number Of Rows",this._rowSize=24,this._volume="Up/Down",this._firstBarTime=0,this._lastBarTime=0,this._vaVolumePercent=70,this._anInt=0,this._eraseCmds=[]}nextGraphicsObjId(){return++this._anInt}pushEraseObjCmd(e,t){this._eraseCmds.push(new u.EraseObj(e,t))}popEraseCmds(){
const e=this._eraseCmds;return this._eraseCmds=[],e}init(e,t){this._studyDataUpdate=new p.JStudyDataUpdate(!0),this._hists=new a.GraphicsListColl,this._pocLines=new c.GraphicsList,this._valueAreaHists=new a.GraphicsListColl;const i=new d.StudyGraphicsData;i.getObjsContainer("hhists").push(new d.Container("histBars2",this._hists)),i.getObjsContainer("hhists").push(new d.Container("histBarsVA",this._valueAreaHists)),i.getObjsContainer("horizlines").push(new d.Container("pocLines",this._pocLines)),this._studyDataUpdate.init(i),this._rowsLayout=t(0),this._rowSize=t(1),this._volume=t(2),this._firstBarTime=t(3),this._lastBarTime=t(4),this._vaVolumePercent=t(5),this.verifyRowSizeInput(this._rowSize,this._rowsLayout),this._originalResolution=o.Interval.parse(e.symbol.interval+e.symbol.resolution);const n=this._lastBarTime+this._originalResolution.inMilliseconds(this._lastBarTime);0===this._firstBarTime&&0===this._lastBarTime?this._basicResolution=this._originalResolution:this._basicResolution=this.findBasicResolutionForFromTo(this._originalResolution,this._firstBarTime,n,(0,s.ensureDefined)(e.symbol.info)),this._hasSecondarySymbol=!this._originalResolution.isEqualTo(this._basicResolution),this._hasSecondarySymbol&&e.new_sym(e.symbol.tickerid,this._basicResolution.value());const l=this._getRowsLayout(this._rowsLayout,this._rowSize);this._vbPCheckHaveVolumeExpr=new _.VbPCheckHaveVolumeExpr(this),this._volumeByPriceExpr=new h((0,r.numOfSubHists)(this._volume),e,this,this._firstBarTime,n,this._hists,this._pocLines,this._valueAreaHists,this._vaVolumePercent,l,(0,r.maxHHistItems)()),this._volumeByPriceExpr.setIdsGeneratorProxy(this),this._developingPocSeries=new m.VolumeProfileOutputSeries,this._developingVAHighSeries=new m.VolumeProfileOutputSeries,this._developingVALowSeries=new m.VolumeProfileOutputSeries}main(e,t,i){this._hasSecondarySymbol&&e.select_sym(1),this._timeSeries=e.new_unlimited_var(),this._openSeries=e.new_unlimited_var(),this._highSeries=e.new_unlimited_var(),this._lowSeries=e.new_unlimited_var(),this._closeSeries=e.new_unlimited_var(),this._volumeSeries=e.new_unlimited_var();const r={type:"composite",data:[]};if(i&&i.period===this._basicResolution.value()&&(this._timeSeries.set(g.Std.time(e)),this._openSeries.set(g.Std.open(e)),this._highSeries.set(g.Std.high(e)),this._lowSeries.set(g.Std.low(e)),this._closeSeries.set(g.Std.close(e)),this._volumeSeries.set(g.Std.volume(e)),e.symbol.isFirstBar&&e.symbol.isLastBar||(this._developingPocSeries.addHist(g.Std.time(e)),this._developingVAHighSeries.addHist(g.Std.time(e)),this._developingVALowSeries.addHist(g.Std.time(e))),this._vbPCheckHaveVolumeExpr.update(0,e.symbol.isLastBar),this._volumeByPriceExpr.update(0),this._developingPocSeries.removeLastIfNaN(),this._developingVAHighSeries.removeLastIfNaN(),this._developingVALowSeries.removeLastIfNaN(),e.symbol.isLastBar)){this._studyDataUpdate.setEraseCmds(this.popEraseCmds()),this._studyDataUpdate.update();const e=this._studyDataUpdate.getUpdate();e.json&&r.data.push({nonseries:!0,type:"study_graphics",data:e.json}),
e.jsonUpdate&&r.data.push({nonseries:!0,type:"study_graphics",data:e.jsonUpdate})}if(this._hasSecondarySymbol&&e.select_sym(0),i&&i.period===this._originalResolution.value()){(0,s.assert)(e.symbol.time===i.time);const t=i.time,n=t+this._originalResolution.inMilliseconds(t)-1;if(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"}}}}},20629:(e,t,i)=>{"use strict";i.d(t,{StudyEngine:()=>r});var s=i(60656);class r{constructor(e){this.runner=new s.ScriptRunner(e)}stop(){this.runner.stop()}isStarted(){return this.runner.isStarted}}},1452:(e,t,i)=>{"use strict";i.d(t,{StudyError:()=>s});class s extends Error{constructor(e){super(e),this.studyError=!0}}},32569:(e,t,i)=>{"use strict";var s;i.d(t,{EraseAll:()=>n,EraseObj:()=>r,GraphicsCmds:()=>o}),function(e){e.One="one",e.All="all"}(s||(s={}));class r{constructor(e,t){this.id=e,this.type=t}primitiveData(){return{action:"one",id:this.id,type:this.type}}}class n{primitiveData(){return{action:"all"}}}class o{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")}}},40878:(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)}}},61923:(e,t,i)=>{"use strict";i.d(t,{GraphicsList:()=>n});var s=i(41978),r=i(67908);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()}}},41978:(e,t,i)=>{"use strict";i.d(t,{GraphicsObj:()=>l});var s=i(73772);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<i;r++){const i=e[r],n=t[r];if(!s.Std.equal(i,n))return!0}return!1}))}createTimeField(e,t){return new n(e,t,this)}dirty(){null!==this._owner&&this._owner.dirty()}setOwner(e){this._owner=e}}class l{constructor(e){this._mixinJSONObject=new a(this),this._state=0,this._owner=null,this._gen=e,this._id=e.nextGraphicsObjId(),this._id2=this._mixinJSONObject.createField(this.id(),"id")}dirty(){null!==this._owner&&this._owner.dirty()}setOwner(e){this._owner=e}id(){return this._id}unsetOwner(e){this._owner===e&&(this._owner=null)}state(){return this._state}erase(){1===this._state&&this._gen.pushEraseObjCmd(this._id,this.jsonName()),this._state=2,this.dirty()}markAsPosted(){1!==this._state&&(this._state=1,this.dirty())}isErased(){return 2===this._state}isPosted(){return 1===this._state}isNaN(){return!1}_processObjUpdate(){1===this._state&&(this._gen.pushEraseObjCmd(this._id,this.jsonName()),this._id=this._gen.nextGraphicsObjId(),this._id2.set(this._id),this._state=0),this.dirty()}}},67908:(e,t,i)=>{"use strict";function s(e){return Boolean(e.isNaN)}i.d(t,{isNaNable:()=>s})},62628:(e,t,i)=>{"use strict";i.d(t,{JStudyDataUpdate:()=>u});var s=i(32569);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,o=i(37265),a=i(67908);function l(e){return Boolean(e.isPosted)}!function(e){e[e.New=0]="New",e[e.Posted=1]="Posted",e[e.Erased=2]="Erased"}(n||(n={}));class c{isIgnoredObj(e,t){return c.isIgnoredObjDefault(e,t)}static isIgnoredObjDefault(e,t){if(void 0===t)return c.isIgnoredObjNaNable(e);const i=e[t];return c.isIgnoredByGeneralRules(e,t)||c.isIgnoredObjNaNable(i)||c.isIgnoredObjListOfNaNables(i)}static isIgnoredObjNaNable(e){return(0,a.isNaNable)(e)&&e.isNaN()}static isIgnoredObjListOfNaNables(e){if(!(0,o.isArray)(e))return!1;let t=!0;for(const i of e)if(!(0,a.isNaNable)(i)||!i.isNaN()){t=!1;break}return t}static isIgnoredObjPosted(e){return l(e)&&e.isPosted()}static isIgnoredObjErased(e){return l(e)&&e.isErased()}static isIgnoredByGeneralRules(e,t){const i=e[t];return(0,o.isArray)(i)&&0===i.length}}class h{isIgnoredObj(e,t){if(void 0===t)return c.isIgnoredObjDefault(e)||c.isIgnoredObjErased(e);const i=e[t];return c.isIgnoredObjDefault(e,t)||c.isIgnoredObjErased(i)}}class d{isIgnoredObj(e,t){if(void 0===t)return c.isIgnoredObjDefault(e)||c.isIgnoredObjErased(e)||c.isIgnoredObjPosted(e);const i=e[t];return c.isIgnoredObjDefault(e,t)||c.isIgnoredObjErased(i)||c.isIgnoredObjPosted(i)}}class u 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 h,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 d,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}:{}}}},45382:(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)}}}},42924:(e,t,i)=>{"use strict";const s=i(19625).getHexColorByName,r=i(73772).Std,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.or(r.and(r.eq(e,t),r.eq(e,i)),r.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.close(this._context),r.high(this._context),r.low(this._context),r.volume(this._context));return[r.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.open(t)),s=t.new_var(r.high(t)),n=t.new_var(r.low(t)),o=t.new_var(r.close(t)),a=r.abs(s-o.get(1)),l=r.abs(n-o.get(1)),c=r.abs(s-n),h=r.abs(o.get(1)-i.get(1)),d=r.max(a,l),u=r.iff(a>=r.max(l,c),a-.5*l+.25*h,r.iff(l>=r.max(a,c),l-.5*a+.25*h,c+.25*h));return r.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.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.gt(e,t)},this.f_1=function(e,t){return r.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.close(this._context),r.open(this._context)),n=this._context.new_var(s),o=r.sum(n,i,this._context),a=this.f_1(r.close(this._context),r.open(this._context)),l=this._context.new_var(a),c=r.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.close(this._context),s=this._input(0),n=this._input(1),o=this._input(2),a=this._context.new_var(i);return[r.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.high(this._context),n=i+1,o=this._context.new_var(s),a=r.highestbars(o,n,this._context),l=this.f_0(a,i),c=r.low(this._context),h=this._context.new_var(c),d=r.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.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.high(this._context)),i=r.change(t),s=this._context.new_var(r.low(this._context)),n=-r.change(s),o=this._context.new_var(r.tr(void 0,this._context)),a=r.rma(o,e,this._context),l=this._context.new_var(r.and(r.gt(i,n),r.gt(i,0))?i:0),c=r.fixnan(100*r.rma(l,e,this._context)/a,this._context),h=this._context.new_var(r.and(r.gt(n,i),r.gt(n,0))?n:0);return[c,r.fixnan(100*r.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.abs(s-n)/(r.eq(o,0)?1:o));return[100*r.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.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.le(e,0)?0:1},this.main=function(e,t){this._context=e,this._input=t;var i=r.hl2(this._context),s=this._context.new_var(i),n=r.sma(s,5,this._context),o=this._context.new_var(i),a=r.sma(o,34,this._context),l=this.f_0(n,a),c=l,h=this._context.new_var(l),d=r.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.le(e,0)?0:1},this.main=function(e,t){this._context=e,this._input=t;var i=r.hl2(this._context),s=this._context.new_var(i),n=r.sma(s,5,this._context),o=this._context.new_var(i),a=r.sma(o,34,this._context),l=this.f_0(n,a),c=this._context.new_var(l),h=r.sma(c,5,this._context),d=this.f_0(l,h),u=this._context.new_var(d),p=r.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.close(this._context),r.open(this._context),r.high(this._context),r.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.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.sma(o,s,this._context),l=this._context.new_var(i),c=r.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.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.sma(o,s,this._context),l=this._context.new_var(i),c=r.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.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.sma(o,s,this._context),l=this._context.new_var(i),c=r.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.or(r.and(r.eq(e,t),r.eq(e,i)),r.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.close(this._context),r.high(this._context),r.low(this._context),r.volume(this._context)),n=this._context.new_var(s),o=r.sum(n,i,this._context),a=r.volume(this._context),l=this._context.new_var(a),c=r.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.accdist(this._context),o=this._context.new_var(n),a=r.ema(o,i,this._context),l=this._context.new_var(n),c=r.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.high(this._context)-r.low(this._context)),s=this._context.new_var(r.ema(i,this.period,this._context));return[r.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.high(this._context),a=this._context.new_var(o),l=r.highest(a,i,this._context),c=r.atr(i,this._context),h=this.f_0(l,s,c),d=this._context.new_var(o),u=r.lowest(d,i,this._context),p=this.f_1(u,s,c),_=this._context.new_var(h),m=r.highest(_,n,this._context),g=this._context.new_var(p);return[r.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.ge(e,0)?e:0},this.f_1=function(e){return r.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.close(this._context),n=this._context.new_var(s),o=r.change(n),a=this.f_0(o),l=this.f_1(o),c=this._context.new_var(a),h=r.sum(c,i,this._context),d=this._context.new_var(l),u=r.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.close(this._context),t=r.hlc3(this._context),i=this._context.new_var(r.high(this._context)),s=r.highest(i,30,this._context),n=r.lowest(i,30,this._context),o=25/(s-n)*n,a=this._context.new_var(e),l=this._context.new_var(r.ema(a,34,this._context)),c=(l.get(1)-l.get(0))/t*o,h=r.sqrt(1+c*c),d=r.round(180*r.acos(1/h)/3.141592653589793),u=r.iff(r.gt(c,0),-d,d),p=r.and(r.gt(u,-2.14),r.le(u,-.71))?7:8,_=r.and(r.gt(u,-3.57),r.le(u,-2.14))?6:p,m=r.and(r.gt(u,-5),r.le(u,-3.57))?5:_,g=r.le(u,-5)?4:m,f=r.and(r.lt(u,2.14),r.ge(u,.71))?3:g,v=r.and(r.lt(u,3.57),r.ge(u,2.14))?2:f,y=r.and(r.lt(u,5),r.ge(u,3.57))?1:v;return[1,r.ge(u,5)?0:y]},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.log10(e/(t-i))/s},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.atr(1,this._context),n=this._context.new_var(s),o=r.sum(n,i,this._context),a=r.high(this._context),l=this._context.new_var(a),c=r.highest(l,i,this._context),h=r.low(this._context),d=this._context.new_var(h),u=r.lowest(d,i,this._context),p=r.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.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.sma(l,s,this._context),h=this._context.new_var(i),d=r.dev(h,s,this._context),u=this.f_0(i,c,d),p=this._context.new_var(u);return"EMA"===n?a=r.ema(p,o,this._context):"WMA"===n?a=r.wma(p,o,this._context):"SMA"===n&&(a=r.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.max(r.change(e),0));return r.rma(s,t,i)},this.f_2=function(e,t,i){var s=i.new_var(-r.min(r.change(e),0));return r.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.nz(e)<=0?1:r.nz(e)+1:r.nz(e)>=0?-1:r.nz(e)-1,this._context.new_var(e)}),this.main=function(e,t){
this._context=e,this._input=t;var i=r.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.rsi(this.f_1(s,n,this._context),this.f_2(s,n,this._context)),c=this.f_3(s),h=r.rsi(this.f_1(c,o,this._context),this.f_2(c,o,this._context)),d=this._context.new_var(r.roc(s,1)),u=r.percentrank(d,a);return[r.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.close(this._context),a=this._context.new_var(o),l=r.roc(a,s),c=this._context.new_var(o),h=r.roc(c,n),d=this.f_0(l,h),u=this._context.new_var(d);return[r.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.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.period(this._context),r.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.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.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.period(this._context)),this._context.new_sym(this._input(1),r.period(this._context)),this.period=this._input(2)},this.correlationLog=function(e,t,i,s){var n=r.sma(e,i,s),o=r.sma(t,i,s),a=s.new_var(e.get()*t.get());return(r.sma(a,i,s)-n*o)/Math.sqrt(r.variance2(e,n,i)*r.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.close(this._context)),n=this._context.new_var(r.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.close(this._context)),c=this._context.new_var(r.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.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.close(this._context)),n=this._context.new_var(r.sma(s,e,this._context)),o=this._context.new_var(r.close(this._context)).get(i)-n,a=r.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.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,offset:0}},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:"offset",name:"Offset",defval:0,type:"integer",min:-1e3,max:1e3}],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=this._input(1),n=r.low(this._context),o=this._context.new_var(n);this._context.setMinimumAdditionalDepth(i+Math.max(s,0))
;var a=r.lowest(o,i,this._context),l=r.high(this._context),c=this._context.new_var(l),h=r.highest(c,i,this._context);return[{value:a,offset:s},{value:h,offset:s},{value:r.avg(h,a),offset:s}]}}},{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.close(this._context),n=this._context.new_var(s),o=r.ema(n,i,this._context),a=this._context.new_var(o),l=r.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.hl2(this._context),o=this._context.new_var(n),a=r.change(o),l=this.f_0(i,a,r.high(this._context),r.low(this._context),r.volume(this._context)),c=this._context.new_var(l);return[r.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.close(this._context),n=this._context.new_var(s),o=r.change(n),a=this.f_0(o,r.volume(this._context)),l=this._context.new_var(a);return[r.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.na()},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.close(this._context),o=this._context.new_var(n),a=r.ema(o,i,this._context),l=this._context.new_var(n),c=r.ema(l,s,this._context),h=a,d=c,u=r.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[this._input(4)](this._context)),s=r.sma(i,this._input(0),this._context);return"Exponential"===this._input(3)?s=r.ema(i,this._input(0),this._context):"Weighted"===this._input(3)&&(s=r.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.close(this._context)),o=0,a=0,l=0;l<this.period;l++)o+=l+1,a+=n.get(l);i=o/this.period,s=a/this.period;var c=0,h=0,d=0;for(l=0;l<this.period;l++)d+=Math.pow(s-n.get(l),2),h+=(i-l-1)*(s-n.get(l)),c+=Math.pow(i-l-1,2);return h=Math.pow(h,2),[Math.sqrt((d-h/c)/(this.period-2))]}}},{name:"Standard Error Bands",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Standard Error Bands@tv-basicstudies-1",scriptIdPart:"",name:"Standard Error Bands",description:"Standard Error Bands",shortDescription:"Standard Error Bands",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:"#2196F3"},plot_1:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#FF6D00"},plot_2:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#2196F3"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:95,visible:!0}},inputs:{periods:21,errors:2,method:"Simple",averagePeriods:3}},styles:{plot_0:{title:"Plot 1"},plot_1:{title:"Plot 2"},plot_2:{title:"Plot 3"}},filledAreas:[{id:"fill_0",objAId:"plot_0",objBId:"plot_2",type:"plot_plot",title:"Background"}],inputs:[{id:"periods",type:"integer",name:"Periods"},{id:"errors",type:"float",name:"Standard Errors"},{id:"method",name:"Method",type:"text",defval:"Simple",options:["Simple","Exponential","Weighted"]},{id:"averagePeriods",type:"integer",name:"Averaging Periods"}],format:{type:"inherit"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.errorDeviation=this._input(1),this.maMethod=this._input(2),this.averagePeriod=this._input(3)},
this.main=function(e,t){this._context=e,this._input=t;for(var i,s,n=this._context.new_var(r.close(this._context)),o=0,a=0,l=0;l<this.period;l++)o+=l+1,a+=n.get(l);i=o/this.period,s=a/this.period;var c=0,h=0,d=0;for(l=0;l<this.period;l++)d+=Math.pow(s-n.get(l),2),h+=(i-l-1)*(s-n.get(l)),c+=Math.pow(i-l-1,2);h=Math.pow(h,2);var u,p,_,m=Math.sqrt((d-h/c)/(this.period-2)),g=r.linreg(n,this.period,0),f=this._context.new_var(g+this.errorDeviation*m),v=this._context.new_var(g),y=this._context.new_var(g-this.errorDeviation*m);return"Simple"===this.maMethod?(u=r.sma(f,this.averagePeriod,this._context),p=r.sma(v,this.averagePeriod,this._context),_=r.sma(y,this.averagePeriod,this._context)):"Exponential"===this.maMethod?(u=r.ema(f,this.averagePeriod,this._context),p=r.ema(v,this.averagePeriod,this._context),_=r.ema(y,this.averagePeriod,this._context)):(u=r.wma(f,this.averagePeriod,this._context),p=r.wma(v,this.averagePeriod,this._context),_=r.wma(y,this.averagePeriod,this._context)),[u,p,_]}}},{name:"Fisher Transform",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:"#E91E63",linestyle:2,linewidth:1,visible:!0,value:1.5},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:.75},{color:"#E91E63",linestyle:2,linewidth:1,visible:!0,value:0},{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:-.75},{color:"#E91E63",linestyle:2,linewidth:1,visible:!0,value:-1.5}],inputs:{in_0:9}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Fisher",histogramBase:0,joinPoints:!1,isHidden:!1,zorder:1},plot_1:{title:"Trigger",histogramBase:0,joinPoints:!1,isHidden:!1,zorder:1.1}},description:"Fisher Transform",shortDescription:"Fisher",is_price_study:!1,bands:[{id:"hline_0",name:"Level",isHidden:!1,zorder:-1.1},{id:"hline_1",name:"Level",isHidden:!1,zorder:-1.11},{id:"hline_2",name:"Level",isHidden:!1,zorder:-1.111},{id:"hline_3",name:"Level",isHidden:!1,zorder:-1.1111},{id:"hline_4",name:"Level",isHidden:!1,zorder:-1.11111}],inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:1e12}],id:"fisher_transform@tv-basicstudies-1",scriptIdPart:"",name:"Fisher Transform",format:{precision:2,type:"price"},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e){var t=r.lt(e,-.99)?-.999:e;return[r.gt(e,.99)?.999:t]},this.f_1=function(){var e=this._input(0),t=this._context.new_var(r.hl2(this._context)),i=r.highest(t,e,this._context),s=this._context.new_var(r.hl2(this._context)),n=r.lowest(s,e,this._context),o=this._context.new_var(),a=this.f_0(.66*((r.hl2(this._context)-n)/r.max(i-n,.001)-.5)+.67*r.nz(o.get(1)));o.set(a[0]);var l=this._context.new_var();l.set(.5*r.log((1+o.get(0))/r.max(1-o.get(0),.001))+.5*r.nz(l.get(1)));var c=l.get(1);return[l.get(0),c]},this.main=function(e,t){return this._context=e,this._input=t,this.f_1()}}},{
name:"Historical Volatility",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,isHidden:!1}},description:"Historical Volatility",shortDescription:"HV",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:1e12}],id:"historical_volatility@tv-basicstudies-1",scriptIdPart:"",name:"Historical Volatility",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(){var e=this._input(0),t=r.or(r.isintraday(this._context),r.and(r.isdaily(this._context),r.eq(r.interval(this._context),1)))?1:7,i=this._context.new_var(r.close(this._context)),s=this._context.new_var(r.log(r.close(this._context)/i.get(1)));return[100*r.stdev(s,e,this._context)*r.sqrt(365/t)]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Hull MA",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:"Hull Moving Average",shortDescription:"HMA",is_price_study:!0,inputs:[{id:"in_0",name:"length",defval:9,type:"integer",min:1,max:1e4}],id:"Hull MA@tv-basicstudies-1",scriptIdPart:"",name:"Hull MA",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=r.close(this._context),s=this._input(0),n=s/2;this._context.setMinimumAdditionalDepth(Math.ceil(s+n));var o=this._context.new_var(i),a=r.wma(o,n,this._context),l=this._context.new_var(i),c=r.wma(l,s,this._context),h=this.f_0(a,c),d=r.sqrt(s),u=r.round(d),p=this._context.new_var(h);return[r.wma(p,u,this._context)]}}},{name:"Ichimoku Cloud",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:l},plot_2:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#43A047"},plot_3:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#A5D6A7"},plot_4:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:o}},palettes:{palette_0:{colors:{0:{color:"#43A047",width:1,style:0},1:{color:a,width:1,style:0}}}},filledAreasStyle:{fill_0:{color:"#000080",transparency:90,visible:!0}},inputs:{in_0:9,in_1:26,in_2:52,in_3:26,in_4:26}},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"},{id:"plot_5",palette:"palette_0",target:"fill_0",type:"colorer"}],styles:{plot_0:{
title:"Conversion Line",histogramBase:0,joinPoints:!1,isHidden:!1},plot_1:{title:"Base Line",histogramBase:0,joinPoints:!1,isHidden:!1},plot_2:{title:"Lagging Span",histogramBase:0,joinPoints:!1,isHidden:!1},plot_3:{title:"Leading Span A",histogramBase:0,joinPoints:!1,isHidden:!1},plot_4:{title:"Leading Span B",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"Ichimoku Cloud",shortDescription:"Ichimoku",is_price_study:!0,is_hidden_study:!1,id:"Ichimoku Cloud@tv-basicstudies-1",palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"}},valToIndex:{0:0,1:1}}},filledAreas:[{id:"fill_0",objAId:"plot_3",objBId:"plot_4",type:"plot_plot",title:"Plots Background",isHidden:!1,palette:"palette_0"}],inputs:[{id:"in_0",name:"Conversion Line Periods",defval:9,type:"integer",min:1,max:1e12},{id:"in_1",name:"Base Line Periods",defval:26,type:"integer",min:1,max:1e12},{id:"in_2",name:"Leading Span Periods",defval:52,type:"integer",min:1,max:1e12},{id:"in_3",name:"Lagging Span Periods",defval:26,type:"integer",min:1,max:1e12},{id:"in_4",name:"Leading Shift Periods",defval:26,type:"integer",min:1,max:1e12}],scriptIdPart:"",name:"Ichimoku Cloud",format:{type:"inherit"}},constructor:function(){this.donchian=function(e){var t=this._context.new_var(r.low(this._context)),i=this._context.new_var(r.high(this._context));return r.avg(r.lowest(t,e,this._context),r.highest(i,e,this._context))},this.f_1=function(){var e=this._input(0),t=this._input(1),i=this._input(2),s=this._input(3)-1,n=this._input(4)-1,o=this.donchian(e),a=this.donchian(t),l=r.avg(o,a),c=this.donchian(i);return[o,a,r.close(this._context),l,c,-s,s,n,r.gt(l,c)?0:1]},this.main=function(e,t){this._context=e,this._input=t;var i=this.f_1();return[i[0],i[1],{value:i[2],offset:i[5]},{value:i[3],offset:i[7]},{value:i[4],offset:i[7]},i[8]]}}},{name:"Keltner 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:"#2196F3"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:95,visible:!0}},inputs:{in_0:!0,in_1:20,in_2:1}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"Upper",histogramBase:0,joinPoints:!1},plot_1:{title:"Middle",histogramBase:0,joinPoints:!1},plot_2:{title:"Lower",histogramBase:0,joinPoints:!1}},description:"Keltner Channels",shortDescription:"KC",is_price_study:!0,filledAreas:[{id:"fill_0",objAId:"plot_0",objBId:"plot_2",type:"plot_plot",title:"Plots Background"}],inputs:[{id:"in_0",name:"useTrueRange",defval:!0,type:"bool"},{id:"in_1",name:"length",defval:20,type:"integer",min:1,max:2e3},{id:"in_2",name:"mult",defval:1,type:"float",min:-1e12,max:1e12}],id:"Keltner Channels@tv-basicstudies-1",scriptIdPart:"",name:"Keltner Channels",format:{type:"inherit"
}},constructor:function(){this.f_0=function(e,t,i,s){return e?t:i-s},this.f_1=function(e,t,i){return e+t*i},this.f_2=function(e,t,i){return e-t*i},this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._input(0),n=this._input(1),o=this._input(2),a=this._context.new_var(i),l=r.ema(a,n,this._context),c=this.f_0(s,r.tr(void 0,this._context),r.high(this._context),r.low(this._context)),h=this._context.new_var(c),d=r.ema(h,n,this._context);return[this.f_1(l,d,o),l,this.f_2(l,d,o)]}}},{name:"Klinger 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:"#43A047"}},inputs:{}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1}},description:"Klinger Oscillator",shortDescription:"Klinger Oscillator",is_price_study:!1,inputs:[],id:"Klinger Oscillator@tv-basicstudies-1",scriptIdPart:"",name:"Klinger Oscillator",format:{type:"volume"}},constructor:function(){this.f_0=function(e,t){return r.ge(e,0)?t:-t},this.f_1=function(e,t){return e-t},this.main=function(e,t){this._context=e,this._input=t;var i=r.hlc3(this._context);this._context.setMinimumAdditionalDepth(66);var s=this._context.new_var(i),n=r.change(s),o=this.f_0(n,r.volume(this._context)),a=this._context.new_var(o),l=r.ema(a,34,this._context),c=this._context.new_var(o),h=r.ema(c,55,this._context),d=this.f_1(l,h),u=this._context.new_var(d);return[d,r.ema(u,13,this._context)]}}},{name:"Know Sure Thing",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}},bands:[{color:"#787B86",linestyle:2,linewidth:1,visible:!0,value:0}],inputs:{in_0:10,in_1:15,in_2:20,in_3:30,in_4:10,in_5:10,in_6:10,in_7:15,in_8:9}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"}],styles:{plot_0:{title:"KST",histogramBase:0,joinPoints:!1,zorder:1.1},plot_1:{title:"Signal",histogramBase:0,joinPoints:!1,zorder:1.11}},description:"Know Sure Thing",shortDescription:"KST",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"roclen1",defval:10,type:"integer",min:1,max:2e3},{id:"in_1",name:"roclen2",defval:15,type:"integer",min:1,max:2e3},{id:"in_2",name:"roclen3",defval:20,type:"integer",min:1,max:2e3},{id:"in_3",name:"roclen4",defval:30,type:"integer",min:1,max:2e3},{id:"in_4",name:"smalen1",defval:10,type:"integer",min:1,max:2e3},{id:"in_5",name:"smalen2",defval:10,type:"integer",min:1,max:2e3},{id:"in_6",name:"smalen3",defval:10,type:"integer",min:1,max:2e3},{id:"in_7",name:"smalen4",defval:15,type:"integer",min:1,max:2e3},{id:"in_8",
name:"siglen",defval:9,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1"]}],id:"Know Sure Thing@tv-basicstudies-1",scriptIdPart:"",name:"Know Sure Thing",format:{type:"price",precision:4},usePlotsZOrder:!0},constructor:function(){this.f_0=function(e,t,i,s){return e+2*t+3*i+4*s},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=this._input(6),h=this._input(7),d=this._input(8);this._context.setMinimumAdditionalDepth(Math.max(a+i,l+s,c+n,h+o)+d);var u=r.close(this._context),p=i,_=this._context.new_var(u),m=r.roc(_,p),g=a,f=this._context.new_var(m),v=r.sma(f,g,this._context),y=s,S=this._context.new_var(u),b=r.roc(S,y),w=l,C=this._context.new_var(b),P=r.sma(C,w,this._context),x=n,T=this._context.new_var(u),I=r.roc(T,x),M=c,A=this._context.new_var(I),L=r.sma(A,M,this._context),k=o,D=this._context.new_var(u),E=r.roc(D,k),V=h,B=this._context.new_var(E),R=r.sma(B,V,this._context),N=this.f_0(v,P,L,R),O=this._context.new_var(N);return[N,r.sma(O,d,this._context)]}}},{name:"Least Squares 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:25,in_1:0}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Least Squares Moving Average",shortDescription:"LSMA",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:25,type:"integer",min:1,max:1e12},{id:"in_1",name:"Offset",defval:0,type:"integer",min:-1e12,max:1e12}],id:"Least Squares Moving Average@tv-basicstudies-1",scriptIdPart:"",name:"Least Squares Moving Average",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=r.close(this._context),o=this._context.new_var(n);return[r.linreg(o,i,s)]}}},{name:"Linear Regression 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:9}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1}},description:"Linear Regression Curve",shortDescription:"LRC",is_price_study:!0,inputs:[{id:"in_0",name:"Length",defval:9,type:"integer",min:1,max:2e3}],id:"Linear Regression Curve@tv-basicstudies-1",scriptIdPart:"",name:"Linear Regression Curve",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._input(0),n=this._context.new_var(i);return[r.linreg(n,s,0)]}}},{name:"Linear Regression Slope",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Linear Regression Slope@tv-basicstudies-1",scriptIdPart:"",name:"Linear Regression Slope",description:"Linear Regression Slope",
shortDescription:"Linear Regression Slope",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",min:2}],format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0)},this.linregSlope=function(e,t,i){var s,r,n,o=0,a=0,l=0,c=0;for(s=0;s<t;++s)o+=n=t-1-s+1,a+=r=e.get(s),l+=n*n,c+=r*n;return(t*c-o*a)/(t*l-o*o)},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r.close(this._context));return[this.linregSlope(i,this.period,0)]}}},{name:"MA 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:"#43A047"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"},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:"MA Cross",shortDescription:"MA 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:"MA Cross@tv-basicstudies-1",scriptIdPart:"",name:"MA Cross",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e?t:r.na()},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.close(this._context),o=this._context.new_var(n),a=r.sma(o,i,this._context),l=this._context.new_var(n),c=r.sma(l,s,this._context),h=a,d=c,u=r.cross(a,c,this._context);return[h,d,this.f_0(u,a)]}}},{name:"MA with 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:10,in_1:10}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"}],styles:{plot_0:{title:"MA",histogramBase:0,joinPoints:!1},plot_1:{title:"EMA",histogramBase:0,joinPoints:!1},plot_2:{title:"Crosses",histogramBase:0,joinPoints:!1}},description:"MA with EMA Cross",shortDescription:"MA/EMA Cross",is_price_study:!0,inputs:[{id:"in_0",name:"Length MA",defval:10,type:"integer",min:1,max:2e3,
hideWhenPlotsHidden:["plot_0","plot_2"]},{id:"in_1",name:"Length EMA",defval:10,type:"integer",min:1,max:2e3,hideWhenPlotsHidden:["plot_1","plot_2"]}],id:"MA with EMA Cross@tv-basicstudies-1",scriptIdPart:"",name:"MA with EMA Cross",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e?t:r.na()},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this._input(1),n=r.close(this._context),o=this._context.new_var(n),a=r.sma(o,i,this._context),l=this._context.new_var(n),c=r.ema(l,s,this._context),h=a,d=c,u=r.cross(a,c,this._context);return[h,d,this.f_0(u,a)]}}},{name:"Mass 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:"Plot",histogramBase:0,joinPoints:!1}},description:"Mass Index",shortDescription:"Mass Index",is_price_study:!1,inputs:[{id:"in_0",name:"length",defval:10,type:"integer",min:1,max:2e3}],id:"Mass Index@tv-basicstudies-1",scriptIdPart:"",name:"Mass Index",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.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=this.f_0(r.high(this._context),r.low(this._context)),n=this._context.new_var(s),o=r.ema(n,9,this._context),a=this._context.new_var(o),l=r.ema(a,9,this._context),c=this.f_1(o,l),h=this._context.new_var(c);return[r.sum(h,i,this._context)]}}},{name:"McGinley Dynamic",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:{in_0:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,isHidden:!1}},description:"McGinley Dynamic",shortDescription:"McGinley Dynamic",is_price_study:!0,is_hidden_study:!1,id:"mcginley_dynamic@tv-basicstudies-1",inputs:[{id:"in_0",name:"length",defval:14,type:"integer",min:1,max:1e12}],scriptIdPart:"",name:"McGinley Dynamic",format:{type:"inherit"}},constructor:function(){this.f_0=function(){var e=this._input(0),t=r.close(this._context),i=this._context.new_var(t),s=r.ema(i,e,this._context),n=this._context.new_var(),o=n.get(1)+(t-n.get(1))/(e*r.pow(t/n.get(1),4));return n.set(r.na(n.get(1))?s:r.nz(o,s)),[n.get(0)]},this.main=function(e,t){return this._context=e,this._input=t,this.f_0()}}},{name:"Median Price",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,id:"Median Price@tv-basicstudies-1",scriptIdPart:"",name:"Median Price",description:"Median Price",shortDescription:"Median 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.hl2(this._context)]}}},{name:"Momentum",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:10,in_1:"close"}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Mom",histogramBase:0,joinPoints:!1,isHidden:!1,zorder:0}},description:"Momentum",shortDescription:"Mom",is_price_study:!1,bands:[{id:"hline_0",name:"Zero",zorder:-1}],inputs:[{id:"in_0",name:"Length",defval:10,type:"integer",min:1,max:2e3},{id:"in_1",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]}],id:"Momentum@tv-basicstudies-1",scriptIdPart:"",name:"Momentum",format:{type:"inherit"},usePlotsZOrder:!0},constructor:function(){this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r[this._input(1)](this._context),n=this._context.new_var(s).get(i);return[n?s-n:null]}}},{name:"Money Flow 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:14}},plots:[{id:"plot_0",type:"line"}],styles:{plot_0:{title:"Plot",histogramBase:0,joinPoints:!1,zorder:1}},description:"Money Flow Index",shortDescription:"MFI",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:"Money Flow@tv-basicstudies-1",scriptIdPart:"",name:"Money Flow Index",format:{precision:2,type:"price"}},constructor:function(){this.f_0=function(e,t,i){return e*(r.le(t,0)?0:i)},this.f_1=function(e,t,i){return e*(r.ge(t,0)?0:i)},this.main=function(e,t){this._context=e,this._input=t;var i=this._input(0),s=r.hlc3(this._context),n=this._context.new_var(s),o=r.change(n),a=this.f_0(r.volume(this._context),o,s),l=this._context.new_var(a),c=r.sum(l,i,this._context),h=this.f_1(r.volume(this._context),o,s),d=this._context.new_var(h),u=r.sum(d,i,this._context);return[r.rsi(c,u)]}}},{name:"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"},smoothedMA:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!1}},inputs:{symbol:"",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",shortDescription:"MA",is_price_study:!0,inputs:[{id:"symbol",name:"Other Symbol",defval:"",type:"symbol",optional:!0,isHidden:!1},{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@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average",format:{type:"inherit"},symbolSource:{type:"symbolInputSymbolSource",inputId:"symbol"}},constructor:function(){this.init=function(e,t){this._context=e,""!==t(0)&&this._context.new_sym(t(0),r.period(this._context))},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(this._context.symbol.time),s=r[this._input(2)](this._context),n=this._input(1),o=this._input(3),a=this._input(4),l=this._input(5);if(this._context.setMinimumAdditionalDepth(n+l),""!==this._input(0)){this._context.select_sym(1);var c=this._context.new_var(this._context.symbol.time),h=r[this._input(2)](this._context);s=this._context.new_var(h).adopt(c,i,1),this._context.select_sym(0)}var d,u=this._context.new_var(s),p=r.sma(u,n,this._context),_=this._context.new_var(p);return"EMA"===a?d=r.ema(_,l,this._context):"WMA"===a?d=r.wma(_,l,this._context):"SMA"===a&&(d=r.sma(_,l,this._context)),[{value:p,offset:o},{value:d,offset:o}]}}},{name:"Moving Average 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:"#2196F3"},plot_1:{linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,visible:!0,color:"#FF6D00"}},filledAreasStyle:{fill_0:{color:"#2196F3",transparency:90,visible:!0}},inputs:{in_0:20,in_1:20,in_2:0,in_3:0}},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}},filledAreas:[{id:"fill_0",objAId:"plot_0",objBId:"plot_1",type:"plot_plot",title:"Plots Background"}],description:"Moving Average Channel",shortDescription:"MAC",is_price_study:!0,inputs:[{id:"in_0",name:"Upper Length",defval:20,type:"integer",min:1,max:1e4},{id:"in_1",name:"Lower Length",defval:20,type:"integer",min:1,max:1e4},{id:"in_2",name:"Upper Offset",defval:0,type:"integer",min:-1e4,max:1e4},{id:"in_3",name:"Lower Offset",defval:0,type:"integer",min:-1e4,max:1e4}],id:"Moving Average Channel@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Channel",format:{type:"inherit"}},constructor:function(){this.main=function(e,t){this._context=e,
this._input=t;var i=r.high(this._context),s=r.low(this._context),n=this._input(0),o=this._input(1),a=this._input(2),l=this._input(3),c=this._context.new_var(i),h=this._context.new_var(s);return[{value:r.sma(c,n,this._context),offset:a},{value:r.sma(h,o,this._context),offset:l}]}}},{name:"Moving Average Convergence/Divergence",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:c},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"}},palettes:{palette_0:{colors:{0:{color:d,width:1,style:0},1:{color:h,width:1,style:0},2:{color:n,width:1,style:0},3:{color:"#FF5252",width:1,style:0}}}},inputs:{in_0:12,in_1:26,in_3:"close",in_2:9}},plots:[{id:"plot_0",type:"line"},{id:"plot_1",type:"line"},{id:"plot_2",type:"line"},{id:"plot_3",palette:"palette_0",target:"plot_0",type:"colorer"}],styles:{plot_0:{title:"Histogram",histogramBase:0,joinPoints:!1},plot_1:{title:"MACD",histogramBase:0,joinPoints:!1},plot_2:{title:"Signal",histogramBase:0,joinPoints:!1}},description:"MACD",shortDescription:"MACD",is_price_study:!1,palettes:{palette_0:{colors:{0:{name:"Color 0"},1:{name:"Color 1"},2:{name:"Color 2"},3:{name:"Color 3"}}}},inputs:[{id:"in_0",name:"fastLength",defval:12,type:"integer",min:1,max:2e3},{id:"in_1",name:"slowLength",defval:26,type:"integer",min:1,max:2e3},{id:"in_3",name:"Source",defval:"close",type:"source",options:["open","high","low","close","hl2","hlc3","ohlc4"]},{id:"in_2",name:"signalLength",defval:9,type:"integer",min:1,max:50}],id:"Moving Average Convergence/Divergence@tv-basicstudies-1",scriptIdPart:"",name:"MACD",format:{type:"inherit"}},constructor:function(){this.f_0=function(e,t){return e-t},this.f_1=function(e){var t=e>0?1:3,i=r.change(this._context.new_var(e));return t-(r.le(i,0)?0:1)},this.main=function(e,t){this._context=e,this._input=t;var i=r[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.ema(a,s,this._context),c=this._context.new_var(i),h=r.ema(c,n,this._context),d=this.f_0(l,h),u=this._context.new_var(d),p=r.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[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.ema(c,s,this._context),d=this._context.new_var(h);return"EMA"===o?l=r.ema(d,a,this._context):"WMA"===o?l=r.wma(d,a,this._context):"SMA"===o&&(l=r.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[this._input(1)](this._context),s=this._input(0),n=this._input(2),o=this._context.new_var(i);return[{value:r.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.close(this._context));return"Exponential"===this._input(2)?(i=r.ema(n,this._input(0),this._context),s=r.ema(n,this._input(1),this._context)):"Weighted"===this._input(2)?(i=r.wma(n,this._input(0),this._context),s=r.wma(n,this._input(1),this._context)):(i=r.sma(n,this._input(0),this._context),s=r.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.close(this._context));return"Exponential"===this._input(3)?(i=r.ema(o,this._input(0),this._context),s=r.ema(o,this._input(1),this._context),n=r.ema(o,this._input(2),this._context)):"Weighted"===this._input(3)?(i=r.wma(o,this._input(0),this._context),s=r.wma(o,this._input(1),this._context),n=r.wma(o,this._input(2),this._context)):(i=r.sma(o,this._input(0),this._context),s=r.sma(o,this._input(1),this._context),n=r.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.stdev(t,i,this._context),a=r.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.close(this._context)),s=this._context.new_var(r.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;s<t;++s)i+=e.get(t-s-1)*this.hmaFactors[s];return i/=this.hmaFactorsSum},this.main=function(e,t){this._context=e,this._input=t;var i=this._context.new_var(r.close(this._context));return[this.hma(i)]}}},{name:"Moving Average Multiple",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!0,id:"Moving Average Multiple@tv-basicstudies-1",scriptIdPart:"",name:"Moving Average Multiple",description:"Moving Average Multiple",shortDescription:"Moving Average Multiple",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"},{id:"plot_5",type:"line"}],defaults:{styles:{plot_0:{linestyle:0,visible:!0,linewidth:1,plottype:0,transparency:0,trackPrice:!1,color:"#9C27B0"},plot_1:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#FF6D00"},plot_2:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#43A047"},plot_3:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#26C6DA"},plot_4:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#F50057"},plot_5:{linestyle:0,visible:!0,linewidth:1,transparency:0,plottype:0,trackPrice:!1,color:"#2196F3"}},inputs:{firstPeriods:14,secondPeriods:21,thirdPeriods:35,fourthPeriods:50,fifthPeriods:100,sixthPeriods:200,method:"Simple"}},styles:{plot_0:{title:"Plot 1"},plot_1:{title:"Plot 2"},plot_2:{title:"Plot 3"},plot_3:{title:"Plot 4"},plot_4:{title:"Plot 5"},plot_5:{title:"Plot 6"}},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:"fourthPeriods",name:"4th Period",type:"integer",defval:50,min:1,max:1e4,hideWhenPlotsHidden:["plot_3"]},{id:"fifthPeriods",name:"5th Period",type:"integer",defval:100,min:1,max:1e4,hideWhenPlotsHidden:["plot_4"]},{id:"sixthPeriods",name:"6th Period",type:"integer",defval:200,min:1,max:1e4,hideWhenPlotsHidden:["plot_5"]},{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,a,l,c=this._context.new_var(r.close(this._context));return"Exponential"===this._input(6)?(i=r.ema(c,this._input(0),this._context),s=r.ema(c,this._input(1),this._context),n=r.ema(c,this._input(2),this._context),o=r.ema(c,this._input(3),this._context),a=r.ema(c,this._input(4),this._context),l=r.ema(c,this._input(5),this._context)):"Weighted"===this._input(6)?(i=r.wma(c,this._input(0),this._context),s=r.wma(c,this._input(1),this._context),n=r.wma(c,this._input(2),this._context),o=r.wma(c,this._input(3),this._context),a=r.wma(c,this._input(4),this._context),l=r.wma(c,this._input(5),this._context)):(i=r.sma(c,this._input(0),this._context),s=r.sma(c,this._input(1),this._context),n=r.sma(c,this._input(2),this._context),o=r.sma(c,this._input(3),this._context),a=r.sma(c,this._input(4),this._context),l=r.sma(c,this._input(5),this._context)),[i,s,n,o,a,l]}}},{name:"Majority Rule",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Majority Rule@tv-basicstudies-1",scriptIdPart:"",name:"Majority Rule",description:"Majority Rule",shortDescription:"Majority Rule",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:{rollingPeriod:14}},styles:{plot_0:{title:"Majority Rule"}},inputs:[{id:"rollingPeriod",type:"integer",name:"Rolling Period",min:1}],format:{precision:2,type:"price"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.rollingPeriod=this._input(0)},this.main=function(e,t){this._context=e,this._input=t;var i,s=r.close(this._context);return i=s>this._context.new_var(s).get(1)?1:0,[100*r.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.gt(e,0)?t:r.lt(i,0)?-t:0*t},this.main=function(e,t){this._context=e,this._input=t;var i=r.close(this._context),s=this._context.new_var(i),n=r.change(s);return[this.f_0(n,r.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.gt(e,0)?t:r.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.close(this._context),o=this._context.new_var(n),a=r.change(o),l=this.f_0(a,r.volume(this._context),a),c=r.cum(l,this._context);this._context.setMinimumAdditionalDepth(s);var h,d=this._context.new_var(c);return"EMA"===i?h=r.ema(d,s,this._context):"WMA"===i?h=r.wma(d,s,this._context):"SMA"===i&&(h=r.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.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.high(this._context),s=this._context.new_var(i),n=r.low(this._context),o=this._context.new_var(n),a=this._input(0),l=this._input(1),c=r.highest(s,a,this._context),h=r.lowest(o,a,this._context);return[{value:c,offset:l},{value:h,offset:l},{value:r.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.close(this._context),s=this._input(0),n=this._input(1),o=this._context.new_var(i),a=r.sma(o,s,this._context),l=this._context.new_var(i),c=r.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.close(this._context));return[r.cum(r.change(e)/e.get(1)*r.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.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.max(e,0)},this.f_1=function(e){return-r.min(e,0)},this.f_2=function(e,t){return r.eq(e,0)?100:r.eq(t,0)?0:100-100/(1+t/e)},this.main=function(e,t){this._context=e,this._input=t;var i=r.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.change(l),h=this.f_0(c),d=this._context.new_var(h),u=r.rma(d,s,this._context),p=this.f_1(c),_=this._context.new_var(p),m=r.rma(_,s,this._context),g=this.f_2(m,u),f=this._context.new_var(g);return"EMA"===n?a=r.ema(f,o,this._context):"WMA"===n?a=r.wma(f,o,this._context):"SMA"===n&&(a=r.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.close(this._context),r.open(this._context)),n=this._context.new_var(s),o=r.swma(n,this._context),a=this._context.new_var(o),l=r.sum(a,i,this._context),c=this.f_0(r.high(this._context),r.low(this._context)),h=this._context.new_var(c),d=r.swma(h,this._context),u=this._context.new_var(d),p=r.sum(u,i,this._context),_=this.f_1(l,p),m=this._context.new_var(_);return[_,r.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.le(e,0)?0:t},this.f_1=function(e,t){return r.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.close(this._context),n=this._context.new_var(s),o=r.stdev(n,i,this._context),a=this._context.new_var(s),l=r.change(a),c=this.f_0(l,o),h=this._context.new_var(c),d=r.ema(h,14,this._context),u=this.f_1(l,o),p=this._context.new_var(u),_=r.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.close(this._context),a=this._context.new_var(o),l=r.tsi(a,i,s,this._context),c=this._context.new_var(l),h=r.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[this._input(1)](this._context);return[r.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.close(this._context));return[r.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.close(this._context),a=r.high(this._context),l=r.low(this._context),c=this._context.new_var(o),h=this._context.new_var(a),d=this._context.new_var(l),u=r.stoch(c,h,d,i,this._context),p=this._context.new_var(u),_=r.sma(p,s,this._context),m=this._context.new_var(_);return[_,r.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.max(r.change(e),0));return r.rma(s,t,i)},this.f_2=function(e,t,i){var s=i.new_var(-r.min(r.change(e),0));return r.rma(s,t,i)},this.main=function(e,t){this._context=e,this._input=t;var i=r.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.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.stoch(h,d,u,n,this._context),_=this._context.new_var(p),m=r.sma(_,o,this._context),g=this._context.new_var(m);return[m,r.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.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.close(this._context)),n=this._context.new_var(s),o=r.ema(n,i,this._context),a=this._context.new_var(o),l=r.ema(a,i,this._context),c=this._context.new_var(l),h=r.ema(c,i,this._context),d=this._context.new_var(h),u=r.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.close(this._context),n=this._context.new_var(s),o=r.ema(n,i,this._context),a=this._context.new_var(o),l=r.ema(a,i,this._context),c=this._context.new_var(l),h=r.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.close(this._context),a=this._context.new_var(o),l=r.tsi(a,s,i,this._context),c=this._context.new_var(l);return[l,r.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.close(this._context)),t=r.sum(e,this.period,this._context),i=0,s=0,n=0;n<this.period;n++){var o=e.get(n);s+=(this.period-1-n)*o,i+=o*o}var a=s-this.invertedPeriod*this.sumX*t,l=(this.sumXX-this.invertedPeriodSumXSumX)*(i-this.invertedPeriod*t*t);return l<0?0==a?0:a>0?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.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.sum(s,i,this._context)/r.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.close(this._context)),n=r.max(r.high(this._context),s.get(1)),o=this._context.new_var(r.close(this._context)),a=r.min(r.low(this._context),o.get(1)),l=r.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.sqrt(s)},this.variance=function(e,t,i){var s=r.sma(e,t,i);return this.variance2(e,s,t)},
this.variance2=function(e,t,i){var s,r,n=0;for(s=0;s<i;s++)n+=(r=e.get(s)-t)*r;return n/(i-1)},this.standardHistVol=function(){var e=this._context.new_var(r.close(this._context)),t=this._context.new_var(r.log(e.get()/e.get(1)));return 100*this.stdev(t,this.period,this._context)*r.sqrt(this.daysPerYear)},this.main=function(e,t){return this._context=e,this._input=t,[this.standardHistVol()]}}},{name:"Volatility Zero Trend Close-to-Close",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Volatility Zero Trend Close-to-Close@tv-basicstudies-1",scriptIdPart:"",name:"Volatility Zero Trend Close-to-Close",description:"Volatility Zero Trend Close-to-Close",shortDescription:"Volatility Zero Trend 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",min:0,max:1e4},{id:"daysPerYear",name:"Days Per Year",type:"integer"}],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.volatliityZTCTC=function(){this._context.setMinimumAdditionalDepth(this._input(0)+1);for(var e=this._context.new_var(r.close(this._context)),t=this._context.new_var(e.symbol.time),i=Math.sqrt((t.get(0)-t.get(1))/864e5/this.daysPerYear),s=Math.log(r.close(this._context)/e.get(1)),n=this._context.new_var(s/i),o=this._context.new_var(Math.pow(n,2)),a=0,l=0;l<this.period;l++)a+=o.get(l);return 100*Math.sqrt(a/this.period)},this.main=function(e,t){return this._context=e,this._input=t,[this.volatliityZTCTC()]}}},{name:"Volatility O-H-L-C",metainfo:{_metainfoVersion:52,isTVScript:!1,isTVScriptStub:!1,is_hidden_study:!1,is_price_study:!1,id:"Volatility O-H-L-C@tv-basicstudies-1",scriptIdPart:"",name:"Volatility O-H-L-C",description:"Volatility O-H-L-C",shortDescription:"Volatility O-H-L-C",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,marketClosedPercentage:0,daysPerYear:252}},styles:{plot_0:{title:"Plot"}},inputs:[{id:"periods",type:"integer",name:"Periods"},{id:"marketClosedPercentage",type:"float",name:"Market Closed Percentage",min:0,max:.999},{id:"daysPerYear",type:"integer",name:"Days Per Year"}],format:{precision:2,type:"percent"}},constructor:function(){this.init=function(e,t){this._context=e,this._input=t,this.period=this._input(0),this.marketClosedPercentage=this._input(1),this.daysPerYear=this._input(2),this.secondsPerYear=86400*this.daysPerYear},this.square=function(e){return e*e},this.volatilityOHLC=function(){
var e=this._context.new_var(Math.log(r.open(this._context))),t=this._context.new_var(Math.log(r.high(this._context))),i=this._context.new_var(Math.log(r.low(this._context))),s=this._context.new_var(Math.log(r.close(this._context))),n=this._context.new_var(r.close(this._context)),o=this._context.new_var(n.symbol.time),a=(o.get(0)-o.get(1))/1e3,l=.5*this.square(t.get()-i.get());l-=(Math.log(4)-1)*this.square(s.get()-e.get()),this.marketClosedPercentage>0&&(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.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.high(this._context)-r.low(this._context),t=r.high(this._context)-this.bars[this.bars.length-2],i=this.bars[this.bars.length-2]-r.low(this._context);return this.tr=Math.max(e,t,i),"Exponential"===this.maMethod?this.atr=r.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.close(this._context)===this.bars[this.bars.length-1])return this.lastSar;if(this.bars.push(r.close(this._context)),1===this.count)this.atr=r.high(this._context)-r.low(this._context),this.sic=r.close(this._context);else if(this.count<this.period){var e=r.high(this._context)-r.low(this._context),t=r.high(this._context)-this.bars[this.bars.length-2],i=this.bars[this.bars.length-2]-r.low(this._context);this.atr+=Math.max(e,t,i),r.close(this._context)>this.sic&&(this.sic=r.close(this._context))}else if(this.count===this.period){e=r.high(this._context)-r.low(this._context),t=r.high(this._context)-this.bars[this.bars.length-2],i=this.bars[this.bars.length-2]-r.low(this._context);this.atr+=Math.max(e,t,i),this.atr*=1/this.period,
r.close(this._context)>this.sic&&(this.sic=r.close(this._context)),this.position="LONG",this.nextsar=this.sic-this.atr*this.atrMult}else{var s=this.nextsar;"LONG"===this.position?r.close(this._context)<s?(this.position="SHORT",this.sic=r.close(this._context),this.nextsar=this.sic+this.computeATR()):(this.position="LONG",this.sic=Math.max(r.close(this._context),this.sic),this.nextsar=this.sic-this.computeATR()):"SHORT"===this.position&&(r.close(this._context)>s?(this.position="LONG",this.sic=r.close(this._context),this.nextsar=this.sic-this.computeATR()):(this.position="SHORT",this.sic=Math.min(r.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.weekofyear(e,t)!==r.weekofyear(e,i)||r.year(e,t)!==r.year(e,i)};case"Month":return function(t,i){return r.month(e,t)!==r.month(e,i)||r.year(e,t)!==r.year(e,i)};case"Quarter":return function(t,i){return Math.floor(r.month(e,t)/3)!==Math.floor(r.month(e,i)/3)||r.year(e,t)!==r.year(e,i)};case"Year":return function(t,i){return r.year(e,t)!==r.year(e,i)};case"Decade":return function(t,i){return Math.floor(r.year(e,t)/10)!==Math.floor(r.year(e,i)/10)};case"Century":return function(t,i){return Math.floor(r.year(e,t)/100)!==Math.floor(r.year(e,i)/100)};default:return e=>this._isFirstBarInSession(e)}},this.init=function(e,t){this._input=t,this._isFirstBarInSession=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(),o=e.new_var();const a=r.time(this._context),l=this._context.new_unlimited_var(a).get(1);if(a){if(null===this._isFirstBarInSession){const t=r.createNthBarInSessionCheck(e);this._isFirstBarInSession=e=>t(e,0)}this._anchorChecker(a,l)&&(this.f_1(s),this.f_1(n),o.set(a))}return s.set(r.nz(s.get(1))+r[i](this._context)*r.volume(this._context)),n.set(r.nz(n.get(1))+r.volume(this._context)),r.na(o.get(0))?[NaN]:[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.close(this._context),s=this._input(0),n=this._context.new_var(i);return[r.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.volume(this._context),o=this._context.new_var(n),a=r.ema(o,i,this._context),l=this._context.new_var(n),c=r.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.low(this._context)),i=this._context.new_var(r.abs(r.high(this._context)-t.get(1))),s=r.sum(i,e,this._context),n=this._context.new_var(r.high(this._context)),o=this._context.new_var(r.abs(r.low(this._context)-n.get(1))),a=r.sum(o,e,this._context),l=this._context.new_var(r.atr(1,this._context)),c=r.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.high(this._context),n=this._context.new_var(s),o=r.highest(n,i,this._context),a=r.low(this._context),l=this._context.new_var(a),c=r.lowest(l,i,this._context);return[this.f_0(r.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.hl2(this._context);return[{value:r.smma(c,i,this._context),offset:o},{value:r.smma(c,s,this._context),offset:a},{value:r.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.high(this._context)),i=!0,s=!0,n=!0,o=!0,a=!0,l=!0,c=1;c<=e;c++)i=r.and(i,r.lt(t.get(e-c),t.get(e))),s=r.and(s,r.lt(t.get(e+c),t.get(e))),n=r.and(n,r.and(r.le(t.get(e+1),t.get(e)),r.lt(t.get(e+c+1),t.get(e)))),o=r.and(o,r.and(r.le(t.get(e+1),t.get(e)),r.and(r.le(t.get(e+2),t.get(e)),r.lt(t.get(e+c+2),t.get(e))))),a=r.and(a,r.and(r.le(t.get(e+1),t.get(e)),r.and(r.le(t.get(e+2),t.get(e)),r.and(r.le(t.get(e+3),t.get(e)),r.lt(t.get(e+c+3),t.get(e)))))),l=r.and(l,r.and(r.le(t.get(e+1),t.get(e)),r.and(r.le(t.get(e+2),t.get(e)),r.and(r.le(t.get(e+3),t.get(e)),r.and(r.le(t.get(e+4),t.get(e)),r.lt(t.get(e+c+4),t.get(e)))))));var h=r.or(s,r.or(n,r.or(o,r.or(a,l)))),d=r.and(i,h),u=this._context.new_var(r.low(this._context)),p=1,_=1,m=1,g=1,f=1,v=1;for(c=1;c<=e;c++)p=r.and(p,r.gt(u.get(e-c),u.get(e))),_=r.and(_,r.gt(u.get(e+c),u.get(e))),m=r.and(m,r.and(r.ge(u.get(e+1),u.get(e)),r.gt(u.get(e+c+1),u.get(e)))),g=r.and(g,r.and(r.ge(u.get(e+1),u.get(e)),r.and(r.ge(u.get(e+2),u.get(e)),r.gt(u.get(e+c+2),u.get(e))))),f=r.and(f,r.and(r.ge(u.get(e+1),u.get(e)),r.and(r.ge(u.get(e+2),u.get(e)),r.and(r.ge(u.get(e+3),u.get(e)),r.gt(u.get(e+c+3),u.get(e)))))),v=r.and(v,r.and(r.ge(u.get(e+1),u.get(e)),r.and(r.ge(u.get(e+2),u.get(e)),r.and(r.ge(u.get(e+3),u.get(e)),r.and(r.ge(u.get(e+4),u.get(e)),r.gt(u.get(e+c+4),u.get(e)))))));var y=r.or(_,r.or(m,r.or(g,r.or(f,v))));return[r.and(p,y),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.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.ema(i,s,this._context),d=r.ema(i,n,this._context),u=r.ema(i,o,this._context),p=r.ema(i,a,this._context),_=r.ema(i,l,this._context),m=r.ema(i,c,this._context),g=this._input(6),f=this._input(7),v=this._input(8),y=this._input(9),S=this._input(10),b=this._input(11);return[h,d,u,p,_,m,r.ema(i,g,this._context),r.ema(i,f,this._context),r.ema(i,v,this._context),r.ema(i,y,this._context),r.ema(i,S,this._context),r.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.period(this._context)&&this._context.new_sym(this._context.symbol.ticker,"1D")},this.main=function(e,t){
this._symbolSupports1DResolution||r.error(`Daily bars are not available for ${this._context.symbol.info.name}`),this._context=e,this._input=t,"1D"!==r.period(this._context)&&this._context.select_sym(1);const i=this._input(0),s=this._input(1),n=r.time(this._context),o=this._context.new_unlimited_var(n),a=this._context.new_unlimited_var(r[i](this._context)),l=this._context.new_unlimited_var(r[s](this._context));if(o.get(365),!this._context.symbol.isLastBar||!this._context.symbol.isNewBar)return null;const c=r.add_years_considering_dst(this._context.symbol.info.timezone,new Date(n),-1),h=o.indexOf(c.getTime()),d=-1===h?NaN:r.highest(a,h,this._context),u=-1===h?NaN:r.lowest(l,h,this._context);if(isNaN(d)||isNaN(u))return{nonseries:!0,type:"study_graphics",data:{graphicsCmds:{erase:[{action:"all"}]}}};return{nonseries:!0,type:"study_graphics",data:{graphicsCmds:{create:{horizlines:[{styleId:"highest",data:[{startIndex:n,endIndex:n,level:d,extendLeft:!0,extendRight:!0}]},{styleId:"lowest",data:[{startIndex:n,endIndex:n,level:u,extendLeft:!0,extendRight:!0}]}]},erase:[{action:"all"}]}}}}}}]},91007:(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={}))},16426:(e,t,i)=>{"use strict";i.d(t,{PointsetsManager:()=>n});var s=i(85049);const r=(0,i(31955).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<e.points.length;++t){const s=e.points[t];if(null!==s.extrapolation&&s.extrapolation.exact)continue;const[r,n]=s.point;s.extrapolation=i.extrapolateTimeWithOffsetToTime(1e3*r,n)}const o=[];for(let i=0;i<e.points.length;++i){const s=e.points[i];if(null===s.extrapolation)return null;const a=n.indexOfTime(s.extrapolation.timeMs);if(null===a)return r.logWarn(`Cannot get index of time: time=${s.extrapolation.timeMs}, ${e.resolution} -> ${t}`),null;o.push({
index:i,value:[a.index,a.timeMs/1e3]})}return o}}},75683:(e,t,i)=>{"use strict";i.d(t,{SessionTimeScale:()=>y});var s=i(50151),r=i(56570),n=i(2740),o=i(29981),a=i(53388),l=i(50503),c=i(9447);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 m(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 g(e,t,i=0){if(0===e.length)return[];let s=i,r=i;const n=[];for(;s<e.length;)r>=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<t[r].timeMs?(n.push({old:s,new:l.INVALID_TIME_POINT_INDEX}),s++):r++;return n.sort(((e,t)=>{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 f(e,t){return{span:e.markWeight,time:e.displayTime,index:t}}!function(e){e[e.FutureTickMarksLimit=1e3]="FutureTickMarksLimit"}(_||(_={}));const v=r.enabled("end_of_period_timescale_marks");class y{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(e<this._sortedTimePoints[0].timeMs){if(null===this._mainSymbolExtrapolator)return null;const t=this._mainSymbolExtrapolator.indexOfTime(e),i=this._mainSymbolExtrapolator.indexOfTime(this._sortedTimePoints[0].timeMs);if(null===t||null===i)return null;let s=t.index-i.index;return i.timeMs!==this._sortedTimePoints[0].timeMs&&(s-=1),{index:s,timeMs:t.timeMs}}if(e>this._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<t))
;return this._sortedTimePoints[t].timeMs!==e&&(t-=1),{index:t,timeMs:this._sortedTimePoints[t].timeMs}}setMainSymbolExtrapolator(e){this._mainSymbolExtrapolator=e,this._updateFutureBars(),this._fillPointsData(this._sortedTimePoints,0)}setMinFutureBarsCount(e){this._minFutureBarsCount=e,this._updateFutureBars()}minFutureBarsCount(){return this._minFutureBarsCount}firstFutureBarIndex(){return this._sortedTimePoints.length}firstSessionBarIndex(){return 0===this._sortedTimePoints.length?null:0}lastSessionBarIndex(){return 0===this._sortedTimePoints.length?null:this._sortedTimePoints.length-1}tickMarks(e=0){const t=this.firstFutureBarIndex();(0,s.assert)(e<=t,"tickmarks cannot be filtered in the future");const i=this._futureBars().map(((e,t)=>({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;t<this._sortedTimePoints.length;++t)r.push(f(this._sortedTimePoints[t],t));const n=i.map(((e,i)=>f(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.timeMs<t));for(const r of e){const e=Math.round(1e3*r.value[0]);for(;i<this._sortedTimePoints.length&&this._sortedTimePoints[i].timeMs<e;)i+=1;i!==this._sortedTimePoints.length&&this._sortedTimePoints[i].timeMs===e||(i-=1),(0,s.assert)(i!==t,"data must have unique times"),t=i,r.index=i}(0,s.assert)(i<this._sortedTimePoints.length,"data must be within a data range")}convertTimesToIndexes(e){if(0===e.length)return[];let t=-1,i=(0,o.lowerbound)(this._sortedTimePoints,e[0],((e,t)=>e.timeMs<t));return e.map((e=>{for(;i<this._sortedTimePoints.length&&this._sortedTimePoints[i].timeMs<e;)i+=1;if(0===i&&e<this._sortedTimePoints[0].timeMs)return l.INVALID_TIME_POINT_INDEX;if(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<t));for(let t=s;t<this._sortedTimePoints.length;++t){const s=this._sortedTimePoints[t];s.pointData.instances.delete(e)&&0===s.pointData.instances.size&&i.push(s)}const r=this._addBarsTimesToInstance(e,t,!0);this._cleanupPointsData(i);const n=r.map((e=>({timeMs:e.timeMs,pointData:e.pointData,markWeight:0,displayTime:NaN})));for(let e=s;e<this._sortedTimePoints.length;++e){const t=this._sortedTimePoints[e];0!==t.pointData.instances.size&&n.push(t)}n.sort(((e,t)=>e.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;i<this._sortedTimePoints.length&&i<e.length;++i){const s=this._sortedTimePoints[i],r=e[i];if(s.timeMs!==r.timeMs){t=i;break}r.markWeight=s.markWeight,r.displayTime=s.displayTime}if(t=S(t,this._sortedTimePoints.length,e.length),-1===t)return null;for(let i=t;i<e.length;++i){e[i].pointData.index=i}this._fillPointsData(e,t);const i=g(this._sortedTimePoints,e,t);return this._sortedTimePoints=e,this._updateFutureBars(),{pointsIndex:t,indexChange:i}}_updateTimeScalePointsTail(e){if(0===e.length)return null;const t=(0,o.lowerbound)(this._sortedTimePoints,e[0].timeMs,((e,t)=>e.timeMs<t));let i=-1;for(let s=0;s<e.length;++s){const r=e[s],n=t+s;if(r.pointData.index=n,n>=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=g(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+r<i.length&&r<e.length;)i[t+r]=e[r],r+=1;for(;r<e.length;++r)i.push(e[r]);i.length=s}return this._updateFutureBars(),{pointsIndex:i,indexChange:r}}_getBaseIndex(){return 0===this._sortedTimePoints.length?null:this._sortedTimePoints.length-1}_fillPointsData(e,t,i=null){this._fillDiplayTimeForPoints(e,t),function(e,t=0,i=null){let s=0===t||0===e.length?i:e[t-1].displayTime,r=null!==s?new Date(1e3*s):null,n=0;for(let i=t;i<e.length;++i){const t=e[i],o=new Date(1e3*t.displayTime);t.markWeight=m(o,r),n+=t.displayTime-(s||t.displayTime),r=o,s=t.displayTime}if(0===t&&e.length>1&&null===i){const t=Math.ceil(n/(e.length-1)),i=new Date(1e3*(e[0].displayTime-t));e[0].markWeight=m(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<this._sortedTimePoints.length;++t)s.push(this._sortedTimePoints[t].timeMs/1e3);return{...e,points:s,baseIndex:this._getBaseIndex(),marks:this.tickMarks(i)}}_fillDiplayTimeForPoints(e,t=0){if(null===this._mainSymbolExtrapolator)return;const i=this._mainSymbolExtrapolator.interval(),s=this._mainSymbolExtrapolator.barBuilder(),r=this._mainSymbolExtrapolator.symbolInfo(),o=null===this._displayTimezone?(0,n.get_timezone)(r.timezone):this._displayTimezone,l=1===this._instanceIds.size,h=i.isDWM(),d=h?(0,a.createDwmAligner)(i.value(),{timezone:r.timezone,corrections:l?r.corrections:void 0,session_holidays:l?r.session_holidays:void 0,session:l?r.session:"24x7"}):null,u=!h;for(let r=t;r<e.length;++r){let t=e[r].timeMs/1e3;v&&(t=(0,c.barTimeToEndOfPeriod)(s,t,i)),null!==d&&(t=Math.floor(d.timeToExchangeTradingDay(1e3*t)/1e3)),u&&(t=Math.floor((0,n.utc_to_cal_ts)(o,1e3*t)/1e3)),e[r].displayTime=t}}}function S(e,t,i){return-1===e&&t!==i&&(e=i<t?Math.max(0,i-1):t),e}},80359:(e,t,i)=>{"use strict";var s=i(2060),r=i(20629).StudyEngine,n=i(3075).OHLCV,o=i(36802),a=i(1430).SymbolExtrapolator,l=i(75683).SessionTimeScale,c=i(16426).PointsetsManager,h=i(14381),d=i(53388).createDwmAligner,u=i(85049).Interval,p=i(76422),_=i(44843).visitObject,m=i(37265).isObject;i(42924),i(6058);var g=i(47282).DatafeedRequestsCachedProcessor,f=i(63950).timezoneIsAvailable,v=i(53388).isAlignmentEnabled,y=i(73698),S=y.isEncodedExtendedSymbol,b=y.decodeExtendedSymbol,w=i(68805).extractSymbolNameFromSymbolInfo,C=i(30328).replaceGraphicsTimesWithTimePointIndexIndex,P=i(56570),x=i(91007).SubsessionId,T=i(14381).getPeriodsBetweenDates,I=i(39692).overwriteVolumeProfileResolutionForPeriodGetter;const M="pre_post_market_sessions",A=P.enabled(M),L=P.enabled("pay_attention_to_ticker_not_symbol");function k(e,t,i,s){return[e,t,i,s].filter((e=>!!e)).join("|")}var D=-5e6;function E(e){
var t=e.findIndex((function(e){return e.index!==D}));return-1===t?[]:0===t?e:e.slice(t)}function V(e,t,i){if(e){if("string"==typeof e)return void F("`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,i.country=void 0)}function B(e,t){return e+"_"+t}function R(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 N(e){const t=b(e),i="string"==typeof t.symbol?t:t.symbol;return[i.symbol,{currency:i["currency-id"],unit:i["unit-id"],session:i.session===x.Regular?void 0:i.session}]}var O=function(e){var t=this;this._studiesCache={},this._objectsDataCache={},this._studiesNonSeriesTimes={},this._metainfoCache=[],this._barsCoefficientsCache={},this._externalDatafeed=e,e.getVolumeProfileResolutionForPeriod&&I((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 g(e,this.serverTimeOffset.bind(this),this._datafeedConfiguration.reset_cache_timeout),o.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 h.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections),n=h.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 F(e){console.warn(`${(new Date).toISOString()} ${e}`)}function W(e,t){return e+"_"+t}function H(e,t,i,s){return e+(t?"_#_"+t:"")+(i?"_#_"+i:"")+(s?"_#_"+s:"")}O.prototype._getSymbolExtrapolator=function(e,t,i){var s=u.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 a(t,s),this._symbolExtrapolators[r]=n),n},O.prototype._barsCoefficients=function(e,t){if(void 0===b(e).type)return{};var i=e+t;return this._barsCoefficientsCache[i]||(this._barsCoefficientsCache[i]={}),this._barsCoefficientsCache[i]},
O.prototype.destroy=function(){for(const e of Object.keys(this._quotesInfo))this._stopQuotesSubscription(e);this._cachedDatafeed.destroy(),this._externalDatafeed=null;for(const e of Object.keys(this._pointsetsManagers))this._pointsetsManagers[e].destroy();this._quotesInfo={},this._pointsetsManagers={}},O.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={}},O.prototype.purgeDataCache=function(){this._cachedDatafeed.purgeCache()},O.prototype._logMessage=function(e){P.enabled("charting_library_debug_mode")&&console.log(`${(new Date).toISOString()} ${e}`)},O.prototype.on=function(e,t){return this._callbacks.hasOwnProperty(e)||(this._callbacks[e]=[]),this._callbacks[e].push(t),this},O.prototype._fireEvent=function(e,t,i){if(this._callbacks.hasOwnProperty(e)){for(var s=this._callbacks[e],r=0;r<s.length;++r)s[r](t);i||(this._callbacks[e]=[])}},O.prototype._adoptConfigurationData=function(e){var t=TradingView.merge({},e),i=t.supported_resolutions;if(!i||0===i.length)return t.supported_resolutions=void 0,t;for(var s=[],r=0;r<i.length;r++){var n=i[r];if(-1!==s.indexOf(n))throw new Error("Duplicating resolution `"+n+"`");s.push(n)}return t.supported_resolutions=s,t},O.prototype.supportedResolutions=function(){return this._datafeedConfiguration.supported_resolutions},O.prototype.supportedCurrencies=function(){return this._datafeedConfiguration.currency_codes||[]},O.prototype.supportedUnits=function(){return this._datafeedConfiguration.units||[]},O.prototype.supportedPriceSources=function(e){return new Promise(((t,i)=>{this._resolveSymbolImpl(e,(e=>{t(e.price_sources)}),(e=>{i(e)}))}))},O.prototype.supportedSymbolsTypes=function(){return this._datafeedConfiguration.symbols_types||[]},O.prototype.symbolsGrouping=function(){return this._datafeedConfiguration.symbols_grouping||{futures:/$a/}},O.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]},O.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=d(r,e),l=P.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(){p.emit("onMarkClick",e.id)},e.label=!!e.label&&(l?e.label.slice(0,2):e.label[0]),e}));s(c)}),r)}},O.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=d(r,e),o=t.map((function(e){return e.tickmark=null!==i?i.timeToSessionStart(1e3*e.time)/1e3:e.time,e}));s(o)}),r)}},O.prototype.getSeriesLastBarTime=function(e,t){var i=this._getSeriesData(e,t);return null===i||0===i.length?null:i[i.length-1].timeMs},O.prototype.getSeriesInterval=function(e,t){var i=this._studiesCache[e][t];return i?i.resolution:null},O.prototype.getSeriesSymbolInfo=function(e,t){var i=this._studiesCache[e][t];return i?i.symbolInfo:null},O.prototype._getSeriesData=function(e,t){return this._objectsDataCache[W(e,t)]||null},O.prototype._computeStudy=async function(e,t,i,s,n,o,a,l,c,h){var p=!0,_=[];null!==l&&(this._objectsDataCache[l]=null),this._timeScales[e].setCompleted(!1);var m=this._computeStudyCounter++;function g(e,t){if(e<c())return D;if(0===t)return 0;var i=_[t-1].index;return i===D?0:i+1}var f=new Map;var y=!1,S=this,b=function(){return S._studiesCache[e]&&S._studiesCache[e][n]&&S._studiesCache[e][n].activeResolve===m};S._studiesCache[e][n].activeResolve=m;var w,C,x=this._resolvePromisesBySymbolId.get(B(e,i));if(void 0===x)throw new Error("This should never happen");try{var I=await x;w=I.symbolInfo,C=I.requestedSymbol}catch(e){return void(b()&&h.onSymbolErrorCallback(e))}b()&&function(i,c){var m=u.parse(s);if(!m.isIntraday()||i.has_intraday){if(u.isDWM(s)&&void 0!==a.to){var b=d(s,i);null!==b&&(a.to=b.timeToExchangeTradingDay(a.to))}if(a.from&&a.to){const e=T(i.session,i.session_holidays,i.corrections,m.letter(),m.multiplier(),a.from,a.to);a.countBack=Math.max(e,a.countBack)}try{var w=new r({tickerid:c,symbolInfo:i,period:s,body:t,sessionId:e,onErrorCallback:h.onErrorCallback,dataRange:a,subsessionId:i.subsession_id,forceAlignBars:!P.enabled("disable_sameinterval_aligning")&&v(),enableDwmAligning:!S._studyCanExtendTimeScale(e,n),input:function(e){return o[e]},out:function(e,t){!function(e,t,i){for(var s=e.time,r="number"==typeof t?[t]:t,n=0;n<r.length;++n){var o=r[n];o&&"object"==typeof o&&(f.set(n,o.offset),o=o.value),"number"==typeof o&&isNaN(o)&&(o=void 0),r[n]=o}var a=_.length-1,l=a<0||s>_[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||h.onRealtimeCallback([_[_.length-1]],l,_.length,f,i)}(e,t,i)},nonseriesOut:function(e,t){h.onNonSeriesDataUpdate(t,i)},setNoMoreData:function(){y=!0},recalc:function(e,s){p=!1,_.endOfData=y,_.emptyBarCount=s.emptyBarCount,t.error&&null!==t.error()||(null!==l&&(S._objectsDataCache[l]=_),h.onDataReadyCallback(_,f,i,s))}});if(!S._studiesCache[e]||!S._studiesCache[e][n])throw Error("This should never happen");S._studiesCache[e][n].engine=w}catch(e){if(!e.studyError)throw e;h.onErrorCallback(e.message)}}else h.onErrorCallback("Unsupported resolution. Did you forget to set has_intraday to true?")}(w,C)},O.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},O.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=E(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<i.length;n++)t[n]=e[i[n].id];return t}(a),TradingView.ChartapiMessagerInstances[s].onStudyLoading(r,n);var d=null,u=!1;l._computeStudy(s,i,e,t,r,a,this._getDataRangeForStudy(s,r),null,(function(){if(l._studyCanExtendTimeScale(s,r))return-1/0;if(null===d){var e=l._getSeriesData(s,o)[0];if(void 0===e)return 1/0;d=e.timeMs}return d}),{onDataReadyCallback:function(e,t,i){u&&0===e.length||c(e,h(t))},onRealtimeCallback:function(e,t,i,o,a){if(e=E(e),l._studyCanExtendTimeScale(s,r)){const t=e.map((function(e){return e.timeMs})),i=l._timeScales[s].replaceBarsTimesTail(r,t);l._applyTimeScaleUpdate(s,i)}l._timeScales[s].fillIndexesInRows(e),TradingView.ChartapiMessagerInstances[s].onDataUpdate(r,n,e,h(o)),l._updateTimeScaleState(s)},onSymbolErrorCallback:function(){l._studiesCache[s][r].completed=!0,TradingView.ChartapiMessagerInstances[s].onStudyError(r,n,"error in series")},onErrorCallback:function(e){l._studiesCache[s][r].completed=!0,TradingView.ChartapiMessagerInstances[s].onStudyError(r,n,e)},onNonSeriesDataUpdate:function(e,t){switch(u=!0,e.type){case"projection":break;case"study_graphics":var i={data:e.data,indexes:[]},n=C(i);l._studiesNonSeriesTimes[s][r]=n,i.indexes=l._timeScales[s].convertTimesToIndexes(n),c([],i);break
;case"non_series_data":n=function(e){var t={};_(e,(function(e){m(e)&&Object.keys(e).forEach((function(i){i.endsWith("__t")&&(t[e[i]]=!0)}))}),{visitInstances:!0});var i=Object.keys(t).map(Number).sort((function(e,t){return e-t}));return i.forEach((function(e,i){t[e]=i})),Object.assign(e,_(e,(function(e){return m(e)&&Object.keys(e).forEach((function(i){i.endsWith("__t")&&(e[i.slice(0,-3)]=t[e[i]])})),e}),{visitInstances:!0})),i}(i={data:e.data,indexes:[]});l._studiesNonSeriesTimes[s][r]=n,i.indexes=l._timeScales[s].convertTimesToIndexes(n),c([],i);break;default:F("unsupported non-series data type for study "+e.type)}}})},O.prototype.onSessionSeriesError=function(e){this.stopSources(e);var t=this._mainSeriesRecord(e);null!==t&&(t.error=!0),this._applyTimeScaleUpdate(e,this._timeScales[e].clearTimeScale())},O.prototype.modifySeries=function(e,t,i,s,r,n){var o=this._mainSeriesRecord(e);if(null===o||o.guid!==t){if(null!==o&&o.error)return this._studiesCache[e][t].symbolId=i,this._studiesCache[e][t].resolution=s,void(this._studiesCache[e][t].turnaround=r);for(var a in this._stopSourcesTree(e,t),this.createSeries(e,t,r,i,s,{countBack:0},!0),this._studiesCache[e]){var l=this._studiesCache[e][a];if(l&&"study"===l.type&&l.parentId===t){this._studiesNonSeriesTimes[e][a]=null;var c=this._studiesCache[e][l.parentId];this._createStudy(c.symbolId,c.resolution,l.studyObject,e,a,l.turnaround,l.parentId,l.inputs)}}}else this._modifyMainSeries(e,i,s,r,n)},O.prototype._modifyMainSeries=function(e,t,i,s,r){this.stopSources(e);var n=this._mainSeriesRecord(e);let o=!1;for(var a in this._studiesCache[e]){if((l=this._studiesCache[e][a])&&"series"===l.type)if(l.guid===n.guid){o=n.symbolId!==t||n.resolution!==i;const a=R(r),l={countBack:a||0};P.enabled("request_only_visible_range_on_reset")&&a&&(delete this._objectsDataCache[W(e,n.guid)],delete this._studiesCache[e][n.guid]),this.createSeries(e,n.guid,s,t,i,l,!0)}else this.createSeries(e,l.guid,l.turnaround,l.symbolId,i,{countBack:0},!0)}for(var a in this._studiesCache[e]){var l;if((l=this._studiesCache[e][a])&&"study"===l.type){this._studiesNonSeriesTimes[e][a]=null;var c=this._studiesCache[e][l.parentId];this._createStudy(c.symbolId,c.resolution,l.studyObject,e,a,l.turnaround,l.parentId,l.inputs)}}o&&this._applyTimeScaleUpdate(e,this._timeScales[e].clearTimeScale())},O.prototype.stopSources=function(e){for(var t in this._studiesCache[e]){var i=this._studiesCache[e][t];i&&"series"===i.type&&this._stopSourcesTree(e,t)}},O.prototype._stopSourcesTree=function(e,t){for(var i in this._studiesCache[e]){var s=this._studiesCache[e][i];s&&(("series"===s.type&&i===t||"study"===s.type&&s.parentId===t)&&(s.engine&&s.engine.isStarted()&&s.engine.stop(),s.activeResolve=-1))}o.unsubscribeUnused()},O.prototype._recreateSourcesForDataRange=function(e,t){var i=[];for(var s in this._studiesCache[e]){if((n=this._studiesCache[e][s])&&"series"===n.type&&!this._isEndOfData(e,s,n.turnaround)&&(this._stopSourcesTree(e,s),i.push(s)),
n&&"study"===n.type&&this._studyCanExtendTimeScale(e,s)&&!this._isEndOfData(e,s,n.turnaround)){var r=this._studiesCache[e][n.parentId];n.dataRange=t,this._createStudy(r.symbolId,r.resolution,n.studyObject,e,s,n.turnaround,n.parentId,n.inputs)}}for(var s in i.forEach((function(i){this._startSourcesTree(e,i,Object.assign({},t))}),this),this._studiesCache[e]){var n;"series"===(n=this._studiesCache[e][s]).type&&this._isEndOfData(e,s,n.turnaround)&&TradingView.ChartapiMessagerInstances[e].onSeriesCompleted(s,n.turnaround,n.engine.runner.host.symbolInfo.data_status)}this._updateTimeScaleState(e)},O.prototype._startSourcesTree=function(e,t,i){var s=this._studiesCache[e][t];for(var r in this.createSeries(e,t,s.turnaround,s.symbolId,s.resolution,i,!0),this._studiesCache[e]){var n=this._studiesCache[e][r];n&&"study"===n.type&&n.parentId===t&&this._createStudy(s.symbolId,s.resolution,n.studyObject,e,r,n.turnaround,n.parentId,n.inputs)}},O.prototype.removeStudy=function(e,t){if(this._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].engine&&(this._studiesCache[e][t].engine.stop(),o.unsubscribeUnused()),this._studyCanExtendTimeScale(e,t)){this._timeScales[e].setCompleted(!1);const i=this._timeScales[e].setStudyBarsTimes(t,[]);this._applyTimeScaleUpdate(e,i),this._updateTimeScaleState(e)}delete this._studiesCache[e][t],delete this._studiesNonSeriesTimes[e][t]},O.prototype.removeSeries=function(e,t){this._stopSourcesTree(e,t),delete this._studiesCache[e][t],this._updateMainTsBuilder(e),this._timeScales[e].isCompleted()&&this._timeScales[e].setCompleted(!1);var i=this._timeScales[e].setSeriesBarsTimes(t,[]);this._applyTimeScaleUpdate(e,i),this._updateTimeScaleState(e)},O.prototype.modifyStudy=function(e,t,i,s){var r=this._studiesCache[e][t];if(!r)throw Error("This should never happen");var n=this._studiesCache[e][r.parentId];r.inputs=s,r.turnaround=i,r.engine&&(r.engine.stop(),o.unsubscribeUnused()),this._studiesNonSeriesTimes[e][t]=null,this._createStudy(n.symbolId,n.resolution,r.studyObject,e,t,i,r.parentId,s)},O.prototype.createStudy=function(e,t,i,s,r,n){var o=this._studiesCache[e][i],a=this._findStudyObject(r);if(null===a)return F("Study does not exist: "+r),void TradingView.ChartapiMessagerInstances[e].onStudyError(t,s,"unknown study name");var l=new a.constructor;this._studiesCache[e]=this._studiesCache[e]||{},this._studiesCache[e][t]={studyObject:l,guid:t,type:"study",inputs:n,metainfo:a.metainfo,turnaround:s,parentId:i},this._studiesNonSeriesTimes[e][t]=null,this._createStudy(o.symbolId,o.resolution,l,e,t,s,i,n)},O.prototype.sessionTimeScale=function(e){return this._timeScales[e]||null},O.prototype.isTimeScaleExtendedTo=function(e,t){var i=this._mainSeriesRecord(e);if(u.isDWM(i.resolution)&&null!=i.symbolInfo){var s=d(i.resolution,i.symbolInfo);null!==s&&(t=s.timeToSessionStart(t))}var r=this._timeScales[e].indexOfTime(t);return null!==r&&r.index>=0},O.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)},O.prototype.extendSeriesRange=function(e,t){var i=this._timeScales[e].firstSeriesBarTime();if(null!==i){var s=this._mainSeriesRecord(e);if(u.isDWM(s.resolution)&&null!=s.symbolInfo){var r=d(s.resolution,s.symbolInfo);null!==r&&(i=r.timeToExchangeTradingDay(i))}var n=this._symbolIdToSymbolRequestString.get(B(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")},O.prototype.seriesTurnaround=function(e,t){return this._studiesCache[e]&&this._studiesCache[e][t]&&this._studiesCache[e][t].turnaround},O.prototype._seriesDataRange=function(e,t){var i=this._studiesCache[e][t];return null!==i.firstLoadedTimeMs?{to:i.firstLoadedTimeMs,countBack:0}:i.dataRange},O.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))}},O.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)}},O.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))},O.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},O.prototype._seriesCount=function(e){var t=0;for(var i in this._studiesCache[e]){"series"===this._studiesCache[e][i].type&&(t+=1)}return t},O.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})))}},O.prototype.createSeries=function(e,t,i,s,r,o,a){this._setEndOfData(e,t,i,!1);var l=new n;this._studiesCache[e]=this._studiesCache[e]||{};var c=this._getSeriesData(e,t),h=this._studiesCache[e][t],d=this._seriesCount(e),p=this._mainSeriesRecord(e);if(!h||u.isEqual(h.resolution,r)&&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===d||null!==p&&(null!=p.firstLoadedTimeMs?(o.to=p.firstLoadedTimeMs,o.countBack=0):o=Object.assign({},p.dataRange));else if(1===d)o=Object.assign({},h.initialDatarange);else{var _=this._timeScales[e].firstSeriesBarTime();(void 0===o.to||null!==_&&_<o.to)&&(o.to=_,o.countBack=0)}if(void 0===o.countBack&&(o.countBack=0),void 0===o.to&&0===o.countBack&&(o.countBack=100),this._studiesCache[e][t]={symbolId:s,resolution:r,studyObject:l,guid:t,type:"series",turnaround:i,dataRange:o,initialDatarange:h&&h.initialDatarange||Object.assign({},o),firstLoadedTimeMs:null,symbolInfo:null,isMain:h&&h.isMain||0===d,completed:!1},null===p||p.guid===t||!p.error){this._updateMainTsBuilder(e),this._updateTimeScaleState(e),TradingView.ChartapiMessagerInstances[e].onSeriesLoading(t,i);var m=this;this._computeStudy(e,l,s,r,t,[],o,W(e,t),(function(){return-1/0}),{onDataReadyCallback:function(n,o,l,c){var h=m._studiesCache[e][t];if(!h)throw Error("This should never happen");if(h.symbolInfo=l,h.firstLoadedTimeMs=c.firstLoadedTimeMs,h.completed=!0,m._updateMainTsBuilder(e),a&&m._pointsetsManagers[e].invalidatePointsetsForSymbol(l.full_name,r),0!==n.length){var d=m._symbolIdToSymbolRequestString.get(B(e,s)),u=m._barsCoefficients(d,r);u.expectedBarsCount&&u.barsCount&&(u.barsCoefficient=Math.min(Math.max(u.barsCoefficient||1,parseInt(u.expectedBarsCount/(n.length-u.barsCount)+.5)),100)),u.barsCount=n.length,m._clearSeriesData(e,t)}else!c.endOfData&&h.isMain&&setTimeout((function(){m._studiesCache[e]&&m._recreateSourcesForDataRange(e,{countBack:10})}),0);g(l),c.endOfData&&(m._logMessage("Series has no more data on server: {0}".format(l.full_name)),m._setEndOfData(e,t,i)),0===n.length&&m._clearSeriesData(e,t),TradingView.ChartapiMessagerInstances[e].onSeriesCompleted(t,i,l.data_status),m._updateTimeScaleState(e)},onRealtimeCallback:function(s,n,o,a,l){g(l,s),m._timeScales[e].fillIndexesInRows(s);var c=s[s.length-1];if(n){if(!m._studiesCache[e][t])throw Error("This should never happen");m._logMessage("New bar arrived: symbol {0}, resolution {1}, bar {2}".format(l.full_name,r,JSON.stringify(c)))}else m._logMessage("Last bar update: symbol {0}, resolution {1}, bar {2}".format(l.full_name,r,JSON.stringify(c))),TradingView.ChartapiMessagerInstances[e].onDataUpdate(t,i,s,null);m._fireEvent("realtime_tick",s[s.length-1],!0)},onSymbolErrorCallback:function(e){m._logMessage("Series symbol resolve error: "+e),
f(e||"resolve error")},onErrorCallback:function(e){m._logMessage("Series error: "+e),f(e)},onNonSeriesDataUpdate:function(s,r){if("projection"!==s.type)throw new Error("unexpected non-series data type for series "+s.type);var n=m._getSeriesData(e,t);if(null!==n)g(r,0===n.length?void 0:[n[n.length-1]],s);else{s=m._prepareSeriesNonSeriesData(e,t,s);TradingView.ChartapiMessagerInstances[e].onDataUpdate(t,i,[],s)}}})}function g(s,n,o){var a=[];if(void 0!==o){var l=(o.data||[]).reduce((function(e,t){return Math.max(e,t[0]||0)}),-1);if(null!=o.projectionTime)for(var c=0;c<=l;++c)a.push(o.projectionTime+c)}var h=null,d=null,u=s?m._getSymbolExtrapolator(e,s,r):null;if(void 0!==n){var p=n.map((function(e){return e.timeMs})).concat(a);null!==u&&u.replaceBarsTimesTail(p,n.length),d=m._timeScales[e].replaceBarsTimesTail(t,p),h=n}else{var _=m._getSeriesData(e,t)||[],g=_.map((function(e){return e.timeMs})).concat(a);null!==u&&u.setBarsTimes(g,_.length),d=m._timeScales[e].setSeriesBarsTimes(t,g),h=_}if(m._applyTimeScaleUpdate(e,d),0!==h.length||void 0!==o){m._timeScales[e].fillIndexesInRows(h);var f=void 0!==o?m._prepareSeriesNonSeriesData(e,t,o):null;TradingView.ChartapiMessagerInstances[e].onDataUpdate(t,i,h,f)}}function f(s){var r=m._studiesCache[e][t];r.completed=!0,TradingView.ChartapiMessagerInstances[e].onSeriesError(t,i,s),P.enabled("clear_bars_on_series_error")&&(r.isMain?m.onSessionSeriesError(e):m._clearSeriesData(e,t))}},O.prototype._clearSeriesData=function(e,t){var i={};for(var s in i[t]={turnaround:this._studiesCache[e][t].turnaround},this._studiesCache[e]){var r=this._studiesCache[e][s];"study"===r.type&&this._studyCanExtendTimeScale(e,s)||("study"!==r.type||r.parentId!==t||this._studyCanExtendTimeScale(e,s)||(i[s]={turnaround:r.turnaround}))}TradingView.ChartapiMessagerInstances[e].onClearData(i)},O.prototype.requestMoreTickmarks=function(e,t){var i=this._timeScales[e];i.setMinFutureBarsCount(i.minFutureBarsCount()+t);var s=i.firstFutureBarIndex(),r=i.tickMarks(s);TradingView.ChartapiMessagerInstances[e].onTickmarksUpdated(s,r)},O.prototype.chartCreateSession=function(e){this._pointsetsManagers[e]=new c,this._timeScales[e]=new l,this._studiesNonSeriesTimes[e]={}},O.prototype.chartDeleteSession=function(e){this._pointsetsManagers[e].destroy(),delete this._pointsetsManagers[e],this._timeScales[e].destroy(),delete this._timeScales[e],delete this._studiesNonSeriesTimes[e]},O.prototype.removePointset=function(e,t){this._pointsetsManagers[e].removePointset(t)},O.prototype.createPointset=async function(e,t,i,s,r){var n,o=this._resolvePromisesBySymbolId.get(B(e,i));try{n=(await o).symbolInfo}catch(e){return}var a=this._getSymbolExtrapolator(e,n,s);if(this._pointsetsManagers[e].createPointset(t,n.full_name,s,r,a),null===this._refreshPointsetsTimerId){var l=this;this._refreshPointsetsTimerId=setTimeout((function(){l._refreshPointsetsTimerId=null,l._refreshPointsets(l._invalidatedPointsetSessions),l._invalidatedPointsetSessions.clear()}),0)}this._invalidatedPointsetSessions.add(e)},O.prototype._refreshPointsets=function(e){
var t=this;e.forEach((function(e){var i=t._studiesCache[e];if(null!=i){var s=null;for(var r in i){var n=i[r];if("series"===n.type){s=n;break}}if(null!==s&&null!=s.symbolInfo){var o=t._getSymbolExtrapolator(e,s.symbolInfo,s.resolution);t._pointsetsManagers[e].getUpdatesForSymbol(s.symbolInfo.full_name,s.resolution,o,t._timeScales[e]).forEach((function(t,i){TradingView.ChartapiMessagerInstances[e].onPointsetDataUpdate(i,null,t)}))}}}))},O.prototype.studiesMetadata=function(){return 0===this._metainfoCache.length&&(this._metainfoCache=JSServer.studyLibrary.map((function(e){return e.metainfo})),this._metainfoCache.push({palettes:{},inputs:[],plots:[{id:"open",type:"line"},{id:"high",type:"line"},{id:"low",type:"line"},{id:"close",type:"line"},{id:"volume",type:"line"}],graphics:{},_metainfoVersion:48,description:"Unnamed Study",format:{type:"inherit"},is_hidden_study:!0,is_price_study:!1,shortDescription:"Unnamed Study",description_localized:"Unnamed Study",id:"BarSetHeikenAshi@tv-prostudies",shortId:"BarSetHeikenAshi",packageId:"tv-basicstudies",version:"13",fullId:"BarSetHeikenAshi@tv-basicstudies-13",productId:"tv-basicstudies",name:"BarSetHeikenAshi@tv-basicstudies"})),this._metainfoCache},O.prototype.searchSymbols=function(e,t,i,s){this._logMessage("Symbol search requested: search string `{0}`, exchange: `{1}`, type `{2}`".format(e,t,i));var r=this;this._externalDatafeed.searchSymbols(e,t,i,(function(e){r._logMessage("Symbol search response: {0}".format(JSON.stringify(e))),e.forEach((e=>{V(e.logo_urls,e.exchange_logo,e)})),s(e)}))},O.prototype.resolveSymbol=function(e,t,i){var s=this;this._symbolIdToSymbolRequestString.set(B(e,t),i),this._resolvePromisesBySymbolId.set(B(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)}))})))},O.prototype._resolveSymbolImpl=function(e,t,i){var s;S(e)||(s="Expect to get symbol encoded string, but got the following instead: "+e,console.error(`${(new Date).toISOString()} ${s}`));const[r,n]=N(e);this._resolveSymbolByName(r,n,t,i)},O.prototype._resolveSymbolByName=function(e,t,i,s){var r,n=t&&t.currency,o=t&&t.unit,a=t&&t.session,l=H(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[H(e,t.currency_id,t.unit_id,t.subsession_id)]=r,c._resolveRequests[H(w(t,null),t.currency_id,t.unit_id,t.subsession_id)]=r,c._resolveRequests[H(w(t,null),n,o,a)]=r})).catch((function(){}))}r.then(i).catch(s)},O.prototype._resolveSymbolInternal=function(e,t,i,s){var r=this;return new Promise(function(n,o){const a=k(e,t,i,s);this._logMessage("Symbol resolve requested: `{0}` ".format(a));var l=!0;this._externalDatafeed.resolveSymbol(e,(function(e){
l&&F("`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){if(e.ticker||(e.ticker=e.symbol||e.name),e.full_name=L?e.ticker:`${e.exchange}:${e.name}`,e.pro_name=e.full_name,e.base_name||(e.base_name=[e.name]),e.legs||(e.legs=[e.name]),e.exchange||(e.exchange=e["exchange-listed"]),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"),void 0===e.visible_plots_set&&(e.visible_plots_set="ohlcv"),e.supported_resolutions)for(var t=0;t<e.supported_resolutions.length;t++){var i=u.parse(e.supported_resolutions[t]);i.isValid()&&(e.supported_resolutions[t]=i.value())}if(e.price_sources||(e.price_sources=[]),e["is-tickbars-available"]=!!e.has_ticks,delete e.has_ticks,A&&Array.isArray(e.subsessions))for(let t=0;t<e.subsessions.length;t++){const i=e.subsessions[t];switch(i.id){case x.Regular:case x.Extended:i.private=!1;break;case x.PreMarket:case x.PostMarket:i.private=!0}}}(e),function(e){const t=e.ticker??e.name??e.symbol??"unknown symbol";function i(e){F(`SymbolInfo validation for ${t}: `+e)}if("string"==typeof e.ticker&&0!==e.ticker.length||!L||i('ticker must be a non-empty string when the "pay_attention_to_ticker_not_symbol" featureset is enabled'),void 0!==e.exchange&&0!==e.exchange.length||i("exchange must be provided to the symbol information"),e.has_empty_bars&&!v()&&i('both has_empty_bars field and featureset "disable_resolution_rebuild" are enabled and may cause data issues (see #3329)'),(void 0===e.minmov||e.minmov<=0)&&i("minmov must be positive"),(void 0===e.pricescale||e.pricescale<=0)&&i("pricescale must be positive"),void 0!==e.name&&0!==e.name.length||i("name must be non-empty string"),void 0!==e.session&&0!==e.session.length||i("session must be non-empty string"),void 0!==e.holidays&&i("field holidays is deprecated, use session_holidays instead"),void 0!==e.has_no_volume&&i("field has_no_volume is deprecated, use visible_plots_set instead"),void 0===e.timezone||0===e.timezone.length?i("timezone must be non-empty string"):"exchange"!==e.timezone&&f(e.timezone)||"UTC"!==e.timezone&&i('unsupported timezone "{0}"'.format(e.timezone)),void 0!==e.intraday_multipliers){var s=e.intraday_multipliers;if(Array.isArray(s))for(var r=0;r<s.length;++r)"string"!=typeof s[r]&&i('intraday_multipliers[{0}] = "{1}" must be string (now: {2})'.format(r+1,s[r],typeof s[r]));else i("intraday_multipliers must be array")}(e.supported_resolutions||[]).filter((function(e){return!u.isValid(e)})).forEach((function(e){i("supported_resolutions field contains invalid value: "+e)})),
A||(void 0!==e.subsessions&&i("Symbol info contains subsessions but the pre_post_market_sessions feature is not enabled, so the subsessions will be ignored"),void 0!==e.subsession_id&&i("Symbol info contains a subsession ID but the pre_post_market_sessions feature is not enabled, so the subsession ID will be ignored"))}(e),r._logMessage("Symbol info after post-processing: `{0}`, SymbolInfo {1}".format(a,JSON.stringify(e))),n(e)}),(function(e){r._logMessage("Symbol resolve failed: `{0}`, reason: `{1}`".format(a,e)),o(e)}),{currencyCode:t,unitId:i,session:s}),l=!1}.bind(this))},O.prototype._createMarketStatusWatchers=function(e,t){void 0===this._marketStatusWatchers[e]&&(this._marketStatusWatchers[e]={});for(let i=0;i<t.length;i+=1){const r=t[i];if(void 0===this._marketStatusWatchers[e][r]){const[t,i]=N(r);this._marketStatusWatchers[e][r]=new s(((s,n,o,a)=>this._resolveSymbolByName(t,i,o,(s=>{F(`Error resolving for market status watcher ${k(t,i.currency,i.unit,i.session)}:\n${s}`),this.quoteRemoveSymbols(e,[r]),a(s)}))),e,r)}}},O.prototype._removeMarketStatusWatchers=function(e){var t=this;Object.keys(this._marketStatusWatchers[e]||{}).forEach((function(i){t._marketStatusWatchers[e][i].stop()})),this._marketStatusWatchers[e]={}},O.prototype._stopQuotesSubscription=function(e){this._quotesInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeQuotes(this._quotesInfo[e].listenerGUID),this._quotesInfo[e].listenerGUID=void 0),this._removeMarketStatusWatchers(e)},O.prototype._startQuotesSubscription=async function(e){var t={},i=this;const s=async e=>{const i=new Map,s=new Set;for(const r of e){const[e,n]=N(r),o=await new Promise((t=>this._resolveSymbolByName(e,n,(e=>t(e)),(()=>t(null)))));null!==o&&(t[o.ticker]=o,t[r]=o,s.add(o.ticker),o.ticker!==r&&(i.has(o.ticker)||i.set(o.ticker,[]),i.get(o.ticker).push(r)))}return[i,[...s]]},[r,n]=await s(this._quotesInfo[e].symbols),[o,a]=await s(this._quotesInfo[e].fastSymbols);function l(s){s.forEach((function(s){const n=s.n;if(r.has(n)||o.has(n)){const e=(r.get(n)??o.get(n)).map((e=>({...s,n:e})));setTimeout((()=>l(e)),0)}void 0!==t[s.n]&&null!==t[s.n]&&function(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,V(s.logo_urls,s.exchange_logo,t.values),r&&t.v.cs&&r.stop(),TradingView.ChartapiMessagerInstances[e].onQuotesData([e].concat([t]))}(s,t[s.n])}))}this._externalDatafeed.getQuotes&&!P.enabled("charting_library")?this._externalDatafeed.getQuotes(n,(function(t){i._quotesInfo[e]&&0!==i._quotesInfo[e].symbols.length&&(l(t),i._quotesInfo[e].listenerGUID=e,i._externalDatafeed.subscribeQuotes(n,a,l,i._quotesInfo[e].listenerGUID))}),(function(e){})):!this._externalDatafeed.getQuotes&&P.enabled("trading_terminal")&&setTimeout((()=>{l(this._quotesInfo[e].symbols.map((function(e){return{n:e,
s:"ok",v:{}}})))})),this._createMarketStatusWatchers(e,this._quotesInfo[e].symbols)},O.prototype._restartQuotesSubscription=function(e){this._stopQuotesSubscription(e),this._startQuotesSubscription(e)},O.prototype.quoteCreateSession=function(e){this._quotesInfo[e]={symbols:[],fastSymbols:[],listenerGUID:void 0}},O.prototype.quoteDeleteSession=function(e){this._stopQuotesSubscription(e),this._quotesInfo[e]=null},O.prototype.quoteSetFields=function(e,t){},O.prototype.quoteAddSymbols=function(e,t){this._quotesInfo[e].symbols=this._filteredSymbols(this._quotesInfo[e].symbols.concat(t)),this._restartQuotesSubscription(e)},O.prototype.quoteRemoveSymbols=function(e,t){this._quotesInfo[e].symbols=this._quotesInfo[e].symbols.filter((function(e){return t.indexOf(e)<0})),this._restartQuotesSubscription(e)},O.prototype.quoteFastSymbols=function(e,t){this._quotesInfo[e].fastSymbols=this._filteredSymbols(t),this._restartQuotesSubscription(e)},O.prototype.quoteHibernateAll=function(e){},O.prototype._stopDepthSubscription=function(e){this._depthInfo[e].listenerGUID&&(this._externalDatafeed.unsubscribeDepth(this._depthInfo[e].listenerGUID),this._depthInfo[e].listenerGUID=void 0)},O.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)])))})))},O.prototype._restartDepthSubscription=function(e){this._stopDepthSubscription(e),this._startDepthSubscription(e)},O.prototype.depthCreateSession=function(e){this._depthInfo[e]={symbol:null,listenerGUID:void 0}},O.prototype.depthDeleteSession=function(e){this._depthInfo[e].symbol=null,this._stopDepthSubscription(e),delete this._depthInfo[e]},O.prototype.depthSetSymbol=function(e,t){this._depthInfo[e].symbol=t,this._restartDepthSubscription(e)},O.prototype._filteredSymbols=function(e){var t=[];return e.forEach((function(e){e instanceof Object||t.indexOf(e)<0&&t.push(e)})),t},O.prototype._isEndOfData=function(e,t,i){var s=e+"!"+t+"@"+i;return!!this._endOfData[s]},O.prototype._setEndOfData=function(e,t,i,s){var r=e+"!"+t+"@"+i;this._endOfData[r]=!1!==s},O.prototype.serverTimeOffset=function(){return this._serverTimeOffset},O.prototype.serverTime=function(){return 1e3*this.getCurrentUTCTime()},O.prototype.getCurrentUTCTime=function(){return(new Date).valueOf()/1e3+this._serverTimeOffset},O.prototype.switchTimezone=function(e,t){this._timeScales[e].setTimezone(t);var i=this._timeScales[e].tickMarks();null!==i&&TradingView.ChartapiMessagerInstances[e].onTickmarksUpdated(0,i)},O.prototype._studyCanExtendTimeScale=function(e,t){const i=this._studiesCache[e][t]?.metainfo
;return void 0!==i&&(P.enabled("studies_extend_time_scale")&&i.canExtendTimeScale||P.enabled("secondary_series_extend_time_scale")&&"Overlay@tv-basicstudies-1"===i.id)},e.exports=O},1430:(e,t,i)=>{"use strict";i.d(t,{SymbolExtrapolator:()=>h});var s,r=i(50151),n=i(29981),o=i(14381),a=i(40644),l=i(85049);function c(e,t){return e.length>t}!function(e){e[e.DefaultExtrapolateLimit=2e5]="DefaultExtrapolateLimit"}(s||(s={}));class h{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=l.Interval.parse(t),this._extrapolateLimit=i,this._barBuilder=(0,o.newBarBuilder)(t,new o.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],s=this._barsTimes[this._barsTimes.length-1],o=i>s?this._barsTimes.length:(0,n.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,r.assert)(-1!==this._projectionFirstIndex,"something went wrong"),s!==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&&e<this._firstRealBarTimeMs){
this._ensureExtrapolatedToHistoryTime(e);let t=(0,n.lowerbound_int)(this._historyBarsCache,e);if(0!==this._historyBarsCache.length&&0===t&&e<this._historyBarsCache[0])return null;t!==this._historyBarsCache.length&&this._historyBarsCache[t]===e||(t-=1);return{index:t-this._historyBarsCache.length,timeMs:this._historyBarsCache[t]}}if(null!==this._lastRealBarTimeMs&&e>this._lastRealBarTimeMs){this._ensureExtrapolatedToFutureTime(e);let t=(0,n.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,r.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,r.ensureNotNull)(this._timeOfBarIndex(0)).timeMs}:null;let t=(0,n.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,n.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,r.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<this._projectionFirstIndex}}_extendFutureCacheFromRight(e){const t=0!==this._futureBarsCache.length?this._futureBarsCache[this._futureBarsCache.length-1]:this._lastRealBarTimeMs;if(null===t)return!1;const i=e(t,this._futureBarsCache.length);return 0!==i.length&&(this._futureBarsCache=this._futureBarsCache.concat(i),!0)}_extendHistoryCacheFromLeft(e){const t=0!==this._historyBarsCache.length?this._historyBarsCache[0]:this._firstRealBarTimeMs;if(null===t)return;const i=e(t,this._historyBarsCache.length);this._historyBarsCache=i.concat(this._historyBarsCache)}_extendFutureCacheToTimeFromLeft(e){if(null!==this._lastRealBarTimeMs&&this._lastRealBarTimeMs<=e)return;if((0,r.assert)(0===this._barsTimes.length||e===this._barsTimes[this._barsTimes.length-1],"invalid argument"),
this._lastRealBarTimeMs=e,0===this._futureBarsCache.length)return;const t=(0,a.extrapolateBarsFrontToTime)(this._barBuilder,e,this._futureBarsCache[0]-1,this._extrapolateLimit,!0).times;this._futureBarsCache=t.concat(this._futureBarsCache)}_extendHistoryCacheToTimeFromRight(e){if(null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs>=e)return;if((0,r.assert)(0===this._barsTimes.length,"bars should be empty"),this._firstRealBarTimeMs=e,0===this._historyBarsCache.length)return;const t=(0,a.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||c(this._futureBarsCache,this._extrapolateLimit))&&this._extendFutureCacheFromRight(((t,i)=>(0,a.extrapolateBarsFrontByCount)(this._barBuilder,t,e-i,!0).times))}_ensureExtrapolatedToFutureTime(e){null!==this._lastRealBarTimeMs&&this._lastRealBarTimeMs>=e||c(this._futureBarsCache,this._extrapolateLimit)||0!==this._futureBarsCache.length&&this._futureBarsCache[this._futureBarsCache.length-1]>=e||(this._extendFutureCacheFromRight(((t,i)=>(0,a.extrapolateBarsFrontToTime)(this._barBuilder,t,e,this._extrapolateLimit,!0).times)),this._futureBarsCache[this._futureBarsCache.length-1]<e&&this._ensureExtrapolatedToFutureBar(this._futureBarsCache.length+1))}_ensureExtrapolatedToHistoryBar(e){this._historyBarsCache.length>=e||c(this._historyBarsCache,this._extrapolateLimit)||this._extendHistoryCacheFromLeft(((t,i)=>(0,a.extrapolateBarsFrontByCount)(this._barBuilder,t,-(e-i),!0).times.reverse()))}_ensureExtrapolatedToHistoryTime(e){null!==this._firstRealBarTimeMs&&this._firstRealBarTimeMs<=e||c(this._historyBarsCache,this._extrapolateLimit)||0!==this._historyBarsCache.length&&this._historyBarsCache[0]<=e||(this._extendHistoryCacheFromLeft(((t,i)=>{const s=(0,a.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))}}},39076:(e,t,i)=>{"use strict";i.d(t,{backend:()=>s});const s=i(64289)},18278:(e,t,i)=>{"use strict";i.d(t,{HandlerInfo:()=>s});class s{constructor(e,t,i){this.handler=e,this.customId=t,this.singleShot=i}}},82783:(e,t,i)=>{"use strict";var s,r,n,o;function a(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:()=>o,areEqualTimeFrames:()=>a}),function(e){e.extractErrorReason=function(e){return e.params[1]}}(s||(s={})),function(e){e.Default="default",e.FullSingleSession="full_single_session"}(r||(r={})),function(e){e.PeriodBack="period-back",e.TimeRange="time-range"}(n||(n={})),function(e){e.PeriodBack="period-back",e.TimeRange="time-range"}(o||(o={}))},80437:()=>{"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[]}},62945:(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","web_site_url","pro_perm","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","figi","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","market_cap_calc","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_publication_type_next_fq","earnings_release_date","earnings_per_share_fq","earnings_per_share_forecast_fq","forecast_raw","last_release_date","next_release_date","reference_last_period","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","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","earnings_release_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","loans_net_fy_h","loans_net_fq_h","loans_net_fh_h","total_deposits_fy","total_deposits_fy_h","total_deposits_fq_h","total_deposits_fh_h","loan_loss_allowances_fy","loan_loss_allowances_fy_h","loan_loss_allowances_fq_h","loan_loss_allowances_fh_h","reserve_to_total_capital_fy_h","reserve_to_total_capital_fq_h","reserve_to_total_capital_fh_h","unearned_premium_to_total_capital_fy_h","unearned_premium_to_total_capital_fq_h","unearned_premium_to_total_capital_fh_h","insurance_reserves_fy_h","insurance_reserves_fq_h","insurance_reserves_fh_h","policy_claims_fy_h","policy_claims_fq_h","policy_claims_fh_h","premiums_earned_fy_h","premiums_earned_fq_h","premiums_earned_fh_h","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-displayed","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","actively_managed","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","preferred_stock_carrying_value_fh","preferred_stock_carrying_value_fq","total_debt_fq","minority_interest_fh","minority_interest_fq","cash_n_short_term_invest_fq","cash_n_due_f_banks_fh","cash_n_due_f_banks_fq","enterprise_value_current","etf_holdings_count","contract-description","reference-last-period","all_time_high","all_time_high_day","all_time_low","all_time_low_day","outstanding_amount","nominal_value","denom_min","current_coupon","coupon_type_general","coupon_frequency","yield_to_maturity","maturity-date","days_to_maturity","bond_issuer","issue_date","bond_issuer_stock_symbol"]),o=new r({
fields:n})},90277:(e,t,i)=>{"use strict";i.d(t,{destroyQuoteSessions:()=>a,getQuoteSessionInstance:()=>o});var s=i(4097),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]}}},98525:(e,t,i)=>{"use strict";i.d(t,{QuoteSession:()=>r});var s=i(92184);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},4097:(e,t,i)=>{"use strict";e=i.nmd(e);var s=i(43370).default,r=i(12481).default,n=i(725).PriceFormatter;const{uniq:o}=i(97144);var a=i(92184);const{normalizeUpdateMode:l}=i(5370);var c=i(31054).deepExtend;const{QUOTE_FIELDS_CACHE:h,QUOTE_FIELDS:d}=i(62945);var u=i(52033).Delegate;var p;function _(e,t){this.options=Object.assign({throttleTimeout:125},t),this._connected=!1,this._symbol_data={},this._subscriptions={},this.onConnect=new u,this.onDisconnect=new u,this._quoteApi=new p(window.ChartApiInstance),this._type=e||"full",this._delayUpdateFastSymbols=r(this._updateFastSymbols,250),this._throttledSymbolData={},this._formatterValuesCache={},this._waitingForFormatters={},this._snapshotValuesCache={},this._waitingForSnapshot={},this.connect()}p=i(98525).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","unit_id","measure"],
_.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","local_description","language","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_calc","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","unit_id","measure"],_.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.typeFields.economic=["reference-last-period","lp","currency_code","value_unit_id","unit_id","measure"],_.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<t.length;n++){var o=t[n];if(s)if(s.has(o)&&i){var a=s.get(o).indexOf(i);~a&&s.get(o).splice(a,1),s.get(o).length||s.delete(o)}else s.delete(o);s&&0===s.size&&delete this._subscriptions[e],this._symbol_data.hasOwnProperty(o)&&(s&&!s.has(o)&&this._symbol_data[o].subscribers_count--,this._symbol_data[o].subscribers_count||(delete this._symbol_data[o],r.push(o)))}r.length&&this._connected&&(this._quoteApi.quoteRemoveSymbols(r),this._delayUpdateFastSymbols())},_.prototype.setFastSymbols=function(e,t){if(this._subscriptions[e])for(var i=this._subscriptions[e],s=Array.from(i.keys()),r=0;r<s.length;++r){var n=s[r];i.get(n).fast=-1!==t.indexOf(n)}this._delayUpdateFastSymbols()},_.prototype._updateFastSymbols=function(){if(this._connected){var e=this._fastSymbols();0===e.length?this._quoteApi.quoteHibernateAll():this._quoteApi.quoteFastSymbols(e)}},_.prototype._delayUpdateFastSymbols=_.prototype._updateFastSymbols,_.prototype._fastSymbols=function(){var e=[];for(var t in this._subscriptions)for(var i=this._subscriptions[t],s=Array.from(i.keys()),r=0;r<s.length;++r){var n=s[r];i.get(n).fast&&e.push(n)}return e=o(e)},_.prototype.formatter=function(e,t){var i=this;if(this._waitingForFormatters[e])return this._waitingForFormatters[e];function s(e){var i=t&&!e.fractional?1:e.minmov;return new n({priceScale:e.pricescale,minMove:i,fractional:e.fractional,minMove2:e.minmove2})}var r=new Promise((function(t,r){if(i._formatterValuesCache[e])t(s(i._formatterValuesCache[e]));else{var n=a.guid();i.subscribe(n,[e],(function(o){"error"===o.status&&(i._waitingForFormatters[e]=null,r("Quotes snapshot is not received")),function(e){return e&&null!=e.pricescale&&null!=e.minmov}(o.values)&&(i._waitingForFormatters[e]=null,i._formatterValuesCache[e]=o.values,t(s(o.values)),i.unsubscribe(n,e))}))}}));return this._waitingForFormatters[e]=r,r},_.prototype.snapshot=function(e){var t=this;if(this._waitingForSnapshot[e])return this._waitingForSnapshot[e];var i=new Promise((function(i,s){if(t._snapshotValuesCache[e])i(t._snapshotValuesCache[e]);else{var r=a.guid();t.subscribe(r,[e],(function(n){"error"===n.status&&(t._waitingForSnapshot[e]=null,s("Quotes snapshot is not received"))
;var o=n.values;o&&o.minmov&&o.pricescale&&(t._waitingForSnapshot[e]=null,t._snapshotValuesCache[e]=o,i(o),t.unsubscribe(r,e))}))}}));return this._waitingForSnapshot[e]=i,i},TradingView.QuoteSessionMultiplexer=_,e&&e.exports&&(e.exports=_)},63812:(e,t,i)=>{"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}}},29981:(e,t,i)=>{"use strict";i.d(t,{compareTwoCollectionsByIds:()=>v,indexOf:()=>f,intersect:()=>_,join:()=>m,lowerbound:()=>o,lowerboundExt:()=>n,lowerbound_int:()=>a,mapEntriesGenerator:()=>y,moveAfter:()=>u,moveBefore:()=>p,moveToHead:()=>d,nestedMapGenerator:()=>S,removeItemFromArray:()=>g,subtract:()=>h,upperbound:()=>l,upperbound_int:()=>c});var s=i(50151);function r(e,t){return e<t}function n(e,t,i,s,r){let n=r-s;for(;0<n;){const r=n>>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<n;){const r=n>>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<e.length-1?a(o,i+1):r.length,r.splice(i,0,...n),{newItems:r,movedItemsStartIndex:i}}function p(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<=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<e.length;i++)if(t(e[i]))return i;return-1}function v(e,t){if(e.length!==t.length)return!1;for(let i=0;i<e.length;++i)if(e[i].id()!==t[i].id())return!1;return!0}function*y(e){for(const[t,i]of e)yield[t,i]}function*S(e,t){for(const[i,s]of e)if(void 0===t)for(const[,e]of s)yield[i,e];else{const e=s.get(t);void 0!==e&&(yield[i,e])}}},2740:(e,t,i)=>{"use strict";var s=i(84917),r=i(23998).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;l<o;l++)i[l]*=1e3,s[l]*=1e3,
a[l]=i[l]-s[l];t.time_utc=a}this.tz=t}function a(e,t){var i=e.length;if(0===i)return-1;if(isNaN(t))throw Error("Key is NaN");for(var s=0,r=i-1,n=l((s+r)/2);;){if(e[n]>t){if((r=n-1)<s)return n}else if(r<(s=n+1))return n<i-1?n+1:-1;n=l((s+r)/2)}}o.prototype.offset_utc=function(e){return o._offset(this.tz.time_utc,this.tz.offset,e)},o.prototype.offset_loc=function(e){return o._offset(this.tz.time,this.tz.offset,e)},o.prototype.name=function(){return this._name},o.prototype.correction_loc=function(e){var t=this.tz.time,i=this.tz.offset,s=a(t,e);if(s<1)return 0;var r=i[s]-i[s-1];if(r>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=_},51056:(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},5201:(e,t,i)=>{"use strict";i.d(t,{CircularCacheBuffer:()=>o});var s,r=i(50151);function n(e){const{prevItem:t,nextItem:i}=e;null!==t&&(t.nextItem=i),null!==i&&(i.prevItem=t)}!function(e){e[e.CapacityFactor=1.3]="CapacityFactor"}(s||(s={}));class o{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&&(n(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){n(i);const e=(0,r.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&&(n(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,r.ensureNotNull)(this._firstItem);for(let i=0;i<e;i+=1)this._cache.delete(t.key),t=(0,r.ensureNotNull)(t.nextItem);t.prevItem=null,this._firstItem=t}}},88960:(e,t,i)=>{"use strict";i.d(t,{combine:()=>o,combineWithFilteredUpdate:()=>n});var s=i(64147)
;function r(e,t,...i){let r=null;const n=(...t)=>e(...t.map((e=>e.value())),null==r?void 0:r.value()),o=r=new s.WatchedValue(n(...i)),a=()=>{t(...i.map((e=>e.value())))&&o.setValue(n(...i))},l=i.map((e=>e.spawn()));for(const e of l)e.subscribe(a);return o.readonly().spawn((()=>{l.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)}},63950:(e,t,i)=>{"use strict";i.r(t),i.d(t,{availableTimezones:()=>l,timezoneIsAvailable:()=>u,timezoneIsSupported:()=>p,timezoneTitle:()=>_,updateAvailableTimezones:()=>d});var s=i(82112),r=i(11542);const n=[{id:"Etc/UTC",get title(){return r.t(null,void 0,i(1833))}},{id:"exchange",get title(){return r.t(null,void 0,i(86905))}}],o=[{id:"Africa/Cairo",get title(){return r.t(null,void 0,i(65736))},offset:0},{id:"Africa/Casablanca",get title(){return r.t(null,void 0,i(70409))},offset:0},{id:"Africa/Johannesburg",get title(){return r.t(null,void 0,i(39585))},offset:0},{id:"Africa/Lagos",get title(){return r.t(null,void 0,i(19931))},offset:0},{id:"Africa/Nairobi",get title(){return r.t(null,void 0,i(40977))},offset:0},{id:"Africa/Tunis",get title(){return r.t(null,void 0,i(21007))},offset:0},{id:"America/Anchorage",get title(){return r.t(null,void 0,i(42630))},offset:0},{id:"America/Argentina/Buenos_Aires",get title(){return r.t(null,void 0,i(25282))},offset:0},{id:"America/Bogota",get title(){return r.t(null,void 0,i(73905))},offset:0},{id:"America/Caracas",get title(){return r.t(null,void 0,i(30948))},offset:0},{id:"America/Chicago",get title(){return r.t(null,void 0,i(72452))},offset:0},{id:"America/El_Salvador",get title(){return r.t(null,void 0,i(55502))},offset:0},{id:"America/Juneau",get title(){return r.t(null,void 0,i(67560))},offset:0},{id:"America/Lima",get title(){return r.t(null,void 0,i(59444))},offset:0},{id:"America/Los_Angeles",get title(){return r.t(null,void 0,i(28733))},offset:0},{id:"America/Mexico_City",get title(){return r.t(null,void 0,i(73332))},offset:0},{id:"America/New_York",get title(){return r.t(null,void 0,i(40544))},offset:0},{id:"America/Phoenix",get title(){return r.t(null,void 0,i(14055))},offset:0},{id:"America/Santiago",get title(){return r.t(null,void 0,i(30231))},offset:0},{id:"America/Sao_Paulo",get title(){return r.t(null,void 0,i(91912))},offset:0},{id:"America/Toronto",get title(){return r.t(null,void 0,i(10095))},offset:0},{id:"America/Vancouver",get title(){return r.t(null,void 0,i(32838))},offset:0},{id:"US/Mountain",get title(){return r.t(null,void 0,i(27358))},offset:0},{id:"Asia/Almaty",get title(){return r.t(null,void 0,i(98128))},offset:0},{id:"Asia/Ashkhabad",get title(){return r.t(null,void 0,i(63627))},offset:0},{id:"Asia/Bahrain",get title(){return r.t(null,void 0,i(90594))},offset:0},{id:"Asia/Bangkok",get title(){return r.t(null,void 0,i(47045))},offset:0},{id:"Asia/Chongqing",get title(){return r.t(null,void 0,i(50349))},offset:0},{id:"Asia/Colombo",get title(){return r.t(null,void 0,i(10871))},offset:0},{id:"Asia/Dhaka",get title(){
return r.t(null,void 0,i(24959))},offset:0},{id:"Asia/Dubai",get title(){return r.t(null,void 0,i(23650))},offset:0},{id:"Asia/Ho_Chi_Minh",get title(){return r.t(null,void 0,i(34491))},offset:0},{id:"Asia/Hong_Kong",get title(){return r.t(null,void 0,i(48861))},offset:0},{id:"Asia/Jakarta",get title(){return r.t(null,void 0,i(14995))},offset:0},{id:"Asia/Jerusalem",get title(){return r.t(null,void 0,i(36057))},offset:0},{id:"Asia/Karachi",get title(){return r.t(null,void 0,i(70913))},offset:0},{id:"Asia/Kathmandu",get title(){return r.t(null,void 0,i(54533))},offset:0},{id:"Asia/Kolkata",get title(){return r.t(null,void 0,i(31561))},offset:0},{id:"Asia/Kuala_Lumpur",get title(){return r.t(null,void 0,i(38561))},offset:0},{id:"Asia/Kuwait",get title(){return r.t(null,void 0,i(76614))},offset:0},{id:"Asia/Manila",get title(){return r.t(null,void 0,i(48991))},offset:0},{id:"Asia/Muscat",get title(){return r.t(null,void 0,i(9865))},offset:0},{id:"Asia/Nicosia",get title(){return r.t(null,void 0,i(94600))},offset:0},{id:"Asia/Qatar",get title(){return r.t(null,void 0,i(28756))},offset:0},{id:"Asia/Riyadh",get title(){return r.t(null,void 0,i(37974))},offset:0},{id:"Asia/Seoul",get title(){return r.t(null,void 0,i(26820))},offset:0},{id:"Asia/Shanghai",get title(){return r.t(null,void 0,i(1852))},offset:0},{id:"Asia/Singapore",get title(){return r.t(null,void 0,i(77377))},offset:0},{id:"Asia/Taipei",get title(){return r.t(null,void 0,i(11034))},offset:0},{id:"Asia/Tehran",get title(){return r.t(null,void 0,i(6686))},offset:0},{id:"Asia/Tokyo",get title(){return r.t(null,void 0,i(69122))},offset:0},{id:"Asia/Yangon",get title(){return r.t(null,void 0,i(53168))},offset:0},{id:"Atlantic/Reykjavik",get title(){return r.t(null,void 0,i(13386))},offset:0},{id:"Australia/Adelaide",get title(){return r.t(null,void 0,i(426))},offset:0},{id:"Australia/Brisbane",get title(){return r.t(null,void 0,i(79336))},offset:0},{id:"Australia/Perth",get title(){return r.t(null,void 0,i(24436))},offset:0},{id:"Australia/Sydney",get title(){return r.t(null,void 0,i(31622))},offset:0},{id:"Europe/Amsterdam",get title(){return r.t(null,void 0,i(36485))},offset:0},{id:"Europe/Athens",get title(){return r.t(null,void 0,i(73702))},offset:0},{id:"Europe/Belgrade",get title(){return r.t(null,void 0,i(71797))},offset:0},{id:"Europe/Berlin",get title(){return r.t(null,void 0,i(64313))},offset:0},{id:"Europe/Bratislava",get title(){return r.t(null,void 0,i(70876))},offset:0},{id:"Europe/Brussels",get title(){return r.t(null,void 0,i(91499))},offset:0},{id:"Europe/Bucharest",get title(){return r.t(null,void 0,i(33672))},offset:0},{id:"Europe/Budapest",get title(){return r.t(null,void 0,i(20313))},offset:0},{id:"Europe/Copenhagen",get title(){return r.t(null,void 0,i(38917))},offset:0},{id:"Europe/Dublin",get title(){return r.t(null,void 0,i(79716))},offset:0},{id:"Europe/Helsinki",get title(){return r.t(null,void 0,i(48203))},offset:0},{id:"Europe/Istanbul",get title(){return r.t(null,void 0,i(78326))},offset:0},{id:"Europe/Lisbon",get title(){
return r.t(null,void 0,i(53375))},offset:0},{id:"Europe/London",get title(){return r.t(null,void 0,i(19439))},offset:0},{id:"Europe/Luxembourg",get title(){return r.t(null,void 0,i(81038))},offset:0},{id:"Europe/Madrid",get title(){return r.t(null,void 0,i(52066))},offset:0},{id:"Europe/Malta",get title(){return r.t(null,void 0,i(38365))},offset:0},{id:"Europe/Moscow",get title(){return r.t(null,void 0,i(64039))},offset:0},{id:"Europe/Oslo",get title(){return r.t(null,void 0,i(75722))},offset:0},{id:"Europe/Paris",get title(){return r.t(null,void 0,i(61879))},offset:0},{id:"Europe/Prague",get title(){return r.t(null,void 0,i(81248))},offset:0},{id:"Europe/Riga",get title(){return r.t(null,void 0,i(94022))},offset:0},{id:"Europe/Rome",get title(){return r.t(null,void 0,i(52961))},offset:0},{id:"Europe/Stockholm",get title(){return r.t(null,void 0,i(86716))},offset:0},{id:"Europe/Tallinn",get title(){return r.t(null,void 0,i(79995))},offset:0},{id:"Europe/Vienna",get title(){return r.t(null,void 0,i(23160))},offset:0},{id:"Europe/Vilnius",get title(){return r.t(null,void 0,i(60534))},offset:0},{id:"Europe/Warsaw",get title(){return r.t(null,void 0,i(5959))},offset:0},{id:"Europe/Zurich",get title(){return r.t(null,void 0,i(62859))},offset:0},{id:"Pacific/Auckland",get title(){return r.t(null,void 0,i(66103))},offset:0},{id:"Pacific/Chatham",get title(){return r.t(null,void 0,i(36549))},offset:0},{id:"Pacific/Fakaofo",get title(){return r.t(null,void 0,i(98549))},offset:0},{id:"Pacific/Honolulu",get title(){return r.t(null,void 0,i(79668))},offset:0},{id:"Pacific/Norfolk",get title(){return r.t(null,void 0,i(67891))},offset:0}];function a(e,t,i){const r=function(e){return e.map((e=>{const{id:t}=e,{string:i,offset:r}=(0,s.parseTzOffset)(t);return{id:t,offset:r,get title(){return`(${i}) ${e.title}`}}}))}(e),n=i.filter((({alias:e})=>Boolean(e))).map((e=>{const{alias:t,id:i}=e,{string:r,offset:n}=(0,s.parseTzOffset)(t);return{id:i,offset:n,get title(){return`(${r}) ${e.title}`},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)}))}(r.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,s.parseTzOffset)(e).string})`}for(const{id:t,title:i}of l)if(t===e)return`${i}`;return e}},52033:(e,t,i)=>{"use strict";i.d(t,{Delegate:()=>n});const s=(0,i(12168).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<this._listeners.length;++i){const s=this._listeners[i];if(s.object===e&&s.member===t){s.skip=!0,this._listeners.splice(i,1);break}}}unsubscribeAll(e){
for(let t=this._listeners.length-1;t>=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<i;++r){const i=t[r];if(!i.skip)try{i.member.apply(i.object||null,e)}catch(e){s.logError(`${e&&(e.stack||e.message)}`)}}}}},82236:(e,t,i)=>{"use strict";i.d(t,{formatStudyError:()=>n,triesTranslateError:()=>r});var s=i(11542);function r(e){return o.get(e)||e}function n(e){return e.format({boldHighlightStart:"<b>",boldHighlightEnd:"</b>"})}const o=new Map([["You cannot see this pivot timeframe on this resolution",s.t(null,void 0,i(25059))],["The data vendor doesn't provide volume data for this symbol.",s.t(null,void 0,i(81657))],['Histogram is too large, please increase "Row Size" input.',s.t(null,void 0,i(72819))],["Histogram is too large, please reduce 'Row Size' input.",s.t(null,void 0,i(66751))],['Histogram is too large, please increase "Ticks Per Row" input.',s.t(null,void 0,i(94966))],["This script is invite-only. To request access, please contact its author.",s.t(null,void 0,i(76989))],["Volume Profile indicator available only on our upgraded plans.",s.t(null,void 0,i(39903))],["VOLUME_BIST_MIXED",s.t(null,void 0,i(69156))],["Runtime error",s.t(null,void 0,i(60630))],["Access error",s.t(null,void 0,i(77401))],["User-defined error",s.t(null,void 0,i(8580))],["Compilation error",s.t(null,void 0,i(12086))]])},19938:(e,t,i)=>{"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}},34776:(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})},12168:(e,t,i)=>{"use strict";i.d(t,{LOGLEVEL:()=>n,getLogHistory:()=>b,getLogLevel:()=>g,getLogger:()=>C,getRawLogHistory:()=>y,isHighRateEnabled:()=>f,loggingOff:()=>T,loggingOn:()=>x,serializeLogHistoryEntry:()=>S,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 y(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 S(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)}(y(e,t).map(S),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")},9859:(e,t,i)=>{"use strict";function s(e,t,i){return Math.min(Math.max(e,t),i)}function r(e){return e<0?-1:e>0?1:0}function n(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 o(e,t,i){return t-e<=i}function a(e,t,i){return Math.abs(e-t)<i}function l(e){return e<=0?NaN:Math.log(e)/Math.log(10)}function c(e,t){return e<t?-1:e>t?1:0}function h(e,t=c){if(e.length<1)throw Error("array is empty");let i=e[0];for(let s=0;s<e.length;++s)t(e[s],i)>0&&(i=e[s]);return i}function d(e){const t=Math.ceil(e);return t%2!=0?t-1:t}function u(e){return e>0?Math.floor(e):Math.ceil(e)}i.d(t,{ceiledEven:()=>d,clamp:()=>s,equal:()=>a,greaterOrEqual:()=>o,isBaseDecimal:()=>n,log10:()=>l,max:()=>h,sign:()=>r,toInt:()=>u})},82112:(e,t,i)=>{"use strict";i.d(t,{parseTzOffset:()=>r});var s=i(2740);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}}},78954:(e,t,i)=>{"use strict";function s(e){return e.includes(":")?e.split(":"):["",e]}i.d(t,{splitSymbolName:()=>s})},4362:(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})},13665:(e,t,i)=>{"use strict";var s=i(56570),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:S},{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:y},{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 y(){g.apply(this,arguments)}function S(){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(y,g),y.prototype.isIncomplete=!0,y.prototype.incompleteSuggest=function(){if("'"!==this.value)return String("'")},t(S,f),S.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;i<e.length;i++)e[i]instanceof n||t.push(e[i]);return t}function P(e){e=C(e);for(var t,i=[],s=[],r=0;r<e.length;r++){var n=e[r];if(n instanceof l)s.length&&s[s.length-1].minPrecedence>n.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.precedence<t.minPrecedence||c.precedence===t.minPrecedence&&c.commutative)||(i.unshift(t.openBraceIndex),i.push(r),s.length&&s[s.length-1].minPrecedence>t.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<e.length;d++){if(!((p=e[d])instanceof n)){if(delete c.isEmpty,p.isIncomplete){var u={status:"incomplete",reason:"incomplete_token",offset:p._offset,token:p};if(p.incompleteSuggest&&(u.recover={
append:p.incompleteSuggest()}),c.warnings.push(u),d!==e.length-1){u.status="error";continue}}if(p instanceof g||p instanceof f){if(r===i){c.errors.push({status:"error",reason:"unexpected_token",offset:p._offset,token:p});continue}r=i}else if(p instanceof l){if(r!==i){c.errors.push({status:"error",reason:"unexpected_token",offset:p._offset,token:p});continue}r="operator"}else if(p instanceof o){if(r===i){c.errors.push({status:"error",reason:"unexpected_token",offset:p._offset,token:p});continue}h.push(p),r=t}else if(p instanceof a){if(r!==i){c.errors.push({status:"error",reason:"unexpected_token",offset:p._offset,token:p});continue}h.pop()||c.errors.push({status:"error",reason:"unbalanced_brace",offset:p._offset,token:p,recover:{prepend:new o}}),r=i}else p instanceof v&&c.errors.push({status:"error",reason:"unparsed_entity",offset:p._offset,token:p})}}for(c.braceBalance=h.length,r!==i&&c.warnings.push({status:"incomplete"});h.length;){var p;u={status:"incomplete",reason:"unbalanced_brace",offset:(p=h.pop())._offset,token:p};r===i&&(u.recover={append:new a}),c.warnings.push(u)}return c.currentState=r,0===c.warnings.length&&delete c.warnings,0===c.errors.length&&delete c.errors,c},factorOutBraces:P,normalizeTokens:function(e){for(var t=0;t<e.length;t++)e[t].parse&&e[t].parse();return e},flip:function(e){var t=function(e){for(var t,i=0,s=1,r=2,c=3,h=i,d=0,p=0;p<e.length;p++){var _=e[p];if(!(_ instanceof n))switch(h){case i:if(!(_ instanceof f&&1==+_.value))return!1;h=s;break;case s:if(!(h===s&&_ instanceof u))return!1;h=r,t=p+1;break;case r:if(_ instanceof o)h=c,d=1;else if(_ instanceof l)return!1;break;case c:_ instanceof o?d++:_ instanceof a&&--d<=0&&(h=r)}}return e.slice(t)}(e);return P(t||[new f("1"),new u,new o].concat(e).concat(new a))},hasBatsSymbols:function(e){return I(e,["BATS"])},hasEodSymbols:function(e){return(e=T(e))&&-1!==e.toUpperCase().indexOf("_EOD")},hasChxjpySymbols:function(e){return I(e,["CHXJPY"])},hasFreeDelaySymbols:function(e){return I(e,pro.getProductsByType(pro.PRODUCT_TYPES.exchange).map((function(e){return e.exchange.toUpperCase()+"_DLY"})))},getExchange:T,getExchanges:x,isExchange:function(e,t){return!!(e=T(e))&&e.substring(0,t.length)===t},SymbolToken:g,IncompleteSymbolToken:y,NumberToken:f,BinaryOperatorToken:l,OpenBraceToken:o,CloseBraceToken:a,ticker:function(e){return new g(e).ticker()},shortName:function(e){if("string"!=typeof e)throw new TypeError("expression must be a string");var t=P(C(w(e)));return t.forEach((function(e){e instanceof g&&e.exchange(null)})),M(t)},normalize:function(e){if("string"!=typeof e)throw new TypeError("expression must be a string");return M(P(C(w(e))))}}}();e.exports=n},45126:(e,t,i)=>{"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)}}},23998: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,-715816800,-702511200,-684367200,-671061600,-652917600,-634168800,-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,1709251200,192501e4],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,18e3]},"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/Kuala_Lumpur":{time:[-2177452800,-2038176e3,-1167609600,-1073001600,-894153600,-879638400,-766972800,378689400,1925020800],offset:[24406,24925,25200,26400,26400,27e3,32400,27e3,28800]},"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,-457743600,-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]}}},1640:(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._major<e._major?-1:this._major>e._major?1:this._minor<e._minor?-1:this._minor>e._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)},64147:(e,t,i)=>{"use strict";i.d(t,{WatchedValue:()=>o});var s=i(34776);const r=(0,i(12168).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;t<r.length;t++){r[t].once&&(i._listeners.splice(t-o,1),o++);try{r[t].cb(e)}catch(e){n(e)}}}deleteValue(){this.setValue(void 0)}subscribe(e,t){if("function"!=typeof e)throw new TypeError("callback must be a function");const i=!!t&&!!t.once,s=!!t&&!!t.callWithLast,r=this._owner?this._owner:this;if(s&&r.hasOwnProperty("_value")){try{e(r._value)}catch(e){n(e)}if(i)return}r._listeners.push({cb:e,owner:this,once:!!t&&!!t.once})}unsubscribe(e){const t=this._owner?this._owner:this;void 0===e&&(e=null);const i=t._listeners;for(let s=i.length;s--;)i[s].owner!==this&&t!==this||i[s].cb!==e&&null!==e||i.splice(s,1)}readonly(){if(this._readonlyInstance)return this._readonlyInstance;const e={subscribe:this.subscribe.bind(this),unsubscribe:this.unsubscribe.bind(this),value:this.value.bind(this),when:this.when.bind(this),ownership:this.ownership.bind(this),spawnOwnership:this.spawnOwnership.bind(this),weakReference:this.weakReference.bind(this),spawn:e=>this.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()}}},91676:(e,t,i)=>{"use strict";i.d(t,{WatchedObject:()=>o});var s=i(64147),r=i(37265);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){(t||!1===this._comparator(this.value(),e))&&super.setValue(e,t)}}},35474:(e,t,i)=>{"use strict";i.d(t,{AriaChartDescription:()=>l});var s=i(68805),r=i(68993),n=i(56570),o=i(72280),a=i(85049);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<a.low.low&&(a.low=e);return a}(e.visibleData)}catch(e){return e instanceof Error&&console.warn("Unable to generate chart description. "+e.message),""}const i=`The first price is ${e.priceFormatter.format(t.start.open)} at ${(0,o.formatDate)(t.start.time)}.`,s=`The last price is ${e.priceFormatter.format(t.close.close)} at ${(0,o.formatDate)(t.close.time)}.`,r=t.close.close-t.start.open,a=r/t.start.open*100,l=`The actual change in price was ${e.priceFormatter.format(r)}, corresponding to a percentage change of ${a.toFixed(2)}%.`;let h="";t.low.time!==t.start.time&&t.low.time!==t.close.time&&(h+=`The lowest price was ${e.priceFormatter.format(t.low.low)} at ${(0,o.formatDate)(t.low.time)}.`);t.high.time!==t.start.time&&t.high.time!==t.close.time&&(h+=` The highest price was ${e.priceFormatter.format(t.high.high)} at ${(0,o.formatDate)(t.high.time)}.`);return`${i} ${s} ${l} ${h}`.trim()}(e);return`${function(e){var t;const i=null!==(t=e.description)&&void 0!==t?t:e.symbol,s=e.chartTypeName;return`${function(e){if(e.chartCount<=1)return"";return`Chart ${e.chartIndex+1} of ${e.chartCount}. `}(e)}${s} chart of ${i}`}(e)}. ${t}`}(a);this._setChartDescription(l)}static getInstance(){return null===this._instance&&(this._instance=new l),this._instance}async _getExportData(e,t){return(await i.e(9498).then(i.bind(i,99992))).exportData(e,t)}async _getData(e,t,i){const s=e.model().model();return await this._getExportData(s,{from:t,to:i,includeTime:!0,includeUserTime:!0})}_setChartDescription(e){if(!this._ariaElement)return;let t=e;e===this._lastDescription&&(t+="."),this._ariaElement.textContent=t,this._lastDescription=t}async _buildChartContext(e,t,i){const r=e.model().mainSeries().properties().childs().style.value(),o=r,l=(0,
s.getTranslatedChartStyleName)(r),c=e.model().mainSeries().symbolInfo(),h=e.model().timeScale(),d=h.visibleBarsStrictRange();if(!d)return null;const u=d.firstBar(),p=Math.min(d.lastBar(),h.baseIndex()),_=h.indexToTimePoint(u),m=h.indexToTimePoint(p);if(!_||!m)return null;let g;n.enabled("aria_detailed_chart_descriptions")&&(g=await this._getData(e,_,m));const f=e.model().mainSeries().interval(),v=a.Interval.parse(f).isIntraday();return{chartType:o,chartTypeName:l,symbol:e.model().mainSeries().symbol(),description:null==c?void 0:c.description,symbolInfo:c,exchange:null==c?void 0:c.exchange,ticker:null==c?void 0:c.ticker,visibleData:g,visibleRange:{from:_,to:m},chartCount:i,chartIndex:t,priceFormatter:e.model().mainSeries().formatter(),interval:f,isIntraday:v}}}function c(e,t,i){const s=e.schema.findIndex(t);return s>=0?s:i}l._instance=null},79612:(e,t,i)=>{"use strict";i.d(t,{AriaCrosshairPriceDescription:()=>r});var s=i(72280);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._nextAnnouncementTime?this._timeoutId=setTimeout((()=>{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},72280:(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})},7047:(e,t,i)=>{"use strict";i.d(t,{MouseClickAutoBlurHandler:()=>o,initMouseClickAutoBlurHandler:()=>a});var s=i(95171),r=i(76460);const n="data-mouse-click-auto-blur";class o{constructor(){this._handler=e=>{document.activeElement instanceof HTMLElement&&((0,r.isKeyboardClick)(e)||e.target instanceof Element&&"INPUT"!==document.activeElement.tagName&&null!==document.activeElement.closest(`[${n}]`)&&document.activeElement.blur())},window.addEventListener("click",this._handler,!0)}static attributes(e=!0){return e?{[n]:!0}:{}}}const a=(0,s.default)((()=>new o))},19291:(e,t,i)=>{"use strict";i.d(t,{
createScopedVisibleElementFilter:()=>h,getActiveElementSelectors:()=>d,mapKeyCodeToDirection:()=>c,navigationOrderComparator:()=>n,queryFocusableElements:()=>a,queryTabbableElements:()=>o,updateTabIndexes:()=>l});var s,r=i(63273);function n(e,t){return e===t?0:e.compareDocumentPosition(t)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1}function o(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(h(e))}function a(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(h(e))}function l(){window.dispatchEvent(new CustomEvent("keyboard-navigation-activation",{bubbles:!0}))}function c(e){const t=(0,r.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}}function h(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 d(){return['button:not([disabled]):not([aria-disabled]):not([tabindex="-1"])','input:not([disabled]):not([aria-disabled]):not([tabindex="-1"])','select:not([disabled]):not([aria-disabled]):not([tabindex="-1"])','textarea:not([disabled]):not([aria-disabled]):not([tabindex="-1"])','[tabindex]:not([disabled]):not([aria-disabled]):not([tabindex="-1"])'].join(", ")}!function(e){e.BlockPrev="blockPrev",e.BlockNext="blockNext",e.InlinePrev="inlinePrev",e.InlineNext="inlineNext"}(s||(s={}))},27235:(e,t,i)=>{"use strict";i.d(t,{TOOLBAR_WIDTH_COLLAPSED:()=>r,TOOLBAR_WIDTH_EXPANDED:()=>s});const s=52,r=5},6307:(e,t,i)=>{"use strict";i.d(t,{isDrawingToolbarVisible:()=>l});var s=i(56840),r=i(56570),n=i(64147);const o=!r.enabled("hide_left_toolbar_by_default"),a=s.getBool("ChartDrawingToolbarWidget.visible",o),l=new n.WatchedValue(a)},72894:(e,t,i)=>{"use strict";i.d(t,{HEADER_TOOLBAR_HEIGHT_COLLAPSED:()=>n,HEADER_TOOLBAR_HEIGHT_EXPANDED:()=>r});var s=i(76384);const r=parseInt(s["css-value-header-toolbar-height"]),n=3},27514:(e,t,i)=>{"use strict";i.d(t,{shouldShowQuickSearchOnLib:()=>o});var s=i(49483),r=i(84015),n=i(56570);function o(){return!s.CheckMobile.any()&&!(0,r.isOnMobileAppPage)("any")&&!n.enabled("widget")&&n.enabled("header_quick_search")}},33388:(e,t,i)=>{"use strict";var s;i.d(t,{ACTION_ID:()=>s}),function(e){e.UnknownAction="UnknownAction",e.ChartChangeTimeZone="Chart.ChangeTimeZone",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.Loading="Loading"}(s||(s={}))},81199:(e,t,i)=>{
"use strict";i.d(t,{ActionWithStandardIcon:()=>n});var s=i(97702),r=i(67375);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)}}},97702:(e,t,i)=>{"use strict";i.r(t),i.d(t,{Action:()=>l,ActionSize:()=>s,Loader:()=>h,Separator:()=>c});var s,r=i(50151),n=i(52033),o=i(68335),a=i(92184);!function(e){e.Normal="normal",e.Big="big"}(s||(s={}));class l{constructor(e){this.type="action",this._destroyed=!1,this._loadOptionsPromise=null,this._customAction=null;const{actionId:t,options:i,optionsLoader:s,customActionOptions:o,customActionOptionsLoader:c,id:h=a.guid()}=e;(0,r.assert)(void 0!==t,"actionId must be defined"),this.id=h,this._onUpdate=new n.Delegate,this._options={actionId:t,...i},this.update(i),this._loadOptionsGetter=null!=s?s:null,this._loadOptionsGetter&&(this._options.loading=!0),o&&(this._customAction=new l({actionId:t,options:o,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,o.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}}destroy(){var e,t,i;this._destroyed=!0,
this._onUpdate.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 c{constructor(e){this.type="separator",this.id=a.guid(),this._hint=e}getHint(){return this._hint}}class h extends l{constructor(e){super({actionId:e,options:{}})}isLoading(){return!0}getSize(){return"big"}}},67375:(e,t,i)=>{"use strict";i.d(t,{icons:()=>v});var s,r=i(34369),n=i(39267),o=i(93544),a=i(84959),l=i(37924),c=i(77067),h=i(16911),d=i(25191),u=i(54190),p=i(6862),_=i(97874),m=i(2872),g=i(1457),f=i(93379);!function(e){e.ChartShowDataWindow="Chart.ShowDataWindow",e.ChartReset="Chart.Reset",e.PlatformColorTheme="Platform.ColorTheme",e.ChartRemoveSelectedObject="Chart.RemoveSelectedObject",e.Settings="Settings",e.ChartHide="Chart.Hide",e.ChartSymbolInfo="Chart.SymbolInfo",e.ChartFinancials="Chart.Financials",e.AlertAdd="Alert.Add",e.AlertEdit="Alert.Edit",e.AlertRestart="Alert.Restart",e.AlertStop="Alert.Stop",e.AlertEventsExport="Alert.EventsExport",e.ClearAll="Alert.Clear",e.ChartVisualOrder="Chart.VisualOrder",e.ChartShowObject="Chart.ShowObject",e.ChartPriceScale="Chart.PriceScale",e.ChartMove="Chart.Move",e.ChartApplyIndicator="Chart.ApplyIndicator",e.ChartUnlockObject="Chart.UnlockObject",e.ChartLockObject="Chart.LockObject",e.ChartClone="Chart.Clone",e.ChartAddHorzLine="Chart.AddHorzLine",e.WatchlistAddSymbol="Watchlist.AddSymbol",e.WatchlistCreateNew="Watchlist.CreateNew",e.TextNoteAdd="TextNote.Add",e.TradingSell="Trading.Sell",e.TradingBuy="Trading.Buy",e.ObjectsTreeCreateGroup="ObjectsTree.CreateGroup",e.ObjectsTreeRenameItem="ObjectsTree.RenameItem"}(s||(s={}));const v=new Map([["Chart.Reset",n],["Chart.RemoveSelectedObject",o],["Settings",r],["Chart.Hide",a],["Chart.SymbolInfo",l],["Chart.VisualOrder",c],["Chart.ShowObject",h],["Chart.PriceScale",d],["Chart.Move",u],["Chart.ApplyIndicator",p],["Chart.UnlockObject",_],["Chart.LockObject",m],["Chart.Clone",g],["Chart.AddHorzLine",f]])},51330:(e,t,i)=>{"use strict";i.d(t,{ActionsProvider:()=>tt,createActionCopyPrice:()=>Ze,createActionToggleVisibilityDataSources:()=>Qe,createChangeIntervalsVisibilitiesAction:()=>Ye,createLinesAction:()=>Xe,createPasteAction:()=>$e,createSyncDrawingActions:()=>Je,createVisualOrderAction:()=>Ke,defaultContextMenuOptions:()=>qe});var s,r=i(50151),n=i(31955),o=(i(60521),i(37265)),a=i(11542),l=i(56570),c=i(97702),h=i(96152),d=i(19466),u=i(72708),p=(i(26023),i(25149)),_=i(28388),m=i(68335),g=(i(25812),
i(85604)),f=i(80387),v=i(86920),y=i(630),S=i(60074),b=i(34585),w=i(45126),C=(i(928),i(85049)),P=i(85719),x=i(10892),T=i(93352),I=i(65383),M=i(12988);!function(e){e.Value="ChartEventsSource"}(s||(s={}));var A=i(300),L=i(81199);(0,n.getLogger)("Chart.ActionsProvider");const k=new w.TranslatedString("change visibility",a.t(null,void 0,i(1924))),D=new w.TranslatedString("pin to scale {label}",a.t(null,void 0,i(81566))),E=new w.TranslatedString("pin to right scale",a.t(null,void 0,i(7495))),V=new w.TranslatedString("pin to left scale",a.t(null,void 0,i(78690))),B=(new w.TranslatedString("change earnings visibility",a.t(null,void 0,i(6819))),new w.TranslatedString("change dividends visibility",a.t(null,void 0,i(53929))),new w.TranslatedString("change splits visibility",a.t(null,void 0,i(47474))),new w.TranslatedString("change continuous contract switch visibility",a.t(null,void 0,i(18867))),new w.TranslatedString("change futures contract expiration visibility",a.t(null,void 0,i(85532))),new w.TranslatedString("change latest news and Minds visibility",a.t(null,void 0,i(50243))),new w.TranslatedString("show all ideas",a.t(null,void 0,i(13336)))),R=new w.TranslatedString("show ideas of followed users",a.t(null,void 0,i(91395))),N=new w.TranslatedString("show my ideas only",a.t(null,void 0,i(57460))),O=(new w.TranslatedString("change events visibility on chart",a.t(null,void 0,i(6119))),new w.TranslatedString("add this symbol to entire layout",a.t(null,void 0,i(79290)))),F=new w.TranslatedString("add this indicator to entire layout",a.t(null,void 0,i(96677))),W=(new w.TranslatedString("add this strategy to entire layout",a.t(null,void 0,i(58156))),new w.TranslatedString("add this financial metric to entire layout",a.t(null,void 0,i(67608))),new w.TranslatedString("apply drawing template",a.t(null,void 0,i(89720))),new w.TranslatedString("lock objects",a.t(null,void 0,i(18942)))),H=new w.TranslatedString("unlock objects",a.t(null,void 0,i(23230))),z=new w.TranslatedString("change visibility at current interval and above",a.t(null,void 0,i(45800))),U=new w.TranslatedString("change visibility at current interval and below",a.t(null,void 0,i(75645))),j=new w.TranslatedString("change visibility at current interval",a.t(null,void 0,i(84331))),G=new w.TranslatedString("change visibility at all intervals",a.t(null,void 0,i(57916))),q=(a.t(null,void 0,i(66823)),(0,b.appendEllipsis)(a.t(null,void 0,i(264))),
a.t(null,void 0,i(98334))),$=a.t(null,void 0,i(27298)),K=a.t(null,void 0,i(3564)),Y=a.t(null,void 0,i(94559)),Z=a.t(null,void 0,i(2165)),X=a.t(null,void 0,i(16986)),J=a.t(null,void 0,i(12645)),Q=a.t(null,void 0,i(44579)),ee=a.t(null,void 0,i(29436)),te=a.t(null,void 0,i(81054)),ie=a.t(null,void 0,i(32538)),se=a.t(null,void 0,i(72046)),re=a.t(null,void 0,i(90095)),ne=a.t(null,void 0,i(14115)),oe=a.t(null,void 0,i(33110)),ae=a.t(null,void 0,i(28280)),le=a.t(null,void 0,i(76150)),ce=a.t(null,void 0,i(94210)),he=a.t(null,void 0,i(60035)),de=a.t(null,void 0,i(10761)),ue=a.t(null,void 0,i(11254)),pe=a.t(null,void 0,i(35049)),_e=a.t(null,void 0,i(19271)),me=a.t(null,void 0,i(15512)),ge=a.t(null,void 0,i(46545)),fe=a.t(null,void 0,i(52160)),ve=a.t(null,void 0,i(17293)),ye=a.t(null,void 0,i(21973)),Se=a.t(null,void 0,i(55481)),be=a.t(null,void 0,i(71179)),we=a.t(null,void 0,i(4077)),Ce=a.t(null,void 0,i(54853)),Pe=a.t(null,void 0,i(20177)),xe=a.t(null,void 0,i(494)),Te=a.t(null,void 0,i(60668)),Ie=a.t(null,void 0,i(58026)),Me=a.t(null,void 0,i(56982)),Ae=((0,b.appendEllipsis)(a.t(null,void 0,i(35088))),(0,b.appendEllipsis)(a.t(null,void 0,i(2439))),(0,b.appendEllipsis)(a.t(null,void 0,i(32514)))),Le=(a.t(null,void 0,i(78358)),(0,b.appendEllipsis)(a.t(null,void 0,i(76266))),a.t(null,void 0,i(49680))),ke=a.t(null,void 0,i(12537)),De=(a.t(null,void 0,i(93553)),a.t(null,void 0,i(74975))),Ee=a.t(null,void 0,i(99894)),Ve=a.t(null,void 0,i(5837)),Be=(a.t(null,void 0,i(37113)),a.t(null,void 0,i(29449)),a.t(null,void 0,i(50849)),a.t(null,void 0,i(33158)),a.t(null,void 0,i(81465)),a.t(null,void 0,i(68112)),a.t(null,void 0,i(55418))),Re=a.t(null,void 0,i(10261)),Ne=a.t(null,void 0,i(44020)),Oe=((0,b.appendEllipsis)(a.t(null,void 0,i(32514))),a.t(null,void 0,i(97878)),a.t(null,void 0,i(39010))),Fe=a.t(null,void 0,i(26090)),We=(a.t(null,void 0,i(95754)),a.t(null,void 0,i(35679)),a.t(null,void 0,i(9140)),a.t(null,void 0,i(46607)),a.t(null,void 0,i(39079)),(0,b.appendEllipsis)(a.t(null,void 0,i(75594)))),He=(0,b.appendEllipsis)(a.t(null,void 0,i(88853))),ze=a.t(null,void 0,i(35140)),Ue=a.t(null,void 0,i(63553)),je=a.t(null,void 0,i(92957)),Ge=a.t(null,void 0,i(58764)),qe=(a.t(null,void 0,i(10996)),a.t(null,void 0,i(3061)),{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 $e(e,t){return!t.isEmpty()&&l.enabled("datasource_copypaste")?new L.ActionWithStandardIcon({actionId:"Chart.Clipboard.PasteSource",options:{label:ze.trim(),shortcutHint:(0,m.humanReadableHash)(m.Modifiers.Mod+86),statName:"Paste",onExecute:()=>e.chartWidgetCollection().clipboard.uiRequestPaste(t)}}):null}function Ke(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:ye,statName:"SendToBack",disabled:!s.sendToBackEnabled,onExecute:()=>i.sendToBack(t)}}),new L.ActionWithStandardIcon({actionId:"Chart.Source.VisualOrder.BringForward",options:{label:Se,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 Ye(e,t){const i=e.model(),s=(e,s)=>{const r=C.Interval.parse(i.mainSeries().interval()),n=(0,x.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,(0,A.sourcesAffectState)(t))},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 Ze(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),c=a.format(o,{ignoreLocaleNumberFormat:!0});return new L.ActionWithStandardIcon({actionId:"Chart.Clipboard.CopyPrice",options:{label:`${Ue} ${l}`,statName:"CopyPrice",onExecute:()=>(0,T.getClipboard)().writeText(c)}})}function Xe(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 Je(e,t){return[]}function Qe(e,t){const i=t[0].properties().visible.value(),s=i?$:q,r=i?"Chart.Hide":"Chart.ShowObject",n=i?"Chart.SelectedObject.Hide":"Chart.SelectedObject.Show";return new L.ActionWithStandardIcon({actionId:n,options:{checkable:!0,statName:"ToggleVisibilitySelectedObject",label:s,iconId:r,onExecute:()=>{const s=e.model();s.withMacro(k,(()=>{t.forEach((e=>{s.setProperty(e.properties().visible,!i,k,P.lineToolsDoNotAffectChartInvalidation&&(0,y.isLineTool)(e))}))}))}}})}var et;!function(e){e.Copy="Copy"}(et||(et={}));class tt{constructor(e,t){this._chartWidget=e,this._options=(0,o.merge)((0,o.clone)(qe),t||{})}async contextMenuActionsForSources(e,t,i,s,r){const n=e[0],o=this._options,a=[];if(n===this._chartWidget.model().mainSeries()&&o.mainSeries)a.push(...await this._contextMenuActionsForSeries(n,i));else if((0,u.isStudy)(n)&&o.studies)a.push(...await this._contextMenuActionsForStudy(n,t,i));else if((0,y.isLineTool)(n)&&o.lineTools){const t=e.filter(y.isLineTool);a.push(...await this._contextMenuActionsForLineTool(t))}else 0;return a.length&&(null==r?void 0:r.length)&&a.push(new c.Separator),a.push(...null!=r?r:[]),a}_isReadOnly(){return this._chartWidget.readOnly()}_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,h.getPriceAxisNameInfo)(n,o).label,c=le.format({label:l}),d={"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:d,iconId:"Chart.PriceScale",subItems:this._createActionScaleItems(e)}})}_createActionResetInputPoints(e){const t=e.metaInfo(),s=t.inputs.filter(I.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 M.Property({inputs:n}),a=await Promise.all([i.e(4703),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(7399),i.e(2248),i.e(7125),i.e(8077),i.e(6625),i.e(5546),i.e(55),i.e(4392),i.e(3114),i.e(5666),i.e(3204),i.e(1729),i.e(9486),i.e(4959),i.e(6665),i.e(4447),i.e(8065),i.e(3645),i.e(1259),i.e(7902),i.e(6955),i.e(5622),i.e(2198),i.e(2227),i.e(3443),i.e(6014),i.e(2079),i.e(3098),i.e(2751),i.e(2264),i.e(7223),i.e(4774),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),d=l||c!==t;if(!d)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,h.getPriceAxisNameInfo)(t,_).label,f=p[t][m].format({label:g});return new L.ActionWithStandardIcon({actionId:"Chart.Source.ChangePriceScale",options:{checkable:!1,disabled:!d,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),d=this._createActionScaleDetachLeft(e),u=o.length+a.length+(null===l?0:1)+(null===d?0:1)>2,p={right:{hidden:{checked:{labelled:K,sided:Y},unchecked:{labelled:Z,sided:X}},visible:{checked:{labelled:J,sided:Q},unchecked:{labelled:ee,sided:te}}},left:{hidden:{checked:{labelled:K,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",d=p[i],u=(0,h.getPriceAxisNameInfo)(i,t).label;return{actionText:d[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!==d&&t.push(d);u&&(a.length>0||null!==d)&&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=this._chartWidget.model().model(),o=(0,r.ensureNotNull)(n.paneForSource(e)),a=this._chartWidget.actions(),h=t&&"localY"in t?t.localY:void 0;if(this._isReadOnly())s.push(Qe(this._chartWidget,[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(a.showSymbolInfoDialog);n.mainSeries().symbolInfo();if(s.length>0&&!(s[s.length-1]instanceof c.Separator)&&s.push(new c.Separator),!o.isEmpty()&&l.enabled("datasource_copypaste")){const e=Ze(o,h),t=$e(this._chartWidget,o);(e||t)&&(e&&s.push(e),t&&s.push(t),s.push(new c.Separator))}s.push(Ke(this._chartWidget,[e]));const t=this._createActionMove(e);null!==t&&s.push(t),s.push(this._createActionScale(e)),s.push(Qe(this._chartWidget,[e])),s.push(new c.Separator);Boolean(null===(i=window.widgetbar)||void 0===i?void 0:i.widget("watchlist"))&&a.addToWatchlist&&s.push(a.addToWatchlist),l.enabled("text_notes")&&s.push(a.addToTextNotes),s[s.length-1]instanceof c.Separator||s.push(new c.Separator),l.enabled("show_chart_property_page")&&!this._chartWidget.onWidget()&&s.push(a.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,f.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,i){const s=t!==this._chartWidget.model().paneForSource(e),r=this._chartWidget.actions(),n=(i&&"localY"in i&&i.localY,[]);if(!e.userEditEnabled())return n;if(this._chartWidget.readOnly())n.push(Qe(this._chartWidget,[e])),n.push(new c.Separator),(0,p.isNonSeriesStudy)(e)||n.push(this._createActionScale(e));else{0,l.enabled("study_on_study")&&e.canHaveChildren()&&n.push(this._createActionAddChildStudy(e));const t=this._createApplyToEntireLayoutCommand(e);null!==t&&n.push(t);const i=this._createAddIndicatorToFavoritesCommand(e);if(i&&n.push(i),n.length>0&&!(n[n.length-1]instanceof c.Separator)&&n.push(new c.Separator),l.enabled("symbol_info")&&(0,u.isCompareOrOverlayStudy)(e)&&null!==e.symbolInfo()&&(n.push(this._createActionShowSymbolInfoDialog(e,this._chartWidget.model().model().availableUnits())),n.push(new c.Separator)),s||n.push(Ke(this._chartWidget,[e])),n.push(Ye(this._chartWidget,[e])),!(0,p.isNonSeriesStudy)(e)&&!s){const t=this._createActionMove(e);null!==t&&n.push(t),n.push(this._createActionScale(e))}n.push(new c.Separator);const o=e.metaInfo();if(e.copiable()){const t=new L.ActionWithStandardIcon({actionId:"Chart.Clipboard.CopySource",options:{label:Le,shortcutHint:(0,m.humanReadableHash)(m.Modifiers.Mod+67),statName:"Copy",onExecute:()=>{
this._chartWidget.chartWidgetCollection().clipboard.uiRequestCopy([e])}}});n.push(t)}n.push(Qe(this._chartWidget,[e])),n.push(r.studyRemove);const a=this._options.objectTree&&r.paneObjectTree,h=!1;(a||h)&&(n.push(new c.Separator),a&&n.push(r.paneObjectTree),h&&n.push(this._chartWidget.actions().showDataWindow)),n.push(new c.Separator),l.enabled("property_pages")&&new _.MetaInfoHelper(o).hasUserEditableOptions()&&n.push(this._createActionShowProperties(e)),n[n.length-1]instanceof c.Separator&&n.pop()}return n}_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,P.lineToolsDoNotAffectChartInvalidation)}))}))}}}})}async _contextMenuActionsForLineTool(e){const t=[],i=this._chartWidget.actions(),s=(this._chartWidget.model().model(),()=>{t.push(Ke(this._chartWidget,e))}),r=()=>{t.push(Ye(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,m.humanReadableModifiers)(m.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,m.humanReadableHash)(m.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(d.TitleDisplayTarget.StatusLine)}),statName:"GoToLineTool",checkable:!1,onExecute:async()=>this._chartWidget.model().scrollToLineTool(e)}});t.push(i)},u=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(Qe(this._chartWidget,[d]));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&&t.push(new c.Separator),e=a(),e&&t.push(new c.Separator),t.push(this._createActionToggleLockLineTools([d])),t.push(Qe(this._chartWidget,[d])),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),u(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(Qe(this._chartWidget,e)),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 g.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,S.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,v.clipboardDataForSources)(t.id(),[e])),a=this._chartWidget.chartWidgetCollection(),c={isOnMainPane:s,asCompare:n,paneIndex:o};a.applyIndicatorToAllCharts(this._chartWidget,i,c,l)}},id:"applyStudyToEntireLayout"})}_createAddIndicatorToFavoritesCommand(e){const t=e.metaInfo();let s
;if(!l.enabled("items_favoriting"))return null;{const{description_localized:e,description:r}=t,n=e||a.t(r,{context:"study"},i(83477));s=()=>i.e(9790).then(i.bind(i,23390)).then((({isFavorite:e,toggleFavorite:t})=>({label:e(n)?Ge:je,onExecute:()=>t(n)})))}return new c.Action({actionId:"Chart.Indicator.AddFavorites",id:"addIndicatorToFavorites",optionsLoader:s,options:{statName:"AddIndicatorToFavorites"}})}}},31045:(e,t,i)=>{"use strict";i.d(t,{Animation:()=>o});var s=i(78871),r=i(61119);const n={duration:250,easing:s.easingFunc.easeOutCubic};class o{constructor(e){this._onFinishCalled=!1,this._options={...n,...e},this._startTime=performance.now()}getStartPosition(){return this._options.from}getPosition(e){const t=this._calculateProgress(e);return 1===t?(this._options.onFinish&&!this._onFinishCalled&&(this._options.onFinish(!0),this._onFinishCalled=!0),this._options.to):(0,r.lerp)(this._options.from,this._options.to,this._options.easing(t))}finished(e){return 1===this._calculateProgress(e)}onFinish(e){var t,i;this._onFinishCalled||(null===(i=(t=this._options).onFinish)||void 0===i||i.call(t,e),this._onFinishCalled=!0)}_calculateProgress(e){const t=e-this._startTime;return t>=this._options.duration?1:t/this._options.duration}}},4711:(e,t,i)=>{"use strict";i.r(t),i.d(t,{isSupportedLineTool:()=>s,supportedLineTools:()=>r});i(49483);function s(e){return e in 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"}}},86920:(e,t,i)=>{"use strict";i.d(t,{clipboardDataForSources:()=>l,isLineToolClipboardData:()=>a});var s=i(50151),r=i(19466),n=i(72708),o=i(630);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}},7114:(e,t,i)=>{"use strict";i.d(t,{addExclusionArea:()=>P,
addExclusionAreaByScope:()=>C,calcTextHorizontalShift:()=>b,clearRect:()=>_,createBoundCanvas:()=>y,createDisconnectedCanvas:()=>g,createDisconnectedCanvasByRenderingInfo:()=>f,disableSelection:()=>w,drawScaled:()=>m,drawWithExclusionAreaByScope:()=>x,fillRect:()=>p,getBindingRenderingInfo:()=>h,getContext2D:()=>d,getPrescaledContext2D:()=>u,measureText:()=>I,tryApplySuggestedCanvasBitmapSize:()=>S});var s=i(27714),r=i(50151),n=i(776),o=i(2844),a=i(63273),l=i(49483);function c(e){return{horizontalPixelRatio:Math.max(1,e.bitmapSize.width/e.canvasElementClientSize.width),verticalPixelRatio:Math.max(1,e.bitmapSize.height/e.canvasElementClientSize.height)}}function h(e){return{...c(e),bitmapSize:e.bitmapSize,mediaSize:e.canvasElementClientSize}}function d(e){const t=(0,r.ensureNotNull)(e.getContext("2d"));return t.setTransform(1,0,0,1,0,0),t}function u(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 p(e,t,i,s,r,n){e.save(),e.fillStyle=n,e.fillRect(t,i,s,r),e.restore()}function _(e,t,i,s,r,n){e.save(),e.globalCompositeOperation="copy",e.fillStyle=n,e.fillRect(t,i,s,r),e.restore()}function m(e,t,i,s){e.save(),e.scale(t,i),s(),e.restore()}function g(e,t,i){const s=v(e);return void 0===i&&(i=(0,n.getCanvasDevicePixelRatio)(s)),s.width=t.width*i,s.height=t.height*i,s}function f(e,t){const{bitmapSize:i,mediaSize:s}=t,r=v(e);return r.style.width=`${s.width}px`,r.style.height=`${s.height}px`,r.width=i.width,r.height=i.height,r}function v(e){const t=e.createElement("canvas");return w(t),t}function y(e,t){const i=v((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 S(e){const t=e.suggestedBitmapSize;return null!==t&&t.width>0&&t.height>0&&(e.applySuggestedBitmapSize(),!0)}function b(e,t){return"center"===e.textAlign?0:(0,a.isRtl)()?"start"===e.textAlign||"right"===e.textAlign?t:0:"start"===e.textAlign||"left"===e.textAlign?0:t}function w(e){e.style.userSelect="none",e.style.webkitUserSelect="none",e.style.msUserSelect="none",e.style.MozUserSelect="none",e.style.webkitTapHighlightColor="transparent"}function C(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<t.length;e++){let{x:n,y:o}=t[e];n*=s,o*=r,0!==e?i.lineTo(n,o):i.moveTo(n,o)}i.closePath(),i.clip("evenodd")}function P(e,t,i){C({context:e,...t},i)}function x(e,t,i){e.context.save(),C(e,t),i(),e.context.restore()}let T;function I(e,t,i){return T||function(){const e=document.createElement("canvas");e.width=0,e.height=0,(0,l.isMac)()&&(e.style.display="none",document.body.append(e)),T=(0,r.ensureNotNull)(e.getContext("2d")),T.textBaseline="alphabetic",T.textAlign="center"}(),T.font=t,i?i.getMetrics(T,e):(0,o.getMinTextMetrics)(T.measureText(e))}},97990:(e,t,i)=>{
"use strict";i.d(t,{ChartChangesWatcher:()=>o,changedAll:()=>n});var s,r=i(52033);!function(e){e[e.NothingChanged=0]="NothingChanged",e[e.ContentChanged=1]="ContentChanged",e[e.LineToolsChanged=2]="LineToolsChanged"}(s||(s={}));const n=3;class o{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 r.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){(null==e?void 0:e.affectsState())&&this._setUndoHistoryHasChanges(!0)}_handleChartMigrated(){this._setUndoHistoryHasChanges(!0)}_handleChartSaved(e){e&&this._setUndoHistoryHasChanges(!1,!0)}}},72522:(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(64147),h=i(28331)
;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().value()&&(e.defaultPrevented||(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}}},17730:(e,t,i)=>{"use strict";i.d(t,{getChartWidgetApiTimeConverter:()=>n});var s=i(50151),r=i(53388);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}}},4849:(e,t,i)=>{"use strict";i.d(t,{ChartWidgetBase:()=>tl});var s=i(27714),r=i(95171),n=i(50151),o=i(3343),a=i(11542),l=i(76422),c=i(49483),h=i(56840),d=i(85662),u=i(51768),p=i(4741),_=i(19063),m=i(31955),g=i(14426);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(58473),y=i(90995),S=i(29280);let b;class w extends S.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(3796),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(7399),i.e(2248),i.e(7769),i.e(7125),i.e(6625),i.e(5546),i.e(4392),i.e(4632),i.e(8432),i.e(3204),i.e(6107),i.e(1227),i.e(8316),i.e(6220),i.e(7530),i.e(7844),i.e(2227),i.e(3443),i.e(7746),i.e(6014),i.e(361),i.e(2079),i.e(3098),i.e(4862)]).then(i.bind(i,34489)).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,P=i(37265),x=i(65383),T=i(12988);async function I(e,t,s,r,n,o="default"){let l,c=[];const h=e.model().model(),d=(0,P.clone)(t),u=new T.Property({inputs:d}),p=function(e,t){return"symbol"===t?e.inputs.filter((t=>t.id===e.symbolInputId())):e.inputs.filter((e=>e.confirm))}(s,o),_=()=>{l&&h.removeCustomSource(l)},m=()=>{_(),n()},g=e=>{r({inputs:e,parentSources:c}),_()},f=p.filter(x.isTimeOrPriceNotHiddenInput);if(f.length>0)try{
const t=await Promise.all([i.e(4703),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(7399),i.e(2248),i.e(7125),i.e(8077),i.e(6625),i.e(5546),i.e(55),i.e(4392),i.e(3114),i.e(5666),i.e(3204),i.e(1729),i.e(9486),i.e(4959),i.e(6665),i.e(4447),i.e(8065),i.e(3645),i.e(1259),i.e(7902),i.e(6955),i.e(5622),i.e(2198),i.e(2227),i.e(3443),i.e(6014),i.e(2079),i.e(3098),i.e(2751),i.e(2264),i.e(7223),i.e(4774),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(4703),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(7399),i.e(2248),i.e(7125),i.e(8077),i.e(6625),i.e(5546),i.e(55),i.e(4392),i.e(3114),i.e(5666),i.e(3204),i.e(1729),i.e(9486),i.e(4959),i.e(6665),i.e(4447),i.e(8065),i.e(3645),i.e(1259),i.e(7902),i.e(6955),i.e(5622),i.e(2198),i.e(2227),i.e(3443),i.e(6014),i.e(2079),i.e(3098),i.e(2751),i.e(2264),i.e(7223),i.e(4774),i.e(3030)]).then(i.bind(i,29638)).then((t=>{const r=new t.ConfirmInputsDialogRenderer(function(e){if("symbol"===e)return a.t(null,void 0,i(46501));return a.t(null,void 0,i(48141))}(o),p,u,o,s,e.model(),g,m);return r.show(),r})):g(u.state().inputs||{})}!function(e){e.Default="default",e.Symbol="symbol"}(C||(C={}));let M=null;i(7727);var A=i(49481),L=i(58096);const k=(0,A.parseHtmlElement)(function(e=""){return`<div class="tv-spinner ${e}" role="progressbar"></div>`}());class D{constructor(e){this._shown=!1,this._el=k.cloneNode(!0),this.setSize(L.spinnerSizeMap[e||L.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 E=i(29981),V=i(88960),B=i(63950),R=i(52033),N=i(56570);function O(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function F(e){return e.reduce(((e,t)=>{for(const i in t)if(O(t,i)){const s=t[i],r=e[i];r?r.push(s):e[i]=[s]}return e}),{})}var W=i(45126),H=i(64147),z=i(7114),U=i(72522);const j=new W.TranslatedString("move left",a.t(null,void 0,i(79209))),G=new W.TranslatedString("move right",a.t(null,void 0,i(60114)));var q;!function(e){e[e.AccelerationPerMSecPixels=.003]="AccelerationPerMSecPixels",e[e.MaxSpeedPerMSecPixels=1.1]="MaxSpeedPerMSecPixels"}(q||(q={}));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){if(this._chartModel.timeScale().isEmpty())return;const t=.003,i=1.1,s=Math.round(i/t);this._moveImpl(e,((r,n,o)=>{const a=Math.min(n,s),l=e*t*Math.pow(a,2)/2;if(n<=s)return r+l;const c=Number.isFinite(o)?Math.max(0,s-o):0;return r+l+e*(n-a-c)*i+e*(i*c-t*Math.pow(c,2)/2)}),(e=>Math.max(0,s-e)+s))}}moveByBar(e){if(null!==this._chartModel){const t=this._chartModel.timeScale(),i=t.visibleBarsStrictRange();if(t.isEmpty()||null===i)return;const s=300,r=i.lastBar();this._moveImpl(e,((i,n)=>{const o=Math.floor(Math.max(0,n-s)/100)+1,a=r+e*o,l=t.indexToCoordinate(r);return i+(t.indexToCoordinate(a)-l)}),(()=>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?j:G,!1),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;this._animation={getStartPosition:()=>0,getPosition:e=>(e=Math.min(o,e),t(0,e-n,o-e)),finished:e=>e>=o,stop:()=>{const e=performance.now()-n;o=performance.now()+i(e)}},this._chartModel.model().stopTimeScaleAnimation(),this._chartModel.model().setTimeScaleAnimation(this._animation)}}var K=i(26023);function Y(e,t,s,r,n){return Promise.all([i.e(6150),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(7399),i.e(2248),i.e(7769),i.e(7125),i.e(8077),i.e(6625),i.e(5546),i.e(55),i.e(4392),i.e(3114),i.e(5666),i.e(8432),i.e(3204),i.e(1729),i.e(9486),i.e(4959),i.e(6665),i.e(4447),i.e(8065),i.e(3762),i.e(3645),i.e(1259),i.e(7902),i.e(6955),i.e(5622),i.e(2417),i.e(3925),i.e(889),i.e(61),i.e(71),i.e(9476),i.e(2227),i.e(3443),i.e(6014),i.e(2079),i.e(3098),i.e(2751),i.e(2264),i.e(7223),i.e(4774),i.e(6408),i.e(9370),i.e(6265)]).then(i.bind(i,81346)).then((i=>{const o=new(0,i.EditObjectDialogRenderer)(e,t,r,n);return o.show(s),o}))}var Z=i(72708);let X=null;var J=i(630);const Q={[K.TabNames.symbol]:"symbol",[K.TabNames.legend]:"legend",[K.TabNames.scales]:"scales",[K.TabNames.trading]:"trading",[K.TabNames.events]:"events",[K.TabNames.eventsAndAlerts]:"events",[K.TabNames.timezoneSessions]:"canvas",[K.TabNames.text]:"text",[K.TabNames.style]:"style",[K.TabNames.visibility]:"visibility"},ee={[K.TabNames.style]:"style",[K.TabNames.visibility]:"visibilities"};async function te(e,t,s={},r,n){const o=r.activeChartWidget.value(),{initialTab:a,tabName:l}=s;if(l&&!a&&(s.initialTab=ee[l]),(0,J.isStudyLineTool)(e)&&function(e){if(!(0,J.isStudyLineTool)(e))return!1;return["LineToolFixedRangeVolumeProfile","LineToolVbPFixed",null].filter(P.notNull).some((t=>e.toolname===t))
}(e))return o.propertiesDefinitionsForSource(e).then((i=>null!==i?Y(e,t,s,n,i):null));if((0,Z.isStudy)(e)&&function(e){const{shortId:t}=e.metaInfo();return"Overlay"===t}(e)||(0,J.isLineTool)(e))return o.propertiesDefinitionsForSource(e).then((r=>{if(null!==r){return function(e){return Promise.all([i.e(5757),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(7399),i.e(2248),i.e(7769),i.e(7125),i.e(8077),i.e(6625),i.e(5546),i.e(55),i.e(4392),i.e(3114),i.e(5666),i.e(8432),i.e(3204),i.e(1729),i.e(9486),i.e(4959),i.e(6665),i.e(4447),i.e(8065),i.e(3645),i.e(1259),i.e(7902),i.e(6955),i.e(5622),i.e(2417),i.e(3925),i.e(889),i.e(71),i.e(223),i.e(2227),i.e(3443),i.e(6014),i.e(2079),i.e(3098),i.e(2751),i.e(2264),i.e(7223),i.e(4774),i.e(6408),i.e(9370),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&&Q[l],shouldReturnFocus:s.shouldReturnFocus})}return null}));if((0,Z.isStudy)(e))return Y(e,t,s,n);{const e=l&&Q[l],t=r.getChartPropertiesDialogRenderer();return t.setActivePage(e),t.show(s)}}var ie=i(19625),se=i(45345),re=i(24633);async function ne(){return(await Promise.all([i.e(8077),i.e(4814),i.e(2227),i.e(139)]).then(i.bind(i,81200))).ErrorCardRenderer}var oe=i(82236),ae=i(68805),le=i(62825);const ce=(0,ie.getHexColorByName)("color-cold-gray-700"),he=(0,ie.getHexColorByName)("color-cold-gray-400"),de=(0,ie.getHexColorByName)("color-cold-gray-900"),ue=(0,ie.getHexColorByName)("color-white"),pe=a.t(null,void 0,i(18905));function _e(e){return e?{...e,message:(0,oe.formatStudyError)(e.message),rawHtml:!0}:null}class me{constructor(e){this._container=null,this._errorCardRenderer=null,this._mainSeriesErrorMessage=null,this._banErrorMessage=new H.WatchedValue(null).spawn(),this._errorMessageHandler=e=>{e=_e(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 ne())}_createErrorCardRendererState(e){return e?{message:e.message,icon:e.icon,textColor:se.watchedTheme.value()===re.StdTheme.Dark?he:ce,backgroundColor:se.watchedTheme.value()===re.StdTheme.Dark?de:ue,solutionId:e.solutionId,rawHtml:e.rawHtml,buttons:e.buttons}:{message:null}}_subscribeToMainSeriesErrors(){const e=this._chartWidget;e.withModel(this,(()=>{const t=e.model().model().mainSeries();this._mainSeriesErrorMessage=(0,V.combine)(((t,s)=>{if(t)return t;if(null===s)return null;switch(s.type){case"invalid_symbol":return{message:a.t(null,void 0,i(52969)),icon:"ghost"};case"calculations_error":return{message:s.errorMessage,icon:"attention"};case"no_data":return{message:a.t(null,void 0,i(36252)),icon:"ghost"};case"unsupported_resolution":return this._createErrorParamsForUnsupportedResolution(e)}}),this._banErrorMessage.weakReference(),(0,ae.getSeriesDisplayErrorWV)(t).ownership()),this._mainSeriesErrorMessage.subscribe(this._errorMessageHandler,{callWithLast:!0})}))}_createErrorParamsForUnsupportedResolution(e){const t=e.model(),i=t.mainSeries().unsupportedResolutionState().value();return null===i?null:{message:(0,le.getErrorFromUnsupportedResolutionState)(i,!0),icon:"unsupported-resolution",rawHtml:!0,maxHeight:400,zeroHeight:200,buttons:[{name:pe.format({resolution:i.applicableResolution}),onClick:()=>{t.setResolution(t.model().mainSeries(),i.applicableResolution)}}]}}_getErrorMessage(){var e;return _e(this._banErrorMessage.value()||(null===(e=this._mainSeriesErrorMessage)||void 0===e?void 0:e.value())||null)}}var ge,fe=i(776),ve=i(62288),ye=i(69186),Se=i(68993),be=i(46088),we=i(4340),Ce=i(5171),Pe=i(66316);class xe{constructor(e,t){this._showed=!1,this._cw=e,this._element=document.createElement("div"),this._element.classList.add(Pe.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(),t=e.dataEvents();t.symbolError().subscribe(this,(e=>{e!==we.permissionDenied&&this.hide()})),t.seriesError().subscribe(this,(()=>{(0,N.enabled)("hide_loading_screen_on_series_error")&&this.hide()})),e.statusWV().subscribe((e=>{(Ce.seriesReadyStatuses.has(e)||4===e||12===e||13===e||14===e)&&this.hide()}))}_show(){const e=this._cw.properties().childs().paneProperties.childs();let t;if(e.backgroundType.value()===be.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(Pe.fade)}_hide(){this._showed=!1,this._element.classList.remove(Pe.fade)}}function Te(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}}!function(e){e[e.MaxNextEventDelay=100]="MaxNextEventDelay",e[e.IgnoreSmallerDeltaCoeff=3]="IgnoreSmallerDeltaCoeff"}(ge||(ge={}));class Ie{constructor(){this._totalDeltaX=0,this._totalDeltaY=0,this._prevWheelTime=0}processWheel(e){e.timeStamp-this._prevWheelTime>100&&this._reset();const t=!(0,c.isMac)()&&e.shiftKey,i=t?-e.deltaY:e.deltaX,s=t?e.deltaX:e.deltaY;this._totalDeltaX+=i,this._totalDeltaY+=s,this._prevWheelTime=e.timeStamp;const r={deltaX:i,deltaY:s};return 0===this._totalDeltaX||0===this._totalDeltaY||(Math.abs(this._totalDeltaX)>=Math.abs(3*this._totalDeltaY)&&(r.deltaY=0),Math.abs(this._totalDeltaY)>=Math.abs(3*this._totalDeltaX)&&(r.deltaX=0)),Te(r,e)}_reset(){this._totalDeltaX=0,this._totalDeltaY=0}}var Me,Ae=i(24377),Le=i(9859),ke=i(35236),De=i(37702);!function(e){e[e.Height=1]="Height",e[e.MinPaneHeight=30]="MinPaneHeight"}(Me||(Me={}));class Ee{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(De.paneSeparator),this._element.style.background=this._color(),this.adjustSize(),this._element.addEventListener("click",(()=>{}));const s=document.createElement("div");s.classList.add(De.handle),this._element.appendChild(s),this._mouseEventHandler=new ke.MouseEventHandler(s,this,{treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!0}),this._handleEl=s,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=Ee.height()+"px"}mouseEnterEvent(e){const{topPane:t,bottomPane:i}=this._topBottomPane(!0);null!==t&&null!==i&&(0,n.ensureNotNull)(this._handleEl).classList.add(De.hovered)}mouseLeaveEvent(e){(0,n.ensureNotNull)(this._handleEl).classList.remove(De.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,z.createDisconnectedCanvas)(document,(0,s.size)({width:t,height:1})),a=(0,z.getPrescaledContext2D)(o);a.fillStyle=n,a.fillRect(0,0,t,1);const l=(0,z.createDisconnectedCanvas)(document,(0,s.size)({width:i,height:1})),c=(0,z.getPrescaledContext2D)(l);c.fillStyle=n,c.fillRect(0,0,i,1);const h=(0,z.createDisconnectedCanvas)(document,(0,s.size)({width:r,height:1})),d=(0,
z.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(),r=s/(t.height()+i.height()),o=30*r;s<=2*o||(this._resizeInfo={startY:e.pageY,prevStretchTopPane:t.state().stretchFactor(),maxPaneStretch:s-o,totalStretch:s,pixelStretchFactor:r,minPaneStretch:o},(0,n.ensureNotNull)(this._handleEl).classList.add(De.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,Le.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,n.ensureNotNull)(this._handleEl).classList.remove(De.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,Ae.parseRgba)(t),s=(0,Ae.parseRgba)(e),r=0===i[3]&&0===s[3]?"rgba(0,0,0,0)":(0,Ae.rgbaToString)((0,Ae.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<t.length;++i){const r=t[i];if(!e||!r.state().collapsed().value()){s=r;break}}return{topPane:i,bottomPane:s}}}var Ve,Be=i(16230);!function(e){e.Default="default",e.Success="success",e.Warning="warning",e.Danger="danger"}(Ve||(Ve={}));var Re,Ne,Oe=i(86441),Fe=i(31054),We=i(56468),He=i(91140),ze=i(28331),Ue=i(66666),je=i(928),Ge=i(81479),qe=i(37743),$e=i(68979),Ke=i(12027),Ye=i(2844),Ze=i(40443),Xe=i(94194),Je=i(15938),Qe=i(7983);!function(e){e[e.LabelRadius=9.5]="LabelRadius",e[e.LabelFontSize=11]="LabelFontSize"}(Re||(Re={})),function(e){e[e.Gear=0]="Gear",e[e.Symbol=1]="Symbol",e[e.Auto=2]="Auto"}(Ne||(Ne={}));const et=(0,$e.makeFont)(11,Je.CHART_FONT_FAMILY),tt={enableTooltip:!0,showLabels:!0,enableMenu:!0,enableHighlight:!0};function it(e,t){return Math.max(1,Math.floor(e.borderSize*t))}class st{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 R.Delegate,this._highlighted=!1,this._labelMode=2,this._fixedLabelMode=null,this._textWidthCache=new Ye.TextWidthCache(5),this._gearRenderer=(0,Ke.svgRenderer)(Qe),this._canvasConfiguredHandler=()=>{this.update(),this._textWidthCache.reset()},this._timeAxisWidget=o,this._isLeft="left"===e;const{rendererOptionsProvider:a,sourcesTitlesProvider:l,contextMenuItemsProvider:c,backgroundBasedTheme:h,onActiveOrHoveredChart:d=new H.WatchedValue(!1).ownership(),requestRepaint:u,getBackgroundTopColor:p,getBackgroundBottomColor:_,showHorizontalBorder:m}=r;this._rendererOptionsProvider=a,this._sourcesTitlesProvider=l,this._contextMenuItemsProvider=c,this._backgroundBasedTheme=h,this._onActiveOrHoveredChart=d,this._requestRepaint=u,this._getBackgroundTopColor=p,this._getBackgroundBottomColor=_,this._showHorizontalBorder=Boolean(m),this._properties=t,this._axisInfo=i,this._labelOptions={...tt,...n},this._properties.lineColor.subscribe(this,this._onPropertyChanged),this._cell=document.createElement("div"),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._labelOptions.enableTooltip&&(0,Xe.setTooltipData)(this._cell,"text",(e=>this._tooltipContent())),this._onActiveOrHoveredChart.subscribe(u)),this._mouseEventHandler=new ke.MouseEventHandler(this._cell,this,{treatHorzTouchDragAsPageScroll:!0,treatVertTouchDragAsPageScroll:!0}),this._canvasBinding=(0,z.createBoundCanvas)(this._cell,(0,s.size)({width:16,height:16})),this._canvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const g=this._canvasBinding.canvasElement;g.style.position="absolute",g.style.left="0",g.style.top="0",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(),this._backgroundBasedTheme.release(),this._onActiveOrHoveredChart.unsubscribe(this._requestRepaint),this._onActiveOrHoveredChart.release()}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){
e<ve.InvalidationLevel.Light&&!this._invalidated||0!==this._size.width&&0!==this._size.height&&(this._invalidated=!1,(0,z.tryApplySuggestedCanvasBitmapSize)(this._canvasBinding),this._paintImpl((0,z.getContext2D)(this._canvasBinding.canvasElement),(0,z.getBindingRenderingInfo)(this._canvasBinding)))}getWidth(){return this._size.width}getImage(){const e=(0,z.getBindingRenderingInfo)(this._canvasBinding),t=(0,z.createDisconnectedCanvasByRenderingInfo)(document,e);return this._paintImpl((0,z.getContext2D)(t),e,!0),t}setLabelMode(e){e!==this._labelMode&&(this._labelMode=e,this._cell.classList.toggle("apply-common-tooltip",1!==e&&this._labelOptions.enableTooltip))}_paintImpl(e,t,i){this._drawBackground(e,t),this._drawVerticalBorder(e,t),this._showHorizontalBorder&&this._drawHorizontalBorder(e,t),this._labelOptions.showLabels&&this._drawLabel(e,t,i)}_setHighlighted(e){this._labelOptions.enableHighlight&&(this._onLabelHovered.fire("stubButton",e),this._highlighted!==e&&(this._highlighted=e,this._invalidated=!0))}_onPropertyChanged(){this._invalidated=!0}_drawVerticalBorder(e,t){e.save(),e.fillStyle=this._vertBorderColor();const i=it(this._rendererOptionsProvider.options(),t.horizontalPixelRatio),s=this._isLeft?t.bitmapSize.width-i:0;e.fillRect(s,0,i,t.bitmapSize.height),e.restore()}_drawHorizontalBorder(e,t){e.save(),e.fillStyle=this._horzBorderColor();const i=it(this._rendererOptionsProvider.options(),t.verticalPixelRatio),s=this._isLeft?0:i;e.fillRect(s,0,t.bitmapSize.width-i,i),e.restore()}_drawBackground(e,t){const i=this._getBackgroundTopColor(),s=this._getBackgroundBottomColor(),{bitmapSize:r}=t;if(i===s?(0,z.clearRect)(e,0,0,r.width,r.height,i):(0,qe.clearRectWithGradient)(e,0,0,r.width,r.height,i,s),this._highlighted){const t=d.themes[this._backgroundBasedTheme.value()].getThemedColor("color-price-axis-highlight");(0,z.fillRect)(e,0,0,r.width,r.height,t),e.globalAlpha=1}}_drawLabel(e,t,i){const s=this._backgroundBasedTheme.value(),r=this._axisInfo;if(null===r||!i&&!this._onActiveOrHoveredChart.value())return;const{bitmapSize:n,horizontalPixelRatio:o,verticalPixelRatio:a}=t,l=it(this._rendererOptionsProvider.options(),o),c=Math.round(n.width)-l,h=it(this._rendererOptionsProvider.options(),a),u=Math.round(n.height)-h,p=(0,Oe.point)(l+c/2,h+u/2);if(1===this._labelMode||2===this._labelMode&&(!this._highlighted||i)){e.fillStyle=d.themes[s].getThemedColor("color-price-axis-label-back"),e.globalAlpha=.5,e.beginPath(),e.arc(p.x,p.y,9.5*o,0,2*Math.PI,!0),e.fill(),e.globalAlpha=1,e.fillStyle=d.themes[s].getThemedColor("color-price-axis-label-text"),e.font=et,e.textAlign="center",e.textBaseline="middle";const t=this._textWidthCache.yMidCorrection(e,r.label);(0,z.drawScaled)(e,o,a,(()=>{e.fillText(r.label,p.x/o,p.y/a+t)}))}else if(!i&&this._onActiveOrHoveredChart.value()){const t=this._gearRenderer.viewBox(),i=Math.round(p.x-t.width*o/2),r=Math.round(p.y-t.height*a/2);e.fillStyle=d.themes[s].getThemedColor("color-text-primary"),e.imageSmoothingQuality="high",this._gearRenderer.render(e,{targetViewBox:{x:i,y:r,width:t.width*o,
height:t.height*a},doNotApplyColors:!0})}}_vertBorderColor(){return this._properties.lineColor.value()}_horzBorderColor(){var e,t;return null!==(t=null===(e=this._timeAxisWidget)||void 0===e?void 0:e.lineColor())&&void 0!==t?t:this._vertBorderColor()}_tooltipContent(){return this._sourcesTitlesProvider().join("\n")}_mouseOrTouchEnterEvent(e){this._labelOptions.showLabels&&this._labelOptions.enableHighlight&&this._setHighlighted(!0)}_mouseOrTouchLeaveEvent(e){this._labelOptions.showLabels&&this._labelOptions.enableHighlight&&this._setHighlighted(!1)}_mouseClickOrTapEvent(e){if(e.preventDefault(),null!==this._fixedLabelMode||1===this._labelMode||!this._labelOptions.enableMenu||!this._labelOptions.showLabels)return void Ze.ContextMenuManager.hideAll();this._fixedLabelMode=this._labelMode,this.setLabelMode(0);const t=this._cell.getBoundingClientRect();Ze.ContextMenuManager.showMenu(this._contextMenuItemsProvider(),{clientX:this._isLeft?t.left:t.right,clientY:t.top,attachToXBy:this._isLeft?"left":"right",attachToYBy:"bottom"},{statName:"PriceScaleLabelContextMenu",doNotCloseOn:this.getElement()},{menuName:"PriceScaleLabelContextMenu"},(()=>{this.setLabelMode((0,n.ensureNotNull)(this._fixedLabelMode)),this._fixedLabelMode=null}))}}var rt=i(96152);class nt{constructor(e,t,i,r,n,o=null){this._axises=[],this._stubs=[],this._size=(0,s.size)({width:0,height:0}),this._onLabelHovered=new R.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._onActiveOrHoveredChart=r.onActiveOrHoveredChart,this._getBackgroundTopColor=r.getBackgroundTopColor,this._getBackgroundBottomColor=r.getBackgroundBottomColor,this._requestRepaint=r.requestRepaint,this._showHorisontalBorder=Boolean(r.showHorizontalBorder),this._labelsOptions={...tt,...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(){var e;this.setScales([],0,0,0),this._backgroundBasedTheme.release(),null===(e=this._onActiveOrHoveredChart)||void 0===e||e.release()}onLabelHovered(){return this._onLabelHovered}setScales(e,t,i,s){for(;e.length>this._axises.length&&this._axises.length<t;){const e=(0,rt.getPriceAxisNameInfo)(this._side,this._axises.length),t=this._priceAxisWidgetFactory(this._side,this._rendererOptionsProvider,this._scalesProperties,e,this._backgroundBasedTheme);this._axises.push(t),this._cell.appendChild(t.getElement())}for(;e.length<this._axises.length;){const e=(0,n.ensureDefined)(this._axises.pop());this._cell.removeChild(e.getElement()),e.destroy()}for(let t=0;t<this._axises.length;++t)this._axises[t].setPriceScale(e[t]);const r=t-e.length,o=Math.max(0,r);for(;this._stubs.length>o;){
const e=(0,n.ensureDefined)(this._stubs.pop());e.onLabelHovered().unsubscribeAll(this),this._cell.removeChild(e.getElement()),e.destroy()}for(;this._stubs.length<r;){const e=this._labelsOptions.showLabels?(0,rt.getPriceAxisNameInfo)(this._side,this._stubs.length):null,t=new st(this._side,this._stubProperties,e,this._stubParams(this._stubs.length),this._labelsOptions,this._timeAxisWidget);t.onLabelHovered().subscribe(this,((t,i)=>{this._labelsOptions.showLabels&&this._labelsOptions.enableHighlight&&this._onLabelHovered.fire({owner:t,axis:(0,n.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?0:1))):this._stubs.forEach(((e,t)=>e.setLabelMode(t<i&&a?2:1)))}getElement(){return this._cell}updateCurrencyLabels(){return this._axises.forEach((e=>e.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,n.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){var t;return{rendererOptionsProvider:this._rendererOptionsProvider,backgroundBasedTheme:this._backgroundBasedTheme.spawnOwnership(),onActiveOrHoveredChart:null===(t=this._onActiveOrHoveredChart)||void 0===t?void 0:t.spawnOwnership(),sourcesTitlesProvider:()=>this._titlesProvider(this._side,e),contextMenuItemsProvider:()=>this._stubContextMenuProvider(this._side,e),getBackgroundTopColor:this._getBackgroundTopColor,getBackgroundBottomColor:this._getBackgroundBottomColor,requestRepaint:this._requestRepaint,showHorizontalBorder:this._showHorisontalBorder}}_getImage(){const e=(0,z.createDisconnectedCanvas)(document,this._size),t=(0,z.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 ot=i(55824),at=i(25313);class lt{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=at["price-axis-currency-label-wrapper"],this._currencyAndUnitLabelsWrapper.setAttribute("data-name","currency-unit-label-wrapper"),this._controlsContainer=document.createElement("div"),this._controlsContainer.className=at["price-axis-currency-label"],this._currencyAndUnitLabelsWrapper.appendChild(this._controlsContainer),this._currencyLabelDiv=document.createElement("div"),this._currencyLabelDiv.className=at.row,this._currencyLabelDiv.classList.add("apply-common-tooltip"),(0,Xe.setTooltipData)(this._currencyLabelDiv,"text",(e=>this._currencyTooltipContent())),this._currencyText=document.createElement("div"),this._currencyText.className=at["price-axis-currency-label-text"],this._currencyLabelDiv.appendChild(this._currencyText),this._currencyArrowDown=document.createElement("div"),this._currencyArrowDown.className=at["price-axis-currency-label-arrow-down"],this._currencyArrowDown.innerHTML=ot,this._currencyLabelDiv.appendChild(this._currencyArrowDown),this._measureUnitIdLabelDiv=document.createElement("div"),this._measureUnitIdLabelDiv.className=at.row,this._measureUnitIdLabelDiv.classList.add("apply-common-tooltip"),this._measureUnitIdLabelDiv.classList.add("readonly"),(0,Xe.setTooltipData)(this._measureUnitIdLabelDiv,"text",(e=>this._measureUnitIdTooltipContent())),this._measureUnitIdText=document.createElement("div"),this._measureUnitIdText.className=at["price-axis-currency-label-text"],this._measureUnitIdLabelDiv.appendChild(this._measureUnitIdText),this._unitLabelDiv=document.createElement("div"),this._unitLabelDiv.className=at.row,this._unitLabelDiv.classList.add("apply-common-tooltip"),(0,Xe.setTooltipData)(this._unitLabelDiv,"text",(e=>this._unitTooltipContent())),this._unitText=document.createElement("div"),this._unitText.className=at["price-axis-currency-label-text"],this._unitLabelDiv.appendChild(this._unitText),this._unitArrowDown=document.createElement("div"),this._unitArrowDown.className=at["price-axis-currency-label-arrow-down"],this._unitArrowDown.innerHTML=ot,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(at.hidden)}setCurrencyExpanded(e){this._currencyLabelDiv.classList.toggle(at.expanded,e)}setUnitExpanded(e){this._unitLabelDiv.classList.toggle(at.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(at.css_wrapper_margin)*i),a=(0,Le.ceiledEven)(t*i)-2*o,l=Math.round(this.labelBottom()*i),c=l-2*o,h=Math.round(Number(at.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,$e.makeFont)(this._fontSize,Je.CHART_FONT_FAMILY);const u=new Ye.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,qe.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 y=o+v;d.forEach(((t,s)=>{""!==t&&((0,z.drawScaled)(e,i,i,(()=>{e.fillText(t,f/i,(y+_[s])/i)})),y=Math.ceil(y+2*v))}))}setHidden(e){this._currencyAndUnitLabelsWrapper.classList.toggle(at.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?a.t(null,void 0,i(54215)):(0,n.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?a.t(null,void 0,i(54215)):(0,n.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?a.t(null,void 0,i(54215)):(0,n.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(at.css_wrapper_margin)+Number(at.css_row_left_right_padding)+2}_currencyTooltipContent(){const e=this._currencyInfo;return null===e?"":null===e.selectedCurrency?Array.from(e.currencies).map((t=>(0,
n.ensureDefined)(e.displayedValues.get(t)))).join(", "):e.readOnly?a.t(null,void 0,i(43931)):a.t(null,void 0,i(48566))}_unitTooltipContent(){const e=this._unitInfo;return null===e?"":null===e.selectedUnit?Array.from(e.units).map((t=>(0,n.ensureDefined)(e.names.get(t)))).join(", "):0===e.availableGroups.size?a.t(null,void 0,i(40012)):a.t(null,void 0,i(85110))}_measureUnitIdTooltipContent(){const e=this._measureUnitIdInfo;return null===e?"":null===e.selectedMeasureUnitId?Array.from(e.measureUnitIds).map((t=>(0,n.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 ct(e,t,s,r,n,o){const{UnitConversionRenderer:a}=await Promise.all([i.e(9093),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(2248),i.e(3114),i.e(4632),i.e(3762),i.e(5458),i.e(8775),i.e(2227),i.e(361),i.e(2704)]).then(i.bind(i,41153));return new a(e,s,t,r,n,o)}var ht=i(97702);class dt{constructor(e){const{action:t,property:i,undoModel:s,undoText:r,callback:n=null}=e;this._property=i,this._undoModel=s,this._undoText=r,this._action=t,this.setValue(i.value()),i.subscribe(this,this._propertyChanged),null!==n?t.update({onExecute:n.bind(this)}):t.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())}}class ut extends ht.Action{constructor(e,t){super(e),this._binding=new dt({action:this,...t})}destroy(){this._binding.destroy(),super.destroy()}}var pt=i(68335),_t=i(73866),mt=i(51330),gt=i(50788),ft=i(92158),vt=i(97754),yt=i.n(vt),St=i(64176);class bt{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=St.priceScaleModeButtons;const[n,o]=this._createButton({title:a.t(null,{context:'The first letter of the "auto" word'},i(94073)),tooltip:a.t(null,void 0,i(24157)),onClick:()=>e("auto"),ariaLabel:a.t(null,void 0,i(94465))});this._autoScaleButton=o,r.appendChild(n);const[l,c]=this._createButton({title:a.t(null,{context:'The first letter of the "logarithmic" word'},i(66384)),tooltip:a.t(null,void 0,i(16170)),onClick:()=>e("log"),ariaLabel:a.t(null,void 0,i(46992))});this._logarithmButton=c,r.appendChild(l)}destroy(){this._wrapper.removeEventListener("dblclick",this._stopPropagation),this._wrapper.removeEventListener("touchstart",this._stopPropagation),this._wrapper.remove()}element(){return this._wrapper}width(){return 52}updateMode(e){const{log:t,autoScale:i}=e
;this._logarithmButton.classList.toggle(St.priceScaleModeButtons__button_activated,!!t),this._autoScaleButton.classList.toggle(St.priceScaleModeButtons__button_activated,!!i)}_createButton(e){const{ariaLabel:t,title:i,tooltip:s,onClick:r,className:n}=e,o=document.createElement("div");o.className=St.priceScaleModeButtons__buttonWrapper;const a=document.createElement("button");a.className=yt()(St.priceScaleModeButtons__button,n,"apply-common-tooltip"),a.textContent=i,a.dataset.tooltip=s;let l=a;return c.CheckMobile.any()&&(l=o),l.addEventListener("click",r),t&&l.setAttribute("aria-label",t),o.appendChild(a),[o,a]}_stopPropagation(e){e.stopPropagation()}}var wt=i(81199);i(11710);const Ct=new W.TranslatedString("change no overlapping labels",a.t(null,void 0,i(61557))),Pt=new W.TranslatedString("toggle auto scale",a.t(null,void 0,i(42240))),xt=new W.TranslatedString("toggle log scale",a.t(null,void 0,i(49403))),Tt=a.t(null,void 0,i(88314)),It=a.t(null,void 0,i(5119)),Mt=a.t(null,void 0,i(59396)),At=a.t(null,void 0,i(15432)),Lt=a.t(null,void 0,i(15332)),kt=a.t(null,void 0,i(24157)),Dt=a.t(null,{context:"scale_menu"},i(34954)),Et=a.t(null,{context:"scale_menu"},i(35210)),Vt=a.t(null,{context:"scale_menu"},i(31340)),Bt=a.t(null,{context:"scale_menu"},i(55300)),Rt=a.t(null,{context:"scale_menu"},i(19405)),Nt=a.t(null,{context:"scale_menu"},i(75163));const Ot=function(e){const t=new _t.LimitedPrecisionNumericFormatter(e);return(e,i)=>(0,P.isNumber)(i)&&!e.isLog()?t.format(i):""}(4),Ft=N.enabled("currency_menu_disabled"),Wt=N.enabled("unit_menu_disabled"),Ht={contextMenuEnabled:!0,currencyConversionEnabled:!1,unitConversionEnabled:!1,countdownEnabled:!0,contextMenu:{general:!0,source:!0},pressedMouseMoveScale:!0,mouseWheelScale:!0,pinchScale:!0,croppedTickMarks:!0};var zt,Ut,jt;!function(e){e[e.LabelOffset=4]="LabelOffset",e[e.DefaultOptimalWidth=34]="DefaultOptimalWidth",e[e.WheelScaleCoeff=15]="WheelScaleCoeff"}(zt||(zt={})),function(e){e[e.Back=0]="Back",e[e.Top=1]="Top",e[e.All=2]="All"}(Ut||(Ut={}));class Gt{constructor(e,t,i,r,n,o,a,l,c){this._actions=null,this._priceScale=null,this._scaleModeButtons=null,this._widthCache=new Ye.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 H.WatchedValue(!1),this._recalcCurrencyAndUnitVisibility=()=>{if(null===this._currencyLabel)return;let e=!0;switch((0,gt.actualCurrencyUnitVisibility)().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._handleactualAutoLogButtonsVisibility=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,P.merge)((0,P.clone)(Ht),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,z.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,z.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",this._cell.setAttribute("aria-hidden","true"),this._mouseEventHandler=new ke.MouseEventHandler(this._cell,this,{treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!0}),this._options.currencyConversionEnabled||this._options.unitConversionEnabled?(this._currencyLabel=new lt,this._cell.appendChild(this._currencyLabel.element())):this._currencyLabel=null,this._properties.childs().fontSize.subscribe(this,this._onFontSizeChanged),this._options.mouseWheelScale&&(this._mouseWheelHelper=new Ie,this._cell.addEventListener("wheel",this._onMousewheel.bind(this),{passive:!1})),this._axisInfo=l,this._offset=0,this.restoreDefaultCursor(),(0,gt.actualCurrencyUnitVisibility)().subscribe(this,this._recalcCurrencyAndUnitVisibility),(0,ft.actualAutoLogButtonsVisibility)().subscribe(this,this._handleactualAutoLogButtonsVisibility),this._handleactualAutoLogButtonsVisibility((0,ft.actualAutoLogButtonsVisibility)()),this._chart.anyPriceAxisHovered().subscribe(this._recalcCurrencyAndUnitVisibility,{callWithLast:!0}),this.update()}getContextMenuActions(e){var t;this._initActions();const i=(0,n.ensureNotNull)(this._actions),s=this._chart.actions(),r=[];return(null===(t=this._priceScale)||void 0===t?void 0:t.resetScaleAvailable().value())&&r.push(i.reset,new ht.Separator),r.push(this._autoScaleAction()),
this._isMainSeriesAxis()&&r.push(this._lockScaleAction()),r.push(s.scaleSeriesOnly,this._invertAction(),new ht.Separator,this._regularScaleAction(),this._percentageAction(),this._indexedTo100Action(),this._logAction(),new ht.Separator),c.CheckMobile.any()||(r.push(this._createMergeScalesAction()),r.push(new ht.Separator)),N.enabled("fundamental_widget")||r.push(new ht.Action({actionId:"Chart.PriceScale.Labels",options:{label:It,subItems:[s.showSymbolLabelsAction,s.showSeriesLastValue,null,null,s.showHighLowPriceLabels,N.enabled("show_average_close_price_line_and_label")?s.showAverageClosePriceLabel:null,null,s.showStudyPlotNamesAction,s.showStudyLastValue,i.alignLabels].filter(Boolean)}})),r.push((0,mt.createLinesAction)(this._chart)),this._options.countdownEnabled&&r.push(s.showCountdown),this._undoModel.crossHairSource().isMenuEnabled()&&r.push(s.addPlusButton),e&&!this._chart.onWidget()&&N.enabled("show_chart_property_page")&&N.enabled("chart_property_page_scales")&&s.scalesProperties&&r.push(new ht.Separator,s.scalesProperties),r}getElement(){return this._cell}onOptimalWidthNeedToBeRecalculated(e){(this._size.width<this.optimalWidth()||e)&&this._undoModel.model().fullUpdate()}optimalWidth(){var e,t,i;if(!this.isVisible())return 0;let s=0;const r=this.rendererOptions();if(this._pane.hasState()){const t=(0,z.getContext2D)(this._canvasBinding.canvasElement);t.font=this.baseFont();const i=this._views(2,this._groupedSources());for(let e=i.length;e--;){if(!i[e].isAxisLabelVisible())continue;const r=this._widthCache.measureText(t,i[e].text());s=Math.max(s,r);const n=i[e].secondLineText();n&&(s=Math.max(s,this._widthCache.measureText(t,n)));const o=i[e].thirdLineText();o&&(s=Math.max(s,this._widthCache.measureText(t,o)))}const r=this.priceScale();for(const e of r.marks())s=Math.max(s,this._widthCache.measureText(t,e.label));const n=(null===(e=r.mainSource())||void 0===e?void 0:e.firstValue())||null;if(null!==n){const e=r.coordinateToPrice(1,n),i=r.coordinateToPrice(this._size.height-2,n);if(Math.abs(e-i)>1e-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,n.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(r.borderSize+r.additionalPaddingInner+r.paddingInner+r.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,
z.createDisconnectedCanvas)(document,e);return(0,z.getPrescaledContext2D)(t).drawImage(this._canvasBinding.canvasElement,0,0,e.width,e.height),null===this._currencyLabel||this._currencyLabel.isHidden()||this._currencyLabel.drawLabel((0,z.getContext2D)(t),e.width,(0,fe.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===ve.InvalidationLevel.None)return;const t=this._pane.state(),i=!t.maximized().value()&&t.collapsed().value(),s=this._pane.hasState();(0,z.tryApplySuggestedCanvasBitmapSize)(this._canvasBinding),(0,z.tryApplySuggestedCanvasBitmapSize)(this._topCanvasBinding);const r=this._groupedSources(),o=null!==this._currencyLabel&&!this._currencyLabel.isHidden(),a=(e,t,i)=>{if(o){e.save(),e.beginPath();const i=(0,n.ensureNotNull)(this._currencyLabel).labelBottom();e.rect(0,i*t.verticalPixelRatio,t.bitmapSize.width,t.bitmapSize.height),e.clip()}i(),o&&e.restore()};if(e>ve.InvalidationLevel.Cursor){const e=(0,z.getContext2D)(this._canvasBinding.canvasElement),t=(0,z.getBindingRenderingInfo)(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,r),e,t)})))}if(s&&!i){const e=(0,z.getContext2D)(this._topCanvasBinding.canvasElement),t=(0,z.getBindingRenderingInfo)(this._topCanvasBinding);e.clearRect(0,0,t.bitmapSize.width,t.bitmapSize.height),a(e,t,(()=>{this._drawLabels(this._views(1,r),e,t),this._drawCrossHairLabel(e,t)}))}}restoreDefaultCursor(){this._setCursor("")}priceScale(){return(0,n.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&&(Object.values(this._actions).forEach((e=>{e.destroy()})),this._actions=null),(0,gt.actualCurrencyUnitVisibility)().unsubscribeAll(this),this._chart.anyPriceAxisHovered().unsubscribe(this._recalcCurrencyAndUnitVisibility),(0,ft.actualAutoLogButtonsVisibility)().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,$e.makeFont)(this.fontSize(),Je.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(),...i.sourcesByGroup().multipaneSources()];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 Oe.Point(e,t),c=(0,z.getBindingRenderingInfo)(this._canvasBinding);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,c,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,gt.actualCurrencyUnitVisibility)().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,gt.actualCurrencyUnitVisibility)().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<e.length;t++)h.isOverlay(e[t])&&c.push(e[t])}const u=l.mainSource(),p=h.sourcesByGroup().multipaneSources();for(const s of[c,h.customSources(),p])for(let r=0;r<s.length;++r){const c=s[r],p=[...null!==(e=c.priceAxisViews(h,l))&&void 0!==e?e:[],...null!==(i=null===(t=c.topPriceAxisViews)||void 0===t?void 0:t.call(c,h,l))&&void 0!==i?i:[]];if(p){const e=p.filter((e=>{if(e.ignoreAlignment()||!e.isVisible())return!1;const{total:t}=e.topBottomTotalHeight(d),i=e.floatCoordinate();return i>-t&&i<n+t}));if(!e.length)continue;a.push(...e),u===c&&(o=e[0].floatCoordinate())}}const _=a.filter((e=>e.floatCoordinate()<=o)),m=a.filter((e=>e.floatCoordinate()>o));_.sort(((e,t)=>t.floatCoordinate()-e.floatCoordinate())),_.length>0&&m.length>0&&m.push(_[0]),m.sort(((e,t)=>e.floatCoordinate()-t.floatCoordinate()));for(const e of a)e.setFixedCoordinate(e.coordinate());if(l.properties().childs().alignLabels.value()){if(m.length>0||_.length>0){{const e=null!==(s=_[0])&&void 0!==s?s:m[0],t=e.getFixedCoordinate(),{top:i,bottom:r,total:o}=e.topBottomTotalHeight(d);o<n&&t-i<0&&t+r>0&&e.setFixedCoordinate(i)}{const e=null!==(r=m[0])&&void 0!==r?r:_[0],t=e.getFixedCoordinate(),{top:i,bottom:s,total:o}=e.topBottomTotalHeight(d);o<n&&t-i<n&&t+s>n&&e.setFixedCoordinate(n-s)}}for(let e=1;e<_.length;e++){const t=_[e],i=_[e-1],{top:s,bottom:r,total:n}=t.topBottomTotalHeight(d),o=t.getFixedCoordinate(),a=i.getFixedCoordinate();if(o>a-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<m.length;e++){const t=m[e],i=m[e-1],{bottom:s,total:r}=i.topBottomTotalHeight(d),o=t.getFixedCoordinate(),a=i.getFixedCoordinate();if(o<a+r)t.setFixedCoordinate(a+r);else if(a<n){const{top:e,bottom:i}=t.topBottomTotalHeight(d);o-e<n&&o+i>n&&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(),{horizontalPixelRatio:r,verticalPixelRatio:o}=t,a=this._isLeft?Math.floor((this._size.width-s.additionalPaddingInner)*r):0,l=this._isLeft?Math.round(a-s.paddingInner*r):Math.round(a+(s.additionalPaddingInner+s.paddingInner)*r),c=this.fontSize(),h=this._isCurrencyLabelEnabled()?(0,n.ensureNotNull)(this._currencyLabel).labelBottom():0,d=i.map((t=>{if(this._options.croppedTickMarks)return{visible:!0,yCorrection:this._widthCache.yMidCorrection(e,t.label)};const i=t.coord-c/2,s=t.coord+c/2,r=!(s>this._size.height||i<h);return{visible:!(s>this._size.height||i<h),yCorrection:r?this._widthCache.yMidCorrection(e,t.label):0}}));e.fillStyle=this.textColor(),e.textAlign=this._isLeft?"right":"left",e.textBaseline="middle",(0,z.drawScaled)(e,r,o,(()=>{for(let t=i.length;t--;){if(!d[t].visible)continue;const s=i[t];e.fillText(s.label,l/r,s.coord+d[t].yCorrection)}})),e.restore()}async _showCurrenciesContextMenu(){var e;if(null!==this._currencyMenu&&this._currencyMenu.isOpened())return void this._currencyMenu.close();(0,u.trackEvent)("GUI","Currency conversion");const{currencyActions:t}=await Promise.all([i.e(9093),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(2248),i.e(3114),i.e(4632),i.e(3762),i.e(5458),i.e(8775),i.e(2227),i.e(361),i.e(2704)]).then(i.bind(i,75556)),s=await ct(Mt,(()=>t(this._undoModel,(0,n.ensureNotNull)(this._currencyLabel).currencyInfo(),this.priceScale())),(0,n.ensureNotNull)(this._currencyLabel).currencyLabelElement(),Ft,(()=>["toggle_currency_menu_inner",this._undoModel.model().id(),this._pane.state().id(),this.priceScale().id()]),(()=>{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,u.trackEvent)("GUI","Unit conversion");const{unitActions:t}=await Promise.all([i.e(9093),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(2248),i.e(3114),i.e(4632),i.e(3762),i.e(5458),i.e(8775),i.e(2227),i.e(361),i.e(2704)]).then(i.bind(i,59363)),s=await ct(At,(()=>t(this._undoModel,(0,n.ensureNotNull)(this._currencyLabel).unitInfo(),this.priceScale())),(0,n.ensureNotNull)(this._currencyLabel).unitLabelElement(),Wt,(()=>["toggle_unit_menu_inner",this._undoModel.model().id(),this._pane.state().id(),this.priceScale().id()]),(()=>{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,0),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,u.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&&Ze.ContextMenuManager.showMenu(this.getContextMenuActions(!0),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.priceScale().hasCalculatedPriceRange()&&this._undoModel.model().zoomEnabled()}_onMousewheel(e){if(!this._zoomAvailable()||!this._options.mouseWheelScale)return;const t=(0,n.ensureNotNull)(this._mouseWheelHelper).processWheel(e).deltaY;if(0===t)return;e.cancelable&&e.preventDefault();const i=this._undoModel,s=this._pane.state(),r=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,r,l),i.endScalePrice(s,r),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=this.backgroundTopColor(),s=this.backgroundColor(),{bitmapSize:r}=t;if(i===s?(0,z.clearRect)(e,0,0,r.width,r.height,this.backgroundColor()):(0,qe.clearRectWithGradient)(e,0,0,r.width,r.height,i,s),this._highlighted){e.globalAlpha=.5;const t=d.themes[this._backgroundBasedTheme.value()].getThemedColor("color-price-axis-highlight");(0,z.fillRect)(e,0,0,r.width,r.height,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{horizontalPixelRatio:i}=t,s=Math.max(1,Math.floor(this.rendererOptions().borderSize*i)),r=this._isLeft?t.bitmapSize.width-s:0;e.fillRect(r,0,s,t.bitmapSize.height),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,i,s,this._widthCache,r),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<t.length;e++)n=Math.min(n,t[e].price),o=Math.max(o,t[e].price);const{horizontalPixelRatio:a,verticalPixelRatio:l}=s,c=this.priceScale(),h=Math.floor(c.priceToCoordinate(n,r)*l),d=Math.ceil(c.priceToCoordinate(o,r)*l);(0,z.fillRect)(e,Math.floor(a),h,s.bitmapSize.width,d-h,this._properties.childs().axisHighlightColor.value())}_viewsOrMaxMinViews(e){var t,i;const s=this._pane.state(),r=this.priceScale();if(0===e.length)return[]
;if(1===e.length)return null!==(t=e[0].priceAxisViews(s,r))&&void 0!==t?t:[];{let t=1/0,n=-1/0,o=null,a=null;for(const l of e){const e=null!==(i=l.priceAxisViews(s,r))&&void 0!==i?i:[];for(const i of e){const e=i.coordinate();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 wt.ActionWithStandardIcon({actionId:"Chart.PriceScale.Reset",options:{label:Lt,iconId:"Chart.Reset",shortcutHint:(0,pt.humanReadableHash)(pt.Modifiers.Alt+82),statName:"ResetScale",onExecute:()=>this.reset()}}),i=new ht.Action({actionId:"Chart.PriceScale.ToggleAutoScale",options:{label:kt,checkable:!0,checked:!0,statName:"ToggleAutoScale",onExecute:()=>{e.togglePriceScaleAutoScaleMode(this.priceScale()),this._updateScalesActions()}}}),s=new ht.Action({actionId:"Chart.PriceScale.TogglePercentage",options:{label:Dt,checkable:!0,checked:this.priceScale().isPercentage(),statName:"TogglePercantage",onExecute:()=>{e.togglePriceScalePercentageScaleMode(this.priceScale()),this._updateScalesActions()}}}),r=new ht.Action({actionId:"Chart.PriceScale.ToggleIndexedTo100",options:{label:Et,checkable:!0,checked:this.priceScale().isIndexedTo100(),statName:"ToggleIndexedTo100",onExecute:()=>{e.togglePriceScaleIndexedTo100ScaleMode(this.priceScale()),this._updateScalesActions()}}}),n=new ht.Action({actionId:"Chart.PriceScale.ToggleLogarithmic",options:{label:Vt,checkable:!0,checked:this.priceScale().isLog(),statName:"ToggleLogScale",onExecute:()=>{e.togglePriceScaleLogScaleMode(this.priceScale()),this._updateScalesActions()}}}),o=new ht.Action({actionId:"Chart.PriceScale.ToggleRegular",options:{label:Bt,checkable:!0,checked:this.priceScale().isRegular(),statName:"ToggleRegularScale",onExecute:()=>{e.setPriceScaleRegularScaleMode(this.priceScale()),this._updateScalesActions()}}}),a=new ut({actionId:"Chart.PriceScale.Labels.ToggleNoOverlappingLabelsVisibility",options:{label:Rt,checkable:!0,checked:this.priceScale().properties().childs().alignLabels.value(),statName:"TogglePreciseLabels"}},{property:this.priceScale().properties().childs().alignLabels,undoModel:e,undoText:Ct}),l=new ht.Action({actionId:"Chart.PriceScale.ToggleInvertScale",options:{label:Nt,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,n.ensureNotNull)(this._actions).setLog}_percentageAction(){return this._isMainSeriesAxis()?this._chart.actions().percentSeriesScale:(0,n.ensureNotNull)(this._actions).setPercentage}_indexedTo100Action(){return this._isMainSeriesAxis()?this._chart.actions().indexedTo100SeriesScale:(0,n.ensureNotNull)(this._actions).setIndexedTo100}_autoScaleAction(){return this._isMainSeriesAxis()?this._chart.actions().autoSeriesScale:(0,n.ensureNotNull)(this._actions).setAutoScale}_regularScaleAction(){return this._isMainSeriesAxis()?this._chart.actions().regularSeriesScale:(0,n.ensureNotNull)(this._actions).setRegular}_lockScaleAction(){const e=this._chart.actions().lockSeriesScale,t=Ot(this.priceScale(),this._undoModel.model().mainSeriesScaleRatio());return e.update({hint:t}),e}_invertAction(){return this._isMainSeriesAxis()?this._chart.actions().invertSeriesScale:(0,n.ensureNotNull)(this._actions).invertScale}_isMainSeriesAxis(){return this.priceScale().hasMainSeries()}_updateScalesActions(){const e=this.priceScale(),t=this._isMainSeriesAxis(),i=(0,n.ensureNotNull)(e.mainSource()).properties(),s=t&&e.isLockScale(),r=t&&6===i.style.value(),o=(0,n.ensureNotNull)(this._actions);o.setRegular.update({checked:e.isRegular(),disabled:s||r}),o.setPercentage.update({checked:e.isPercentage(),disabled:s||r}),o.setIndexedTo100.update({checked:e.isIndexedTo100(),disabled:s||r}),o.setLog.update({checked:e.isLog(),disabled:s||r}),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 ht.Action({actionId:"Chart.PriceScale.MergeAllScales",options:{label:Tt,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 bt({className:"price-axis__modeButtons",setMode:e=>{this._priceScale&&("log"===e?this._chart.model().setPriceScaleMode({log:!this._priceScale.isLog()},this._priceScale,xt):this._chart.model().setPriceScaleMode({autoScale:!this._priceScale.isAutoScale()},this._priceScale,Pt))}});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,_.applyTransparency)(d.themes[this._backgroundBasedTheme.value()].getThemedColor("color-price-axis-highlight"),50),s=(0,Ae.rgbaToString)((0,Ae.blendRgba)((0,Ae.parseRgba)(this.backgroundColor()),(0,Ae.parseRgba)(i)));this._highlightColorCache={theme:t,backgroundColor:e,resultColor:s}}return this._highlightColorCache.resultColor}_applyLightUpdateIfRequired(){"visibleOnMouseOver"===(0,gt.actualCurrencyUnitVisibility)().value()&&this._undoModel.model().lightUpdate()}}function qt(e,t){return e.position-t.position}function $t(e,t,i){const s=(e.position-t.position)/(e.time-t.time);return Math.sign(s)*Math.min(Math.abs(s),i)}!function(e){e[e.MaxStartDelay=50]="MaxStartDelay",e[e.EpsilonDistance=1]="EpsilonDistance"}(jt||(jt={}));class Kt{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)<this._minMove)return}this._position4=this._position3,this._position3=this._position2,this._position2=this._position1,this._position1={time:t,position:e}}start(e,t){if(null===this._position1||null===this._position2)return;if(t-this._position1.time>50)return;let i=0;const s=$t(this._position1,this._position2,this._maxSpeed),r=qt(this._position1,this._position2),n=[s],o=[r];if(i+=r,null!==this._position3){const e=$t(this._position2,this._position3,this._maxSpeed);if(Math.sign(e)===Math.sign(s)){const t=qt(this._position2,this._position3);if(n.push(e),o.push(t),i+=t,null!==this._position4){const e=$t(this._position3,this._position4,this._maxSpeed);if(Math.sign(e)===Math.sign(s)){const t=qt(this._position3,this._position4);n.push(e),o.push(t),i+=t}}}}let a=0;for(let e=0;e<n.length;++e)a+=o[e]/i*n[e];Math.abs(a)<this._minSpeed||(this._animationStartPosition={position:e,time:t},this._speedPxPerMsec=a,this._durationMsecs=function(e,t){const i=Math.log(t);return Math.log(1*i/-e)/i}(Math.abs(a),this._dumpingCoeff))}getStartPosition(){return(0,n.ensureNotNull)(this._animationStartPosition).position}getPosition(e){const t=(0,n.ensureNotNull)(this._animationStartPosition),i=e-t.time;return t.position+this._speedPxPerMsec*(Math.pow(this._dumpingCoeff,i)-1)/Math.log(this._dumpingCoeff)}finished(e){return null===this._animationStartPosition||this._progressDuration(e)===this._durationMsecs}
_progressDuration(e){const t=e-(0,n.ensureNotNull)(this._animationStartPosition).time;return Math.min(t,this._durationMsecs)}}var Yt=i(60265);const Zt=(0,m.getLogger)("Chart.ChartUndoModel");class Xt extends Yt.UndoCommand{constructor(e,t,i,s=!0){super(i,!1,s),this._newRightOffsetAndBarSpacing=null,this._model=e,this._rightOffsetAndBarSpacing=t}undo(){if(null!==this._newRightOffsetAndBarSpacing)return void Zt.logDebug("TimeScaleChangeUndoCommand.undo: Command is already undone");const e=this._model.timeScale();this._newRightOffsetAndBarSpacing={barSpacing:e.barSpacing(),rightOffset:e.rightOffset()},e.setBarSpacing(this._rightOffsetAndBarSpacing.barSpacing),e.setRightOffset(this._rightOffsetAndBarSpacing.rightOffset),this._model.lightUpdate()}redo(){if(null===this._newRightOffsetAndBarSpacing)return void Zt.logDebug("TimeScaleChangeUndoCommand.redo: Command is not undone");const e=this._model.timeScale();e.setBarSpacing(this._newRightOffsetAndBarSpacing.barSpacing),e.setRightOffset(this._newRightOffsetAndBarSpacing.rightOffset),this._model.lightUpdate(),this._newRightOffsetAndBarSpacing=null}}const Jt=(0,m.getLogger)("Chart.ChartUndoModel");var Qt;!function(e){e[e.MergeTimeout=1e3]="MergeTimeout"}(Qt||(Qt={}));const ei=new W.TranslatedString("scale price",a.t(null,void 0,i(94981)));class ti extends Yt.UndoCommand{constructor(e,t,i,s,r,n=!0){super(ei,!1,n),this._newPriceScaleState=null,this._model=e,this._paneIndex=e.panes().indexOf(t),this._priceScaleId=i.id(),this._state=s,this._timestamp=r?performance.now():null}undo(){if(null!==this._newPriceScaleState)return void Jt.logDebug("PriceScaleChangeUndoCommand.undo: Command is already undone");const[e,t]=this._paneAndScale();this._newPriceScaleState=t.state(),this._model.restorePriceScaleState(e,t,this._state)}redo(){if(null===this._newPriceScaleState)return void Jt.logDebug("PriceScaleChangeUndoCommand.redo: Command is not undone");const[e,t]=this._paneAndScale();this._model.restorePriceScaleState(e,t,this._newPriceScaleState),this._newPriceScaleState=null}canMerge(e){return e instanceof ti&&null!==this._timestamp&&null!==e._timestamp&&null===this._newPriceScaleState&&e._model===this._model&&e._paneIndex===this._paneIndex&&e._priceScaleId===this._priceScaleId&&Math.abs(e._timestamp-this._timestamp)<1e3}merge(e){this._timestamp=e._timestamp}_paneAndScale(){const e=this._model.panes()[this._paneIndex],t=(0,n.ensureNotNull)(e.getPriceScaleById(this._priceScaleId));return[e,t]}}var ii,si=i(45579);function ri(e,t){0}function ni(e){ri()}!function(e){e.Create="create",e.Paste="paste",e.Clone="clone"}(ii||(ii={}));var oi=i(15764),ai=i(72791),li=i(38780),ci=i(81171);function hi(e){return"startMoving"in e&&"move"in e&&"endMoving"in e&&"convertYCoordinateToPriceForMoving"in e}var di=i(32549),ui=i(10074),pi=i(44672),_i=i(80747);i(27437);const mi=parseInt(_i["css-value-pane-controls-padding-left"]),gi=parseInt(_i["css-value-pane-controls-padding-right"]),fi=(0,ie.getHexColorByName)("color-cold-gray-700"),vi=(0,
ie.getHexColorByName)("color-cold-gray-400"),yi=new W.TranslatedString("scroll",a.t(null,void 0,i(42070))),Si=a.t(null,void 0,i(66005));a.t(null,void 0,i(78972));function bi(e,t,i){e.drawBackground&&e.drawBackground(t,i)}function wi(e,t,i){e.draw(t,i)}function Ci(e,t){return e.paneViews(t)}function Pi(e,t){var i,s;return null!==(s=null===(i=e.topPaneViews)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:[]}function xi(e,t){return e.labelPaneViews(t)}function Ti(e,t){const i=e.strategyOrdersPaneView();return null===i?null:[i]}function Ii(e,t){return null===e||e.source!==t?null:e.hittest.data()}function Mi(e,t,i,s,r){var n,o;const a=null!==(o=null===(n=e.result)||void 0===n?void 0:n.hittest.target())&&void 0!==o?o:0;t.target()>a&&(e.result={hittest:t,source:i,renderer:s,isCustom:r})}const Ai={contextMenuEnabled:!0,contextMenu:mt.defaultContextMenuOptions,priceScaleContextMenuEnabled:!0,legendWidgetEnabled:!0,controlsEnabled:!0,propertyPagesEnabled:!0,sourceSelectionEnabled:!0,countdownEnabled:!0},Li=new Map([[We.AreaName.Text,"Text"],[We.AreaName.Style,"Style"]]),ki=!N.enabled("display_legend_on_all_charts");var Di;!function(e){e[e.MinScrollSpeed=.2]="MinScrollSpeed",e[e.MaxScrollSpeed=7]="MaxScrollSpeed",e[e.DumpingCoeff=.997]="DumpingCoeff",e[e.ScrollMinMove=15]="ScrollMinMove",e[e.SPenMaxDistance=5]="SPenMaxDistance",e[e.CollapsedHeight=33]="CollapsedHeight"}(Di||(Di={}));let Ei=null;function Vi(e,t){return!(0,We.shouldDefaultActionBeExecuted)(e,t,"pressedMouseMoveHandler","touchMoveHandler")}var Bi;!function(e){e[e.None=0]="None",e[e.DownWithoutMove=1]="DownWithoutMove",e[e.DownWithMove=2]="DownWithMove"}(Bi||(Bi={}));class Ri{constructor(e,t,i,r){this._legendWidget=null,this._paneControls=null,this._isDestroyed=!1,this._trackCrosshairOnlyAfterLongTap=(0,ye.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 H.WatchedValue({owner:"",axis:null}),this._visuallyCollapsed=new H.WatchedValue(!1),this._endOfSeriesDataBanner=null,this._selectionBeforeMouseDown=new WeakSet,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,P.merge)((0,P.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 Gt(this._chart,this,this._chartUndoModel(),i,t,e,n,s,r),a=e.properties().childs().scalesProperties,l=this._chartModel().rendererOptionsProvider(),c={backgroundBasedTheme:e.backgroundBasedTheme().spawnOwnership(),stubContextMenuProvider:()=>[],titlesProvider:()=>[],rendererOptionsProvider:l,getBackgroundTopColor:()=>this._chartModel().backgroundTopColor().value(),getBackgroundBottomColor:()=>this._chartModel().backgroundColor().value(),requestRepaint:()=>this._chartModel().lightUpdate()},h={showLabels:!1};this._lhsPriceAxisesContainer=new nt(a,"left",o,c,h),this._rhsPriceAxisesContainer=new nt(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,z.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,z.createBoundCanvas)(this._div,(0,s.size)({width:16,height:16})),this._topCanvasBinding.subscribeSuggestedBitmapSizeChanged(this._canvasConfiguredHandler);const u=this._topCanvasBinding.canvasElement;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()),d.setAttribute("aria-hidden","true");const p=this._chartModel().mainSeries()
;p.dataEvents().symbolResolved().subscribe(this,this._updateAccesibilityAttr),p.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,ci.magnetEnabled)().subscribe(this._onMagnetStateChangedListener),(0,U.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 ke.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;this._chart.onPaneWidgetDestroyed(this);const t=this._chartModel().mainSeries();t.dataEvents().symbolResolved().unsubscribeAll(this),t.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,ci.magnetEnabled)().unsubscribe(this._onMagnetStateChangedListener),(0,U.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,Ue.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 ai.PaneCursorType.VerticalResize:this._setCursorClassName("ns-resize");break;case ai.PaneCursorType.HorizontalResize:this._setCursorClassName("ew-resize");break;case ai.PaneCursorType.DiagonalNeSwResize:this._setCursorClassName("nesw-resize");break;case ai.PaneCursorType.DiagonalNwSeResize:this._setCursorClassName("nwse-resize");break;case ai.PaneCursorType.Default:this._setCursorClassName("default");break;case ai.PaneCursorType.Pointer:this._setCursorClassName("pointer");break;case ai.PaneCursorType.Grabbing:this._setCursorClassName("grabbing");break;case ai.PaneCursorType.Text:this._setCursorClassName("text")}return}const s=je.tool.value();if((0,je.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=je.cursorTool.value();"dot"!==r?"arrow"!==r?this._setCursorClassName(""):this._setCursorClassName("default"):this._setCursorClassName("dot")}showContextMenuForSelection(e,t,i){const s=this._chartUndoModel().selection();if(s.isEmpty())return;const r=s.dataSources().filter((e=>e.hasContextMenu()));this.showContextMenuForSources(r,e,void 0,t,i)}async showContextMenuForSources(e,t,i,s,r){var n,o,a,l,c;if(!e.length||!this._state)return Promise.resolve(null);const h=e[0],d=(0,P.merge)((0,P.clone)(this._options.contextMenu),i||{}),u=new mt.ActionsProvider(this._chart,d);if(h===this._chartUndoModel().crossHairSource())return h.handleContextMenuEvent(t),Promise.resolve(null);{const i=await u.contextMenuActionsForSources(e,this._state,t,null==s?void 0:s.origin,null===(n=null==r?void 0:r.data())||void 0===n?void 0:n.customActions);if(0===i.length)return Promise.resolve(null);{let e;return e=h instanceof di.Series?{menuName:null!==(o=null==s?void 0:s.origin)&&void 0!==o?o:"ObjectTreeContextMenu",detail:{type:"series",id:h.instanceId()}}:(0,J.isLineTool)(h)?{menuName:null!==(a=null==s?void 0:s.origin)&&void 0!==a?a:"ObjectTreeContextMenu",detail:{type:"shape",id:null!==(l=null==h?void 0:h.id())&&void 0!==l?l:null}}:{menuName:null!==(c=null==s?void 0:s.origin)&&void 0!==c?c:"ObjectTreeContextMenu",detail:{
type:"study",id:(null==h?void 0:h.id())||null}},Ze.ContextMenuManager.createMenu(i,{takeFocus:!0,returnFocus:!0,isKeyboardEvent:d.isKeyboardEvent},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,n.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()&&this._chartModel().paneForSource(d)===this.state()&&c&&r){n.push(s?d.statusProvider(null==e?void 0:e.status).text():"");const r=N.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.legendValuesProvider().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=N.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.legendValuesProvider().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!==Ei&&Ei.stateId===this.state().id()&&Math.abs(Ei.x-e.localX)+Math.abs(Ei.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()!==je.SelectPointMode.None?this.startTrackingMode(new Oe.Point(e.localX,e.localY),new Oe.Point(e.localX,e.localY)):!this._chart.readOnly()&&null!==i&&(0,J.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 ze.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)<=We.HitTarget.MovePointBackground)return;const i=new ze.EnvironmentState(e),s=t.hittest.eraseMarker();if(i.mod()&&void 0!==s&&t.source.processErase)return void t.source.processErase(this._chartUndoModel(),s);const r=this._chartUndoModel();r.selection().isSelected(t.source)||r.selectionMacro((e=>{e.clearSelection();const i=(0,n.ensureNotNull)(t.source);e.addSourceToSelection(i,Ii(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 Oe.Point(e.localX,e.localY),new Oe.Point(e.localX,e.localY),new ze.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 ze.EnvironmentState(e)),this.setCursorPosition(e.localX,e.localY,new ze.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,z.tryApplySuggestedCanvasBitmapSize)(this._canvasBinding),(0,z.tryApplySuggestedCanvasBitmapSize)(this._topCanvasBinding),this._state&&(e.priceScaleSideMaxLevel("left")>ve.InvalidationLevel.Cursor||e.priceScaleSideMaxLevel("right")>ve.InvalidationLevel.Cursor)&&(this._recalculatePriceScales((0,pi.viewportChangeEvent)(this.state())),null!==Ei&&Ei.stateId===this.state().id()&&this.setCursorPosition(Ei.x,Ei.y,Ei.envState));const t=e.fullInvalidation();if(t>ve.InvalidationLevel.Cursor&&null!==Ei&&Ei.stateId===this.state().id()){const e=this._dataSourceAtPoint(Ei.x,Ei.y);this._updateHoveredSource(e,(0,U.globalEnvironmentState)())}if(this._lhsPriceAxisesContainer.paint(e.getterForPriceScaleInvalidationLevelBySide("left")),this._rhsPriceAxisesContainer.paint(e.getterForPriceScaleInvalidationLevelBySide("right")),t===ve.InvalidationLevel.None)return;const i=this._state&&(this._state.maximized().value()||!this._state.collapsed().value());if(t>ve.InvalidationLevel.Cursor){const e=(0,n.ensureNotNull)(this._canvasBinding.canvasElement.getContext("2d"));e.setTransform(1,0,0,1,0,0);const t=(0,z.getBindingRenderingInfo)(this._canvasBinding);this._makeSureIsUpdated(t),this._drawBackground(e,t),i&&this._drawSources(e,t)}if(null!==this._state){const e=(0,n.ensureNotNull)(this._topCanvasBinding.canvasElement.getContext("2d"));e.setTransform(1,0,0,1,0,0);const t=(0,z.getBindingRenderingInfo)(this._topCanvasBinding);e.clearRect(0,0,t.bitmapSize.width,t.bitmapSize.height),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,oi.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,oi.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,je.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()?vi:fi,solutionId:null==e?void 0:e.solutionId,rawHtml:null==e?void 0:e.rawHtml,
buttons:this.containsMainSeries()?null==e?void 0:e.buttons:void 0,maxWidth:null==e?void 0:e.maxWidth,maxHeight:null==e?void 0:e.maxHeight,zeroHeight:null==e?void 0:e.zeroHeight})}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)}_tryExitTrackingMode(e){this._exitTrackingModeOnNextTry&&(this._startTrackPoint=null,e||this._clearCursorPosition())}_tryStartMeasure(e,t,i,s,r){return!(!(0,je.toolIsMeasure)(je.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,je.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"===je.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,n.ensureNotNull)(t.mainDataSource()).firstValue(),r=i.coordinateToPrice(e.localY,(0,n.ensureNotNull)(s)),o=this._chartUndoModel(),a=Math.round(o.timeScale().coordinateToIndex(e.localX)),l=(0,n.ensureNotNull)(this._firstZoomPoint);a!==l.index&&o.zoomToViewport(l.index,a,l.price,r,t),this._chartModel().crossHairSource().clearSelection(),this._firstZoomPoint=null,(0,je.resetToCursor)(),this._preventCrossHairMove()&&this._clearCursorPosition()}_tryFinishZoom(e){return null!==this._firstZoomPoint&&(this._finishZoom(e),!0)}_tryHandleEraserMouseDown(e,t){if(!("eraser"!==je.tool.value()||e.isCustom||(i=e.source,i&&i.customization&&i.customization.disableErasing))){const i=this._chartUndoModel();if((0,J.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 r,o,a;if(e.isTouch&&null!==this._startTrackPoint)return!1;const l=t.hittest;if((!e.isTouch||!this._preventSourceChange)&&l&&(0,J.isLineTool)(t.source)&&l.target()===We.HitTarget.ChangePoint){const c=this._chartUndoModel(),h=(0,n.ensure)(null===(r=this.state().mainDataSource())||void 0===r?void 0:r.firstValue()),d=(0,n.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 Oe.Point(e.localX,e.localY),!0}return!1}_tryFinishClonning(e,t,i){const s=this._chartUndoModel(),r=this._chartModel();if(t.mod()&&this._clonningAtMoveLineTools){const o=new Oe.Point(e.localX,e.localY),a=(0,n.ensureNotNull)(this._startCloningPoint).subtract(o).length(),l=[];for(const e of this._clonningAtMoveLineTools){const t=r.dataSourceForId(e);null!==t&&l.push(t)}if(0===l.length)return!1;if(a>8){const r=this.cloneLineTools(l,!0).map((e=>(0,n.ensureNotNull)(s.model().dataSourceForId(e))));s.selectionMacro((e=>{e.clearSelection();let t=null;r.forEach((s=>{null===t&&(t=Ii(i,s)),e.addSourceToSelection(s,t)}))}));const o=new Oe.Point(e.localX,e.localY),a=(0,n.ensureNotNull)(r[0].priceScale()),c=(0,n.ensureNotNull)(this.state().mainDataSource()).firstValue(),h={index:s.timeScale().coordinateToIndex(e.localX),price:a.coordinateToPrice(e.localY,(0,n.ensureNotNull)(c))};s.startMovingSources(r,{logical:h,screen:o},null,t),this._clonningAtMoveLineTools=null,this._startCloningPoint=null}return!0}return!1}_mouseDownEventForLineTool(e,t,i,s){var r,o;const a=je.tool.value();if(!this.hasState()||(0,oi.isLineToolDrawWithoutPoints)(a))return;const l=this._chartUndoModel();let c=!1,h=null;(0,je.hideAllDrawings)().value()&&(0,y.toggleHideMode)(),(0,je.lockDrawings)().setValue(!1),e.isTouch&&!e.stylus&&((0,oi.isLineToolName)(a)&&!(0,oi.isLineDrawnWithPressedButton)(a)||l.lineBeingCreated())&&this._initToolCreationModeParams(e);const d=l.lineBeingCreated();if(d&&!(0,oi.isLineDrawnWithPressedButton)(d.toolname)){const a=(0,n.ensure)(null===(r=d.ownerSource())||void 0===r?void 0:r.firstValue());if(e.isTouch&&!e.stylus){if(!this._startTouchPoint){this._startTouchPoint=new Oe.Point(e.pageX,e.pageY);const t=d.points(),i=t[t.length-1],s=l.timeScale().indexToCoordinate(i.index),r=(0,n.ensureNotNull)(d.priceScale()).priceToCoordinate(i.price,a);return void(this._initCrossHairPosition=new Oe.Point(s,r))}}else if(!e.isTouch){h=d;const r=l.model().paneForSource(d);if(r!==this._state&&null!==r){const i=this._externalPaneXCoord(r,e.localX),s=this._externalPaneYCoord(r,e.localY);c=l.continueCreatingLine({index:Math.round(l.timeScale().coordinateToIndex(i)),price:(0,
n.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,oi.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,n.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()>=We.HitTarget.MovePointBackground:t.hittest.target()>We.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,u.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,li.hide)(t);if(this._prevTooltipData&&(0,Be.default)(i,this._prevTooltipData))return;this._prevTooltipData=i;const s=(0,P.clone)(i);if(void 0!==s.rect){const e=this._paneCell.getBoundingClientRect();s.rect.x+=e.left,s.rect.y+=e.top}(0,li.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();Ei={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);if(null!==t){const i=this._sourceWasSelected(t);t.hittest.tryCallMouseUpOrTouchEndHandler(e,{sourceWasSelected:i})}}_crossHairShouldBeVisible(){const e=this._chartModel().crossHairSource();return(0,oi.isLineToolName)(je.tool.value())||(0,je.toolIsMeasure)(je.tool.value())||e.startMeasurePoint()&&!e.endMeasurePoint()||null!==this._firstZoomPoint||null!==this._chartModel().lineBeingEdited()||null!==this._chartModel().lineBeingCreated()}_clearCursorPosition(){Ei=null,this._chartModel().clearCurrentPosition()}_dataSourceAtPoint(e,t){var i,s;if(!this.hasState())return null;const r={
result:null},n=this._chartUndoModel();if((0,oi.isLineToolName)(je.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=(0,z.getBindingRenderingInfo)(this._canvasBinding);this._makeSureIsUpdated(l);const c=Mi.bind(null,r),h=new Oe.Point(e,t);if(!a.maximized().value()&&a.collapsed().value()||(0,ye.lastMouseOrTouchEventInfo)().isTouch&&(je.activePointSelectionMode.value()!==je.SelectPointMode.None||null!==this._startTrackPoint))return this._hitTestSources(l,[n.crossHairSource()],h,c,!1,o),r.result;const d=a.sourcesByGroup(),u=n.selection(),p=u.dataSources().filter((e=>e.isMultiPaneEnabled()||n.paneForSource(e)===a));this._hitTestSources(l,p,h,c,!1,o),this._hitTestSources(l,u.customSources(),h,c,!0,o),u.allSources().forEach((e=>o.add(e.id()))),this._hitTestSources(l,[n.crossHairSource()],h,c,!1,o),this._hitTestSources(l,a.customSources(He.CustomSourceLayer.Topmost),h,c,!0,o),this._hitTestSources(l,d.tradingSources(),h,c,!1,o),this._hitTestSources(l,a.customSources(He.CustomSourceLayer.Foreground),h,c,!0,o);const _=d.hitTestSources();if(this._hitTestSources(l,_,h,c,!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);if(null!==i){const t=i.hitTest(h,l);t&&Mi(r,t,e,i,!1)}}}}return null===r.result&&this._hitTestSources(l,a.customSources(He.CustomSourceLayer.Background),h,c,!0,o),r.result}_sourceWasSelected(e){return!!e&&this._selectionBeforeMouseDown.has(e.source)}_hitTestSources(e,t,i,s,r,o){const a=(0,n.ensureNotNull)(this._state);for(let n=t.length-1;n>=0;--n){const l=t[n];if(o.has(l.id()))continue;const c=l.paneViews(a);if(null!==c&&0!==c.length)for(let t=c.length-1;t>=0;--t){const n=c[t].renderer(e);if(n&&n.hitTest){const t=n.hitTest(i,e);null!==t&&s(t,l,n,r)}}}}_tryStartMovingLineTool(e,t,i,s){var r;if(null===t.source||!t.source.movable()||null!==this._startTrackPoint)return!1;if(!this._preventSourceChange){const o=this._chartUndoModel(),a=(0,n.ensureNotNull)((0,n.ensureNotNull)(this._state).mainDataSource()).firstValue(),l=(0,n.ensureNotNull)(t.source.priceScale()),c=null===a?NaN:l.coordinateToPrice(e.localY,a);let h=(t.source.isSelectionEnabled()?o.selection().allSources():[t.source]).filter(hi);const d=h.filter(J.isLineTool);h=d.length>0?d:h.includes(t.source)?[t.source]:[h[0]];const u=new Oe.Point(e.localX,e.localY),p={index:s,price:c
},_=null===(r=t.hittest.data())||void 0===r?void 0:r.activeItem;return this._startMoveSourceParams={source:h,startPoint:{logical:p,screen:u},activeItem:void 0===_?null:_,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,n.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,n.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();let s=this.state().defaultPriceScale();if(this._startScrollingPos&&!this._isScrolling&&(this._startScrollingPos.x!==e.clientX||this._startScrollingPos.y!==e.clientY))return i.beginUndoMacro(yi),null===this._scrollXAnimation&&this._options.useKineticScroll&&(this._scrollXAnimation=new Kt(.2,7,.997,15),this._scrollXAnimation.addPosition(e.clientX,this._startScrollingPos.timestamp)),i.selection().isEmpty()||(s=i.selection().allSources()[0].priceScale()),null===s||s.isEmpty()||(this._scrollPriceScale=s,i.startScrollPrice(this.state(),s,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(e.clientX,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();return null!==this._scrollXAnimation&&(this._scrollXAnimation.start(e.clientX,i),this._scrollXAnimation.finished(i)||(this._chartModel().stopTimeScaleAnimation(),this._chartModel().setTimeScaleAnimation(this._scrollXAnimation),this._scrollXAnimation=null)),t}_preventScroll(){return this._trackCrosshairOnlyAfterLongTap&&this._longTap||this._contextMenuOpenedOnLastTap||(0,
oi.isLineToolName)(je.tool.value())||Boolean(this._chartUndoModel().lineBeingCreated())||null!==this._startTrackPoint||this._preventScrollUntilNextMouseDownOrTouchStart}_isSelectPointModeEnabled(){return this._chartUndoModel().crossHairSource().selectPointMode().value()!==je.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===je.tool.value()&&(0,je.resetToCursor)(),this._preventCrossHairMove()&&this._clearCursorPosition(),i.selectionMacro((i=>{i.addSourceToSelection(e,Ii(t,e))})),(0,J.isEditableTextLineTool)(e)&&e.activateEditingOnCreation())e.activateTextEditingOn(this._div,!0);else if((0,oi.isTextToolName)(s)){const t=i.createUndoCheckpoint();this._chart.showChartPropertiesForSource(e,K.TabNames.text,void 0,t)}this._lastFinishedToolId=e.id(),(0,l.emit)("drawing_event",e.id(),"create"),ni()}_alignSourcesThatBeingMoved(e,t,i,s,r){const n=this._chartUndoModel(),o=2===r?NaN:n.timeScale().coordinateToIndex(t);n.model().sourcesBeingMoved().forEach((e=>{var a;let l=o,c=e.convertYCoordinateToPriceForMoving(i,this.state().mainDataSource());if(null===c){if(1!==r)return;c=NaN}if((0,Z.isStudy)(e)){const e=n.mainSeries(),t=e.bars().firstIndex(),i=e.bars().lastIndex();null!==t&&null!==i&&2!==r&&(l=Math.min(Math.max(o,t),i)),1!==r&&(c=this._chartModel().magnet().align(c,o,this.state()))}null!==this._currentMovingHitTest&&void 0!==(null===(a=this._currentMovingHitTest.sourceAtPoint.hittest.data())||void 0===a?void 0:a.cursorType)||this.setCursorForTool(),n.moveSources({screen:new Oe.Point(t,i),logical:{index:l,price:c}},s)}))}_resetMeasureIfRequired(){this._needResetMeasureLater&&((0,je.resetToCursor)(),this._needResetMeasureLater=!1)}_makeSureIsUpdated(e){var t;const i=this.state(),s=[...i.dataSources(),...i.customSources()];for(const r of s){const s=r.paneViews(i);if(null!==s)for(const i of s)null===(t=i.makeSureIsUpdated)||void 0===t||t.call(i,e)}}_drawBackground(e,t){const i=this._chartModel(),s=i.backgroundTopColor().value(),r=i.backgroundColor().value();s===r?(0,z.clearRect)(e,0,0,t.bitmapSize.width,t.bitmapSize.height,r):(0,qe.clearRectWithGradient)(e,0,0,t.bitmapSize.width,t.bitmapSize.height,s,r)}_drawWatermark(e,t){const i=this._chartModel().watermarkSource();if(null===i)return;if(!this.state().containsMainSeries())return;const s=i.paneViews();for(const i of s){e.save();const s=i.renderer(t);s&&s.draw(e,t),e.restore()}}_drawCrossHair(e,t){const i=this._chartUndoModel().crossHairSource();i.invalidateLockPosition(),i.visible||null===je.crosshairLock.value()||i.updateAllViews((0,pi.sourceChangeEvent)(i.id())),this._drawSourceImpl(e,t,Ci,wi,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,
Ue.isDataSource)(r)&&r.isMultiPaneEnabled())&&this._drawSourceImpl(e,t,Ci,wi,r)}}_drawTopViews(e,t){for(const i of this.state().sourcesByGroup().all())i.topPaneViews&&this._drawSourceImpl(e,t,Pi,wi,i)}_drawSources(e,t){const i=this.state(),s=i.model(),r=i.sourcesByGroup(),n=r.tradingSources(),o=r.generalSources(),a=r.phantomSources(),l=i.customSources(He.CustomSourceLayer.Background).slice(),c=i.customSources(He.CustomSourceLayer.Foreground).slice(),h=i.customSources(He.CustomSourceLayer.Topmost).slice(),d=s.activeStrategySource().value(),u=s.replayStudyStrategy().value();{const e=s.panes();for(let t=e.length-1;t>=0;t--)e[t].createDrawingsCaches()}this._drawSourceImpl(e,t,Ci,wi,s.gridSource()),this._drawWatermark(e,t);for(const i of l)this._drawSourceImpl(e,t,Ci,bi,i);for(const i of o)this._drawSourceImpl(e,t,Ci,bi,i);for(const i of c)this._drawSourceImpl(e,t,Ci,bi,i);for(const i of a)this._drawSourceImpl(e,t,Ci,bi,i);const p=new Set;[s.lineBeingCreated(),s.lineBeingEdited(),...s.sourcesBeingMoved(),s.customSourceBeingMoved()].filter(P.notNull).forEach((e=>p.add(e.id())));let _=s.hoveredSource();null!==_&&((0,Ue.isDataSource)(_)&&!_.showOnTopOnHovering()||p.has(_.id())||(0,Ue.isDataSource)(_)&&!o.includes(_)?_=null:p.add(_.id()));const m=s.selection().allSources().filter((e=>!((0,Ue.isDataSource)(e)&&!o.includes(e))&&!p.has(e.id())));m.forEach((e=>p.add(e.id())));for(const i of l)this._drawSourceImpl(e,t,Ci,wi,i,p);for(const i of o)this._drawSourceImpl(e,t,Ci,wi,i,p);for(const i of c)this._drawSourceImpl(e,t,Ci,wi,i,p);d&&this.containsMainSeries()&&this._drawSourceImpl(e,t,Ti,wi,d,p),u&&this._drawSourceImpl(e,t,Ti,wi,u,p);for(const i of n)this._drawSourceImpl(e,t,Ci,bi,i);for(const i of h)this._drawSourceImpl(e,t,Ci,bi,i);for(const i of o)this._drawSourceImpl(e,t,xi,wi,i,p);for(const i of c)this._drawSourceImpl(e,t,xi,wi,i,p);for(const i of n)this._drawSourceImpl(e,t,Ci,wi,i,p);for(const i of h)this._drawSourceImpl(e,t,Ci,wi,i,p);for(const i of m)this._drawSourceImpl(e,t,Ci,wi,i),i===d&&this.containsMainSeries()&&this._drawSourceImpl(e,t,Ti,wi,d);for(const i of m)this._drawSourceImpl(e,t,xi,wi,i);_&&(this._drawSourceImpl(e,t,Ci,wi,_),_===d&&this.containsMainSeries()&&this._drawSourceImpl(e,t,Ti,wi,d),this._drawSourceImpl(e,t,xi,wi,_));for(const i of a)this._drawSourceImpl(e,t,Ci,wi,i,p);{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=i(r,this.state());if(o)for(const i of o){const r=i.renderer(t);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 Ge.UndoMacroCommand))return!1;if(t.isEmpty())return!1;const i=t.commands()[0];return i instanceof ti||i instanceof Xt}_onStateDestroyed(){this.setState(null)}
_onDataSourcesCollectionChanged(){this._startMoveSourceParams=null}_processMouseEnterLeaveMoveHandlers(e,t){var i,s,r,n;if(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))){const e=this._sourceWasSelected(this._prevHoveredHittest);(0,We.tryCallHandler)(t,{sourceWasSelected:e},null===(r=this._prevHoveredHittest.hittest.data())||void 0===r?void 0:r.mouseLeaveHandler),this._prevHoveredHittest=null}if(!t.isTouch&&null!==e){const i=this._sourceWasSelected(e);(null===(n=this._prevHoveredHittest)||void 0===n?void 0:n.renderer)!==e.renderer&&(e.hittest.tryCallMouseEnterHandler(t,{sourceWasSelected:i}),this._prevHoveredHittest=e),e.hittest.tryCallMouseMoveHandler(t,{sourceWasSelected:i})}}_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((0,z.getBindingRenderingInfo)(this._canvasBinding),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}async showConfetti(e,t){0}_mouseClickOrTapEvent(e){var t;if(!this.hasState())return;const i=this._dataSourceAtPoint(e.localX,e.localY),s=i&&i.source,r=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||r.crossHairSource().trySelectCurrentPoint();const a=this._sourceWasSelected(i);null!==i&&i.hittest.tryCallClickOrTapHandler(e,{sourceWasSelected:a})&&r.model().updateSource((0,n.ensureNotNull)(s)),!e.isTouch||this._isSelectPointModeEnabled()||i&&i.source===r.crossHairSource()||this._tryExitTrackingMode(),s&&(0,J.isLineTool)(s)&&this._lastFinishedToolId!==s.id()&&(0,l.emit)("drawing_event",s.id(),"click"),this._resetMeasureIfRequired()}_mouseDownOrTouchStartEvent(e,t){var i,s,r,o,a,c,h;this._pressedMoveStage=1,
this._preventScrollUntilNextMouseDownOrTouchStart=!1,this._selectionBeforeMouseDown=new Set(this._chartModel().selection().allSources()),e.isTouch&&(this._longTap=!1,this._exitTrackingModeOnNextTry=null!==this._startTrackPoint,this._paneWidgetsSharedState.clearDraggingSource()),this._contextMenuOpenedOnLastTap=!1,this._lastFinishedToolId=null;const d=this._chartModel();if(d.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,l.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 u=this._chartUndoModel(),p=new ze.EnvironmentState(e);u.mainSeries().clearGotoDateResult();const _=this.state().defaultPriceScale();if(u.timeScale().isEmpty())return;const m=u.crossHairSource();if(!e.isTouch&&!(0,oi.isLineDrawnWithPressedButton)(je.tool.value())){const t=u.lineBeingCreated(),i=null!==t?u.model().paneForSource(t):null;null!==i&&i!==this._state?this._setCursorPositionOnExternalPane(i,e.localX,e.localY,p):this.setCursorPosition(e.localX,e.localY,p)}e.isTouch&&(0,oi.isLineToolName)(je.tool.value())&&((0,oi.isLineDrawnWithPressedButton)(je.tool.value())||null!==m.pane?(0,oi.isLineDrawnWithPressedButton)(je.tool.value())&&this._clearCursorPosition():this._chart.updateCrossHairPositionIfNeeded());const g=(0,n.ensureNotNull)(this.state().mainDataSource()).firstValue();let f=null==g?null:_.coordinateToPrice(e.localY,g),v=d.timeScale().coordinateToIndex(e.localX);if(m.startMeasurePoint()&&m.endMeasurePoint()&&m.clearMeasure(),p.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,je.toolIsCursor)(je.tool.value())&&u.selection().isEmpty()&&je.tool.setValue("measure"),(e.isTouch&&!e.stylus||null===f||!this._tryStartMeasure(e,m,p,f,v))&&(e.isTouch&&!e.stylus||!this._tryFinishMeasure(e,m))&&!(this._tryFinishZoom(e)||null!==f&&this._tryStartZoom(e,f,v,p))){if(e.isTouch&&(null!==this._startTrackPoint?(this._initCrossHairPosition=m.currentPoint(),this._startTrackPoint=new Oe.Point(e.localX,e.localY)):this._isSelectPointModeEnabled()&&null===this._chart.trackingModePaneWidget()&&this.startTrackingMode(new Oe.Point(e.localX,e.localY),new Oe.Point(e.localX,e.localY),new ze.EnvironmentState(e))),e.isTouch&&(this._preventSourceChange=null===t||!u.selection().isSelected(t.source)),!this._isSelectPointModeEnabled()&&!this._isScrolling){if(e.isTouch&&!e.stylus&&((0,je.toolIsMeasure)(je.tool.value())||null!==m.measurePane().value()))return void this._initToolCreationModeParams(e);if(null!==f&&((0,oi.isLineToolName)(je.tool.value())||u.lineBeingCreated()))return p.shift()||u.selectionMacro((e=>e.clearSelection())),void this._mouseDownEventForLineTool(e,p,v,f)}
if(null!==t){const i=this._sourceWasSelected(t);t.hittest.tryCallMouseDownOrTouchStartHandler(e,{sourceWasSelected:i})}if(!this._chart.readOnly()){const i=this._handleSelectionMouseDownAndGetJustDeselectedSource(e,t,p);if(null!==t&&!this._preventSourceChange){const i=t.hittest.data();if(t.isCustom){if(t.hittest.hasPressedMoveHandler(e))return u.model().setMovingCustomSource(t.source,i),this._preventScrollUntilNextMouseDownOrTouchStart=!0,this._currentMovingHitTest={sourceAtPoint:t,cancelledContainer:null!==(r=u.model().customSourceMovingHitTestData())&&void 0!==r?r:void 0},void u.selectionMacro((e=>{e.clearSelection(),e.addSourceToSelection((0,n.ensureNotNull)(t.source),(0,n.ensureNotNull)(i))}))}else if((null==i?void 0:i.areaName)===We.AreaName.SourceItemMove){const s=null==i?void 0:i.activeItem;if(void 0!==s)return u.startCustomMoving(t.source,s,e),this._currentMovingHitTest={sourceAtPoint:t},void u.selectionMacro((e=>{e.clearSelection(),e.addSourceToSelection((0,n.ensureNotNull)(t.source),(0,n.ensureNotNull)(i))}))}}if(null!==t&&this._tryHandleEraserMouseDown(t,p))return;const s=null!==t&&(0,J.isLineTool)(t.source)&&t.source.isLocked&&t.source.isLocked();if(!((0,je.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,r=null===(a=t.hittest.data())||void 0===a?void 0:a.snappingIndex;let l=e.localY,h=e.localX;if(void 0!==s&&null!==g&&(l=(0,n.ensure)(null===(c=t.source)||void 0===c?void 0:c.priceScale()).priceToCoordinate(s,g),f=s),void 0!==r&&(h=d.timeScale().indexToCoordinate(r),v=r),l===e.localY&&h===e.localX||(e={...e,localY:l,localX:h},this.setCursorPosition(e.localX,e.localY,p)),this._tryStartChangingLineTool(e,t,p,v))return void(this._currentChangingLineToolHitTest=t);if(this._currentChangingLineToolHitTest=null,(y=t.hittest.target())===We.HitTarget.MovePoint||y===We.HitTarget.MovePointBackground&&(0,ye.lastMouseOrTouchEventInfo)().isTouch){if(this._tryStartCloning(e,t,p,i))return;if(this._tryStartMovingLineTool(e,t,p,v))return void(this._currentMovingHitTest={sourceAtPoint:t});this._currentMovingHitTest=null}}if(null!==t&&(0,si.isPriceDataSource)(t.source)&&t.source.isDraggable()&&(null===(h=this._state)||void 0===h?void 0:h.hasDataSource(t.source))&&this._paneWidgetsSharedState.trySetDraggingSource(t.source,this))return}var y;null!==t&&t.hittest.target()===We.HitTarget.Regular||(this._processing=!0)}}_mouseUpOrTouchEndEvent(e){var t,i;if(!this.hasState())return;this._pressedMoveStage=0;const s=e.isTouch&&null!==this._startTrackPoint,r=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(),a=o.model().customSourceMovingHitTestData();null!==a||o.customMoveBeingProcessed()||this._processMouseUpOrTouchEndHandler(e),this._isSelecting=!1
;const c=o.model(),h=c.crossHairSource(),d=this._dataSourceAtPoint(e.localX,e.localY);if(h.selection()&&null===this._firstZoomPoint){const e=this.state().lineToolsForArea(h.selection(),(0,z.getBindingRenderingInfo)(this._canvasBinding));o.selectionMacro((t=>{let i=null;e.forEach((e=>{null===i&&(i=Ii(d,e)),t.addSourceToSelection(e,i)}))})),h.clearSelection(),(0,u.trackEvent)("GUI","Multiselect","Area Select")}(0,l.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 ze.EnvironmentState(e),m=je.tool.value();if(e.isTouch&&((0,je.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,oi.isLineDrawnWithPressedButton)(m)&&(0,oi.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(),r=(0,n.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,r)},l=(0,n.ensureNotNull)(o.createLineTool({pane:this.state(),point:a,linetool:m}));return o.selectionMacro((e=>{e.addSourceToSelection(l)})),o.lineBeingCreated()||(this._finishTool(l,d),e.preventDefault()),void(this._startTouchPoint=null)}const g=o.lineBeingCreated();if(g&&!(0,oi.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 ze.EnvironmentState(e));this._initCrossHairPosition=null,i&&(this._finishTool(g,d),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!==a){if(a.beingMoved&&!a.cancelled){const t=this._sourceWasSelected(d);(0,We.tryCallHandler)(e,{sourceWasSelected:t},a.mouseUpHandler,a.touchEndHandler),this.setCursorForTool()}if(c.setMovingCustomSource(null,null),Vi(e,a))return}if(c.lineBeingEdited())return o.endChangingLinetool(!1),void(this._preventCrossHairMove()&&this._clearCursorPosition());if((0,oi.isLineDrawnWithPressedButton)(m)&&!this._isSelectPointModeEnabled()){const t=o.lineBeingCreated();null!==t&&(ni(),t.finish(),"LineToolBrush"===t.toolname&&(0,l.emit)("drawing_event",t.id(),"create"));const s=this.state().defaultPriceScale();if(s.isEmpty())return;if(!t)return;const r=(0,n.ensure)(null===(i=t.ownerSource())||void 0===i?void 0:i.firstValue()),a=s.coordinateToPrice(e.localY,r),c={
index:Math.round(o.timeScale().coordinateToIndex(e.localX)),price:a};return void o.continueCreatingLine(c)}if(c.sourcesBeingMoved().length)return o.endMovingSource(!1,!1),c.sourcesBeingMoved().filter(J.isLineTool).forEach((e=>{this.setCursorForTool(e)})),void c.invalidate(ve.InvalidationMask.cursor());if(!this._chart.readOnly()){const t=e.localX>=0&&e.localX<this._size.width;if((!d||d.source!==h)&&t){const t=o.timeScale().coordinateToIndex(e.localX);c.onSyncScrollNeeded(t)}}const f=this._isScrolling,v=this._endScroll(e),y=this._paneWidgetsSharedState.draggingSource();if(null!==y){const t=e.target,i=this._chart.paneByCanvas(t);i&&i!==this&&(v&&o.undoHistory().undo(),o.mergeToPane(y,i.state()));if(this._chart.timeAxisByCanvas(t))if(c.isUnmergeAvailableForSource(y))v&&o.undoHistory().undo(),o.unmergeToNewBottomPane(y);else{const e=c.panes(),t=(0,n.ensureNotNull)(c.paneForSource(y)),i=e.indexOf(t);i!==e.length-1&&(v&&o.undoHistory().undo(),t.maximized().value()&&this._chart.toggleMaximizePane(null),o.movePane(i,e.length-1))}this._paneWidgetsSharedState.clearDraggingSource();const s=this._chart.getTimeScale();s&&s.restoreDefaultCursor();const r=this._chart.paneWidgets();for(let e=0;e<r.length;e++){const t=r[e];t===this&&d&&!d.isCustom?t.setCursorForTool(d.source||void 0):t.setCursorForTool(),t.leftPriceAxisesContainer().restoreDefaultCursor(),t.rightPriceAxisesContainer().restoreDefaultCursor()}}this._chart.readOnly()||s||_.mod()||f||r||null!==this._lastFinishedToolId||null!==d&&(d.hittest.target()>We.HitTarget.MovePointBackground||(0,ye.lastMouseOrTouchEventInfo)().isTouch)&&o.selectionMacro((e=>{e.clearSelection();const t=(0,n.ensureNotNull)(d.source);e.addSourceToSelection(t,Ii(d,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 Oe.Point(s,r);const n=new ze.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,i;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 s=new ze.EnvironmentState(e),r=this._chartUndoModel(),o=r.crossHairSource(),a=e.localX,l=e.localY;if(this._prevMoveEventPosition=new Oe.Point(a,l),null!==this._firstZoomPoint)return this._processMouseMoveWhileZoom(e),void(this._firstZoomPoint.draggingMode=!0);const c=je.tool.value();if(e.isTouch&&this._startTouchPoint&&(0,oi.isLineToolName)(c)&&!(0,
oi.isLineDrawnWithPressedButton)(c)&&!r.lineBeingCreated()&&!this._isSelectPointModeEnabled())return void this._updateCrosshairPositionInToolCreationMode(e,this.state());const h=o.measurePane().value();if(e.isTouch&&(this._startTouchPoint||e.stylus)&&((0,je.toolIsMeasure)(c)||null!==h))return void(e.stylus?this.setCursorPosition(e.localX,e.localY,new ze.EnvironmentState(e)):this._updateCrosshairPositionInToolCreationMode(e,h||this.state()));const d=r.lineBeingCreated();if(e.isTouch&&!e.stylus&&d&&!(0,oi.isLineDrawnWithPressedButton)(d.toolname)){if(this._startTouchPoint){const t=(0,n.ensureNotNull)(r.lineBeingCreated()),i=(0,n.ensureNotNull)(r.model().paneForSource(t));this._updateCrosshairPositionInToolCreationMode(e,i)}return}if(e.isTouch&&null!==this._startTrackPoint){this._exitTrackingModeOnNextTry=!1;const e=(0,n.ensureNotNull)(this._initCrossHairPosition),t=new Oe.Point(a,l).subtract(this._startTrackPoint),i=e.add(t);this.setCursorPosition(i.x,i.y,s)}else e.isTouch&&this._preventCrossHairMove()||this.setCursorPosition(a,l,s);const u=this._isSelectPointModeEnabled();if((0,oi.isLineToolName)(c)&&!(0,oi.isLineDrawnWithPressedButton)(c)&&!u&&!s.mod())return;if((0,oi.isLineDrawnWithPressedButton)(c)&&!u){const i=this.state().defaultPriceScale();if(i.isEmpty())return;const s=r.lineBeingCreated();if(!s)return;const o=new Oe.Point(e.localX,e.localY),a=(0,n.ensure)(null===(t=s.ownerSource())||void 0===t?void 0:t.firstValue());return o.price=i.coordinateToPrice(e.localY,a),o.index=Math.round(r.timeScale().coordinateToIndex(e.localX)),void r.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(r.timeScale().isEmpty())return;const p=this._options.handleScroll;if((!p.pressedMouseMove||e.isTouch)&&(!p.horzTouchDrag&&!p.vertTouchDrag||!e.isTouch))return;if(r.customMoveBeingProcessed())return void r.processCustomMove(e);const _=r.model().customSourceMovingHitTestData();if(null!==_&&(this._updateCommonTooltip(null,!0),_.cancelled||(r.model().processingCustomSourceMove(),(0,We.tryCallHandler)(e,{sourceWasSelected:this._selectionBeforeMouseDown.has(r.model().customSourceBeingMoved())},_.pressedMouseMoveHandler,_.touchMoveHandler)),Vi(e,_)))return;if(r.model().lineBeingEdited())return void this.setCursorPosition(a,l,s);if(r.model().sourcesBeingMoved().length)return void this._alignSourcesThatBeingMoved(r.model().sourcesBeingMoved(),e.localX,e.localY,s,null===(i=r.model().lastHittestData())||void 0===i?void 0:i.possibleMovingDirections);const m=this._dataSourceAtPoint(e.localX,e.localY);if(this._tryFinishClonning(e,new ze.EnvironmentState(e),m))return;const g=(0,je.toolIsMeasure)(c)||o.startMeasurePoint()&&o.endMeasurePoint();this._chart.readOnly()||!s.mod()||(0,oi.isLineToolName)(c)||g||u?(this._processScroll(e),
this._preventScroll()&&!this._preventCrossHairMove()&&null===this._startTrackPoint&&this.setCursorPosition(e.localX,e.localY,new ze.EnvironmentState(e))):this._isSelecting||(o.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();if(this._chartModel().setHoveredSource(null,null),null!==this._prevHoveredHittest){const i=this._sourceWasSelected(this._prevHoveredHittest);(0,We.tryCallHandler)(e,{sourceWasSelected:i},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,oi.isLineToolName)(je.tool.value())&&this._dataSourceAtPoint(e.localX,e.localY)||null,i=this._sourceWasSelected(t);if(null!==t&&t.isCustom)t.hittest.tryCallDblClickOrDblTapHandler(e,{sourceWasSelected:i});else if(null!==t&&(e.isTouch||t.hittest.target()>We.HitTarget.MovePointBackground))t.hittest.tryCallDblClickOrDblTapHandler(e,{sourceWasSelected:i})&&!(0,We.shouldDefaultActionBeExecuted)(e,(0,n.ensureNotNull)(t.hittest.data()),"doubleClickHandler","doubleTapHandler")||this.processDoubleClickOnSource(t.source,t.hittest?t.hittest:void 0);else if(!this._chart.readOnly()&&!(0,oi.isLineToolName)(je.tool.value())&&!this._chartUndoModel().lineBeingCreated()&&this._chartUndoModel().selection().isEmpty()){const t=this.state();new ze.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,je.resetToCursor)(!0);if(this._pinching)return;if(null===this._firstZoomPoint||this._trackCrosshairOnlyAfterLongTap||this.cancelZoom(),!(0,je.toolIsCursor)(je.tool.value())||this._isSelectPointModeEnabled()){if(e.isTouch)return;return(0,je.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>=We.HitTarget.Regular||r>=We.HitTarget.MovePointBackground&&e.isTouch;if(this._chart.updateActions(),t.selectionMacro((t=>{null!==s&&n?t.selection().isSelected(s)||(t.clearSelection(),
t.addSourceToSelection(s,Ii(i,s))):(this._options.contextMenu.general&&this._showContextMenu(e),t.clearSelection())})),null!==i&&n&&null!==s)if((0,Ue.isDataSource)(s)&&s.hasContextMenu())s.isSelectionEnabled()?this.showContextMenuForSelection(e,void 0,i.hittest):this.showContextMenuForSources([s],e,void 0,void 0,i.hittest);else{const t=this._sourceWasSelected(i);i.hittest.tryCallContextMenuHandler(e,{sourceWasSelected:t})}}_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 Oe.Point(e.localX,e.localY),new Oe.Point(i.x,e.localY),new ze.EnvironmentState(e))}}async _showContextMenu(e){const t=e=>e instanceof ht.Separator,i=this._customActions(),s=(await this._initActions(e)).filter((e=>null!==e));i.remove.forEach((e=>{for(let t=0;t<s.length;t++){const i=s[t];if(i instanceof ht.Action&&i.getLabel()===e){s.splice(t,1);break}}}));const r=i.top.concat(s).concat(i.bottom);for(let e=r.length-1;e>0;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),Ze.ContextMenuManager.showMenu(r,e,{statName:"ChartContextMenu"},{menuName:"ChartContextMenu"})}async _initActions(e){var t;const i=this._chart.actions(),s=[];if(this._chart.model().model().resetScalesAvailable().value()&&(s.push(i.chartReset),s.push(new ht.Separator)),!this.state().isEmpty()&&N.enabled("datasource_copypaste")){const t=(0,mt.createActionCopyPrice)(this.state(),e.localY),i=(0,mt.createPasteAction)(this._chart,this.state());(t||i)&&(t&&s.push(t),i&&s.push(i),s.push(new ht.Separator))}s[s.length-1]instanceof ht.Separator||s.push(new ht.Separator);return Boolean(null===(t=window.widgetbar)||void 0===t?void 0:t.widget("watchlist"))&&i.addToWatchlist&&s.push(i.addToWatchlist),N.enabled("text_notes")&&s.push(i.addToTextNotes),s[s.length-1]instanceof ht.Separator||s.push(new ht.Separator),s.push(this._createLockTimeAxisAction(e)),s.push(new ht.Separator),!N.enabled("charting_library_base")&&i.applyColorTheme&&s.push(i.applyColorTheme),s[s.length-1]instanceof ht.Separator||s.push(new ht.Separator),this._chart.applyIndicatorsToAllChartsAvailable()&&(s.push(i.applyStudiesToAllCharts),s.push(new ht.Separator)),s.push(i.paneRemoveAllDrawingTools),s.push(i.paneRemoveAllStudies),s.push(new ht.Separator),s.push(i.hideAllMarks),s.push(new ht.Separator),N.enabled("show_chart_property_page")&&s.push(i.chartProperties),s[s.length-1]instanceof ht.Separator&&s.pop(),s}_loadAndCreateLegendWidget(){Promise.all([i.e(2364),i.e(5514),i.e(1729),i.e(8073),i.e(3547),i.e(2153),i.e(2227),i.e(5715),i.e(5093)]).then(i.bind(i,8855)).then((e=>{if(this._isDestroyed)return;const t=e.LegendWidget,i=(0,Fe.deepExtend)({},this._options.legendWidget)
;i.canShowSourceCode=!this._chart.onWidget()&&!c.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,pineSourceStatusEnabled:this._options.pineSourceStatusEnabled};const s=(0,V.combine)(((e,t)=>ki&&this._chart!==e&&!t),this._chart.chartWidgetCollection().activeChartWidget.weakReference(),this._chart.chartWidgetCollection().lock.crosshair.weakReference()),r=(0,V.combine)(((e,t)=>null!==e?e===this._state:(0,je.toolIsMeasure)(t)),this._chartModel().crossHairSource().measurePane().weakReference(),je.tool.weakReference());this._legendWidget=new t(this._chartUndoModel(),this,this._chart.backgroundTopTheme().spawnOwnership(),s.ownership(),this._visuallyCollapsed.spawnOwnership(),r.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),onLegendRowFocused:()=>{this._chart.chartWidgetCollection().activeChartWidget.setValue(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,n.ensureDefined)(this._customLegendWidgetsFactoryMap.get(e)))}))}_loadAndCreatePaneControlsWidget(){Promise.all([i.e(2364),i.e(5514),i.e(1729),i.e(8073),i.e(3547),i.e(2153),i.e(2227),i.e(5715),i.e(5093)]).then(i.bind(i,61560)).then((e=>{var t;if(this._isDestroyed)return;const i=e.PaneControlsWidget;this._paneControls=new i(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 ResizeObserver(this._handleRestrictLegendWidth.bind(this)),this._paneControlsResizeObserver.observe(this._paneControls.getElement()),(null===(t=this._state)||void 0===t?void 0:t.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+mi+gi;this._legendWidget.addMargin(i)}_onMagnetStateChanged(){
this._chart.isActive().value()&&(this._isSelectPointModeEnabled()||this._isToolActionActiveOnPane(!0))&&this._chartModel().crossHairSource().visible&&this._updateLineToolUsingMagnetOrShift()}_onShiftKeyStateChanged(){this._chart.isActive().value()&&this._isToolActionActiveOnPane(!1)&&this._chartModel().crossHairSource().visible&&this._updateLineToolUsingMagnetOrShift(ze.EnvironmentState.create((0,U.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,oi.isLineToolName)(je.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?(je.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(K.TabNames.symbol);else if((0,J.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 Oe.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,r=e.pageY,o=(0,n.ensureNotNull)(this._initCrossHairPosition),a=new Oe.Point(s,r).subtract((0,n.ensureNotNull)(this._startTouchPoint)),l=o.add(a);this.setCursorPosition(l.x,l.y,new ze.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,J.isLineTool)(i)||t.recalculatePriceScale(i.priceScale(),e)}_createLockTimeAxisAction(e){var t;const i=0===(null===(t=je.crosshairLock.value())||void 0===t?void 0:t.type);return new ht.Action({actionId:"Chart.Crosshair.LockVerticalCursor",options:{label:Si,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 je.crosshairLock.setValue({type:0,time:s})}je.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,J.isLineTool)(e.source))||this._editDialog&&this._editDialog.visible().value())c&&(o.setHoveredSource(null,null),this.setCursorForTool());else{const h=je.tool.value();let d=null;if(!this._processing&&((0,je.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()>We.HitTarget.MovePointBackground?(d=l,!(null==l?void 0:l.isHoveredEnabled())||"eraser"===h&&l===n.mainSeries()?o.setHoveredSource(null,null):o.setHoveredSource(l,t.data(),0)):o.setHoveredSource(null,null)}c?this.setCursorForTool(d,t,ai.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 ai.PaneCursorType.VerticalResize:this._setCursorClassName("ns-resize");break;case ai.PaneCursorType.HorizontalResize:this._setCursorClassName("we-resize");break;case ai.PaneCursorType.DiagonalNeSwResize:this._setCursorClassName("nesw-resize");break;case ai.PaneCursorType.DiagonalNwSeResize:this._setCursorClassName("nwse-resize")}}}this._preventCrossHairMove()&&this._clearCursorPosition(),1!==this._pressedMoveStage&&o.crossHairSource().setLinesShouldBeHidden(a)}async _createErrorBlock(){const e=new(await ne());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(!N.enabled("custom_items_in_context_menu"))return e;const s=t.isEmpty()?void 0:t.indexToUserTime(t.coordinateToIndex(this._contextMenuX));let r;if(i&&!i.isEmpty()){const e=(0,n.ensureNotNull)(this.state().mainDataSource()).firstValue();r=i.coordinateToPrice(this._contextMenuY,(0,n.ensureNotNull)(e))}return(0,l.emit)("onContextMenu",{unixtime:null!=s?s.getTime()/1e3:void 0,price:r,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 ht.Separator:new ht.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,ui.getTranslatedResolutionModel)(e.interval()).hint,r=a.t(null,{replace:{symbol:t,interval:s}},i(1136));this._topCanvasBinding.canvasElement.setAttribute("aria-label",r)}else this._topCanvasBinding.canvasElement.setAttribute("aria-hidden","true")}async _updateEndOfSeriesBanner(){}}class Ni{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,n.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,n.assert)(null===e||null===this._scrollingPane||this._scrollingPane===e),this._scrollingPane=e}scrollingPane(){return this._scrollingPane}setPinchingPane(e){(0,n.assert)(null===e||null===this._pinchingPane||this._pinchingPane===e),this._pinchingPane=e}pinchingPane(){return this._pinchingPane}}var Oi,Fi=i(55158),Wi=i(95700);i(8406);!function(e){e[e.BorderSize=1]="BorderSize",e[e.OffsetSize=5]="OffsetSize"}(Oi||(Oi={}));const Hi={contextMenuEnabled:!0,timezoneMenuEnabled:!0,pressedMouseMoveScale:!0},zi=new W.TranslatedString("change session",a.t(null,void 0,i(87041))),Ui=a.t(null,void 0,i(94031));class ji{constructor(e,t,i,r,n){this._rendererOptions=null,this._onLabelHovered=new R.Delegate,this._mousedown=!1,this._currentCursorClassName="invalid",this._options=(0,P.merge)((0,P.clone)(Hi),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=e.model().model().rendererOptionsProvider(),a=()=>this.backgroundColor(),l=()=>{throw new Error("Time axis does not support real price scales")},c={titlesProvider:i,
stubContextMenuProvider:(e,t)=>{const i=r(e,t),s=this.getContextMenuActions(!0);return 0===s.length?i:i.concat(new ht.Separator,s)},backgroundBasedTheme:n.spawnOwnership(),onActiveOrHoveredChart:(0,V.combine)(((e,t)=>e||t),this.chart.isActive().weakReference(),this.chart.isHovered().weakReference()).ownership(),rendererOptionsProvider:o,getBackgroundTopColor:a,getBackgroundBottomColor:a,requestRepaint:()=>this.chart.model().model().lightUpdate(),showHorizontalBorder:!0};this._lhsStubContainer=new nt(this._properties,"left",l,c,this._options.priceAxisLabelsOptions,this),this._lhsStubContainer.onLabelHovered().subscribe(this,((e,t)=>{this._onLabelHovered.fire(e,t)})),this._rhsStubContainer=new nt(this._properties,"right",l,c,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,z.createBoundCanvas)(this._dv,(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,z.createBoundCanvas)(this._dv,(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",this._dv.setAttribute("aria-hidden","true"),this._element.appendChild(this._rhsStubContainer.getElement()),this.restoreDefaultCursor(),this.update(),this._minVisibleSpan=Fi.MINUTE_SPAN,this._mouseEventHandler=new ke.MouseEventHandler(this._topCanvasBinding.canvasElement,this,{treatVertTouchDragAsPageScroll:!0,treatHorzTouchDragAsPageScroll:!1}),this.size=(0,s.size)({width:0,height:0}),(0,je.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),this._backgroundBasedTheme.release(),(0,
je.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,$e.makeFont)(e,Je.CHART_FONT_FAMILY,""),widthCache:new Ye.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,Ae.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,$e.makeFont)(this.fontSize(),Je.CHART_FONT_FAMILY)}baseBoldFont(){return(0,$e.makeFont)(this.fontSize(),Je.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 ht.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 ht.Action({actionId:"Chart.SetSession",options:{label:(0,Wi.translateSessionDescription)(e.description),checkable:!0,checked:t.value()===e.id,statName:"SetSession",
onExecute:()=>{i.model().setProperty(t,e.id,zi)}}}))),n=new ht.Action({actionId:"Chart.SetSession",options:{label:Ui,statName:"SetSession",subItems:e}});r.push(n)}}}return!i.onWidget()&&N.enabled("show_chart_property_page")&&N.enabled("chart_property_page_scales")&&s.scalesProperties&&r.push(new ht.Separator,s.scalesProperties),r}update(){if(!this.chart.hasModel())return;const e=this.chart.model().timeScale().marks();if(e){this._minVisibleSpan=Fi.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,n.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===ve.InvalidationLevel.None||0===this.size.width||0===this.size.height)return;(0,z.tryApplySuggestedCanvasBitmapSize)(this._canvasBinding),(0,z.tryApplySuggestedCanvasBitmapSize)(this._topCanvasBinding);const t=(0,z.getContext2D)(this._topCanvasBinding.canvasElement);if(e>ve.InvalidationLevel.Cursor){const i=(0,z.getContext2D)(this._canvasBinding.canvasElement),s=(0,z.getBindingRenderingInfo)(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,z.getBindingRenderingInfo)(this._topCanvasBinding))}drawBackground(e,t){if((0,z.clearRect)(e,0,0,t.bitmapSize.width,t.bitmapSize.height,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._highlightBackground(e,s,t)}const s=i.model().crossHairSource();s.startMeasurePoint()&&this._highlightBackground(e,s.measurePoints(),t)}drawBorder(e,t){e.save(),e.fillStyle=this.lineColor();const i=Math.max(1,Math.floor(this.rendererOptions().borderSize*t.verticalPixelRatio)),s=t.bitmapSize.width;e.fillRect(0,0,s,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,z.drawScaled)(e,t.horizontalPixelRatio,t.verticalPixelRatio,(()=>{e.font=this.baseFont();for(let t=0;t<i.length;t++){const r=i[t];r.span<s&&e.fillText(r.label,r.coord,n)}e.font=this.baseBoldFont();for(let t=0;t<i.length;t++){const r=i[t];r.span>=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<n.length;i++){const r=n[i];if(!s.has(r)&&r.timeAxisViews){const i=r.timeAxisViews();if(i)for(let s=0;s<i.length;s++)i[s].renderer().draw(e,t,c)}}e.restore()}drawCrossHairLabel(e,t){var i;e.save(),e.clearRect(0,0,t.bitmapSize.width,t.bitmapSize.height);const s=this.chart.model().model(),r=[],n=null!==(i=s.lineBeingEdited())&&void 0!==i?i:s.lineBeingCreated();if(n&&n.timeAxisViews){const e=n.timeAxisViews();e&&e.length&&r.push(e)}const o=s.customSourceBeingMoved();this._addViewsOrMaxMin(null===o?[]:[o],r),this._addViewsOrMaxMin(s.sourcesBeingMoved(),r),this._addViewsOrMaxMin(s.selection().allSources(),r);const a=s.hoveredSource();if(a&&(0,Ue.isDataSource)(a)&&!s.selection().isSelected(a)&&a.timeAxisViews){const e=a.timeAxisViews();e&&e.length&&r.push(e)}const l=s.crossHairSource(),c=l.timeAxisViews&&l.timeAxisViews();c&&c.length&&r.push(c);const h=this.rendererOptions();for(const i of r)for(const s of i)e.save(),s.renderer().draw(e,t,h),e.restore();e.restore()}mouseDownEvent(e){this._mouseDownOrTouchStartEvent(e)}touchStartEvent(e){this._mouseOrTouchEnterEvent(e),this._mouseDownOrTouchStartEvent(e)}mouseDownOutsideEvent(){this._outsideMouseDownOrTouchStartEvent()}touchStartOutsideEvent(){this._outsideMouseDownOrTouchStartEvent()}pressedMouseMoveEvent(e){this._pressedMouseOrTouchMoveEvent(e)}touchMoveEvent(e){this._pressedMouseOrTouchMoveEvent(e)}mouseUpEvent(e){this._mouseUpOrTouchEndEvent(e)}touchEndEvent(e){this._mouseUpOrTouchEndEvent(e),this._mouseOrTouchLeaveEvent(e)}contextMenuEvent(e){this._contextMenuOrTouchContextMenuEvent(e)}touchContextMenuEvent(e){this._contextMenuOrTouchContextMenuEvent(e)}mouseEnterEvent(e){this._mouseOrTouchEnterEvent(e)}mouseLeaveEvent(e){this._mouseOrTouchLeaveEvent(e)}mouseDoubleClickEvent(e){this._mouseDoubleClickOrDoubleTapEvent(e)}doubleTapEvent(e){this._mouseDoubleClickOrDoubleTapEvent(e)}_outsideMouseDownOrTouchStartEvent(){this._zoomAvailable()&&this._mousedown&&(this._mousedown=!1,this.chart.model().endScaleTime(),this.restoreDefaultCursor())}_highlightBackground(e,t,i){const s=this.chart.model().timeScale();let r=t[0].index,n=t[0].index;for(let e=1;e<t.length;e++)r=Math.min(r,t[e].index),n=Math.max(n,t[e].index);const{horizontalPixelRatio:o}=i,a=Math.floor(s.indexToCoordinate(r)*o),l=Math.ceil(s.indexToCoordinate(n)*o);(0,z.fillRect)(e,a,0,l-a,i.bitmapSize.height,this._properties.childs().axisHighlightColor.value())}_addViewsOrMaxMin(e,t){if(e.length<=1){for(const i of e)if(i.timeAxisViews){const e=i.timeAxisViews();e&&e.length&&t.push(e)}}else t.push(this._minMaxViews(e))}_minMaxViews(e){const t=[]
;let i=1/0,s=-1/0,r=null,n=null;for(const t of e)if(t.timeAxisViews){const e=t.timeAxisViews();if(e&&e.length)for(let t=0;t<e.length;++t){const o=e[t],a=o.coordinate();a>=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&&Ze.ContextMenuManager.showMenu(this.getContextMenuActions(),e,{statName:"TimeScaleContextMenu"},{menuName:"TimeScaleContextMenu"})}_mouseOrTouchEnterEvent(e){this._zoomAvailable()&&this.setCursor("ew-resize")}_mouseOrTouchLeaveEvent(e){this.restoreDefaultCursor()}_mouseDoubleClickOrDoubleTapEvent(e){(0,u.trackEvent)("GUI","Double click time scale"),this.chart.model().resetTimeScale()}_areEventsEnabled(){return!(0,je.hideMarksOnBars)().value()}}var Gi=i(85459),qi=i.n(Gi),$i=i(78871),Ki=i(71885),Yi=i(68159),Zi=i(82783),Xi=i(85049);function Ji(e,t){return!!Xi.Interval.isEqual(e.res,t.res)&&(0,Zi.areEqualTimeFrames)(e.val,t.val)}var Qi=i(7611),es=i(31045),ts=i(86920),is=i(61119),ss=i(98272);const rs=new W.TranslatedString("toggle collapsed pane state",a.t(null,void 0,i(46054)));class ns extends Yt.UndoCommand{constructor(e,t){super(rs),this._chartModel=e,this._paneIndex=t}redo(){this._chartModel.toggleCollapsedPane(this._paneIndex)}undo(){this._chartModel.toggleCollapsedPane(this._paneIndex)}}const os=new W.TranslatedString("move all scales to left",a.t(null,void 0,i(64077))),as=new W.TranslatedString("move all scales to right",a.t(null,void 0,i(19013))),ls=(0,m.getLogger)("Chart.MergeAllScales");class cs extends Yt.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,n.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,n.ensureNotNull)(e.getPriceScaleById(this._scaleId));e.movePriceScale(t,this._sourcePosition,this._sourceIndex),this._model.fullUpdate()}}var hs=i(85719);class ds extends Yt.UndoCommand{constructor(e,t,i,s){super(s,void 0,!hs.lineToolsDoNotAffectChartInvalidation),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,n.ensureNotNull)(this._model.dataSourceForId(t.id)),r=0===this._createdIds.length?void 0:(0,n.ensureDefined)(this._createdIds[i]),o=(0,J.cloneLineTool)(this._model,s,!this._withoutShift,r);void 0!==t.sharingMode&&o.share(t.sharingMode);const a=(0,n.ensureNotNull)(s.priceScale());(0,n.ensureNotNull)(this._model.paneForSource(s)).addDataSource(o,a,!1);const l=this._origGroups[i];if(null!==l){const t=e.groupForId(l);t&&t.addLineTools([o])}return this._model.updateSource(o),o}));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,n.ensureNotNull)(this._model.dataSourceForId(t)),s=e.groupForLineTool(i);null!==s&&s.excludeLineTool(i),this._model.removeSource(i)}))}newIds(){return this._createdIds}}var us=i(74174),ps=i(70618),_s=i(300);class ms extends Yt.UndoCommand{constructor(e,t,i,s=!0){super(i,s,(0,_s.sourcesAffectState)(t)),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(P.notNull).map((e=>(0,n.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,Z.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 gs=i(83520),fs=i(52967),vs=i(2718),ys=i(29137),Ss=i(69661),bs=i(98523);const ws=new W.TranslatedString("create {tool}",a.t(null,void 0,i(12898)));class Cs extends Ss.LineToolSynchronizeUndoCommand{constructor({model:e,pane:t,lineTool:i,ownerSource:s,drawOnAllChartsMode:r=0,id:n}){super(e,ws.format({tool:new W.TranslatedString(i,bs.lineToolsLocalizedNames[i])}),!1,!hs.lineToolsDoNotAffectChartInvalidation),this._lineId=null,this._lineState=null,this._paneIndex=e.panes().indexOf(t),this._lineTool=i,this._ownerSourceId=s.id(),this._lineId=null!=n?n:null,this._drawOnAllChartsMode=r}startCreatingLine(e,t,i,s,r){var n;const o=this._chartModel.panes()[this._paneIndex],a=this._chartModel.dataSourceForId(this._ownerSourceId)||void 0,l=this._chartModel.createLineTool({pane:o,point:e,linetool:this._lineTool,properties:t,linkKey:i,sharingMode:s,ownerSource:a,id:null!==(n=this._lineId)&&void 0!==n?n:void 0,fromExternalModel:r});return this._lineId=l.id(),this._fromExternalModel=r,!this._chartModel.lineBeingCreated()}continueCreatingLine(e,t,i,s){const r=this._chartModel.continueCreatingLine(e,t,i,s,this._fromExternalModel);return r&&this._chartModel.setShouldBeSavedEvenIfHidden(!0),r}line(){
return null===this._lineId?null:this._chartModel.dataSourceForId(this._lineId)}drawOnAllCharts(){return 0!==this._drawOnAllChartsMode}_redo(){if(null===this._lineState)return;const e=this._chartModel.restoreSource(!1,this._paneIndex,null,(0,n.ensureNotNull)(this._lineState),null);null!==e&&(this._lineId=e.id(),this._lineState=null,e.share(this._drawOnAllChartsMode))}_undo(){const e=this.line();null!==e&&(this._lineState=e.state(!1),this._chartModel.removeSource(e),this._lineId=null)}}var Ps=i(19466);const xs=new W.TranslatedString("bring {title} to front",a.t(null,void 0,i(53159))),Ts=new W.TranslatedString("send {title} to back",a.t(null,void 0,i(5005))),Is=new W.TranslatedString("insert {title} after {targetTitle}",a.t(null,void 0,i(56307))),Ms=new W.TranslatedString("insert {title} before {targetTitle}",a.t(null,void 0,i(46229))),As=new W.TranslatedString("send {title} backward",a.t(null,void 0,i(40962))),Ls=new W.TranslatedString("bring {title} forward",a.t(null,void 0,i(41966))),ks=new W.TranslatedString("send group {title} backward",a.t(null,void 0,i(69546))),Ds=new W.TranslatedString("bring group {title} forward",a.t(null,void 0,i(1979)));function Es(e){return new W.TranslatedString(e.name(),e.title(Ps.TitleDisplayTarget.StatusLine))}class Vs extends Yt.UndoCommand{constructor(e,t,i){super(i,void 0,(0,_s.sourcesAffectState)(t)),this._sourcesByPanes=new Map,this._originalState=new Map,this._model=e,t.forEach((t=>{const i=(0,n.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,r=new Set(i.sourcesByGroup().multipaneSources());i.sourcesByGroup().allIncludingHidden().filter((e=>!r.has(e))).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,n.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,n.ensureNotNull)(i.dataSourceForId(e))));this._paneOperation(i,s)}))}}class Bs extends Vs{constructor(e,t){super(e,t,xs.format({title:Es(t[0])}))}_paneOperation(e,t){e.bringToFront(t)}}class Rs extends Vs{constructor(e,t){super(e,t,Ts.format({title:Es(t[0])}))}_paneOperation(e,t){e.sendToBack(t)}}class Ns extends Vs{constructor(e,t,i,s){super(e,t,s),this._targetSource=i}_paneOperation(e,t){e.insertAfter(t,this._targetSource)}}class Os extends Ns{constructor(e,t,i){super(e,t,i,Is.format({title:Es(t[0]),targetTitle:Es(i)}))}}class Fs extends Vs{constructor(e,t,i,s){super(e,t,s),this._targetSource=i}_paneOperation(e,t){e.insertBefore(t,this._targetSource)}}class Ws extends Fs{constructor(e,t,i){super(e,t,i,Ms.format({title:Es(t[0]),targetTitle:Es(i)}))}}function Hs(e,t){const i=t[0],s=e.sourcesByGroup().all().filter((e=>e.zorder()<i.zorder()))
;if(0===s.length)throw new Error("Cannot move backward source that alreadt on back");let r=s[s.length-1];if((0,J.isLineTool)(r)){const t=e.model().lineToolsGroupModel().groupForLineTool(r);null!==t&&(r=t.lineTools()[0])}return r}class zs extends Fs{constructor(e,t,i){super(e,i,Hs(t,i),As.format({title:Es(i[0])}))}}function Us(e,t){const i=t[t.length-1],s=e.sourcesByGroup().allExceptSpecialSources().filter((e=>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,J.isLineTool)(r)){const t=e.model().lineToolsGroupModel().groupForLineTool(r);if(null!==t){const e=t.lineTools();r=e[e.length-1]}}return r}class js extends Ns{constructor(e,t,i){super(e,i,Us(t,i),Ls.format({title:Es(i[0])}))}}function Gs(e,t){return(0,n.ensureNotNull)(e.paneForSource(t.lineTools()[0]))}class qs extends Fs{constructor(e,t){super(e,t.lineTools(),Hs(Gs(e,t),t.lineTools()),ks.format({title:t.name().value()}))}}class $s extends Ns{constructor(e,t){super(e,t.lineTools(),Us(Gs(e,t),t.lineTools()),Ds.format({title:t.name().value()}))}}const Ks=new W.TranslatedString("rearrange panes",a.t(null,void 0,i(2618)));class Ys extends Yt.UndoCommand{constructor(e,t,i){super(Ks),this._chartModel=e,this._index=t,(0,P.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<e&&this._dstIndex>=0&&this._dstIndex<e}}var Zs=i(55917),Xs=i(82992);function Js(e){var t,i;return{val:e.value(),dependenValues:null!==(i=null===(t=e.dependents)||void 0===t?void 0:t.call(e).map(Js))&&void 0!==i?i:[]}}function Qs(e){var t,i;return(null!==(i=null===(t=e.dependents)||void 0===t?void 0:t.call(e))&&void 0!==i?i:[]).map(Js)}function er(e,t){var i,s;(null!==(s=null===(i=e.dependents)||void 0===i?void 0:i.call(e))&&void 0!==s?s:[]).forEach(((e,i)=>{var s,r;e.setValue(t[i].val),(null!==(r=null===(s=e.dependents)||void 0===s?void 0:s.call(e))&&void 0!==r?r:[]).forEach((e=>er(e,t[i].dependenValues)))}))}class tr extends Yt.UndoCommand{constructor(e,t,i,s,r=!0){super(i,void 0,r),this._targetObj=e,this._newValue=t,this._oldValue=this._targetObj.value(),this._dependentValues=Qs(this._targetObj),this._model=s}redo(){(0,Zs.allowSavingDefaults)(!0),this._targetObj.setValue(this._newValue),(0,Zs.allowSavingDefaults)(!1),this._model.recalculateAllPanes((0,pi.globalChangeEvent)()),this._model.lightUpdate()}undo(){(0,Zs.allowSavingDefaults)(!0),this._targetObj.setValue(this._oldValue),er(this._targetObj,this._dependentValues),(0,Zs.allowSavingDefaults)(!1),this._model.recalculateAllPanes((0,pi.globalChangeEvent)()),this._model.lightUpdate()}}class ir extends Yt.UndoCommand{constructor(e,t,i,s,r,n){super(s),this._prevPriceAxisProps={},this._dependentValues=[],this._property=e,this._mainSeries=i,this._value=t,this._model=r,this._chartWidget=n}redo(){
const e=this._mainSeries,t=e.properties().childs();this._dependentValues=Qs(this._property),this._prevResolution=t.interval.value(),this._prevValue=this._property.value(),this._storePriceAxisProps(),(0,Zs.allowSavingDefaults)(!0);const i=t.interval.value(),s=this._model.defaultResolutions(),r=(0,ui.getResolutionByChartStyle)(this._value,i,s);Xs.linking.interval.setValue(r),e.setChartStyleWithIntervalIfNeeded(this._value,r),(0,ae.setLastUsedStyle)(this._value,e.symbolInfo()),(0,ae.preparePriceAxisProperties)(t),(0,Zs.allowSavingDefaults)(!1),this._invalidateModel(),this._chartWidget.screen.show(!0)}undo(){const e=this._mainSeries;(0,Zs.allowSavingDefaults)(!0),e.setChartStyleWithIntervalIfNeeded(this._prevValue,this._prevResolution),this._restorePriceAxisProps(),Xs.linking.interval.setValue(this._prevResolution),er(this._property,this._dependentValues),(0,Zs.allowSavingDefaults)(!1),this._invalidateModel(),this._chartWidget.screen.show(!0)}_storePriceAxisProps(){const e=this._mainSeries.priceScale();this._prevPriceAxisProps=e.mode()}_restorePriceAxisProps(){this._mainSeries.priceScale().setMode(this._prevPriceAxisProps)}_invalidateModel(){this._model&&(this._model.recalculateAllPanes((0,pi.sourceChangeEvent)(this._model.mainSeries().id())),this._model.lightUpdate())}}const sr=new W.TranslatedString("change date range",a.t(null,void 0,i(16979)));class rr extends Yt.UndoCommand{constructor(e,t){super(sr),this._modelsData=[],this._rangeOptions=t,this._modelsData.push({model:e,prevResolution:e.mainSeries().properties().childs().interval.value(),barSpacing:e.timeScale().barSpacing(),rightOffset:e.timeScale().rightOffset(),rangeOptions:e.appliedTimeFrame().value()})}redo(){for(const e of this._modelsData){const t=e.model.mainSeries(),i=t.properties().childs().interval;Xi.Interval.isEqual(this._rangeOptions.res,i.value())?t.loadDataTo(this._rangeOptions.val):(t.setDefaultTimeframe(this._rangeOptions.val),t.setSymbolParams({interval:this._rangeOptions.res}))}}undo(){for(const e of this._modelsData){const t=e.model.mainSeries(),i=t.properties().childs().interval;e.prevResolution!==i.value()?(null!==e.rangeOptions&&t.setDefaultTimeframe(e.rangeOptions.val),t.setSymbolParams({interval:e.prevResolution})):null!==e.rangeOptions&&t.loadDataTo(e.rangeOptions.val);const s=e.model.timeScale();s.setBarSpacing(e.barSpacing),s.setRightOffset(e.rightOffset)}}canMerge(e){return e instanceof rr&&Ji(e._rangeOptions,this._rangeOptions)}merge(e){if(!(e instanceof rr))throw new Error("Invalid command to merge");this._modelsData=this._modelsData.concat(e._modelsData)}}var nr=i(62839);i(21251);class or extends Yt.UndoCommand{constructor(e,t,i){super(i,void 0,!hs.lineToolsDoNotAffectChartInvalidation),this._model=e,this._groupId=t.id,this._groupName=t.name().value(),this._lineToolsIds=t.lineTools().map((e=>e.id()))}redo(){const e=(0,n.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 nr.LineToolsGroup(e,this._groupName,this._groupId);this._model.lineToolsGroupModel().addGroup(t)}}const ar=new W.TranslatedString("create line tools group",a.t(null,void 0,i(46219)));class lr extends Yt.UndoCommand{constructor(e,t){super(ar,void 0,!hs.lineToolsDoNotAffectChartInvalidation),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,n.ensureNotNull)(this._model.lineToolsGroupModel().groupForId((0,n.ensureNotNull)(this._groupId)));this._model.lineToolsGroupModel().removeGroup(e)}createdGroupId(){return this._groupId}}const cr=new W.TranslatedString("add line tool(s) to group {group}",a.t(null,void 0,i(21162)));class hr extends Yt.UndoCommand{constructor(e,t,i){super(cr.format({group:t.name().value()}),void 0,!hs.lineToolsDoNotAffectChartInvalidation),this._model=e,this._groupId=t.id,this._lineToolsIds=i.map((e=>e.id()))}redo(){const e=(0,n.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,n.ensureNotNull)(this._model.lineToolsGroupModel().groupForId(this._groupId)).excludeLineTools(e)}}class dr extends Yt.UndoCommand{constructor(e,t,i,s){super(s,void 0,!hs.lineToolsDoNotAffectChartInvalidation),this._chartModel=e,this._groupId=t.id,this._oldName=t.name().value(),this._newName=i}redo(){(0,n.ensureNotNull)(this._chartModel.lineToolsGroupModel().groupForId(this._groupId)).setName(this._newName)}undo(){(0,n.ensureNotNull)(this._chartModel.lineToolsGroupModel().groupForId(this._groupId)).setName(this._oldName)}}const ur=new W.TranslatedString("create line tools group from selection",a.t(null,void 0,i(95394))),pr=new W.TranslatedString("removing line tools group {name}",a.t(null,void 0,i(41430))),_r=new W.TranslatedString("add line tool {lineTool} to group {name}",a.t(null,void 0,i(12570))),mr=new W.TranslatedString("make group {group} visible",a.t(null,void 0,i(45987))),gr=new W.TranslatedString("make group {group} invisible",a.t(null,void 0,i(76709))),fr=new W.TranslatedString("lock group {group}",a.t(null,void 0,i(20453))),vr=new W.TranslatedString("unlock group {group}",a.t(null,void 0,i(74590))),yr=new W.TranslatedString("rename group {group} to {newName}",a.t(null,void 0,i(80491)));class Sr{constructor(e){this._environment=e}createGroupFromSelection(){const e=this._environment.model();(0,n.assert)(!e.selection().isEmpty(),"Cannot create group from empty selection");const t=(0,vs.sortSources)(e.selection().lineDataSources());(0,n.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 o=e.lineToolsGroupModel().groupForLineTool(s);if(null!==o){const e=o.lineTools();r=e[e.length-1]}this._environment.beginUndoMacro(ur);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,n.ensureNotNull)(e.paneForSource(t));l.add(r)})),(0,n.assert)(l.size<=1,"All selected sources should be on the same pane"),a.forEach(((t,i)=>{const s=new ps.ExcludeLineToolsFromGroupUndoCommand(e,i,t);this._environment.pushUndoCommand(s)}));const c=new lr(e,(0,vs.sortSources)(t));if(this._environment.pushUndoCommand(c),i){const i=new Os(e,t,r);this._environment.pushUndoCommand(i)}this._environment.endUndoMacro();const h=(0,n.ensureNotNull)(c.createdGroupId());return(0,n.ensureNotNull)(e.lineToolsGroupModel().groupForId(h))}removeGroup(e){const t=this._environment.model(),i=e.lineTools();this._environment.beginUndoMacro(pr.format({name:e.name().value()}));const s=new or(t,e,null);this._environment.pushUndoCommand(s);const r=new us.RemoveSourcesUndoCommand(t,i,null);this._environment.pushUndoCommand(r);const o=t.mainSeries().symbol();i.forEach((e=>{null!==e.linkKey().value()&&(0,je.removeLineTool)({withUndo:!0,model:t,symbol:o,sourceTitle:new W.TranslatedString(e.name(),e.title(Ps.TitleDisplayTarget.DataWindow)),lineToolState:e.state(!1),linkKey:(0,n.ensureNotNull)(e.linkKey().value())})})),this._environment.endUndoMacro()}groups(){return this._environment.model().lineToolsGroupModel().groups()}excludeLineToolFromGroup(e,t){const i=this._environment.model(),s=new ps.ExcludeLineToolsFromGroupUndoCommand(i,e,[t]);this._environment.pushUndoCommand(s)}addLineToolToGroup(e,t){const i=this._environment.model(),s=i.lineToolsGroupModel().groupForLineTool(t);if(s===e)return;const r=_r.format({lineTool:new W.TranslatedString(t.name(),t.title(Ps.TitleDisplayTarget.StatusLine)),name:e.name().value()});this._environment.beginUndoMacro(r),null!==s&&this._environment.pushUndoCommand(new ps.ExcludeLineToolsFromGroupUndoCommand(i,s,[t]));if(N.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 hr(i,e,[t])),this._environment.endUndoMacro()}bringToFront(e){const t=this._environment.model(),i=new Bs(t,e.lineTools());this._environment.pushUndoCommand(i),this._environment.emitEvent("changeZOrder",[e.lineTools()])}sendToBack(e){const t=this._environment.model(),i=new Rs(t,e.lineTools());this._environment.pushUndoCommand(i),this._environment.emitEvent("changeZOrder",[e.lineTools()])}bringForward(e){const t=this._environment.model(),i=new $s(t,e);this._environment.pushUndoCommand(i),this._environment.emitEvent("changeZOrder",[e.lineTools()])}sendBackward(e){const t=this._environment.model(),i=new qs(t,e)
;this._environment.pushUndoCommand(i),this._environment.emitEvent("changeZOrder",[e.lineTools()])}insertAfter(e,t){const i=this._environment.model();let s;if(t instanceof nr.LineToolsGroup){const e=t.lineTools();s=e[e.length-1]}else s=t;const r=new Os(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 nr.LineToolsGroup){s=t.lineTools()[0]}else s=t;const r=new Ws(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],o=(0,n.ensureNotNull)(t.paneForSource(i[0])).sourcesByGroup().allExceptSpecialSources(),a=o[0],l=o[o.length-1];return{bringForwardEnabled:r!==l,bringToFrontEnabled:r!==l,sendBackwardEnabled:s!==a,sendToBackEnabled:s!==a}}setGroupVisibility(e,t){const i=(t?mr:gr).format({group:e.name().value()}),s=this._environment.model();this._environment.beginUndoMacro(i),e.lineTools().forEach((e=>{const i=e.properties().visible,r=new tr(i,t,null,s,!hs.lineToolsDoNotAffectChartInvalidation);this._environment.pushUndoCommand(r)})),this._environment.endUndoMacro()}setGroupLock(e,t){const i=(t?fr:vr).format({group:e.name().value()}),s=this._environment.model();this._environment.beginUndoMacro(i),e.lineTools().forEach((e=>{const i=e.properties().frozen,r=new tr(i,t,null,s,!hs.lineToolsDoNotAffectChartInvalidation);this._environment.pushUndoCommand(r)})),this._environment.endUndoMacro()}setGroupName(e,t){const i=this._environment.model(),s=yr.format({group:e.name().value(),newName:t}),r=new dr(i,e,t,s);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 br=i(14314),wr=i(96286),Cr=i(36915),Pr=i(9155);const xr=new W.TranslatedString("apply study template {template}",a.t(null,void 0,i(69604)));function Tr(e){for(const t of e.panes)for(const e of t.sources)if((0,Cr.isMainSeriesState)(e))return e.id;return null}class Ir extends Yt.UndoCommand{constructor(e,t,i){var s,r;super(xr.format({template:i})),this._newSymbolParams={},this._model=e,this._templateContent=function(e,t){const i=(0,br.default)({},e),s=(0,n.ensureNotNull)(Tr(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 o=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,ae.getChartStyleByResolution)(t.interval,o.style())),this._initialSymbolParams={symbol:o.symbol(),currency:o.currency(),unit:o.unit(),interval:o.interval(),style:o.style()},this._initialState=e.studyTemplate(),this._initialGroupsState=e.lineToolsGroupModel().state()}redo(){this._model.mainSeries().setSymbolParams(this._newSymbolParams);const e=this._merge(this._templateContent).filter(J.isLineTool);this._model.lineToolsGroupModel().removeLineTools(e);const t=this._model.mainSeries().properties();(0,ae.preparePriceAxisProperties)(t),this._model.recalcVisibleRangeStudies(He.RecalcVisibleRangeStudiesReason.StudyCreation),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,n.assert)(s.id()===Tr(e)),s.priceScale().properties().childs().lockScale.setValue(!1);const r=i.panes(),o=[];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,Z.isStudy)(t)||(0,Z.isStudyStub)(t))&&t.isRemovedByStudyTemplates())&&o.push(t)}}i.resetDeferredStudies();const a=(0,wr.closeSourcesSet)(i,o);for(let e=0;e<a.length;++e)i.removeSource(a[e]);const l=e.panes;for(let e=0;e<l.length;e++){let s=-1;const n=(0,P.clone)(l[e]);n.sources.sort(((e,t)=>e.zorder-t.zorder));for(let e=0;e<n.sources.length;e++){const t=n.sources[e];if((0,Cr.isMainSeriesState)(t)){delete t.state,s=e;break}}const o=s>-1,a=o?r[e]:i.createPane(e);o&&t<3&&(0,Pr.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,pi.globalChangeEvent)()),i.fullUpdate(),a}}var Mr=i(92184),Ar=i(60074);const Lr=(0,m.getLogger)("Chart.ChartUndoModel");var kr;!function(e){e[e.PasteYCoordOffset=-40]="PasteYCoordOffset"}(kr||(kr={}));const Dr=new W.TranslatedString("paste drawing",a.t(null,void 0,i(62192)));class Er extends Yt.UndoCommand{constructor(e,t,i,s,r){super(Dr,void 0,!hs.lineToolsDoNotAffectChartInvalidation),this._needCopyToOtherCharts=!1,this._sourceState=null,this._model=e,this._clipboardData=t,this._paneIndex=this._model.panes().indexOf(i||(0,n.ensureNotNull)(this._model.paneForSource(this._model.mainSeries()))),this._pasteWithData=!!s,this._keepZIndex=!!r}redo(){const e=this._model.panes()[this._paneIndex],t=(0,n.ensureNotNull)(e.clipboardLineToolOwnerSource(this._clipboardData.source.id)),i=t===this._model.mainSeries();null===this._sourceState&&(this._sourceState=this._getSourceState(t,i));const s=(0,n.ensureNotNull)(e.restoreLineTool(this._sourceState,this._pasteWithData,this._keepZIndex,void 0,t));(0,
n.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 Lr.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,n.ensureNotNull)(this._model.dataSourceForId((0,n.ensureNotNull)(this._sourceState).id))}needCopyToOtherCharts(){return this._needCopyToOtherCharts}_getSourceState(e,t){const i=(0,P.clone)(this._clipboardData.source);delete i.state.symbol,t?(null!=i.linkKey||void 0!==i.sharingMode&&0!==i.sharingMode)&&(i.linkKey=(0,Mr.randomHash)()):(i.linkKey=null,i.sharingMode=0);const s=(0,n.ensureNotNull)(e.priceScale()),r=this._model,{symbol:o,currencyId:a,unitId:l}=this._clipboardData.source.state,c=(0,n.ensureNotNull)(e.symbolSource());let h=!1;!c.symbolSameAsCurrent(o)||(null!==a?a!==(0,ae.symbolCurrency)(c.symbolInfo(),void 0,!0):c.isConvertedToOtherCurrency())||(null!==l?l!==(0,ae.symbolUnit)(c.symbolInfo(),this._model.unitConversionEnabled()):c.isConvertedToOtherUnit())||((0,Ar.isActingAsSymbolSource)(e)?h=!0:(0,Z.isStudy)(e)&&(h=Boolean(e.metaInfo().is_price_study))),i.state.currencyId=r.currencyConversionEnabled()&&c.isConvertedToOtherCurrency()?c.currency():null,i.state.unitId=r.unitConversionEnabled()&&c.isConvertedToOtherUnit()?c.unit():null;const d=e=>{const t=e.x*r.timeScale().width(),i=e.y*s.height()-40;return new Oe.Point(t,i)},u=(0,n.ensureNotNull)(e.firstValue());if(this._model.id()===this._clipboardData.modelId||!h){for(let e=0;e<this._clipboardData.geometry.length;++e){const t=d(this._clipboardData.geometry[e]),n=r.timeScale().coordinateToIndex(t.x),o=r.timeScale().normalizeBarIndex(n);if(h){const t=s.priceToCoordinate(i.points[e].price,u)+-40;o.price=s.coordinateToPrice(t,u)}else o.price=s.coordinateToPrice(t.y,u);i.points[e]=o}i.state.interval=r.mainSeries().interval()}return i.id=(0,Mr.randomHashN)(6),i}}var Vr=i(77470),Br=i(25512),Rr=i(58783),Nr=i(69109);class Or extends Yt.UndoCommand{constructor(e,t,i,s){super(e),this._charts=new Map,this._firstRedo=!0,this._creationTime=performance.now(),this._linkingGroupIndex=s.linkingGroupIndex().value(),this._charts.set(s,{sourceId:t.id(),newSymbolParams:i,prevSymbolParams:t.symbolParams(),showFade:this._showFade(t,s),chartWidget:s})}redo(){this._firstRedo||(0,Nr.muteLinkingGroup)(this._linkingGroupIndex,!0),this._charts.forEach((e=>{this._symbolSource(e).setSymbolParams(e.newSymbolParams),e.showFade&&e.chartWidget.screen.show(!0)})),this._firstRedo||(0,Nr.muteLinkingGroup)(this._linkingGroupIndex,!1),this._firstRedo=!1}undo(){(0,Nr.muteLinkingGroup)(this._linkingGroupIndex,!0),this._charts.forEach((e=>{this._symbolSource(e).setSymbolParams(e.prevSymbolParams),
e.showFade&&e.chartWidget.screen.show(!0)})),(0,Nr.muteLinkingGroup)(this._linkingGroupIndex,!1)}canMerge(e){if(!(e instanceof Or)||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 Or)for(const[t,i]of e._charts)this._charts.set(t,i)}_showFade(e,t){return e===t.model().mainSeries()}_symbolSource(e){return(0,n.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 Fr=new W.TranslatedString("change symbol",a.t(null,void 0,i(35400)));class Wr extends Or{constructor(e,t,i){super(Fr,e,{symbol:t,currency:null,unit:null},i),this._symbol=t}canMerge(e){return e instanceof Wr&&e._symbol===this._symbol&&super.canMerge(e)}}const Hr=(0,m.getLogger)("Chart.ChartUndoModel"),zr=new W.TranslatedString("paste indicator",a.t(null,void 0,i(1064)));class Ur extends Yt.UndoCommand{constructor(e,t,i){super(zr),this._sourceState=null,this._model=e,this._clipboardData=t,this._paneId=i}redo(){if(!this._sourceState){const e=(0,P.clone)(this._clipboardData.source);e.id=(0,Mr.randomHashN)(6),this._sourceState=e}let e,t;e=this._paneId?(0,n.ensureNotNull)(this._model.paneForId(this._paneId)):this._sourceState.metaInfo.is_price_study?(0,n.ensureNotNull)(this._model.paneForSource(this._model.mainSeries())):this._model.createPane();const i=!e.mainDataSource();this._sourceState.zorder=e.newStudyZOrder();const s=(0,n.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,Z.isStudy)(s)&&s.start()}undo(){if(null===this._sourceState)return void Hr.logError("This command was never executed - nothing to undo");const e=(0,n.ensureNotNull)(this._model.dataSourceForId(this._sourceState.id));this._model.removeSource(e)}state(){return this._sourceState}}class jr extends Yt.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()}}const Gr=new W.TranslatedString("move",a.t(null,void 0,i(98277)));class qr extends Yt.UndoCommand{constructor(e,t,i,s){super(Gr,!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,
n.ensureNotNull)(this._endEvent))}_move(e){const t=(0,n.ensureNotNull)(this._model.dataSourceForId(this._sourceId));(0,n.assert)(void 0!==t.moveItem,'The method "moveItem" is not defined'),t.moveItem&&t.moveItem(new Oe.Point(e.localX,e.localY),this._itemIndex,new ze.EnvironmentState(e))}}class $r extends Yt.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,u.trackEvent)("SOS","Apply SOS","Rebind SOS"))),this._chartModel.setShouldBeSavedEvenIfHidden(!0),null!==this._paneState){(0,n.ensureNotNull)(this._chartModel.paneForSource(i)).restoreState({state:this._paneState,withData:!1,version:this._chartModel.version()}),this._paneState=null}}undo(){const e=(0,n.ensureNotNull)(this._chartModel.dataSourceForId((0,n.ensureNotNull)(this._studyId)));(0,Ar.isSymbolSource)(e)&&e.symbolResolved().unsubscribeAll(this);const t=(0,n.ensureNotNull)(this._chartModel.paneForSource(e)).state();this._additionalStudiesIds.forEach((e=>{const t=(0,n.ensureNotNull)(this._chartModel.dataSourceForId(e));this._chartModel.removeSource(t)})),this._additionalStudiesIds=[],this._chartModel.removeSource(e)&&(this._paneState=t)}insertedStudy(){return this._chartModel.dataSourceForId((0,n.ensureNotNull)(this._studyId))}lastInsertionStartPromise(){var e;return null!==(e=this._lastInsertionStartPromise)&&void 0!==e?e:Promise.resolve()}_createCopiesOfNewFundamentalForAllStocks(e){}_createCopiesOfExistingFundamentalsForNewStock(e){}}var Kr=i(48984),Yr=i(51804),Zr=i.n(Yr),Xr=i(33515);const Jr=new W.TranslatedString("zoom",a.t(null,void 0,i(91084)));class Qr extends Yt.UndoCommand{constructor(e,t,i,s,r,n){super(Jr),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,n.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,n.ensureNotNull)(e.visibleBarsStrictRange());e.setBarSpacing((0,n.ensureNotNull)(this._barSpacing)),e.zoomToBarsRange(i.firstBar()+(0,n.ensureNotNull)(this._leftBarsOffset),i.lastBar()+(0,n.ensureNotNull)(this._rightBarsOffset)),t.setMode((0,n.ensureNotNull)(this._priceMode)),t.recalculatePriceRange((0,n.ensureNotNull)(e.visibleBarsStrictRange())),this._model.recalculateAllPanes((0,pi.viewportChangeEvent)()),this._model.lightUpdate()}}const en=(0,m.getLogger)("Chart.ChartUndoModel"),tn=new W.TranslatedString("zoom",a.t(null,void 0,i(91084)));class sn extends Yt.UndoCommand{constructor(e,t,i){super(tn),this._baseCmd=e,this._zoomStack=t,this._inOut=i}undo(){if(this._inOut){if(this._baseCmd!==this._zoomStack.head())return void en.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 en.logDebug("zoom stack inconsistency");this._baseCmd.undo(),this._zoomStack.pop()}}}const rn=new W.TranslatedString("stop syncing drawing",a.t(null,void 0,i(3350)));class nn extends Yt.UndoCommand{constructor(e,t){super(rn,void 0,!hs.lineToolsDoNotAffectChartInvalidation),this._model=e,this._sourceId=t.id(),this._linkKey=t.linkKey().value()}redo(){(0,n.ensureNotNull)(this._model.dataSourceForId(this._sourceId)).linkKey().setValue(null)}undo(){(0,n.ensureNotNull)(this._model.dataSourceForId(this._sourceId)).linkKey().setValue(this._linkKey)}}var on=i(31229);const an=new W.TranslatedString("restore defaults",a.t(null,void 0,i(85815)));class ln extends Yt.UndoCommand{constructor(e,t,i=an,s=!0){super(i,void 0,s),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()}}class cn extends ln{constructor(e,t,i,s){super(e,t,i,null!=s?s:!hs.lineToolsDoNotAffectChartInvalidation)}redo(){this._defaultProperty.hasChild("intervalsVisibilities")&&this._defaultProperty.childs().intervalsVisibilities.mergeAndFire(on.intervalsVisibilitiesDefaults),super.redo()}}const hn=new W.TranslatedString("restore study defaults",a.t(null,void 0,i(96881)));class dn extends cn{constructor(e,t,i=hn){super(e,t.properties(),i,!0),this._study=t}redo(){super.redo(),this._chartModel.recalcColorStudies(!0),this._patchProperties()}undo(){super.undo(),this._chartModel.recalcColorStudies(!0),this._patchProperties()}_patchProperties(){0}}var un=i(10892),pn=i(35039);function _n(e){return f(e,["bidLineColor","askLineColor"])}function mn(e){return f(e,["preMarketColor","postMarketColor"])}function gn(e){return f(e,["highLowPriceLinesColor","averagePriceLineColor"])}function fn(e){return f(e,["upColor","downColor","borderColor","borderUpColor","borderDownColor","wickDownColor","wickUpColor","wickColor"])}
function vn(e){return f(e,["upColor","downColor","borderColor","borderUpColor","borderDownColor","wickDownColor","wickUpColor","wickColor"])}function yn(e){return f(e,["upColor","downColor","borderColor","borderUpColor","borderDownColor","wickDownColor","wickUpColor","wickColor"])}function Sn(e){return f(e,["upColor","downColor"])}function bn(e){return f(e,["color","borderColor","labelColor"])}function wn(e){return f(e,["color"])}function Cn(e){return f(e,["transparency","color1","color2","linecolor"])}function Pn(e){const{inputs:t,...i}=e;return i}function xn(e){const{inputs:t,...i}=e;return i}function Tn(e){const{inputs:t,...i}=e;return i}function In(e){const{inputs:t,...i}=e;return i}function Mn(e){const{topLineWidth:t,bottomLineWidth:i,baseLevelPercentage:s,priceSource:r,...n}=e;return n}function An(e){const{thinBars:t,inputs:i,barStyle:s,...r}=e;return r}function Ln(e){const{baseLineColor:t,priceLineColor:i,prevClosePriceLineColor:s,highLowAvgPrice:r,bidAsk:n,prePostMarket:o,hlcAreaStyle:a,candleStyle:l,volCandlesStyle:c,hollowCandleStyle:h,haStyle:d,barStyle:u,hiloStyle:p,lineStyle:_,lineWithMarkersStyle:m,steplineStyle:g,areaStyle:v,renkoStyle:y,pbStyle:S,kagiStyle:b,pnfStyle:w,baselineStyle:C,rangeStyle:P,volFootprintStyle:x,tpoStyle:T,svpStyle:I}=e;return{baseLineColor:t,priceLineColor:i,prevClosePriceLineColor:s,hlcAreaStyle:(M=a,f(M,["highLineColor","lowLineColor","closeLineColor","highCloseFillColor","closeLowFillColor"])),bidAsk:_n(n),prePostMarket:mn(o),candleStyle:fn(l),hollowCandleStyle:vn(h),haStyle:yn(d),barStyle:Sn(u),hiloStyle:bn(p),lineStyle:wn(_),lineWithMarkersStyle:wn(m),steplineStyle:wn(g),areaStyle:Cn(v),renkoStyle:Pn(y),pbStyle:xn(S),kagiStyle:Tn(b),pnfStyle:In(w),baselineStyle:Mn(C),rangeStyle:An(P),volFootprintStyle:{},tpoStyle:{},svpStyle:{},volCandlesStyle:fn(c),highLowAvgPrice:gn(r)};var M}function kn(e){return f(e,["backgroundColor","lineColor","textColor","axisHighlightColor","axisLineToolLabelBackgroundColorCommon","axisLineToolLabelBackgroundColorActive","crosshairLabelBgColorLight","crosshairLabelBgColorDark"])}function Dn(e){const{separatorColor:t,background:i,backgroundGradientEndColor:s,backgroundGradientStartColor:r,backgroundType:n,horzGridProperties:o,vertGridProperties:a,crossHairProperties:l}=e;return{separatorColor:t,background:i,backgroundGradientEndColor:s,backgroundGradientStartColor:r,backgroundType:n,horzGridProperties:{color:o.color},vertGridProperties:{color:a.color},crossHairProperties:{color:l.color,transparency:l.transparency}}}function En(e){const{graphics:{backgrounds:{outOfSession:t,preMarket:i,postMarket:s},vertlines:{sessBreaks:r}}}=e;return{graphics:{backgrounds:{outOfSession:{color:t.color,transparency:t.transparency},preMarket:{color:i.color,transparency:i.transparency},postMarket:{color:s.color,transparency:s.transparency}},vertlines:{sessBreaks:{color:r.color}}}}}function Vn(e){var t,i;e.wickUpColor=null!==(t=e.wickUpColor)&&void 0!==t?t:e.wickColor,e.wickDownColor=null!==(i=e.wickDownColor)&&void 0!==i?i:e.wickColor,delete e.wickColor}
const Bn=new W.TranslatedString("apply chart theme",a.t(null,void 0,i(68231)));class Rn extends Yt.UndoCommand{constructor(e,t,i){var s,r,n,o;super(Bn),this._model=e,this._newSessionProps=t.sessions?{properties:i?t.sessions:En(t.sessions)}:void 0,Vn(t.mainSourceProperties.candleStyle),Vn(t.mainSourceProperties.hollowCandleStyle),Vn(t.mainSourceProperties.haStyle);const a=t;a.chartProperties=null!==(s=a.chartProperties)&&void 0!==s?s:{paneProperties:{},scalesProperties:void 0};const l=a.chartProperties.paneProperties.gridProperties;a.chartProperties.paneProperties.vertGridProperties=null!==(r=a.chartProperties.paneProperties.vertGridProperties)&&void 0!==r?r:l,a.chartProperties.paneProperties.horzGridProperties=null!==(n=a.chartProperties.paneProperties.horzGridProperties)&&void 0!==n?n:l;const c=this._model.properties().state().paneProperties.legendProperties;delete c.backgroundTransparency;const h=a.chartProperties.paneProperties;i?h.legendProperties={...h.legendProperties,...c}:delete h.legendProperties;const d=(0,pn.factoryDefaults)("chartproperties"),u=(0,Fe.deepExtend)({},d,t.chartProperties),p=i?u.paneProperties:Dn(u.paneProperties),_=i?u.scalesProperties:kn(u.scalesProperties);this._newChartProps={paneProperties:p,scalesProperties:_},e.timeScale().preserveBarSpacing()&&delete this._newChartProps.scalesProperties.barSpacing;const m=(0,pn.factoryDefaults)("chartproperties.mainSeriesProperties"),g=(0,Fe.deepExtend)({},m,t.mainSourceProperties);this._newSeriesProps=i?g:Ln(g);const f=e.properties().state();this._oldChartProps={paneProperties:Dn(f.paneProperties),scalesProperties:kn(f.scalesProperties)};const v=e.mainSeries().properties().state();this._oldSeriesProps=i?v:Ln(v),this._oldSessionProps=null!==(o=this._model.sessions().state())&&void 0!==o?o:void 0}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,Zs.allowSavingDefaults)(!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().updateThemedColors(),a.mainSeries().properties().saveDefaults(),a.mainSeries().createPaneView(),a.mainSeries().invalidateBarStylesCache(),a.recalculateAllPanes((0,pi.globalChangeEvent)()),a.fullUpdate(),a.properties().saveDefaults(),
i&&a.sessions().restoreState(i,!1),(0,Zs.allowSavingDefaults)(!1)}}const Nn=new W.TranslatedString("change resolution",a.t(null,void 0,i(32829)));class On extends Or{constructor(e,t,i){super(Nn,e,function(e,t){let i;const s=(0,ae.isRangeStyle)(e.style()),r=Xi.Interval.isRange(t);return!s&&r?i=11:s&&!r&&(i=(0,ae.getLastUsedStyle)()),{interval:t,style:i}}(e,t),i),this._resolution=t}canMerge(e){return e instanceof On&&e._resolution===this._resolution&&super.canMerge(e)}_showFade(e,t){return!0}}var Fn=i(11008);class Wn extends Fn.SetWatchedValueCommand{constructor(){super(...arguments),this._firstRedo=!0}redo(){this._firstRedo||(0,Nr.muteLinkingGroup)(this._newValue,!0),(0,Nr.muteLinkingGroup)(this._oldValue,!0),super.redo(),this._firstRedo||(0,Nr.muteLinkingGroup)(this._newValue,!1),(0,Nr.muteLinkingGroup)(this._oldValue,!1),this._firstRedo=!1}undo(){(0,Nr.muteLinkingGroup)(this._newValue,!0),(0,Nr.muteLinkingGroup)(this._oldValue,!0),super.undo(),(0,Nr.muteLinkingGroup)(this._newValue,!1),(0,Nr.muteLinkingGroup)(this._oldValue,!1)}}var Hn=i(72396),zn=i(15491);class Un extends Yt.UndoCommand{constructor(e,t,i){super(i),this._chartModel=e,this._stubDescriptor=(0,n.ensureNotNull)(t.getDescriptor())}redo(){this._chartModel.dataSourceForId(this._stubDescriptor.id)||this._chartModel.restoreStudyStub(this._stubDescriptor)}undo(){this._chartModel.removeStudyStub(this._stubDescriptor.id)}}class jn extends Yt.UndoCommand{constructor(e,t,i){super(i,void 0,!hs.lineToolsDoNotAffectChartInvalidation),this._source=e,this._newState=t,this._oldState=e.properties().state()}redo(){this._source.applyTemplate(this._newState)}undo(){this._source.applyTemplate(this._oldState)}}var Gn=i(77007),qn=i(63829),$n=i(11497),Kn=i(30141),Yn=i(60859),Zn=i(51613),Xn=i(79320),Jn=i(19475);const Qn=new W.TranslatedString("apply all chart properties",a.t(null,void 0,i(99551)));class eo extends Yt.UndoCommand{constructor(e){super(Qn),this._trading=null,this._oldShowSellBuyButtons=null,this._oldNoConfirmEnabled=null,this._oldShowOnlyRejectionNotifications=null,this._oldShowPricesWithZeroVolume=null,this._oldShowPricesWithSpread=null,this._oldOrderExecutedSoundEnabled=null,this._prevWatermarkPreferences=null,this._prevAlertPreferences=null,this._model=e,this._trading=(0,Xn.tradingService)(),null!==this._trading&&(this._oldShowSellBuyButtons=this._trading.showSellBuyButtons.value(),this._oldNoConfirmEnabled=this._trading.noConfirmEnabled.value(),this._oldShowOnlyRejectionNotifications=this._trading.showOnlyRejectionNotifications.value(),this._oldShowPricesWithZeroVolume=this._trading.showPricesWith().zeroVolume.value(),this._oldShowPricesWithSpread=this._trading.showPricesWith().spread.value(),this._oldOrderExecutedSoundEnabled=this._trading.orderExecutedSoundParams.enabled.value()),this._defaultsPreferences=(0,Gn.defaultsPreferencesByWhiteList)(this._model,this._model.mainSeries()),this._oldPreferences=e.preferences(),this._prevDateFormat=qn.dateFormatProperty.value(),this._prevTimeHoursFormat=$n.timeHoursFormatProperty.value(),
this._prevAddPlusButton=Jn.addPlusButtonProperty.value(),this._prevShowOpenMarkerStatus=Kn.showMarketOpenStatusProperty.value(),this._prevCurrencyUnitVisibility=(0,gt.currencyUnitVisibilityProperty)().value(),this._prevAutoLogButtonsVisibility=(0,ft.autoLogButtonsVisibilityProperty)().value(),this._prevNavigationButtonsVisibility=(0,Yn.property)().value(),this._prevPaneButtonsVisibility=(0,Zn.property)().value();const t=this._model.watermarkSource();null!==t&&(this._prevWatermarkPreferences=t.properties().state())}redo(){null!==this._trading&&(this._trading.showSellBuyButtons.setValue(!0),this._trading.noConfirmEnabled.setValue(!1),this._trading.showOnlyRejectionNotifications.setValue(!1),this._trading.showPricesWith().zeroVolume.setValue(!0),this._trading.showPricesWith().spread.setValue(!0),this._trading.orderExecutedSoundParams.enabled.setValue(!1)),this._model.applyPreferences(this._defaultsPreferences),this._model.updateScales(),(0,qn.restoreDateFormatSettingsValue)(),(0,$n.restoreTimeHoursFormatSettingsValue)(),(0,Jn.restoreAddPlusButtonSettingsValue)(),(0,Kn.restoreShowMarketOpenStatusProperty)(),(0,gt.restoreCurrencyUnitVisibilitySettingsValue)(),(0,ft.restoreAutoLogButtonsVisibilitySettingsValue)(),(0,Yn.restoreNavigationButtonsVisibilitySettingsValue)(),(0,Zn.restorePaneButtonsVisibilitySettingsValue)();const e=this._model.watermarkSource();null!==e&&e.restorePropertiesDefaults()}undo(){null!==this._trading&&(this._trading.showSellBuyButtons.setValue((0,n.ensureNotNull)(this._oldShowSellBuyButtons)),this._trading.noConfirmEnabled.setValue((0,n.ensureNotNull)(this._oldNoConfirmEnabled)),this._trading.showOnlyRejectionNotifications.setValue((0,n.ensureNotNull)(this._oldShowOnlyRejectionNotifications)),this._trading.showPricesWith().zeroVolume.setValue((0,n.ensureNotNull)(this._oldShowPricesWithZeroVolume)),this._trading.showPricesWith().spread.setValue((0,n.ensureNotNull)(this._oldShowPricesWithSpread)),this._trading.orderExecutedSoundParams.enabled.setValue((0,n.ensureNotNull)(this._oldOrderExecutedSoundEnabled))),this._model.applyPreferences(this._oldPreferences),this._model.updateScales(),qn.dateFormatProperty.setValue(this._prevDateFormat),$n.timeHoursFormatProperty.setValue(this._prevTimeHoursFormat),Kn.showMarketOpenStatusProperty.setValue(this._prevShowOpenMarkerStatus),Jn.addPlusButtonProperty.setValue(this._prevAddPlusButton),(0,gt.currencyUnitVisibilityProperty)().setValue(this._prevCurrencyUnitVisibility),(0,ft.autoLogButtonsVisibilityProperty)().setValue(this._prevAutoLogButtonsVisibility),(0,Yn.property)().setValue(this._prevNavigationButtonsVisibility),(0,Zn.property)().setValue(this._prevPaneButtonsVisibility);const e=this._model.watermarkSource();null!==e&&null!==this._prevWatermarkPreferences&&e.properties().mergeAndFire(this._prevWatermarkPreferences)}}var to=i(70131),io=i(34391);class so{constructor(e){this._leftScales=e.leftPriceScales().map((e=>e.id())),this._rightScales=e.rightPriceScales().map((e=>e.id()))}restorePane(e){this._leftScales.reverse().map((t=>(0,
n.ensureNotNull)(e.getPriceScaleById(t)))).forEach((t=>e.movePriceScale(t,"left"))),this._rightScales.reverse().map((t=>(0,n.ensureNotNull)(e.getPriceScaleById(t)))).forEach((t=>e.movePriceScale(t,"right")))}}class ro extends Yt.UndoCommand{constructor(e,t,i){super(i),this._chartModel=e,this._targetStrategy=(0,io.createPriceScaleSelectionStrategy)(t),this._initialState=e.panes().map((e=>new so(e)))}redo(){this._chartModel.panes().forEach((e=>e.setPriceScaleSelectionStrategy(this._targetStrategy))),this._chartModel.fullUpdate()}undo(){const e=this._chartModel.panes();for(let t=0;t<e.length;t++)this._initialState[t].restorePane(e[t]);this._chartModel.fullUpdate()}}
const no=new W.TranslatedString("send {title} backward",a.t(null,void 0,i(40962))),oo=new W.TranslatedString("bring {title} forward",a.t(null,void 0,i(41966))),ao=new W.TranslatedString("insert {title} after {target}",a.t(null,void 0,i(32960))),lo=new W.TranslatedString("insert {title} before {target}",a.t(null,void 0,i(57106))),co=new W.TranslatedString("cut {title}",a.t(null,void 0,i(11500))),ho=new W.TranslatedString("cut sources",a.t(null,void 0,i(94227))),uo=new W.TranslatedString("remove {title}",a.t(null,void 0,i(94543))),po=new W.TranslatedString("remove drawings group",a.t(null,void 0,i(1193))),_o=new W.TranslatedString("move scale",a.t(null,void 0,i(44854))),mo=new W.TranslatedString("stop syncing line tool(s)",a.t(null,void 0,i(49183))),go=new W.TranslatedString("zoom out",a.t(null,void 0,i(73638))),fo=new W.TranslatedString("zoom in",a.t(null,void 0,i(49856))),vo=new W.TranslatedString("move drawing(s)",a.t(null,void 0,i(52510))),yo=new W.TranslatedString("load default drawing template",a.t(null,void 0,i(43364))),So=new W.TranslatedString("apply factory defaults to selected sources",a.t(null,void 0,i(27851))),bo=new W.TranslatedString("change currency",a.t(null,void 0,i(32302))),wo=new W.TranslatedString("change unit",a.t(null,void 0,i(85975))),Co=new W.TranslatedString("clone line tools",a.t(null,void 0,i(32943))),Po=new W.TranslatedString("merge up",a.t(null,void 0,i(52458))),xo=new W.TranslatedString("merge down",a.t(null,void 0,i(78055))),To=new W.TranslatedString("merge to pane",a.t(null,void 0,i(41866))),Io=new W.TranslatedString("unmerge up",a.t(null,void 0,i(79443))),Mo=new W.TranslatedString("unmerge down",a.t(null,void 0,i(46453))),Ao=new W.TranslatedString("unmerge to new bottom pane",a.t(null,void 0,i(81576))),Lo=new W.TranslatedString("move {title} to new right scale",a.t(null,void 0,i(77482))),ko=new W.TranslatedString("move {title} to new left scale",a.t(null,void 0,i(58228))),Do=new W.TranslatedString("make {title} no scale (Full screen)",a.t(null,void 0,i(10625))),Eo=new W.TranslatedString("scroll time",a.t(null,void 0,i(87840))),Vo=new W.TranslatedString("scale time",a.t(null,void 0,i(70771))),Bo=new W.TranslatedString("reset time scale",a.t(null,void 0,i(17336))),Ro=new W.TranslatedString("reset scales",a.t(null,void 0,i(3323))),No=new W.TranslatedString("create {tool}",a.t(null,void 0,i(12898))),Oo=new W.TranslatedString("change {pointIndex} point",a.t(null,void 0,i(63058))),Fo=new W.TranslatedString("paste {title}",a.t(null,void 0,i(57010))),Wo=new W.TranslatedString("insert {title}",a.t(null,void 0,i(48818))),Ho=new W.TranslatedString("remove pane",a.t(null,void 0,i(93333))),zo=new W.TranslatedString("invert scale",a.t(null,void 0,i(6830))),Uo=new W.TranslatedString("toggle auto scale",a.t(null,void 0,i(42240))),jo=new W.TranslatedString("toggle lock scale",a.t(null,void 0,i(49695))),Go=new W.TranslatedString("toggle regular scale",a.t(null,void 0,i(80688))),qo=new W.TranslatedString("toggle indexed to 100 scale",a.t(null,void 0,i(24736))),$o=new W.TranslatedString("toggle percentage scale",a.t(null,void 0,i(98994))),Ko=new W.TranslatedString("toggle log scale",a.t(null,void 0,i(49403))),Yo=new W.TranslatedString("move left",a.t(null,void 0,i(79209))),Zo=new W.TranslatedString("move right",a.t(null,void 0,i(60114))),Xo=new W.TranslatedString("set price scale selection strategy to {title}",a.t(null,void 0,i(82241))),Jo=new W.TranslatedString("remove all studies",a.t(null,void 0,i(43172))),Qo=new W.TranslatedString("remove drawings",a.t(null,void 0,i(30538))),ea=new W.TranslatedString("remove all studies and drawing tools",a.t(null,void 0,i(56253))),ta=(new W.TranslatedString("turn line tools sharing off",a.t(null,void 0,i(8040))),
new W.TranslatedString("share line tools in layout",a.t(null,void 0,i(90221))),new W.TranslatedString("share line tools globally",a.t(null,void 0,i(63934))),new W.TranslatedString("change linking group",a.t(null,void 0,i(88849)))),ia=(0,m.getLogger)("Chart.ChartUndoModel");var sa;function ra(e,t){return{bringForwardEnabled:e.bringForwardEnabled||t.bringForwardEnabled,bringToFrontEnabled:e.bringToFrontEnabled||t.bringToFrontEnabled,sendBackwardEnabled:e.sendBackwardEnabled||t.sendBackwardEnabled,sendToBackEnabled:e.sendToBackEnabled||t.sendToBackEnabled}}!function(e){e[e.Up=0]="Up",e[e.Down=1]="Down",e[e.Left=2]="Left",e[e.Right=3]="Right"}(sa||(sa={}));const na=(0,N.enabled)("saveload_separate_drawings_storage");function oa(){return na?(0,je.drawOnAllCharts)().value()?1===(0,je.drawOnAllChartsMode)().value()?1:2:0:(0,je.drawOnAllCharts)().value()?1:0}function aa(e,t){(0,Ki.showTooManyStudiesNotice)(t.limitValue)}class la extends(qi()){constructor(e,t,i,s,r,n,o,a,l,c,h){super(),this._createLineCommand=null,this._initialTimeScrollState=null,this._initialTimeScrollPos=null,this._initialTimeScaleState=null,this._scalePriceInfo=null,this._currentSourceMoveCommand=null,this._currentLineChangeCommand=null,this._currentCustomMoveCommand=null,this._zoomStack=new Qi.UndoStack,this._initialPriceScrollState=null,this._initialPriceScrollPos=null,this._chartWidget=r,this.m_model=new(Zr())(e,t,i,s,this,o,a,l,c,h),this._undoHistory=n,this._lineToolsGroupController=new Sr({model:this._model.bind(this),pushUndoCommand:this._pushUndoCommand.bind(this),beginUndoMacro:e=>{this._undoHistory.beginUndoMacro(e)},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?os:as),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){ls.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 cs(this._model(),e,t,i,s,_o);this._pushUndoCommand(r)}createLineTool({pane:e,point:t,linetool:i,properties:s,linkKey:r,ownerSource:o,disableSynchronization:a,sharingMode:l=oa(),id:c}){const h=zn.lineToolsStudyIds[i];if((0,n.assert)(!(0,oi.isStudyLineToolName)(h)||!!h),h){const e=this.canCreateStudy({id:h});if(!e.success)return aa(this.model(),e),(0,oi.isStudyLineToolName)(je.tool.value())&&(0,je.resetToCursor)(),null}const d=No.format({tool:new W.TranslatedString(i,bs.lineToolsLocalizedNames[i])});this.beginUndoMacro(d)
;const u=!a;this._createLineCommand=new Cs({model:this._model(),pane:e,lineTool:i,ownerSource:o||(0,n.ensureNotNull)(e.mainDataSource()),drawOnAllChartsMode:l,id:c});const p=this._createLineCommand.startCreatingLine(t,s,r||null,l,a),_=(0,n.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,je.drawOnAllCharts)().value()&&_.isSynchronizable()){const e=(0,n.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,n.ensureNotNull)(_.linkKey().value()),finalState:m,id:_.id(),sharingMode:_.sharingMode().value()};_.isFixed()&&(s.pointPositionPercents=_.calcPositionPercents()),(0,je.createLineTool)(s)}return this.endUndoMacro(),_}continueCreatingLine(e,t,i,s){const r=(0,n.ensureNotNull)(this._createLineCommand);this.beginUndoMacro(r.text());const o=(0,n.ensureNotNull)(this._model().lineBeingCreated()),a=r.continueCreatingLine(e,t,i,s);let l=null;if(a&&(this.finishLineTool(o),this._pushUndoCommand(r),this._createLineCommand=null,l={points:o.normalizedPoints(),interval:this.mainSeries().interval()}),r.drawOnAllCharts()&&o.isSynchronizable()){const i=(0,n.ensureNotNull)(this._model().externalTimeStamp(e.index));(0,je.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,n.ensureNotNull)(this._createLineCommand),r=s.continueCreatingLine(e,t,i);return r&&(this._pushUndoCommand(s),this._createLineCommand=null),r}finishLineTool(e){this._model().finishLineTool(e)}cancelCreatingLine(){this.m_model.cancelCreatingLine()}lineBeingCreated(){return this.m_model.lineBeingCreated()}pasteImageAsLineTool(e,t,i,s){return null}loadRange(e){const t=this._model(),i=t.appliedTimeFrame().value();return(null===i||!Ji(i,e))&&(this._pushUndoCommand(new rr(t,e)),!0)}mainSeries(){return this.m_model.mainSeries()}model(){return this.m_model}publishedChartsTimelineSource(){return this.m_model.publishedChartsTimelineSource()}unlinkLines(e){const t=this.model();this.beginUndoMacro(mo);for(const i of e)null!==i.linkKey().value()&&(0,je.removeLineTool)({withUndo:!0,model:this.model(),symbol:i.symbol(),linkKey:(0,n.ensureNotNull)(i.linkKey().value()),sourceTitle:(0,ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,i),lineToolState:i.state(!1),unlink:!0}),this._pushUndoCommand(new nn(t,i));this.endUndoMacro()}zoomFromViewport(){const e=new sn((0,n.ensureDefined)(this._zoomStack.head()),this._zoomStack,!1);this._pushUndoCommand(e)}zoomToViewport(e,t,i,s,r){const n=new Qr(this.m_model,e,t,i,s,r),o=new sn(n,this._zoomStack,!0);this._pushUndoCommand(o)}zoomStack(){return this._zoomStack}timeScale(){return this.m_model.timeScale()}selection(){return this.m_model.selection()}selectionMacro(e,t){
return this.m_model.selectionMacro(e,t)}onSelectedSourceChanged(){return this.m_model.onSelectedSourceChanged()}onTagsChanged(){return this.m_model.onTagsChanged()}lineCancelled(){return this.m_model.lineCancelled()}hoveredSource(){return this.m_model.hoveredSource()}crossHairSource(){return this.m_model.crossHairSource()}activeStrategySource(){return this.m_model.activeStrategySource()}setProperty(e,t,i,s){if(e&&e.value()!==t){this.beginUndoMacro(i);const r=new tr(e,t,i,this.m_model,!s);this._pushUndoCommand(r),this.endUndoMacro(),this.emitEvent("setProperty")}}setProperties(e,t,i,s=!0){this.beginUndoMacro(i),this.m_model.selectionMacro((()=>{for(let r=0;r<e.length;r++)this.setProperty(e[r],t[r],i,!s)})),this.endUndoMacro()}beginUndoMacro(e){return this._undoHistory.beginUndoMacro(e)}endUndoMacro(){this._undoHistory.endUndoMacro()}invertPriceScale(e){const t=e.properties().childs().isInverted;this.setProperty(t,!t.value(),zo)}togglePriceScaleAutoScaleMode(e){const t={autoScale:!e.isAutoScale()};this.setPriceScaleMode(t,e,Uo)}togglePriceScaleLockScaleMode(e){const t={lockScale:!e.isLockScale()};this.setPriceScaleMode(t,e,jo)}togglePriceScalePercentageScaleMode(e){const t={percentage:!e.isPercentage()};this.setPriceScaleMode(t,e,$o)}togglePriceScaleIndexedTo100ScaleMode(e){const t={indexedTo100:!e.isIndexedTo100()};this.setPriceScaleMode(t,e,qo)}togglePriceScaleLogScaleMode(e){const t={log:!e.isLog()};this.setPriceScaleMode(t,e,Ko)}setPriceScaleRegularScaleMode(e){this.setPriceScaleMode({log:!1,percentage:!1,indexedTo100:!1},e,Go)}withMacro(e,t){const i=this.beginUndoMacro(e);try{t()}finally{this.endUndoMacro()}return i}dataSources(){return this.m_model.dataSources()}orderedDataSources(e){return this.m_model.orderedDataSources(e)}barsMarksSources(){return this.m_model.barsMarksSources()}removeAllDrawingTools(){this.beginUndoMacro(Qo),this._removeAllDrawingToolsImpl(),this.endUndoMacro()}removeAllStudiesAndDrawingTools(){this.beginUndoMacro(ea),this._removeAllDrawingToolsImpl(),this._removeAllStudiesImpl(),this.endUndoMacro()}removeAllStudies(){this.beginUndoMacro(Jo),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();this.canZoomOut()&&(this.changeTimeScale(go),(0,is.doAnimate)({to:e/5,onStep:e=>{this.startScaleTime(0),this.scaleTimeTo(e),this.endScaleTime()}}))}zoomIn(){const e=this.timeScale().width();this.canZoomIn()&&(this.changeTimeScale(fo),(0,is.doAnimate)({to:e/5,onStep:e=>{this.startScaleTime(e),this.scaleTimeTo(0),this.endScaleTime()}}))}scrollChart(e){this.m_model.scrollEnabled()&&(this.startScrollTime(0),this.scrollTimeTo(e),this.endScrollTime())}startMovingSources(e,t,i,s){e.filter((e=>e.doesMovingAffectsUndo())).length&&(this._currentSourceMoveCommand=new ms(this.model(),e,vo,!1)),
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 ms(this.model(),[e],Oo.format({pointIndex:i}),!1),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=void 0,r=()=>{this.beginUndoMacro(i);const s=new ir(e,t,this.mainSeries(),i,this.model(),this._chartWidget);this._pushUndoCommand(s),this.emitEvent("setChartStyleProperty"),e.value(),this.endUndoMacro()};s?runOrGoPro(r,s.feature,{feature:s.featureName}):r()}}setPriceAutoScale(e,t,i){this._pushUndoCommand(new ti(this.m_model,e,t,t.state())),this.m_model.setPriceAutoScale(e,t,i)}setPriceScaleMode(e,t,i){if(!(0,Be.default)(t.mode(),e)){const s=new Kr.SetPriceScaleModeCommand(e,t,i,this.m_model);this._pushUndoCommand(s)}}setPriceScaleSelectionStrategy(e){if(this.m_model.properties().priceScaleSelectionStrategyName.value()===e)return;(0,u.trackEvent)("Chart","Change PriceScale Selection Strategy");const t=Xo.format({title:e});this.beginUndoMacro(t),this.setProperty(this.m_model.properties().priceScaleSelectionStrategyName,e,t);const i=new ro(this.m_model,e,t);this._pushUndoCommand(i),this.endUndoMacro()}setScaleRatioProperty(e,t,i){if(e.value()!==t){const s=new to.SetScaleRatioPropertiesCommand(e,t,i,this.m_model);this._pushUndoCommand(s)}}createUndoCheckpoint(){return this._undoHistory.createUndoCheckpoint()}undoToCheckpoint(e){this._undoHistory.undoToCheckpoint(e)}restorePropertiesForSource(e){(0,J.isLineTool)(e)?this._restoreLineToolFactoryDefaults(e):this._restoreStudyFactoryDefaults(e)}restoreLineToolsFactoryDefaults(e){1===e.length?this._restoreLineToolFactoryDefaults(e[0]):(this.beginUndoMacro(So),e.forEach((e=>this._restoreLineToolFactoryDefaults(e))),this.endUndoMacro())}restorePreferences(){const e=new eo(this.model());this._pushUndoCommand(e)}restoreState(e,t,i){return this.m_model.restoreState(e,t,i)}async clipboardCopy(e,t=this.selection().dataSources()){if(!(0,N.enabled)("datasource_copypaste"))return;const i=t.filter((e=>e.copiable()));if(0===i.length)return;for(const e of i)if((0,Z.isStudy)(e)&&e.isChildStudy())throw new Error("Can not copy child study");const s=(0,ts.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,N.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?co:ho).format({title:(0,ys.getTranslatedStringForSource)(Ps.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,N.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 Ir(this._model(),e,t);this._pushUndoCommand(i),(0,l.emit)("load_study_template")}createStudyInserter(e,t,i={}){const{stubTitle:s,isOverlay:r}=i,n={createStudy:(e,t,i,s,r,n,o,a,c,h,d,p)=>{if(!this.checkIfFeatureAvailable(e,o))return ia.logNormal("Cannot insert study "+e.id),null;(0,u.trackEvent)("studies","Study_"+e.id),"Compare@tv-basicstudies"===e.id&&(0,u.trackEvent)("compare","symbol:"+t.symbol),s&&this.m_model.removeSource(s);const _=this._insertStudy(e,t,r,n,o,a,c,h,d,null,p);return(0,l.emit)("study_event",_.study.id(),"create"),_},storeFailedStub:e=>{this._storeFailedStub(e)}};void 0!==s&&(n.createStub=()=>this.m_model.insertStudyStub(s,r).id(),n.removeStub=e=>this.m_model.removeStudyStub(e));const o=new Hn.StudyInserter(e,n);return o.setParentSources(t),o}applyLineToolTemplate(e,t,i){this.beginUndoMacro(i),this.saveLineToolState(e,i);const s=new jn(e,t,i);this._pushUndoCommand(s),this.saveLineToolState(e,i),this.endUndoMacro(),this.model().updateSource(e)}replayStatus(){return this.m_model.replayStatus()}setReplayStatus(e){return this.m_model.setReplayStatus(e)}isInReplay(){return this.m_model.isInReplay()}getSymbolString(){return this.m_model.getSymbolString()}interval(){return this.m_model.interval()}onInReplayStateChanged(){return this.m_model.onInReplayStateChanged()}switchToReplay(e,t){0}switchToRealtime(){0}async canChangeResolution(e){return this.model().canChangeResolution(e)}startCustomMoving(e,t,i){this._currentCustomMoveCommand=new qr(this.model(),e,t,i)}customMoveBeingProcessed(){return null!==this._currentCustomMoveCommand}processCustomMove(e){(0,n.ensureNotNull)(this._currentCustomMoveCommand).move(e)}endCustomMoving(){null!==this._currentCustomMoveCommand&&this._currentCustomMoveCommand.hasChanges()&&(this._pushUndoCommand(this._currentCustomMoveCommand),this._currentCustomMoveCommand=null)}state(e,t,i,s){return this.m_model.state(e,t,i,s)}panes(){return this.m_model.panes()}cloneLineTools(e,t){for(let t=0;t<Math.min(5,e.length);++t)e[t],ri();this.beginUndoMacro(Co);const i=new ds(this._model(),e,t,Co);this._pushUndoCommand(i);const s=i.newIds().map((e=>(0,n.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,uo.format({title:(0,
ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,e)}),i):this.cancelCreatingLine()}removeSelectedSources(){const e=this._model().selection().dataSources();if(!e.length)return;const t=(e.length>1?po:uo).format({title:(0,ys.getTranslatedStringForSource)(Ps.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(),o=r.lineToolsGroupModel();this.beginUndoMacro(i),r.selectionMacro((s=>{const a=new Map;e.forEach((e=>{if((0,J.isLineTool)(e)){const t=o.groupForLineTool(e);if(null!==t){const i=a.get(t)||[];i.push(e),a.set(t,i)}null!==e.linkKey().value()&&(0,je.removeLineTool)({withUndo:!0,model:this.model(),linkKey:(0,n.ensureNotNull)(e.linkKey().value()),symbol:this.model().mainSeries().symbol(),lineToolState:e.state(!1),sourceTitle:(0,ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,e)})}}));const l=new us.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()}async scrollToLineTool(e){const t=this.timeScale().logicalRange();if(null===t)return;const i=e.points().map((e=>e.index)),s=this.timeScale().points().range().value();if(null===s)return;let r=s.firstIndex;const o=s.lastIndex,a=t.length()/2;if(0===i.length||i.some((e=>t.contains(e))))return;const l=()=>{const t=e.points().map((e=>e.index)),i=t.filter((e=>e<=o)).reduce(((e,t)=>null===e?t:Math.max(e,t)),null);return null!==i?i:t.reduce(((e,t)=>Math.min(e,t)))};let c=l();if(r-a>c){const t=e.points().map((e=>e.time)).filter(P.notUndefined).map((e=>1e3*e));if(0===t.length)return;const i=t.reduce(((e,t)=>Math.min(e,t)),t[0]);await this.model().gotoTime(i),c=l();if((0,n.ensureNotNull)(this.timeScale().logicalRange()).contains(c))return;r=(0,n.ensureNotNull)(this.timeScale().points().range().value()).firstIndex}r-a>c&&this.mainSeries().setGotoDateResult({timestamp:(0,n.ensureNotNull)(this.timeScale().points().valueAt(r)),eod:!0});const h=this.timeScale().width()/2,d=this.timeScale().indexToCoordinate(c);this.model().stopTimeScaleAnimation(),this.model().setTimeScaleAnimation(new es.Animation({from:0,to:h-d,duration:$i.dur,easing:$i.easingFunc.easeInOutCubic}))}mergeSourceUp(e){const t=new fs.MergeUpUndoCommand(this._model(),e,Po);this._mergeUnmergeSource(e,t)}mergeSourceDown(e){const t=new fs.MergeDownUndoCommand(this._model(),e,xo);this._mergeUnmergeSource(e,t)}mergeToPane(e,t,i){const s=this._model().panes().indexOf(t),r=new fs.MergeToTargetPane(this._model(),e,s,To,i);this._mergeUnmergeSource(e,r)}unmergeSourceUp(e){const t=new gs.UnmergeUpUndoCommand(this._model(),e,Io);this._mergeUnmergeSource(e,t)}unmergeSourceDown(e){const t=new gs.UnmergeDownUndoCommand(this._model(),e,Mo);this._mergeUnmergeSource(e,t)}unmergeToNewBottomPane(e){const t=new gs.UnmergeToNewBottomPane(this._model(),e,Ao);this._mergeUnmergeSource(e,t)}moveLeft(){this.beginUndoMacro(Yo),(0,is.doAnimate)({
to:this.m_model.timeScale().width()/5,onStep:e=>{this.startScrollTime(e),this.scrollTimeTo(0),this.endScrollTime()},onComplete:()=>{this.endUndoMacro()}})}moveRight(){this.beginUndoMacro(Zo),(0,is.doAnimate)({to:this.m_model.timeScale().width()/5,onStep:e=>{this.startScrollTime(0),this.scrollTimeTo(e),this.endScrollTime()},onComplete:()=>{this.endUndoMacro()}})}availableZOrderOperations(e){const t=this._model().lineToolsGroupModel(),i=e.filter(J.isLineTool),s=i.map((e=>t.groupForLineTool(e)));(0,n.assert)(new Set(s).size<=1,"Cannot move line tools from different group");const r=0===s.length?null:s[0];let o={bringForwardEnabled:!1,bringToFrontEnabled:!1,sendBackwardEnabled:!1,sendToBackEnabled:!1};const a=new Set(i);for(const t of(0,vs.sortSources)(e)){if((0,J.isLineTool)(t)&&null!==r){const e=(0,vs.sortSources)(r.lineTools().filter((e=>!a.has(e)||e===t)));o=ra(o,{bringForwardEnabled:t!==e[e.length-1],bringToFrontEnabled:t!==e[e.length-1],sendBackwardEnabled:t!==e[0],sendToBackEnabled:t!==e[0]});continue}const e=(0,n.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();o=ra(o,{bringForwardEnabled:i!==l,bringToFrontEnabled:i!==l,sendBackwardEnabled:i!==s,sendToBackEnabled:i!==s})}return o}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,J.isLineTool)(i)){const s=this._model().lineToolsGroupModel().groupForLineTool(i);if(null!==s){const i=s.lineTools();t=new Ws(this.model(),(0,vs.sortSources)(e),i[0])}}null===t&&(t=new Rs(this.model(),(0,vs.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,J.isLineTool)(i)){const s=this._model().lineToolsGroupModel().groupForLineTool(i);if(null!==s){const i=s.lineTools();t=new Os(this.model(),(0,vs.sortSources)(e),i[i.length-1])}}null===t&&(t=new Bs(this.model(),(0,vs.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=no.format({title:(0,ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,e[0])});this._sendBackOrBringForward(t,(0,vs.sortSources)(e),((e,t)=>new zs(this.model(),e,t)))}bringForward(e){if(!this.availableZOrderOperations(e).bringForwardEnabled)throw new Error("Bring forward operation is unavailable");const t=oo.format({title:(0,ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,e[0])});this._sendBackOrBringForward(t,(0,vs.sortSources)(e),((e,t)=>new js(this.model(),e,t)))}insertAfter(e,t){e=(0,vs.sortSources)(e);const i=ao.format({title:(0,ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,e[0]),target:(0,
ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,t)});this._insertAfterOrBefore(i,e,t,(()=>new Os(this.model(),e,t)))}insertBefore(e,t){e=(0,vs.sortSources)(e);const i=lo.format({title:(0,ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,e[0]),target:(0,ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,t)});this._insertAfterOrBefore(i,e,t,(()=>new Ws(this.model(),e,t)))}detachToRight(e,t){(0,u.trackEvent)("Chart","Move to new right scale");const i=Lo.format({title:(0,ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,e)}),s=new Rr.MoveToNewPriceScaleUndoCommand(this.model(),e,t,"right",i);this._pushUndoCommand(s),this.emitEvent("moveSource",[e])}detachToLeft(e,t){(0,u.trackEvent)("Chart","Move to new left scale");const i=ko.format({title:(0,ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,e)}),s=new Rr.MoveToNewPriceScaleUndoCommand(this.model(),e,t,"left",i);this._pushUndoCommand(s),this.emitEvent("moveSource",[e])}detachNoScale(e,t){(0,u.trackEvent)("Chart","Make source no scale");const i=Do.format({title:(0,ys.getTranslatedStringForSource)(Ps.TitleDisplayTarget.StatusLine,e)}),s=new Rr.MoveToNewPriceScaleUndoCommand(this.model(),e,t,"overlay",i);this._pushUndoCommand(s),this.emitEvent("moveSource",[e])}moveToScale(e,t,i,s,r){(0,u.trackEvent)("Chart","Move source to target scale"),this.beginUndoMacro(s);const n=new Rr.MoveToExistingPriceScaleUndoCommand(this.model(),e,t,i,s),o=r?null:(0,ss.sourceNewCurrencyOnPinningToPriceScale)(e,i,this._model()),a=r?null:(0,Xr.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(ta),this._pushUndoCommand(new Wn(this.model().linkingGroupIndex(),e,ta)),this._model().setShouldBeSavedEvenIfHidden(!0),this._undoHistory.endUndoMacro()}startScrollPrice(e,t,i){t.isAutoScale()||(this._initialPriceScrollState=t.state(),this._initialPriceScrollPos=i,this._model().startScrollPrice(e,t,i))}scrollPriceTo(e,t,i){t.isAutoScale()||(this._initialPriceScrollState&&this._initialPriceScrollPos&&Math.abs(this._initialPriceScrollPos-i)>20&&(this._pushUndoCommand(new ti(this.m_model,e,t,this._initialPriceScrollState,void 0,!1)),this._initialPriceScrollState=null,this._initialPriceScrollPos=null),this._model().scrollPriceTo(e,t,i))}endScrollPrice(e,t){t.isAutoScale()||(this._initialPriceScrollState=null,this._initialPriceScrollPos=null,this._model().endScrollPrice(e,t))}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 Xt(this.model(),this._initialTimeScrollState,Eo,!1)),this._initialTimeScrollPos=null,
this._initialTimeScrollState=null),this.model().scrollTimeTo(e)}endScrollTime(){this.model().endScrollTime(),this._initialTimeScrollPos=null,this._initialTimeScrollState=null}startScaleTime(e){const t=this.timeScale();this._initialTimeScaleState={rightOffset:t.rightOffset(),barSpacing:t.barSpacing()},this.model().startScaleTime(e)}scaleTimeTo(e){null!==this._initialTimeScaleState&&this._initialTimeScaleState.barSpacing!==this.timeScale().barSpacing()&&(this._pushUndoCommand(new Xt(this.model(),this._initialTimeScaleState,Vo,!0)),this._initialTimeScaleState=null),this.model().scaleTimeTo(e)}endScaleTime(){this.model().endScaleTime()}resetTimeScale(){this.changeTimeScale(Bo,this.timeScale().resetAvailable().value()),this.model().resetTimeScale()}changeTimeScale(e,t=!0){const i=this.timeScale(),s={rightOffset:i.rightOffset(),barSpacing:i.barSpacing()};this._pushUndoCommand(new Xt(this.model(),s,e,t))}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,n.ensureNotNull)(this._scalePriceInfo);(0,Be.default)(i.priceScaleState,t.state())||this._pushUndoCommand(new ti(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,n.ensureNotNull)(this._scalePriceInfo);(0,Be.default)(i.priceScaleState,t.state())||this._pushUndoCommand(new ti(this.model(),e,t,i.priceScaleState,i.tryMergeConsecutiveScales)),this._scalePriceInfo=null}resetPriceScale(e,t){const i=t.state();this.model().resetPriceScale(e,t),(0,Be.default)(i,t.state())||this._pushUndoCommand(new ti(this.m_model,e,t,i))}rearrangePanes(e,t){const i=new Ys(this._model(),e,t);this._pushUndoCommand(i)}movePane(e,t){const i=new Ys(this._model(),e,t);this._pushUndoCommand(i)}toggleCollapsedPane(e){const t=this.panes().findIndex((t=>t===e));t<0||this._pushUndoCommand(new ns(this._model(),t))}readOnly(){return this.m_model.readOnly()}checkIfFeatureAvailable(e,t){const i=t.length>0,s=this.canCreateStudy({id:e.id,child:i,fundamental:!1});return!!s.success||(aa(this.model(),s),!1)}async pasteSourceFromClip(e,t,i){const s=t;if(!s||0===s.sources.length)return null;const r=e||(0,n.ensureNotNull)(this.model().paneForSource(this.mainSeries()));if(!s.sources.some((e=>"drawing"!==e.type||null!==r.clipboardLineToolOwnerSource(e.source.id))))return null;const o=Array.from(new Set(s.sources.filter(ts.isLineToolClipboardData).map((e=>e.source.type))));await Promise.all(o.map((e=>(0,J.initLineTool)(e)))),this.beginUndoMacro(Fo.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&&(ri(),a+=1),c.push(e),l.push(e)}else"study"===t.type&&t.source&&t.source.metaInfo&&this.checkIfFeatureAvailable(new Yi.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,un.mergeIntervalVisibilitiesDefaults)(t.source.state.intervalsVisibilities),(0,un.makeIntervalsVisibilitiesVisibleAtInterval)(t.source.state.intervalsVisibilities,this.model().mainSeries().intervalObj());const r=new Er(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 Ur(this.model(),e,null==t?void 0:t.id());this._pushUndoCommand(i);const s=(0,n.ensureNotNull)(i.state()).id;return(0,l.emit)("study_event",s,"paste_study"),(0,n.ensureNotNull)(this._model().dataSourceForId(s))}removePane(e){const t=this.m_model.panes()[e].dataSources().slice();this.removeSources(t,!1,Ho)}createPane(e){return this.m_model.createPane(e)}setPriceScaleCurrency(e,t){const i=new Vr.SetPriceScaleCurrencyUndoCommand(this.m_model,e,t,bo);this._pushUndoCommand(i)}setPriceScaleUnit(e,t){const i=new Br.SetPriceScaleUnitUndoCommand(this.m_model,e,t,wo);this._pushUndoCommand(i)}setSymbol(e,t){e.symbolSameAsResolved(t)||this._pushUndoCommand(new Wr(e,t,this._chartWidget))}setResolution(e,t){Xi.Interval.isEqual(e.interval(),t)||this._pushUndoCommand(new On(e,t,this._chartWidget))}hideMaximizedPaneIfRequired(){this._chartWidget.isMaximizedPane()&&this._chartWidget.toggleMaximizePane(null)}syncCrosshair(e,t,i){this._chartWidget.chartWidgetCollection().syncCrosshair(e,this._chartWidget.id(),t,i)}loadingScreen(){return this._chartWidget.screen}chartLoadTheme(e,t,i){const s=new Rn(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 jr(this.model(),e,t,i,s);this._pushUndoCommand(r)}applyPreferences(e){throw new Error("Not implemented")}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 ms(this.m_model,[e],t))}resetScales(){this._model().stopTimeScaleAnimation(),this.beginUndoMacro(Ro),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,pi.viewportChangeEvent)())}shareLineTools(e,t){}canCreateStudy(e,t){return this.model().chartApi().canCreateStudy(e,t)}chartWidgetCollectionLock(){return this._chartWidget.chartWidgetCollection().lock}onSymbolIntervalChanged(){return this.m_model.onSymbolIntervalChanged()}paneBeingCreatedLineOn(){return this.m_model.paneBeingCreatedLineOn()}invalidate(e){this.m_model.invalidate(e)}setWidth(e){this.m_model.setWidth(e)}setPaneHeight(e,t){this.m_model.setPaneHeight(e,t)}dataSourceForId(e){return this.m_model.dataSourceForId(e)}lineBeingEdited(){return this.m_model.lineBeingEdited()}sourcesBeingMoved(){return this.m_model.sourcesBeingMoved()}gridSource(){return this.m_model.gridSource()}watermarkSource(){return this.m_model.watermarkSource()}mainSeriesScaleRatioProperty(){return this.m_model.mainSeriesScaleRatioProperty()}setHoveredSource(e,t){this.m_model.setHoveredSource(e,t)}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)}version(){return this.m_model.version()}restart(){this.m_model.restart()}disconnect(){this.m_model.disconnect()}calculateDefaultTags(){return this.m_model.calculateDefaultTags()}_model(){return this.m_model}_pushUndoCommand(e){this._undoHistory.pushUndoCommand(e)}_mergeUnmergeSource(e,t){this.beginUndoMacro(t.text());const i=(0,n.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 ps.ExcludeLineToolsFromGroupUndoCommand(this._model(),e,e.lineTools()))})),this._pushUndoCommand(t),this.endUndoMacro()}_insertStudy(e,t,i,s,r,o,a,l,c,h,d,u){const p=Wo.format({title:e.description});this.beginUndoMacro(p);const _=new $r(this.model(),e,t,i,s,r,o,a,l,c,h||null,u,p);this._pushUndoCommand(_);const m=_.insertedStudy();if(void 0!==d){const e=new Kr.SetPriceScaleModeCommand(d,(0,n.ensureNotNull)(m.priceScale()),null,this.model());this._pushUndoCommand(e)}return this.endUndoMacro(),{study:m,startPromise:_.lastInsertionStartPromise()}}_storeFailedStub(e){const t=Wo.format({title:e.title()});this.beginUndoMacro(t);const i=new Un(this.model(),e,t);this._pushUndoCommand(i),this.endUndoMacro()}async _processSpecialLineToolsContents(e,t,i){0}_insertAfterOrBefore(e,t,i,s){const r=(0,n.ensureNotNull)(this._model().paneForSource(i));if(t.some((e=>(0,J.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,n.ensureNotNull)(this.model().paneForSource(e))!==r&&this.mergeToPane(e,r)}));const o=s();this._pushUndoCommand(o),
this.emitEvent("changeZOrder",[t]),this.endUndoMacro()}_sendBackOrBringForward(e,t,i){const s=new Map;t.forEach((e=>{const t=(0,n.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,je.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(vo);const r=i.firstBar(),n=this.timeScale().indexToCoordinate(r),o=r+(3===e?1:2===e?-1:0),a=this.timeScale().indexToCoordinate(o);return je.isDirectionalMovementActive.setValue(!0),s.forEach((t=>{const{startPrice:i,priceStep:s,priceScale:l,firstValue:c}=t,h=i+(0===e?s:1===e?-s:0),d=l.priceToCoordinate(i,c),u=l.priceToCoordinate(h,c),p={logical:{index:r,price:i},screen:new Oe.Point(n,d)},_={logical:{index:o,price:h},screen:new Oe.Point(a,u)};this.startMovingSources(t.sources,p,null),this.moveSources(_),this.endMovingSource(!1,!0)})),je.isDirectionalMovementActive.setValue(!1),this.endUndoMacro(),!0}_restoreStudyFactoryDefaults(e){const t=new dn(this.m_model,e);this._pushUndoCommand(t)}_restoreLineToolFactoryDefaults(e){this.beginUndoMacro(yo),this.saveLineToolState(e,yo);const t=new cn(this.m_model,e.properties(),yo);this._pushUndoCommand(t),this.saveLineToolState(e,yo),this.endUndoMacro(),this.model().updateSource(e)}_removeAllDrawingToolsImpl(e){this.selectionMacro((()=>{this.lineBeingCreated()&&this.cancelCreatingLine();this.dataSources().filter(J.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(Z.isStudy).filter((e=>!e.isChildStudy()&&e.removeByRemoveAllStudies())),i=e.filter(Z.isStudyStub);t.concat(i).forEach((e=>this.removeSource(e,!1)))}}var ca=i(16638),ha=i(36986),da=i(79612),ua=i(17402);const pa=a.t(null,void 0,i(47773));var _a=i(3615);class ma 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 pa.format({linkStart:`<a target="_blank" href="${t.toString()}">`,linkEnd:"</a>"})}_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,_a.showWarning)({title:"Unavailable",html:this._getPopupContent(),onClose:()=>this._onPopupClosed()})}}const ga=(0,m.getLogger)("ChartApi.AbstractSession");var fa;!function(e){e[e.Disconnected=0]="Disconnected",e[e.Registered=1]="Registered",e[e.Connected=2]="Connected"}(fa||(fa={}));class va extends class{constructor(e,t,i){this._isConnected=new H.WatchedValue(!1),this._state=0,this._isConnectForbidden=!1,this._sessionId="",this._sessionIdChanged=new R.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,n.assert)(!this._isConnectForbidden,"Cannot call connect because it is forbidden at this moment"),this._setSessionId(`${this._sessionPrefix}_${(0,Mr.randomHash)()}`),this._logNormal("Connecting session - wait until transport stay connected"),this._state=1,this._chartApi.createSession(this._sessionId,this))}disconnect(){0!==this._state&&((0,n.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)}serverTime(){return this._chartApi.serverTime()}_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,n.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){ga.logNormal(this._generateLogMessage(e))}_logError(e){ga.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 R.Delegate,this._symbolResolveMap=new Map,this._lastSymbolResolveInfoMap=new Map,this._disableStatistics=t}destroy(){this._criticalError.destroy(),this._handler=null,this._symbolResolveMap.clear(),super.destroy()}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 this._getChartApi().requestMoreTickmarks(this.sessionId(),e,t,i)}setFutureTickmarksMode(e){return this._getChartApi().setFutureTickmarksMode(this.sessionId(),e)}canCreateStudy(e,t){return this._getChartApi().canCreateStudy(this.sessionId(),e,t)}getStudyCounter(){
return this._getChartApi().getStudyCounter(this.sessionId())}getFundamentalCounter(){return this._getChartApi().getFundamentalCounter(this.sessionId())}createStudy(e,t,i,s,r,n,o){return this._getChartApi().createStudy(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)}notifyStudy(e,t,i){return this._getChartApi().notifyStudy(this.sessionId(),e,t,i)}removeStudy(e){return this._getChartApi().removeStudy(this.sessionId(),e)}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 ya=i(14381);i(66831);var Sa=i(8025),ba=i(7507),wa=i(7029),Ca=i(34585),Pa=i(80387),xa=i(62400);var Ta=i(86235);function Ia(e){const t=e.options(),s={label:(0,Ca.appendEllipsis)(wa.t(null,void 0,i(2569))),statName:"ChangeInterval",onExecute:()=>(0,Ta.showChangeIntervalDialogAsync)({initVal:Xs.linking.interval.value(),selectOnInit:!0})};return!(0,N.enabled)("show_interval_dialog_on_key_press")||t.readOnly||t.hideSymbolSearch||(s.shortcutHint=",",s.hotkeyGroup=e.hotkeys(),s.hotkeyHash=188),new ht.Action({actionId:"Chart.Dialogs.ShowChangeInterval",options:s})}i(67375);class Ma extends ht.Action{constructor(e,t=new H.WatchedValue(!1)){super({...e,options:{...e.options,checkable:!0,checked:t.value(),onExecute:()=>{this._wv.setValue(!this._wv.value())}}}),this._updateChecked=e=>{this.update({checked:e})},t.subscribe(this._updateChecked),this._wv=t}destroy(){this._wv.unsubscribe(this._updateChecked),super.destroy()}}var Aa=i(99531);const La=(0,N.enabled)("show_average_close_price_line_and_label"),ka=new W.TranslatedString("scale price chart only",wa.t(null,void 0,i(63796))),Da=new W.TranslatedString("stay in drawing mode",wa.t(null,void 0,i(4114))),Ea=new W.TranslatedString("hide marks on bars",wa.t(null,void 0,i(62249))),Va=new W.TranslatedString("change symbol last value visibility",wa.t(null,void 0,i(67453))),Ba=(new W.TranslatedString("change symbol previous close value visibility",wa.t(null,void 0,i(4729))),
new W.TranslatedString("change previous close price line visibility",wa.t(null,void 0,i(58419))),new W.TranslatedString("change symbol labels visibility",wa.t(null,void 0,i(73357)))),Ra=new W.TranslatedString("change indicators value labels visibility",wa.t(null,void 0,i(64729))),Na=new W.TranslatedString("change indicators name labels visibility",wa.t(null,void 0,i(24893))),Oa=(new W.TranslatedString("change bid and ask labels visibility",wa.t(null,void 0,i(69362))),new W.TranslatedString("change bid and ask lines visibility",wa.t(null,void 0,i(52919))),new W.TranslatedString("change pre/post market price label visibility",wa.t(null,void 0,i(30870))),new W.TranslatedString("change pre/post market price line visibility",wa.t(null,void 0,i(11718))),new W.TranslatedString("change high and low price labels visibility",wa.t(null,void 0,i(24226)))),Fa=new W.TranslatedString("change high and low price lines visibility",wa.t(null,void 0,i(80692))),Wa=new W.TranslatedString("change average close price label visibility",wa.t(null,void 0,i(76852))),Ha=new W.TranslatedString("change average close price line visibility",wa.t(null,void 0,i(1022))),za=new W.TranslatedString("change countdown to bar close visibility",wa.t(null,void 0,i(39383))),Ua=new W.TranslatedString("change plus button visibility",wa.t(null,void 0,i(96379))),ja=new W.TranslatedString("change session breaks visibility",wa.t(null,void 0,i(38413))),Ga=new W.TranslatedString("change price line visibility",wa.t(null,void 0,i(8662)));i(61442);const qa=(0,m.getLogger)("ChartWidget",{color:"#606"}),$a=N.enabled("chart_content_overrides_by_defaults"),Ka=N.enabled("symphony_embed"),Ya=new W.TranslatedString("hide {title}",a.t(null,void 0,i(13017)));const Za={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:c.CheckMobile.any(),indicatorsDialogShortcutEnabled:!0,handleScale:{mouseWheel:!0,pinch:!0,axisPressedMouseMove:{time:!0,price:!0}},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!0}};var Xa;function Ja(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))}!function(e){e[e.ShowTimeAxisMinChartHeight=61]="ShowTimeAxisMinChartHeight",
e[e.ShowPriceAxisMinChartWidth=102]="ShowPriceAxisMinChartWidth"}(Xa||(Xa={}));const Qa=new Set(["Volume@tv-basicstudies","Compare@tv-basicstudies","Overlay@tv-basicstudies","Dividends@tv-basicstudies","Earnings@tv-basicstudies","Splits@tv-basicstudies","BarSetContinuousRollDates@tv-corestudies","Sessions@tv-basicstudies","VbPSessionsRough@tv-volumebyprice","AnchoredVWAP@tv-basicstudies","RegressionTrend@tv-basicstudies","VbPAnchored@tv-basicstudies","VbPFixed@tv-basicstudies","VbPFixed@tv-volumebyprice"]),el=(0,r.default)((()=>{window.ChartApiInstance.setIsNonCountedStudyFn((e=>Qa.has(e)))}));class tl{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 R.Delegate,this._isDestroyed=!1,this._customLegendWidgetsFactoryMap=new Map,this._backgroundTopTheme=new H.WatchedValue("light"),this._backgroundBasedTheme=new H.WatchedValue("light"),this._backgroundBottomTheme=new H.WatchedValue("light"),this._lhsAxesWidth=0,this._rhsAxesWidth=0,this._lhsPriceAxisWidthChanged=new R.Delegate,this._rhsPriceAxisWidthChanged=new R.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 R.Delegate,this._redraw=new R.Delegate,this._isVisible=new H.WatchedValue(!0),this._collapsed=new H.WatchedValue(!1),this._dataWindowWidget=null,this._resizeHandler=null,this._spinner=null,this._properties=null,this._symbolWV=new H.WatchedValue,this._resolutionWV=new H.WatchedValue,this._actions=null,this._updateThemedColorBound=this._updateThemedColor.bind(this),this._disconnected=new R.Delegate,this._reconnectBailout=new R.Delegate,this._connected=new R.Delegate,this._chartWidgetInitialized=new R.Delegate,this._saveChartService=null,this._objectTreeDialogController=null,this._chartPaintedPromise=null,this._noExchangeSubscrptionWarning=null,this._paneWidgetsSharedState=new Ni,this._onZoom=new R.Delegate,this._onScroll=new R.Delegate,this._availableScreen=null,this._hoveredPriceAxes=new Set,this._anyAxisHovered=new H.WatchedValue(!1),this._linkingGroupIndex=new H.WatchedValue(null),this._isHovered=new H.WatchedValue(!1),this._activeHint=null,this._eventHintDeferredPromise=null,this._warningHintDeferredPromise=null,this._setSymbolIntervalContentOverrides={},this._ariaPriceDescription=null,this._updateScalesActions=()=>{const e=this.actions(),t=this.model().mainSeries(),i=t.priceScale(),s=t.properties(),r=i.isLockScale(),n=6===s.childs().style.value();e.percentSeriesScale.update({disabled:r||n,checked:i.isPercentage()}),e.logSeriesScale.update({disabled:r||n,checked:i.isLog()}),
e.regularSeriesScale.update({disabled:r||n,checked:i.isRegular()}),e.indexedTo100SeriesScale.update({disabled:r||n,checked:i.isIndexedTo100()}),e.invertSeriesScale.update({checked:i.isInverted()}),e.lockSeriesScale.update({checked:i.isLockScale()}),e.autoSeriesScale.update({checked:i.isAutoScale(),disabled:i.properties().childs().autoScaleDisabled.value()})},this._invalidationHandler=e=>{if(!(e instanceof ve.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,n.ensureNotNull)((0,n.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,P.merge)((0,P.clone)(Za),e),this._chartWidgetCollection=this._options.chartWidgetCollection,this._isActive=new H.WatchedValue(!!this._options.isActive),this._options.customLegendWidgetFactories&&(this._customLegendWidgetsFactoryMap=this._options.customLegendWidgetFactories),this._subscribeToDrawingState(),this.withModel(this,(()=>{const e=this.model().model();e.backgroundTopColor().subscribe(this._updateThemedColorBound),e.backgroundColor().subscribe(this._updateThemedColorBound)})),this._errorRenderer=new me(this),this._scrollHelper=new $(this),this._objectTreeDialogController=w.getInstance(),this._properties=new Zs.DefaultProperty({defaultName:"chartproperties",useUserPreferences:this._options.useUserChartPreferences,excludedDefaultsKeys:["scalesProperties.axisHighlightColor","scalesProperties.axisLineToolLabelBackgroundColorActive","scalesProperties.axisLineToolLabelBackgroundColorCommon","scalesProperties.showPriceScaleCrosshairLabel","scalesProperties.showTimeScaleCrosshairLabel","scalesProperties.crosshairLabelBgColorLight","scalesProperties.crosshairLabelBgColorDark"]}),this._startSpinner(this._options.container.value()),this._chartSession=new va(window.ChartApiInstance),el(),this._isMultipleLayout=(0,V.combine)((e=>(0,Se.isMultipleLayout)(e)),this._chartWidgetCollection.layout.weakReference()),this._properties.childs().scalesProperties.childs().scaleSeriesOnly.subscribe(null,(()=>{const e=this.model().model();e.recalculateAllPanes((0,pi.viewportChangeEvent)()),e.invalidate(ve.InvalidationMask.full())})),this._hotkeys=p.createGroup({desc:"Chart actions",isDisabled:()=>!this.isActive().value()}),this._ariaPriceDescription=da.AriaCrosshairPriceDescription.getInstance(),this.withModel(this,(()=>{this.model().crossHairSource().moved().subscribe(this,this._updateAriaPriceDescription)}))}refreshMarks(){
this.model().barsMarksSources().forEach((e=>e.refreshData()))}clearMarks(e){this.model().barsMarksSources().forEach((t=>t.clearMarks(e)))}setTimezone(e){const t=e;t&&(0,B.timezoneIsAvailable)(t)?this.properties().childs().timezone.setValue(t):console.warn("Incorrect timezone: "+JSON.stringify(t))}getTimezone(){return this.properties().childs().timezone.value()}destroy(){var e,t,i;this._unsetActions(),this._hotkeys&&this._hotkeys.destroy(),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 r=this.model().mainSeries().seriesSource();this._chartSession.setVisibleTimeRange((0,n.ensureNotNull)(r.instanceId()),r.turnaround(),e,t,null!=i?i:{},null!=s?s:()=>{})}}lineToolsSynchronizer(){return this._lineToolsSynchronizer}actions(){return null===this._actions?this._setActions():this._actions}requestFullscreen(){this.getResizerDetacher().requestFullscreen()}exitFullscreen(){this.getResizerDetacher().exitFullscreen()}inFullscreen(){return this.getResizerDetacher().fullscreen.value()}model(){return(0,n.ensureNotNull)(this._model)}id(){return this._id}layoutId(){return this._chartWidgetCollection.metaInfo.uid.value()}isActive(){return this._isActive.readonly()}isHovered(){return this._isHovered.readonly()}crossHairSyncEnabled(){return this._chartWidgetCollection.lock.crosshair.value()}isVisible(){return this._isVisible.value()}setVisible(e){this._isVisible.setValue(e)}visible(){return this._isVisible.readonly()}isCollapsed(){return this._collapsed.value()}setCollapsed(e){this._collapsed.setValue(e)}collapsed(){return this._collapsed.readonly()}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(!N.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,85662)),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 N.enabled("property_pages")&&e.userEditEnabled()?e===this.model().model().mainSeries()?this.showGeneralChartProperties(t):((i=i||{}).onResetToDefault=()=>{((0,J.isLineTool)(e)||(0,Z.isStudy)(e))&&this.model().restorePropertiesForSource.bind(this._model,e)},this._showChartProperties(e,t,i,s)):Promise.resolve(null)}options(){return this._options}async showChartPropertiesForSources(e){if(!N.enabled("property_pages"))return Promise.resolve(null);const{sources:t,title:s,tabName:r,renamable:o}=e,l=(0,n.ensureNotNull)(this._model),c=F(t.map((e=>e.properties().childs()))),h=F(t.map((e=>e.properties().childs().intervalsVisibilities))),[{createPropertyPage:d},{getSelectionStylePropertiesDefinitions:u},{getSelectionIntervalsVisibilitiesPropertiesDefinition:p},{getSelectionCoordinatesPropertyDefinition:_}]=await Promise.all([Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,57717)),Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,72707)),Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,26434)),Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,73174))]);return async function(e){
const{SourcesPropertiesEditorRenderer:t}=await Promise.all([i.e(5757),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(7399),i.e(2248),i.e(7769),i.e(7125),i.e(8077),i.e(6625),i.e(5546),i.e(55),i.e(4392),i.e(3114),i.e(5666),i.e(8432),i.e(3204),i.e(1729),i.e(9486),i.e(4959),i.e(6665),i.e(4447),i.e(8065),i.e(3645),i.e(1259),i.e(7902),i.e(6955),i.e(5622),i.e(2417),i.e(3925),i.e(889),i.e(71),i.e(223),i.e(2227),i.e(3443),i.e(6014),i.e(2079),i.e(3098),i.e(2751),i.e(2264),i.e(7223),i.e(4774),i.e(6408),i.e(9370),i.e(6780)]).then(i.bind(i,66512)),s=new t(e);return null!==M&&(M.hide(),M=s),s.show(),s}({sources:t,propertyPages:[d(u(c,l),"style",a.t(null,void 0,i(92516))),d({definitions:[_(t,l)]},"displacement",a.t(null,void 0,i(70132))),d(p(h,l),"visibility",a.t(null,void 0,i(40091)))],undoModel:l,title:s,activeTabId:r,renamable:o})}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,n.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,Ya.format({title:new W.TranslatedString(e[0].name(),e[0].title(Ps.TitleDisplayTarget.StatusLine))}))}}hideSelectedObject(){this.hideDataSources(this.model().selection().dataSources().filter((e=>!0)))}unlinkSelectedLine(){const e=(0,n.ensureNotNull)(this._model),t=e.selection().lineDataSources();e.unlinkLines(t)}selectPointMode(){return(0,n.ensureNotNull)(this._model).model().selectPointMode()}cancelRequestSelectPoint(){const e=(0,n.ensureNotNull)(this._model).model();e.cancelRequestSelectPoint(),e.setReplayStatus(e.isInReplay().value()?3:0),e.clearCurrentPosition()}requestSelectPoint(e,t){const i=(0,n.ensureNotNull)(this._model);return e.selectPointMode===je.SelectPointMode.Replay&&i.model().setReplayStatus(1),new Promise(((s,r)=>{const n=()=>!!this.isVisible()||(r("Chartwidget must be visible"),this.cancelRequestSelectPoint(),!1);if(!n())return;(0,je.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()===je.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,pi.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,ve.InvalidationMask.light().invalidateForPane(e)))}else for(let e=0;e<this._paneWidgets.length;++e){const t=this._paneWidgets[e];s.push(i(t,ve.InvalidationMask.light().invalidateForPane(e))),e<this._paneWidgets.length-1&&s.push(this._paneSeparators[e].image())}let r;this._timeAxisWidget&&(this._timeAxisWidget.paint(ve.InvalidationLevel.Light),r=this._timeAxisWidget.getScreenshotData()),window.TradingView.printing=!1,this.model().selectionMacro((e=>{t.forEach((t=>{e.addSourceToSelection(t)}))})),this.model().model().recalculateAllPanes((0,pi.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,r){return this._insertStudyOrReplaceStub(e,t,void 0,i,s,r)}replaceStubByStudy(e,t,i,s,r,n){return e.updateDescriptor(t),this._insertStudyOrReplaceStub(t,i,e,s,r,n)}addOverlayStudy(e,t,i){const s=this.model();return this._options&&this._options.isSymbolAvailable?this._options.isSymbolAvailable(e).then((async r=>{if(!r)return null;await(0,ca.studyMetaInfoRepository)().requestMetaInfo();const n=s.createStudyInserter({type:"java",studyId:"Overlay@tv-basicstudies"},[]),o={allowExtendTimeScale:i};if(N.enabled("use_overrides_for_overlay")){const e=(0,pn.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((async i=>i?(await(0,ca.studyMetaInfoRepository)().requestMetaInfo(),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,{signNegative:!0,useRtlFormat:!1}),n=e=>null==e?"":e+"";e={resolution:s.interval(),symbol:s.symbol(),values:s.legendValuesProvider().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=je.tool.value();this._model.model().setCurrentTool(e);const t=(0,ye.lastMouseOrTouchEventInfo)();if(t.isTouch){const e=this._maximizedPaneWidget||this._paneWidgets[0];if(e.hasState()&&(!t.stylus&&(this._isLineToolModeExceptBrush()||(0,je.toolIsMeasure)(je.tool.value()))||this.selectPointMode().value()!==je.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,pi.sourceChangeEvent)(i.id()))}}}trackingModePaneWidget(){if(!(0,ye.lastMouseOrTouchEventInfo)().isTouch)return null;for(const e of this.paneWidgets())if(e.trackingModeEnabled())return e;return null}startTrackingMode(){if((0,ye.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,ye.lastMouseOrTouchEventInfo)().isTouch&&this.paneWidgets().some((e=>e.trackingModeEnabled()))&&(this.paneWidgets().forEach((e=>e.exitTrackingMode())),this.model().model().clearCurrentPosition())}onToolChanged(){const e=this.model().model();e.lineBeingCreated()&&!e.lineBeingCreateFromExternal()&&this._cancelCreatingLine(),this.selectPointMode().value()!==je.SelectPointMode.None&&this.cancelRequestSelectPoint(),this.exitTrackingMode()}setInLoadingState(e){this._inLoadingState=e}paint(e){const t=null!=e?e:ve.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,u.trackEvent)("GUI","Reset Scales"),null!==this._model&&this._model.resetScales()}applyOverrides(e){const t={};for(const[i,s]of Object.entries(e))i.startsWith("mainSeriesProperties.priceAxisProperties")||(t[i]=s);if((0,pn.applyPropertiesOverrides)(this.properties(),void 0,!1,t,void 0),this._model){(0,pn.applyPropertiesOverrides)(this._model.model().properties(),void 0,!1,t),(0,pn.applyPropertiesOverrides)(this._model.mainSeries().properties(),void 0,!1,t,"mainSeriesProperties"),this._model.model().sessions().callFunction((e=>e.applyOverrides(t)))
;const e=this._model.model().watermarkSource();null!==e&&e.applyOverrides(t)}}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}setActive(e){(0,ye.lastMouseOrTouchEventInfo)().isTouch&&(e&&this.selectPointMode().value()!==je.SelectPointMode.None?this.startTrackingMode():this.exitTrackingMode());for(const e of this._paneWidgets)e.update();e||this.model().selectionMacro((e=>{e.clearSelection()})),this._isActive.setValue(e)}justActivated(){return this._justActivated}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,n.ensureNotNull)(this._lineToolsSynchronizer).prepareDTO()}resetLineToolsInvalidated(e,t,i){(0,n.ensureNotNull)(this._lineToolsSynchronizer).resetInvalidated(e,t,i)}applyLineToolUpdateNotification(e,t){(0,n.ensureNotNull)(this._lineToolsSynchronizer).applyLineToolUpdateNotification(e,t)}reloadAllLineTools(){(0,n.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,n.ensureNotNull)(t.setPage("object_tree"));(0,n.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,n.ensureNotNull)(this._model),r=(s.restoreState(this._content,t,i),s.mainSeries().properties().childs());this._symbolWV.setValue(r.symbol.value()),this._resolutionWV.setValue(r.interval.value())}addCompareAsOverlay(e,t,i){const s=this.model();return(0,n.ensureDefined)(this._options.isSymbolAvailable)(e).then((async r=>{if(!r)return null;await(0,ca.studyMetaInfoRepository)().requestMetaInfo();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,n.ensureNotNull)(this._model).selection().dataSources();if(1===t.length)this.showSourceProperties(t[0],e);else{const i=t.filter(J.isLineTool);i.length>0&&this.showChartPropertiesForSources({sources:i,tabName:e})}}executeActionById(e){if("takeScreenshot"===e)return console.warn('Action "takeScreenshot" is deprecated. Use method "takeScreenshot" instead'),void this._chartWidgetCollection.takeScreenshot();const t=this.actions()[e];t?t.execute():console.warn("Unknown action id: "+e)}getCheckableActionState(e){const t=this.actions()[e];if(t){if(t.isCheckable())return t.isChecked();console.warn("Action "+e+" has no state")}else console.warn("Unknown action id: "+e);return null}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")}hotkeys(){return this._hotkeys}_clearSelectionHotkey(){return{desc:"Cancel selection",hotkey:27,handler:()=>{var e,t,i,s;if(this.selectPointMode().value()!==je.SelectPointMode.None)return this.selectPointMode().value()===je.SelectPointMode.Replay&&this._chartWidgetCollection.getAll().forEach((e=>{e!==this&&e.selectPointMode().value()===je.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()===je.SelectPointMode.None;return t&&i&&s}}}_insertStudyOrReplaceStub(e,t,i,s,r,n){const o="java"===e.type;return new Promise((async a=>{if(0===t.length)return null==n||n(),o&&await(0,ca.studyMetaInfoRepository)().requestMetaInfo(),void a(this._insertOrReplaceStubByStudyImpl(e,t,i,s,r));window.runOrSignIn((async()=>{null==n||n(),o&&await(0,ca.studyMetaInfoRepository)().requestMetaInfo(),a(this._insertOrReplaceStubByStudyImpl(e,t,i,s,r))}),{source:"study on study"})})).catch((()=>null))}_insertOrReplaceStubByStudyImpl(e,t,i,s,r){const o=(0,n.ensureNotNull)(this._model).createStudyInserter(e,t,s);o.setForceOverlay("java"===e.type&&"Volume@tv-basicstudies"===e.studyId&&N.enabled("volume_force_overlay"));const a=o.insert(((e,i,s)=>new Promise(((n,o)=>{this.selectPointMode().value()!==je.SelectPointMode.None&&this.cancelRequestSelectPoint(),r?n(r(e,i,s)):(0,Z.isSymbolicStudy)(s)?((0,u.trackEvent)("GUI","Confirmation dialogs","Symbol confirmation dialog"),I(this,e,s,n,o,"symbol")):(0,Z.hasConfirmInputs)(i)?((0,u.trackEvent)("GUI","Confirmation dialogs","Inputs confirmation dialog"),I(this,e,s,n,o)):n({inputs:{},parentSources:t})}))),void 0,i);return a.then((()=>{(0,je.hideAllIndicators)().value()&&(0,y.toggleHideMode)()})).catch((e=>{})),a}async _showChartProperties(e,t,i,s){if(!this._model)return null;t&&((0,h.setValue)("properties_dialog.active_tab.chart",t),i.tabName=t);const r=await te(e,this._model,i,this._options.chartWidgetCollection,s);return(null==r?void 0:r.visible().value())?r:null}_createLineToolsSynchronizerIfNeeded(){var e;if(N.enabled("saveload_separate_drawings_storage")){const t={readOnlyMode:this.readOnly(),migrateSyncedLineTools:this===this._options.chartWidgetCollection.getAll()[0]},i=(0,ba.getLineToolsSynchronizerClass)()
;this._lineToolsSynchronizer=new i({layoutId:this.layoutId(),chartId:this._id,clientId:this._chartWidgetCollection.clientId},this.model().model(),t),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,_.isColorDark)(t),n=(0,_.isColorDark)(i),o=(0,_.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,d.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=je.tool.value();return(0,oi.isLineToolName)(e)&&!(0,oi.isLineDrawnWithPressedButton)(e)&&this.selectPointMode().value()===je.SelectPointMode.None}_cancelCreatingLine(){const e=(0,n.ensureNotNull)(this._model).model(),t=e.lineBeingCreated();if(null!==t){const i=(0,n.ensureNotNull)(e.paneForSource(t));(0,n.ensureNotNull)(this.paneByState(i)).cancelCreatingLineTool(),t.toolname===je.tool.value()&&(0,je.resetToCursor)()}const i=e.crossHairSource().measurePane().value();if(null!==i){(0,n.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),a=(0,fe.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:Ee.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,y=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(),y=e)}let S=n.reduce(c,0),b=o.reduce(c,0),w=Math.max(d-S-b,0)
;if(w<=102){S=0,b=0,w=d;for(let e=0;e<n.length;e++)n[e]=0;for(let e=0;e<o.length;e++)o[e]=0}for(const e of this._paneSeparators)e.adjustSize();const C=_+v+g,P=u<C?0:u-C,x=P/i;let T=0,I=!1;const M=null===(t=this._model)||void 0===t?void 0:t.model();for(let e=0;e<this._paneWidgets.length;++e){const t=this._paneWidgets[e];void 0!==M&&t.setState(M.panes()[e]);let i=0;if(this.isMaximizedPane())i=this._maximizedPaneWidget===t?P:0;else if(t.state().collapsed().value())i=Math.min(f,t.collapsedHeight());else{const e=t===y?Math.ceil((P-T)*a)/a:Math.round(t.stretchFactor()*x*a)/a;i=Math.max(e,2),T+=i}t.setPriceAxisSizes("left",i,n),t.setPriceAxisSizes("right",i,o),I=I||i!==t.height(),t.setSize((0,s.size)({width:w,height:i})),M&&t.state()&&M.setPaneHeight(t.state(),i)}null!==this._timeAxisWidget&&this._timeAxisWidget.setSizes((0,s.size)({width:w,height:g}),n,o),M&&M.setWidth(w,e),this._controlBarNavigation&&this._controlBarNavigation.updatePosition(),this._lhsAxesWidth!==S&&(this._lhsAxesWidth=S,this._lhsPriceAxisWidthChanged.fire(S)),this._rhsAxesWidth!==b&&(this._rhsAxesWidth=b,this._rhsPriceAxisWidthChanged.fire(b)),I&&l.emit("panes_height_changed")}_makePaneWidgetsAndSeparators(){const e=this.model().model().panes(),t=e.length,i=this._paneWidgets.length;for(let e=t;e<i;e++){(0,n.ensureDefined)(this._paneWidgets.pop()).destroy();const e=this._paneSeparators.pop();e&&e.destroy()}const s=this._options.containsData;for(let r=i;r<t;r++){const t={contextMenuEnabled:this._options.paneContextMenuEnabled,currencyConversionEnabled:this._options.currencyConversionEnabled,unitConversionEnabled:this._options.unitConversionEnabled,handleScale:this._options.handleScale,handleScroll:this._options.handleScroll,priceScaleContextMenuEnabled:this._options.priceScaleContextMenuEnabled,legendWidgetEnabled:this._options.legendWidgetEnabled,sourceStatusesWidgetEnabled:!s,sourceStatusesWidget:this._options.sourceStatusesWidget,marketStatusWidgetEnabled:this._options.marketStatusWidgetEnabled&&!s,chartWarningWidgetEnabled:this._options.chartWarningWidgetEnabled&&!s,chartWarningWidget:this._options.chartWarningWidget,dataProblemWidgetEnabled:this._options.dataProblemWidgetEnabled&&!s,legendWidget:this._options.legendWidget,propertyPagesEnabled:this._options.propertyPagesEnabled,sourceSelectionEnabled:this._options.sourceSelectionEnabled,controlsEnabled:this._options.paneControlsEnabled,croppedTickMarks:this._options.croppedTickMarks,countdownEnabled:this._options.countdownEnabled,customLegendWidgetFactories:new Map(this._customLegendWidgetsFactoryMap),useKineticScroll:this._options.useKineticScroll,pineSourceStatusEnabled:!this.readOnly()};void 0!==this._options.paneContextMenu&&(t.contextMenu=this._options.paneContextMenu),void 0!==this._options.priceScaleContextMenu&&(t.priceScaleContextMenu=this._options.priceScaleContextMenu);const i=new Ri(this,e[r],t,this._paneWidgetsSharedState);if(this._paneWidgets.push(i),r>0){const e=new Ee(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;i<t;i++){const t=e[i],s=this._paneWidgets[i];s.hasState()&&s.state()===t?s.updatePriceAxisWidgetsStates():s.setState(t)}for(let e=t;e--;)this._paneWidgets[e].updateControls();this._errorRenderer.updatePaneWidgets(),this._updateThemedColor()}_width(){return this._options.width.value()}_height(){return this._options.height.value()}_update(e,t){var i,s;const r=e?e.fullInvalidation():ve.InvalidationLevel.Full,n=!!e&&e.isVisibleTimeRangeLockedOnResize();if(null!==this._timingsMeter&&this._timingsMeter.startDraw(r),r===ve.InvalidationLevel.Full&&(this._model?this._updateGui(n):this._adjustSize(n)),r>ve.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())===ve.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===ve.InvalidationLevel.Full?this._dataWindowWidget.fullUpdate():t>ve.InvalidationLevel.None&&this._dataWindowWidget.update()}for(let t=0;t<this._paneWidgets.length;t++)this._paneWidgets[t].updateStatusWidget(e.invalidateForPane(t));null!==this._timingsMeter&&this._timingsMeter.stopDraw(),e&&e.panesOrderInvalidated()&&l.emit("panes_order_changed")}_onMousewheel(e){if(!this.model().model().zoomEnabled()||null===this._mouseWheelHelper)return;if(!(0,c.onWidget)()&&!Ka&&parent&&parent!==window&&parent.IS_DEMO_PAGE)return;if(null===this._model)return;if(this.model().timeScale().isEmpty())return;const t=this._mouseWheelHelper.processWheel(e),i=t.deltaX,s=-t.deltaY;if(0!==i&&this._options.handleScroll.mouseWheel||0!==s&&this._options.handleScale.mouseWheel){if(e.cancelable&&e.preventDefault(),0!==s&&this._options.handleScale.mouseWheel){const t=Math.sign(s)*Math.min(1,Math.abs(s)),i=(0,n.ensureNotNull)(this._mainDiv).getBoundingClientRect(),r=e.clientX-this._lhsAxesWidth-i.left;if(!Number.isFinite(r)||!Number.isFinite(t))return void qa.logWarn("Incorrect mouse wheel processing: scrollPosition: "+r+", zoomScale: "+t);const o=new ze.EnvironmentState(e).mod();this.model().model().zoomTime(r,t,!!o||void 0),this._onZoom.fire(o)}0!==i&&this._options.handleScroll.mouseWheel&&this.model().scrollChart(-80*i)}}_beginRequestActive(){const e=this._chartWidgetCollection.activeChartWidget.value()!==this;if(this._chartWidgetCollection.activeChartWidget.setValue(this),e){this._chartWidgetCollection.ariaDescribeChart(this._chartWidgetCollection.activeChartWidget.value())
;const e=(0,ye.lastMouseOrTouchEventInfo)();e.isTouch&&!e.stylus&&this._isLineToolModeExceptBrush()&&this.updateCrossHairPositionIfNeeded(),this._justActivated=!0}}_endRequestActive(){this._justActivated&&setTimeout((()=>this._justActivated=!1),0)}_requestActive(){this._beginRequestActive(),this._endRequestActive()}_updateGui(e){this._model&&(this._makeTimeAxisWidget(),this._makePaneWidgetsAndSeparators(),this._elMainTable.style.userSelect="none",this._adjustSize(e))}_setElement(e){if(this._mainDiv){this._mainDiv.remove();const e=document.createRange();e.selectNodeContents((0,n.ensureNotNull)(this._parent)),e.deleteContents()}this._controlBarNavigation&&(this._controlBarNavigation.destroy(),this._controlBarNavigation=null),null!==this._removeMaximizeHotkey&&this._removeMaximizeHotkey(),this._removeMaximizeHotkey=this._initMaximizeHotkey(e);const t=e.ownerDocument,s=t.createElement("div");s.classList.add("chart-container-border"),e.insertBefore(s,e.firstChild),this._parent=s;const r=t.createElement("div");if(r.classList.add("chart-widget"),this._mainDiv=r,this._elTooltipDiv=t.createElement("div"),this._elTooltipDiv.className="tooltip-wrapper",this._mainDiv.appendChild(this._elTooltipDiv),this._elMainTable=t.createElement("div"),this._elMainTable.className="chart-markup-table",this._mainDiv.appendChild(this._elMainTable),r.setAttribute("role","region"),r.setAttribute("aria-label",a.t(null,{replace:{index:this.id()}},i(56275))),this._hotkeysListener&&this._hotkeysListener.destroy(),this._errorRenderer.setContainer(this._parent),this._hotkeysListener=new U.ChartHotkeysListener(this,this._mainDiv),(this._options.controlBarEnabled||N.enabled("control_bar"))&&this._createControlBar(),this._options.handleScale.mouseWheel||this._options.handleScroll.mouseWheel){this._mouseWheelHelper=new Ie;const e=this._onMousewheel.bind(this);this._onWheelBound=e,this._mainDiv.addEventListener("wheel",e,{passive:!1})}this._mainDiv.addEventListener("mouseenter",(()=>this._isHovered.setValue(!0))),this._mainDiv.addEventListener("mouseleave",(()=>this._isHovered.setValue(!1))),this.resize(),this._justActivated=!1,this.withModel(this,(()=>{s.appendChild(r),r.addEventListener("mousedown",this._beginRequestActive.bind(this)),r.addEventListener("mouseup",this._endRequestActive.bind(this)),r.addEventListener("touchstart",this._beginRequestActive.bind(this)),r.addEventListener("touchmove",this._endRequestActive.bind(this)),r.addEventListener("touchend",this._endRequestActive.bind(this)),r.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(ve.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(ve.InvalidationMask.full())},this._resizeHandler(),(0,n.ensureNotNull)(this._parent).appendChild((0,n.ensureNotNull)(this._mainDiv)),this._spinner&&(this._spinner.stop(),this._spinner=null),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 la(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 H.WatchedValue(!0));return this._createSessions(r.model()),r};N.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;$a&&this._initialLoading&&(e={...e,symbol:this._defSymbol,interval:this._defInterval,style:this._defStyle},Xi.Interval.isRange(this._defInterval)&&(e.style=11)),this.restoreState(this._content,this._containsData,e),this._setSymbolIntervalContentOverrides={},$a&&this._defSymbol&&this.model().model().recalculatePriceRangeOnce()}this._setActions(),this._createLineToolsSynchronizerIfNeeded(),(()=>{const e=(0,n.ensureNotNull)(this._model);e.onTagsChanged().subscribe(this,(()=>this.onModelTagsChanged())),this._initBackgroundColor(),this._updateGui(),this._modelCreated.fire(e),this._tagsChanged.fire(),N.enabled("determine_first_data_request_size_using_visible_range")&&this._setFirstRequestNumbarsUsingTimeframeAndInterval(e);const t=e.mainSeries(),i=t.properties().childs();this._defTimeframe&&t.setDefaultTimeframe(this._defTimeframe),t.dataEvents().symbolNotPermitted().subscribe(null,(e=>t.setSymbolParams({symbol:e}))),this._symbolWV.setValue(i.symbol.value()),i.symbol.subscribe(this,(e=>this._symbolWV.setValue(e.value()))),this._resolutionWV.setValue(i.interval.value()),i.interval.subscribe(this,(e=>this._resolutionWV.setValue(e.value()))),i.style.unsubscribe(this,this._onChartStyleChanged),
i.style.subscribe(this,this._onChartStyleChanged),t.dataEvents().completed().subscribe(this,(()=>this._addPerfMark("SeriesCompleted")),!0),t.dataEvents().barReceived().subscribe(this,(()=>this._addPerfMark("SeriesFirstDataReceived")),!0);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,ui.compareResolutions)(e,i)>=0)),n=null!=r?r:s[s.length-1];t.setSymbolParams({interval:n})})),t.dataEvents().intradayExchangeNotPermitted().subscribe(null,(()=>{t.setSymbolParams({interval:"D"})})),t.requestingStyleIsNotSupported.subscribe(null,(()=>{const i=t.interval(),s=e.model().defaultResolutions(),r=(0,ae.getLastUsedSingleValueBasedStyle)(),n=(0,ui.getResolutionByChartStyle)(r,i,s);t.setChartStyleWithIntervalIfNeeded(r,n)})),t.requestingStyleSupportRecovered.subscribe(null,(i=>{const s=t.interval(),r=e.model().defaultResolutions(),n=(0,ui.getResolutionByChartStyle)(i,s,r);t.setChartStyleWithIntervalIfNeeded(i,n)}))})()}_addHotkeys(){if(this._hotkeys.add({desc:"Maximize",hotkey:o.Modifiers.Alt+13,handler:()=>this.toggleFullscreen(),isDisabled:()=>!this.getResizerDetacher().fullscreenable.value()}),this._hotkeys.add(this._clearSelectionHotkey()),this._options.indicatorsDialogShortcutEnabled&&this._hotkeys.add({desc:"Show insert indicator dialog",hotkey:111,handler:()=>this.showIndicators()}),!this.readOnly()){this._hotkeys.add({desc:"Remove selected source",hotkey:o.isMacKeyboard?46:8,handler:()=>this.removeSelectedSources()});{const e=(e,t)=>{this.activePaneWidget&&("drawRightThere"===t.action?this.activePaneWidget.drawRightThere(e):je.tool.setValue(e))},t=(t,i)=>()=>e(t,i);Object.entries(ua.lineToolsSelectHotkeys).map((([e,i])=>({desc:i.description,hotkey:i.hash,handler:t(e,i)}))).forEach((e=>this._hotkeys.add(e)))}}this._hotkeys.add({desc:"Hide all drawing tools",hotkey:o.Modifiers.Mod+o.Modifiers.Alt+72,handler:()=>(0,y.toggleHideMode)()}),this.withModel(null,(()=>{const e=()=>this._hotkeys.promote();this.model().onSelectedSourceChanged().subscribe(null,e),this.model().crossHairSource().measurePane().subscribe((t=>{null!==t&&e()}))}))}_startSpinner(e){this._spinner||e&&(this._spinner=(new D).spin(e))}_handleLoginStateChanged(){0}_checkObsoleteTimezone(){const e=this.properties().childs().timezone.value();(0,B.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,ha.getChartingLibraryGlobalContext)().configurationData.is_tradingview_data||this.onWidget())&&this._makeAvailableOnTVPopup(),this.hasModel()&&(this._makeTimeAxisWidget(),this._makePaneWidgetsAndSeparators(),this._updateScalesActions()),this._adjustSize(),(0,z.disableSelection)(this._elMainTable),this._updateAndPaint()}_makeLoadingScreen(){if(N.enabled("lean_chart_load")){if(this.screen)return;this.screen=new xe(this,(0,n.ensureNotNull)(this._parent))}else this.screen=new xe(this,(0,n.ensureNotNull)(this._mainDiv))}_makeAvailableOnTVPopup(){this._availableScreen||(this._availableScreen=new ma(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 ji(this,this._options.timeScaleWidget,this._titlesProvider.bind(this),this._menuItemsProvider.bind(this),this._backgroundBasedTheme.spawnOwnership()),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()),r=(0,n.ensureNotNull)(this.paneByState((0,n.ensureNotNull)(s))).highlightedPriceAxis(),o=r.value();(i||o.owner===t.owner)&&(r.setValue({owner:t.owner,axis:i?t.axis:null}),this.model().model().lightUpdate())}))}_updateAriaPriceDescription(e){var t;if(this._ariaPriceDescription&&N.enabled("aria_crosshair_price_description")){const i=this.model().mainSeries().nearestData(e.index,Sa.PlotRowSearchMode.Exact);if(!i)return;const s=i.value[4];if(!(0,P.isNumber)(s))return;const r=this.model().timeScale().indexToUserTime(i.index),n=Xi.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,n.ensureNotNull)(this._maximizedPaneWidget?this._maximizedPaneWidget.state():i.paneForSource(i.mainSeries())),r="right"===e?s.rightPriceScales():s.leftPriceScales();if(r.length<t+1)return[];let o=r[t].orderedSources().filter((e=>e===i.mainSeries()||(0,Z.isStudy)(e)));return o.reverse(),o=(0,E.moveToHead)(o,i.mainSeries()),o.map((e=>e.title(Ps.TitleDisplayTarget.StatusLine,!0,void 0,!1)))}_menuItemsProvider(e,t){const i=this.model(),s=(0,n.ensureNotNull)(this._maximizedPaneWidget?this._maximizedPaneWidget.state():i.paneForSource(i.mainSeries())),r="right"===e?s.visibleRightPriceScales():s.visibleLeftPriceScales();if(r.length<t+1)return[];const o=r[t],a=i.model().panes().indexOf(s),l=this._paneWidgets[a],c="right"===e?l.rightPriceAxisesContainer():l.leftPriceAxisesContainer();return(0,n.ensureNotNull)(c.findAxisWidgetForScale(o)).getContextMenuActions()}
_invalidationRAFCallback(e){if(this._drawPlanned=!1,this._drawRafId=0,!this._inLoadingState){if(this._invalidationMask){const t=this._invalidationMask;this._invalidationMask=null,this._update(t,e);for(const i of t.timeScaleInvalidations())if(0===i.type&&!i.value.finished(e)){this.model().model().setTimeScaleAnimation(i.value,i.rightOffsetPx);break}}null!==this._chartPaintedPromise&&(this._chartPaintedPromise.resolve(),this._chartPaintedPromise=null)}}_applyTimeScaleInvalidations(e,t){for(const i of e.timeScaleInvalidations())this._applyTimeScaleInvalidation(i,t)}_applyTimeScaleInvalidation(e,t){var i,s,r;const n=null===(i=this._model)||void 0===i?void 0:i.timeScale();if(n&&0===e.type){const i=e.value.getStartPosition()-e.value.getPosition(t),o=e.rightOffsetPx+i,a=n.width()-o,l=n.indexToCoordinate(n.baseIndex());n.startScroll(l),n.scrollTo(a),n.endScroll(),n.requestHistoryPointsIfNeeded(),e.value.finished(t)&&(null===(r=(s=e.value).onFinish)||void 0===r||r.call(s,!0))}}_onChartSessionCriticalError(e,t){this._disconnected.fire(!0)}_onData(e){if("reconnect_bailout"===e.method)this._reconnectBailout.fire();else this.model().model().onData(e)}_onConnection(){this.hasModel()?(this.model().model().restart(),this.model().model().fullUpdate(),this._connected.fire()):this._requestMetadataAndProcessModel()}_onDisconnect(){this.hasModel()&&this.model().model().disconnect(),this._model&&this._model.model().fullUpdate(),this._disconnected.fire()}async _requestMetadataAndProcessModel(){await this._requestMetadata(),this._inited||(await(0,J.initAllLineToolsFromContent)(this._content),this._init(),this._chartWidgetInitialized.fire(),N.enabled("charting_library_base")||qa.logDebug("initialized"))}async _requestMetadata(){this._addPerfMark("RequestMetadataStart"),await(0,ca.studyMetaInfoRepository)().requestMetaInfo(),this._addPerfMark("RequestMetadataEnd")}async _createControlBar(){const e=await Promise.all([i.e(2364),i.e(5514),i.e(1729),i.e(8073),i.e(3547),i.e(2153),i.e(2227),i.e(5715),i.e(5093)]).then(i.bind(i,22136));this._controlBarNavigation=new e.ControlBarNavigation(this,(0,n.ensureNotNull)(this._mainDiv),this._options.controlBar),this._model&&this._adjustSize()}_subscribeToDrawingState(){if(this._options.readOnly)return;(0,je.init)();const e=(e,t)=>{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))};je.createdLineTool.subscribe(null,(t=>{e(t,((e,i)=>{const s=(0,n.ensureNotNull)(e.paneForSource(e.mainSeries()));let r,o=null;if(void 0===t.pointPositionPercents){if(o=Ja(e,t.model,t.point.timeStamp),null===o)return;r=t.point.price}else{const i=t.pointPositionPercents.x*e.timeScale().width(),s=e.mainSeries().priceScale(),n=t.pointPositionPercents.y*s.height(),a=e.mainSeries().firstValue();if(null===a)return;o=e.timeScale().coordinateToIndex(i),r=s.coordinateToPrice(n,a)}const a={index:(0,n.ensureNotNull)(o),price:r},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})}))})),je.continuedLineTool.subscribe(null,(t=>{e(t,((e,i)=>{var s;const r=Ja(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})}))})),je.cancelledLineTool.subscribe(null,(t=>{e(t,((e,t)=>{e.cancelCreatingLine()}))})),je.beenSetLineToolLastPoint.subscribe(null,(t=>{e(t,((e,i)=>{const s=e.lineBeingCreated();if(null===s||s.linkKey().value()!==t.linkKey)return;const r=Ja(e,t.model,t.point.timeStamp);if(null===r)return;const n={index:r,price:t.point.price};s.setLastPoint(n),s.updateAllViews((0,pi.sourceChangeEvent)(s.id())),e.lightUpdate()}))})),je.startedMovingLineTool.subscribe(null,(t=>{e(t,((e,i)=>{var s;const r=t.linkKeys.map(J.lineToolByLinkKey.bind(null,e)).filter(P.notNull);if(r.length){const i=Ja(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)}}))})),je.movedLineTool.subscribe(null,(t=>{e(t,((e,i)=>{var s;const r=e.sourcesBeingMoved().filter(J.isLineTool).filter((e=>(e=>t.linkKeys.some((t=>e.linkKey().value()===t)))(e)));if(!r.length)return;const n=Ja(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)}))})),je.finishedMovingLineTool.subscribe(null,(t=>{e(t,((e,i)=>{const s=e.sourcesBeingMoved().filter(J.isLineTool);if(0===s.length)return;s.forEach((i=>{const s=(e=>{for(let i=0;i<t.linkKeys.length;i++)if(t.linkKeys[i]===e.linkKey().value())return{state:t.finalStates[i],changes:t.changes[i]};return null})(i);e.endMovingSources(null!==s,!0),null!==s&&(i.restoreExternalPoints(s.state,s.changes),s.state.pointPositionPercents&&i.restorePositionPercents(s.state.pointPositionPercents))}))}))})),je.startedChangingLineTool.subscribe(null,(t=>{e(t,((e,i)=>{var s;const r=(0,J.lineToolByLinkKey)(e,t.linkKey);if(null!==r){const i=r.getPoint(t.pointIndex),n=i?i.index:Ja(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)}}}))})),je.changedLineTool.subscribe(null,(t=>{e(t,((e,i)=>{const s=e.lineBeingEdited();if(null===s||s.linkKey().value()!==t.linkKey)return;let r=null;if(r=t.changes.indexesChanged?Ja(e,t.model,t.point.timeStamp):(0,n.ensureNotNull)(e.linePointBeingChanged()).index,
null!==r&&s.isActualSymbol()&&s.isActualCurrency()&&s.isActualUnit()){const i={index:r,price:t.point.price};e.changeLinePoint(i,void 0,!0)}}))})),je.finishedChangingLineTool.subscribe(null,(t=>{e(t,((e,i)=>{const s=(0,J.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)}))})),je.removedLineTool.subscribe(null,(t=>{e(t,((e,i)=>{const{withUndo:s,unlink:r,linkKey:n}=t,o=(0,J.lineToolByLinkKey)(e,n);null!==o&&(r&&o.detachAlert(),s?i.removeSource(o,!1):(e.lineToolsGroupModel().removeLineTools([o]),e.removeSource(o)))}))})),je.finishedLineTool.subscribe(null,(t=>{e(t,((e,i)=>{const s=(0,J.lineToolByLinkKey)(e,t.linkKey);null!==s&&(0,oi.isLineToolFinishRequiredWhenCreatedByApi)(s.toolname)&&s.finish()}))})),je.changedLineStyle.subscribe(null,(t=>{e(t,((e,i)=>{const s=(0,J.lineToolByLinkKey)(e,t.linkKey);null!==s&&(s.restoreExternalState(t.state),s.propertiesChanged(!0),t.alertId&&s.syncAlert(t.alertId))}))})),je.restoredLineToolState.subscribe(null,(t=>{e(t,((e,i)=>{const s=(0,J.lineToolByLinkKey)(e,t.linkKey);if(null!==s){const i={...t.state};i.indexes=t.state.points.map((i=>({index:Ja(e,t.model,i.time_t),price:i.price}))),e.restoreLineToolState(s,i,!1)}}))})),je.restoredLineTool.subscribe(null,(t=>{e(t,((e,i)=>{e.restoreSource(t.state.restorePane,t.state.paneIndex,t.state.paneState,t.state.sourceState,null)}))})),je.copiedLineTool.subscribe(null,(t=>{e(t,((e,i)=>{const s=(0,n.ensureNotNull)(e.paneForSource(e.mainSeries()));let r;const o={...t.state,intervalsVisibilities:(0,un.mergeIntervalVisibilitiesDefaults)(t.state.intervalsVisibilities)},a=(0,J.createLineToolProperties)(t.linetool,o,e),l=e.dataSourceForId(t.id);if(l){if(!(0,J.isLineTool)(l))return void qa.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 qa.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(r=null!=l?l:i.createLineTool({pane:s,point:e,linetool:t.linetool,properties:a,linkKey:t.linkKey,disableSynchronization:!0,id:t.id}),null===r)return;r.restorePositionPercents((0,n.ensureDefined)(t.pointPositionPercents))}else{const o=i=>({index:(0,n.ensureNotNull)(Ja(e,t.model,i.timeStamp)),price:i.price}),c=t.points.map(o),h=t.pointsForCreating.map(o),d=c[0];if(l)r=l;else if(t.withUndo)r=i.createLineTool({pane:s,point:d,linetool:t.linetool,properties:a,linkKey:t.linkKey,sharingMode:t.sharingMode,disableSynchronization:!0,id:t.id});else{const e=new Cs({model:i.model(),pane:s,lineTool:t.linetool,ownerSource:(0,n.ensureNotNull)(s.mainDataSource()),drawOnAllChartsMode:t.sharingMode,id:t.id});e.redo(),e.startCreatingLine(d,a,t.linkKey||null,t.sharingMode,!0),r=(0,
n.ensureNotNull)(e.line())}if(null===r)return;const u=(e,s)=>{t.withUndo?i.continueCreatingLine(e,new ze.EnvironmentState(void 0,!0),s,!0):i.model().continueCreatingLine(e,new ze.EnvironmentState(void 0,!0),s,!0)},p=(0,oi.isLineToolFinishRequiredWhenCreatedByApi)(t.linetool);if(e.lineBeingCreated())if(h.length>1)for(let e=1;e<h.length;e++)u(h[e],e<h.length-1&&!p),e===h.length-1&&p&&(r.finish(),u(h[e],!0));else p&&(r.finish(),u(h[0],!0))}r.properties().interval.setValue(t.state.interval),r.restoreExternalState(t.state),r.restoreData&&r.restoreData(t),r.setZorder(t.zOrder),r.propertiesChanged(!0),t.finalState&&(r.calcIsActualSymbol(),r.restoreExternalPoints(t.finalState,{pricesChanged:!0,indexesChanged:!0},!0)),t.alertId&&r.syncAlert(t.alertId)}))}))}_setFirstRequestNumbarsUsingTimeframeAndInterval(e){const t=function(e){var t,i,s,r,n,o,a,l,c,h,d,u,p;const _=null!==(t=e.numberExtraBars)&&void 0!==t?t:0,m=e.barSpacing||6,g=Math.ceil(e.width/m)+_;if(e.timeFrame){if(!e.interval)return{barCount:g};const t=Xi.Interval.parse(e.interval);if("string"==typeof e.timeFrame){if("ALL"===e.timeFrame)return{barCount:g};let l=e.timeFrame;"YTD"===e.timeFrame&&(l=`${Math.floor(((new Date).valueOf()-new Date((new Date).getFullYear(),0,0).valueOf())/1e3/60/60/24)}D`);const c=Xi.Interval.parse(l),h=Date.now().valueOf(),d=h-c.inMilliseconds();return{barCount:(0,ya.getPeriodsBetweenDates)(null!==(s=null===(i=e.symbolInfo)||void 0===i?void 0:i.session)&&void 0!==s?s:"24x7",null!==(n=null===(r=e.symbolInfo)||void 0===r?void 0:r.session_holidays)&&void 0!==n?n:"",null!==(a=null===(o=e.symbolInfo)||void 0===o?void 0:o.corrections)&&void 0!==a?a:"",t.letter(),t.multiplier(),d,h)+_,message:`based on period of ${l}`,shouldAdjustBarSpacing:!0}}if("time-range"===e.timeFrame.type)return{barCount:(0,ya.getPeriodsBetweenDates)(null!==(c=null===(l=e.symbolInfo)||void 0===l?void 0:l.session)&&void 0!==c?c:"24x7",null!==(d=null===(h=e.symbolInfo)||void 0===h?void 0:h.session_holidays)&&void 0!==d?d:"",null!==(p=null===(u=e.symbolInfo)||void 0===u?void 0:u.corrections)&&void 0!==p?p:"",t.letter(),t.multiplier(),1e3*e.timeFrame.from,1e3*e.timeFrame.to)+_,message:`based on time range: ${e.timeFrame.from} ... ${e.timeFrame.to}`,shouldAdjustBarSpacing:!0}}return{barCount:g}}({width:e.timeScale().width(),barSpacing:e.timeScale().barSpacing(),timeFrame:this.options().defTimeframe,interval:this.options().defInterval});if(N.enabled("charting_library_debug_mode")&&console.log(`${(new Date).toISOString()} Setting initial data request count to ${t.barCount} bars${t.message?` (${t.message})`:""}`),e.mainSeries().seriesSource().setInitialRequestOptions({count:t.barCount}),t.shouldAdjustBarSpacing&&"number"==typeof t.barCount&&t.barCount>0){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(7727),i.e(2227),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){N.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()}_checkIsTradedGroupSelected(){const e=this.model(),t=e.model();return e.selection().customSources().some((e=>{var i;return null===(i=t.customSourceName(e))||void 0===i?void 0:i.startsWith(tradedGroupPlaceOrderPrefix)}))}_setActions(){return this._unsetActions(),this._addHotkeys(),this._actions=function(e){const t=e.hotkeys(),s=e.model(),r=e.options(),n=e.properties(),l=new ht.Action({actionId:"Chart.Series.PriceScale.ToggleInvertPriceScale",options:{label:wa.t(null,void 0,i(37189)),statName:"Invert Scale",checkable:!0,onExecute:()=>s.invertPriceScale(s.mainSeries().priceScale()),hotkeyGroup:t,hotkeyHash:o.Modifiers.Alt+73}}),c=new ht.Action({actionId:"Chart.Series.PriceScale.ToggleAutoScale",options:{label:wa.t(null,void 0,i(24157)),checkable:!0,onExecute:e=>{const t=s.mainSeries().priceScale();s.togglePriceScaleAutoScaleMode(t),e.update({checked:t.isAutoScale()})}}}),h=new ht.Action({actionId:"Chart.Scales.ToggleLockPriceToBarRatio",options:{label:wa.t(null,void 0,i(14017)),checkable:!0,statName:"ToggleLockScale",onExecute:()=>s.togglePriceScaleLockScaleMode(s.mainSeries().priceScale())}}),d=new ht.Action({actionId:"Chart.Series.PriceScale.ToggleRegular",options:{label:wa.t(null,{context:"scale_menu"},i(55300)),checkable:!0,statName:"ToggleRegularScale",onExecute:e=>{const t=s.mainSeries().priceScale();s.setPriceScaleRegularScaleMode(t),e.update({checked:t.isRegular()})}}}),p=new ht.Action({actionId:"Chart.Series.PriceScale.TogglePercentage",options:{label:wa.t(null,void 0,i(6919)),checkable:!0,statName:"TogglePercantage",onExecute:()=>s.togglePriceScalePercentageScaleMode(s.mainSeries().priceScale()),hotkeyGroup:t,hotkeyHash:o.Modifiers.Alt+80}}),_=new ht.Action({actionId:"Chart.Series.PriceScale.ToggleIndexedTo100",options:{label:wa.t(null,void 0,i(89999)),checkable:!0,statName:"ToggleIndexedTo100",onExecute:()=>s.togglePriceScaleIndexedTo100ScaleMode(s.mainSeries().priceScale())}}),m=new ht.Action({actionId:"Chart.Series.PriceScale.ToggleLogarithmic",options:{label:wa.t(null,void 0,i(16170)),statName:"ToggleLogScale",checkable:!0,onExecute:()=>s.togglePriceScaleLogScaleMode(s.mainSeries().priceScale()),hotkeyGroup:t,hotkeyHash:o.Modifiers.Alt+76}}),g=new ht.Action({actionId:"Chart.ChangeTimeZone",options:{label:wa.t(null,void 0,i(20909)),statName:"TimeZone"}}),f=new wt.ActionWithStandardIcon({actionId:"Chart.TimeScale.Reset",options:{label:wa.t(null,void 0,i(54170)),iconId:"Chart.Reset",statName:"ResetScale",onExecute:()=>s.resetTimeScale(),hotkeyGroup:e.hotkeys(),hotkeyHash:o.Modifiers.Mod+o.Modifiers.Alt+81}}),y=new ht.Action({
actionId:"Chart.Dialogs.ShowInsertIndicators",options:{label:(0,Ca.appendEllipsis)(wa.t(null,void 0,i(87829))),statName:"InsertIndicator",onExecute:()=>e.showIndicators(),...r.indicatorsDialogShortcutEnabled?{hotkeyGroup:t,hotkeyHash:191}:void 0}}),S=new ht.Action({actionId:"Chart.Dialogs.ShowCompareOrAddSymbol",options:{label:(0,Ca.appendEllipsis)(wa.t(null,void 0,i(53942))),statName:"CompareOrAddSymbol",onExecute:()=>e.toggleCompareOrAdd()}}),b=new wt.ActionWithStandardIcon({actionId:"Chart.Dialogs.ShowGeneralSettings",options:{label:(0,Ca.appendEllipsis)(wa.t(null,void 0,i(32514))),iconId:"Settings",statName:"ChartProperties",onExecute:()=>e.showGeneralChartProperties()}}),w=new wt.ActionWithStandardIcon({actionId:"Chart.Dialogs.ShowGeneralSettings.SymbolTab",options:{label:(0,Ca.appendEllipsis)(wa.t(null,void 0,i(32514))),iconId:"Settings",statName:"MainSeriesProperties",onExecute:()=>e.showGeneralChartProperties(K.TabNames.symbol)}}),C=new wt.ActionWithStandardIcon({actionId:"Chart.Dialogs.ShowGeneralSettings.ScalesTab",options:{label:(0,Ca.appendEllipsis)(wa.t(null,void 0,i(93907))),iconId:"Settings",statName:"ScalesProperties",onExecute:()=>e.showGeneralChartProperties(K.TabNames.scales)}}),P=new ht.Action({actionId:"Chart.SelectedObject.ToggleLocked",options:{label:wa.t(null,void 0,i(79777)),statName:"ToggleLockSelectedObject",onExecute:()=>e.toggleLockSelectedObject()}}),x=new wt.ActionWithStandardIcon({actionId:"Chart.SelectedObject.Hide",options:{label:wa.t(null,void 0,i(27298)),iconId:"Chart.Hide",statName:"HideSelectedObject",onExecute:()=>e.hideSelectedObject()}}),T=new ut({actionId:"Chart.PriceScale.ToggleAutoScaleSeriesOnly",options:{label:wa.t(null,void 0,i(43758)),checkable:!0,statName:"ScalePriceChartOnly"}},{property:n.childs().scalesProperties.childs().scaleSeriesOnly,undoModel:s,undoText:ka}),I=new Ma({actionId:"Chart.DrawingToolbar.ToggleVisibility",options:{label:wa.t(null,void 0,i(93864)),statName:"ToggleDrawingToolbar"}},r.isDrawingToolbarVisible),M=new ut({actionId:"",options:{label:wa.t(null,void 0,i(4035)),checkable:!0,statName:"ToggleStayInDrawingMode"}},{property:je.properties().childs().stayInDrawingMode,undoModel:s,undoText:Da}),A=new ut({actionId:"Chart.Marks.ToggleVisibility",options:{label:wa.t(null,void 0,i(28345)),checkable:!0,statName:"ToggleHideMarksOnBars"}},{property:je.hideMarksOnBars(),undoModel:s,undoText:Ea,callback:e=>je.hideMarksOnBars().setValue(e.isChecked())}),L=new ut({actionId:"Chart.PriceScale.Labels.ToggleSeriesLastValueVisibility",options:{label:wa.t(null,void 0,i(10127)),checkable:!0,checked:!1,statName:"ToggleSymbolLastValue"}},{property:n.childs().scalesProperties.childs().showSeriesLastValue,undoModel:s,undoText:Va}),k=new ut({actionId:"Chart.PriceScale.Labels.ToggleSymbolNameLabelsVisibility",options:{label:wa.t(null,void 0,i(32390)),checkable:!0,checked:!1,statName:"ToggleSymbolLabels"}},{property:n.childs().scalesProperties.childs().showSymbolLabels,undoModel:s,undoText:Ba}),D=(0,
Aa.combineProperty)(((e,t)=>e||!1),n.childs().scalesProperties.childs().showStudyLastValue.weakReference(),n.childs().scalesProperties.childs().showFundamentalLastValue.weakReference()),E=new ut({actionId:"Chart.PriceScale.Labels.ToggleIndicatorsValueLabelsVisibility",options:{label:wa.t(null,void 0,i(46850)),checkable:!0,checked:!1,statName:"ToggleStudiesAndFundamentalsPriceLabels",onDestroy:()=>{D.destroy()}}},{property:D,undoModel:s,undoText:null,callback:()=>{const e=!D.value();s.beginUndoMacro(Ra),s.setProperty(n.childs().scalesProperties.childs().showStudyLastValue,e,null),s.endUndoMacro()}}),V=(0,Aa.combineProperty)(((e,t)=>e||!1),n.childs().scalesProperties.childs().showStudyPlotLabels.weakReference(),n.childs().scalesProperties.childs().showFundamentalNameLabel.weakReference()),B=new ut({actionId:"Chart.PriceScale.Labels.ToggleIndicatorsNameLabelsVisibility",options:{label:wa.t(null,void 0,i(54418)),checkable:!0,checked:!1,statName:"ToggleStudiesAndFundamentalsNameLabels",onDestroy:()=>{V.destroy()}}},{property:V,undoModel:s,undoText:null,callback:()=>{const e=!V.value();s.beginUndoMacro(Na),s.setProperty(n.childs().scalesProperties.childs().showStudyPlotLabels,e,null),s.endUndoMacro()}}),R=s.mainSeries().properties().childs().highLowAvgPrice.childs(),O=new ut({actionId:"Chart.PriceScale.Labels.ToggleHighLowPriceLabelsVisibility",options:{label:wa.t(null,void 0,i(99479)),checkable:!0,checked:!1,statName:"ToggleHighLowPriceLabels"}},{property:R.highLowPriceLabelsVisible,undoModel:s,undoText:Oa}),F=new ut({actionId:"Chart.Lines.ToggleHighLowLinesVisibility",options:{label:wa.t(null,void 0,i(33766)),checkable:!0,checked:!1,statName:"ToggleHighLowPriceLine"}},{property:R.highLowPriceLinesVisible,undoModel:s,undoText:Fa}),W=new ut({actionId:"Chart.PriceScale.ToggleCountdownToBarCloseVisibility",options:{label:wa.t(null,void 0,i(83140)),checkable:!0,checked:!1,statName:"ToggleCountdown"}},{property:s.mainSeries().properties().childs().showCountdown,undoModel:s,undoText:za}),H=new ut({actionId:"Chart.PriceScale.ToggleAddOrderPlusButtonVisibility",options:{label:wa.t(null,void 0,i(71566)),checkable:!0,checked:Jn.addPlusButtonProperty.value(),statName:"ToggleAddOrderPlusButton"}},{property:Jn.addPlusButtonProperty,undoModel:s,undoText:Ua}),z=new wt.ActionWithStandardIcon({actionId:"Chart.Dialogs.ShowSymbolInfo",options:{label:(0,Ca.appendEllipsis)(wa.t(null,void 0,i(75594))),iconId:"Chart.SymbolInfo",checkable:!1,statName:"SymbolInfo",onExecute:()=>{{const t=e.model().model(),i=t.mainSeries().symbolInfo();if(i){const e=t.availableUnits(),s=t.unitConversionEnabled();(0,Pa.showSymbolInfoDialog)({symbolInfo:i,showUnit:s,unitDescription:t=>t?e.description(t):"",dateFormatter:t.dateFormatter()})}}}}}),U=new ht.Action({actionId:"Chart.PriceScale.MergeAllScalesToLeft",options:{label:wa.t(null,void 0,i(62329)),statName:"MergeAllScalesToLeft",onExecute:()=>s.mergeAllScales("left")}}),j=new ht.Action({actionId:"Chart.PriceScale.MergeAllScalesToRight",options:{label:wa.t(null,void 0,i(55813)),statName:"MergeAllScalesToRight",
onExecute:()=>s.mergeAllScales("right")}}),G=new ht.Action({actionId:"Chart.PriceScale.MoveToLeft",options:{label:wa.t(null,void 0,i(26493)),statName:"MoveScaleToLeft",onExecute:()=>s.mergeAllScales("left")}}),q=new ht.Action({actionId:"Chart.PriceScale.MoveToRight",options:{label:wa.t(null,void 0,i(40789)),statName:"MoveScaleToRight",onExecute:()=>s.mergeAllScales("right")}}),$=new wt.ActionWithStandardIcon({actionId:"Chart.Scales.Reset",options:{label:wa.t(null,void 0,i(75246)),iconId:"Chart.Reset",statName:"ResetChart",onExecute:()=>e.GUIResetScales(),hotkeyGroup:t,hotkeyHash:o.Modifiers.Alt+82}}),Y=e.model().model().sessions();let Z;const X=(0,Aa.createWVFromProperty)(e.model().mainSeries().isDWMProperty()),J=new ht.Action({actionId:"Chart.SessionBreaks.ToggleVisibility",options:{label:wa.t(null,void 0,i(66707)),checkable:!0,checked:!1,statName:"ToggleSessionBreaks",disabled:!0,onExecute:()=>{Z&&s.setProperty(Z,!Z.value(),ja)},onDestroy:()=>X.destroy()},optionsLoader:async()=>{const e=await Y.promise();return Z=e.properties().childs().graphics.childs().vertlines.childs().sessBreaks.childs().visible,{checked:Z.value(),disabled:X.value()}}});X.subscribe((()=>J.update({disabled:X.value()})));const Q=new ut({actionId:"Chart.Lines.ToggleSeriesPriceLineVisibility",options:{label:wa.t(null,void 0,i(72926)),checkable:!0,statName:"TogglePriceLine"}},{property:s.mainSeries().properties().childs().showPriceLine,undoModel:s,undoText:Ga}),ee=new ht.Action({actionId:"Chart.Undo",options:{label:wa.t(null,void 0,i(14804)),onExecute:()=>{(0,u.trackEvent)("GUI","Undo"),s.undoHistory().undo()},onDestroy:()=>{e.model().undoHistory().undoStack().onChange().unsubscribeAll(ee)},disabled:!0,hotkeyGroup:t,hotkeyHash:o.Modifiers.Mod+90,isRepeatAccepted:!0}});e.model().undoHistory().undoStack().onChange().subscribe(ee,(()=>ee.update({disabled:e.model().undoHistory().undoStack().isEmpty()})));const te=new ht.Action({actionId:"Chart.Redo",options:{label:wa.t(null,void 0,i(48236)),onExecute:()=>{(0,u.trackEvent)("GUI","Redo"),e.model().undoHistory().redo()},onDestroy:()=>{e.model().undoHistory().redoStack().onChange().unsubscribeAll(te)},disabled:!0,hotkeyGroup:t,hotkeyHash:o.Modifiers.Mod+89,isRepeatAccepted:!0}});e.model().undoHistory().redoStack().onChange().subscribe(te,(()=>te.update({disabled:e.model().undoHistory().redoStack().isEmpty()})));const ie={invertSeriesScale:l,autoSeriesScale:c,lockSeriesScale:h,regularSeriesScale:d,percentSeriesScale:p,indexedTo100SeriesScale:_,logSeriesScale:m,applyTimeZone:g,symbolSearch:new ht.Action({actionId:"Chart.Dialogs.ShowChangeSymbol",options:{label:(0,Ca.appendEllipsis)(a.t(null,void 0,i(85124))),statName:"ChangeSymbol",onExecute:()=>{(0,v.showDialog)({defaultValue:"",trackResultsOptions:{trackResults:!1,emptySearchType:"empty_result__supercharts"}})}}}),changeInterval:Ia(e),timeScaleReset:f,insertIndicator:y,compareOrAdd:S,chartProperties:b,mainSeriesPropertiesAction:w,scalesProperties:C,lineToggleLock:P,seriesHide:x,studyHide:x,lineHide:x,scaleSeriesOnly:T,drawingToolbarAction:I,
stayInDrawingModeAction:M,hideAllMarks:A,showSeriesLastValue:L,showSymbolLabelsAction:k,showStudyLastValue:E,showStudyPlotNamesAction:B,showHighLowPriceLabels:O,showHighLowPriceLines:F,showCountdown:W,addPlusButton:H,showSymbolInfoDialog:z,mergeLeftScalesAction:U,mergeRightScalesAction:j,moveScaleToLeft:G,moveScaleToRight:q,chartReset:$,sessionBreaks:J,showPriceLine:Q,undo:ee,redo:te};return r.goToDateEnabled&&(ie.gotoDate=new ht.Action({actionId:"Chart.Dialogs.ShowGoToDate",options:{label:(0,Ca.appendEllipsis)(wa.t(null,void 0,i(54280))),statName:"GoToDate",onExecute:()=>(0,xa.showGoToDateDialog)(e.chartWidgetCollection().activeChartWidget.value()),hotkeyGroup:t,hotkeyHash:o.Modifiers.Alt+71}})),(0,N.enabled)("show_object_tree")&&(ie.paneObjectTree=new ht.Action({actionId:"Chart.ObjectTree.Show",options:{label:(0,Ca.appendEllipsis)(wa.t(null,void 0,i(51221))),statName:"ObjectsTree",onExecute:()=>e.showObjectsTreePanelOrDialog()}})),(0,N.enabled)("property_pages")&&(ie.format=new wt.ActionWithStandardIcon({actionId:"Chart.SelectedObject.ShowSettingsDialog",options:{label:(0,Ca.appendEllipsis)(wa.t(null,void 0,i(32514))),iconId:"Settings",statName:"EditSelectedObject",onExecute:()=>e.showSelectedSourcesProperties()}})),La&&(ie.showAverageClosePriceLabel=new ut({actionId:"Chart.PriceScale.Labels.ToggleAveragePriceLabelVisibility",options:{label:wa.t(null,void 0,i(21841)),checkable:!0,checked:!1,statName:"ToggleAverageClosePriceLabel"}},{property:R.averageClosePriceLabelVisible,undoModel:s,undoText:Wa}),ie.showAverageClosePriceLine=new ut({actionId:"Chart.Lines.TogglePrePostMarketLineVisibility",options:{label:wa.t(null,void 0,i(16138)),checkable:!0,checked:!1,statName:"ToggleAverageClosePriceLine"}},{property:R.averageClosePriceLineVisible,undoModel:s,undoText:Ha})),e.readOnly()||(ie.paneRemoveAllStudies=new ht.Action({actionId:"Chart.RemoveAllIndicators",options:{label:wa.t(null,void 0,i(99984)),statName:"RemoveAllIndicators",onExecute:()=>e.removeAllStudies()}}),ie.paneRemoveAllDrawingTools=new ht.Action({actionId:"Chart.RemoveAllLineTools",options:{label:wa.t(null,void 0,i(96374)),statName:"RemoveAllDrawingTools",onExecute:()=>e.removeAllDrawingTools()}}),ie.paneRemoveAllStudiesDrawingTools=new ht.Action({actionId:"Chart.RemoveAllIndicatorsAndLineTools",options:{label:wa.t(null,void 0,i(81442)),statName:"RemoveAllIndicatorsAndDrawingTools",onExecute:()=>e.removeAllStudiesDrawingTools()}}),ie.applyStudiesToAllCharts=new ht.Action({actionId:"Chart.ApplyIndicatorsToAllCharts",options:{label:wa.t(null,void 0,i(22437)),statName:"ApplyIndicatorsToAllCharts",onExecute:()=>e.chartWidgetCollection().applyIndicatorsToAllCharts(e)}}),ie.studyRemove=ie.lineRemove=new wt.ActionWithStandardIcon({actionId:"Chart.SelectedObject.Remove",options:{label:wa.t(null,void 0,i(67410)),iconId:"Chart.RemoveSelectedObject",statName:"RemoveSelectedObject",onExecute:()=>{var t;(null!==(t=e.chartWidgetCollection().activeChartWidget.value())&&void 0!==t?t:e).removeSelectedSources()},hotkeyGroup:t,hotkeyHash:o.isMacKeyboard?8:46}})),ie}(this),
this.withModel(null,(()=>{const e=this.model().mainSeries(),t=e.properties();t.childs().priceAxisProperties.subscribe(this,this._updateScalesActions),e.priceScaleAboutToBeChanged().subscribe(this,(()=>{t.childs().priceAxisProperties.unsubscribeAll(this)})),e.priceScaleChanged().subscribe(this,(()=>{t.childs().priceAxisProperties.subscribe(this,this._updateScalesActions),this._updateScalesActions()}))})),this._updateScalesActions(),this._actions}_unsetActions(){this._actions&&(Object.values(this._actions).forEach((e=>{e.destroy()})),this._actions=null)}}},29250:(e,t,i)=>{"use strict";i.r(t),i.d(t,{activeLinkingGroupWV:()=>Ei,allInitialModelsCreated:()=>gi,allInitialSymbolsResolved:()=>mi,allLinkingGroupsWV:()=>Bi,applyIndicatorToAllChartsImpl:()=>xt,applyIndicatorsToAllChartsImpl:()=>Pt,applyLineToolUpdateNotificationImpl:()=>Dt,applyStudiesOverrides:()=>Xi,applyThemeImpl:()=>yi,chartsSymbolsImpl:()=>Bt,checkProFeatureImpl:()=>fi,combinedTrackTimeLock:()=>Wi,computeContentBoxImpl:()=>qt,copyScreenshotToClipboard:()=>Ht,createBroadcastChannel:()=>ui,createChartStorageSubscriptionsIfRequired:()=>Rt,createChartWidgetCollectionNewsNotifier:()=>Nt,createClipboardHandler:()=>Et,createLeftBottomChartWidgetWV:()=>Ut,deserializedChartIds:()=>Lt,destroyBroadcastChannel:()=>pi,downloadScreenshot:()=>Wt,generateNewChartId:()=>ti,getAllLinkingGroups:()=>Vi,getAsyncStateForChartImpl:()=>At,getChartWidgetsForIntervalLock:()=>ki,getClientSnapshot:()=>Gt,getLinkingGroupCharts:()=>Ri,getSnapshot:()=>jt,getStateForChartImpl:()=>Mt,getVisuallyAdjacentDefImpl:()=>Qt,handleConnectionLimitReachedChanged:()=>Oi,handleDateRangeLockChange:()=>xi,handleInternalDateRangeLockChange:()=>Pi,handleInternalIntervalLockChange:()=>wi,handleInternalSymbolLockChange:()=>Si,handleInternalTrackTimeLockChange:()=>Ti,handleIntervalLockChange:()=>Ci,handleSymbolLockChange:()=>bi,handleTrackTimeLockChange:()=>Ii,hideChartImpl:()=>ri,lineToolsAndGroupsDTOsImpl:()=>It,removeChartWidgetSubscriptionsImpl:()=>oi,resetLayoutSizesImpl:()=>Yt,resetLineToolsInvalidatedImpl:()=>kt,setBrokerImpl:()=>Vt,setChartLayoutWithUndoImpl:()=>vi,setChartStyleToWidget:()=>Li,setLayoutImpl:()=>ci,setResolution:()=>Di,setSymbol:()=>Mi,setSymbolAll:()=>Ai,someOfWidgetsAreInSelectingReplayPointMode:()=>Fi,stateImpl:()=>Yi,subscribeToCompletedEventForDateRangeUpdate:()=>Hi,subscribeToEventsForDateRangeSync:()=>Gi,syncChartsDateRangesWithActiveChartRange:()=>Ki,syncCrosshairImpl:()=>di,syncScrollImpl:()=>_i,takeScreenshot:()=>Ot,takeServerScreenshot:()=>Ft,unloadUnusedChartsImpl:()=>ai,unsubscribeFromEventsForDateRangeSync:()=>qi,updateLayoutImpl:()=>Jt,updateLayoutPartialImpl:()=>Xt,updateLinkingGroupCharts:()=>Ni});var s=i(50151),r=i(86441),n=i(31955),o=i(11542),a=i(69109),l=i(49483),c=i(45126),h=i(56570);function d(e){const t={};return{promise:new Promise(((i,s)=>{e.subscribe(t,i,!0)})),destroy:()=>{e.unsubscribeAll(t)}}}var u=i(64147),p=(i(77788),i(60265));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(49406),v=i(65446),y=i(93352);const S=(0,n.getLogger)("Clipboard");var b;!function(e){e.MagicAttrName="data-tradingview-clip"}(b||(b={}));class w{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`<meta charset="utf-8"><span data-tradingview-clip="${(0,f.htmlEscape)(e)}">${t?(0,f.htmlEscape)(t.slice(0,256)):"&#128200;"}</span>`}}class C{constructor(e){this._e=e}async read(){this._e&&0===this._e.eventPhase&&(S.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;e<t.files.length;e++)i.files.push(t.files[e]);for(let e=0;e<t.items.length;e++){const s=t.items[e];"string"===s.kind&&("text/plain"===s.type?i.text=t.getData(s.type):"text/html"===s.type?i.html=t.getData(s.type):i.files.push(new Blob([t.getData(s.type)],{type:s.type})))}return i}async _readUsingApi(){const e=(0,y.getClipboard)();if(!e||!e.read)throw new DOMException("ClipboardApi is not supported","NotSupportedError");let t,i;const s=[],r=await e.read();for(const e of r)for(const r of e.types)"text/html"===r?t=e.getType(r).then(this._readBlobAsText):"text/plain"===r?i=e.getType(r).then(this._readBlobAsText):s.push(e.getType(r));return{text:await i,html:await t,files:await Promise.all(s)}}_fromRaw(e){const t={};if(void 0!==e.text&&(t.text=e.text),void 0!==e.html){const i=this._parseAppData(e.html);i?t.app=i:t.html=e.html}return e.files.length>0&&(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 P=i(35749);function x(e){const t=e.target;return null!==t&&1===t.nodeType&&(0,P.isTextEditingField)(t)}function T(e){const t=e.target;if(null===t)return!1;const i=(t.ownerDocument||t).getSelection();return null!==i&&!i.isCollapsed}class I 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 C(null).read()}uiRequestCopy(e){this._callbacks.copyRequested&&this._callbacks.copyRequested(new w(null),e)}uiRequestCut(e){this._callbacks.cutRequested&&this._callbacks.cutRequested(new w(null),e)}uiRequestPaste(e){this._callbacks.pasteRequested&&this._callbacks.pasteRequested(new C(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 w(e))}_onCutEv(e){e.defaultPrevented||this._callbacks.cutRequested&&this._callbacks.cutRequested(new w(e))}_onPasteEv(e){e.defaultPrevented||this._callbacks.pasteRequested&&this._callbacks.pasteRequested(new C(e))}}{_onCopyEv(e){if(!x(e)&&!T(e))return super._onCopyEv(e)}_onCutEv(e){if(!x(e)&&!T(e))return super._onCutEv(e)}_onPasteEv(e){if(!x(e))return super._onPasteEv(e)}}const M=()=>i.e(4389).then(i.bind(i,7960));function A(e,t={}){return M().then((i=>i.copyToClipboardImageOfChart(e,t)))}function L(e,t={}){return M().then((i=>i.getImageOfChartSilently(e,t)))}var k=i(2740),D=i(68805),E=i(84015),V=i(85662),B=i(27714),R=i(24377),N=i(26843),O=i(29981),F=i(7114),W=i(15938),H=i(68979),z=i(87489),U=i(76351);const j=!h.enabled("widget_logo")||!1;var G;function q(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=q(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=q(r,t,i);s={...s,...n.relativePositions},t=n.nextElementLeft,e=n.nextElementTop}i=e}return{relativePositions:s,nextElementTop:i,nextElementLeft:t}}!function(e){e[e.LegendTopMargin=10]="LegendTopMargin",e[e.LegendLeftMargin=8]="LegendLeftMargin",e[e.LegendLineSpacingCoeff=1.4]="LegendLineSpacingCoeff",e[e.LegendItemSpacingCoeff=1.4]="LegendItemSpacingCoeff",e[e.LegendTextFontSize=12]="LegendTextFontSize",e[e.FooterTextFontSize=13]="FooterTextFontSize",e[e.Padding=10]="Padding",e[e.ChartsSpacing=5]="ChartsSpacing",e[e.FooterHeight=35]="FooterHeight",e[e.LogoHeight=15]="LogoHeight",e[e.LogoWidth=20]="LogoWidth",e[e.LogoTextMargin=3]="LogoTextMargin"}(G||(G={}));const $=function(e){const t={};for(const i of Object.keys(e)){const s=q(e[i]).relativePositions;t[i]=s}return t}(z);function K(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=K(o.l,t,i,s);r=e.x+e.width+Math.round(5*s)}if(null!==o.t){const e=K(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 Y(e,t,i){var s;const r=(new DOMParser).parseFromString(U,"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 Z(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,F.drawScaled)(e,r,r,(()=>{e.fillText("TradingView",n,o)})),e.restore()}function X(e,t,i,s){return(0,F.drawScaled)(e,s,s,(()=>{e.fillText(i,t.x/s,t.y/s)})),e.measureText(i).width*s}function J(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;e<t.length;++e)n.push(e);const o=(0,O.upperbound)(n,i,((n,o)=>e.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+=X(e,new r.Point(l,i.y),s.text,t),s.color&&e.restore(),d+=s.text.length}return c.elided&&(l+=X(e,new r.Point(l,i.y),"...",t)),l}function Q(e){return e.map((e=>({...e,title:""})))}function ee(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 te{constructor(e,t){this._logoTextColor=null,this._snapshotData=e,t=t||{},this._options={backgroundColor:V.themes[e.theme].getThemedColor("color-bg-primary"),borderColor:V.themes[e.theme].getThemedColor("color-border"),font:W.CHART_FONT_FAMILY,fontSize:12,legendMode:"vertical",hideResolution:!1,hideStudiesFromLegend:!1,showHeaderPublishedBy:!1,showHeaderMainSymbol:!1,...t};const i=$[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,B.size)({width:i,height:s})}(e)));if(this._pixelRatio=e.hidpiRatio,this._chartsGeometry=e.charts.map(((e,t)=>K(t,s,i,this._pixelRatio))),!j){let i=e.theme;void 0!==t.backgroundColor&&(i="black"===(0,R.rgbToBlackWhiteString)((0,R.parseRgb)(t.backgroundColor),150)?N.StdTheme.Dark:N.StdTheme.Light),this._logoTextColor=V.themes[i].getThemedColor("color-text-primary")}this._headerDefaultTextColor=V.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=j?Math.round(10*e):Math.round(35*e),h=i;i+=c;const d=(0,F.createDisconnectedCanvas)(document,(0,B.size)({width:t,height:i}),1),u=(0,F.getContext2D)(d);u.font=(0,H.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;e<this._snapshotData.charts.length;++e){const t=this._snapshotData.charts[e],i=this._chartsGeometry[e];this._drawChart(t,i,u,new r.Point(0,l))}if(null!==this._logoTextColor){const t=await Y(Math.round(20*e),Math.round(15*e),this._logoTextColor);u.fillStyle=this._logoTextColor,u.font=(0,H.makeFont)(13,W.CHART_FONT_FAMILY);const i=h+Math.round(c/2-t.height/2);Z(u,Math.round(10*e),i,t,e)}return d}_drawChart(e,t,i,s){i.save(),i.translate(t.x+s.x,t.y+s.y);let n=0;for(const t of e.panes){let s=0;const o=t.leftAxis.canvas.width+Math.round(8*this._pixelRatio),a=n,l=n+Math.round(10*this._pixelRatio);t.leftAxis.contentWidth>0&&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(ee(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)=>{J(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<n+e.canvas.height){const i=J(t,this._pixelRatio,new r.Point(l,c),e.contentWidth*this._pixelRatio,ee(e.mainSeriesText,e.mainSeriesValues),!0);"horizontal"!==this._options.legendMode?c+=a:(l=(0,s.ensureNotNull)(i)+1.4*this._options.fontSize*this._pixelRatio,o=!1)}
for(let s=0;s<e.studies.length;++s)if(c+a<n+e.canvas.height){const n=e.studies[s],h=e.studiesValues[s];let d=null;for(;null===d;)d=J(t,this._pixelRatio,new r.Point(l,c),e.contentWidth*this._pixelRatio,this._options.hideStudiesFromLegend?[]:ee(n,Q(h)),o),"horizontal"!==this._options.legendMode?c+=a:null===d?(o=!0,l=i.x,c+=a):(l=d+1.4*this._options.fontSize*this._pixelRatio,o=!1)}}}var ie=i(92184),se=i(68993),re=i(76422),ne=i(31940),oe=i(79754),ae=i(65952),le=i(18832),ce=i(35236),he=i(72522);const de=new c.TranslatedString("change chart layout to {title}",o.t(null,void 0,i(68846)));class ue extends p.UndoCommand{constructor(e,t){super(de.format({title:se.layouts[t].title})),this._chartWidgetCollection=e,this._newLayoutType=t,this._oldLayoutType=e.layout.value()}redo(){this._chartWidgetCollection.setLayout(this._newLayoutType)}undo(){this._chartWidgetCollection.setLayout(this._oldLayoutType)}}var pe,_e=i(37265),me=i(928),ge=i(19625),fe=i(95201),ve=i(2844),ye=i(95173),Se=i(34026),be=i(51056),we=i(37743),Ce=i(61993);!function(e){e[e.SizeDelta=1]="SizeDelta"}(pe||(pe={}));class Pe{constructor(e,t,i){this._data=e,this._hittest=t,this._textWidthCache=i}draw(e,t){const{horizontalPixelRatio:i,verticalPixelRatio:s}=t,n=this._data.centerPoint,o=Math.round(n.x*i),a=Math.round(n.y*s),l=Math.max(1,Math.floor(i))%2/2,c=Math.max(1,Math.floor(s))%2/2,h=new r.Point(o+l,a-c);this._drawLollipop(e,h,t),this._drawLabel(e,h,t)}hitTest(e){const t=(0,Ce.interactionTolerance)().esd,i=this._data.centerPoint.y-this._data.style.lollipop.height/2-t,s=this._data.centerPoint.x-this._data.style.lollipop.width/2-t,n=(0,r.box)(new r.Point(s,i),new r.Point(s+this._data.style.lollipop.width+2*t,i+this._data.style.lollipop.height+2*t));return(0,Se.pointInBox)(e,n)?this._hittest:null}_drawLollipop(e,t,i){const s=this._data.style,{horizontalPixelRatio:r}=i,n=this._fillRadius(r);s.lollipop.fillCircle&&s.lollipop.backgroundColor&&this._drawFilledCircle(e,t,n,s.lollipop.backgroundColor);const o=Math.round(s.lollipop.lineWidth*r),a=n-Math.round(1*r+o/2);this._drawBorderLine(e,t,o,a),s.lollipop.fillCircle&&s.lollipop.fillStyle&&this._drawFilledCircle(e,t,a,s.lollipop.fillStyle)}_drawLabel(e,t,i){const s=this._data.style.lollipop.text,r=s.label;if(""===r)return;const{horizontalPixelRatio:n,verticalPixelRatio:o}=i;e.textAlign="center",e.textBaseline="middle",e.fillStyle=s.strokeStyle,e.font=s.font;const a=this._textWidthCache.yMidCorrection(e,r);e.translate(t.x,t.y+((s.deltaY||0)+a)*o),(0,F.drawScaled)(e,n,o,(()=>{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,we.setLineStyle)(e,be.LINESTYLE_SOLID),(0,we.createCircle)(e,t.x,t.y,s),e.stroke()}_drawFilledCircle(e,t,i,s){e.fillStyle=s,(0,we.createCircle)(e,t.x,t.y,i),e.fill()}}var xe,Te,Ie=i(56468);!function(e){e[e.SpaceBetweenRows=25]="SpaceBetweenRows",e[e.TooltipTopMargin=15]="TooltipTopMargin",
e[e.SpaceBetweenCardAndLollipop=8]="SpaceBetweenCardAndLollipop"}(xe||(xe={}));class Me extends Pe{_drawLollipop(e,t,i){var s;if(!this._imageLoaded())return void super._drawLollipop(e,t,i);const r=this._data.style,{horizontalPixelRatio:n}=i,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,we.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)}}!function(e){e.PositiveEarningFillPath="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",e.PositiveEarningStrokePath="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",e.NegativeEarningFillPath="M8.961 23.08a3 3 0 0 0 3.078 0l7.5-4.48A3 3 0 0 0 21 16.025V4a3 3 0 0 0-3-3H3a3 3 0 0 0-3 3v12.025A3 3 0 0 0 1.461 18.6l7.5 4.48z",e.NegativeEarningStrokePath="M9.866 21.257c.391.23.877.23 1.268 0l7.5-4.414a1.25 1.25 0 0 0 .616-1.078V4c0-.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",e.DefaultEarningFillPath="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",e.DefaultEarningStrokePath="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"}(Te||(Te={}));const Ae={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")},Le={fillPath:new Path2D("M8.961 23.08a3 3 0 0 0 3.078 0l7.5-4.48A3 3 0 0 0 21 16.025V4a3 3 0 0 0-3-3H3a3 3 0 0 0-3 3v12.025A3 3 0 0 0 1.461 18.6l7.5 4.48z"),strokePath:new Path2D("M9.866 21.257c.391.23.877.23 1.268 0l7.5-4.414a1.25 1.25 0 0 0 .616-1.078V4c0-.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")},ke={
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 De(e,t,i,s,r){const{horizontalPixelRatio:n,verticalPixelRatio:o}=i;e.save(),e.translate(t.x-s.lollipop.width*n/2,t.y-s.lollipop.height*o/2),e.scale(n,o),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,we.setLineStyle)(e,be.LINESTYLE_SOLID),s.lollipop.fillCircle&&s.lollipop.fillStyle&&(e.fillStyle=s.lollipop.fillStyle,e.fill(r.strokePath)),e.stroke(r.strokePath),e.restore()}function Ee(e,t,i,s){De(e,t,i,s,Ae)}function Ve(e,t,i,s){De(e,t,i,s,Le)}function Be(e,t,i,s){De(e,t,i,s,ke)}class Re extends Pe{_drawLollipop(e,t,i){const s=this._data.style;switch(s.shape){case"earningUp":Ee(e,t,i,s);break;case"earningDown":Ve(e,t,i,s);break;case"earning":Be(e,t,i,s);break;default:super._drawLollipop(e,t,i)}}}var Ne;!function(e){e[e.HoveredColorTransparency=85]="HoveredColorTransparency",e.ActiveTextColor="rgba(255, 255, 255, 0.92)"}(Ne||(Ne={}));const Oe={backgroundDark:(0,ge.getHexColorByName)("color-cold-gray-900"),backgroundLight:(0,ge.getHexColorByName)("color-white")};class Fe extends class{constructor(e,t,i){this._invalidated=!1,this._renderer=new fe.CompositeRenderer,this._textWidthCache=new ve.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,t){var i;if(null===this._lastClickedId||!t)return void this.clearLastClicked();let n=null;if((0,ce.isTouchMouseEvent)(t))n=new r.Point(t.clientX,t.clientY);else if(function(e){return void 0!==e.touches}(t)){if(1!==t.touches.length)return;{const e=(0,s.ensureNotNull)(t.target).getBoundingClientRect(),i=t.touches[0];n=new r.Point(i.clientX-e.left,i.clientY-e.top)}}else n=new r.Point(t.offsetX,t.offsetY);const o=this._renderer.hitTest(n,e);null!==o&&(null===(i=o.data())||void 0===i?void 0:i.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,_e.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){const{mediaSize:t}=e;this._renderer.clear();for(const i in this._lollipops)if(this._lollipops.hasOwnProperty(i)){const n=(0,s.ensureDefined)(this._lollipops[i]);if(n.visible){const i=this._getLollipopStatus(n),s=this.getStyle(n,i),o={id:n.id,centerPoint:new r.Point(n.basePoint.x,n.basePoint.y-s.lollipop.bottom-s.lollipop.height/2-(s.lollipop.incHeight||0)),style:s,status:i},a={activeItem:n.itemIndex,hideCrosshairLinesOnHover:!0,clickHandler:this._lollipopMouseClickHandler.bind(this,e,o,t),tapHandler:this._lollipopMouseClickHandler.bind(this,e,o,t)};if(this._renderer.append(this._createRendererForLollipop(o,a)),this._showBarLine(n)){const{strokeStyle:e,lineStyle:t,lineWidth:i}=s.barLine,r={color:e,linestyle:t,linewidth:i,x:n.basePoint.x,top:0,bottom:n.basePoint.y-s.lollipop.bottom-s.lollipop.height},o=new ye.VerticalLineRenderer;o.setData(r),this._renderer.insert(o,0)}}}}_recreateStyles(e){this._stylesCache=null}_createRendererForLollipop(e,t){return new Pe(e,new Ie.HitTestResult(Ie.HitTarget.Custom,t),this._textWidthCache)}_onSymbolOrIntervalChanged(){this._lollipops={},this._lollipopsCounter=0,this._renderer.clear(),this.clearLastClicked()}_lollipopMouseClickHandler(e,t,i,n){n.preventDefault();const o=t.id;if(this._lastClickedId=this._lastClickedId===o?null:o,null===this._lastClickedId)return;const a={target:n.target,targetSize:i,point:new r.Point(t.centerPoint.x,t.centerPoint.y-t.style.lollipop.height/2-8),marginTop:15};this._clickHandler(e,a,(()=>{const e=(0,s.ensureDefined)(this._lollipops[o]);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){return this._invalidated&&(this._createLollipops(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?Me:Re)(e,new Ie.HitTestResult(Ie.HitTarget.Custom,t),this._textWidthCache)}_lollipopMouseClickHandler(e,t,i,s){
super._lollipopMouseClickHandler(e,t,i,s),(0,re.emit)("onTimescaleMarkClick",t.id)}_createLollipops(e){const t=this._model.timeScale(),i=super._getY(),s=this._model.lastHittestData(),n=this._model.hoveredSource(),o=this.source.marks(),a=new Map;Object.keys(o).forEach((e=>{var l;const c=o[e],h=c.id,d=c.index;if(null!=d){const e=h===this.getLastClickedLollipopId(),o=this._lollipops[h],u=void 0!==o?o.itemIndex:this._lollipopsCounter++;this._itemIndexToId.has(u)||this._itemIndexToId.set(u,h);const p=n===this.source&&null!==s&&s.activeItem===u,_=(null!==(l=a.get(d))&&void 0!==l?l:-1)+1;a.set(d,_),this._lollipops[h]={id:h,itemIndex:u,basePoint:new r.Point(t.indexToCoordinate(d)+1,i),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)}_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()?Oe.backgroundDark:Oe.backgroundLight;let h,d=i;if("active"===e)h=i,d="rgba(255, 255, 255, 0.92)";else if("hovered"===e){const e=(0,R.tryParseRgba)(i);if(null!==e){const t=e[3]*(1-.85);h=(0,R.rgbaToString)((0,R.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:be.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,H.makeFont)(12,W.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 We=i(55917),He=i(2718),ze=i(19938),Ue=i(41925);const je=(0,n.getLogger)("Chart.UserDefinedImageMarks");class Ge extends Ue.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,ze.getImage)(e,e).then((e=>{this._destroyed||(t.imageElement=e,this.updateAllViewsAndRepaint(),this._model.updateSource(this))})).catch((()=>{je.logWarn(`An error ocurred while loading image ${e}`)})),this._imageItems.set(e,t)}}class qe extends Ge{constructor(e){super(e,new We.DefaultProperty({defaultName:"UserDefinedTimescaleMarks",state:{visible:!0}})),this._requestedPointsets=new Set,(0,me.hideMarksOnBars)().subscribe(this,(()=>this._properties.childs().visible.setValue(!(0,me.hideMarksOnBars)().value()))),this._paneView=new Fe(e,this,this._showTooltip.bind(this)),
this._paneViews=[this._paneView]}destroy(){(0,me.hideMarksOnBars)().unsubscribeAll(this),super.destroy()}zorder(){return He.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(e,t){this._paneView.processClickOutside(e,t)}isVisible(){return this.properties().childs().visible.value()}_initialize(){this._properties.childs().visible.setValue(!(0,me.hideMarksOnBars)().value())}_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,r){const n=r();if(!n)return;const o=this._model.timeScale(),a=[o.onScroll(),o.barSpacingChanged(),this._model.mainSeries().onSymbolIntervalChanged(),(0,s.ensureNotNull)(this._model.paneForSource(this)).onSizeChanged()],l=this._paneView.processClickOutside.bind(this._paneView,e),c=this._paneView.clearLastClicked.bind(this._paneView);(await Promise.all([i.e(2603),i.e(7769),i.e(8077),i.e(9259),i.e(2227),i.e(361),i.e(9039)]).then(i.bind(i,184))).showLollipopTooltip({items:n,position:t,customCloseSubscriptions:a,onClickOutside:l,onCustomClose:c})}}var $e,Ke,Ye=i(71382);function Ze(e,t){const{horizontalPixelRatio:i,verticalPixelRatio:s}=t,r=Math.max(1,Math.floor(i)),n=Math.round(e.x*i)+r%2/2;let o=Math.round(e.size*i);(n+o/2)%1!=0&&(o+=1);const a=Math.min(Math.max(1,Math.round(i*e.borderWidth)),o/2);let l;const c=("up"===e.direction?-1:1)*(e.yInverted?-1:1),h=c*(Math.round(e.size*s/2)+r%2);if(void 0!==e.fixedSpaceYPosition){
const t=Math.round(e.fixedSpaceYPosition.itemSpacing*s),i=e.fixedSpaceYPosition.order,r=c*(o*i+t*(i+1));l=Math.round(e.fixedSpaceYPosition.basePosition*s)+r+h}else l=Math.round(e.y*s)+h;return{x:n,y:l,size:o,borderWidth:a,tickSize:r}}function Xe(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}=Ze(i,t);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,{x:l,y:c,borderWidth:h,size:d}=Ze(i,t);e.strokeStyle=n,e.fillStyle=o,e.lineWidth=h,e.beginPath();const u=d/2-h/2;e.arc(l,c,u,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,we.createCircle)(e,s,r,i),e.clip(),e.drawImage(t,s-i,r-i,n,n),e.restore()}}(e,r,u,l,c);e.stroke(),!s&&a&&d/2>=7&&(e.textAlign="center",e.textBaseline="middle",e.font=a.font,e.fillStyle=a.fontColor,(0,F.drawScaled)(e,t.horizontalPixelRatio,t.verticalPixelRatio,(()=>{e.fillText(a.text,l/t.horizontalPixelRatio,c/t.verticalPixelRatio)})))}(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()}!function(e){e[e.MinRadiusToDrawText=7]="MinRadiusToDrawText"}($e||($e={}));class Je{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);if(s)return s}return null}draw(e,t){this._canvas=e.canvas,null!==this._data&&this._data.items.forEach(Xe.bind(null,e,t,this._data.highlightByAuthor))}_hitTestDot(e,t,i){const s=new r.Point(e.x,Ze(e,i).y/i.verticalPixelRatio);if((0,Se.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 Ie.HitTestResult(Ie.HitTarget.Regular,{activeItem:e.originalItem.id,...i})}return null}}!function(e){e[e.BarSpacingToSizeRatio=.8]="BarSpacingToSizeRatio",e[e.MinSize=7]="MinSize",e[e.MaxSize=553]="MaxSize"}(Ke||(Ke={}));const Qe={green:{border:(0,ge.getHexColorByName)("color-minty-green-700"),background:(0,ge.getHexColorByName)("color-minty-green-a600")},red:{border:(0,ge.getHexColorByName)("color-ripe-red-700"),background:(0,
ge.getHexColorByName)("color-ripe-red-500")},neutral:{border:(0,ge.getHexColorByName)("color-tan-orange-700"),background:(0,ge.getHexColorByName)("color-tan-orange-500")},yellow:{border:"#EAC300",background:"#FFD400"},blue:{border:"#047ACE",background:"#0496FF"}};function et(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 tt 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 Je(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(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer}onClickOutside(e,t){t&&((0,ce.isTouchMouseEvent)(t)?t.isTouch:(0,Ye.isTouchEvent)(t))&&null!==this._tooltip&&!this._tooltip.contains(t.target)&&this._tooltip.hide(!0)}_extractBarMarksRendererItemData(e,t){var i,s;const r=null!==(i=t.overridedTheme)&&void 0!==i?i:Qe[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:et(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,H.makeFont)(Math.ceil(Math.max(10,Math.min(n/2,20))),W.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(2841),i.e(2227),i.e(8020)]).then(i.bind(i,6897)),Promise.all([i.e(2841),i.e(2227),i.e(8020)]).then(i.bind(i,16608))]);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 it extends Ge{constructor(e){super(e,new We.DefaultProperty({defaultName:"UserDefinedBarsMarks",state:{visible:!0}})),this._paneView=new tt(this,e),this._paneViews=[this._paneView],(0,me.hideMarksOnBars)().subscribe(this,(()=>{this.properties().childs().visible.setValue(!(0,me.hideMarksOnBars)().value())}))}destroy(){(0,me.hideMarksOnBars)().unsubscribeAll(this),this._paneView.destroy(),super.destroy()}zorder(){return He.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,t){this._paneView.onClickOutside(e,t)}_initialize(){this.properties().childs().visible.setValue(!(0,me.hideMarksOnBars)().value())}_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,_e.isNumber)(e.borderWidth)?e.borderWidth:void 0,s=(0,_e.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 st=i(45345);const rt=new c.TranslatedString("apply toolbars theme",o.t(null,void 0,i(86708)));class nt extends p.UndoCommand{constructor(e,t,i=!0){super(rt),this._prevThemeName=e,this._themeName=t,this._syncState=i}undo(){(0,V.isStdThemeName)(this._prevThemeName)&&((0,st.setTheme)(this._prevThemeName),this._syncState&&(0,V.syncTheme)())}redo(){(0,
V.isStdThemeName)(this._themeName.toLowerCase())&&((0,st.setTheme)(this._themeName.toLowerCase()),this._syncState&&(0,V.syncTheme)())}}var ot=i(88960),at=i(23869),lt=i(91676),ct=(i(85049),i(10074)),ht=i(16638),dt=i(68159),ut=i(75162);i(53473);const pt=!l.CheckMobile.any(),_t=((0,n.getLogger)("ChartWidgetCollectionBase"),new c.TranslatedString("apply indicators to entire layout",o.t(null,void 0,i(70507)))),mt=new c.TranslatedString("sync time",o.t(null,void 0,i(91677))),gt=new c.TranslatedString("resize layout",o.t(null,void 0,i(47418))),ft=new c.TranslatedString("reset layout sizes",o.t(null,void 0,i(85366))),vt=new c.TranslatedString("apply chart theme",o.t(null,void 0,i(68231))),yt=new c.TranslatedString("symbol lock",o.t(null,void 0,i(53278))),St=new c.TranslatedString("interval lock",o.t(null,void 0,i(56558))),bt=new c.TranslatedString("date range lock",o.t(null,void 0,i(58850))),wt=new c.TranslatedString("track time",o.t(null,void 0,i(46807))),Ct=new c.TranslatedString("change series style",o.t(null,void 0,i(49965)));o.t(null,void 0,i(28298)),o.t(null,void 0,i(78972)),o.t(null,void 0,i(10615)),o.t(null,void 0,i(81518)),o.t(null,void 0,i(40947)),o.t(null,void 0,i(55801)),o.t(null,void 0,i(76651)),o.t(null,void 0,i(68054)),o.t(null,void 0,i(94656));function Pt(e,t){const i=t.model().model().studyTemplate();e.undoHistory.beginUndoMacro(_t);for(let s=0;s<e.chartWidgetsDefs.length;s++){const r=e.chartWidgetsDefs[s].chartWidget;r!==t&&(r.hasModel()&&r.model().applyStudyTemplate(i,""))}e.undoHistory.endUndoMacro()}async function xt(e,t,i,r,n){e.undoHistory.beginUndoMacro(n);for(let o=0;o<e.chartWidgetsDefs.length;o++){const a=e.chartWidgetsDefs[o].chartWidget;if(a!==t&&a&&a.hasModel()){const t=a.model();let o;if(r.isOnMainPane)o=(0,s.ensureNotNull)(t.model().paneForSource(a.model().model().mainSeries()));else{const i=new _(t.model(),r.paneIndex);e.undoHistory.pushUndoCommand(i);const n=(0,s.ensureDefined)(i.createdPaneId());o=(0,s.ensureDefined)(t.model().panes().find((e=>e.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 Tt(e){let t=1;for(;e.has(""+t);)t++;return""+t}function It(e){const t=new Map,i=e.chartsCountToSave(),s=new Set;for(let r=0;r<i;r++)if(r<e.chartWidgetsDefs.length){const i=e.chartWidgetsDefs[r].chartWidget,n=i.id(),o=i.lineToolsAndGroupsDTO();t.set(n,o),s.add(n)}else{const i=e.savedChartWidgetOptions[r-e.chartWidgetsDefs.length].content;i.chartId||(i.chartId=Tt(s));const n=new Map;n.set(0,extractLineToolsDTOFromChartState(i)),t.set(i.chartId,n),s.add(i.chartId)}return t}function Mt(e,t){const i=this.innerState(),{withData:s,skipLineToolsFromOtherSymbols:r,wipeSensitiveData:n,skipLineTools:o}=t;if(e<i.chartWidgetsDefs.length){const t=i.chartWidgetsDefs[e].chartWidget
;return e<i.actualLayoutCount()||t.shouldBeSavedEvenIfHidden()?t.state(s,r,n,o):null}const a=i.savedChartWidgetOptions[e-i.chartWidgetsDefs.length].content;return a}function At(e,t){return t<e.chartWidgetsDefs.length?e.chartWidgetsDefs[t].chartWidget.asyncState():Promise.resolve({})}function Lt(e){return e.savedChartWidgetOptions.map((e=>(0,s.ensureDefined)(e.content.chartId)))}function kt(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 Dt(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 Et(e){return new I({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 Vt(e,t){0}function Bt(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 Rt(e,t){0}async function Nt(e,t){return null}function Ot(e,t){return L(t,{snapshotUrl:e}).then((e=>((0,re.emit)("onScreenshotReady",e),e)))}function Ft(e,t){const i={snapshotUrl:e};const s=(0,E.isOnMobileAppPage)("any");return(s?L:A)(t,i).then((e=>((0,re.emit)("onScreenshotReady",e),s||(0,re.emit)("onServerScreenshotCopiedToClipboard"),e)))}function Wt(e){return function(e){return M().then((t=>t.downloadClientScreenshot(e)))}(e)}function Ht(e){return function(e){return M().then((t=>t.copyToClipboardClientScreenshot(e)))}(e).then((()=>{(0,re.emit)("onClientScreenshotCopiedToClipboard")}))}const zt={
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,"4s-l":0,"5h":0,"5v":0,"6h":0,"6v":0,"7h":0,"8h":0,"8v":0,"1-3":1,"2-2":3,"2-2-l":0,"2-3":2,"3-2":3,"1-4":1,"2-4":2,"5s":0,"6c":4,"8c":6,"9s":6,"9h":0,"9v":0,"10h":0,"10v":0,"10c5":1,"12c6":1,"12c4":3,"14c7":1,"16c8":1,"16c4":3};function Ut(e,t,i,s){let r=0;const n=(0,at.createWVFromGetterAndSubscriptions)((()=>++r),[i,s]);return(0,ot.combine)((t=>{var i;return null!==(i=e()[zt[t]])&&void 0!==i?i:null}),t.weakReference(),n.ownership())}function jt(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,V.getCurrentTheme)().name,charts:[e.activeChartWidget.value().images(s)],publishedBy:o};const l=[],c=se.layouts[e.layout.value()].count,h={showCollapsedStudies:(s=s||{}).showCollapsedStudies,status:s.status};for(let e=0;e<n.length&&e<c;e++)l.push(n[e].images(h));return{layout:e.layout.value(),hidpiRatio:r,theme:(0,V.getCurrentTheme)().name,charts:l,publishedBy:o}}function Gt(e,t,i,s){const r=s||{};return async function(e,t){return new te(e,t).getImage()}(jt(e,0,0,{showCollapsedStudies:!0,status:{hideResolution:Boolean(r.hideResolution)}}),r)}function qt(e){var t,i,s,r,n,o;const a=(null!==(t=e.options.edge)&&void 0!==t?t:0)+(null!==(i=e.options.border)&&void 0!==i?i:0),l=null!==(r=null===(s=e.bottomToolbar.value())||void 0===s?void 0:s.offsetHeight)&&void 0!==r?r:0,c=null!==(o=null===(n=e.replayContainer)||void 0===n?void 0:n.offsetHeight)&&void 0!==o?o:0;return{width:e.widthWV.value()-2*a,height:e.heightWV.value()-l-c-a,top:0,left:a}}function $t(e){return`chart-widget-collection-border-${e}`}function Kt(e,t){const i=(0,ae.layoutInitialSizingState)(e.layoutTemplate.value().expression),s=e.layoutTemplate.value().layoutType,r=t=>t?e.allLayoutSizesState.set(s,t):e.allLayoutSizesState.delete(s);if(t)return e.sizingState.setValue(i),void r(i);e.undoHistory.beginUndoMacro(ft),e.undoHistory.pushUndoCommand(new g(e.sizingState,e.sizingState.value(),i,ft)),e.undoHistory.pushUndoCommand(new m(r,e.allLayoutSizesState.get(e.layoutTemplate.value().layoutType),i,ft)),e.undoHistory.endUndoMacro()}function Yt(e,t){Kt(e,t)}class Zt{constructor(e,t,i){this._onShiftPressed=e=>{const t=this._state.currentLayoutResizeAction.value();t&&this._applyMouseMove(t.delta,e)},this._state=e,this._splitterElement=t,this._splitter=i,(0,he.shiftPressed)().subscribe(this._onShiftPressed)}destroy(){(0,he.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=$t(this._splitter.className)
;Array.from(this._state.parent.getElementsByClassName(t)).forEach((e=>e.classList.remove(ut.hovered)))}mouseDoubleClickEvent(e){Kt(this._state)}_highlightSplitters(e){const t=$t(this._splitter.className);Array.from(this._state.parent.getElementsByClassName(t)).forEach((e=>e.classList.remove(ut.hovered)));(e?Array.from(this._state.parent.getElementsByClassName(t)):[this._splitterElement]).forEach((e=>e.classList.add(ut.hovered)))}_mouseDownOrTouchStartEvent(e){const t=new r.Point(e.localX+this._splitterElement.offsetLeft,e.localY+this._splitterElement.offsetTop),i=(0,le.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,le.deepCopy)(i)),shiftState:e.shiftKey,delta:0}),this._splitterElement.classList.add(ut["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(ut["i-active"]),this._state.currentLayoutResizeAction.setValue(null),t.currentState)){this._state.undoHistory.beginUndoMacro(gt),this._state.undoHistory.pushUndoCommand(new g(this._state.sizingState,t.initialState,t.currentState,gt));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(),ft)),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=qt(this._state);r.currentState=this._state.layoutTemplate.value().resizeApplier(a,o,e,r.splitter,(0,le.deepCopy)(n),t),this._state.sizingState.setValue(r.currentState)}}function Xt(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=qt(e),h=r.sizer(c,i,s,a+l,pt?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 Jt(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)=>Xt(e,t,i,r.length))),pt&&!e.maximizedChartDef.value()){const r=qt(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<c.length?c[i].splitterElement:document.createElement("div");let r,n;i<c.length?(r=c[i].mouseListener,n=c[i].mouseHandler):(r=new Zt(e,s,t),n=new ce.MouseEventHandler(s,r));const o=t.metrics,a=s.classList.contains(ut.hovered),l=s.classList.contains(ut["i-active"]);return s.className="",s.classList.add(ut.chartsSplitter),s.classList.add($t(t.className)),a&&s.classList.add(ut.hovered),l&&s.classList.add(ut["i-active"]),s.style.left=o.left+"px",s.style.top=o.top+"px",s.style.width=o.width+"px",s.style.height=o.height+"px",s.setAttribute("aria-hidden","true"),"v"===t.orientation?s.style.cursor="ns-resize":s.style.cursor="ew-resize",e.parent.insertBefore(s,e.bottomToolbar.value()),{splitter:t,splitterElement:s,mouseHandler:n,mouseListener:r}}));e.splitters.setValue(h)}}function Qt(e,t,i){const s=e.chartWidgetsDefs.slice(0,e.layoutTemplate.value().count).map(((t,i,s)=>({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 ei(e,t){return e.chartWidgetsDefs.some((e=>{var i;return(null===(i=e.chartWidget)||void 0===i?void 0:i.id())===t}))}function ti(e){let t=1;for(;e(""+t);)t++;return""+t}function ii(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 it(e);s.push(t);const i=new qe(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.insertBefore(d,e.bottomToolbar.value()),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 ne.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;n<r.count;n++)t.chartWidgetsDefs[n]===e&&(s=i),i++;Xt(t,e,s,i,r)}(p,e),h={...h,...p.rdState.bridge()};const m=h.content?(0,s.ensureDefined)(h.content.chartId):ti((t=>ei(e,t))),g=p.chartWidget=new oe.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=Ri(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 si(e,t,i,s){let r,n=e.savedChartWidgetOptions.shift();if(void 0!==n){const t=e.activeChartWidget.value();t&&t.lineToolsSynchronizer()&&(r=t.lineToolsAndGroupsDTO())}else n=function(e){const t=e.activeChartWidget.value();if(t){const i=t.state();return i.chartId=ti((t=>ei(e,t))),i.shouldBeSavedEvenIfHidden=!1,i.panes.forEach((e=>{e.sources.forEach((e=>{"alertId"in e&&(e.alertId=void 0)}))})),{content:i}}}(e);const o={...e.widgetOptions,...n,...0===i||e.symbolLock.value()?void 0:{defSymbol:null}},a=ii(e,t,o),{chartWidget:l}=a;return l.modelCreated().subscribe(null,(()=>{s?s():e.checkAllPendingModelsAlreadyCreated(),e.dateRangeLock.value()&&l===e.activeChartWidget.value()&&e.subscribeToCompletedEventForDateRangeSync(l,!0);const t=l.lineToolsSynchronizer();void 0!==r&&t&&[...r.entries()].map((([e,i])=>{0!==e&&t.applyDTO(i,e).then((()=>{t.invalidateAll()}))}));const i=e.chartWidgetsDefs.filter((e=>e.chartWidget.hasModel())).map((e=>e.chartWidget.model()));e.chartModels.setValue(i)}),!0),a}function ri(e){e.hiddenInLayout.setValue(!0);const t=e.container.value()
;t.parentNode&&t.parentNode.removeChild(t),e.fullscreen.setValue(!1)}function ni(e,t,i){const r=(0,s.ensureNotNull)(e.chartWidget);r.onZoom().unsubscribeAll(i),r.onScroll().unsubscribeAll(i),r.withModel(null,(()=>{const e=r.lineToolsSynchronizer();null!==e&&(e.hasChanges().unsubscribe(t.recalcHasChanges),t.recalcHasChanges())}))}function oi(e,t){e.chartWidgetsDefs.forEach((i=>{ni(i,e,t)}))}function ai(e,t){const i=e.actualLayoutCount();for(let s=i;s<e.chartWidgetsDefs.length;s++)ni(e.chartWidgetsDefs[s],e,t);e.chartWidgetsDefs.splice(i,e.chartWidgetsDefs.length-i)}function li(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 ci(e){var t,i;const r=this.innerState();(e=r.checkProFeature(e))in se.layouts||(e="s"),oi(r,this);const n=r.layoutType,o=se.layouts[e].count;(0,re.emit)("layout_about_to_be_changed",e),(null!==(t=r.splitters.value())&&void 0!==t?t:[]).forEach(((e,t)=>{e.splitterElement.remove(),e.mouseHandler.destroy()})),r.splitters.setValue([]);const a=se.layouts[e];r.layoutTemplate.setValue(a);const l=null!==(i=r.allLayoutSizesState.get(a.layoutType))&&void 0!==i?i:(0,ae.layoutInitialSizingState)(a.expression);r.allLayoutSizesState.set(a.layoutType,l),r.sizingState.setValue(l);const c=r.maximizedChartDef.value();n!==e&&r.maximizedChartDef.value()&&r.maximizedChartDef.setValue(null),c&&r.activeChartWidget.setValue((0,s.ensureNotNull)(c.chartWidget));for(let e=0;e<o||e<r.chartWidgetsDefs.length;e++){let t,i=r.chartWidgetsDefs[e];const n=e>=o;if(t=r.maximizedChartDef.value()?r.maximizedChartDef.value()===i:e<o,t){if(i){if(r.parent.insertBefore(i.container.value(),r.bottomToolbar.value()),i.hiddenInLayout.setValue(!1),r.loadingContent){const e=r.savedChartWidgetOptions.shift();e&&(r.setLoadingContent(!0),(0,s.ensureNotNull)(i.chartWidget).loadContent(e.content,r.initialLoading),r.setLoadingContent(!1))}}else si(r,this,e,void 0),i=r.chartWidgetsDefs[e];i.container.value().classList.toggle("multiple",o>1),i.fullscreen.setValue(r.maximizedChartDef.value()===i),i.collapsed.setValue(n)}else i&&(ri(i),i.collapsed.setValue(n))}r.sizingState.setValue(l),Jt(r),r.layoutWV.setValue(e),r.setLayoutType(e),r.updateWatchedValue(),function(e){const t=e.layoutTemplate.value().count;e.inlineChartsCount.setValue(t),e.globalDetachable.setValue(t>1)}(r),r.checkAllPendingModelsAlreadyCreated(),li(r,this),r.inlineChartsCount.value()<1&&o>0&&r.chartWidgetsDefs[o-1].rdState.bridge().attach()}function hi(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 di(e,t,i,s,r){if(hi(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 ui(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&&hi(s,i.payload.point,null,!1,i.payload.envState)},{channel:t,uniqueId:(0,ie.randomHashN)(6)}}function pi(e){var t;null===(t=e.crossHairSyncBroadcast)||void 0===t||t.channel.close()}function _i(e,t,i){if(!e.combinedTrackTimeLock.value()||e.dateRangeLock.value())return;const s=e.layoutTemplate.value().count;e.undoHistory.beginUndoMacro(mt),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,re.emit)("sync_time",t)}function mi(e){return Promise.all(e.map((e=>{const t=e.model().mainSeries();return t.symbolResolvingActive().value()?d(t.dataEvents().symbolResolved()).promise:t.symbolInfo()})))}function gi(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((()=>gi(e)))}function fi(e,t){var i;if((0,h.enabled)("charting_library_base"))return t;if("s"===t||e.widgetOptions.containsData||e.readOnly||isProductFeatureEnabled("MULTIPLE_CHARTS")&&(0,s.ensure)(null===(i=getProductFeatureConfig("MULTIPLE_CHARTS"))||void 0===i?void 0:i.limit)>=se.layouts[t].count)return t;return"s"}async function vi(e,t,i){return i=fi(e,i),e.layoutWV.value()!==i&&(e.undoHistory.pushUndoCommand(new ue(t,i)),!0)}async function yi(e,t,i){const{theme:s,onlyActiveChart:r,restoreNonThemeDefaults:n,themeName:o,standardTheme:a,syncState:l=!0,noUndo:c}=i,h=(0,V.getCurrentTheme)().name;let d;r?d=[e.activeChartWidget.value()]:(oi(e,t),await Promise.all(e.savedChartWidgetOptions.map(((i,s)=>new Promise((i=>{ri(si(e,t,s,i))}))))),d=e.chartWidgetsDefs.map((e=>e.chartWidget)),li(e,t)),c?(a&&new nt(h,o,l).redo(),d.forEach((e=>{e.model().model().restoreTheme(s,n,c)}))):(e.undoHistory.beginUndoMacro(vt),a&&e.undoHistory.pushUndoCommand(new nt(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 Si(e,t){e.symbolLock.setValue(t)}function bi(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(yt),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,yt),r.endUndoMacro()}}function wi(e,t){e.intervalLock.setValue(t)}function Ci(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(St),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,St),r.endUndoMacro()}}function Pi(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 xi(e,t){const{internalDateRangeLock:i,undoHistory:s,loadingContent:r}=e;r?i.setValue(t):s.setWatchedValue(i,t,bt)}function Ti(e,t){e.trackTimeLock.setValue(t)}function Ii(e,t){const{internalTrackTimeLock:i,undoHistory:s,loadingContent:r}=e;r?i.setValue(t):s.setWatchedValue(i,t,wt)}function Mi(e,t,i){e.symbolLock.value()?Ai(e,t,i):e.activeChartWidget.value().setSymbol(t)}function Ai(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 Li(e,t=this.activeChartWidget.value()){return!!t&&(function(e,t){const i=e.model(),s=i.mainSeries().properties().childs().style;i.setChartStyleProperty(s,t,Ct)}(t,e),!0)}function ki(e){return(e.intervalLock.value()?e.chartWidgetsDefs.map((e=>e.chartWidget)):[e.activeChartWidget.value()]).filter((e=>e.hasModel()))}async function Di(e,t,i,s){return!(e.flags.loadingChart||e.flags.setTimeFrameActive||e.flags.setNewResolution)&&(function(e,t,i,s){(0,ct.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 Ei(e){return new u.WatchedValue(null).spawn()}function Vi(e){return[null]}function Bi(e){const t=new lt.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 Ri(e,t){t=null;let i=e.linkingGroupsCharts.get(t);return void 0===i&&(i=new lt.WatchedObject([],O.compareTwoCollectionsByIds),e.linkingGroupsCharts.set(t,i)),i}function Ni(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,O.join)(new Set(e.linkingGroupsCharts.keys()),new Set(i.keys())))Ri(e,s).setValue(null!==(t=i.get(s))&&void 0!==t?t:[])}function Oi(e){0}function Fi(e,t){return new u.WatchedValue(!1).spawn()}function Wi(e,t,i){return(0,ot.combine)(((e,t)=>e||t),t.weakReference(),Fi().ownership())}function Hi(e,t,i){const s=t.id();if(e.chartWidgetIdToCompletedCallbackMap.has(s))return;const r=()=>{e.chartWidgetIdToCompletedCallbackMap.has(s)&&(e.chartWidgetIdToCompletedCallbackMap.delete(s),Ki(e,i?t:void 0))};t.model().mainSeries().dataEvents().completed().subscribe(null,r,!0),e.chartWidgetIdToCompletedCallbackMap.set(s,{cw:t,callback:r})}function zi(e){Ki(e)}const Ui=new Map;function ji(e){var t;const i=null!==(t=Ui.get(e.id()))&&void 0!==t?t:{};return Ui.set(e.id(),i),i}function Gi(e,t){t.timeScale().visibleBarsStrictRangeChanged().subscribe(ji(t),zi.bind(null,e))}function qi(e,t){t.timeScale().visibleBarsStrictRangeChanged().unsubscribeAll(ji(t)),e.chartWidgetIdToCompletedCallbackMap.forEach((e=>{const t=e.cw,i=e.callback;t.model().mainSeries().dataEvents().completed().unsubscribe(null,i)})),e.chartWidgetIdToCompletedCallbackMap.clear()}function $i(e,t,i){e.model().model().gotoTimeRange(t,i),(0,re.emit)("sync_date_range",t,i)}function Ki(e,t){if(!e.dateRangeLock.value()||null!==e.currentLayoutResizeAction.value())return;const i=e.activeChartWidget.value(),r=i.model().mainSeries();if(!(0,D.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 Hi(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,k.set_hms)(e,0,0,0,0),(0,k.set_hms)(t,0,0,0,0),h=e.getTime(),d=t.getTime()}for(let s=0;s<e.chartWidgetsDefs.length;s++){const r=e.chartWidgetsDefs[s].chartWidget;r.hasModel()&&r!==i&&(void 0===t||r===t)&&(0,D.isTimeBasedStyle)(r.model().mainSeries().style())&&setTimeout($i.bind(null,r,h,d))}}function Yi(e){const{addOnlyActiveChart:t,...i}=e,s=this.innerState();let r=t?this.getAll().indexOf(this.activeChartWidget.value()):0;const n=t?r+1:s.chartsCountToSave(),o=[];for(;r<n;r++){const e=Mt.call(this,r,i);if(e){let t=e;0,o.push(t)}}const a=t?void 0:Array.from(s.allLayoutSizesState.entries()).reduce(((e,[t,i])=>(e[t]=i,e)),{});return{name:this.metaInfo.name.value(),layout:t?"s":s.layoutType,charts:o,symbolLock:Zi(s.symbolLock),intervalLock:Zi(s.intervalLock),trackTimeLock:Zi(s.trackTimeLock),
dateRangeLock:Zi(s.dateRangeLock),crosshairLock:Zi(s.crosshairLock),layoutsSizes:a,studyMetaInfoMap:undefined}}function Zi(e){return e.value()?1:0}function Xi(e){dt.StudyMetaInfo.mergeDefaultsOverrides(e),(0,ht.studyMetaInfoRepository)().isReady()&&dt.StudyMetaInfo.overrideDefaults((0,ht.studyMetaInfoRepository)().getInternalMetaInfoArray())}},15938:(e,t,i)=>{"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"},79754:(e,t,i)=>{"use strict";var s=i(78954).splitSymbolName,r=i(45126).TranslatedString,n=i(50151).assert,o=i(56570),a=i(26023).TabNames,l=i(68335),c=i(67317).Study,h=i(21239).StudyStub,d=i(72708).isStudy,u=i(29875).LineDataSource,p=i(630),_=p.isLineTool,m=p.isStudyLineTool,g=i(94113).STUDYPLOTDISPLAYTARGET,f=i(16638).studyMetaInfoRepository,v=i(97702).Action,y=i(33388).ACTION_ID,S=i(85049).Interval,b=i(68805),w=b.getDefaultStyle,C=b.hasVolume,P=i(63950),x=P.availableTimezones,T=P.timezoneIsAvailable,I=i(85719).lineToolsDoNotAffectChartInvalidation,M=i(51768).trackEvent,A=i(35039),L=i(52033).Delegate,k=i(31955).getLogger("ChartWidget",{color:"#606"}),D=i(19334).addPerfMark,E=i(4849).ChartWidgetBase,V=i(49483).CheckMobile.any(),B=i(82783).TIMEFRAMETYPE,R=new r("change timezone",i.i18next(null,void 0,i(20137))),N=new r("unlock {title}",i.i18next(null,void 0,i(12525))),O=new r("lock {title}",i.i18next(null,void 0,i(76104)));e.exports.ChartWidget=class extends E{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;var o=this._options.containsData,a=this._options.onWidget,l=this._options.onCmeWidget;l&&k.logWarn("[ChartWidget] 'onCmeWidget' option is depricated");var c=this._options.widgetCustomer,h=this._options.timezone,d=this._options.hideSymbolSearch,u=this._options.defSymbol,p=S.isValid(this._options.defInterval)?this._options.defInterval:void 0,_=parseInt(this._options.defStyle),m=b.isValidStyle(_)?_:void 0,g=this._options.defSessionId,f=void 0!==this._options.defTimeframe?"string"==typeof this._options.defTimeframe?{value:this._options.defTimeframe.toUpperCase(),type:B.PeriodBack}:{...this._options.defTimeframe,type:B.TimeRange}:void 0;this._content=r,this._initialLoading=this._options.initialLoading,this._readOnly=n,this._containsData=o,this._defSymbol=u,this._defInterval=p,this._defTimeframe=f,this._defStyle=m,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 v=this._contentSeriesProperties();v&&(u=v.symbol,p=v.interval),
void 0===this._options.useUserChartPreferences&&(this._options.useUserChartPreferences=!0);var y="chartproperties.mainSeriesProperties",C=this._options.useUserChartPreferences?A.defaults(y):A.factoryDefaults(y);this._properties.mainSeriesProperties.merge(C),this._properties.mainSeriesProperties.hasChild("esdBreaksStyle")&&this._properties.mainSeriesProperties.removeProperty("esdBreaksStyle"),p=p||C.interval||"D",b.isValidStyle(m)||(m=b.isValidStyle(C.style)?C.style:w(S.isRange(p))),this._properties.mainSeriesProperties.merge({visible:!0,symbol:u||DEFAULT_SYMBOL,shortName:"",timeframe:"",onWidget:this._onWidget,interval:p,currencyId:null,unitId:null,style:m,sessionId:g}),this._symbolWV.setValue(this.getSymbol()),this._resolutionWV.setValue(this.getResolution()),this._containsData&&this._properties.mainSeriesProperties.merge({showCountdown:!1}),h&&T(h)&&this._properties.timezone.setValue(h),this._tagsChanged=new L,this._timingsMeter=null,this._options.container.subscribe((function(e){s._setElement(e)}),{callWithLast:!0});var P=function(){s.resize()};this._options.width.subscribe(P),this._options.height.subscribe(P),this._options.visible.subscribe(this._updateTimingsMeterState.bind(this)),this._aboutToBeDestroyed=new L,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(1184),i.e(8278),i.e(4482),i.e(3596)]).then(i.bind(i,61857));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||l.modifiersFromEvent(e)===l.Modifiers.Alt&&e.stopPropagation()}function s(e){e.defaultPrevented||l.modifiersFromEvent(e)===l.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())}setTimezone(e){e&&T(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<this._paneWidgets.length;t++)if(this._paneWidgets[t].hasCanvas(e))return this._paneWidgets[t];return null}paneByState(e){for(var t=0;t<this._paneWidgets.length;t++)if(this._paneWidgets[t].state()===e)return this._paneWidgets[t];return null}timeAxisByCanvas(e){return this._timeAxisWidget.hasCanvas(e)?this._timeAxisWidget:null}properties(){return this._properties}readOnly(){return this._readOnly}modelCreated(){return this._modelCreated}updateActions(){for(var e=this.actions(),t=this._model.dataSources(),r=!1,n=!1,o=0,a=t.length;o<a;o++){var l=t[o];TradingView.isInherited(l.constructor,u)&&l.isUserDeletable()&&(r=!0),TradingView.isInherited(l.constructor,c)&&l.removeByRemoveAllStudies()&&(n=!0),TradingView.isInherited(l.constructor,h)&&(n=!0)}this._readOnly||(e.paneRemoveAllStudies&&e.paneRemoveAllStudies.update({disabled:!n}),e.paneRemoveAllDrawingTools&&e.paneRemoveAllDrawingTools.update({disabled:!r}),e.paneRemoveAllStudiesDrawingTools&&e.paneRemoveAllStudiesDrawingTools.update({disabled:!n&&!r}));var d=this,p=[],_=function(e){return e.id===d.model().model().properties().timezone.value()};if(x.forEach((function(e){if(!e.separator){var t=new v({actionId:y.ChartChangeTimeZone,options:{label:e.title,checkable:!0,checked:_(e),statName:"SetTimeZone",onExecute:function(){d.model().setProperty(d.model().model().properties().timezone,e.id,R)}}});p.push(t)}}),this),e.applyTimeZone.update({subItems:p}),e.addToWatchlist||e.addToTextNotes){const[,t]=s(d.symbolWV().value());e.addToWatchlist&&(e.addToWatchlist.request(),e.addToWatchlist.updateLabel(t)),e.addToTextNotes&&e.addToTextNotes.update({label:i.i18next(null,void 0,i(39873)).format({symbol:t})})}}defaultSymbol(){return this._defSymbol}widget(){return this._mainDiv}_onBackgroundColorChanged(){for(var e=0;e<this._paneWidgets.length;e++)this._paneWidgets[e].setCursorForTool();this.update(),this.model().model().fullUpdate()}setTimingsMeter(e){this._timingsMeter=e,this._updateTimingsMeterState()}ownerDocument(){return this._parent.ownerDocument}_updateTimingsMeterState(){var e=this._options.visible.value();null!==this._timingsMeter&&(e?this._timingsMeter.startCollect():this._timingsMeter.stopCollect())}_createVolumeIfNeeded(){var e=o.enabled("create_volume_indicator_by_default")&&this._options.addVolume,t=!this._content,i=o.enabled("charting_library_base"),s=o.enabled("create_volume_indicator_by_default_once"),r=this._content&&!this._content.loading;e&&(t||i&&r&&!s)&&this._model.mainSeries().dataEvents().symbolResolved().subscribe(this,(function(){var e=this;setTimeout((async function(){var t=e._model.model().mainSeries().symbolInfo();if(t){var i=C(t);if(!e.containsVolume()&&i){var s=A.factoryDefaults("chartproperties.volumePaneSize"),r=e._model.model();await f().requestMetaInfo()
;var n=r.createStudyInserter({type:"java",studyId:"Volume@tv-basicstudies"});n.setForceOverlay(o.enabled("volume_force_overlay")),n.setPaneSize(s),o.enabled("hide_volume_ma")&&n.setPropertiesState({styles:{vol_ma:{display:g.None}}}),n.insert()}else if(!i&&e.containsVolume()){var a=e.model().dataSources().filter((function(e){return e instanceof c&&"Volume"===e.metaInfo().shortId}))[0];e._model.model().removeSource(a)}}}),0)}),s)}_createSessions(e){var t=this.showGeneralChartProperties.bind(this,a.timezoneSessions);e.createSessions(t)}_createPrePostMarket(e){}_onChartStyleChanged(){M("Chart","Chart Style "+this._model.mainSeries().getStyleShortName().toUpperCase())}getTimeScale(){return this._timeAxisWidget}chartWidgetCollection(){return this._chartWidgetCollection}generalPropertiesDefinitions(){return this._getChartPropertyDefinitionsViewModel().then((function(e){return e.propertyPages()}))}propertiesDefinitionsForSource(e){return _(e)||d(e)||m(e)?e.getPropertyDefinitionsViewModel().then((function(e){return null===e?null:e.propertyPages()})).catch((function(e){return k.logWarn(e),null})):Promise.resolve(null)}toggleCompareOrAdd(){this._compareDialog.visible().value()?this._compareDialog.hide():this._compareDialog.show()}showFundamentals(e){this.showIndicators(e,"financials")}removeSelectedSources(){this.removeDataSources(this._model.selection().dataSources())}removeDataSources(e){var t=e.filter(function(e){return e!==this._model.mainSeries()&&e!==this._model.lineBeingCreated()&&e.isUserDeletable()}.bind(this));if(0!==t.length){var i=null;d(t[0])&&(n(1===t.length,"Cannot remove several studies (no multi select for studies)"),i=t[0]);t.find((function(e){return e.hasAlert().value()}));i&&i.hasChildren()?showDeleteStudyTreeConfirm(this._model.removeSelectedSources.bind(this._model)):this._model.removeSelectedSources()}}toggleLockSelectedObject(){var e=this._model;e.selection().lineDataSources().forEach((function(t){var i=t.properties().frozen.value();e.setProperty(t.properties().frozen,!i,(i?N:O).format({title:new r(t.name(),t.title())}),I)}))}showSourceProperties(e,t=null){e===this._model.mainSeries()&&(t=a.symbol),this.showChartPropertiesForSource(e,t)}tags(){return this._model?this._model.calculateDefaultTags():[]}state(e,t,i,s){if(this._model){const r=this._model.state(e,t,i,s);return r.chartId=this.id(),r}return this._content?this._content:{}}metaInfo(){var e=this._metaInfo;return this._model&&(e.systemTags=this._model.calculateDefaultTags()),e}onTagsChanged(){return this._tagsChanged}onModelTagsChanged(){this._tagsChanged.fire()}onAboutToBeDestroyed(){return this._aboutToBeDestroyed}destroy(){this._aboutToBeDestroyed.fire(),null!==this._removeMaximizeHotkey&&(this._removeMaximizeHotkey(),this._removeMaximizeHotkey=null),0!==this._drawRafId&&this._parent.ownerDocument.defaultView.cancelAnimationFrame(this._drawRafId),null!==this._backgroundTopColorSpawn&&this._backgroundTopColorSpawn.destroy(),null!==this._backgroundBottomColorSpawn&&this._backgroundBottomColorSpawn.destroy(),
null!==this._timingsMeter&&(this._timingsMeter.stopCollect(),this._timingsMeter=null);for(var e=0;e<this._paneWidgets.length;e++)this._paneWidgets[e].destroy();this._paneWidgets.length=0;for(e=0;e<this._paneSeparators.length;e++)this._paneSeparators[e].destroy();this._paneSeparators.length=0,this._hotkeysListener&&this._hotkeysListener.destroy(),this._barsButton&&this._barsButton.destroy(),this._controlBarNavigation&&(this._controlBarNavigation.destroy(),this._controlBarNavigation=void 0),this._mainDiv&&this._mainDiv.remove(),null!==this._timeAxisWidget&&(this._timeAxisWidget.destroy(),this._timeAxisWidget=null),null!==this._definitionsViewModel&&this._definitionsViewModel.destroy(),this._mainDiv.removeEventListener("wheel",this._onWheelBound),super.destroy()}title(){return i.i18next(null,void 0,i(39950))}symbolProperty(){return this._model.mainSeries().properties().shortName?this._model.mainSeries().properties().shortName:this._model.mainSeries().properties().symbol}loadContent(e,t){this.screen.show();var i=this;this.isMaximizedPane()&&this.toggleMaximizePane(null);var s,r=i._model.model().dataSources(),n=i._model.mainSeries(),o=i._model.crossHairSource();o.clearMeasure();for(var a=0;a<r.length;a++){var l=r[a];l!==n&&l!==o&&i._model.model().removeSource(l,!0)}let c;this._model.disconnect(),i.activePaneWidget=null,n.purgeSymbolInfo(),e.loading=!0,this._content=e,this._setSymbolIntervalContentOverrides={},this._initialLoading=Boolean(t);for(a=0;a<e.panes.length;++a)for(var h=0;h<e.panes[a].sources.length;++h)if(e.panes[a].sources[h].state.symbol){s=e.panes[a].sources[h].state,c=e.chartProperties.priceScaleSelectionStrategyName;break}if(!s)throw Error("An error occured while determining main series ion the chart");i._properties.mainSeriesProperties.mergeAndFire({visible:!0,symbol:s.symbol,timeframe:"",onWidget:i._onWidget,interval:s.interval||"D",style:s.style}),void 0!==c&&i._properties.priceScaleSelectionStrategyName.setValue(c),i._init(),i._model.undoHistory().clearStack()}_contentSeriesProperties(){if(this._content)for(var e=this._content.panes.length;e-- >0;)for(var t=this._content.panes[e].sources,i=t.length;i-- >0;)if("MainSeries"===t[i].type)return t[i].state}containsVolume(){return this.model().dataSources().some((function(e){return e instanceof c&&"Volume"===e.metaInfo().shortId}))}containsStudyByPredicate(e){return!!this._model&&this._model.dataSources().some((function(t){if(!(t instanceof c))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()}showReplayOrderConfirmationDialog(){
if(!this.model().isInReplay().value())return Promise.resolve()}_addPerfMark(e){D("ChartWidget."+this._id+"."+e)}getResizerDetacher(){return this._options}}},68122:(e,t,i)=>{"use strict";const{clone:s}=i(37265);var r=i(50151).assert,n=i(68993).layouts,o=i(55902).createUndoHistory,a=i(928),l=i(4741),c=i(68335),h=i(76422),d=i(56570),u=i(91676).WatchedObject,p=i(64147).WatchedValue,_=i(31955).getLogger("Chart.ChartWidgetCollection"),m=i(14729).preventDefaultForContextMenu,g=i(5171),f=i(13323).GeneralChartPropertiesRenderer,v=i(42120).CompareDialogRenderer,y=i(84015).isOnMobileAppPage,S=i(52033).Delegate;const{isSupportedLayout:b,tryGuessingTheMostSuitableLayout:w}=i(68993);var C,P=i(35474).AriaChartDescription;const x=i(92184).randomHash;var T=i(29250),I=T.applyIndicatorsToAllChartsImpl,M=T.applyIndicatorToAllChartsImpl,A=T.lineToolsAndGroupsDTOsImpl,L=T.resetLineToolsInvalidatedImpl,k=T.applyLineToolUpdateNotificationImpl,D=T.createClipboardHandler,E=T.chartsSymbolsImpl,V=T.updateLayoutImpl,B=T.computeContentBoxImpl,R=(T.getVisuallyAdjacentDefImpl,T.setLayoutImpl),N=T.removeChartWidgetSubscriptionsImpl,O=T.generateNewChartId,F=T.syncCrosshairImpl,W=T.createBroadcastChannel,H=T.destroyBroadcastChannel,z=T.syncScrollImpl,U=T.allInitialModelsCreated,j=T.allInitialSymbolsResolved,G=T.applyThemeImpl,q=T.handleDateRangeLockChange,$=T.handleInternalDateRangeLockChange,K=T.handleTrackTimeLockChange,Y=T.handleInternalTrackTimeLockChange,Z=T.handleIntervalLockChange,X=T.handleInternalIntervalLockChange,J=T.handleSymbolLockChange,Q=T.handleInternalSymbolLockChange,ee=(T.handleConnectionLimitReachedChanged,T.createLeftBottomChartWidgetWV),te=T.subscribeToEventsForDateRangeSync,ie=T.unsubscribeFromEventsForDateRangeSync,se=T.syncChartsDateRangesWithActiveChartRange,re=T.subscribeToCompletedEventForDateRangeUpdate,ne=T.resetLayoutSizesImpl,oe=T.unloadUnusedChartsImpl,ae=T.applyStudiesOverrides,le=new Map,ce={saveChartEnabled:!0,takeScreenshotEnabled:!0,publishedChartsEnabled:!0};e.exports=function(e){var t=this,he=Object.assign({},ce,e),de=new p,ue=he.readOnly||!1,pe=x(),_e=[],me=0,ge=new p,fe=new p,ve=new p,ye="s",Se=new p(null),be=new Map,we=new p([]),Ce=new p,Pe=[];const xe={isConfirmationAboutReplayLocked:!1,loadingChart:!1,setTimeFrameActive:!1,setNewResolution:!1};var Te=!1,Ie=!1,Me=new p(!1),Ae=new p(null),Le=new p(!1),ke=new p(!1);ke.subscribe((e=>J(yt(),e)));var De=new p(ke.value());De.subscribe((e=>Q(yt(),e)));var Ee=new p(!1);Ee.subscribe((e=>Z(yt(),e)));var Ve=new p(Ee.value());Ve.subscribe((e=>X(yt(),e)));var Be=new p(ye),Re=new p(!1);Re.subscribe((e=>K(yt(),e)));var Ne=T.combinedTrackTimeLock(Be,Re,_e);Re.subscribe((e=>K(yt(),e)));var Oe=new p(Ne.value());Oe.subscribe((e=>Y(yt(),e)));var Fe=new p(!1);Fe.subscribe((e=>q(yt(),e))),Se.subscribe(zt);var We=new p(Fe.value());We.subscribe((e=>$(yt(),e)));var He=new p(TVSettings.getBool("chart.syncCrosshair",!0)),ze=l.createGroup({desc:"Layout"}),Ue=null,je=null,Ge=null,qe=null;if(window.TVD){var $e=window.TVD.crosshairSyncEnabled;$e?($e.value()&&(Ge=W(yt)),
qe=$e.subscribe((e=>{e?Ge=W(yt):(H(yt()),Ge=null)}))):Ge=W(yt)}var Ke=He.value();He.subscribe((function(e){Ke=e=!!e,TVSettings.setValue("chart.syncCrosshair",e);for(var t=0;t<_e.length;++t){var i=_e[t].chartWidget;i.hasModel()&&i.model().model().lightUpdate()}}));var Ye=he.resizerBridge.width,Ze=he.resizerBridge.height,Xe=new p(null),Je=new p(null);Xe.subscribe((e=>{Je.setValue(null===e?null:e.chartWidget)}));var Qe=he.widgetOptions||{},et=he.metaInfo||{},tt={id:new p(et.id||null),name:new p(et.name),description:new p(et.description),username:new p(et.username),uid:new p(et.uid),lastModified:new p(et.lastModified)},it=o();it.onChange().subscribe(null,(function(e){h.emit("undo_redo_state_changed",e)}));var st=he.resizerBridge.container.value();st.addEventListener("contextmenu",m);var rt,nt=new S,ot=new S,at=new S,lt=new p(!1),ct=new p(null),ht=null,dt=null;he.seriesControlBarEnabled&&(rt="0px",ct.setValue(document.createElement("div")),ct.value().style.left=rt,ct.value().style.right=rt,ct.value().style.bottom=rt,ct.value().classList.add("chart-toolbar","chart-controls-bar"),ct.value().setAttribute("data-is-chart-toolbar-component","true"),st.appendChild(ct.value()),Promise.all([i.e(6822),i.e(3060),i.e(2603),i.e(5514),i.e(7811),i.e(7399),i.e(2248),i.e(7769),i.e(7125),i.e(5546),i.e(8073),i.e(6107),i.e(3762),i.e(8732),i.e(1227),i.e(302),i.e(2227),i.e(361),i.e(5075),i.e(7260)]).then(i.bind(i,68426)).then((({BottomToolbarRenderer:e})=>{var i=he.resizerBridge,s=[i.container.spawn(),i.width.spawn(),i.height.spawn()],r=i.container.value(),n=function(){var e=r.getBoundingClientRect(),t=B(yt());return t.top=e.top+t.top,t.left=e.left+t.left,t},o=new S,a=function(){o.fire()};s.forEach((function(e){e.subscribe(a)}));var l=function(){s.forEach((function(e){e.destroy()})),o.destroy()};ht=new e(ct.value(),o,n,t,ChartApiInstance,Qe,he.seriesControlBar),dt=function(){null!==ht&&(ht.destroy(),ht=null,ct.value().remove(),ct.setValue(null)),l()}})));var ut=new f(t),pt=new v(t);function _t(){lt.setValue(_e.some((e=>{const t=e.chartWidget.lineToolsSynchronizer();return null!==t&&t.hasChanges().value()})))}function mt(e){return T.checkProFeatureImpl(yt(),e)}Ae.subscribe((()=>wt()));const gt=new Map,ft=()=>T.updateLinkingGroupCharts(yt()),vt=new u([]);function yt(){return{undoHistory:it,chartWidgetsDefs:_e,chartsCountToSave:St,actualLayoutCount:bt,savedChartWidgetOptions:Pe,activeChartWidget:de,options:he,parent:st,toastsFactory:null,crosshairLockRaw:Ke,crossHairSyncBroadcast:Ge,setChartStorageNotificationSubscription:e=>{je=e},maximizedChartDef:Xe,setMaximized:It,layoutTemplate:ve,widthWV:Ye,heightWV:Ze,checkProFeature:mt,lineToolsSynchronizerHasChanges:lt,recalcHasChanges:_t,onZoom:ot,onScroll:at,layoutType:ye,layoutWV:Be,setLayoutType:e=>{ye=e},isPhoneSize:Me,viewMode:Ce,updateViewMode:At,loadingContent:Te,setLoadingContent:e=>{Te=e},initialLoading:Ie,inlineChartsCount:fe,updateWatchedValue:Lt,checkAllPendingModelsAlreadyCreated:Mt,readOnly:ue,symbolLock:ke,internalSymbolLock:De,intervalLock:Ee,internalIntervalLock:Ve,dateRangeLock:We,
internalDateRangeLock:We,trackTimeLock:Re,internalTrackTimeLock:Oe,crosshairLock:He,customLegendWidgetsFactoriesMap:Xt,globalDetachable:ge,saveChartService:Ue,customSources:Yt,updateActivityView:kt,chartWidgetCreatedDelegate:nt,sizingState:Ae,currentLayoutResizeAction:Se,allLayoutSizesState:be,splitters:we,widgetOptions:Qe,bottomToolbar:ct,replayContainer:Zt,layoutSizesChanged:Le,subscribeToCompletedEventForDateRangeSync:(e,t)=>re(yt(),e,t),subscribeToEventsForDateRangeSync:e=>te(yt(),e),unsubscribeFromEventsForDateRangeSync:e=>ie(yt(),e),syncChartsDateRangesWithActiveChartRange:e=>se(yt(),e),combinedTrackTimeLock:Ne,chartWidgetIdToCompletedCallbackMap:le,flags:xe,linkingGroupsCharts:gt,chartModels:vt,updateLinkingGroupCharts:ft}}function St(){return bt()}function bt(){return n[ye].count}function wt(){V(yt())}Ye.subscribe(wt),Ze.subscribe(wt),this.updateLayout=wt;const Ct=T.activeLinkingGroupWV(de),Pt=T.allLinkingGroupsWV(yt());function xt(e){return e.rdState.owner.value()!==e}function Tt(e){return R.call(t,e)}function It(e){Xe.value()!==e&&(Xe.setValue(e),Tt(ye))}function Mt(){_e.every((e=>e.chartWidget.hasModel()))&&(Lt(),h.emit("layout_changed"))}function At(){"s"===ye||Xe.value()?Ce.setValue(C.ForceFullscreen):Ce.setValue(C.Multichart)}function Lt(){var e=Math.min(ve.value().count,_e.length)-1;if(e<0)de.deleteValue();else{var t=me;t<0&&(t=0),t>e&&(t=e),de.setValue(_e[t].chartWidget)}}function kt(){for(var e=_e.length;e--;){var t=e===me;_e[e].container.value().classList.toggle("active",t),_e[e].container.value().classList.toggle("inactive",!t)}}function Dt(e){{const t=ri().indexOf(e);P.getInstance().updateChartDescription(e,t,ye)}}function Et(e){Dt(de.value())}const Vt=new S;var Bt=new S,Rt=new p,Nt=new p([]),Ot=null;function Ft(e){var t=e.mainSeries().properties();t.style.subscribe(null,Wt),Wt(t.style),e.model().onSelectedSourceChanged().subscribe(null,Ht),Fe.value()&&(te(yt(),e),se(yt())),Ht(e.selection().allSources())}function Wt(e){Rt.setValue(e.value())}function Ht(){var e=Ot.model();Nt.setValue(e.selection().allSources())}function zt(e){Fe.value()&&null===e&&se(yt())}de.subscribe((function(e){if(e){for(var t,i=_e.length;i--;)if(_e[i].chartWidget===e){t=i;break}if(!isFinite(t))throw new Error("Cannot make detached ChartWidget active");if(me!==t){Xe.value()&&(xt(_e[t])||Xe.setValue(_e[t])),me=t,kt();for(i=_e.length;i--;)_e[i].chartWidget!==e&&_e[i].chartWidget.setActive(!1);ai(),e.setActive(!0),a.activePointSelectionMode.setValue(e.selectPointMode().value())}!function(e){if(Ot!==e){if(Ot&&(Ot.modelCreated().unsubscribe(null,Ft),Ot.hasModel())){var t=Ot.model();Fe.value()&&ie(yt(),t),t.mainSeries().properties().style.unsubscribe(null,Wt),t.model().onSelectedSourceChanged().unsubscribe(null,Ht),Ot=null}e&&(Ot=e,e.hasModel()?Ft(e.model()):e.modelCreated().subscribe(null,Ft))}}(e)}}),{callWithLast:!0});var Ut=new S;function jt(){he.resizerBridge.requestFullscreen()}function Gt(){he.resizerBridge.exitFullscreen()}function qt(){return he.resizerBridge.fullscreenable}function $t(){return he.resizerBridge.fullscreen}
function Kt(e){if(0!==_e.length){for(var t=_e.length;t--;)_e[t].chartWidget.setActive(!1);_e[me].chartWidget.setActive(e)}}ue||(ze.add({desc:"Switch active chart",hotkey:d.enabled("accessible_keyboard_shortcuts")?c.Modifiers.Shift+39:9,handler:function(){Et()}}),ze.add({desc:"Switch active chart",hotkey:d.enabled("accessible_keyboard_shortcuts")?c.Modifiers.Shift+37:c.Modifiers.Shift+9,handler:function(){Et()}})),ze.add({desc:"Fullscreen mode",hotkey:c.Modifiers.Shift+70,isDisabled:d.enabled("widget")||!qt().value(),handler:function(){$t().value()?Gt():jt()}}),he.takeScreenshotEnabled&&(ze.add({desc:"Screenshot server",hotkey:c.Modifiers.Alt+83,handler:T.takeServerScreenshot.bind(this,he.snapshotUrl,t)}),y("any")||(ze.add({desc:"Download client screenshot",hotkey:c.Modifiers.Mod+c.Modifiers.Alt+83,handler:T.downloadScreenshot.bind(this,t)}),ze.add({desc:"Copy client screenshot",hotkey:c.Modifiers.Mod+c.Modifiers.Shift+83,handler:T.copyScreenshotToClipboard.bind(this,t)}))),he.saveChartEnabled&&ze.add({desc:"Save Chart Layout",hotkey:c.Modifiers.Mod+83,handler:function(){Bt.fire()}});var Yt=new Map,Zt=null,Xt=new Map;const Jt=D(yt());he.globalEvents&&Jt.listen();const Qt=ke.spawn(),ei=Ee.spawn(),ti=Fe.spawn(),ii=Re.spawn(),si=He.spawn(),ri=()=>_e.map((e=>e.chartWidget)),ni=ee(ri,Be.readonly(),Vt,nt);function oi(e,t){if(Te=!0,Ie=Boolean(t),Pe.splice(0),e){if(e.charts||(e={layout:"s",charts:[e]}),e.layoutsSizes)for(const t of Object.keys(e.layoutsSizes))be.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=O((function(e){return i.has(e)}));i.add(t),e.chartId=t}}));let t=e.layout;if(!b(t)){const e=w(t);_.logError(`Loading unsupported layout ${t}. Force migration to ${e}`),t=e}ye=mt(t||"s");for(const t of e.charts)e.studyMetaInfoMap&&t.panes.forEach((t=>{t.sources.forEach((t=>{"string"==typeof t.metaInfo&&(t.metaInfo=s(e.studyMetaInfoMap[t.metaInfo]))}))})),Pe.push({content:t});void 0!==e.symbolLock&&ke.setValue(Boolean(e.symbolLock)),void 0!==e.intervalLock&&Ee.setValue(Boolean(e.intervalLock)),void 0!==e.trackTimeLock&&Re.setValue(Boolean(e.trackTimeLock)),void 0!==e.dateRangeLock&&Fe.setValue(Boolean(e.dateRangeLock)),void 0!==e.crosshairLock&&He.setValue(Boolean(e.crosshairLock))}Tt(ye),a.init(),a.tool.subscribe(li),a.tool.subscribe(ai),Te=!1,Ie=!1}function ai(){var e=de.value();_e.forEach((function(t){t.chartWidget!==e&&t.chartWidget.updateCrossHairPositionIfNeeded()})),e&&e.updateCrossHairPositionIfNeeded()}function li(){_e.forEach((function(e){e.chartWidget.onToolChanged()}))}Object.assign(this,{innerState:yt,getAll:ri,maximizedChartWidget:()=>Je.readonly(),leftBottomChartWidget:()=>ni,activeLinkingGroup:()=>Ct,allLinkingGroups:()=>Pt,linkingGroupsCharts:e=>T.getLinkingGroupCharts(yt(),e).readonly(),destroy:function(){if(Ut.fire(),Kt(!1),null!==dt&&(dt(),dt=null),N(yt()),Qt.destroy(),ei.destroy(),ii.destroy(),ti.destroy(),Ne.destroy(),si.destroy(),Se.unsubscribe(zt),_e.forEach((function(e){
void 0!==e.timingsMeter&&e.timingsMeter.destroy(),e.chartWidget.linkingGroupIndex().unsubscribe(ft),e.chartWidget.destroy()})),he.resizerBridge.remove(),we.value().forEach((e=>{e.mouseHandler.destroy(),e.mouseListener.destroy()})),window.removeEventListener("resize",wt),a.tool.unsubscribe(ai),a.tool.unsubscribe(li),st.remove(),Yt.clear(),Xt.clear(),ze.destroy(),je&&je.destroy(),Jt&&Jt.destroy(),Ct.destroy(),Pt.destroy(),window.TVD){const e=window.TVD.crosshairSyncEnabled;e&&e.unsubscribe(qe),H(yt())}ni.destroy(),!0},onAboutToBeDestroyed:Ut,layout:Be.readonly(),setLayout:Tt,activeChartWidget:de,viewMode:Ce,activeChartStyle:Rt.readonly(),setChartStyleToWidget:T.setChartStyleToWidget.bind(this),selectedSources:Nt.readonly(),metaInfo:tt,state:function(e,i,s,r,n){return T.stateImpl.call(t,{withData:e,skipLineToolsFromOtherSymbols:i,wipeSensitiveData:s,skipLineTools:r,addOnlyActiveChart:n})},lineToolsAndGroupsDTOs:function(){return A(yt())},resetLineToolsInvalidated:function(e,t){return L(yt(),e,t)},applyLineToolUpdateNotification:k.bind(null,_e),readOnly:function(){return ue},onZoom:function(){return ot},onScroll:function(){return at},resizerBridge:function(){return he.resizerBridge},lock:{symbol:Qt,interval:ei,dateRange:ti,crosshair:si,trackTime:ii},setSymbol:(e,t)=>T.setSymbol(yt(),e,t),setSymbolAll:(e,t)=>T.setSymbolAll(yt(),e,t),setResolution:(e,t,i)=>T.setResolution(yt(),e,t,i),setTimeFrame:function(e){xe.loadingChart||xe.setTimeFrameActive||(xe.setTimeFrameActive=!0,Ee.value()?_e.forEach((function(t){t.chartWidget.loadRange(e)})):de.value().loadRange(e),xe.setTimeFrameActive=!1)},updateLayout:wt,setChartLayoutWithUndo:function(e){return T.setChartLayoutWithUndoImpl(yt(),this,e)},images:T.getSnapshot.bind(this,this,he.widgetOptions.customerReadableName,Qe.onWidget),clientSnapshot:T.getClientSnapshot.bind(this,this,he.widgetOptions.customerReadableName,Qe.onWidget),tags:function(){for(var e=[],t=0;t<_e.length&&t<ve.value().count;t++)e=e.concat(_e[t].chartWidget.tags());return e=(e=Array.from(new Set(e))).map((function(e){return e.toLowerCase().replace(/\W+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}))},syncCrosshair:(e,t,i,s)=>F(yt(),e,t,i,s),syncScroll:function(e,t){return z(yt(),e,t)},clearChartMetaInfo:function(){tt.id.setValue(null),tt.uid.setValue(void 0),tt.name.setValue(void 0)},takeScreenshot:T.takeScreenshot.bind(this,he.snapshotUrl,this),takeServerScreenshot:T.takeServerScreenshot.bind(this,he.snapshotUrl,this),loadContent:oi,purgeUnusedWidgets:function(){for(var e=n[ye].count;e<_e.length;e++)_e[e].chartWidget.destroy();_e.splice(n[ye].count)},applyOverrides:function(e){for(var t=0;t<_e.length;t++)_e[t].chartWidget.applyOverrides(e)},applyStudiesOverrides:ae,switchChart:Et,startFullscreen:jt,exitFullscreen:Gt,fullscreen:$t,fullscreenable:qt,chartWidgetCreated:function(){return nt},saveKeysPressed:function(){return Bt},getContainer:function(){return st},onWidget:Qe.onWidget,applyTheme:function(e){return G(yt(),t,e)},applyIndicatorsToAllCharts:function(e){I(yt(),e)},
applyIndicatorsToAllChartsAvailable:function(){return!ue&&bt()>1},applyIndicatorToAllCharts:async function(e,t,i,s){await M(yt(),e,t,i,s)},setActive:Kt,inlineChartsCount:fe.readonly(),revertToInline:function(){It(null);for(var e=0;e<_e.length;e++)_e[e].rdState.bridge().attach()},chartMarketStatuses:function(){return _e.map((function(e){return"-"}))},chartSeriesStatuses:function(){return _e.map((function(e){var t=e.chartWidget.hasModel()?e.chartWidget.model().mainSeries().status():null;return(null===t?"":g.SERIES_STATUS_TEXT[t])+" ("+t+")"}))},undoHistory:it,lineToolsSynchronizerHasChanges:lt,applyPreferencesToAllCharts:function(e){},getToasts:function(){return Promise.resolve(null)},addCustomSource:function(e,t,i){r(!Yt.has(e),"Cannot create the same custom source multiple times"),Yt.set(e,{factory:t,layer:i});for(var s=0;s<_e.length;++s){var n=_e[s].chartWidget;n.hasModel()&&n.model().model().addCustomSource(e,t,i)}},removeCustomSource:function(e){r(Yt.has(e),"Cannot remove not created custom source"),Yt.delete(e);for(var t=0;t<_e.length;++t){var i=_e[t].chartWidget;i.hasModel()&&i.model().model().removeCustomSource(e)}},addCustomWidgetToLegend:function(e,t){r(!Xt.has(e),"Cannot create the same custom widget in legend multiple times"),Xt.set(e,t);for(var i=0;i<_e.length;++i)_e[i].chartWidget.addCustomWidgetToLegend(e,t)},addReplayWidget:function(e){r(null===Zt,"Cannot create replay container multiple times"),(Zt=document.createElement("div")).style.position="absolute",Zt.style["min-height"]="51px",Zt.style.overflow="hidden",Zt.style.left="0px",Zt.style.right="0px";var t=null===ct.value()?0:ct.value().offsetHeight;Zt.style.bottom=`${t}px`,Zt.setAttribute("data-is-chart-toolbar-component","true"),st.prepend(Zt),e(Zt,(()=>wt())),wt()},destroyReplayWidget:function(){r(null!==Zt,"Cannot remove replay container, container is not created"),Zt.remove(),Zt=null,wt()},setViewMode:function(e){Ce.setValue(e)},moveActiveChartWithUndo:function(e){},activeChartCanBeMoved:function(){return!1},generalPropertiesDefinitions:function(){return de.value().generalPropertiesDefinitions()},reconnectChartApi:function(e){undefined(e)},setBroker:function(e){0},setSaveChartService:function(e){Ue=e;for(var t=0;t<_e.length;++t){_e[t].chartWidget.setSaveChartService(e)}},getCompareDialogRenderer:function(){return pt},getChartPropertiesDialogRenderer:function(){return ut},clipboard:Jt,chartsSymbols:function(){return E(yt())},resetLayoutSizes:ne.bind(null,yt()),unloadUnusedCharts:oe.bind(null,yt()),layoutSizesChanged:()=>Le,clientId:pe,ariaDescribeChart:Dt,chartModels:()=>vt.readonly()}),oi(he.content,!0),Be.subscribe((function(){kt()})),Be.hook=function(e){return e===this.value()?e:mt(e)},ue&&(Be.writeLock=!0),window.addEventListener("resize",wt);var ci=0;function hi(){0===--ci&&h.emitOnce("onChartReady")}_e.forEach((function(e){if(e){ci++;var t=e.chartWidget;t.withModel(null,(function(){he.metaInfo&&t.model().model().setChartSaveTime(1e3*he.metaInfo.lastModified);var e=t.model().mainSeries();if(e.bars().size()>0||e.isFailed())hi();else{
var i=e.dataEvents(),s=function(){hi(),i.barReceived().unsubscribe(null,s),i.completed().unsubscribe(null,s),i.error().unsubscribe(null,s),i.unsupportedResolutionRequested().unsubscribe(null,s)};i.barReceived().subscribe(null,s),i.completed().subscribe(null,s),i.error().subscribe(null,s),i.unsupportedResolutionRequested().subscribe(null,s)}}))}})),U(yt()).then(j).then((function(){window.saver&&window.is_authenticated&&he.widgetOptions.justCloned&&window.saver.saveChartSilently()})).catch(_.logError.bind(_))}},40443:(e,t,i)=>{"use strict";i.d(t,{ContextMenuManager:()=>s});var s,r=i(29981),n=i(97702),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(4109),i.e(2603),i.e(7769),i.e(5666),i.e(4632),i.e(8432),i.e(8073),i.e(8732),i.e(1335),i.e(2227),i.e(2157),i.e(1584)]).then(i.bind(i,11785));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<a.length;e++)if(a[e].renderer.isShown())return a[e].renderer;return null}}(s||(s={}))},29280:(e,t,i)=>{"use strict";i.d(t,{DialogRenderer:()=>r});var s=i(64147);class r{constructor(){this._container=document.createElement("div"),this._visibility=new s.WatchedValue(!1),this._rootInstance=null}visible(){return this._visibility.readonly()}_setVisibility(e){this._visibility.setValue(e)}}},26023:(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={}))},9726:(e,t,i)=>{"use strict";i.d(t,{createFavoriteDrawingToolbar:()=>a,getFavoriteDrawingToolbarPromise:()=>o});var s=i(72894);let r=null,n=null;function o(){return n}function a(){
null===n&&(n=Promise.all([i.e(1595),i.e(3060),i.e(2603),i.e(5514),i.e(7399),i.e(2248),i.e(7769),i.e(7125),i.e(55),i.e(5666),i.e(4632),i.e(8432),i.e(8073),i.e(6107),i.e(3645),i.e(8732),i.e(1227),i.e(1335),i.e(5877),i.e(1538),i.e(2227),i.e(361),i.e(1890),i.e(2157),i.e(3504),i.e(2306)]).then(i.bind(i,17815)).then((({FavoriteDrawingToolbar:e})=>(r=null!==r?r:new e({left:window.innerWidth/2,top:s.HEADER_TOOLBAR_HEIGHT_EXPANDED+61}),r))))}},776:(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})},96152:(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<i.length?i[t]:"")}},77788:(e,t,i)=>{"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={}))},62288:(e,t,i)=>{"use strict";i.d(t,{InvalidationLevel:()=>s,InvalidationMask:()=>l,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;var a;!function(e){e[e.ScrollAnimation=0]="ScrollAnimation",e[e.StopAnimation=1]="StopAnimation"}(a||(a={}));class l{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;t<e._additionalActions.length;t++)this._additionalActions.push(e._additionalActions[t]);for(const t of e._timeScaleInvalidations)this._applyTimeScaleInvalidation(t)}panesOrderInvalidated(){return this._panesOrderChanged}isVisibleTimeRangeLockedOnResize(){return this._keepVisibleTimeRangeOnResize}setTimeScaleAnimation(e,t){this._removeTimeScaleAnimation(),this._timeScaleInvalidations.push({type:0,value:e,rightOffsetPx:t})}stopTimeScaleAnimation(){this._removeTimeScaleAnimation(),this._timeScaleInvalidations.push({type:1})}timeScaleInvalidations(){
return this._timeScaleInvalidations}static cursor(){return new l(s.Cursor)}static light(){return new l(s.Light)}static full(){return new l(s.Full)}static panesOrder(){const e=l.full();return e.invalidatePanesOrder(),e}static invalidateLegendWidgetLayout(e){var t;const i=new l;return i._invalidatedPanes.set(e,new n),null===(t=i._invalidatedPanes.get(e))||void 0===t||t.invalidateLegendWidgetLayout(),i}static validateAction(e){const t=new l;return t._additionalActions.push(e),t}_applyTimeScaleInvalidation(e){switch(e.type){case 0:this.setTimeScaleAnimation(e.value,e.rightOffsetPx);break;case 1:this._removeTimeScaleAnimation()}}_removeTimeScaleAnimation(){var e,t;const i=this._timeScaleInvalidations.findIndex((e=>0===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)}}}},69186:(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}}},65952:(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))}},68993:(e,t,i)=>{"use strict";i.r(t),i.d(t,{isMultipleLayout:()=>o,isSingleLayout:()=>n,isSupportedLayout:()=>a,layouts:()=>r,tryGuessingTheMostSuitableLayout:()=>l});i(87489),i(65952);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"}},17402:(e,t,i)=>{"use strict";i.d(t,{lineToolsSelectHotkeys:()=>r});i(21251);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"}}},35236:(e,t,i)=>{"use strict";i.d(t,{MouseEventHandler:()=>g,defaultPreventedHandler:()=>_,ignoreClickOrTapOnDblClickOrDblTapHandlers:()=>m,isTouchMouseEvent:()=>p});var s=i(95171),r=i(50151),n=i(49483),o=i(37265),a=i(80007),l=i(69186);const c=n.isSafari?"click":"auxclick";var h,d;!function(e){
e[e.ResetClick=500]="ResetClick",e[e.LongTap=240]="LongTap",e[e.PreventFiresTouchEvents=500]="PreventFiresTouchEvents"}(h||(h={})),function(e){e[e.CancelClickManhattanDistance=5]="CancelClickManhattanDistance",e[e.CancelTapManhattanDistance=5]="CancelTapManhattanDistance",e[e.DoubleClickManhattanDistance=5]="DoubleClickManhattanDistance",e[e.DoubleTapManhattanDistance=30]="DoubleTapManhattanDistance"}(d||(d={}));const u={treatVertTouchDragAsPageScroll:!1,treatHorzTouchDragAsPageScroll:!1,ignoreClickAndTapOnDblClickOrDblTap:!1};function p(e){return"isTouch"in e&&"stylus"in e}function _(e){return t=>{t.preventDefault(),e(t)}}function m(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 g{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=!n.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(v(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(v(e),this._clickPosition);i<5&&!this._cancelClick&&this._processMouseEvent(t,this._handlers.mouseDoubleClickEvent),this._resetClickTimeout()}}},this._target=e,this._options=(0,o.merge)((0,o.clone)(u),i||{}),this._options.ignoreClickAndTapOnDblClickOrDblTap){if(t.mouseClickEvent&&t.mouseDoubleClickEvent){const e=m({clickOrTap:t.mouseClickEvent.bind(t),doubleClickOrDoubleTap:t.mouseDoubleClickEvent.bind(t)});t.mouseClickEvent=e.clickOrTap,t.mouseDoubleClickEvent=e.doubleClickOrDoubleTap}if(t.tapEvent&&t.doubleTapEvent){const e=m({clickOrTap:t.tapEvent.bind(t),doubleClickOrDoubleTap:t.doubleTapEvent.bind(t)});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=b(e.changedTouches,(0,r.ensureNotNull)(this._activeTouchId));if(null===t)return;if(this._lastTouchEventTimeStamp=S(e),null!==this._pinchInfo)return;if(this._preventTouchDragProcess)return;this._pinchPrevented=!0;const i=this._touchMouseMoveWithDownInfo(v(t),(0,r.ensureNotNull)(this._touchMoveStartPosition)),{xOffset:s,yOffset:n,manhattanDistance:o}=i;if(this._touchMoveExceededManhattanDistance||!(o<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,a.preventDefault)(e)}}}_mouseMoveWithDownHandler(e){if(0!==e.button)return;const t=this._touchMouseMoveWithDownInfo(v(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=b(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=S(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(v(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,a.preventDefault)(e));0===this._tapCount&&(0,a.preventDefault)(e),0===e.touches.length&&this._longTapActive&&(this._longTapActive=!1,(0,a.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),n.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(v(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=S(e);const i=this._target.ownerDocument.documentElement;this._cancelTap=!1,this._touchMoveExceededManhattanDistance=!1,this._preventTouchDragProcess=!1,this._touchMoveStartPosition=v(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=v(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;n.isFF&&t.addEventListener("mouseleave",this._onFirefoxOutsideMouseUp),this._cancelClick=!1,this._mouseMoveStartPosition=v(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=v(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=S(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})}n.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,a.preventScrollByWheelClick)(this._target),this._target.addEventListener("mousedown",this._mouseDownHandler.bind(this)),this._target.addEventListener(c,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=b(e.touches,(0,
r.ensureNotNull)(this._activeTouchId)),i=b(e.touches,this._pinchInfo.secondTouchId);if(t&&i&&void 0!==this._handlers.pinchEvent){const{startPinchDistance:s,startPinchMiddlePoint:r}=this._pinchInfo,n=y(t,i)/s,o=f(this._target);this._handlers.pinchEvent(r,{x:t.clientX-o.left,y:t.clientY-o.top},{x:i.clientX-o.left,y:i.clientY-o.top},n),(0,a.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=f(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:y(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=!n.CheckMobile.iOS()}_longTapHandler(e){const t=b(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,a.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:S(e)<this._lastTouchEventTimeStamp+500}_processTouchEvent(e,t){(0,l.setLastMouseOrTouchEventInfo)(e),t&&t.call(this._handlers,e)}_processMouseEvent(e,t){"mouseleave"!==e.srcType&&(0,l.setLastMouseOrTouchEventInfo)(e),t&&t.call(this._handlers,e)}_makeCompatEvent(e,t){const i=t||e,r=(0,s.default)((()=>this._target.getBoundingClientRect()||{left:0,top:0}));return{clientX:i.clientX,clientY:i.clientY,pageX:i.pageX,pageY:i.pageY,screenX:i.screenX,screenY:i.screenY,get localX(){return i.clientX-r().left},get localY(){return i.clientY-r().top},ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,isTouch:!e.type.startsWith("mouse")&&"contextmenu"!==e.type&&"click"!==e.type,stylus:"stylus"===(null==t?void 0:t.touchType),srcType:e.type,target:i.target,view:e.view,preventDefault:()=>{"touchstart"!==e.type&&(0,
a.preventDefault)(e)}}}}function f(e){return e.getBoundingClientRect()||{left:0,top:0}}function v(e){return{x:e.pageX,y:e.pageY}}function y(e,t){const i=e.clientX-t.clientX,s=e.clientY-t.clientY;return Math.sqrt(i*i+s*s)}function S(e){return e.timeStamp||performance.now()}function b(e,t){for(let i=0;i<e.length;++i)if(e[i].identifier===t)return e[i];return null}},60859:(e,t,i)=>{"use strict";i.d(t,{actualBehavior:()=>a,availableValues:()=>o,navigationButtonsVisibilityKey:()=>r,property:()=>n,restoreNavigationButtonsVisibilitySettingsValue:()=>l});var s=i(17656);const r="NavigationButtons.visibility",{property:n,availableValues:o,actualBehavior:a,restoreDefaultValue:l}=(0,s.createVisibilityController)(r)},51613:(e,t,i)=>{"use strict";i.d(t,{actualBehavior:()=>a,availableValues:()=>o,property:()=>n,restorePaneButtonsVisibilitySettingsValue:()=>l});var s=i(17656),r=i(60859);const{property:n,availableValues:o,actualBehavior:a,restoreDefaultValue:l}=(0,s.createVisibilityController)("PaneButtons.visibility",r.navigationButtonsVisibilityKey)},65388:(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}},28388:(e,t,i)=>{"use strict";i.d(t,{MetaInfoHelper:()=>u});var s=i(50151),r=i(68159),n=i(94113),o=i(37265),a=i(31955),l=i(65383);function c(e){return!e.groupId&&!e.isHidden&&e.id!==l.RangeDependentStudyInputNames.FirstBar&&e.id!==l.RangeDependentStudyInputNames.LastBar}var h=i(65388);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}},59063:(e,t,i)=>{"use strict";i.d(t,{AbstractJsonStoreService:()=>r,CommonJsonStoreService:()=>n});var s=i(52033);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}}},38119:(e,t,i)=>{"use strict";i.d(t,{CustomStatusModel:()=>c});var s=i(64147);const r="#9598a1",n=!1,o=null,a='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor"></svg>';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},30141:(e,t,i)=>{"use strict";i.d(t,{restoreShowMarketOpenStatusProperty:()=>l,showMarketOpenStatusProperty:()=>a});var s=i(17625),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())))},90823:(e,t,i)=>{"use strict";i.d(t,{MarketStatusModel:()=>u});var s,r=i(50151),n=i(64147),o=i(88960),a=i(68805),l=i(69748),c=i(2740);function h(e){return window.ChartApiInstance.serverTime()/1e3-e}
function d(e,t,i){return e<=i?t<=i?1/0:t/1e3:Math.min(e,t)/1e3}!function(e){e.Open="market",e.Pre="pre_market",e.Post="post_market",e.Close="out_of_session",e.Holiday="holiday",e.Delisted="delisted",e.Expired="expired"}(s||(s={}));class u{constructor(e){var t,i;this._currentSession=new n.WatchedValue(null),this._delistedByTypespecs=new n.WatchedValue(!1),this._sessionsSpec=null,this._nextSessionEdgeInternal=null,this._nextSessionEdge=new n.WatchedValue(null),this._recalcNextSessionEdgeTimerId=null,this._delay=0,this._futuresContractExpirationTime=null,this._quotesProvider=e,this._marketStatus=(0,o.combine)(((e,t,i)=>null===e?e:t?"delisted":i?"expired":function(e){switch(e){case"market":return"market";case"pre_market":return"pre_market";case"post_market":return"post_market";case"out_of_session":return"out_of_session";case"holiday":return"holiday"}(0,r.ensureNever)(e)}(e)),this._currentSession.weakReference(),this._delistedByTypespecs.weakReference(),(null!==(i=null===(t=this._futuresContractExpirationTime)||void 0===t?void 0:t.expired())&&void 0!==i?i:new n.WatchedValue(!1)).weakReference()),e.quotesUpdate().subscribe(this,(e=>{var t;this._currentSession.setValue(null!==(t=null==e?void 0:e.values.current_session)&&void 0!==t?t:null)})),e.quoteSymbolChanged().subscribe(this,(()=>{this._currentSession.setValue(null)}))}destroy(){this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._quotesProvider.quoteSymbolChanged().unsubscribeAll(this),null!==this._recalcNextSessionEdgeTimerId&&clearTimeout(this._recalcNextSessionEdgeTimerId),this._marketStatus.destroy()}futuresContractExpirationTime(){return this._futuresContractExpirationTime}setSymbolInfo(e){var t,i,s,r,n;if(this._nextSessionEdgeInternal=null,null===e)return void(this._sessionsSpec=null);this._delay=(0,a.getSymbolDelaySeconds)(e);const o=new l.SessionSpec(e.timezone,null!==(t=e.session_display)&&void 0!==t?t:e.session,e.session_holidays,e.corrections);let c,h;const d=null===(i=e.subsessions)||void 0===i?void 0:i.find((e=>"premarket"===e.id)),u=null===(s=e.subsessions)||void 0===s?void 0:s.find((e=>"postmarket"===e.id));void 0!==d&&(c=new l.SessionSpec(e.timezone,null!==(r=d["session-display"])&&void 0!==r?r:d.session,e.session_holidays,d["session-correction"])),void 0!==u&&(h=new l.SessionSpec(e.timezone,null!==(n=u["session-display"])&&void 0!==n?n:u.session,e.session_holidays,u["session-correction"])),this._sessionsSpec={general:o,preMarket:c,postMarket:h},this._recalculateNextSessionEdge()}status(){return this._marketStatus}currentSession(){return this._currentSession}nextSessionEdge(){return this._nextSessionEdge}_getNextSessionEdgeInternal(){var e;if(null===this._sessionsSpec||"24x7"===this._sessionsSpec.general.spec())return null;const t=1e3*h(this._delay);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,c.get_timezone)(e.timezone()),n=(0,c.utc_to_cal)(r,t),o=d((0,
c.cal_to_utc)(r,e.alignToNearestSessionStart(n,1)),(0,c.cal_to_utc)(r,e.alignToNearestSessionEnd(n,1)),t),a=d(void 0!==i?(0,c.cal_to_utc)(r,i.alignToNearestSessionStart(n,1)):1/0,void 0!==i?(0,c.cal_to_utc)(r,i.alignToNearestSessionEnd(n,1)):1/0,t),l=d(void 0!==s?(0,c.cal_to_utc)(r,s.alignToNearestSessionStart(n,1)):1/0,void 0!==s?(0,c.cal_to_utc)(r,s.alignToNearestSessionEnd(n,1)):1/0,t);let u=Math.min(o,a,l);if(u===1/0){const t=h(this._delay),i=6e4,s=new Date(Math.round(new Date(1e3*t).getTime()/i)*i).getTime()+i,n=(0,c.utc_to_cal)(r,s),o=d((0,c.cal_to_utc)(r,e.alignToNearestSessionStart(n,1)),(0,c.cal_to_utc)(r,e.alignToNearestSessionEnd(n,1)),s),p=Math.min(o,a,l);p!==1/0?(this._nextSessionEdgeInternal={timestamp:u},u=p):this._nextSessionEdgeInternal={timestamp:null}}this._nextSessionEdgeInternal=u===l?{timestamp:u,status:"post_market"}:u===a?{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-h(this._delay))};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()}}},22118:(e,t,i)=>{"use strict";i.d(t,{CRUCIAL_REALTIME_BATS:()=>l,firstReplacedByBatsExchange:()=>c,isDelay:()=>d,isEod:()=>h,witoutRealtime:()=>u});i(50151);var s=i(13665),r=i.n(s);const n=["DJ","JSE","BELEX"],o=["NZX"],a=["BIVA"],l=["AMEX","NASDAQ","NYSE"];function c(e){return null}function h(e,t){return r().hasEodSymbols(e.full_name)||6===t}function d(e){return void 0!==e&&e>0}function u(e){return"index"===e.type&&n.includes(e.listed_exchange)||"futures"===e.type&&o.includes(e.listed_exchange)||a.includes(e.listed_exchange)}},76032:(e,t,i)=>{"use strict";i.d(t,{getStudyTemplateDescString:()=>a,getStudyTemplateMetaInfo:()=>n,getStudyTemplateSaveData:()=>o});var s=i(19466),r=i(72708);function n(e,t){return{indicators:e.orderedDataSources(!0).filter((e=>(0,r.isStudy)(e)&&!0)).map((e=>({id:e.metaInfo().id,description:e.title(s.TitleDisplayTarget.StatusLine,!0,void 0,!0)}))),interval:t}}function o(e,t,i,s){const r=t.studyTemplate(i,s);return{name:e,content:JSON.stringify(r),meta_info:n(t,r.interval)}}function a(e){const t=new Map;return e.forEach((e=>{const[i,s]=t.get(e.id)||[e.description,0];t.set(e.id,[i,s+1])})),Array.from(t.values()).map((([e,t])=>`${e}${t>1?` x ${t}`:""}`)).join(", ")}},79652:(e,t,i)=>{"use strict";i.d(t,{canShowSpreadActions:()=>r,globalKeypressMatches:()=>n});var s=i(56570);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")}},50340:(e,t,i)=>{"use strict";function s(){return Promise.all([i.e(359),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(7399),i.e(2248),i.e(7125),i.e(8077),i.e(5546),i.e(3114),i.e(3204),i.e(1729),i.e(9486),i.e(4959),i.e(2227),i.e(3443),i.e(6014),i.e(361),i.e(2079),i.e(3098),i.e(2751),i.e(1754)]).then(i.bind(i,89324))}i.d(t,{loadNewSymbolSearch:()=>s})},79320:(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}},31601:(e,t,i)=>{"use strict";i.d(t,{TradingViewApiBase:()=>Re});var s=i(50151),r=i(82992),n=i(76422),o=i(56570),a=i(40443),l=i(68993),c=i(51768),h=i(85662),d=i(45345),u=i(52033);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(4711),m=i(928),g=i(64147),f=i(55917),v=i(630),y=i(19888),S=i.t(y,2);const b=new u.Delegate;var w=i(11542),C=i(45126),P=i(85049),x=i(78749),T=i(14381),I=i(9447);class M{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 A=i(63950);const L=new C.TranslatedString("change timezone",w.t(null,void 0,i(20137)));class k{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 A.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,A.timezoneIsAvailable)(e),`Incorrect timezone: ${e}`),(null==t?void 0:t.disableUndo)?this._timezoneProperty.setValue(e):this._chartWidget.model().setProperty(this._timezoneProperty,e,L)}onTimezoneChanged(){return this._onTimezoneChanged}}class D{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:t.selectedCurrency,originalCurrencies:Array.from(t.originalCurrencies),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._chartModel.availableUnits(),t=this._priceScale.unit(e);return null===t?null:{readOnly:0===t.availableGroups.size,selectedUnit:t.selectedUnit,originalUnits:Array.from(t.originalUnits),availableGroups:Array.from(t.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 E=i(72708);function V(e){return{id:e.id(),name:(t=e.toolname,Object.keys(_.supportedLineTools).find((e=>_.supportedLineTools[e].name===t))||null)};var t}function B(e){return{id:e.id(),name:e.metaInfo().description}}var R=i(37265),N=i(60265);const O=new C.TranslatedString("change pane height",w.t(null,void 0,i(14691)))
;class F extends N.UndoCommand{constructor(e,t,i){super(O),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.length;++t)e[t].setStretchFactor((0,s.ensureDefined)(this._prevStretchFactors[t]));this._model.fullUpdate()}}class W{constructor(e,t){this._priceScales=new WeakMap,this._pane=e,this._chartWidget=t}hasMainSeries(){return this._pane.containsMainSeries()}getLeftPriceScales(){return this._pane.leftPriceScales().map(this._getPriceScaleApi,this)}getRightPriceScales(){return this._pane.rightPriceScales().map(this._getPriceScaleApi,this)}getMainSourcePriceScale(){const e=this._pane.mainDataSource();if(null===e)return null;const t=e.priceScale();return null===t||this._pane.isOverlay(e)?null:this._getPriceScaleApi(t)}getPriceScaleById(e){const t=this._pane.getPriceScaleById(e);return null===t?null:this._getPriceScaleApi(t)}setMaximized(e){if(this._pane.maximized().value()!==e)for(const e of this._chartWidget.paneWidgets())if(e.state()===this._pane){this._chartWidget.toggleMaximizePane(e);break}}legendLoaded(){const e=this._chartWidget.paneByState(this._pane);return Boolean(e&&e.statusWidget())}getAllEntities(){const e=this._pane.model();return this._pane.sourcesByGroup().allIncludingHidden().filter((e=>!e.isSpeciallyZOrderedSource())).map((t=>function(e,t){return t===e.mainSeries()?{id:e.mainSeries().id(),name:"Main Series"}:(0,E.isStudy)(t)?B(t):(0,v.isLineTool)(t)?V(t):null}(e,t))).filter(R.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 F(t,r,e);this._chartWidget.model().undoHistory().pushUndoCommand(n)}moveTo(e){const t=this.paneIndex();t!==e&&((0,s.assert)(e>=0&&e<this._chartWidget.paneWidgets().length,"Invalid pane index"),this._chartWidget.model().movePane(t,e))}paneIndex(){return this._chartWidget.model().model().panes().indexOf(this._pane)}collapse(){if(1===this._chartWidget.paneWidgets().length)throw new Error("Cannot collapse a single pane!");if(this._pane.collapsed().value())throw new Error("Cannot collapse current pane!");this._chartWidget.model().toggleCollapsedPane(this._pane)}restore(){if(1===this._chartWidget.paneWidgets().length)throw new Error("Cannot restore a single pane!");if(!this._pane.collapsed().value())throw new Error("Cannot restore current pane!");this._chartWidget.model().toggleCollapsedPane(this._pane)}_getPriceScaleApi(e){let t=this._priceScales.get(e);return void 0===t&&(t=new D(this._chartWidget.model(),e),this._priceScales.set(e,t)),t}}var H=i(19466),z=i(77470),U=i(98272),j=i(83520),G=i(52967),q=i(58783),$=i(51330),K=i(33515),Y=i(25512),Z=i(678),X=i(152),J=i(70120),Q=i(58137);class ee{constructor(e,t){
this._onStudyCompleted=new u.Delegate,this._onStudyError=new u.Delegate,this._study=e,this._chartWidget=t,this._undoModel=this._chartWidget.model(),this._model=this._undoModel.model(),this._study.onAboutToBeDestroyed().subscribe(this,(()=>{this._study.onStatusChanged().unsubscribeAll(this),this._study.onAboutToBeDestroyed().unsubscribeAll(this)})),this._study.onStatusChanged().subscribe(this,(e=>{switch(e.type){case Z.StudyStatusType.Completed:this._onStudyCompleted.fire();break;case Z.StudyStatusType.Error:this._onStudyError.fire()}}))}isUserEditEnabled(){return this._study.userEditEnabled()}setUserEditEnabled(e){this._study.setUserEditEnabled(e)}getInputsInfo(){return(0,X.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,R.isObject)(i)?i.v:i}}))}getStyleInfo(){return(0,J.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 G.MergeUpUndoCommand(this._model,this._study,null).redo()}mergeDown(){this._model.isMergeDownAvailableForSource(this._study)&&new G.MergeDownUndoCommand(this._model,this._study,null).redo()}unmergeUp(){this._model.isUnmergeAvailableForSource(this._study)&&new j.UnmergeUpUndoCommand(this._model,this._study,null).redo()}unmergeDown(){this._model.isUnmergeAvailableForSource(this._study)&&new j.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 D(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 q.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 q.MoveToExistingPriceScaleUndoCommand(this._model,this._study,i,this._model.mainSeries().priceScale(),null).redo();break;case"new-left":new q.MoveToNewPriceScaleUndoCommand(this._model,this._study,i,"left",null).redo();break;case"new-right":new q.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,U.sourceNewCurrencyOnPinningToPriceScale)(this._study,o,this._model),l=(0,K.sourceNewUnitOnPinningToPriceScale)(this._study,o,this._model);new q.MoveToExistingPriceScaleUndoCommand(this._model,this._study,i,o,null).redo(),null!==a&&new z.SetPriceScaleCurrencyUndoCommand(this._model,o,a,null).redo(),null!==l&&new Y.SetPriceScaleUnitUndoCommand(this._model,o,l,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,x.applyOverridesToStudy)(this._study,e)}hasPlots(){return this._study.metaInfo().plots.length>0}dataLength(){return this._study.status().type!==Z.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===Z.StudyStatusType.Undefined||e.type===Z.StudyStatusType.Loading}hasPendingUnresolvedSymbols(){return this._study.hasPendingUnresolvedSymbols()}anyGraphicsReady(){return!(0,Q.isStudyGraphicsEmpty)(this._study.graphics())}graphicsViewsReady(){return this._study.graphicsViewsReady()}properties(){return this._study.properties()}async applyToEntireLayout(){const e=new $.ActionsProvider(this._chartWidget),t=(await e.contextMenuActionsForSources([this._study],(0,s.ensureNotNull)(this._chartWidget.model().paneForSource(this._study)))).find((e=>"applyStudyToEntireLayout"===e.id));t&&t.execute()}status(){return{...this._study.status()}}title(){return this._study.title(H.TitleDisplayTarget.StatusLine)}symbolsResolved(){return this._study.symbolsResolved()}}const te=new Map([["LineToolBezierQuadro",3],["LineToolBezierCubic",4]]);function ie(e){const t=te.get(e.toolname);if(void 0!==t)return t;const i=e.pointsCount();return-1===i?e.points().length:i}function se(e){return"LineToolRiskRewardLong"===e||"LineToolRiskRewardShort"===e}
const re=["alwaysShowStats","entryPrice","inputs.first bar time","inputs.last bar time","interval","linesWidths","points","snapTo45Degrees","stopPrice","symbol","symbolStateVersion","currencyId","unitId","targetPrice","zOrderVersion"];class ne{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(re,!0)}setProperties(e,t){(0,f.allowSavingDefaults)(!!t),this._source.properties().mergeAndFire(e),(0,f.allowSavingDefaults)(!1)}getPoints(){let e=this._source.points();const t=ie(this._source);return e.length>t&&((0,s.assert)(se(this._source.toolname)),e=e.slice(0,t)),this._pointsConverter.dataSourcePointsToPriced(e)}setPoints(e){if(this._source.isFixed())return;const t=ie(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()}}class oe{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 G.MergeUpUndoCommand(this._model,this._series,null).redo()}mergeDown(){this._model.isMergeDownAvailableForSource(this._series)&&new G.MergeDownUndoCommand(this._model,this._series,null).redo()}unmergeUp(){this._model.isUnmergeAvailableForSource(this._series)&&new j.UnmergeUpUndoCommand(this._model,this._series,null).redo()}unmergeDown(){this._model.isUnmergeAvailableForSource(this._series)&&new j.UnmergeDownUndoCommand(this._model,this._series,null).redo()}detachToRight(){new q.MoveToNewPriceScaleUndoCommand(this._model,this._series,this._pane(),"right",null).redo()}detachToLeft(){new q.MoveToNewPriceScaleUndoCommand(this._model,this._series,this._pane(),"left",null).redo()}detachNoScale(){new q.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 q.MoveToNewPriceScaleUndoCommand(this._model,this._series,t,"left",null).redo();break;case"new-right":new q.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 q.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 q.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,t){return t?this._series.properties().childs()[ae(e)].state():this._series.properties().childs()[ae(e)].state(["inputs","inputsInfo"])}setChartStyleProperties(e,t){this._series.properties().childs()[ae(e)].mergeAndFire(t)}barsCount(){return this._series.bars().size()}endOfData(){return this._series.endOfData()}symbolSource(){return{symbol:this._series.symbol(),currencyId:this._series.currency(),unitId:this._series.unit()}}isLoading(){return this._series.isLoading()}isInReplay(){return this._series.isInReplay()}
data(){return this._series.data()}priceScale(){return new D(this._undoModel,this._series.priceScale())}seriesErrorMessage(){return this._series.seriesErrorMessage()}compositeStatusVW(){return this._series.compositeStatusVW()}_pane(){return(0,s.ensureNotNull)(this._model.paneForSource(this._series))}}function ae(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";case 18:return"tpoStyle";case 19:return"volCandlesStyle";case 20:return"svpStyle";default:(0,s.ensureNever)(e)}throw new Error(`unsupported chart style: ${e}`)}var le=i(32112),ce=i(16638),he=i(48984),de=i(70131);function ue(e,t){const{symbolChanged:i,currencyChanged:s,unitChanged:r,styleChangeRequiresRestart:n}=e.compareSymbolParams(t);return!(i||s||r||n)}function pe(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),(ue(e,r)||e.seriesSource().symbolInstanceId()===i)&&t(!1)},o=()=>{s.error().unsubscribe(null,n),(ue(e,r)||e.seriesSource().symbolInstanceId()===i)&&t(!0)};s.completed().subscribe(null,n,!0),s.error().subscribe(null,o,!0)}var _e=i(71885),me=i(68159),ge=i(17730),fe=i(53388),ve=i(45579),ye=i(74174),Se=i(2718);class be{constructor(e,t){this._controller=e,this._model=t}createGroupFromSelection(){return this._controller.createGroupFromSelection().id}removeGroup(e){const t=(0,s.ensureDefined)(this._groupById(e));this._controller.removeGroup(t)}groups(){return this._controller.groups().map((e=>e.id))}shapesInGroup(e){const t=(0,s.ensureDefined)(this._groupById(e));return(0,Se.sortSources)(t.lineTools()).map((e=>e.id()))}excludeShapeFromGroup(e,t){const i=(0,s.ensureDefined)(this._groupById(e)),r=(0,s.ensureNotNull)(this._model.dataSourceForId(t));(0,s.assert)((0,v.isLineTool)(r),"Passed shapeId is not a line tool"),this._controller.excludeLineToolFromGroup(i,r)}addShapeToGroup(e,t){const i=(0,s.ensureDefined)(this._groupById(e)),r=(0,s.ensureNotNull)(this._model.dataSourceForId(t));(0,s.assert)((0,v.isLineTool)(r),"Passed shapeId is not a line tool"),this._controller.addLineToolToGroup(i,r)}availableZOrderOperations(e){const t=(0,s.ensureDefined)(this._groupById(e));return this._controller.availableZOrderOperations(t)}bringToFront(e){const t=(0,s.ensureDefined)(this._groupById(e));this._controller.bringToFront(t)}bringForward(e){const t=(0,s.ensureDefined)(this._groupById(e));this._controller.bringForward(t)}sendBackward(e){const t=(0,s.ensureDefined)(this._groupById(e));this._controller.sendBackward(t)}sendToBack(e){const t=(0,s.ensureDefined)(this._groupById(e))
;this._controller.sendToBack(t)}insertAfter(e,t){const i=(0,s.ensureDefined)(this._groupById(e)),r=(0,s.ensureNotNull)(this._groupById(t)||this._model.dataSourceForId(t));this._controller.insertAfter(i,r)}insertBefore(e,t){const i=(0,s.ensureDefined)(this._groupById(e)),r=(0,s.ensureNotNull)(this._groupById(t)||this._model.dataSourceForId(t));this._controller.insertBefore(i,r)}groupVisibility(e){return(0,s.ensureDefined)(this._groupById(e)).visibility()}setGroupVisibility(e,t){const i=(0,s.ensureDefined)(this._groupById(e));this._controller.setGroupVisibility(i,t)}groupLock(e){return(0,s.ensureDefined)(this._groupById(e)).locked()}setGroupLock(e,t){const i=(0,s.ensureDefined)(this._groupById(e));this._controller.setGroupLock(i,t)}getGroupName(e){return(0,s.ensureDefined)(this._groupById(e)).name().value()}setGroupName(e,t){const i=(0,s.ensureDefined)(this._groupById(e));this._controller.setGroupName(i,t)}canBeGroupped(e){const t=e.map((e=>(0,s.ensureNotNull)(this._model.dataSourceForId(e))));return!t.some((e=>!(0,v.isLineTool)(e)))&&this._controller.canBeGroupped(t)}_groupById(e){return this._controller.groups().find((t=>t.id===e))}}var we=i(15764),Ce=i(28331),Pe=i(39076),xe=i(76032);const Te=new C.TranslatedString("change price to bar ratio",w.t(null,void 0,i(2509))),Ie=new C.TranslatedString("toggle lock scale",w.t(null,void 0,i(49695)));function Me(e,t){return t.map((t=>(0,s.ensureNotNull)(e.dataSourceForId(t))))}class Ae{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 k(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 g.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 de.SetScaleRatioPropertiesCommand(r,e,null,s).redo():i.setScaleRatioProperty(r,e,Te)}
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 he.SetPriceScaleModeCommand({lockScale:e},r,null,s).redo():i.setPriceScaleMode({lockScale:e},r,Ie)}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,R.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),pe(this._chartWidget.model().mainSeries(),(e=>{!e&&i&&i()})))}async setResolution(e,t){(0,R.isFunction)(t)&&(t={dataReady:t});const{dataReady:i,doNotActivateChart:s}=t||{},r=P.Interval.normalize(e);if(null===r||r===this.resolution())return null==i||i(),!0;s||this._activateChart();const n=await this._chartWidget.chartWidgetCollection().setResolution(r,void 0,this._chartWidget);return n&&pe(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 pe(this._chartWidget.model().mainSeries(),(e=>{!e&&t&&t()})),i}resetData(){this._chartWidget.model().mainSeries().rerequestData()}executeActionById(e){this._chartWidget.executeActionById(e)}getCheckableActionState(e){return this._chartWidget.getCheckableActionState(e)}refreshMarks(){this._chartWidget.refreshMarks()}clearMarks(e){this._chartWidget.clearMarks(e)}getBarsMarksSources(){return this._chartWidget.model().barsMarksSources()}getAllShapes(){
return this._chartWidget.model().model().allLineTools().map(V).filter((e=>null!==e.name))}getAllStudies(){return this._chartWidget.model().model().allStudies(!0).map(B)}getStudyTemplateSnapshot(e,t,i){return(0,xe.getStudyTemplateSaveData)(e,this._chartWidget.model().model(),t,i)}getStudyTemplateDescString(){const e=(0,xe.getStudyTemplateMetaInfo)(this._chartWidget.model().model());return(0,xe.getStudyTemplateDescString)(e.indicators)}applyStudyTemplateByRecord(e){if(!e)return;const t=t=>this._chartWidget.model().applyStudyTemplate(JSON.parse(t.content),e.name);e.is_default?Pe.backend.getStandardStudyTemplateById(e.id,t):Pe.backend.getStudyTemplateById(e.id).then(t)}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()}restoreChartPreferences(){this._chartWidget.model().restorePreferences()}availableZOrderOperations(e){const t=Me(this._chartWidget.model().model(),e);return this._chartWidget.model().availableZOrderOperations(t)}sendToBack(e){const t=Me(this._chartWidget.model().model(),e);this._chartWidget.model().sendToBack(t)}bringToFront(e){const t=Me(this._chartWidget.model().model(),e);this._chartWidget.model().bringToFront(t)}bringForward(e){const t=Me(this._chartWidget.model().model(),e);this._chartWidget.model().bringForward(t)}sendBackward(e){const t=Me(this._chartWidget.model().model(),e);this._chartWidget.model().sendBackward(t)}insertAfter(e,t){const i=this._chartWidget.model().model(),r=Me(i,e),n=(0,s.ensureNotNull)(i.dataSourceForId(t));this._chartWidget.model().insertAfter(r,n)}insertBefore(e,t){const i=this._chartWidget.model().model(),r=Me(i,e),n=(0,s.ensureNotNull)(i.dataSourceForId(t));this._chartWidget.model().insertBefore(r,n)}sessions(){var e,t;return null!==(t=null===(e=this._chartWidget.model().model().sessions())||void 0===e?void 0:e.get())&&void 0!==t?t:null}chartModel(){return this._chartWidget.model().model()}getTimeScaleLogicalRange(){return this._chartWidget.model().timeScale().logicalRange()}setEntityVisibility(e,t){console.warn("`setEntityVisibility` is deprecated. Use shape/study API instead");const i=this._chartWidget.model().model().dataSourceForId(e);if(!i)return;const s=i.properties();s&&s.visible&&s.visible.setValue(t)}async 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);e=e.toLowerCase();const o=await(0,ce.studyMetaInfoRepository)().findAllJavaStudies(),a=me.StudyMetaInfo.findStudyMetaInfoByDescription(o,e);if(n.checkLimit){const e=this._chartWidget.model().canCreateStudy({id:a.id});if(!e.success)return(0,_e.showTooManyStudiesNotice)(e.limitValue),Promise.resolve(null)}const l=(n.disableUndo?this._chartWidget.model().model():this._chartWidget.model()).createStudyInserter({type:"java",studyId:a.id},[]);if(l.setForceOverlay(!!t),n.priceScale&&l.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&&l.setAllowChangeCurrency(!0),n.allowChangeUnit&&l.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;t<a.inputs.length;++t)e[a.inputs[t].id]=s[t];s=e}return l.insert((()=>Promise.resolve({inputs:s||{},parentSources:[]}))).then((e=>(r&&(0,x.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 oe(t,e)}createShape(e,t){return this.createMultipointShape([e],t)}createMultipointShape(e,t){var i;const r=Object.assign({},{filled:!0},t),n=_.supportedLineTools[r.shape]||_.supportedLineTools.flag;const o=this._chartWidget.model().model(),a=o.mainSeries();if(o.timeScale().isEmpty())return null;const l=void 0!==r.ownerStudyId&&null!==(i=o.dataSourceForId(r.ownerStudyId))&&void 0!==i?i:a,c=o.paneForSource(l),h=this._convertUserPointsToDataSource(e);if(null===h||null===c)return null;if(n.onlySelectable)throw new Error(`Cannot create "${r.shape}" shape`);if("LineToolIcon"===n.name){const e=r;if(e.icon=e.icon||e.overrides&&e.overrides.icon,!r.hasOwnProperty("icon"))throw new Error("icon must be specified in options");e.overrides=e.overrides||{},e.overrides.icon=e.icon}const d=(0,v.createLineToolProperties)(n.name,void 0,this._chartWidget.model().model());if((0,v.prepareLineToolPropertiesByOwnerSource)(d,l),r.overrides)for(const e in r.overrides)d.hasChild(e)?(0,s.ensureDefined)(d.child(e)).mergeAndFire(r.overrides[e]):se(n.name)&&-1!==["profitLevel","stopLevel"].indexOf(e)&&d.addProperty(e,r.overrides[e]);let u;void 0!==d.hasChild("text")&&r.text&&(0,s.ensureDefined)(d.child("text")).setValue(r.text),d.hasChild("filled")&&r.filled&&(0,s.ensureDefined)(d.child("filled")).setValue(!0),u=r.disableUndo?this._chartWidget.model().model():this._chartWidget.model();const p=u.createLineTool({pane:c,point:h[0],linetool:n.name,properties:d,
ownerSource:l});if(null===p)return null;if(se(n.name)){if(h.length>2)throw new Error(`Wrong points count for ${r.shape}. Required 1 or 2`);2===h.length&&(p.startChanging(1,h[1]),p.setPoint(1,h[1]),p.endChanging(!0,!1))}else{const e=p.pointsCount();if(e!==h.length&&-1!==e)throw new Error(`Wrong points count for ${r.shape}. Required ${e}`);const t=new Ce.EnvironmentState(void 0,!0),i=(0,we.isLineDrawnWithPressedButton)(n.name);for(let e=1;e<h.length&&this._chartWidget.model().lineBeingCreated();e++)p.setLastPoint(h[e]),u.continueCreatingLine(h[e],t,e<h.length-1||i);(0,we.isLineToolFinishRequiredWhenCreatedByApi)(n.name)&&(p.finish(),u.finishLineTool(p),u.continueCreatingLine(h[h.length-1],t,!1))}if(r.lock&&p.setUserEditEnabled(!1),r.disableSelection&&p.setSelectionEnabled(!1),r.disableSave&&(void 0===p.customization&&(p.customization={}),p.customization.disableSave=!0),r.hasOwnProperty("showInObjectsTree")&&(void 0===p.customization&&(p.customization={}),p.customization.showInObjectsTree=r.showInObjectsTree),r.zOrder){const e=this._chartWidget.model().availableZOrderOperations([p]);"top"===r.zOrder&&e.bringToFrontEnabled?u.bringToFront([p]):"bottom"===r.zOrder&&e.sendToBackEnabled&&u.sendToBack([p])}return p.id()}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)}removeEntity(e,t){const i=this._chartWidget.model().model().dataSourceForId(e);i?t&&t.disableUndo?new ye.RemoveSourcesUndoCommand(this._chartWidget.model().model(),[i],null).redo():this._chartWidget.model().removeSource(i,!0,!0):console.warn(`Can't find a source with id: ${e}`)}removeEntityWithUndo(e){const t=this._chartWidget.model().model().dataSourceForId(e);t&&this._chartWidget.model().removeSource(t,!1)}removeAllShapes(){this._chartWidget.removeAllDrawingTools()}removeAllStudies(){this._chartWidget.removeAllStudies()}selection(){return null===this._selectionApi&&(this._selectionApi=new le.SelectionApi(this._chartWidget.model().model())),this._selectionApi}showPropertiesDialog(e){const t=this._chartWidget.model().model().dataSourceForId(e);if(null===t)throw new Error(`Study or shape ${e} does not exist`);this._chartWidget.showChartPropertiesForSource(t)}createStudyTemplate(e){return this._chartWidget.model().model().studyTemplate(e.saveSymbol,e.saveInterval)}applyStudyTemplate(e){this._chartWidget.model().applyStudyTemplate(e,""+1e3*Math.random())}drawOnAllCharts(e){(0,m.drawOnAllCharts)().setValue(e)}createOrderLine(e){var t;return this._createTradingPrimitive("LineToolOrder",null!==(t=null==e?void 0:e.disableUndo)&&void 0!==t&&t)}createPositionLine(e){var t;return this._createTradingPrimitive("LineToolPosition",null!==(t=null==e?void 0:e.disableUndo)&&void 0!==t&&t)}createExecutionShape(e){var t;return this._createTradingPrimitive("LineToolExecution",null!==(t=null==e?void 0:e.disableUndo)&&void 0!==t&&t)}symbol(){return this._chartWidget.symbolWV().value()}symbolExt(){const e=this._chartWidget.model().mainSeries().symbolInfo()
;if(null===e)return null;const t=((e,t)=>{const i={};return t.forEach((t=>{void 0!==e[t]&&(i[t]=e[t])})),i})(e,["name","base_name","ticker","description","long_description","type","session","session_display","session_holidays","corrections","exchange","exchange","listed_exchange","timezone","format","pricescale","minmov","fractional","minmove2","variable_tick_size","has_intraday","supported_resolutions","intraday_multipliers","has_seconds","has_ticks","seconds_multipliers","has_daily","daily_multipliers","has_weekly_and_monthly","weekly_multipliers","monthly_multipliers","has_empty_bars","visible_plots_set","volume_precision","data_status","delay","expired","expiration_date","sector","industry","currency_code","original_currency_code","unit_id","original_unit_id","unit_conversion_types","subsession_id","subsessions","price_source_id","price_sources","logo_urls","exchange_logo","pro_name","library_custom_fields"]);return t.pro_name=e.pro_name,t}resolution(){return this._chartWidget.model().mainSeries().interval()}marketStatus(){return this._chartWidget.model().mainSeries().marketStatusModel().currentSession().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}getVisiblePriceRange(){if(console.warn("`getVisiblePriceRange` is deprecated. Use Price Scale API instead"),!this._chartWidget.model().mainSeries())return null;return this._chartWidget.model().mainSeries().priceScale().priceRangeInPrice()}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()}priceFormatter(){return this._chartWidget.model().mainSeries().priceScale().formatter()}chartType(){return this._chartWidget.model().mainSeries().properties().childs().style.value()}setTimezone(e){this._chartWidget.setTimezone(e)}getTimezone(){return this._chartWidget.getTimezone()}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,99992)).then((e=>e.exportData(this._chartWidget.model().model(),t)))}canZoomOut(){return!this._chartWidget.model().zoomStack().isEmpty()}zoomOut(){this.canZoomOut()&&this._chartWidget.model().zoomFromViewport()}setZoomEnabled(e){
this._chartWidget.model().model().setZoomEnabled(e)}setScrollEnabled(e){this._chartWidget.model().model().setScrollEnabled(e)}shapesGroupController(){return new be(this._chartWidget.model().lineToolsGroupController(),this._chartWidget.model().model())}isSelectBarRequested(){return this._chartWidget.selectPointMode().value()!==m.SelectPointMode.None}requestSelectBar(){return this.isSelectBarRequested()?Promise.reject("already requested"):new Promise(((e,t)=>{this._chartWidget.requestSelectPoint({pointType:"time"}).then((t=>{e(this._convertTimeToPublic((0,s.ensureDefined)(t.point.time)))})).catch((()=>{t("cancelled")}))}))}cancelSelectBar(){this.isSelectBarRequested()&&this._chartWidget.cancelRequestSelectPoint()}barTimeToEndOfPeriod(e){const t=this._prepareEndOfPeriodArgs();return(0,I.barTimeToEndOfPeriod)(t.barBuilder,e,t.intervalObj)}endOfPeriodToBarTime(e){const t=this._prepareEndOfPeriodArgs();return(0,I.endOfPeriodToBarTime)(t.barBuilder,e,t.intervalObj)}createAnchoredShape(e,t){const i=t.shape;if((0,_.isSupportedLineTool)(i)&&!0!==_.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 M(this._chartWidget.model().timeScale())}async loadChartTemplate(e){await(0,h.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=1,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()}studyMetaIntoRepository(){return(0,ce.studyMetaInfoRepository)()}replayStatus(){return this._chartWidget.model().model().replayStatus()}replayStudyStrategyProperties(){return this._chartWidget.model().model().replayStudyStrategyProperties()}insertStudyWithoutCheck(e,t,i,s){return this._chartWidget.model().insertStudyWithoutCheck(new me.StudyMetaInfo(e),t,i,s)}_destroy(){this._chartWidget.hasModel()&&(this._chartWidget.model().crossHairSource().moved().unsubscribeAll(this),this._chartWidget.model().timeScale().logicalRangeChanged().unsubscribe(this,this._onLogicalRangeChanged)),this._widgetLinkingGroupIndex.destroy()}_createTradingPrimitive(e,t){const i=this._chartWidget.model(),r=i.model(),n={pane:(0,s.ensureNotNull)(r.paneForSource(r.mainSeries())),point:(()=>{const e=(0,s.ensureNotNull)(i.mainSeries().bars().last());return{index:e.index,price:e.value[4]}})(),linetool:e};return(t?r.createLineTool(n):i.createLineTool(n)).adapter()}_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)}_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(e<c&&a===h.firstIndex){const t=(0,s.ensureNotNull)(i.syncModel()).distance(e,c);t.success&&(l.index=l.index-t.result)}if((0,R.isNumber)(t))l.price=t;else{const e=["open","high","low","close"];let t=o?e.indexOf(o)+1:1;t<=0&&(t=1),l.price=(0,s.ensure)((0,s.ensureNotNull)(n.valueAt(a))[t])}return l},c=[];for(let t=0;t<e.length;t++){const i=e[t];c.push(l(a[t],i.price,i.channel))}
return c}_convertTimeFromPublic(e){return this._getTimeConverter().convertPublicTimeToInternalTime(e)}_getTimeConverter(){const e=this._chartWidget.model().mainSeries();return(0,ge.getChartWidgetApiTimeConverter)(e.interval(),(0,s.ensureNotNull)(e.symbolInfo(),"main series symbol info"),this._chartWidget.model().model())}_onHoveredSourceChanged(e){const t=null!==e&&(0,ve.isPriceDataSource)(e)?e.id():null,i=this._prevHoveredSourceId;this._prevHoveredSourceId=t,t!==i&&this._dataSourceHovered.fire(t)}_onCrosshairMoved(e){var t,i;const s=this.chartModel().crossHairSource().pane;if(null===s)return;const r=this._chartWidget.offsetInDocument(s),n=this.chartModel().timeScale(),o=null===(t=s.mainDataSource())||void 0===t?void 0:t.priceScale(),a=n.indexToUserTime(e.index),l=this._convertIndexToPublicTime(e.index),c=n.indexToCoordinate(e.index),h=null==o?void 0:o.priceToCoordinate(e.price,(null===(i=s.mainDataSource())||void 0===i?void 0:i.firstValue())||0);if(void 0===c||void 0===h||null===a||null===l)return;const d={price:e.price,time:l,userTime:a.getTime()/1e3,entityValues:{},offsetX:c+r.left,offsetY:h+r.top},u=this.chartModel().priceDataSources();for(let e=0;e<u.length;e++){const t=u[e],i=t.dataWindowView();if(null===i)continue;i.update();const s=t===this.chartModel().hoveredSource(),r=i.items().filter((e=>e.visible()&&0!==e.title().length)).map((e=>({title:e.title(),value:e.value()})));d.entityValues[t.id()]={isHovered:s,values:r,title:i.header()}}this._crosshairMoved.fire(d)}_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 T.SessionInfo(t,i.session,i.session_holidays,i.corrections);return{barBuilder:(0,T.newBarBuilder)(r,n,n),intervalObj:P.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 ee(e,this._chartWidget),this._studies.set(e,t)),t}_getLineDataSourceApi(e){let t=this._lineDataSources.get(e);return void 0===t&&(t=new ne(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()||!P.Interval.isDWM(s)||null===r)return e;const n=(0,fe.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,R.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`)}}var Le=i(74047),ke=i(19475),De=i(97990),Ee=i(99531),Ve=i(42752);function Be(){throw new Error("not implemented")}class Re{constructor(e){this.linking=r.linking,this._studyTemplatesDrawer=null,this._fontIconsSettingsDrawer=null,this._favoriteDrawingsToolbar=null,this._webview=null,this._themesApi=null,this._newsApiDeferredPromise=null,this._newsApiRejectionReason=null,this._watchlistApiDeferredPromise=null,this._watchlistApiRejectionReason=null,this._widgetbarApiDeferredPromise=null,this._widgetbarApiRejectionReason=null,this._isDestroyed=!1,this._widgebarApi=null,this._chartWidgets=new WeakMap,this._layoutSettingsDrawer=null,this._magnetEnabledWatchedValue=null,this._magnetModeWatchedValue=null,this._drawOnAllCharts=(0,Ve.convertPropertyToWatchedValue)((0,m.drawOnAllCharts)()),this._replayApi=null,this._pineEditorApi=null,this._activateChart=e=>{this.setActiveChart(this._chartIndex(e))},this._toggleUnitConversionMenu=(e,t,i,r,o)=>{const a=this._chartWidgetCollection.getAll(),l=a.findIndex((e=>e.model().model().id()===i));if(-1===l)return;const c=(0,s.ensureDefined)(a[l]).paneWidgets().findIndex((e=>e.state().id()===r));-1!==c&&n.emit(e,t,l,c,o)};const{chartApiInstance:t,chartWidgetCollection:i,studyMarket:o,saveChartService:a,loadChartService:l,sharingChartService:c=null,webview:h=null,favoriteServices:d}=e;this._chartApiInstance=t,this._chartWidgetCollection=i,this._studyMarket=o,this._saveChartService=a,this._sharingChartService=c,this._loadChartLayoutDialog=l,this._favoriteServices=d,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=h;const u=new De.ChartChangesWatcher(this._chartWidgetCollection,window.saver,n);this._chartChangesWatcher=u,this._chartHasChanged=(0,Ee.createWVFromGetterAndSubscription)((()=>u.hasChanges()),u.getOnChange());const p=i.lock;this._symbolSync=p.symbol.spawn(),this._intervalSync=p.interval.spawn(),this._dateRangeSync=p.dateRange.spawn(),this._crosshairSync=p.crosshair.spawn(),this._timeSync=p.trackTime.spawn(),n.subscribe("toggle_currency_menu_inner",((e,t,i,s)=>this._toggleUnitConversionMenu("toggle_currency_menu",e,t,i,s)),this),n.subscribe("toggle_unit_menu_inner",((e,t,i,s)=>this._toggleUnitConversionMenu("toggle_unit_menu",e,t,i,s)),this)}destroy(){var e,t,i,s;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._drawOnAllCharts.destroy(),null===(s=this._pineEditorApi)||void 0===s||s.destroy(),this._isDestroyed=!0,(0,m.properties)().childs().magnet.unsubscribeAll(this),(0,m.properties)().childs().magnetMode.unsubscribeAll(this),n.unsubscribeAll("toggle_currency_menu_inner",this),n.unsubscribeAll("toggle_unit_menu_inner",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 Be(),this._webview}studyTemplatesDrawerApi(){Be()}fontIconsSettingsDrawer(){Be()}intervalsService(){Be()}supportedChartTypes(){return this._supportedChartStylesSpawn}setBrokerName(e){this._chartWidgetCollection.setBroker(e)}getDrawOnAllCharts(){return(0,m.drawOnAllCharts)().value()}drawOnAllCharts(e){return(0,m.drawOnAllCharts)().setValue(e)}drawOnAllChartsEnabled(){return this._drawOnAllCharts}getDrawOnAllChartsMode(){return(0,m.drawOnAllChartsMode)().value()}drawOnAllChartsMode(e){(0,m.drawOnAllChartsMode)().setValue(e)}currencies(){var e,t;return null!==(t=null===(e=this._chartApiInstance)||void 0===e?void 0:e.availableCurrencies())&&void 0!==t?t:Promise.reject()}units(){var e,t;return null!==(t=null===(e=this._chartApiInstance)||void 0===e?void 0:e.availableUnits())&&void 0!==t?t:Promise.reject()}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){Be()}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.chartsCount()){const t=this._chartWidgetCollection.getAll()[e];t&&(this._activeChartWidget().inFullscreen()?t.requestFullscreen():this._chartWidgetCollection.activeChartWidget.setValue(t))}}async replayApi(){throw new Error("Not implemented")}pineEditorApi(){throw new Error("Not implemented")}activeChartIndex(){return this._chartIndex(this._activeChartWidget())}chartsCount(){return l.layouts[this.layout()].count}layout(){return this._chartWidgetCollection.layout.value()}layoutName(){return this._chartWidgetCollection.metaInfo.name.value()}layoutNameWatchedValue(){return this._chartWidgetCollection.metaInfo.name.readonly()}async layoutSettingsDrawer(){throw new Error("not implemented")}setLayout(e,t){(null==t?void 0:t.withUndo)?this._chartWidgetCollection.setChartLayoutWithUndo(e):this._chartWidgetCollection.setLayout(e)}resetLayoutSizes(e){throw new Error("Unsupported. This API is only applicable to the Trading Edition of the library")}unloadUnusedCharts(){throw new Error("Unsupported. This API is only applicable to the Trading Edition of the library")}undoRedoState(){return this._chartWidgetCollection.undoHistory.state()}clearUndoHistory(){return this._chartWidgetCollection.undoHistory.clearStack()}undo(){this._chartWidgetCollection.undoHistory.undo()}redo(){this._chartWidgetCollection.undoHistory.redo()}async selectLineTool(e,t){if(!(0,_.isSupportedLineTool)(e))return;const i=_.supportedLineTools[e].name;if("icon"===e){const e=null==t?void 0:t.icon;void 0!==e&&m.iconTool.setValue(e)}if("emoji"===e){const e=null==t?void 0:t.emoji;void 0!==e&&m.emojiTool.setValue(e)}if("sticker"===e){const e=null==t?void 0:t.sticker;void 0!==e&&m.stickerTool.setValue(e)}m.tool.setValue(i)}favoriteDrawingsToolbar(){return i.e(5551).then(i.bind(i,17072)).then((e=>(this._favoriteDrawingsToolbar||(this._favoriteDrawingsToolbar=new e.FavoriteDrawingsApi),this._favoriteDrawingsToolbar)))}sharingChart(){return this._sharingChartService}watchlist(){Be()}setWatchlistApiPromise(e){Be()}news(){Be()}setNewsApiPromise(e){Be()}widgetbar(){Be()}setWidgetbarApiPromise(e){Be()}getChartStorage(){return getChartStorage()}setDebugMode(e){o.setEnabled("charting_library_debug_mode",e)}setFeatureEnabled(e,t){"chart_crosshair_menu"!==e?o.setEnabled(e,t):ke.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.allowSavingDefaults)(!0),(0,m.properties)().childs().magnet.setValue(e),(0,f.allowSavingDefaults)(!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.allowSavingDefaults)(!0),(0,m.properties)().childs().magnetMode.setValue(e),(0,f.allowSavingDefaults)(!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(){const e=Object.keys(S).concat(["LineToolAnchoredVWAP","LineToolRegressionTrend","LineToolAnchoredVolumeProfile","LineToolFixedRangeVolumeProfile","LineToolVbPFixed"]);return Promise.all(e.map((e=>(0,v.initLineTool)(e)))).then((()=>{}))}watermark(){{const e=Le.WatermarkApi.getInstance();if(!e.ready())throw new Error("Watermark API is not initialised yet.");return e}}setContextMenuOptions(e){Re.setContextMenuOptions(e)}changeSymbol(e,t,i){r.linking.interval.setValue((0,s.ensureNotNull)(P.Interval.normalize(t))),r.linking.setSymbolAndLogInitiator(e,"API"),i&&this.activeChart().onDataLoaded().subscribe(null,i,!0)}getFavoriteChartStylesService(){throw new Error("not implemented")}getFavoriteIntervalsService(){throw new Error("not implemented")}getFavoriteCurrencyUnitConversionApi(){throw new Error("not implemented")}getLinetoolsFavoritesStore(){throw new Error("not implemented")}getSavedCharts(e){Pe.backend.getCharts().then(e)}getSymbolInterval(e){const t={symbol:this.linking.proSymbol.value(),interval:this.linking.interval.value()};return null==e||e(t),t}hasChartChanges(){return this._chartHasChanged}loadChartFromServer(e){Pe.backend.loadChart(e)}removeChartFromServer(e,t){Pe.backend.removeChart(e).then(t)}saveChart(e,t){if(!this._saveChartService)return;const i=this._saveChartService.saveToJSON(t);return e&&e(JSON.parse(i.content))}saveChartToServer(e,t,i){this._saveChartService&&this._saveChartService.saveChartSilently(e,t,i)}autosave(){if(!this._saveChartService)throw new Error("Saving service is not available");return this._saveChartService.autoSaveEnabled()}setForceFullscreenMode(){Be()}setMultichartMode(){Be()}setDateRangeLinkingEnabled(e){this._chartWidgetCollection.lock.dateRange.setValue(e)}studyMetaIntoRepository(){return(0,ce.studyMetaInfoRepository)()}shouldBeSaved(){var e;return!this._chartWidgetCollection.readOnly()&&((null===(e=this._saveChartService)||void 0===e?void 0:e.hasChanges())||!1)}showLoadChartDialog(){var e;null===(e=this._loadChartLayoutDialog)||void 0===e||e.show()}persistentLogger(){return null}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 Ae(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()}}},25605:(e,t,i)=>{"use strict";var s=i(82992).linking,r=(i(14426).createDeferredPromise,i(76422)),n=i(40443).ContextMenuManager,o=i(928),a=i(10074),l=i(31955),c=i(3615).showWarning,h=i(3615).showConfirm,d=i(4711),u=i(52092).CLOSE_POPUPS_AND_DIALOGS_COMMAND,p=i(31601).TradingViewApiBase,_=i(68159).StudyMetaInfo,m=i(152).getStudyInputsInfo,g=i(70120).getStudyStylesInfo,f=i(52033).Delegate,v=i(64147).WatchedValue;e.exports=class extends p{constructor(e){const{chartWidgetCollection:t,saveChartService:i,loadChartService:s,sharingChartService:r,alertsServices:n,supportTicketData:o,favoriteServices:a,chartApiInstance:l=null,studyMarket:c=null,webview:h}=e;super({chartApiInstance:l,chartWidgetCollection:t,studyMarket:c,saveChartService:i,loadChartService:s,sharingChartService:r,webview:h,favoriteServices:a}),this._supportTicketData=o,this._proxyWatchListChangedDelegate=null,this._lockDrawingsWatchedValue=null,this._hideDrawingsWatchedValue=null,this._hideIndicatorsWatchedValue=null,this._getDataSourceHub=function(){return t.activeChartWidget.value().model().model()},this._alertService=n?new undefined(n.alertsDispatcher,this._getDataSourceHub,n.alertsFacadeChannelPushApi):null,this._activeChangedChangedDelegate=new f,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")}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=_.findStudyMetaInfoByDescription(this._chartApiInstance.allStudiesMetadata(),e);return m(t)}}getStudyStyles(e){{const t=_.findStudyMetaInfoByDescription(this._chartApiInstance.allStudiesMetadata(),e);return g(t)}}getIntervals(){var e=[],t=a.getCustomResolutions();return null!==this._chartApiInstance&&(e=this._chartApiInstance.defaultResolutions()),a.mergeResolutions(e,t)}closePopupsAndDialogs(){n.hideAll(),r.emit(u)}selectedLineTool(){for(var e=Object.keys(d.supportedLineTools),t=o.tool.value(),i=0;i<e.length;++i)if(d.supportedLineTools[e[i]].name===t)return e[i];return""}
lockAllDrawingTools(){return null===this._lockDrawingsWatchedValue&&(this._lockDrawingsWatchedValue=new v(o.lockDrawings().value()),this._lockDrawingsWatchedValue.subscribe((function(e){o.lockDrawings().setValue(e)})),o.lockDrawings().subscribe(this,(function(){this._lockDrawingsWatchedValue.setValue(o.lockDrawings().value())}))),this._lockDrawingsWatchedValue}hideAllDrawingTools(){return null===this._hideDrawingsWatchedValue&&(this._hideDrawingsWatchedValue=new v(o.hideAllDrawings().value()),this._hideDrawingsWatchedValue.subscribe((function(e){o.hideAllDrawings().setValue(e)})),o.hideAllDrawings().subscribe(this,(function(){this._hideDrawingsWatchedValue.setValue(o.hideAllDrawings().value())}))),this._hideDrawingsWatchedValue}hideAllIndicators(){return null===this._hideIndicatorsWatchedValue&&(this._hideIndicatorsWatchedValue=new v(o.hideAllIndicators().value()),this._hideIndicatorsWatchedValue.subscribe((function(e){o.hideAllIndicators().setValue(e)})),o.hideAllIndicators().subscribe(this,(function(){this._hideIndicatorsWatchedValue.setValue(o.hideAllIndicators().value())}))),this._hideIndicatorsWatchedValue}mainSeriesPriceFormatter(){return this._chartWidgetCollection.activeChartWidget.value().model().mainSeries().priceScale().formatter()}showNoticeDialog(e){c({title:(e=e||{}).title,text:e.body||"",onClose:e.callback})}showConfirmDialog(e){if(!(e=e||{}).callback)throw Error("callback must be exist");var t=e.callback;function i(e){t&&(t(e),t=null)}h({title:e.title,text:e.body||"",onClose:function(){i(!1)},onConfirm:function(e){i(!0),e.dialogClose()}})}logs(){return{getLogHistory:l.getLogHistory,enable:l.loggingOn,disable:l.loggingOff}}showSaveAsChartDialog(){var e=this._saveChartService;e&&window.runOrSignIn((function(){e.saveChartAs()}),{source:"Save as chart dialogue"})}trading(){throw new Error("Not implemented")}waitTrading(){throw new Error("Not implemented")}symbolSearch(){throw new Error("Not implemented")}saveChartOrShowTitleDialog(e,t,i){throw new Error("Not implemented")}showRenameChartDialog(){throw new Error("Not implemented")}setUserInfo(e){throw new Error("Not implemented")}connect(){throw new Error("Not implemented")}disconnect(){throw new Error("Not implemented")}loginRequired(){throw new Error("Not implemented")}onConnectionStatusChanged(e){throw new Error("Not implemented")}isConnected(){throw new Error("Not implemented")}showCreateAlertDialog(){throw new Error("Not implemented")}alertService(){throw new Error("Not implemented")}publishChart(e){throw new Error("Not implemented")}setPublishChartOptions(e){throw new Error("Not implemented")}showSupportDialog(){throw new Error("Not implemented")}openMobileChartPicker(){throw new Error("Not implemented")}closeMobileChartPicker(){throw new Error("Not implemented")}takeScreenshot(){return this._chartWidgetCollection.takeScreenshot()}setIntervalLinkingEnabled(e){this._chartWidgetCollection.lock.interval.setValue(e)}setTimeFrame(e){this._chartWidgetCollection.setTimeFrame(e)}startFullscreen(){return this._chartWidgetCollection.startFullscreen()}
exitFullscreen(){return this._chartWidgetCollection.exitFullscreen()}takeClientScreenshot(e){return this._chartWidgetCollection.clientSnapshot(e)}supportTicketData(){return this._supportTicketData}createGoProDialog(e){throw new Error("Not implemented")}onGoProDialog(e,t){throw new Error("Not implemented")}}},74047:(e,t,i)=>{"use strict";i.d(t,{WatermarkApi:()=>o});var s=i(50151),r=i(42752),n=i(96001);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},96e3:(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}}},19475:(e,t,i)=>{"use strict";i.d(t,{addPlusButtonProperty:()=>_,restoreAddPlusButtonSettingsValue:()=>m,showPlusButtonOnCursor:()=>d});var s=i(4741),r=i(56570),n=i(56840),o=i(17625),a=i(64147);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"))}))},92934:(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()}},12974:(e,t,i)=>{"use strict";i.d(t,{AppliedTimeFrame:()=>r});var s=i(91676);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)}}},77007:(e,t,i)=>{"use strict";i.d(t,{defaultsPreferencesByWhiteList:()=>x,preferencesByWhiteList:()=>P});var s=i(37265),r=i(91140),n=i(20596),o=i(31955),a=i(94164),l=i(35039),c=i(6290),h=i(31054),d=i(46088);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})},y={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)},S={priceScaleSelectionStrategyName:"auto",timeScale:(0,h.deepExtend)({},{defaultRightOffset:0,defaultRightOffsetPercentage:5,usePercentageRightOffset:!1}),mainSeries:(0,h.deepExtend)({},y),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),...S},w={scalesProperties:(0,h.deepExtend)({},g),...S};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){var s;const r={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:{}},n=["timeScale","mainSeries","sessions"],o=i.mainSeries,a=Object.keys(i),l=Object.keys(o),c=t.properties(),h=e.properties(),d=i.sessions,u=Object.keys(d);l.forEach((e=>{
r.mainSeries[e]=C(e,c,o,"mainSeries")}));const p=null===(s=e.sessions().state())||void 0===s?void 0:s.properties;return p&&u.forEach((e=>{r.sessions[e]=C(e,p,d,"sessions",!1)})),a.forEach((e=>{n.includes(e)||(r[e]=C(e,h,i,"preferences"))})),r}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}},92158:(e,t,i)=>{"use strict";i.d(t,{actualAutoLogButtonsVisibility:()=>l,autoLogButtonsVisibilityOptions:()=>o,autoLogButtonsVisibilityProperty:()=>n,restoreAutoLogButtonsVisibilitySettingsValue:()=>a});var s,r=i(17656);!function(e){e.SettingsKey="PriceAxisAutoLogButtons.visibility"}(s||(s={}));const{property:n,availableValues:o,restoreDefaultValue:a,actualBehavior:l}=(0,r.createVisibilityController)("PriceAxisAutoLogButtons.visibility")},57596:(e,t,i)=>{"use strict";i.d(t,{axisLabelBackgroundColor:()=>r});var s=i(19625);const r={common:s.colorsPalette["color-tv-blue-500"],active:s.colorsPalette["color-tv-blue-800"]};var n;!function(e){e.BorderColor="#2E84A6"}(n||(n={}))},53388:(e,t,i)=>{"use strict";i.d(t,{createDwmAligner:()=>c,createTimeToBarTimeAligner:()=>d,isAlignmentEnabled:()=>h});var s=i(2740),r=i(56570),n=i(85049),o=i(42217),a=i(14381);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)}},42217:(e,t,i)=>{"use strict";i.d(t,{BarBuilderBase:()=>a,SessionInfo:()=>o});var s=i(2740),r=i(83910),n=i(69748);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)}}},14381:(e,t,i)=>{"use strict";i.r(t),i.d(t,{SessionInfo:()=>o.SessionInfo,alignExchangeTimeToSessionStartAndReturnUTC:()=>T,alignPeriodsBackForDataRequest:()=>w,alignPeriodsBackForVisibleRange:()=>C,getPeriodsBetweenDates:()=>x,isTradingNow:()=>I,newBarBuilder:()=>b});var s=i(2740),r=i(85049),n=i(9859),o=i(42217),a=i(83910);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._sessionStartMs?a.SessionStage.PRE_SESSION: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,h,d=i(79324);function u(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 p 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 d.BusinessDay(0,0,0),this._periodEndDay=new d.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=d.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._periodStart?a.SessionStage.PRE_SESSION: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=u(o,l);const c=s.clone(l),h=o.businessDaysToCalendarDays(c,1);h>1&&s.add_date(c,h-1),this._periodStartDay=d.BusinessDay.fromCalendar(c);const p=this._builder.startOfPeriod(a,n,i);this._periodEnd=u(o,p);const _=s.clone(p);for(s.add_date(_,-1);o.isCalWeekEnd(_);)s.add_date(_,-1);this._periodEndDay=d.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=u(o,p),(this._periodLastBarStart<this._periodStart||this._periodLastBarStart===this._periodEnd)&&(this._periodLastBarStart=this._periodStart)}endOfBar(e){if(0!==e)throw new Error("index should be 0");return this._periodEnd}isLastBar(e,t){if(0!==e)throw new Error("index should be 0");return t>=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=u(this._sessionTgt.spec,a);return a=s.get_cal_from_unix_timestamp_ms(s.get_timezone("Etc/UTC"),l),i<s.get_year(a)?(a=this._builder.startOfPeriod(o,r-1,i),l=u(this._sessionTgt.spec,a),{index:(r-1)/this._period,time:l}):{index:(0,n.toInt)(r/this._period),time:l}}sessionSrc(){return this._sessionSrc}_indexOfPeriodInYear(e){const t=this._builder.indexOfPeriod(e);let i=(0,n.toInt)(t/this._period)*this._period;return-1===t&&(i=-this._period),i}}function _(e,t){const i=s.get_day_of_week(t)-e.firstDayOfWeek();return i<0?i+7:i}function m(e,t){const i=s.get_day_of_year(t)-1;let r=_(e,t)-i%7;return 0===r?(0,n.toInt)(i/7):(r>=0&&(r-=7),(0,n.toInt)((r+i)/7))}class g{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 f extends g{constructor(e){super(),this._sessionsSpec=e}indexOfPeriod(e){return super.indexOfPeriod(e)-function(e,t){const i=m(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 i<s.get_year(a)&&(c+=l),super.startOfPeriod(e,c,i)}}class v{constructor(e){this._builder=null,this._initialized=!1,this._session=e}indexOfPeriod(e){return this._getBuilder().indexOfPeriod(e)}startOfPeriod(e,t,i){return this._getBuilder().startOfPeriod(e,t,i)}_getBuilder(){return null!==this._builder&&this._initialized||(this._builder=this._session.spec.hasWeekEnds()?new f(this._session.spec):new g,this._initialized=!0),this._builder}}class y{constructor(e){this._session=e}indexOfPeriod(e){let t=m(this._session.spec,e);if(0===t){const i=s.get_timezone(this._session.spec.timezone());e<this.startOfPeriod(i,0,s.get_year(e))&&(t=-1)}return t}startOfPeriod(e,t,i){if(t<0){i--;const r=s.get_cal(s.get_timezone("Etc/UTC"),i,s.DECEMBER,31,23,59,59),o=this.indexOfPeriod(r),a=-1*t,l=(0,n.toInt)(o/a)*a;return this.startOfPeriod(e,l,i)}const r=s.get_cal(s.get_timezone("Etc/UTC"),i,s.JANUARY,1),o=_(this._session.spec,r),a=0===o?7*t:7*(t+1)-o;return a>s.get_days_per_year(r)?this.startOfPeriod(e,0,i+1):(s.add_date(r,a),r)}}class S{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 b(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 p(t,i,o,function(e,t){switch(e){case r.ResolutionKind.Days:return new v(t);case r.ResolutionKind.Weeks:return new y(t);case r.ResolutionKind.Months:return new S}throw new Error(`Unknown dwm resolution: ${e}`)}(n.kind(),t),s)}function w(e,t,i,s,r,n,o){return P(e,t,i,s,r,n,o,0)}function C(e,t,i,s,r,n,o){return P(e,t,i,s,r,n,o,1)}function P(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){M(e,Math.floor(t/12));let i=e.getUTCMonth()-t%12;i<0&&(M(e,1),i+=12);e.setUTCMonth(i);for(;e.getUTCMonth()!==i;)A(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<f)v=a/g;else{v=7*(a/f)}return p&&(v=Math.floor(v)),l-864e5*v}function x(e,t,i,s,n,a,l){const c=r.Interval.parse(n+s);if(c.isMonths()){const e=new Date(a),t=new Date(l);let i=12*(t.getUTCFullYear()-e.getUTCFullYear());return i+=t.getUTCMonth()-e.getUTCMonth(),Math.ceil(i/c.multiplier())}const h=new o.SessionInfo("Etc/UTC",e,t,i),d=c.inMilliseconds();let u;u=c.isDWM()?864e5:60*h.spec.maxTradingDayLength()*1e3;let p=0;p=c.isWeeks()?7:7-h.spec.weekEndsCount()
;const _=l-a,m=u/d,g=p*m;let f=_/864e5*m;f>=g&&(f=_/6048e5*g);return f%1<=Number.EPSILON*Math.ceil(f)?Math.round(f):Math.ceil(f)}function T(e,t){const i=s.clone(t);return e.alignToSessionStart(i),s.cal_to_utc(s.get_timezone(e.timezone()),i)}function I(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<o.startOffset()+o.length()}function M(e,t){const i=e.getUTCMonth();e.setUTCFullYear(e.getUTCFullYear()-t),e.getUTCMonth()!==i&&A(e,1)}function A(e,t){e.setTime(e.getTime()-864e5*t)}!function(e){e[e.AlignToFirstDay=0]="AlignToFirstDay",e[e.AlignToClosestDay=1]="AlignToClosestDay"}(c||(c={})),function(e){e[e.D=864e5]="D",e[e.W=6048e5]="W"}(h||(h={}))},79324:(e,t,i)=>{"use strict";i.d(t,{BusinessDay:()=>r});var s=i(2740);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))}}},83910:(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={}))},40644:(e,t,i)=>{"use strict";i.d(t,{extrapolateBarsFrontByCount:()=>n,extrapolateBarsFrontToTime:()=>r});var s=i(83910);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}}},69748:(e,t,i)=>{
"use strict";i.d(t,{SessionSpec:()=>y});var s,r=i(2740),n=i(29981),o=i(79324);function a(e,t){return e.compareTo(t)}!function(e){e[e.LeftFirst=-1]="LeftFirst",e[e.Unchanged=0]="Unchanged",e[e.RightFirst=1]="RightFirst"}(s||(s={}));class l{constructor(e,t,i){this._dayOfWeek=e,this._start=t,this._length=i}start(){return this._start+r.minutesPerDay*this.sessionStartDaysOffset()}startOffset(){return this._start}sessionStartDaysOffset(){return this._start>=0?0:this._start%r.minutesPerDay==0?-Math.ceil(this._start/r.minutesPerDay):-Math.floor(this._start/r.minutesPerDay)}sessionEndDaysOffset(){const e=this._start+this._length;return e>=0?0:e%r.minutesPerDay==0?-Math.ceil(e/r.minutesPerDay):-Math.floor(e/r.minutesPerDay)}isOvernight(){return this._start<0}dayOfWeek(){return this._dayOfWeek}sessionStartDayOfWeek(){let e=this._dayOfWeek-this.sessionStartDaysOffset();return e<r.SUNDAY&&(e+=7),e}sessionEndDayOfWeek(){let e=this.sessionStartDayOfWeek()+this.sessionEndDaysOffset();return e>r.SATURDAY&&(e=1),e}length(){return this._length}weight(){return this._dayOfWeek*r.minutesPerDay+this._start}compareTo(e){const t=this.weight(),i=t+this._length,s=e.weight(),r=s+e._length;return t<=s&&s<i||s<=t&&t<r?0:t>s?1:-1}contains(e){const t=60*r.get_hours(e)+r.get_minutes(e);let i=r.get_day_of_week(e)-this._dayOfWeek;i>0&&(i-=7);const s=i*r.minutesPerDay+t;return s>=this._start&&s<this._start+this._length}}class c{constructor(e,t,i){this.weekIndex=e,this.entryIndex=t,this.entries=i}getEntry(){return this.entries[this.entryIndex]}}var h=i(12168);const d=[r.MONDAY,r.TUESDAY,r.WEDNESDAY,r.THURSDAY,r.FRIDAY],u=[r.SUNDAY,r.MONDAY,r.TUESDAY,r.WEDNESDAY,r.THURSDAY,r.FRIDAY,r.SATURDAY],p=(0,h.getLogger)("Chart.Model.SessionSpec");function _(e){return e>=48&&e<=57}class m{constructor(){this.entries=[],this.firstDayOfWeek=r.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 u)this.entries.push(m._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,p.logError(`Bad session section: ${i}`);continue}const n=1===r.length;if(n){if(e){s=!0,p.logError(`Duplicated default section: ${i}`);continue}e=!0}const o=n?d:m._parseWorkingDays(r[1]);for(const e of o)n&&t.has(e)||t.set(e,r[0])}for(const e of u){const i=t.get(e);if(void 0!==i)for(const t of i.split(",")){const{hasErrors:i,sessionEntry:r}=m._parseSessionEntry(e,t);i&&(s=i),this.entries.push(r)}}}this.entries.sort(a);const o=new Map;for(const e of this.entries){const t=e.dayOfWeek();o.set(t,e.length()+(null!==(i=o.get(t))&&void 0!==i?i:0))}return this.maxTradingDayLength=0,o.forEach((e=>{this.maxTradingDayLength=Math.max(this.maxTradingDayLength,e)})),this.weekEndsCount=7-o.size,s||r}static parseHolidaysAndCorrections(e,t,i){const s=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);s.set(t,e)}}if(""===i)return s;const a=r.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=r.get_day_of_week(r.get_cal(a,t.year,t.month-1,t.day)),c=[];for(const e of i)c.push(new l(n,e.startOffset(),e.length()));s.set(t,c)}}return s}_clear(){this.entries=[],this.timezone="",this.firstDayOfWeek=r.MONDAY,this.weekEndsCount=-1}_parseFirstDayOfWeek(e){const t=e.split(";");if(t.length>2)return p.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 s=t[0].indexOf("-")>=0?NaN:parseInt(t[0]);return isNaN(s)&&(i=0,s=parseInt(t[1])),s<r.SUNDAY||s>r.SATURDAY?(p.logError(`Unexpected day index @ session: ${e}; day index ${s}`),{hasErrors:!0,spec:e}):(this.firstDayOfWeek=s,{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 o.BusinessDay(t,i,s)}static _parseSessionEntry(e,t){let i=!1,s=t.split("-");2!==s.length&&(i=!0,p.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,m._minutesFromHHMM(l),m._minutesFromHHMM(c),r,o)}}static _isCorrectSession(e){return 4===e.length&&_(e.charCodeAt(0))&&_(e.charCodeAt(1))&&_(e.charCodeAt(2))&&_(e.charCodeAt(3))}static _parseWorkingDays(e){const t=[];for(let i=0;i<e.length;i++){const s=+e[i];-1===t.indexOf(s)&&t.push(s)}return t}static _minutesFromHHMM(e){return r.get_minutes_from_hhmm(e)}static _createSessionEntry(e,t,i,s,n){0===i&&(i=r.minutesPerDay),s===n&&i<=t&&(s+=1),s>0&&(t-=s*r.minutesPerDay),n>0&&(i-=n*r.minutesPerDay);return new l(e,t,i-t)}}function g(e,t){return e.compareTo(t)<0}function f(e,t){const i=(0,n.lowerbound)(e,t,((e,t)=>-1===e.day.compareTo(t)));return i===e.length?null:e[i]}const v=621672192e5;class y{constructor(e="Etc/UTC",t="0000-0000",i="",s=""){this._entries=[],this._firstDayOfWeek=r.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 m;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=m.parseHolidaysAndCorrections(e,i,s),a=r.get_timezone(e);this._isThereCorrections=""!==i||""!==s,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,s,n){0===i&&(i=r.minutesPerDay),s===n&&i<=t&&(s+=1),s>0&&(t-=s*r.minutesPerDay),n>0&&(i-=n*r.minutesPerDay);const o=i-t;this._entries.push(new l(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,n.lowerbound)(this._entries,new l(e,0,0),((e,t)=>e.dayOfWeek()<t.dayOfWeek()));return t>this._entries.length-1||this._entries[t].dayOfWeek()!==e}isCalWeekEnd(e){const t=r.get_day_of_week(e);if(!this._isThereCorrections)return this.isWeekEnd(t);const i=o.BusinessDay.fromCalendar(e),s=this._holidayAndCorrectionMap.get(i.toString());return void 0===s?this.isWeekEnd(t):0===s.length}hasWeekEnds(){return this.weekEndsCount()>0}weekEndsCount(){return this._weekEndsCount}maxTradingDayLength(){return this._maxTradingDayLength}holidaysFromYearStart(e){if(!this._isThereCorrections)return 0;const t=r.get_timezone(this._timezone),i=new o.BusinessDay(r.get_year(e),r.JANUARY,1),s=o.BusinessDay.fromCalendar(e);let n=0;const a=this._selectHolidays(i,s);for(let e=0;e<a.length;e++){const i=a[e].day.toCalendar(t);this.isWeekEnd(r.get_day_of_week(i))?n+=0===a[e].sessions.length?0:-1:n+=0===a[e].sessions.length?1:0}return n}intradayCanBeBuiltFrom24x7(e){return this._entries.every((t=>t.start()%e==0&&t.length()%e==0))}indexOfSession(e,t,i){const s=this._getEntriesForWeek(e);let o=(0,n.lowerbound)(s,new l(t,i,0),g);if(o!==s.length)return new c(e,o,s);let a=e;const h=7-t+this._firstDayOfWeek-1;for(i=-(r.minutesPerDay-i+h*r.minutesPerDay);;){a++;const e=this._getEntriesForWeek(a);if(0!==e.length)return o=(0,n.lowerbound)(e,new l(this._firstDayOfWeek,i,0),g),new c(a,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 c(r.weekIndex,o,n)}getWeekIndex(e){if(!this._isThereCorrections)return 0;const t=r.get_day_of_week(e)-r.SUNDAY,i=r.get_timezone("Etc/UTC"),s=r.get_cal(i,r.get_year(e),r.get_month(e),r.get_day_of_month(e)-t);return Math.floor((s.getTime()+v)/1e3/86400/7)}correctTradingDay(e){const t=r.get_day_of_week(e),i=60*r.get_hours(e)+r.get_minutes(e),s=this.getWeekIndex(e),n=this.findSession(s,t,i,0),o=n.getEntry().dayOfWeek()-t+7*(n.weekIndex-s);return 0!==o&&r.add_date(e,o),e}alignToSessionStart(e,t=0){
const i=r.get_day_of_week(e),s=60*r.get_hours(e)+r.get_minutes(e),n=this.getWeekIndex(e),o=this.findSession(n,i,s,t),a=o.getEntry(),l=a.dayOfWeek()-i+7*(o.weekIndex-n);0!==l&&r.add_date(e,l);const c=a.startOffset();return r.set_hms(e,c/60,c%60,0,0,r.get_timezone(this._timezone)),a.length()}businessDaysToCalendarDays(e,t){let i=this.getWeekIndex(e),s=r.get_day_of_week(e),n=0,o=0;for(;o<t;){const e=this._getEntriesForWeek(i);let a=0;for(let i=s;i<=r.SATURDAY;i++){n++;let s=!0;for(;a<e.length&&!(e[a].dayOfWeek()>i);)e[a].dayOfWeek()<i||s&&(s=!1,o++),a++;if(o>=t)return n}i++,s=r.SUNDAY}return n}calendarDaysToBusinessDays(e,t){let i=this.getWeekIndex(e),s=r.get_day_of_week(e),n=0,o=0;for(;n<t;){const e=this._getEntriesForWeek(i);let a=0;for(let i=s;i<=r.SATURDAY;i++){n++;let s=!0;for(;a<e.length&&!(e[a].dayOfWeek()>i);)e[a].dayOfWeek()<i||s&&(s=!1,o++),a++;if(n>=t)return o}i++,s=r.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(a),this._getLeftEntryBorder(e,t[0]))}bordersOfDailyBar(e){const t=this._getEntriesForDay(e);if(0===t.length)return null;t.sort(a);const i=this._getLeftEntryBorder(e,t[0]),s=t[t.length-1],n=r.clone(e);let o=60*(s.startOffset()+s.length())-1;const l=Math.floor(o/3600);return o-=3600*l,r.set_hms(n,l,o/60,o%60,0,r.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=r.get_timezone(this._timezone);t=this._entries.slice();const s=this._weekIndexToCalendar(e),n=this._weekIndexToCalendar(e+1),l=o.BusinessDay.fromCalendar(s),c=o.BusinessDay.fromCalendar(n),h=this._selectHolidays(l,c);for(const e of h){const s=e.day.toCalendar(i),n=r.get_day_of_week(s);t=t.filter((e=>e.dayOfWeek()!==n)),t=t.concat(e.sessions)}return t.sort(a),this._entriesHash.set(e,t),t}_selectHolidays(e,t){const i=[];let s=e;for(;;){const e=f(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)-v,i=r.get_cal_from_unix_timestamp_ms(r.get_timezone("Etc/UTC"),t),s=r.get_timezone("Etc/UTC");return r.get_cal(s,r.get_year(i),r.get_month(i),r.get_day_of_month(i))}_alignToNearestSessionValue(e,t,i){const s=r.get_day_of_week(e),n=60*r.get_hours(e)+r.get_minutes(e),o=this.getWeekIndex(e);let a=this.findSession(o,s,n);if(a.getEntry().contains(e)&&o===a.weekIndex||1===t)return i(a,r.clone(e),t);const l=a.getEntry(),h=l.contains(e),d=o===a.weekIndex,u=l.sessionStartDaysOffset()-l.dayOfWeek()>=0;if(h&&(d||u))return i(a,r.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 c(e,p,t)
}else a=new c(a.weekIndex,p,a.entries);return i(a,r.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,s){let n=r.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(a<r.SUNDAY&&(c<=0?h=!0:c--,a+=7),(c>0&&i>=0||c<0&&i<0)&&r.add_date(t,7*c),!o.contains(t)){let e=a-n;h&&i<0&&(e=-(7-a+n)),r.add_date(t,e),n=r.get_day_of_week(t)}o.isOvernight()&&n===o.dayOfWeek()&&r.add_date(t,-o.sessionStartDaysOffset());let d=s(o);const u=Math.floor(d/3600);return d-=3600*u,r.set_hms(t,u,d/60,d%60,0,r.get_timezone(this._timezone)),t}_getEntriesForDay(e){const t=r.get_day_of_week(e);return this._getEntriesForWeek(this.getWeekIndex(e)).filter((e=>e.dayOfWeek()===t))}_getLeftEntryBorder(e,t){const i=r.clone(e),s=t.startOffset();return r.set_hms(i,s/60,s%60,0,0,r.get_timezone(this._timezone)),i}}},15716:(e,t,i)=>{"use strict";i.d(t,{barFunctionByStyle:()=>r});var s=i(3070);function r(e,t){switch(e){case 12:return(0,s.barFunction)("low","low","close");case 2:case 18:case 20: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")}}},41925:(e,t,i)=>{"use strict";i.d(t,{BarsMarksContainer:()=>g});var s=i(50151),r=i(31955),n=i(56840),o=i.n(n),a=i(56570),l=i(85049),c=i(37265),h=i(68805),d=i(29137),u=i(44672);const p=(0,r.getLogger)("Chart.BarsMarksContainer"),_=Math.round(new Date(2037,0,1).getTime()/1e3);var m;!function(e){e[e.MaxPlatesPerBar=10]="MaxPlatesPerBar"}(m||(m={}));class g 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()<n))return{start:0,end:0};let o;o=i.lastBar()<n?this.timeScale().indexToTimePoint(i.lastBar()):_;const a={start:this.timeScale().indexToTimePoint(Math.max(i.firstBar(),r)),end:o};return{start:null!==(e=a.start)&&void 0!==e?e:1/0,end:null!==(t=a.end)&&void 0!==t?t:-1/0}}getVisibleRangePlates(){const e=[],t=this.getVisibleTickMarksRange(),i=this.getIntervalInTicks();return Object.keys(this._marks).forEach((s=>{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;e<o.length;e++)o[e].user__id===(null===(i=u[0])||void 0===i?void 0:i.user__id)&&(o[e].highlightByAuthor=!0);return d.sort(((e,t)=>e.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.start<this._loadedRange.start?e.end=this._loadedRange.start:e.end>this._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}}},91988:(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)}}},93815:(e,t,i)=>{"use strict";i.d(t,{ChartModelBase:()=>Rs});var s=i(12481),r=i(43370),n=i(27788),o=i(50151),a=i(86441),l=i(24377),c=i(19625),h=i(11542),d=i(45345),u=i(85662),p=i(51768),_=i(14426),m=i(76422),g=i(11417),f=i(91140),v=i(66666),y=i(29981),S=i(630);function b(e){return(0,S.isLineTool)(e)&&e.boundToSymbol()||!1}class w{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&&!b(this._items[0])&&this.clear(),b(e)){const t=(0,y.lowerbound)(this._items,e,((e,t)=>e.zorder()<t.zorder()));this._items.splice(t,0,e)}else this.clear(),this._items=[e];this._set.add(e),this._invalidateCache()}canBeAddedToSelection(e){return 0===this._items.length||b(this._items[0])&&b(e)}isSelected(e){return this._set.has(e)}allSources(){return this._items.slice(0)}dataSources(){return null===this._dataSourcesCache&&(this._dataSourcesCache=this._items.filter(v.isDataSource)),this._dataSourcesCache}lineDataSources(){return null===this._lineSourcesCache&&(this._lineSourcesCache=this._items.filter(S.isLineTool)),this._lineSourcesCache}customSources(){return null===this._customSourcesCache&&(this._customSourcesCache=this._items.filter((e=>!(0,v.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 C,P,x=i(65383),T=i(21239),I=i(67317),M=i(85049),A=i(55917),L=i(12988),k=i(68979),D=i(15938);!function(e){e[e.BorderSize=1]="BorderSize"}(C||(C={})),function(e){e[e.AdditionalInnerPadding=4]="AdditionalInnerPadding",e[e.HorzPadding=4]="HorzPadding",e[e.VertPadding=2.5]="VertPadding",e[e.LineSpacing=2]="LineSpacing"}(P||(P={}));class E{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,k.makeFont)(i,D.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 V=i(16638);class B extends class{constructor(e,t){this._destroyed=!1,this._callbacks=[],this._resource={pendingResource:e},e.then((e=>{var t;if(this._destroyed)null===(t=this._destroyFn)||void 0===t||t.call(this,e);else{for(const t of this._callbacks)t(e);this._resource.resource=e}})).finally((()=>{this._callbacks=[]}))}destroy(){var e;this._resource.resource&&(null===(e=this._destroyFn)||void 0===e||e.call(this,this._resource.resource)),this._resource={pendingResource:Promise.reject("Resource is destroyed").catch((()=>{}))},this._callbacks=[],this._destroyed=!0}callFunction(e){this._destroyed||(this._resource.resource?e(this._resource.resource):this._callbacks.push(e))}get(){
return this._destroyed||!this._resource.resource?null:this._resource.resource}promise(){return this._resource.pendingResource}}{constructor(e){super(e,(e=>e.destroy())),this._sessionsState=null,e.then((()=>{if(!this._destroyed&&this._sessionsState){const{state:e,includeData:t}=this._sessionsState;this.restoreState(e,t),this._sessionsState=null}}))}state(e){var t,i,s,r;return null!==(r=null!==(i=null===(t=this.get())||void 0===t?void 0:t.state(e))&&void 0!==i?i:null===(s=this._sessionsState)||void 0===s?void 0:s.state)&&void 0!==r?r:null}restoreState(e,t){const i=this.get();i?(e&&i.restoreState(e,t),this._sessionsState=null):this._sessionsState=e?{state:e,includeData:t}:null}}var R=i(72708),N=i(52033),O=i(64147),F=i(91676),W=i(62288),H=i(50788),z=i(92158),U=i(96001),j=i(35039),G=i(29137),q=i(22365),$=i(24708),K=i(75919),Y=i(2844);class Z extends K.MediaCoordinatesPaneRenderer{constructor(){super(...arguments),this._data=null,this._widthCache=new Y.TextWidthCache}setData(e){this._data=e}hitTest(e){return null}_drawImpl(e){if(!this._data)return;const{lines:t,color:i}=this._data,{context:s,mediaSize:{width:r,height:n}}=e;s.fillStyle=i;let o=0;const a=[];for(const e of t){if(!e.text)continue;s.font=e.font;const t=this._widthCache.measureText(s,e.text),i=t>r?r/t:1;a.push(i),o+=e.lineHeight*i}let l=Math.max((n-o)/2,0),c=-1;for(const e of t){if(!e.text)continue;c+=1;const t=a[c];s.save(),s.translate(r/2,l),s.textBaseline="top",s.textAlign="center",s.font=e.font,s.scale(t,t),s.fillText(e.text,0,e.vertOffset),s.restore(),l+=e.lineHeight*t}}}class X{constructor(e,t){this._renderer=new Z,this._invalidated=!0,this._model=e,this._watermark=t}update(){this._invalidated=!0}renderer(){return this._invalidated&&this._updateImpl(),this._renderer}_updateImpl(){const e=this._watermark.properties().childs(),t=this._model.mainSeries(),i=t.symbolInfo();if(!i||!e.visibility.value())return void this._renderer.setData(null);let s;{const e=this._model.watermarkContentProvider(),r=e?e({symbolInfo:i,interval:t.interval()}):null;s=r?r.map((e=>({text:e.text,font:(0,k.makeFont)(e.fontSize,D.CHART_FONT_FAMILY),lineHeight:e.lineHeight,vertOffset:e.vertOffset}))):null}let r=i.name;if(/QUANDL/.test(i.exchange)){const e=r.split(/\//);e.length&&(r=e[e.length-1])}const n={description:i.description,short_description:i.short_description,pro_name:i.pro_name,short_name:i.name,local_description:i.local_description,language:i.language},o=s||[{text:r?`${r}, ${(0,$.translatedIntervalString)(t.interval())}`:"",font:(0,k.makeFont)(96,D.CHART_FONT_FAMILY),lineHeight:117,vertOffset:0},{text:(0,q.getTranslatedSymbolDescription)(n)||"",font:(0,k.makeFont)(48,D.CHART_FONT_FAMILY),lineHeight:58,vertOffset:5}];this._renderer.setData({color:e.color.value(),lines:o})}}const J="symbolWatermark";class Q extends G.DataSource{constructor(e){super(),this._properties=(0,U.watermarkProperty)(),(0,j.applyDefaultsOverrides)(this._properties,void 0,!1,J),this._properties.subscribe(this,(()=>e.updateSource(this))),this._paneView=new X(e,this)}destroy(){
this._properties.unsubscribeAll(this),super.destroy()}name(){return"watermark"}properties(){return this._properties}restorePropertiesDefaults(){(0,U.restoreWatermarkPropertyDefaults)()}applyOverrides(e){(0,j.applyPropertiesOverrides)(this._properties,void 0,!1,e,J)}paneViews(){return[this._paneView]}updateAllViews(e){super.updateAllViews(e),this._paneView.update()}}var ee,te=i(56570),ie=i(31955),se=i(92184),re=i(18112),ne=i(34391),oe=i(68159),ae=i(37265),le=i(56991),ce=i(45579),he=i(2718);function de(e,t,i){return i.hasDataSource(t)?_e(t,i)===e:!!i.isMainPane()&&_e(i.model().mainSeries(),i)===e}!function(e){e.Trading="trading",e.Drawing="drawing",e.DrawingForAllSymbols="drawingsForAllSymbols",e.Phantom="phantom",e.RestRowSources="restRowSources",e.LegendViewSources="legendViewSources",e.LeftPriceScale="leftPriceScale",e.RightPriceScale="rightPriceScale",e.OverlayPriceScale="overlayPriceScale",e.MultipaneSources="multipane",e.AllWithoutMultipane="allWithoutMultipane",e.HitTest="hitTest",e.General="general",e.Price="price",e.ExceptSpecial="exceptSpecial",e.AllSorted="allSorted",e.VisibleSorted="visibleSorted"}(ee||(ee={}));const ue=new Map([["price",e=>(0,ce.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,t)=>t.hasDataSource(e)&&((0,ce.isPriceDataSource)(e)||(0,S.isStudyLineTool)(e))],["leftPriceScale",de.bind(null,"left")],["rightPriceScale",de.bind(null,"right")],["overlayPriceScale",de.bind(null,"overlay")],["multipane",(e,t)=>!t.hasDataSource(e)],["allWithoutMultipane",(e,t)=>t.hasDataSource(e)]]),pe=new Map([["price","visibleSorted"],["trading","visibleSorted"],["drawing","visibleSorted"],["drawingsForAllSymbols","allSorted"],["phantom","visibleSorted"],["restRowSources","visibleSorted"],["legendViewSources","visibleSorted"],["leftPriceScale","visibleSorted"],["rightPriceScale","visibleSorted"],["overlayPriceScale","visibleSorted"],["multipane","visibleSorted"],["allWithoutMultipane","visibleSorted"]]);function _e(e,t){const i=e.priceScale();return null===i?"overlay":t.priceScalePosition(i)}class me{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,o.ensureDefined)(this._groupedSources.get("visibleSorted"))}allIncludingHidden(){return this._groupedSources.has("allSorted")||this._sortSources(),(0,o.ensureDefined)(this._groupedSources.get("allSorted"))}allWithoutMultipane(){return this._getSourcesByGroupType("allWithoutMultipane")}allExceptSpecialSources(){if(!this._groupedSources.has("exceptSpecial")){const e=this.allIncludingHidden().filter((e=>!e.isSpeciallyZOrderedSource()));this._groupedSources.set("exceptSpecial",e)}return(0,
o.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",(0,he.sortSources)(e,this._pane))}return(0,o.ensureDefined)(this._groupedSources.get("hitTest"))}generalSources(){if(!this._groupedSources.has("general")){const e=this.allExceptLineAndTradingSources().concat(this.lineSources());this._groupedSources.set("general",(0,he.sortSources)(e,this._pane))}return(0,o.ensureDefined)(this._groupedSources.get("general"))}leftPriceScalesSources(){return this._getSourcesByGroupType("leftPriceScale")}rightPriceScalesSources(){return this._getSourcesByGroupType("rightPriceScale")}overlayPriceScaleSources(){return this._getSourcesByGroupType("overlayPriceScale")}multipaneSources(){return this._getSourcesByGroupType("multipane")}legendViewSources(){return this._getSourcesByGroupType("legendViewSources")}_getSourcesByGroupType(e){const t=(0,o.ensureDefined)(pe.get(e));return this._groupedSources.has(t)?this._groupedSources.has(e)||this._groupSources(e):(this._sortSources(),this._groupSources(e)),(0,o.ensureDefined)(this._groupedSources.get(e))}_sortSources(){null===this._sources&&(this._sources=this._pane.dataSources());const e=this._pane.model().multiPaneSources(this._pane),t=(0,he.sortSources)(this._sources.concat(e),this._pane),i=t.filter((e=>!(0,S.isLineTool)(e)||e.isActualSymbol()&&e.isActualCurrency()&&e.isActualUnit()));this._groupedSources.set("allSorted",t),this._groupedSources.set("visibleSorted",i)}_groupSources(e){const t=(0,o.ensureDefined)(pe.get(e)),i=ue.get(e);if(void 0!==i){const s=(0,o.ensureDefined)(this._groupedSources.get(t)).filter((e=>i(e,this._pane)));this._groupedSources.set(e,s)}}}var ge=i(15764),fe=i(93280),ve=i(49256),ye=i(32549),Se=i(60074),be=i(68805),we=i(33515),Ce=i(60521),Pe=i(9859);function xe(e,t,i){const s=e.div(t).toNumber();return Math.abs(Math.round(s)-s)<i}const Te=[2,5],Ie=[5,2];class Me{constructor(e,t,i){if(this._base=e,this._integralDividers=t,(0,Pe.isBaseDecimal)(e))this._fractionalDividers=[2,2.5,2];else{this._fractionalDividers=[];const e=i?Te:Ie;for(let t=this._base;1!==t;){if(t%e[0]==0)this._fractionalDividers.push(e[0]),t/=e[0];else{if(t%e[1]!=0)throw new Error("unexpected base");this._fractionalDividers.push(e[1]),t/=e[1]}if(this._fractionalDividers.length>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,Pe.log10)(e-t))));if(!isFinite(n))return 1e305
;let o=0,a=this._integralDividers[0];for(;;){const e=(0,Pe.greaterOrEqual)(n,s,r)&&n>s+r,t=(0,Pe.greaterOrEqual)(n,i*a,r),l=(0,Pe.greaterOrEqual)(n,1,r),c=new Ce.Big(n).div(a),h=0===s||xe(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,Pe.equal)(n,1,r))for(o=0,a=this._fractionalDividers[0];;){const e=(0,Pe.greaterOrEqual)(n,i*a,r)&&n>s+r,t=new Ce.Big(n).div(a),l=0===s||xe(t,s,r);if(!e||!l)break;n=t.toNumber(),a=this._fractionalDividers[++o%this._fractionalDividers.length]}return n}}class Ae{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<t)throw new Error("high < low");const s=this._priceScale.height(),r=this._tickMarkHeight(),n=(e-t)*r/s,o=[new Me(this._base,[2,2.5,2],!0),new Me(this._base,[2,2,2.5],!0),new Me(this._base,[2.5,2,2],!0),new Me(this._base,[2,2.5,2],!1),new Me(this._base,[2,2,2.5],!1),new Me(this._base,[2.5,2,2],!1)].reduce(((s,r)=>{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()||!e.hasCalculatedPriceRange()||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)<this._tickMarkHeight()||(t.push({coord:r,label:p.format(i)}),u=r,e.isLog()&&(c=this.tickSpan(i*d,l)))}return t}}var Le=i(928),ke=i(725),De=i(43290);const Ee=te.enabled("hide_price_scale_if_all_sources_hidden"),Ve=(0,De.getPercentageFormatter)(),Be=new ke.PriceFormatter({priceScale:100,minMove:1}),Re={autoScale:!0,autoScaleDisabled:!1,lockScale:!1,percentage:!1,percentageDisabled:!1,log:!1,logDisabled:!1,alignLabels:!0,isInverted:!1,indexedTo100:!1};class Ne{constructor(e,t){this._marksCache=null,this._onMarksChanged=new N.Delegate,this.m_dataSources=[],this._sourcesForAutoscale=null,this._sourcesThatAffectVisibility=[],this._hasSeries=!1,this._studiesCount=0,this._drawingCount=0,this._seriesLikeSources=[],this._priceDataSources=[],this._mainSource=null,this._lastSourceRemoved=new N.Delegate,this._scaleSeriesOnly=!1,this._invalidatedForRange={isValid:!0,visibleBars:null},this._priceRange=null,this._hasCalculatedPriceRange=!1,this._logFormula=(0,ve.logFormulaForBase)(null),this.m_height=0,this._margins={
top:0,bottom:0},this._correctedMarginsCache=null,this._topPixelMargin=0,this._bottomPixelMargin=0,this._internalHeightCache=null,this._internalHeightChanged=new N.Delegate,this._priceRangeSnapshot=null,this._scrollStartPoint=null,this._currencyCache=null,this._unitCache=null,this._measureUnitIdCache=null,this._recalculatePriceRangeOnce=!1,this._cachedOrderedSoruces=null,this._scaleStartPoint=null,this._twoPointsScaleStartPosition=null,this._maxPriceRange=null,this._minPriceRange=null,this._priceRangeChanged=new N.Delegate,this._modeChanged=new N.Delegate,this._sourcesToUpdateViews=null,this._markBuilder=new Ae(this,100,this._coordinateToLogical.bind(this),this._logicalToCoordinate.bind(this)),this._formatter=null,this._resetScaleAvailable=new O.WatchedValue(!1),this._id="",this._isVisible=new O.WatchedValue(!0),t=Object.assign({},Re,t),this._properties=new L.Property(t),this._boundOnSourceIsActingAsSymbolSourceChanged=this._onSourceIsActingAsSymbolSourceChanged.bind(this),this._scalesProperties=e,this._properties.childs().isInverted.subscribe(this,this._onIsInvertedChanged),this._properties.subscribe(null,(()=>{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,se.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()}isScaleSeriesOnly(){return this._scaleSeriesOnly}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._priceRange}setPriceRange(e,t,i){if(!(e instanceof fe.PriceRange))throw new TypeError("incorrect price range");const s=this._priceRange;if(!t&&fe.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._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._priceRange)?(r=this._convertPriceRangeFromLog(this._priceRange),null!==r&&this.setPriceRange(r)):n.autoScale.setValue(!0)),!s.log&&n.log.value()&&(r=this._convertPriceRangeToLog(this._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._priceRange||this._priceRange.isEmpty()}hasCalculatedPriceRange(){return this._hasCalculatedPriceRange}canDetachSource(e){return this.m_dataSources.some((t=>t!==e&&(0,ce.isPriceDataSource)(t)&&!((0,R.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,ae.clone)(this._logFormula),hasCalculatedPriceRange:this._hasCalculatedPriceRange}}restoreState(e){var t;let i=e.m_priceRange;if(void 0===i)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 s={autoScale:e.m_isAutoScale};void 0!==e.m_isPercentage&&(s.percentage=e.m_isPercentage),void 0!==e.m_isIndexedTo100&&(s.indexedTo100=e.m_isIndexedTo100),void 0!==e.m_isLog&&(s.log=e.m_isLog),void 0!==e.m_isLockScale&&(s.lockScale=e.m_isLockScale),void 0!==e.m_isInverted&&this._properties.childs().isInverted.setValue(e.m_isInverted),this.setMode(s),this._hasCalculatedPriceRange=null!==(t=e.hasCalculatedPriceRange)&&void 0!==t?t:null!==i,i?(i instanceof fe.PriceRange||(i=new fe.PriceRange(i)),this.setPriceRange(i,!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,ve.toLog)(e,this._logFormula):e}logicalToPrice(e){return this.isLog()?(0,ve.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,ve.fromPercent)(i,t):this.isIndexedTo100()&&(i=(0,ve.fromIndexedTo100)(i,t)),i}mainSource(){if(null!==this._mainSource)return this._mainSource;let e;for(const t of this._priceDataSources){if(t instanceof ye.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,o.ensureNotNull)(this.priceRange()),s=i.minValue(),r=i.maxValue(),n=this.internalHeight()-1,a=this.isInverted(),l=n/(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,ve.toPercent)(t,e)):this.isIndexedTo100()?t=>h((0,ve.toIndexedTo100)(t,e)):this.isLog()?e=>h((0,ve.toLog)(e,this._logFormula)):e=>h(e)}pricesArrayToCoordinates(e,t,i){this._makeSureItIsValid();const s=this.bottomPixelMargin(),r=(0,o.ensureNotNull)(this.priceRange()),n=r.minValue(),a=r.maxValue(),l=this.internalHeight()-1,c=this.isInverted(),h=l/(a-n);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;r<i;r++)m=e[r],
Number.isFinite(m)&&(d?m=(0,ve.toPercent)(m,t):u?m=(0,ve.toIndexedTo100)(m,t):p&&(m=(0,ve.toLog)(m,this._logFormula)),g=s+h*(m-n),e[r]=c?g:_-1-g)}pointsArrayToCoordinates(e,t,i){var s,r;this._makeSureItIsValid();const n=(0,o.ensureNotNull)(this.priceRange()),a=this.bottomPixelMargin(),l=n.minValue(),c=n.maxValue(),h=this.internalHeight()-1,d=this.isInverted(),u=h/(c-l),p=e,_=null!==(s=null==i?void 0:i.startItemIndex)&&void 0!==s?s:0,m=null!==(r=null==i?void 0:i.endItemIndex)&&void 0!==r?r:p.length;if(this.isPercentage())for(let e=_;e<m;e++)p[e].y=(0,ve.toPercent)(p[e].y,t);if(this.isIndexedTo100())for(let e=_;e<m;e++)p[e].y=(0,ve.toIndexedTo100)(p[e].y,t);if(this.isLog())for(let e=_;e<m;e++)p[e].y=this.priceToLogical(p[e].y);for(let e=_;e<m;e++){const t=p[e].y;if(isNaN(t)||null==t)continue;const i=a+u*(t-l),s=d?i:this.m_height-1-i;p[e].y=s}}barPricesToCoordinates(e,t){this._makeSureItIsValid();const i=(0,o.ensureNotNull)(this.priceRange()),s=e,r=this.bottomPixelMargin(),n=i.minValue(),a=i.maxValue(),l=this.internalHeight()-1;let c=null;if(this.isPercentage()?c=ve.toPercent:this.isIndexedTo100()?c=ve.toIndexedTo100:this.isLog()&&(c=(e,t)=>e?(0,ve.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;e<s.length;e++){if(!s[e])continue;const i=s[e];h&&(i.open=c(i.open,t)),i.high=c(i.high,t),i.low=c(i.low,t),d&&(i.close=c(i.close,t)),void 0!==i.additionalPrice&&(i.additionalPrice=c(i.additionalPrice,t))}const u=l/(a-n),p=this.isInverted();for(let e=0;e<s.length;e++){const t=s[e];if(!t)continue;if(h){const e=r+u*(t.open-n),i=p?e:this.m_height-1-e;t.open=i}const i=r+u*(t.high-n),o=p?i:this.m_height-1-i;t.high=o;const a=r+u*(t.low-n),l=p?a:this.m_height-1-a;if(t.low=l,d){const e=r+u*(t.close-n),i=p?e:this.m_height-1-e;t.close=i}if(void 0!==t.additionalPrice){const e=r+u*(t.additionalPrice-n);t.additionalPrice=p?e:this.m_height-1-e}}}formatter(){return null===this._formatter&&this.updateFormatter(),(0,o.ensureNotNull)(this._formatter)}updateFormatter(){this._marksCache=null;const e=this.mainSource();let t=100;e&&(t=e.base()),this._formatter=null,this.isPercentage()?(this._formatter=Ve,t=100):this.isIndexedTo100()?(this._formatter=Be,t=100):this._formatter=e?e.formatter():Be,this._markBuilder=new Ae(this,t,this._coordinateToLogical.bind(this),this._logicalToCoordinate.bind(this)),this._markBuilder.rebuildTickMarks()}formatPrice(e,t,i){return this.isPercentage()?this.formatPricePercentage(e,t,i):this.isIndexedTo100()?this.formatPriceIndexedTo100(e,t,i):this.formatter().format(e,i)}formatPriceAbsolute(e,t){return this._mainSourceFormatter().format(e,t)}formatPricePercentage(e,t,i){return e=(0,ve.toPercent)(e,t),Ve.format(e,i)}formatPriceIndexedTo100(e,t,i){const s=(0,ve.toIndexedTo100)(e,t);return this.formatter().format(s,i)}getFormattedValues(e,t,i,s){null!=s||(s=this.formatPriceAbsolute(e));const r=this.formatPricePercentage(e,t,{signPositive:i}),n=this.formatPriceIndexedTo100(e,t);return{formattedPriceAbsolute:s,formattedPricePercentage:r,
formattedPriceIndexedTo100:n,text:(0,ve.getCurrentModePriceText)(this,{formattedPriceAbsolute:s,formattedPricePercentage:r,formattedPriceIndexedTo100:n})}}resetScale(){this.setMode({autoScale:!0})}resetScaleAvailable(){return this._resetScaleAvailable.readonly()}dataSources(){return this.m_dataSources}seriesLikeSources(){return this._seriesLikeSources}addDataSource(e,t){this._addDataSourceImpl(e,t)}removeDataSource(e){const t=this.m_dataSources.indexOf(e);if((0,o.assert)(-1!==t,"Source is not attached to scale"),this.m_dataSources.splice(t,1),(0,ce.isPriceDataSource)(e)){const t=this._priceDataSources.indexOf(e);if((0,o.assert)(-1!==t,"Source is not found"),this._priceDataSources.splice(t,1),(0,Se.isSymbolSource)(e)){const t=this._seriesLikeSources.indexOf(e);(0,o.assert)(-1!==t,"Source is not found"),this._seriesLikeSources.splice(t,1),e.symbolResolved().unsubscribeAll(this),e.isActingAsSymbolSource().unsubscribe(this._boundOnSourceIsActingAsSymbolSourceChanged),e instanceof ye.Series&&(this._hasSeries=!1)}e.currencyChanged().unsubscribeAll(this),e.unitChanged().unsubscribeAll(this)}this.mainSource()||this.setMode({autoScale:!0}),(0,R.isStudy)(e)&&(e.onIsActualIntervalChange().unsubscribe(this,this._dropScaleCache),e.onHibernationStateChange().unsubscribe(this,this._dropScaleCache),this._studiesCount--,0===this._studiesCount&&(0,Le.hideAllIndicators)().unsubscribe(this,this._dropScaleCache)),(0,S.isLineTool)(e)&&(this._drawingCount--,0===this._drawingCount&&(0,Le.hideAllDrawings)().unsubscribe(this,this._dropScaleCache));const i=this._sourcesThatAffectVisibility.indexOf(e);-1!==i&&(this._sourcesThatAffectVisibility.splice(i,1),e.properties().childs().visible.listeners().unsubscribe(this,this._onSourceVisibilityChanged)),e===this._mainSource&&(this._correctedMarginsCache=null,this._internalHeightCache=null,this._marksCache=null),this._mainSource=null,this._dropScaleCache(),this.updateFormatter(),this.invalidateSourcesCache(),this._updateIsVisible(),this._updateLogFormula(),0===this.m_dataSources.length&&this._lastSourceRemoved.fire()}replaceSource(e,t){const i=(0,ce.isPriceDataSource)(e)?this._priceDataSources.indexOf(e):void 0;return this._addDataSourceImpl(t,void 0,-1===i?void 0:i),this.removeDataSource(e),-1!==i}currency(e){if(null!==this._currencyCache&&e.size()===this._currencyCache.availableCurrenciesCount)return this._currencyCache.value;let t;const i=new Set,s=new Set,r=new Set,n=new Map;let a,l=0===this._seriesLikeSources.length,c=!0,h=0,d=0;const u=this._seriesLikeSources.filter(Se.isActingAsSymbolSource);for(const d of u){if(!d.isVisible())continue;const u=d.symbolInfo();if(null===u){t=null;break}const p=(0,be.symbolOriginalCurrency)(u);if(null===p){t=null;break}n.set(p,(0,o.ensureNotNull)((0,be.symbolOriginalCurrency)(u,!0)));const _=d.currency();if(null===_){t=null;break}n.set(_,(0,o.ensureNotNull)((0,be.symbolCurrency)(u,!0)));const m=(0,be.symbolBaseCurrency)(u);null!==m&&s.add(m),c=c&&p===_,r.add(_),i.add(p),void 0===a?a=_:null!==a&&a!==_&&(a=null),l||e.convertible(_)&&(0,
be.symbolCurrencyConvertible)(u)||(l=!0),h+=1}if(null!==t)for(const i of this._priceDataSources){if(u.includes(i))continue;const s=i;if(!s.isCurrencySource()||!s.isVisible())continue;const c=s.currency();if(null===c){t=null;break}r.add(c),d+=1;const h=(0,o.ensureNotNull)(s.symbolSource()),p=s.currencySourceSymbolInfo();if(null===p){t=null;break}if(l||e.convertible(c)&&(0,be.symbolCurrencyConvertible)(p)||(l=!0),n.set(c,(0,o.ensureNotNull)((0,be.symbolCurrency)(p,!0))),u.includes(h)||(l=!0),void 0===a)a=c;else if(null!==a&&a!==c){a=null;break}}return void 0===t&&(t=0===h&&0===d?null:{readOnly:l,selectedCurrency:a||null,currencies:r,originalCurrencies:i,baseCurrencies:s,symbolSourceCount:h,allCurrenciesAreOriginal:c,displayedValues:n}),this._currencyCache={value:t,availableCurrenciesCount:e.size()},t}unit(e){if(null!==this._unitCache&&e.size()===this._unitCache.availableUnitsCount)return this._unitCache.value;let t;const i=new Set,s=new Set,r=new Map,n=new Map;let a,l=0===this._seriesLikeSources.length?new Set:e.allGroups(),c=!0,h=0,d=0;const u=this._seriesLikeSources.filter(Se.isActingAsSymbolSource);for(const o of u){if(!o.isVisible())continue;const d=o.symbolInfo();if(null===d){t=null;break}const u=(0,be.symbolOriginalUnit)(d,o.model().unitConversionEnabled());if(null===u){t=null;break}r.set(u,e.name(u)),n.set(u,e.description(u));const p=o.unit();if(null===p){t=null;break}if(r.set(p,e.name(p)),n.set(p,e.description(p)),c=c&&u===p,s.add(p),i.add(u),void 0===a?a=p:null!==a&&a!==p&&(a=null),l.size>0){const t=(0,we.unitConvertibleGroups)(d,p,e);l=(0,y.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,o.ensureNotNull)(c.symbolSource()),_=p.symbolInfo();if(null===_){t=null;break}if(l.size>0){const t=(0,we.unitConvertibleGroups)(_,h,e);l=(0,y.intersect)(l,new Set(t))}if(r.set(h,e.name(h)),n.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:n}}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(Se.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,ae.isNumber)(e.top)||!(0,
ae.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,o.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,ve.toLog)(e.from,this._logFormula):e.from,o=r?(0,ve.toLog)(e.to,this._logFormula):e.to;const a=o-n;n+=s*a,o-=i*a,this.setMode({autoScale:!1}),this.setPriceRange(new fe.PriceRange(n,o)),this._marksCache=null,this._onMarksChanged.fire()}hasMainSeries(){return this._hasSeries}getStudies(){return this.dataSources().filter(R.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,he.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,o.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 fe.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._priceRange=null,this.recalculatePriceRangeOnce()}isVisible(){return this._isVisible}_addDataSourceImpl(e,t,i){if(t||-1===this.m_dataSources.indexOf(e)){if((0,ce.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,Se.isSymbolSource)(e)&&(this._seriesLikeSources.push(e),e.symbolResolved().subscribe(this,(()=>{this._currencyCache=null,this._unitCache=null,this._measureUnitIdCache=null,this._updateLogFormula()})),e.isActingAsSymbolSource().subscribe(this._boundOnSourceIsActingAsSymbolSourceChanged),e instanceof ye.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,R.isStudy)(e)&&(e.onIsActualIntervalChange().subscribe(this,this._dropScaleCache),e.onHibernationStateChange().subscribe(this,this._dropScaleCache),0===this._studiesCount&&(0,Le.hideAllIndicators)().subscribe(this,this._dropScaleCache),this._studiesCount++),(0,S.isLineTool)(e)&&(0===this._drawingCount&&(0,Le.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(),this._updateLogFormula()}}_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 ye.Series)&&(e?t instanceof ye.Series:(0,R.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;const a={targetPriceScale:this,scaleSeriesOnly:this._scaleSeriesOnly};for(const l of i){if(!l.properties().visible.value())continue;const i=l.firstValue();if(null===i||s&&0===i)continue;const c=e.firstBar(),h=e.lastBar(),d=l.autoScaleInfo(c,h,a);let u=d.range;u&&(s?u=(0,ve.toPercentRange)(u,i):r&&(u=(0,ve.toIndexedTo100Range)(u,i)),t=null===t?u:t.merge(u)),void 0!==d.topPixelMargin&&(n=Math.max(n,d.topPixelMargin)),void 0!==d.bottomPixelMargin&&(o=Math.max(o,d.bottomPixelMargin))}(Math.abs(n-this._topPixelMargin)>0||Math.abs(o-this._bottomPixelMargin)>0)&&(this._bottomPixelMargin=o,this._topPixelMargin=n,this._marksCache=null,this._invalidateInternalHeightCache()),t?(this._hasCalculatedPriceRange=!0,t.minValue()===t.maxValue()&&(t=new fe.PriceRange(t.minValue()-.5,t.maxValue()+.5)),this.setPriceRange(t)):this._priceRange||this.setPriceRange(new fe.PriceRange(-.5,.5)),this._invalidatedForRange.isValid=!0;const l=this.mainSource();null!==l&&this._recalculatePriceRangeOnce&&(this._recalculatePriceRangeOnce=!l.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,o.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,o.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,ve.fromLog)(e.minValue(),this._logFormula),i=(0,ve.fromLog)(e.maxValue(),this._logFormula);return new fe.PriceRange(t,i)}_convertPriceRangeToLog(e){if(null===e)return null;const t=(0,ve.toLog)(e.minValue(),this._logFormula),i=(0,ve.toLog)(e.maxValue(),this._logFormula);return new fe.PriceRange(t,i)}_canConvertPriceRangeFromLog(e){if(null===e)return!1;const t=(0,ve.fromLog)(e.minValue(),this._logFormula),i=(0,ve.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(!Ee)return void this._isVisible.setValue(!0);const e=this._sourcesThatAffectVisibility.some((e=>e.isVisible()));this._isVisible.setValue(e)}_updateLogFormula(){const e=this.mainSource();if(null===e)return void(this._logFormula=(0,ve.logFormulaForBase)(null));const t=e.base()||null,i=(0,ve.logFormulaForBase)(t);(0,
ve.logFormulasAreSame)(i,this._logFormula)||(this._logFormula=i)}_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())||Be}_priceToPercentOrIndexedTo100IfNeeded(e,t){return this.isPercentage()?(0,ve.toPercent)(e,t):this.isIndexedTo100()?(0,ve.toIndexedTo100)(e,t):e}_onSourceIsActingAsSymbolSourceChanged(){this._dropScaleCache()}_onIsInvertedChanged(){this._marksCache=null,this._markBuilder.rebuildTickMarks()}_updateResetAvailableValue(){this._resetScaleAvailable.setValue(!this.isLockScale()&&!this.isAutoScale())}}var Oe=i(59769),Fe=i(9155),We=i(36915),He=i(5171),ze=i(678);const Ue=[],je=[];class Ge{constructor(e){this._studies={},this._deferreds={},this._container=e,Ue.push(e),je.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,_.createDeferredPromise)()),this._deferreds[e].promise)}delete(e){delete this._studies[e],delete this._deferreds[e]}reset(){const e=Ue.indexOf(this._container);~e&&(Ue.splice(e,1),je.splice(e,1))}static instance(e){const t=Ue.indexOf(e);return~t?je[t]:new Ge(e)}}var qe=i(65365);var $e=i(10892),Ke=i(81756),Ye=i(62828),Ze=i(83776),Xe=i(37968),Je=i(56621),Qe=i(44672),et=i(42989),tt=i(79303);const it=te.enabled("clear_price_scale_on_error_or_empty_bars"),st=(0,ie.getLogger)("Chart.Pane");var rt;function nt(e,t,i){e.setMargins({top:t,bottom:i})}!function(e){e[e.DefaultStretchFactor=1e3]="DefaultStretchFactor",e[e.LargePaneSizeRatio=1]="LargePaneSizeRatio",e[e.MediumPaneSizeRatio=.6]="MediumPaneSizeRatio",e[e.SmallPaneSizeRatio=.3]="SmallPaneSizeRatio",e[e.TinyPaneSizeRatio=.15]="TinyPaneSizeRatio"}(rt||(rt={}));const ot="chart.pane";class at{constructor(e,t,i,s){this.m_dataSources=[],this._sourceWatchedValuesSubscriptions=new Map,this.m_mainDataSource=null,this._cachedOrderedSources=new me(this),this._sourcesById=new Map,this._priceSourcesById=new Map,this._sourcePropertiesChanged=new N.Delegate,this._sourcesZOrderChanged=new N.Delegate,this._tagsChanged=new N.Delegate,this._stretchFactor=1e3,
this._isInInsertManyDataSourcesState=!1,this._lastLineDataSourceZOrder=null,this._rightPriceScales=[],this._leftPriceScales=[],this._lockedPriceScale=null,this._currentPriceScaleRatio=null,this._onPriceScalesChanged=new N.Delegate,this._isRecalculatingScales=!1,this._priceDataSources=[],this._symbolSources=[],this._lollipopDataSources=[],this._symbolSourceResolved=new N.Delegate,this._symbolSourceResolvingActive=new O.WatchedValue(!1),this._bulkActions={activeCounter:0},this._height=0,this._width=0,this._sizeChanged=new N.Delegate,this._dataSourcesCollectionChanged=new N.Delegate,this._symbolSourceCollectionChanged=new N.Delegate,this._priceSourcesCollectionChanged=new N.Delegate,this._maximized=new O.WatchedValue(!1),this._collapsed=new O.WatchedValue(!1),this._resetPriceScalesAvailable=new O.WatchedValue(!1),this._destroyed=new N.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,ne.createPriceScaleSelectionStrategy)(i.properties().childs().priceScaleSelectionStrategyName.value()),this._id=null!=s?s:(0,se.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,ne.createPriceScaleSelectionStrategy)(e.value()),this._priceScaleSelectionStrategy.apply(this)})),this._timeScale.barSpacingChanged().subscribe(this,(()=>{this.m_mainDataSource===this._model.mainSeries()&&this._recalculatePriceScaleByScaleRatio(this.m_mainDataSource.priceScale())})),it&&(this._seriesDisplayError=(0,be.getSeriesDisplayErrorWV)(this._model.mainSeries()),this._seriesDisplayError.subscribe(this._onSeriesDisplayError)),i.onMultipaneSourcesCollectionChanged().subscribe(this,this._invalidateSourcesCache),i.panesCollectionChanged().subscribe(this,this._invalidateSourcesCache),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._model.onMultipaneSourcesCollectionChanged().unsubscribeAll(this),this._model.panesCollectionChanged().unsubscribeAll(this),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 Ne(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,y.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,y.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,re.getPersistentLogger)())||void 0===i||i.addPersistentLogEntry(`changeSourceId for series from ${e.id()} to ${t}`,ie.LOGLEVEL.INFO,ot)),(0,o.assert)(this.hasDataSource(e));const s=e.id();e.setId(t),this._sourcesById.delete(s),this._sourcesById.set(t,e),(0,ce.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;let i=e.sourcesForAutoscale();if(e===this._model.mainSeries().priceScale()&&(i=[...i,...this._cachedOrderedSources.multipaneSources()]),(e.isAutoScale()||e.priceRangeShouldBeRecalculatedOnce()||null===e.priceRange())&&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,ce.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,ce.isPriceDataSource)(e)&&this.recalculatePriceScale(t,(0,Qe.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,R.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 st.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,ce.isPriceDataSource)(e)&&!t&&this._processMainSourceChange(),(0,R.isStudy)(e)&&e.metaInfo().hasForceOverlayPlots()&&this._model.removeMultiPaneSource(e),this._tagsChanged.fire(),n&&(0,ce.isPriceDataSource)(e)&&this.recalculatePriceScale(n,(0,Qe.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.removeDataSource(e,s,void 0,n),this.insertDataSource(t,i,r,n),this._sourcesById.set(t.id(),t),(0,ce.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){const t=this._cachedOrderedSources.all();for(const i of t)i.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 Ne(this.model().properties().childs().scalesProperties,i);return s.setHeight(this.height()),nt(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&&st.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,Qe.sourceChangeEvent)(e.id())),this.recalculatePriceScale(t,(0,Qe.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().fullUpdate()}isMainPane(){return this.hasDataSource(this.model().mainSeries())}isLast(){const e=this.model().panes();return e[e.length-1]===this}newStudyZOrder(){return(0,
Fe.newStudyZOrder)(this._priceDataSources)}newLineToolZOrder(e){return(0,Fe.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],Fe.moveBeforeSource)}bringToFront(e){const t=this.sourcesByGroup().allExceptSpecialSources();this._batchReorder(e,t[t.length-1],Fe.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,Fe.moveAfterSource)}insertBefore(e,t){this._batchReorder(e,t,Fe.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,v.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)<o.indexOf(r)?s:[]}actionNoScaleIsEnabled(e){return!(!this.isOverlay(e)&&(0,ce.isPriceDataSource)(e))||this._nonOverlayPricesSourcesCount()>1}properties(){return this._properties}setPriceAutoScale(e,t){e.setMode({autoScale:t}),this.timeScale().isEmpty()||this.recalculatePriceScale(e,(0,Qe.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;e<this.m_dataSources.length;e++){const t=h(this.m_dataSources[e]);null!==t&&l.sources.push(t)}}const d=e=>null!==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:n=this._model.mainSeries().id(),settingsMigration:a={},contentOverrides:l,restoreSilently:c,reason:h=0}=e;null===(t=(0,re.getPersistentLogger)())||void 0===t||t.addPersistentLogEntry(`Restoring pane with seriesId ${n}`,ie.LOGLEVEL.INFO,ot),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))))||(st.logNormal("Dropped invalid "+e.type+". Reason: non-numeric point time"),!1)))})),t=e.findIndex(We.isMainSeriesState);-1!==t&&this.model().mainSeries().setObsoleteZOrder(e[t].zorder),r<3&&(0,Fe.reorderDataSourcesStateZOrder)(e);const o=-1!==this.m_dataSources.indexOf(this._model.mainSeries());this.clearSeries(Boolean(c)),this.m_mainDataSource=null,o&&this._addSourceToCollections(this._model.mainSeries(),c),(()=>{const t=e.find((e=>e.id===i.mainSourceId));if(void 0===t)return void st.logWarn("There is no main source with id "+i.mainSourceId+", total sources="+e.length);if(!window.TradingView[t.type]||!(0,ge.isLineToolName)(t.type))return void st.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,ge.isLineToolName)(i.type)){if(null!==s)return void st.logWarn("Pane contains more than 1 possibly main sources - auto fix cannot be applied");s=i}if(null===s)return void st.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)})),st.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){const e=t;e.oldState=!0,this.model().sessions().restoreState(e,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,We.isMainSeriesState)(t)?this._restoreMainSeries(t,s,o,a,l,c):(0,We.isStudyState)(t)?this.restoreStudy(t,s,n,a,c,h):(0,We.isLineToolState)(t)?(t.state&&(t.state.zOrderVersion=2),
this.restoreLineTool(t,s,void 0,c)):"ChartEventsSource"===t.type&&this._restoreSpecialSource(t,s,c)):st.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,j.defaults)("chartproperties").paneProperties.axisProperties,i=new Ne(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,o.ensure)(s),t=new Ne(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 Ne(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,ce.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,R.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(){le.ExecutionsPositionController.recreateOrderedByBarsSourcesCache(this)}clearDrawingCaches(){le.ExecutionsPositionController.clearOrderedByBarsSourcesCache()}executionsPositionController(){return this._executionsPositionController||(this._executionsPositionController=new le.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<this.m_dataSources.length;t++){const i=this.m_dataSources[t];this.isOverlay(i)&&i.priceScale()&&(0,o.ensureNotNull)(i.priceScale()).setHeight(e)}this.updateAllViews((0,Qe.viewportChangeEvent)()),this._sizeChanged.fire()}}setWidth(e){return this._width!==e&&(this._width=e,this.updateAllViews((0,Qe.viewportChangeEvent)()),this._sizeChanged.fire(),!0)}onSizeChanged(){return this._sizeChanged}onTagsChanged(){return this._tagsChanged}onDestroyed(){return this._destroyed}dataSourcesCollectionChanged(){return this._dataSourcesCollectionChanged}symbolSourceCollectionChanged(){return this._symbolSourceCollectionChanged}priceSourcesCollectionChanged(){return this._priceSourcesCollectionChanged}symbolSourceResolved(){return this._symbolSourceResolved}symbolSourceResolvingActive(){return this._symbolSourceResolvingActive}sourcePropertiesChanged(){return this._sourcePropertiesChanged}sourceZOrderChanged(){return this._sourcesZOrderChanged}lineToolsForArea(e,t){const i=this.logicalRectToPixels(e);return[...this.m_dataSources,...this.model().multiPaneSources(this)].filter(S.isLineTool).filter((e=>(e.paneViews(this)||[]).some((e=>{const s=e.renderer(t);return s&&s.doesIntersectWithBox&&s.doesIntersectWithBox(i,t)}))))}logicalRectToPixels(e){const t=this.defaultPriceScale(),i=this.timeScale(),s=(0,o.ensureNotNull)((0,o.ensureNotNull)(t.mainSource()).firstValue()),r=t.priceToCoordinate(e.p1.price,s),n=i.indexToCoordinate(e.p1.index),l=t.priceToCoordinate(e.p2.price,s),c=i.indexToCoordinate(e.p2.index),h=new a.Point(Math.min(n,c),Math.min(r,l)),d=new a.Point(Math.max(n,c),Math.max(r,l));return(0,a.box)(h,d)}timeScale(){return this._timeScale}restoreLineTool(e,t,i,s,r){var n,a,l,c,h,d,u,p,_,m,g;if((0,ge.isMtpPredictorToolName)(e.type))return st.logWarn(`No longer supported tool ${e.type} is skipped while restoring state`),null;delete e.state.lastUpdateTime,e.state.intervalsVisibilities=(0,$e.mergeIntervalVisibilitiesDefaults)(e.state.intervalsVisibilities),i=void 0===i||i,qe.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,o.assert)((0,ge.isLineToolName)(f),"invalid data source type:"+f+" (expected to be a Line Tool)");let w,C,P=null
;if((0,We.isStudyLineToolState)(e)){P=this._model.isSnapshot()?new tt.StudyVersioning([],[]):(0,V.studyMetaInfoRepository)().studyVersioning();const t=tt.StudyVersioning.patchPointsBasedStudyState(e);e=t;const i=new oe.StudyMetaInfo(t.metaInfo);0;const s=P.updateMetaInfo(i),r=null!=s?s:i;C=(0,S.createStudyLineToolProperties)(f,i,r,y,P),w=(0,S.createLineTool)(f,this._model,C,r,!0)}else C=(0,S.createLineToolProperties)(f,y,this._model,!1),t?null===(n=C.child("fixedSize"))||void 0===n||n.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 Ke.LineToolBarsPattern||w instanceof Ye.LineToolCallout||w instanceof Ze.LineToolTrendAngle||w instanceof Xe.LineToolGhostFeed||w instanceof Je.LineToolParallelChannel)null===(u=(d=w).restoreData)||void 0===u||u.call(d,e);else if(t&&(0,We.isStudyLineToolState)(e)&&w.restoreData){const t=e;P&&(t.graphics=tt.StudyVersioning.patchPointsBasedStudyData(new oe.StudyMetaInfo(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,l;if(t&&void 0===e.data&&void 0===e.nonSeriesData&&void 0===e.indexes)return st.logError("Cannot restore (skipping) study without data "+e.id+", "+e.metaInfo.id),null;const c=e.id,d=e.state,u=e.zorder;s=null!=s?s:this._model.mainSeries().id();const p=(null!==(a=e.parentSources)&&void 0!==a?a:e.ownerSource?[e.ownerSource]:[]).filter((e=>e!==s));let _=new oe.StudyMetaInfo(e.metaInfo);if(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}(_.id)&&!t)return st.logNormal("Skipping study "+_.id),null;let m=d;const g=new T.StudyStub(this._model,e,null!==(l=_.shortDescription)&&void 0!==l?l:_.name);let f;g.setId(c),
g.setZorder(u);let v=!1;const y=(i,s)=>{if(v&&this._model.dataSourceForId(c)!==g)return;g.setStatus({type:ze.StudyStatusType.Undefined});const r=null!=i?i:_,n=Ge.instance(this._model),a=a=>{var l;const h=(0,I.prepareStudyPropertiesForLoadChart)(_,i,m,s),d=(0,R.createStudy)(this._model,h,a,r,void 0,o);if(d.setId(c),d.setOwnFirstValue(null!==(l=e.ownFirstValue)&&void 0!==l?l:null),e.customFields&&d.restoreStateCustomFields(e.customFields),t){const t=e,{data:i,nsData:s,indexes:r}=tt.StudyVersioning.patchStudyData(_,t.data,t.nonSeriesData,t.indexes);d.restoreData(i,s,r)}this._model.replaceStudyStub(g,d)||(f=d),n.add(c,d)};if(p.length>0){const e=p.map((e=>n.get(e)));Promise.all(e).then(a)}else a([])};let S;if(t){const e=tt.StudyVersioning.patchPropsStateAndMetaInfo(d,_,{oldShowStudyLastValueProperty:!(null==r?void 0:r.showStudyLastValueProperty)});S=Promise.resolve(new oe.StudyMetaInfo(e.metaInfo))}else{S=(0,V.studyMetaInfoRepository)().requestMetaInfo().then((()=>{const e=tt.StudyVersioning.patchPropsStateAndMetaInfo(d,_,{oldShowStudyLastValueProperty:t&&!(null==r?void 0:r.showStudyLastValueProperty)});return m=e.propsState,new oe.StudyMetaInfo(e.metaInfo)}))}S.then((e=>{var t;const i=this._model.isSnapshot()?new tt.StudyVersioning([],[]):(0,V.studyMetaInfoRepository)().studyVersioning();if(null===e||this._model.isSnapshot())return void y(e,i);const s=i.updateMetaInfoAsync(e);s.sync?y(null!==(t=s.result)&&void 0!==t?t:e,i):s.result.then((e=>y(e,i))).catch((e=>g.setFailed("error: "+e)))})).catch((()=>g.setFailed(h.t(null,void 0,i(11768)))));const b=null!=f?f:g;if(b){b.setZorder(u);const t=e.metaInfo.linkedToSeries?this._model.mainSeries():p.length?this.dataSourceForId(p[0]):null;b.setOwnerSource(t),this._addSourceToCollections(b,n),this._processMainSourceChange(),v=b===g}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,ce.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,Se.isActingAsSymbolSource)(e)||(s.realign(),s.updateAllViews((0,Qe.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,Qe.viewportChangeEvent)())}endScalePrice(e){e.endScale()}startScrollPrice(e,t){e.startScroll(t)}scrollPriceTo(e,t){e.scrollTo(t),this.updateAllViews((0,Qe.viewportChangeEvent)())}endScrollPrice(e){e.endScroll()}resetPriceScale(e){const t=this.timeScale().visibleBarsStrictRange();e.resetScaleAvailable().value()&&e.resetScale(),e.recalculatePriceRange(t),this.updateAllViews((0,Qe.viewportChangeEvent)())}resetPriceScalesAvailable(){
return this._resetPriceScalesAvailable.readonly()}restorePriceScaleState(e,t){e.restoreState(t),this.updateAllViews((0,Qe.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,ce.isPriceDataSource)(t)&&!this.isOverlay(t)&&(!(0,R.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,he.sortSources)(e);for(const t of e)this.move(t,(0,o.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,ce.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,o.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,Qe.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,Se.isSymbolSource)(e)?e:null;(0,ce.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],s=i.id();if(i.properties().unsubscribeAll(this),i.zOrderChanged().unsubscribeAll(this),this.m_dataSources.splice(e,1),this._sourcesById.delete(i.id()),(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,Se.isSymbolSource)(i)?i:null;(0,ce.isPriceDataSource)(i)&&(this._priceSourcesById.delete(i.id()),i.currencyChanged().unsubscribeAll(this),i.unitChanged().unsubscribeAll(this),(0,y.removeItemFromArray)(this._priceDataSources,i),this._onPriceSourcesCollectionChanged(),null!==r&&((0,y.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)nt(i,e,t);for(const i of this._rightPriceScales)nt(i,e,t);for(const i of this.m_dataSources)if(this.isOverlay(i)){const s=i.priceScale();null!==s&&(nt(s,e,t),this.recalculatePriceScale(s,(0,Qe.viewportChangeEvent)()))}for(const e of this._leftPriceScales)this.recalculatePriceScale(e,(0,Qe.viewportChangeEvent)());for(const e of this._rightPriceScales)this.recalculatePriceScale(e,(0,Qe.viewportChangeEvent)());this.updateAllViews((0,Qe.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,o.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,Oe.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,Qe.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,Oe.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,o.ensureNotNull)(this._lockedPriceScale),t=(0,Oe.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,Oe.barSpacingByScaleRatio)((0,o.ensureNotNull)(this._lockedPriceScale),this._currentPriceScaleRatio));this.timeScale().isValidBarSpacing(e)&&this.timeScale().setBarSpacing(e)}_mainSourceVisiblePriceRange(e){const t=this.timeScale().visibleBarsStrictRange();return null!==t?(0,o.ensureNotNull)((0,o.ensureNotNull)(e.mainSource()).priceRange(t.firstBar(),t.lastBar(),{targetPriceScale:e,scaleSeriesOnly:e.isScaleSeriesOnly()})):new fe.PriceRange(-.5,.5)}_setMinMaxPriceRange(){const e=(0,o.ensureNotNull)(this._lockedPriceScale),t=(0,Oe.priceRangeByScaleRatio)(e,this.timeScale().maxBarSpacing(),this._currentPriceScaleRatio),i=(0,Oe.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,R.isStudy)(e)||!e.isLinkedToSeries())&&((0,ce.isPriceDataSource)(e)&&e.showInObjectTree()&&!this.isOverlay(e)))).length}_restoreMainSeries(e,t,i,s,r,n){var a,l,c;const h=e.id,d=e.state;if(d&&r&&(d.style=null!==(a=r.style)&&void 0!==a?a:d.style,d.interval=r.interval||d.interval,r.symbol&&r.symbol!==d.symbol&&(d.symbol=r.symbol,delete d.currencyId,delete d.unitId)),d&&["candleStyle","hollowCandleStyle","haStyle"].forEach((e=>{d[e]&&(d[e].wickUpColor=d[e].wickUpColor||d[e].wickColor,d[e].wickDownColor=d[e].wickDownColor||d[e].wickColor)})),d&&(d.statusViewStyle=d.statusViewStyle||{},!d.statusViewStyle.symbolTextSource)){const e=!!d.statusViewStyle.showSymbolAsDescription;d.statusViewStyle.symbolTextSource=e?"ticker":"description"}if(d){d.extendedHours?d.sessionId="extended":d.sessionId||(d.sessionId="regular"),delete d.extendedHours,(0,et.allChartStyles)().includes(d.style)||(d.style=2);const e=d.lineStyle.styleType;let t;delete d.lineStyle.styleType,0===e&&(t=14,d.lineWithMarkersStyle=(0,ae.clone)(d.lineStyle)),1===e&&(t=15,d.steplineStyle=(0,ae.clone)(d.lineStyle)),void 0!==t&&2===d.style&&(d.style=t)}if(!i){const e=this._model.mainSeries();(0,o.ensureNotNull)(this._model.mainPane()).removeDataSource(e,!1,n),this._addSourceToCollections(e,n)}const u=this.model().mainSeries(),p=u.properties().childs();this.m_mainDataSource=u;const _=d&&d.style?d.style:void 0;6===_&&"ATR"===p.pnfStyle.childs().inputs.childs().style.value()?p.pnfStyle.childs().inputs.childs().style.setValueSilently("Traditional"):4===_&&"ATR"===p.renkoStyle.childs().inputs.childs().style.value()&&p.renkoStyle.childs().inputs.childs().style.setValueSilently("Traditional"),d&&!d.hasOwnProperty("showSessions")&&(d.showSessions=!1),d&&void 0===d.settlementAsClose&&(d.settlementAsClose=!1),d&&t&&(d.showCountdown=!1),d&&(t&&!("showSeriesLastValueProperty"in s)&&"showLastValue"in d&&this._model.properties().childs().scalesProperties.childs().showSeriesLastValue.setValue(d.showLastValue),delete d.showLastValue),d&&this._restoreMainSeriesStudyInputs(e,u.styleStudyInfos());const m=u.sessionId();null===(l=(0,re.getPersistentLogger)())||void 0===l||l.addPersistentLogEntry(`Restore series. source.id: ${e.id} id: ${h}`,ie.LOGLEVEL.INFO,ot),u.restoreState(e,t),this.changeSourceId(u,h),null===(c=(0,re.getPersistentLogger)())||void 0===c||c.addPersistentLogEntry(`Series has been successfully restored. id: ${u.id()}`,ie.LOGLEVEL.INFO,ot),u.sessionId()!==m&&p.sessionId.listeners().fire(p.sessionId,"")}async _restoreMainSeriesStudyInputs(e,t){const i={haStyle:(0,be.chartStyleStudyId)(8,!0),renkoStyle:(0,be.chartStyleStudyId)(4,!0),pbStyle:(0,be.chartStyleStudyId)(7,!0),kagiStyle:(0,be.chartStyleStudyId)(5,!0),pnfStyle:(0,be.chartStyleStudyId)(6,!0),rangeStyle:(0,be.chartStyleStudyId)(11,!0),volFootprintStyle:(0,
be.chartStyleStudyId)(17,!0),tpoStyle:(0,be.chartStyleStudyId)(18,!0),svpStyle:(0,be.chartStyleStudyId)(20,!0)};await(0,V.studyMetaInfoRepository)().requestMetaInfo();const s=(0,V.studyMetaInfoRepository)().studyVersioning(),r=Object.keys(He.SYMBOL_STRING_DATA),n={},a=(0,o.ensureDefined)(e.state);for(let o=0;o<r.length;o++){const l=He.STYLE_SHORT_NAMES[r[o]]+"Style",c=l in e?e[l].studyId:i[l],h=a[l];if(null==h)continue;n[l]=h;const d=h.inputs,u=oe.StudyMetaInfo.parseIdString(c),p=t[l].studyId,_=oe.StudyMetaInfo.parseIdString(p),m=s.updateStudyInputs(u.id,u.version,_.version,d,null);h.inputs=m}this.model().mainSeries().properties().mergeAndFire(n)}_restoreSpecialSource(e,t,i){}}var lt,ct=i(78871),ht=i(31054),dt=i(91988);!function(e){e[e.Contains=0]="Contains",e[e.PlacedBefore=1]="PlacedBefore",e[e.PlacedAfter=2]="PlacedAfter"}(lt||(lt={}));class ut{constructor(e,t){(0,o.assert)(e<=t,"The left value should be greater than or equal to the right value"),this._left=e,this._right=t}left(){return this._left}right(){return this._right}length(){return this._right-this._left+1}contains(e,t){return e<this._left-.5?!0===t&&1:e>this._right+.5?!0===t&&2:!0!==t||0}before(e){return e<this._left-.5}after(e){return e>this._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 pt=(0,ie.getLogger)("Chart.TimePoints");function _t(e,t){return null===e||null===t?e===t:e.firstIndex===t.firstIndex&&e.lastIndex===t.lastIndex}class mt{constructor(){this._zoffset=0,this._items=[],this._range=new F.WatchedObject(null,_t)}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;i<e.length;i++)this._items.push(e[i]);this._updateFirstAndLastIndex()}remove(e){const t=this._indexToOffset(e);if(null===t)return[];const i=this._items.splice(t),s=[];for(let t=0;t<i.length;t++)s.push({change:"remove",index:e+t,value:i[t]});return this._updateFirstAndLastIndex(),s}valueAt(e){const t=this._indexToOffset(e);return null!==t?this._items[t]:null}indexOf(e,t){if(this._items.length<1)return null;if(e>this._items[this._items.length-1])return t?this._validOffsetToIndex(this._items.length-1):null;for(let i=0;i<this._items.length;++i){if(e===this._items[i])return this._validOffsetToIndex(i);if(e<this._items[i])return t?this._validOffsetToIndex(i):null}return null}state(e){var t,i;let s=0,r=this._items.length;return null!==e&&(s=null!==(t=this._indexToOffset(e.firstBar()))&&void 0!==t?t:0,r=(null!==(i=this._indexToOffset(e.lastBar()))&&void 0!==i?i:r-1)+1),{items:this._items.slice(s,r),zoffset:this._zoffset-s}}restoreState(e){null!==e&&(this._items=e.items,this._zoffset=e.zoffset,this._updateFirstAndLastIndex())}roughTime(e,t=null){e=Math.round(e);const i=this.valueAt(e);if(null!==i)return i;const s=this._items
;if(!s.length||s.length<2)return null;const r=s.length-1,n=this._validOffsetToIndex(0),o=this._validOffsetToIndex(r),a=s[0],l=s[r],c=(l-a)/(o-n);if(e<n){return a-(n-e)*c}if(e>o){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(e<o){const t=o-e;return r-Math.round(t/l)}if(e>a){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(e<r)return null;if(e===r)return this._validOffsetToIndex(s);for(;i>s+1;){const r=s+i>>1,n=t[r];if(n>e)i=r;else{if(!(n<e))return n===e?this._validOffsetToIndex(r):null;s=r}}return this._validOffsetToIndex(s)}_mergeImpl(e,t,i){if(0===i.length)return pt.logError("merge: 'values' does not contain any time points"),[];if(t>this._zoffset&&e+t>0)return pt.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.length<r)return pt.logError("merge: 'values' does not contain enough time points to fill in the new items. 'index': "+e.toString()+", previous 'zoffset': "+this._zoffset.toString()+", new 'zoffset': "+t.toString()+", 'values.length': "+i.length),[];this._items=new Array(r).concat(this._items),this._zoffset=t;for(let s=0;s<i.length;++s)this._items[e+s+t]=i[s];return[{change:"rebuild",index:this._validOffsetToIndex(0)}]}const r=[];let n=s;for(;n<this._items.length&&n-s<i.length;++n)this._items[n]=i[n-s],r.push({change:"update",index:this._validOffsetToIndex(n),value:i[n-s]});const o=s+i.length;if(o>this._items.length){const e=o-this._items.length;for(let t=n;t<n+e;++t){const e=this._items.length;this._items.push(i[t-s]),r.push({change:"append",index:this._validOffsetToIndex(e),value:i[t-s]})}}else{for(let e=o;e<this._items.length;++e)r.push({change:"remove",index:this._validOffsetToIndex(e),value:this._items[e]});this._items.length=o}return this._zoffset=t,r}_updateFirstAndLastIndex(){const e=this._offsetToIndex(0),t=this._offsetToIndex(this._items.length-1);this._range.setValue(null===e||null===t?null:{firstIndex:e,lastIndex:t})}_validOffsetToIndex(e){return e-this._zoffset}_offsetToIndex(e){return 0<=e&&e<this.size()?this._validOffsetToIndex(e):null}_indexToOffset(e){const t=e+this._zoffset;return 0<=t&&t<this.size()?t:null}}var gt=i(50503);const ft=new Map([[0,.1],[11,.1],[1,.35],[9,.35],[12,.35],[8,.35]]);class vt{constructor(e,t){this._styleSpecificRanges=new Map,this._logicalRange=e,this._defaultStyle=t}strictRange(e){
if(null===this._logicalRange)return null;void 0===e&&(e=this._defaultStyle);let t=this._styleSpecificRanges.get(e);if(void 0===t){const i=(ft.get(e)||0)/2;t=new dt.BarsRange(Math.floor(this._logicalRange.left()+i),Math.ceil(this._logicalRange.right()-i)),this._styleSpecificRanges.set(e,t)}return t}logicalRange(){return this._logicalRange}isValid(){return null!==this._logicalRange}static invalid(){return new vt(null,1)}}var yt=i(22677),St=i(55158);class bt{constructor(e,t=50){this._actualSize=0,this._usageTick=1,this._oldestTick=1,this._cache=new Map,this._tick2Labels=new Map,this._format=e,this._maxSize=t}format(e){const t=this._cache.get(e.valueOf());if(void 0!==t)return t.string;if(this._actualSize===this._maxSize){const e=this._tick2Labels.get(this._oldestTick);this._tick2Labels.delete(this._oldestTick),this._cache.delete((0,o.ensureDefined)(e)),this._oldestTick++,this._actualSize--}const i=this._format(e);return this._cache.set(e.valueOf(),{string:i,tick:this._usageTick}),this._tick2Labels.set(this._usageTick,e.valueOf()),this._actualSize++,this._usageTick++,i}}var wt=i(24526);let Ct;var Pt=i(11497),xt=i(15344),Tt=i(63146),It=i(8025),Mt=i(31045);class At{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}]}state(e){return{type:"constant",state:{baseIndex:this._baseIndex}}}restoreState(e){this._baseIndex=e.state.baseIndex}needAdjustingOnDataRestoring(){return!1}}const Lt={preserveBarSpacing:!1,lockVisibleTimeRangeOnResize:!1,rightBarStaysOnScroll:!0,minBarSpacing:.5},kt=te.enabled("low_density_bars"),Dt=kt?1:2,Et=(0,ie.getLogger)("Chart.TimeScale");var Vt;!function(e){e[e.DefaultRightOffset=10]="DefaultRightOffset",e[e.DefaultBarSpacing=6]="DefaultBarSpacing",e[e.UnplottableIndexCoord=-500]="UnplottableIndexCoord",e[e.DefaultRightOffsetPercentage=5]="DefaultRightOffsetPercentage",e[e.MaxIterationsForDynamicBarSpacingAdjust=20]="MaxIterationsForDynamicBarSpacingAdjust"}(Vt||(Vt={}));class Bt{constructor(e,t){this._width=0,this._widthChanged=new N.Delegate,this._rightOffset=10,this._rightOffsetChanged=new N.Delegate,this._maxRightOffsetChanged=new N.Delegate,this._defaultRightOffset=new O.WatchedValue(10),this._defaultRightOffsetPercentage=new O.WatchedValue(5),this._usePercentageRightOffset=new O.WatchedValue(!1),this._lastDefaultRightOffset=void 0,this._baseIndex=null,this._leftEdgeIndex=null,this._barSpacingChanged=new N.Delegate,this._barSpacing=6,this._visibleBars=vt.invalid(),this._visibleBarsInvalidated=!0,this._visibleBarsChanged=new N.Delegate,this._logicalRangeChanged=new N.Delegate,this._points=new mt,this._tickMarks=new yt.Tickmarks,this._onScroll=new N.Delegate,this._resetDelegate=new N.Delegate,this._scrollData=null,this._scaleStartPoint=null,this._commonTransitionStartState=null,this._formattedBySpan=new Map,this._requestingMoreData=!1,this._requestedTickmarksCount=0,this._endOfData=!1,
this._lockBarsAndLogicalRangeEvents=!1,this._resetAvailable=new O.WatchedValue(!1),this._pointWeights=new At,this._weightedPointsCache=[],this._options=(0,ht.deepExtend)({},Lt,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,o.ensureDefined)(this._tickMarks.maxIndex)+(i?0:1);for(let e=0;e<s.marks.length;e++)s.marks[e].index=r+e;this._tickMarks.addTail(s.marks),this._points.addTail(s.changes,i);const n=this._rightOffset-s.changes.length;this._updateRightOffset(n)}state(e){const t={m_barSpacing:this.barSpacing(),m_rightOffset:this._defaultRightOffset.value(),rightOffsetPercentage:this._defaultRightOffsetPercentage.value(),usePercentageRightOffset:this._usePercentageRightOffset.value()};if(e){t.m_rightOffset=Math.max(0,this._rightOffset);const e=this.visibleExtendedDataRange(this._model.mainSeries().data(),0);t.points=this._points.state(e),t.tickmarks=this._tickMarks.state(e),t.width=this._width,t.weights=this._pointWeights.state(e),t.baseIndex=this._baseIndex}return t}restoreState(e,t){var i;if(void 0===e.m_barSpacing)return void Et.logDebug("restoreState: invalid state");if(void 0===e.m_rightOffset)return void Et.logDebug("restoreState: invalid state");e.weights&&(this._pointWeights=function(e){let t;switch(e.type){case"constant":return t=new At,t.restoreState(e),t;case"computed":return t=new ComputedTimePointWeights,t.restoreState(e),t}throw new Error(`Unexpected time point weigths type ${e.type}`)}(e.weights));let s=e.m_barSpacing;const r=e.m_rightOffset<0&&!t?this.rightOffsetDefaultValue():e.m_rightOffset,n=r<0?this.rightOffsetDefaultValue():Math.round(r);if(this._defaultRightOffset.setValue(n),
void 0!==e.rightOffsetPercentage&&Number.isFinite(e.rightOffsetPercentage)&&this._defaultRightOffsetPercentage.setValue(e.rightOffsetPercentage),this._usePercentageRightOffset.setValue(Boolean(e.usePercentageRightOffset)),this._rightOffset=r,this._baseIndex=null!==(i=e.baseIndex)&&void 0!==i?i:this._baseIndex,t&&(this._requestedTickmarksCount=1/0,this._endOfData=!0,this._points.restoreState(e.points||null),this._tickMarks.restoreState(e.tickmarks||null),e.width&&this._width>0&&(s*=this._width/e.width)),t&&this._pointWeights.needAdjustingOnDataRestoring()){this._tryToUpdateBarSpacing(this._barSpacing,s);const e=this._points.range().value();if(e){const t=e.firstIndex;let i=s,r=s,n=0;(()=>{n=this.indexToCoordinate(t),n<0?(r=s,i=s/10):(i=s,r=10*s)})();for(let e=0;e<20&&Math.abs(n)>2;e++){const e=(r+i)/2;this._tryToUpdateBarSpacing(this._barSpacing,e),n=this.indexToCoordinate(t),n<0?r=e:i=e}}}else this._tryToUpdateBarSpacing(this._barSpacing,s);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,o.ensureNotNull)(this.visibleBarsStrictRange()),r=Math.max(s.firstBar(),s.firstBar()-i),n=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<=n))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>=St.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(),It.PlotRowSearchMode.NearestRight),s=e.search(t.lastBar(),It.PlotRowSearchMode.NearestLeft);return null===i||null===s?null:new dt.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,It.PlotRowSearchMode.NearestLeft),r=0===t?null:e.search(i.lastBar()+1,It.PlotRowSearchMode.NearestRight);return null===s&&(s=e.search(i.firstBar(),It.PlotRowSearchMode.NearestRight)),null===r&&(r=e.search(i.lastBar(),It.PlotRowSearchMode.NearestLeft)),null===s||null===r?null:new dt.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 Et.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,o.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,o.ensureNotNull)(this._points.valueAt(t)),s=this.indexToCoordinate(t);if(s<=0||s>=this._width)return null;const r=this.barSpacing(),n=this.baseIndex();let a;a=0===n?this._model.mainSeries().intervalObj().inMilliseconds()/1e3:(0,o.ensureNotNull)(this._points.valueAt(n))-(0,o.ensureNotNull)(this._points.valueAt(n-1));const l=s+(e-i)/a*r+1;return l<=0||l>=this._width?null:l}barBorders(e){const t={timePointIndex:e,left:NaN,center:NaN,right:NaN};return this.fillBarBorders([t]),t}fillBarBorders(e,t,i){var s,r;if(0===e.length)return;let n=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;if(!0===i&&(n=(0,y.upperbound)(e,gt.UNPLOTTABLE_TIME_POINT_INDEX,((e,t)=>e<t.timePointIndex),n,a+1)),n>a)return;const l=this._pointWeights.indexToTotalWeight(this.baseIndex()+this._rightOffset+.5),c=this._pointWeights.indexRangeToWeights(e[n].timePointIndex,e[a].timePointIndex,this._weightedPointsCache);let h=0,d=c[h];const u=d,p=c[c.length-1];let _=NaN,m=NaN,g=NaN,f=!0;for(let t=n;t<=a;t+=1){const i=e[t];if(i.timePointIndex<u.timePointIndex)_=u.left-(u.timePointIndex-i.timePointIndex),m=_+.5,g=_+1;else if(i.timePointIndex>p.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.timePointIndex<i.timePointIndex;)h+=1,(0,o.assert)(h<c.length,"Bar borders coordinates are not correct"),d=c[h],_=d.left,m=d.center,g=d.right;i.left=this._width-(l-_)*this._barSpacing,i.center=this._width-(l-m)*this._barSpacing,i.right=this._width-(l-g)*this._barSpacing}}timedValuesToCoordinates(e,t,i){var s,r
;const n=this._pointWeights.indexToTotalWeight(this.baseIndex()+this._rightOffset+.5),o=null!==(s=null==t?void 0:t.startItemIndex)&&void 0!==s?s:0;let a=o;const l=null!==(r=null==t?void 0:t.endItemIndex)&&void 0!==r?r:e.length;!0===i&&(a=(0,y.upperbound)(e,gt.UNPLOTTABLE_TIME_POINT_INDEX,((e,t)=>e<t.x),o,l));for(let t=a;t<l;++t){const i=e[t],s=n-this._pointWeights.indexToTotalWeight(i.x);i.x=this._width-s*this._barSpacing}for(let t=o;t<a;++t)e[t].x=-500}rightOffsetForTimePoint(e){const t=this.timeToCoordinate(e);if(null===t)return null;const i=(t-this._baseIndexBarCenterCoordinate())/this._barSpacing;return this._pointWeights.totalWeightToIndex(i)}scrollToRealtime(e,t){let i=this.targetDefaultRightOffset();i<0&&(i=this.rightOffsetDefaultValue());const s=()=>{void 0!==t&&t(),this._requestMoreData()};if(e){const e=this.logicalRange(),t=this._model.mainSeries().bars().lastIndex();if(null===e||null===t)return;const i=this.indexToCoordinate(e.right()+.5),r=this.indexToCoordinate(t+this._defaultRightOffset.value()+.5);return this._model.stopTimeScaleAnimation(),void this._model.setTimeScaleAnimation(new Mt.Animation({from:0,to:i-r,duration:1e3,easing:ct.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,Qe.viewportChangeEvent)()),void this._model.lightUpdate();const o=s+(e-s)*t;this._updateRightOffset(o),this._model.recalculateAllPanes((0,Qe.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,A.allowSavingDefaults)(!0),this._scalesProperties.childs().barSpacing.setValue(this._barSpacing),(0,A.allowSavingDefaults)(!1)),this._model.recalculateAllPanes((0,Qe.viewportChangeEvent)()),this._model.lightUpdate())):Et.logWarn(`setBarSpacing: invalid argument: ${e}`)}barSpacingChanged(){return this._barSpacingChanged}getValidBarSpacing(e){return null==e&&(e=this.barSpacing()),e<this.minBarSpacing()?this.minBarSpacing():e>this.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,o.ensureNotNull)(this._points.range().value()).firstIndex;return e<r?(t=(0,o.ensureNotNull)(this._points.valueAt(r)),i=e-r):e>s?(t=(0,o.ensureNotNull)(this._points.valueAt(s)),i=e-s):(t=(0,o.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+Dt}maxRightOffset(){return this.width()/this._barSpacing-Dt}maxRightOffsetChanged(){return this._maxRightOffsetChanged}onReset(){return this._resetDelegate}baseIndex(){return this._baseIndex||0}zoom(e,t,i){if(!Number.isFinite(e)||!Number.isFinite(t))return void Et.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.startScroll(this.indexToCoordinate(a)),this.scrollTo(e),this.endScroll()),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),Dt);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.maxBarSpacing()}canZoomOut(){return this.barSpacing()>this._options.minBarSpacing}minBarSpacing(){return this._options.minBarSpacing}maxBarSpacing(){const e=this.width();return kt?e:e/Dt}minVisibleBarCount(){return Dt}resetRightOffset(){this.setRightOffset(this.targetDefaultRightOffset())}reset(){this._visibleBarsInvalidated=!0,this._points.clear(),this._scrollData=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()):Et.logDebug(`setBaseIndex: invalid argument: ${e}`)}resetBaseIndex(){this._visibleBarsInvalidated=!0,this._baseIndex=null}setRightOffset(e){Number.isFinite(e)?(this._visibleBarsInvalidated=!0,this._updateRightOffset(e)):Et.logWarn(`setRightOffset: invalid argument: ${e}`)}correctBarSpacing(){this.isEmpty()||this.points().size()<this.width()/this.barSpacing()&&(this.setRightOffset(this.targetDefaultRightOffset()),this.setBarSpacing(this.width()/(this.points().size()+this.rightOffset())))}setTimePointWeights(e){this._weightedPointsCache=[],this._pointWeights=null!=e?e:new At,this._pointWeights.setBaseIndex(this.baseIndex()),this._visibleBarsInvalidated=!0}correctOffset(){const e=this.maxRightOffset();this._rightOffset>e&&(this._rightOffset=e,this._visibleBarsInvalidated=!0);const t=this.minRightOffset();null!==t&&this._rightOffset<t&&(this._rightOffset=t,this._visibleBarsInvalidated=!0)}logicalRange(){return this._visibleBarsInvalidated&&(this._visibleBarsInvalidated=!1,this._updateVisibleBars()),this._visibleBars.logicalRange()}restoreDefault(){this._visibleBarsInvalidated=!0,this._lockBarsAndLogicalRangeEvents=!0;const e=this._visibleBars;this.setBarSpacing(6),this.resetRightOffset(),this._lockBarsAndLogicalRangeEvents=!1,this._fireVisibleBarsChangedIfRequired(e,this._visibleBars),this._requestMoreData()}startScale(e){this._scrollData&&this.endScroll(),null===this._scaleStartPoint&&null===this._commonTransitionStartState&&(this.isEmpty()||(this._scaleStartPoint=e,this._saveCommonTransitionsStartState()))}scaleTo(e){if(null===this._commonTransitionStartState)return;const t=(0,Pe.clamp)(this._width-e,0,this._width),i=(0,Pe.clamp)(this._width-(0,o.ensureNotNull)(this._scaleStartPoint),0,this._width);if(0===t||0===i)return;const s=this.barIndexLengthToPercents(this.rightOffset());this.setBarSpacing(this._commonTransitionStartState.barSpacing*t/i),this.usePercentageRightOffset().value()&&this.rightOffset()>=0&&this.setRightOffset(this.percentsToBarIndexLength(s))}endScale(){null!==this._scaleStartPoint&&(this._scaleStartPoint=null,this._clearCommonTransitionsStartState(),this._requestMoreData())}startScroll(e){null===this._scrollData&&null===this._commonTransitionStartState&&(this.isEmpty()||(this._scrollData={startCoordinate:e,startRightEdgeLogical:this.baseIndex()+this._rightOffset+.5,startBaseIndex:this.baseIndex()},this._saveCommonTransitionsStartState()))}scrollTo(e){if(this._visibleBarsInvalidated=!0,null===this._scrollData)return;const{startCoordinate:t,startRightEdgeLogical:i,startBaseIndex:s}=this._scrollData,r=e-t,n=i+(this.baseIndex()-s),o=this.indexToCoordinate(n),a=this.coordinateToFloatIndex(o-r)-.5-this.baseIndex();this._updateRightOffset(a),this._onScroll.fire()}endScroll(){null!==this._scrollData&&(this._scrollData=null,
this._clearCommonTransitionsStartState(),this._requestMoreData())}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 bt((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===St.MILLISECOND_SPAN&&t)return"TimeWithMilliseconds";if(e<St.MINUTE_SPAN&&t)return"TimeWithSeconds";if(e<St.DAY_SPAN&&t)return"Time";if(e<St.WEEK_SPAN)return"DayOfMonth";if(e<St.MONTH_SPAN)return"DayOfMonth";if(e<St.YEAR_SPAN)return"Month";return"Year"}(t,!this._model.mainSeries().isDWM());return null!==wt.customFormatters.tickMarkFormatter?wt.customFormatters.tickMarkFormatter(e,s):function(e,t){switch(t){case"TimeWithMilliseconds":return new xt.TimeFormatter(xt.hourMinuteSecondMillisecFormat).format(e);case"TimeWithSeconds":case"Time":const s="TimeWithSeconds"===t?(0,Tt.getHourMinuteSecondFormat)(Pt.timeHoursFormatProperty.value()):(0,Tt.getHourMinuteFormat)(Pt.timeHoursFormatProperty.value());return new xt.TimeFormatter(s).format(e);case"DayOfMonth":return e.getUTCDate().toString();case"Month":return(void 0===Ct&&(Ct=[h.t(null,void 0,i(62310)),h.t(null,void 0,i(2507)),h.t(null,void 0,i(92767)),h.t(null,void 0,i(27072)),h.t(null,{context:"short"},i(13132)),h.t(null,void 0,i(429)),h.t(null,void 0,i(53786)),h.t(null,void 0,i(46450)),h.t(null,void 0,i(6816)),h.t(null,void 0,i(12179)),h.t(null,void 0,i(26899)),h.t(null,void 0,i(32084))]),Ct)[e.getUTCMonth()];case"Year":return e.getUTCFullYear().toString()}}(e,s)}onScroll(){return this._onScroll}invalidateVisibleBars(){this._visibleBarsInvalidated=!0}onTimeScaleCompleted(e){var t;if(this._requestingMoreData=!1,this._endOfData=e,te.enabled("fix_left_edge")&&this._endOfData){const e=null===(t=this._points.range().value())||void 0===t?void 0:t.firstIndex;void 0!==e&&this.setLeftEdgeFix(e)}this._requestMoreData()}requestMoreHistoryPoints(e){this._requestHistoryPoints(e)}targetDefaultRightOffset(){return this.usePercentageRightOffset().value()?this.percentsToBarIndexLength(this._defaultRightOffsetPercentage.value()):this._defaultRightOffset.value()}percentsToBarIndexLength(e){return.01*e*this._width/this._barSpacing}barIndexLengthToPercents(e){return 100*e*this._barSpacing/this._width}requestHistoryPointsIfNeeded(){if(this.isEmpty())return;if(this._endOfData)return void Et.logNormal("Skipping loading more data due end of data state");const e=this.visibleBarsStrictRange();if(null===e)return;const t=(0,o.ensureNotNull)(this._points.range().value()).firstIndex-e.firstBar();t<=0||this._requestHistoryPoints(t)}_requestMoreData(){this._requestFutureTickmarksIfNeeded(),this.requestHistoryPointsIfNeeded()}_requestFutureTickmarksIfNeeded(){if(this.isEmpty()||!this._model.chartApi().isConnected().value())return;const e=this.visibleBarsStrictRange();if(null===e)return;const t=e.lastBar()-(0,o.ensureNotNull)(this._points.range().value()).lastIndex
;if(t<=this._requestedTickmarksCount)return;const i=t-this._requestedTickmarksCount;this._requestedTickmarksCount=t,this._model.chartApi().requestMoreTickmarks((0,o.ensureNotNull)(this._model.mainSeries().seriesSource().instanceId()),i)}_requestHistoryPoints(e){this._model.chartApi().isConnected().value()&&(this._requestingMoreData?Et.logNormal("Skipping loading more data due active loading"):(this._requestingMoreData=!0,this._model.chartApi().requestMoreData(e)))}_updateVisibleBars(){const e=this._visibleBars;if(this.isEmpty())return void(this._visibleBars.isValid()&&(this._visibleBars=vt.invalid(),this._visibleBarsChanged.fire(null,e.strictRange()),this._logicalRangeChanged.fire(null,e.logicalRange())));const t=this.width()/this.barSpacing(),i=this.baseIndex(),s=i+this._rightOffset,r=s+.5,n=this._pointWeights.indexToTotalWeight(r)-t,o=Math.min(r-1,this._pointWeights.totalWeightToIndex(n))+.5;Number.isFinite(o)&&Number.isFinite(s)?(this._visibleBars=new vt(new ut(o,s),this._model.mainSeries().style()),this._lockBarsAndLogicalRangeEvents||this._fireVisibleBarsChangedIfRequired(e,this._visibleBars)):Et.logWarn(`updateVisibleBars error: baseIndex: ${i}, barSpacing: ${this._barSpacing}, rightOffset: ${this._rightOffset}`)}_fireVisibleBarsChangedIfRequired(e,t){dt.BarsRange.compare(e.strictRange(),t.strictRange())||this._visibleBarsChanged.fire(t.strictRange(),e.strictRange()),ut.compare(e.logicalRange(),t.logicalRange())||this._logicalRangeChanged.fire(t.logicalRange(),e.logicalRange())}_baseIndexBarCenterCoordinate(){const e=this.baseIndex()+this._rightOffset+.5,t=this._pointWeights.indexToTotalWeight(e);return this._width-t*this._barSpacing}_tryToUpdateBarSpacing(e,t){return e!==t&&(this._visibleBarsInvalidated=!0,this._barSpacing=t,this._barSpacingChanged.fire(t),!0)}_saveCommonTransitionsStartState(){this._commonTransitionStartState={barSpacing:this.barSpacing(),rightOffset:this.rightOffset()}}_clearCommonTransitionsStartState(){this._commonTransitionStartState=null}_maxRightOffsetOnChanged(){this._maxRightOffsetChanged.fire(this.maxRightOffset())}_updateRightOffset(e){const t=this._rightOffset;this._rightOffset=e,this.correctOffset(),this._rightOffset!==t&&this._rightOffsetChanged.fire(this._rightOffset),this._model.recalculateAllPanes((0,Qe.viewportChangeEvent)()),this._model.lightUpdate()}_defaultRightOffsetOptionsUpdated(){const e=this.rightOffset();if(te.enabled("lock_visible_range_when_adjusting_percentage_right_margin")&&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 Rt=i(52388),Nt=i(82826),Ot=i(63829),Ft=i(62839);class Wt{constructor(e){this._onChanged=new N.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 Ft.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=Ft.LineToolsGroup.fromState(e,s);null!==t&&i.push(t)}return new Wt(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}}}var Ht=i(2740),zt=i.n(Ht),Ut=i(14381);let jt=null;function Gt(e){return Boolean(e.symbolInfo.timezone)&&Boolean(e.symbolInfo.session)}class qt{constructor(e,t){var i,s;this._sourceTargetBarBuilder=null,this._cache=new Map,this._source=e,this._sourceSession=Ut.SessionInfo.fromState(e.session),this._target=t,this._targetSession=Ut.SessionInfo.fromState(t.session),this._isResolutionTheSame=M.Interval.isEqual(e.resolution,t.resolution)||M.Interval.isTicks(e.resolution)&&M.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=M.Interval.isDWM(e.resolution)&&!this._isSessionTheSame}sourceTimeToTargetTime(e){if(this._isSessionTheSame&&this._isResolutionTheSame)return e;if(!Gt(this._source)||!Gt(this._target))return e;let t=this._cache.get(e);if(void 0===t){let i=1e3*e;if(this._shouldCorrectTradingDay){let e=zt().utc_to_cal(this._sourceSession.timezone,i);e=this._sourceSession.spec.correctTradingDay(e);const t=new Date(e)
;zt().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===jt&&(jt=new Ut.SessionInfo("Etc/UTC","24x7")),jt);this._sourceTargetBarBuilder=(0,Ut.newBarBuilder)(this._target.resolution,this._targetSession,e)}return this._sourceTargetBarBuilder}}var $t=i(56468),Kt=i(19063),Yt=i(41925),Zt=i(46088);function Xt(e,t){return e.code<t.code?-1:e.code>t.code?1:0}class Jt{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(Xt),i}getItems(){return this._convertibleItems.map((e=>e.id))}}class Qt{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 ei=i(50335);class ti{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,ge.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,ei.isNumber)(e.index)||!(0,ei.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({pane:e.pane,point:t,linetool:this._model.currentTool()}),this._sourcePane=e.pane)}_removeSource(){null!==this._source&&(this._model.removeSource(this._source),this._source=null,this._sourcePane=null)}}
var ii,si=i(82783),ri=i(92693),ni=i(81171);!function(e){e[e.MagnetTolerance=50]="MagnetTolerance"}(ii||(ii={}));class oi{constructor(){this._lastValue=null}align(e,t,i){this._lastValue=null;let s=e;if(!(0,ni.magnetEnabled)().value())return s;const r=i.mainDataSource();if(null===r)return s;const n=r.model().mainSeries();if(r!==n)return s;const a=n.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}(n,t);if(!l)return s;const c=(0,o.ensure)(n.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,ni.magnetMode)().value()===ri.MagnetMode.StrongMagnet||Math.abs(u.y-d)<50)&&(s=u.price,this._lastValue=s),s}lastValue(){return this._lastValue}resetLastValue(){this._lastValue=null}}var ai=i(53388),li=i(37743),ci=i(30125);class hi extends ci.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,li.setLineStyle)(t,this._data.vertLineStyle);for(const e of this._data.timeMarks){const i=Math.round(e.coord*s);(0,li.drawVerticalLine)(t,i,0,o)}}if(this._data.horzLinesVisible){t.strokeStyle=this._data.horzLinesColor,(0,li.setLineStyle)(t,this._data.horzLineStyle);for(const e of this._data.priceMarks){const s=Math.round(e.coord*i);(0,li.drawHorizontalLine)(t,s,0,a)}}}}class di{constructor(e){this._renderer=new hi,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 ui extends G.DataSource{id(){return"grid"}paneViews(e){return[new di(e)]}name(){return"Grid"}}var pi=i(98558);class _i extends pi.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,Kt.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 mi extends _i{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=Le.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()?c.colorsPalette["color-cold-gray-600"]:c.colorsPalette["color-cold-gray-650"]:t.backgroung=void 0,s||(t.visible=s)}}class gi extends _i{_isVisible(){return null!==this._source.measurePane().value()}_bgColor(){return this._properties.childs().axisLineToolLabelBackgroundColorCommon.value()}}var fi,vi=i(65458),yi=(i(97702),i(40443)),Si=(i(19466),i(19475));i(81199);function bi(e){const t=e.priceScale();return null===t?0:t.isPercentage()||t.isIndexedTo100()?2:1}!function(e){e[e.NotDefined=0]="NotDefined",e[e.Regular=1]="Regular",e[e.Unregular=2]="Unregular"}(fi||(fi={}));class wi extends vi.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){const t=this._crosshair.y,i=this._chartModel.properties().childs().scalesProperties.childs().fontSize.value(),s=this._chartModel.timeScale().width(),r=this._crosshair.model().priceAxisRendererOptions(),n=i+2*this._crosshairPriceAxisView.additionalPadding(i)+r.paddingTop+r.paddingBottom,o=n,l=t-n/2,c=this._crosshair.pane,h=this._mainDataSourceOnPane(),d=h&&h.symbolSource(),u=!!d&&(d.isConvertedToOtherCurrency()||d.isConvertedToOtherUnit());if(this._updateGaOrigin(),null!==h){const e=bi(h),t=h.idForAlert(),i=this._chartModel.isInReplay().value(),s=this._crossHairMenuCachedState,r=te.enabled("chart_crosshair_menu");null!==s&&s.id===t&&s.priceScale===e&&s.isCurrencyOrUnitConverted===u&&s.isInReplay===i&&s.isMenuEnabled===r||(this._updateTooltipAndActionsAvailability(h,e,u),this._crossHairMenuCachedState={id:t,priceScale:e,isCurrencyOrUnitConverted:u,isInReplay:i,isMenuEnabled:r})}const p=null!==h&&(0,
Se.isActingAsSymbolSource)(h)?h.symbol():null,_=null!==c&&(c.maximized().value()||!c.collapsed().value())&&(Boolean(p)||!1);this._crosshairPriceAxisView.setPaneLabelVisible(_);const m=this._position();if(null!==m){const e=0,t=s-o,i=Boolean(Si.showPlusButtonOnCursor.value()),r=i?this._crosshair.x:void 0,c=void 0!==r?r-o/2:"left"===m?e:t,h=void 0!==r?r+o/2:"left"===m?e+o:t+o,d=(0,a.box)(new a.Point(c,l),new a.Point(h,l+n));this._data={itemBox:d,clickHandler:this._handleClick.bind(this,m,i,d)},this._crosshairPriceAxisView.setHitTestData(this._data),this._crosshairPriceAxisView.setXCoord(r)}super._updateImpl(e)}_priceScale(){return this._scale}_updateGaOrigin(){this._gaOrigin=Boolean(Si.showPlusButtonOnCursor.value())?"CH menu cursor":"CH menu"}_updateTooltipAndActionsAvailability(e,t,i){this._hasActions=!1;if(!(1===t))return;this._chartModel.isInReplay().value();this._hasActions=!1}_handleClick(e,t,i,s,r){(0,p.trackEvent)(this._gaOrigin,"click");const n=this._mainDataSourceOnPane(),o=null!==n&&(0,Se.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};m.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 n="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?Le.crosshairLock.value():void 0;if(void 0!==p){const e=(0,o.ensureNotNull)(this._chartModel.timeScale().points().roughTime(this._crosshair.index));Le.crosshairLock.setValue({type:1,price:this._crosshair.price,time:e,modelId:this._chartModel.id(),paneId:(0,o.ensureNotNull)(this._crosshair.pane).id()})}yi.ContextMenuManager.showMenu(e,{clientX:s.clientX,clientY:s.clientY,box:{x:l,w:d,y:h,h:u},attachToXBy:t?"auto":n?"left":"right",attachToYBy:"auto-strict",marginX:t?0:-d},void 0,{menuName:"CrosshairMenuView"},(()=>{void 0!==p&&Le.crosshairLock.setValue(p)}))}))}_mainDataSourceOnPane(){const e=this._crosshair.pane;return null!==e?e.mainDataSource():null}}var Ci,Pi=i(51056),xi=i(69186);class Ti extends ci.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e}hitTest(e){return void 0===this._data.clickHandler?null:new $t.HitTestResult($t.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,li.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,li.drawVerticalLine)(s,a,0,h),i&&l>=0&&(0,li.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(Ii),s.strokeStyle="#fff",s.lineWidth=1,s.stroke(Ii)}(e,a,l)}}!function(e){e.Path="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",e[e.Size=24]="Size",e.FillColor="#131722",e.StrokeColor="#fff",e[e.StrokeWidth=1]="StrokeWidth"}(Ci||(Ci={}));const Ii=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 Mi=c.colorsPalette["color-tv-blue-500"];class Ai{constructor(e,t){this._rendererData={},this._renderer=new Ti(this._rendererData),this._source=e,this._pane=t}update(){}renderer(){var e,t;const i=this._source.selectPointMode().value()!==Le.SelectPointMode.None,s=this._source.lockedPane(),r=(this._source.visible||null!==s)&&(this._source.areLinesVisible||i)&&!this._source.linesShouldBeHidden(),n=this._rendererData;if(!r||null===this._pane)return null;const a=this._source.paneForPointSelect(),l=this._source.isReplaySelection(),c=null!=s?s:this._source.pane,h=this._pane===c,d=l||(null!==a?c===a&&this._pane===a:h);if(n.scissors=!1,i&&(l||this._source.isOnHoveredChartWidget())&&d){const e=(0,o.ensureNotNull)(this._source.pointToSelect());n.color=this._source.lineColor()||Mi,l?(n.lineWidth=2,n.scissors=h):n.lineWidth=1,n.lineStyle=Pi.LINESTYLE_SOLID,n.horzLinesVisible=!0,n.vertLinesVisible=!0,n.drawCenter=!1,"time"===e?n.horzLinesVisible=!1:"price"===e&&(n.vertLinesVisible=!1)}else{const e=this._source.properties(),t=this._source.model().currentTool(),i=(0,
xi.lastMouseOrTouchEventInfo)(),s=i.isTouch&&!i.stylus&&((0,ge.isLineToolName)(t)||(0,Le.toolIsMeasure)(t));let r;r=s?Mi:e.childs().color.value();const o=e.childs().transparency.value();!s&&o>0&&(r=(0,Kt.generateColor)(r,o)),n.color=r,n.horzLinesVisible=this._pane===c&&(this._pane.maximized().value()||!this._pane.collapsed().value()),n.vertLinesVisible=!0,n.lineWidth=e.childs().width.value(),n.lineStyle=e.childs().style.value(),n.drawCenter=s&&this._pane===c}return n.x=null!==(e=this._source.lockedX())&&void 0!==e?e:this._source.x,n.y=null!==(t=this._source.lockedY())&&void 0!==t?t:this._source.y,this._renderer}}var Li=i(62189);const ki={backgroundColor:(0,Kt.generateColor)(c.colorsPalette["color-tv-blue-500"],70),borderColor:(0,Kt.generateColor)(c.colorsPalette["color-tv-blue-500"],20)};class Di{constructor(e){this._renderer=new Li.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(){if(!this._rectangle)return null;const e={backcolor:ki.backgroundColor,color:ki.borderColor,fillBackground:!0,linewidth:1,points:[this._rectangle.min,this._rectangle.max],extendLeft:!1,extendRight:!1};return this._renderer.setData(e),this._renderer}}var Ei=i(63273),Vi=i(92953),Bi=i(91046),Ri=i(17330),Ni=i(95201),Oi=i(49857);const Fi=h.t(null,void 0,i(41643)),Wi=h.t(null,{context:"study"},i(24261)),Hi=(0,De.getPercentageFormatter)(),zi=new Vi.TimeSpanFormatter,Ui=(0,De.getVolumeFormatter)(),ji=(0,c.getHexColorByName)("color-tv-blue-500"),Gi=(0,c.getHexColorByName)("color-ripe-red-400"),qi={bgColorPositive:(0,Kt.generateColor)(ji,80),bgColorNegative:(0,Kt.generateColor)(Gi,80),colorPositive:(0,c.getHexColorByName)("color-tv-blue-600"),colorNegative:(0,c.getHexColorByName)("color-ripe-red-400"),labelBgColorPositive:ji,labelBgColorNegative:Gi};var $i;!function(e){e[e.MinArrowDistance=50]="MinArrowDistance"}($i||($i={}));class Ki{constructor(e,t){this._horzTrenRenderer=new Bi.TrendLineRenderer,this._vertTrenRenderer=new Bi.TrendLineRenderer,this._bgRenderer=new Li.RectangleRenderer,this._labelRenderer=new Ri.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 n=(0,o.ensureNotNull)(this._source.measurePane().value()),l=s.price,c=r.price,h=r.index-s.index,d=(0,Ei.forceLTRStr)(""+h),u=(0,o.ensureNotNull)(n.mainDataSource()),p=(0,o.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+=" ("+Hi.format(100*e)+")"}const g=(0,Ei.forceLTRStr)(m);this._label=g+"\n"+Fi.format({count:d});const f=(0,
o.ensureNotNull)(u.firstValue()),v=this._source.model().timeScale().indexToCoordinate(s.index),y=this._source.model().timeScale().indexToCoordinate(r.index),S=n.defaultPriceScale().priceToCoordinate(l,f),b=n.defaultPriceScale().priceToCoordinate(c,f);this._p1=new a.Point(v,S),this._p2=new a.Point(y,b);const w=this._source.model().timeScale().indexToUserTime(s.index),C=this._source.model().timeScale().indexToUserTime(r.index);let P=null;null!==w&&null!==C&&(P=(C.valueOf()-w.valueOf())/1e3);const x=this._pane.model().mainSeries().symbolInfo(),T=x&&(0,De.getPipFormatter)(x),I=T?T.format(_):null,M=null!==I?" , "+I:"",A=null!==P?zi.format(P):null,L=null!==A?", "+(0,Ei.startWithLTR)(A):"";this._label=(0,Ei.forceLTRStr)(g+M)+"\n"+Fi.format({count:d})+L;const k=this._source.measureVolume();Number.isNaN(k)||(this._label+=`\n${Wi} ${Ui.format(k)}`);const E=c<l?qi.bgColorNegative:qi.bgColorPositive,V=c<l?qi.colorNegative:qi.colorPositive,B=c<l?qi.labelBgColorNegative:qi.labelBgColorPositive,R={points:[this._p1,this._p2],linewidth:0,fillBackground:!0,color:E,backcolor:E,extendLeft:!1,extendRight:!1};this._bgRenderer.setData(R);const N=this._p1.add(this._p2).scaled(.5);{const e=Math.round(N.y),t=new a.Point(this._p1.x,e),i=new a.Point(this._p2.x,e),s={points:[t,i],color:V,linewidth:1,linestyle:Pi.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:Oi.LineEnd.Normal,rightend:Math.abs(t.x-i.x)>=50?Oi.LineEnd.Arrow:Oi.LineEnd.Normal};this._horzTrenRenderer.setData(s)}{const e=Math.round(N.x),t=new a.Point(e,this._p1.y),i=new a.Point(e,this._p2.y),s={points:[t,i],color:V,linewidth:1,linestyle:Pi.LINESTYLE_SOLID,extendleft:!1,extendright:!1,leftend:Oi.LineEnd.Normal,rightend:Math.abs(t.y-i.y)>=50?Oi.LineEnd.Arrow:Oi.LineEnd.Normal};this._vertTrenRenderer.setData(s)}const O={x:0,y:10},F=.5*(this._p1.x+this._p2.x),W=this._p2.y,H=new a.Point(F,W),z=(U=(0,o.ensureNotNull)(this._label),{points:[H],text:U,color:"#FFFFFF",horzAlign:"center",vertAlign:"middle",font:D.CHART_FONT_FAMILY,offsetX:O.x,offsetY:O.y,bold:!1,italic:!1,fontsize:12,padding:8,highlightBorder:!1,backgroundColor:B,backgroundTransparency:10,boxPaddingVert:9,boxPaddingHorz:9,backgroundRoundRect:4});var U;this._labelRenderer.setData(z);const j=this._labelRenderer.measure(),G=(0,Ri.calculateLabelPosition)(j,this._p1,this._p2,O,this._pane.height());this._labelRenderer.setPoints([G])}renderer(){if(null===this._p1||null===this._p2)return null;const e=new Ni.CompositeRenderer;return e.append(this._bgRenderer),e.append(this._horzTrenRenderer),e.append(this._vertTrenRenderer),e.append(this._labelRenderer),e}}var Yi,Zi=i(12027),Xi=i(99875);!function(e){e[e.Light=0]="Light",e[e.Dark=1]="Dark"}(Yi||(Yi={}));class Ji extends K.MediaCoordinatesPaneRenderer{constructor(e){super(),this._svgMap=new Map,this._data=e,this._svgMap.set(e.theme,this._createSvgRenderer(e.theme))}hitTest(){return null}setData(e){this._svgMap.has(e.theme)||this._svgMap.set(e.theme,this._createSvgRenderer(e.theme)),this._data=e}_drawImpl(e){
const{context:t,mediaSize:i}=e,{theme:s,x:r}=this._data,n=this._svgMap.get(s);if(!n)return;const o=n.viewBox(),{width:a,height:l}=o,c=a/2;r+c<0||r-c>i.width||(t.translate(r-c,i.height-l),n.render(t,{targetViewBox:o}))}_createSvgRenderer(e){const t=1===e?Xi.replace("backgroundColor",(0,c.getHexColorByName)("color-cold-gray-900")).replace("lineColor",(0,c.getHexColorByName)("color-cold-gray-450")):Xi.replace("backgroundColor",(0,c.getHexColorByName)("color-white")).replace("lineColor",(0,c.getHexColorByName)("color-cold-gray-550"));return(0,Zi.svgRenderer)(t)}}class Qi{constructor(e){this._source=e,this._renderer=new Ji(this._getRenderData(0))}update(){}renderer(){var e;const t=this._source.visible&&this._source.areLinesVisible,i=this._source.lockedX(),s=0===(null===(e=Le.crosshairLock.value())||void 0===e?void 0:e.type);return t&&s&&null!==i?(this._renderer.setData(this._getRenderData(i+1)),this._renderer):null}_getRenderData(e){return{x:e,theme:this._source.model().dark().value()?1:0}}}var es=i(49483),ts=i(7576),is=i(82587);class ss extends ts.DataWindowView{constructor(e){super(),this._invalidated=!0,this._dateItem=new ts.DataWindowItem("",h.t(null,void 0,i(62154)),""),this._timeItem=new ts.DataWindowItem("",h.t(null,void 0,i(12806)),""),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(is.notAvailable),this._dateItem.setValue(is.notAvailable),this._model.timeScale().isEmpty())return;let t=this._model.crossHairSource().appliedIndex();if(!(0,ei.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 rs=i(66156);const ns=c.colorsPalette["color-tv-blue-500"],os=h.t(null,{context:"Replay"},i(53310));class as extends rs.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?`${os}: ${this._model.dateTimeFormatter().format(t)}`:""}return super._getText(e)}_getBgColor(){if(this._source.isReplaySelection())return ns;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 ls=i(61105),cs=i(10074);const hs={menuEnabled:!1,menuForMainSourceOnly:!1,disableTradingMenuActions:!1,
disableDrawHorizLineMenuAction:!1};let ds=0;const us=(0,ie.getLogger)("Chart.Crosshair");class ps extends G.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 O.WatchedValue(null),this._measurePaneViewCache=new WeakMap,this._startMeasurePoint=null,this._endMeasurePoint=null,this._lastValidMeasurePoint=null,this._isOnHoveredChartWidget=!1,this._crossHairSelectPointMode=new O.WatchedValue(Le.SelectPointMode.None),this._selectionPane=null,this._selectionView=new Di(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 N.Delegate,this._pointSelectedDelegate=new N.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({},hs,i||{}),this._linesShouldBeHidden=this._model.readOnly(),this._dataWindowView=new ss(e),this.setSelectionEnabled(!1);const s=e=>t=>t===(0,o.ensureNotNull)(this._measurePane.value()).defaultPriceScale()?e():null;this._currentPosPriceProvider=e=>{const t=(0,o.ensureNotNull)(this.pane);if(e===t.defaultPriceScale())return this.price;const i=(0,o.ensureNotNull)(t.defaultPriceScale().mainSource()).firstValue();if(null===i)return null;const s=t.defaultPriceScale().priceToCoordinate(this.price,i),r=(0,o.ensureNotNull)(e.mainSource()).firstValue();return null===r?null:e.coordinateToPrice(s,r)},this._startMeasurePriceProvider=s((()=>(0,o.ensureNotNull)(this._startMeasurePoint).price)),this._endMeasurePriceProvider=s((()=>(0,o.ensureNotNull)(this._lastMeasurePoint()).price)),this._properties=t;this._timeAxisView=new as(e,this,(()=>this.appliedIndex()),!1),this._startMeasureTimeAxisView=new as(e,this,(()=>(0,o.ensureNotNull)(this._startMeasurePoint).index),!0),this._endMeasureTimeAxisView=new as(e,this,(()=>(0,o.ensureNotNull)(this._lastMeasurePoint()).index),!0),e.readOnly()||Le.cursorTool.subscribe((e=>this.areLinesVisible="arrow"!==e),{callWithLast:!0}),this._crosshairLock=Le.crosshairLock.spawn(),this._showPlusButtonOnCursor=Si.showPlusButtonOnCursor.spawn();const r=()=>{this.updateAllViews((0,Qe.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 a.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=Le.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,o.assert)(null===this._volumeCalculator),this._volumeCalculator=new ls.SeriesTimeRangeVolumeCalculator(this.model().mainSeries())),this._model.updatePane(t)}finishMeasure(e){this._endMeasurePoint=e,this._createMeasurePointset((0,o.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,o.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()!==Le.SelectPointMode.None&&this._setSelectPointModeState(Le.SelectPointMode.None),this._selectFromAllChartsIfOutOfData=null}requestSelectPoint(e){(0,o.assert)(this._crossHairSelectPointMode.value()===Le.SelectPointMode.None,"Point already requested");const{pointType:t,pane:i,lineColor:s=null,selectFromAllChartsIfOutOfData:r,selectPointMode:n=Le.SelectPointMode.Study}=e;i&&((0,o.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(n)}onPointSelected(){return this._pointSelectedDelegate}
trySelectCurrentPoint(){var e;const t=this.pane;if(!t)return;const i=(0,o.ensureNotNull)(this._requestedPoint);let s=null;if(!this._model.mainSeries().bars().search(this.index,It.PlotRowSearchMode.Exact)&&"price"!==i&&(this._selectFromAllChartsIfOutOfData&&(s=null!==(e=Math.min(...Array.from(Le.barTimesUnderCursor.values())))&&void 0!==e?e:null),null===s))return;if(this._paneForRequestedPoint&&this._paneForRequestedPoint!==t)return;let r,n=s;if("price"===i||null!==s||(n=this._model.timeScale().indexToTimePoint(this.index),null!==n)){if("time"!==i){const e=t.mainDataSource();if(null===e)return;const i=e.firstValue(),s=e.priceScale();if(null===i||null===s)return;r=s.coordinateToPrice(this.y,i)}this._setSelectPointModeState(Le.SelectPointMode.None),this._pointSelectedDelegate.fire({time:null!=n?n:void 0,price:r},t)}}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,It.PlotRowSearchMode.NearestRight);return r&&Le.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()!==Le.SelectPointMode.None&&this._setSelectPointModeState(Le.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,mi,!0)[0]),this._startMeasurePoint&&r.push(this._createPriceAxisViewOnDemand(this._startMeasurePriceAxisViews,null,e,t,this._startMeasurePriceProvider,gi)[0]),this._lastMeasurePoint()&&r.push(this._createPriceAxisViewOnDemand(this._endMeasurePriceAxisViews,null,e,t,this._endMeasurePriceProvider,gi)[0]),r}timeAxisViews(){const e=[],t=null===this._requestedPoint||"price"!==this._requestedPoint||!this._isOnHoveredChartWidget;return this._linesShouldBeHidden||!this.visible&&null===Le.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 Ai(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 Ki(this,e),this._measurePaneViewCache.set(e,t)),t.update((0,Qe.sourceChangeEvent)(this.id())),s.push(t)}if((Si.addPlusButtonProperty.value()||this._showPlusButtonOnCursor.value())&&1!==(null===(t=Le.crosshairLock.value())||void 0===t?void 0:t.type)){const t=e===this.pane,i=!es.CheckMobile.any()||window.screen.width>=320,r=Le.tool.value(),n=(0,ge.isLineToolName)(r),o=null!==this._model.lineBeingEdited()||null!==this._model.lineBeingCreated()||this._model.sourcesBeingMoved().length>0||null!==this._model.customSourceBeingMoved()||(0,Le.toolIsMeasure)(r);if(t&&this._isOnHoveredChartWidget&&this._crossHairSelectPointMode.value()===Le.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,mi,!0)[1];null!==t&&s.push(t)}}}}return 0===(null===(i=Le.crosshairLock.value())||void 0===i?void 0:i.type)&&(null===this._timeLockPaneView&&(this._timeLockPaneView=new Qi(this)),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 Si.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,n,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 n(this,i,s,r),l.set(s,h),void 0!==c){const e=new wi(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,o.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,Qe.sourceChangeEvent)(this.id())),this._movedDelegate.fire({index:this.index,price:this.price}),!0)}_tryToUpdateData(e,t,i){const s=this.x,r=this.y,n=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,o.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||n!==this.price||l!==this.pane}_priceScaleByPane(e){return e&&!e.defaultPriceScale().isEmpty()?e.defaultPriceScale():null}_setSelectPointModeState(e){e===Le.SelectPointMode.None&&(this._requestedPoint=null,this._selectLineColor=null,this._paneForRequestedPoint&&(this._paneForRequestedPoint=null,this._model.panesCollectionChanged().unsubscribe(this,this._paneCollectionChanged))),Le.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=Le.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(),++ds,this._currentMeasurePointsetAndSymbolId={measurePointsetId:ds,symbolId:(0,o.ensureNotNull)(this._model.mainSeries().seriesSource().symbolInstanceId())};const n=(0,cs.getServerInterval)(this._model.mainSeries().interval());this._model.chartApi().createPointset(this._currentMeasurePointsetIdWithPrefix(),"turnaround",this._currentMeasurePointsetAndSymbolId.symbolId,n,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,o.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 us.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,Qe.sourceChangeEvent)(this.id())),this._model.updateSource(this)}}var _s=i(63812),ms=i(77007),gs=i(31229),fs=i(45126),vs=i(98272),ys=i(25149),Ss=i(56840);class bs{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 ws=i(88960),Cs=i(99531),Ps=i(74047);const xs=new fs.TranslatedString("remove deselected empty line tools",h.t(null,void 0,i(27171))),Ts=te.enabled("auto_enable_symbol_labels"),Is=te.enabled("saveload_separate_drawings_storage"),Ms=(0,ie.getLogger)("Chart.ChartModel");var As;function Ls(e,t){const i=e.indexOf(t);return-1!==i&&(e.splice(i,1),!0)}function ks(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()}}!function(e){e[e.MnPaneHeight=30]="MnPaneHeight"}(As||(As={}));const Ds={isSnapshot:!1,readOnly:!1,watermarkEnabled:!0,shiftVisibleRangeOnNewBar:!0,currencyConversionEnabled:!1,unitConversionEnabled:!1,countdownEnabled:!0,lastPriceAnimationEnabled:!0,onWidget:!1,hideIdeas:!1};!function(e){e[e.RecalcVisibleRangeStudiesTimeout=2e3]="RecalcVisibleRangeStudiesTimeout",e[e.RecalcVisibleRangeStudiesLargeTimeout=5e3]="RecalcVisibleRangeStudiesLargeTimeout",e[e.RecalcVisibleRangeStudiesTimeoutLibrary=500]="RecalcVisibleRangeStudiesTimeoutLibrary",e[e.RecalcColorStudiesTimeout=250]="RecalcColorStudiesTimeout"}(As||(As={}));const Es={throttle:r.default,debounce:s.default},Vs=new Map([[f.RecalcVisibleRangeStudiesReason.ViewportChangeUserAction,{timeout:500,adapter:"debounce"}],[f.RecalcVisibleRangeStudiesReason.DataUpdate,{timeout:500,adapter:"throttle"}],[f.RecalcVisibleRangeStudiesReason.SeriesRestart,{timeout:500,adapter:"debounce"}],[f.RecalcVisibleRangeStudiesReason.SeriesCompleted,{timeout:500,adapter:"debounce"}],[f.RecalcVisibleRangeStudiesReason.StudyCreation,{timeout:500,adapter:"debounce"
}]]),Bs=Array.from(Vs.values());class Rs{constructor(e,t,i,r,n,o,a,l,c,h){this._onRearrangePanes=new N.Delegate,this._lineToolsGroupModel=new Wt,this._sourcesBeingMoved=[],this._activeItemBeingMoved=null,this._lineBeingEdited=null,this._linePointBeingEdited=null,this._linePointBeingChanged=null,this._customSourceBeingMovedHitTestData=null,this._customSourceBeingMoved=null,this._dataSourceCollectionChanged=new N.Delegate,this._sourceProperitesChanged=new N.Delegate,this._sourceZOrderChanged=new N.Delegate,this._symbolSourceResolved=new N.Delegate,this._symbolSourceResolvingActive=new O.WatchedValue(!1),this._adjustForDividendsAvailability=new O.WatchedValue(0),this._adjustForDividendsEnabled=new O.WatchedValue(!1),this._currentTool="",this._lineBeingCreated=null,this._paneBeingCreatedLineOn=null,this._lineCancelled=new N.Delegate,this._phantomSourceContainer=new ti(this),this._destroyed=!1,this._isSettingsExternalPosition=!1,this._isTimeScrolling=!1,this._magnet=new oi,this._scrollingState=null,this._modelIntervals=[],this._rendererOptionsProvider=new E(this),this._studyInserted=new N.Delegate,this._cachedStudiesMaxOffset=0,this._replayStatus=new O.WatchedValue(0),this._panes=[],this._tagsChanged=new N.Delegate,this._strategySources=[],this._strategySourcesChange=new N.Delegate,this._activeStrategySource=new O.WatchedValue(null),this._symbolIntervalChanged=new N.Delegate,this._paneCollapsingAvailable=new O.WatchedValue(!1),this._panesCollectionChanged=new N.Delegate,this._scrollEnabled=te.enabled("chart_scroll"),this._zoomEnabled=te.enabled("chart_zoom"),this._lollipopSourcesWatcher=null,this._alertsWatcher=null,this._hoveredSource=null,this._hoveredSourceChanged=new N.Delegate,this._lastHoveredHittestData=null,this._hoveredSourceOrigin=null,this._lastSelectedHittestData=null,this._topmostCustomSources=[],this._fgCustomSources=[],this._bgCustomSources=[],this._allCustomSources=[],this._customSourcesMap=new Map,this._multiPaneSources=[],this._showLegendProperty=new L.Property,this._id=(0,se.guid)(),this._chartSaveTime=null,this._availableCurrenciesList=null,this._availableCurrencies=new Jt([]),this._availablePriceSources=new bs([]),this._availableUnitsObject=null,this._availableUnits=new Qt({}),this._availablePriceSourcesBySymbol=new Map,this._shouldBeSavedEvenIfHidden=!1,this._watchedThemeSpawn=d.watchedTheme.spawn(),this._gradientColorsCache=null,this._studiesWV=new F.WatchedObject([],y.compareTwoCollectionsByIds),this._studiesExcludeInternalWV=new F.WatchedObject([],y.compareTwoCollectionsByIds),this._resetScalesAvailable=new O.WatchedValue(!1),this._recalcVRStudiesParams={reasons:new Set},this._recalcColorStudiesParams={},this._replayStudyStrategy=new O.WatchedValue(null),this._recalcVisibleRangeStudiesImplDebouncedByAdapter=new Map(Object.keys(Es).map((e=>[e,new Map(Bs.filter((t=>t.adapter===e)).map((e=>[e.timeout,Es[e.adapter](this._recalcVisibleRangeStudiesImpl.bind(this,this._recalcVRStudiesParams),e.timeout)])))]))),this._recalcColorStudiesImplDebounced=(0,
s.default)(this._recalcColorStudiesImpl.bind(this,this._recalcColorStudiesParams),250),this._width=0,this._resetScales=new N.Delegate,this._chartThemeLoaded=new N.Delegate,this._selection=new w,this._selectedSourceChanged=new N.Delegate,this._symbolSourceCollectionChanged=new N.Delegate,this._gridSource=new ui,this._visibleRangeStudiesInputs=new F.WatchedObject(null),this._syncPointCache=new Map,this._lastAppliedGotoTimeRange=null,this._lastGotoTimeRange=null,this._lollipopSourcesWatcherLoader=null,this._sessions=null,this._onMultipaneSourcesCollectionChanged=new N.Delegate,this._replayStudyStrategyInputs=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(Se.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,ae.merge)((0,ae.clone)(Ds),a),this._hibernateWV=l,this._linkingGroupIndex=c,this._isAutoSaveEnabled=h,this._readOnly=this._options.readOnly,this._isSnapshot=this._options.isSnapshot,
this._chartSaveTime=(new Date).valueOf(),this._backgroundColor=new O.WatchedValue(this._getBackgroundColor()),this._backgroundTopColor=new O.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 O.WatchedValue(this._getBackgroundCounterColor()),this._backgroundColor.subscribe((()=>this._backgroundCounterColor.setValue(this._getBackgroundCounterColor()))),this._isDark=(0,ws.combine)((e=>"white"===e),this._backgroundCounterColor.weakReference()),this._watchedThemeSpawn.subscribe(this._updateBackgroundColor.bind(this)),this._symbolSourceResolvingActive.subscribe(this._recalcAdjustForDividendsAvailability),(0,Le.init)();const u=this._readOnly?new L.Property((0,j.defaults)("chartproperties.paneProperties.crossHairProperties")):this._properties.childs().paneProperties.childs().crossHairProperties;this.m_crossHairSource=new ps(this,u,this._options.crossHair),this._crossHairSelectPointMode=this.m_crossHairSource.selectPointMode().spawn(),this._crossHairSelectPointMode.subscribe((e=>{if(e!==Le.SelectPointMode.None&&this.lineBeingCreated()){const e=Le.tool.value();this.cancelCreatingLine(),Le.tool.setValue(e)}})),this._tagsChanged=new N.Delegate;const p=new A.DefaultProperty({defaultName:"chartproperties.mainSeriesProperties",excludedDefaultsKeys:["priceAxisProperties.lockScale","priceAxisProperties.percentage","priceAxisProperties.indexedTo100","priceAxisProperties.isInverted","priceAxisProperties.log","priceAxisProperties.logDisabled","priceAxisProperties.percentageDisabled","priceAxisProperties.autoScaleDisabled"]});p.merge(i.childs().mainSeriesProperties.state()),this._timeScale=new Bt(this,this._options.timeScale),this._timeScale.resetAvailable().subscribe(this._updateResetScalesAvailableValue);const _={countdownEnabled:this._options.countdownEnabled,lastPriceAnimationEnabled:this._options.lastPriceAnimationEnabled};this.m_mainSeries=new ye.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,Qe.sourceChangeEvent)(this.m_mainSeries.id())),m()})),(0,H.currencyUnitVisibilityProperty)().subscribe(this,m),(0,z.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,si.areEqualTimeFrames)(this._lastAppliedGotoTimeRange.range,i)){const e=this.appliedTimeFrame().value();null!==e&&!this._lastAppliedGotoTimeRange.actual&&(0,si.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.m_mainSeries.onSymbolIntervalChanged().subscribe(this,this._onSymbolIntervalChanged),this._createLollipopSourcesWatcher(),this._watermarkSource=this._options.watermarkEnabled?new Q(this):null,this._timezoneExceptExchange=(0,ws.combine)(((e,t)=>"exchange"!==e?e:t),(0,Cs.createWVFromProperty)(this._properties.childs().timezone).ownership(),(0,Cs.createWVFromGetterAndSubscription)((()=>{var e,t;return null!==(t=null===(e=this.mainSeries().symbolInfo())||void 0===e?void 0:e.timezone)&&void 0!==t?t:null}),this.mainSeries().symbolResolved()).ownership())}restart(){var e,t;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();null===(t=null===(e=this._sessions)||void 0===e?void 0:e.get())||void 0===t||t.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,o.assert)(0===this._topmostCustomSources.length),(0,o.assert)(0===this._fgCustomSources.length),(0,o.assert)(0===this._bgCustomSources.length),(0,o.assert)(0===this._allCustomSources.length),(0,o.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,H.currencyUnitVisibilityProperty)().unsubscribeAll(this),(0,z.autoLogButtonsVisibilityProperty)().unsubscribeAll(this),this._crossHairSelectPointMode.destroy(),this.m_mainSeries.symbolResolved().unsubscribe(this,this._clearAvailablePriceSources),this.m_mainSeries.onSymbolIntervalChanged().unsubscribe(this,this._onSymbolIntervalChanged),this._timezoneExceptExchange.destroy(),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}replayStudyStrategy(){return this._replayStudyStrategy}setReplayStudyStrategy(e){this._replayStudyStrategy.setValue(e)}async replayStudyStrategyProperties(){if(null===this._replayStudyStrategyInputs){const e=await getReplayStrategyMetaInfo();if(null!==this._replayStudyStrategyInputs)return this._replayStudyStrategyInputs;this._replayStudyStrategyInputs=new A.DefaultProperty({
defaultName:"replayStudyStrategyInputs",factoryDefaultsSupplier:()=>(0,ae.clone)(e.defaults.inputs)})}return this._replayStudyStrategyInputs}clearReplayStudyStrategyProperties(){this._replayStudyStrategyInputs=null}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 fe.PriceRange(n,o)),this.recalculateAllPanes((0,Qe.viewportChangeEvent)()),this.invalidate(this._paneInvalidationMask(r,W.InvalidationLevel.Light))}setTimeViewport(e,t){const i=this.appliedTimeFrame().value();null!==this._lastAppliedGotoTimeRange&&null!==i&&(0,si.areEqualTimeFrames)(this._lastAppliedGotoTimeRange.range,i.val)&&!this._lastAppliedGotoTimeRange.actual||(this.timeScale().zoomToBarsRange(e,t),this.recalculateAllPanes((0,Qe.viewportChangeEvent)()),this.recalcVisibleRangeStudies(f.RecalcVisibleRangeStudiesReason.ViewportChangeUserAction),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,Qe.viewportChangeEvent)()),this.lightUpdate(),this.recalcVisibleRangeStudies(f.RecalcVisibleRangeStudiesReason.ViewportChangeUserAction)}lineBeingEdited(){return this._lineBeingEdited}linePointBeingEdited(){return this._linePointBeingEdited}activeItemBeingMoved(){return this._activeItemBeingMoved}linePointBeingChanged(){return this._linePointBeingChanged}mainSeries(){return this.m_mainSeries}updateAllPaneViews(e){var t;for(const t of this._panes)t.updateAllViews(e);null===(t=this._watermarkSource)||void 0===t||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}orderedDataSources(e){let t=[this.m_crossHairSource];for(let i=0;i<this._panes.length;i++){let s=this._panes[i].sourcesByGroup().all();e&&(s=s.slice().reverse()),t=t.concat(s)}return t}timeScale(){return this._timeScale}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,y.subtract)(i,this.selection().allSources()),r=(0,y.subtract)(this.selection().allSources(),i);r.concat(i).forEach((e=>e.updateAllViews((0,Qe.selectionChangeEvent)())));let n=[];if(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)})),1===r.length){const[e]=r;(0,S.isLineTool)(e)&&e.hasAlert().value()&&0===e.alertStatus().value()&&e.synchronizeAlert().catch((()=>{}))}n=n.filter((e=>null!==this.dataSourceForId(e.id()))),n.length>0&&this._undoModel.removeSources(n,!1,xs),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=Wt.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 n of e){if(!n.isSynchronizable())continue;const e=n.linkKey().value()||(0,se.randomHash)();n.linkKey().setValue(e);const a=n.state(!1),l=n.normalizedPoints(),c=n.normalizedPointsForCreating(),h=n.properties().interval.value(),d=i.interval(),u=e=>{if(M.Interval.isEqual(h,d))return e.map((e=>{const t=(0,o.ensureNotNull)(r.timePointToIndex(e.time_t))+e.offset;return{price:e.price,timeStamp:(0,o.ensureNotNull)(this.externalTimeStamp(t))}}));{const t=s.createNewModelWithResolution(h);return e.map((e=>({price:e.price,timeStamp:0===e.offset?e.time_t:t.projectTime(e.time_t,e.offset)})))}},p=u(l),_=u(c),m={...a,id:n.id(),linkKey:e,points:p,pointsForCreating:_,linetool:n.toolname,model:this,symbol:i.symbol(),withUndo:t,zOrder:n.zorder(),finalState:{points:l,interval:h},pointPositionPercents:n.isFixed()?n.calcPositionPercents():void 0,sharingMode:n.sharingMode().value()};(0,Le.copyLineTool)(m)}}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,o.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<this._modelIntervals.length;e++)clearInterval(this._modelIntervals[e]);this._modelIntervals=[]}insertStudyWithParams(e,t,i,s,r,a,l,c,h,d,u){var p,_;let m=null;if(!r&&void 0!==e.groupingKey){const t=this.findNonOverlayStudyWithGroupingKey(e.groupingKey);null!==t&&(m=t.pane)}null===m&&(r||e.is_price_study?m=(0,o.ensureNotNull)(this.paneForSource(null!==(p=null==a?void 0:a[0])&&void 0!==p?p:this.m_mainSeries)):(m=this.createPane(),void 0!==d&&m.setPaneSize(d))),"Compare@tv-basicstudies"===e.id&&this.m_mainSeries.priceScale().setMode({log:!1,percentage:!0});const g=(0,ae.merge)((0,n.default)(null!=s?s:{}),{inputs:t,parentSources:[]}),v=null!=a?a:[],y=(0,I.prepareStudyProperties)(e,g,m,(0,V.studyMetaInfoRepository)().studyVersioning(),v),S=(0,R.createStudy)(this,y,v,e,u),b=m.findSuitableScale(S,null!==(_=null==a?void 0:a[0])&&void 0!==_?_:this.mainSeries(),l);if(b===this.mainSeries().priceScale()&&(0,Se.isSymbolSource)(S)){const e=c?(0,vs.sourceNewCurrencyOnPinningToPriceScale)(S,b,this,!0):null,t=h?(0,we.sourceNewUnitOnPinningToPriceScale)(S,b,this,!0):null;null===e&&null===t||S.setSymbolParams({currency:e||void 0,unit:t||void 0})}(0,Se.isSymbolSource)(S)&&(0,o.ensureNotNull)(m).hasDataSource(this.mainSeries())&&Ts&&!Ss.getBool("enable_symbol_labels_on_inserting_compare_once",!1)&&((0,A.allowSavingDefaults)(!0),this.properties().childs().scalesProperties.childs().showSymbolLabels.setValue(!0),(0,A.allowSavingDefaults)(!1),Ss.setValue("enable_symbol_labels_on_inserting_compare_once",!0));const w=S.start();if(i&&m.id()===i.paneId)m.insertDataSource(S,b,i.zorder);else{m.addDataSource(S,b,!1);null!==S.preferredZOrder()&&m.insertAfter([S],this.mainSeries())}return S.isLinkedToSeries()&&S.setOwnerSource(this.mainSeries()),this.recalculatePane(m,(0,Qe.sourceChangeEvent)(S.id())),this.fullUpdate(),this._invalidateBarColorerCaches(),this._recalcVisibleRangeStudiesImpl({studies:[S],reasons:new Set([f.RecalcVisibleRangeStudiesReason.StudyCreation])}),this._recalcColorStudiesImpl({studies:[S],force:!0}),this._studyInserted.fire(S),S.maxOffset().subscribe(this._boundUpdateStudiesMaxOffset,{callWithLast:!0}),{study:S,startPromise:w}}replaceStudyStub(e,t){const i=this.paneForSource(e);if(null===i)return!1;const s=e.priceScale(),r=e.zorder(),n=e.ownerSource();return this.paneForSource(e)===i?i.replaceSource(e,t,s):(i.insertDataSource(t,s,r),this.removeSource(e)),t.setOwnerSource(n),this.dataSources().forEach((i=>{
i.ownerSource()===e&&i.setOwnerSource(t)})),this._invalidateBarColorerCaches(),t.start(),this.recalculatePane(i,(0,Qe.sourceChangeEvent)(t.id())),this.fullUpdate(),!0}insertStudyStub(e,t,i,s){const r=void 0!==t,n=new T.StudyStub(this,null!=i?i:null,e,r,null!=s?s:null);let a;if(t||!r){a=(0,o.ensureNotNull)(this.mainPane());const e=!0===t?this.mainSeries().priceScale():a.createPriceScaleAtPosition("overlay");a.addDataSource(n,e,!1)}else a=this.createPane(),a.addDataSource(n,null,!1);return n.setZorder(a.newStudyZOrder()),this.recalculatePane(a,(0,Qe.sourceChangeEvent)(n.id())),this.fullUpdate(),n}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)}restoreStudyStub(e){var t;const i=this.insertStudyStub(e.title,e.isOverlay,e.descriptor);return null===(t=this.paneForSource(i))||void 0===t||t.changeSourceId(i,e.id),i.setStatus(e.status),i}allLineTools(){return this._getAllSources(S.isLineTool)}setHoveredSource(e,t=null,i){const s=this._hoveredSource!==e;if(this._hoveredSourceOrigin=null!=i?i:null,!s&&(0,$t.hitTestResultDataAreEqual)(this._lastHoveredHittestData,t))return;this._lastHoveredHittestData=t;let r=null;if(this._hoveredSource){this._hoveredSource.updateAllViews((0,Qe.selectionChangeEvent)()),r=new W.InvalidationMask(W.InvalidationLevel.Cursor);const e=this._invalidationMaskForSource(this._hoveredSource,W.InvalidationLevel.Light);null!==e&&r.merge(e)}if(this._hoveredSource=e,e){e.updateAllViews((0,Qe.selectionChangeEvent)()),r||(r=new W.InvalidationMask(W.InvalidationLevel.Cursor));const t=this._invalidationMaskForSource(e,W.InvalidationLevel.Light);null!==t&&r.merge(t)}r&&this.invalidate(r),s&&this._hoveredSourceChanged.fire(e)}properties(){return this._properties}chartApi(){return this._chartApi}disconnect(){var e,t;null===(t=null===(e=this._sessions)||void 0===e?void 0:e.get())||void 0===t||t.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}hoveredSourceOrigin(){return this._hoveredSourceOrigin}hoveredSourceChanged(){return this._hoveredSourceChanged}lastHittestData(){return this._lastHoveredHittestData}lastSelectedHittestData(){return this._lastSelectedHittestData}lightUpdate(){this.invalidate(W.InvalidationMask.light())}fullUpdate(){this.invalidate(W.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,Ht.get_timezone)(this.timezone());let n=(0,Ht.utc_to_cal)(r,s);this.mainSeries().isDWM()&&(n=i.getSession().spec.correctTradingDay(n),(0,Ht.set_hms)(n,0,0,0,0,(0,Ht.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 n=e,a=t;if(null!==r.symbolInfo()){const i=(0,o.ensureNotNull)(this.timezoneExceptExchange().value()),s=(0,Ht.get_timezone)(i),l=(0,Ht.utc_to_cal)(s,e),c=(0,Ht.utc_to_cal)(s,t);if(r.isDWM()){const e=(0,Ht.get_timezone)("Etc/UTC");(0,Ht.set_hms)(l,0,0,0,0,e),(0,Ht.set_hms)(c,0,0,0,0,e)}n=l.getTime(),a=c.getTime()}const l=(0,o.ensureDefined)(s.maxIndex),c=(0,o.ensureDefined)(s.minIndex);if(n>=(0,o.ensureNotNull)(s.indexToTime(c)).valueOf()||r.endOfData()){const e=(e,t)=>e<t,t=e=>(0,o.ensureNotNull)(s.indexToTime(e)).valueOf(),h=(0,y.lowerboundExt)(t,n,e,s.nearestIndex(n),l);let d=n===a?h:(0,y.lowerboundExt)(t,a,e,s.nearestIndex(a),l);this._lastGotoTimeRange=null,null!==this._lastAppliedGotoTimeRange&&(this._lastAppliedGotoTimeRange.actual=!1);const u=i.baseIndex();if(h+Math.max(d-h+1,i.minVisibleBarCount())>u){const e=i.targetDefaultRightOffset();d-u<e&&(d=u+e)}const p=h===d&&h===c&&r.endOfData()?h-1:h;i.zoomToBarsRange(p,d),this.lightUpdate()}else{const i={type:"time-range",from:e/1e3,to:t/1e3};null===this._lastAppliedGotoTimeRange?(this._lastAppliedGotoTimeRange={range:i,actual:!0},r.loadDataTo(i)):(0,si.areEqualTimeFrames)(this._lastAppliedGotoTimeRange.range,i)||(this._lastGotoTimeRange={from:e,to:t})}}paneForSource(e){if(!(0,v.isDataSource)(e))return Array.from(this._customSourcesMap.values()).includes(e)?this.paneForSource(this.mainSeries()):null;for(let t=this._panes.length-1;t>=0;t--)if(this._panes[t].hasDataSource(e))return this._panes[t];return e instanceof Yt.BarsMarksContainer?this.paneForSource(this.mainSeries()):null}mainPane(){var e;return null!==(e=this._panes.find((e=>e.isMainPane())))&&void 0!==e?e:null}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,Le.isToolEditingNow.setValue(!1)),e===this.lineBeingCreated()&&(this._lineBeingCreated=null,Le.isToolCreatingNow.setValue(!1)),!t&&e.stop&&e.stop();const i=this.detachSource(e),s=this.mainSeries().priceScale();return(0,R.isStudy)(e)&&(0,Se.isActingAsSymbolSource)(e)&&e.priceScale()===s&&s.isPercentage()&&1===s.seriesLikeSources().filter(Se.isActingAsSymbolSource).length&&s.setMode({percentage:!1}),this.fullUpdate(),this._invalidateBarColorerCaches(),(0,R.isStudy)(e)&&((0,m.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,m.emit)("drawing_event",e.id(),"remove")),i}timezone(){return this._properties.childs().timezone.value()}timezoneExceptExchange(){return this._timezoneExceptExchange}allStudies(e){const t=e?e=>(0,R.isStudy)(e)&&!0:R.isStudy;return this._getAllSources(t)}studiesWV(e){return e?this._studiesExcludeInternalWV.readonly():this._studiesWV.readonly()}listUserStudies(e){const t=[];for(const i of this._panes)for(const s of i.priceDataSources())if((0,R.isStudy)(s)&&!(0,R.isFundamentalStudy)(s)&&s.showInObjectTree()){const{id:i,shortDescription:r}=s.metaInfo();if(e.dontCountVolume&&"Volume@tv-basicstudies"===i||e.dontCountCompare&&"Compare@tv-basicstudies"===i||e.dontCountOverlay&&"Overlay@tv-basicstudies"===i)continue;t.push(r)}return t}findNonOverlayStudyWithGroupingKey(e,t){const i=void 0!==t?[t]:this._panes;for(const t of i){const i=t.dataSources().find((i=>(0,R.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(W.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,Kt.gradientColorAtPercent)(i,t,e/100);return this._gradientColorsCache.colors.set(e,s),s}backgroundCounterColor(){return this._backgroundCounterColor.readonly()}dark(){return this._isDark}readOnly(){return this._readOnly}defaultResolutions(){return this.chartApi().defaultResolutions()}availableCurrencies(){const e=this._getAvailableCurrencies();return e.length!==this._availableCurrencies.size()&&(this._availableCurrencies=new Jt(e)),this._availableCurrencies}currencyConversionEnabled(){return this._options.currencyConversionEnabled}availableUnits(){const e=this._getAvailableUnits();return this._availableUnits.unitsChanged(e)&&(this._availableUnits=new Qt(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 bs(t)),this._availablePriceSources}resetDeferredStudies(){Ge.instance(this).reset()}waitForStudy(e){return Ge.instance(this).get(e)}resetWaitForStudy(e){
Ge.instance(this).delete(e)}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,R.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,$e.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,Le.restoreLineToolState)({model:this,linkKey:r,state:t})}restoreFactoryDefaults(e){e.restoreFactoryDefaults(),this.recalcVisibleRangeStudies(f.RecalcVisibleRangeStudiesReason.ViewportChangeUserAction)}preferences(){return(0,ms.preferencesByWhiteList)(this,this.mainSeries())}applyPreferences(e){for(const[t,i]of Object.entries(e)){const e=this._properties.child(t);void 0!==i&&void 0!==e&&e.mergeAndFire(i)}if(void 0!==e.timeScale){const t=e.timeScale;this._timeScale.defaultRightOffset().setValue(t.defaultRightOffset),this._timeScale.defaultRightOffsetPercentage().setValue(t.defaultRightOffsetPercentage),this._timeScale.usePercentageRightOffset().setValue(t.usePercentageRightOffset)}this._properties.saveDefaults(),this.m_mainSeries.applyPreferences(e.mainSeries),this.sessions().restoreState({properties:e.sessions},!1),this.recalculateAllPanes((0,Qe.globalChangeEvent)()),this.fullUpdate()}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,n){this._sourcesBeingMoved=e,this._activeItemBeingMoved=i;let a=!1;if(this._sourcesBeingMoved.forEach((e=>{!a&&(0,R.isStudy)(e)&&(a=!0);const l=(0,o.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,o.ensureDefined)(s.get(h)),a={screen:this._percentPositionToPoint(t,l)};e.startMoving(a,i,r,n)}else e.startMoving(t,i,r,n);const d=this._paneInvalidationMask(l,W.InvalidationLevel.Light);this.invalidate(d)})),!n){const s=e.filter(S.isLineTool).filter((e=>e.linkKey().value()&&e.isSynchronizable())).map((e=>e.linkKey().value()));if(s.length&&t.logical){const n=this.externalTimeStamp(t.logical.index),a={linkKeys:s,model:this,symbol:this.mainSeries().symbol(),point:{price:t.logical.price,timeStamp:n},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,o.ensureNotNull)(this.paneForSource(e));a.pointPositionPercents.set(i,this._pointToPercentPosition((0,o.ensureDefined)(t.screen),s))}}})),(0,Le.startMovingLineTool)(a)}}Le.isToolMovingNow.setValue(!0),a&&Le.isStudyEditingNow.setValue(!0)}moveSources(e,t,i,s){if(this._sourcesBeingMoved.filter((e=>!e.isLocked||!e.isLocked())).forEach((r=>{const n=(0,S.isLineTool)(r)?r.linkKey().value():null;if(null!==n&&t.has(n)){const e=(0,o.ensureNotNull)(this.paneForSource(r)),a=(0,o.ensureDefined)(t.get(n)),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,o.ensureNotNull)(this.paneForSource(t));r.pointPositionPercents.set(t.linkKey().value(),this._pointToPercentPosition((0,o.ensureDefined)(e.screen),i))}})),(0,Le.moveLineTool)(r)}}endMovingSources(e,t,i){const s=this._sourcesBeingMoved.map((s=>{const r=(0,o.ensureNotNull)(this.paneForSource(s)),n=s.endMoving(e,t,i),a=this._paneInvalidationMask(r,W.InvalidationLevel.Light);return a.invalidateAll(W.InvalidationLevel.Light),this.invalidate(a),n})),r=this._sourcesBeingMoved.filter(S.isLineTool).filter((e=>e.isSynchronizable()&&!!e.linkKey().value())).map((e=>e.linkKey().value())),n=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,Le.finishMovingLineTool)({linkKeys:r,model:this,finalStates:n,changes:s}),this._sourcesBeingMoved=[],this._activeItemBeingMoved=null,Le.isToolMovingNow.setValue(!1),Le.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._panes.reduce(((t,i)=>i.setWidth(e)||t),!1)||this._width!==e)&&(this._width=e,this._timeScale.setWidth(e,t),
this.recalculateAllPanes((0,Qe.viewportChangeEvent)()),this.recalcVisibleRangeStudies(f.RecalcVisibleRangeStudiesReason.ViewportChangeUserAction))}setPaneHeight(e,t){e.setHeight(t),this.recalculateAllPanes((0,Qe.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){this._undoModel.hideMaximizedPaneIfRequired();const s=this._properties.childs().paneProperties;t&&s.merge(t);const r=new at(this._timeScale,s,this,i);return void 0!==e?this._panes.splice(e,0,r):this._panes.push(r),r.onTagsChanged().subscribe(this,Rs.prototype.onPaneTagsChanged),r.dataSourcesCollectionChanged().subscribe(this,(()=>this._dataSourceCollectionChanged.fire(r))),r.symbolSourceCollectionChanged().subscribe(this,(()=>this._onSymbolSourceCollectionChanged(r))),r.priceSourcesCollectionChanged().subscribe(this,(()=>this._onPriceSourcesCollectionChanged(r))),r.sourcePropertiesChanged().subscribe(this,(e=>this._sourceProperitesChanged.fire(r,e))),r.sourceZOrderChanged().subscribe(this,(e=>this._sourceZOrderChanged.fire(r,e))),r.symbolSourceResolved().subscribe(this,(e=>this._symbolSourceResolved.fire(r,e))),r.symbolSourceResolvingActive().subscribe(this._recalcSymbolResolvingActive),r.collapsed().subscribe(this._recalcPaneCollapsingAvailable),r.resetPriceScalesAvailable().subscribe(this._updateResetScalesAvailableValue,{callWithLast:!0}),this._recalcPaneCollapsingAvailable(),this._panesCollectionChanged.fire(this._panes),this.invalidate(W.InvalidationMask.panesOrder()),r}removePane(e){this._undoModel.hideMaximizedPaneIfRequired();const t=e;t.destroy();const i=this._panes.indexOf(t);-1!==i&&(this._panes.splice(i,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),t.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(W.InvalidationMask.panesOrder())}changePanesHeight(e,t){if(this._panes.length<2)return;(0,o.assert)(e>=0&&e<this._panes.length,"Invalid pane index");const i=this._panes[e],s=this._panes.reduce(((e,t)=>e+t.stretchFactor()),0),r=this._panes.reduce(((e,t)=>e+t.height()),0),n=r-30*(this._panes.length-1);t=Math.min(n,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(n,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,o.ensureNotNull)(e.dataWindowView()).update(),ks(this._panes),this.invalidate(W.InvalidationMask.cursor()),this._undoModel.syncCrosshair(null),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,n,a,l,c,h;let d=NaN;const u=this._timeScale.coordinateToVisibleIndex(e),p=null!==(a=null===(n=null!==(r=this._lineBeingEdited)&&void 0!==r?r:this.lineBeingCreated())||void 0===n?void 0:n.priceScale())&&void 0!==a?a:i.defaultPriceScale();let _=null;!p.isEmpty()&&Number.isFinite(t)&&(_=(0,o.ensureNotNull)(i.mainDataSource()).firstValue(),null!==_&&(d=p.coordinateToPrice(t,_)));const m=this._crossHairSelectPointMode.value()!==Le.SelectPointMode.None,g=this.currentTool(),f=this.mainSeries(),v=this.crossHairSource(),y=v.index,S=v.price,b=m||Le.isStudyEditingNow.value(),w=p===this.m_mainSeries.priceScale()&&(this._lineBeingCreated||this._lineBeingEdited||(0,ge.isLineToolName)(g)||(0,Le.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,o.ensureNotNull)(v.dataWindowView()).update(),ks(this._panes);const P=f.syncModel();this.crossHairSource().startMeasurePoint()||this._lineBeingCreated?this.lightUpdate():this.invalidate(W.InvalidationMask.cursor());const x=this.lineBeingCreated();if(x){const e=x.linkKey().value();if(!this._isSettingsExternalPosition){const t=x.setLastPoint({index:u,price:d},s);if(x.updateAllViews((0,Qe.sourceChangeEvent)(x.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,Le.setLineToolLastPoint)({model:this,linkKey:e,point:{timeStamp:(0,o.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)}}(y!==u||S!==d)&&this._syncCrosshair(s)}setExternalPosition(e,t){let i;const s=this.crossHairSource();if(s.setOnHoveredChartWidget(!1),null!==e&&(0,ae.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,o.ensureNotNull)(this.paneForSource(this.mainSeries())),n=this._timeScale.indexToCoordinate(i),a=(0,o.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(n,i,r,t)}return s.setOnHoveredChartWidget(!1),void(this._isSettingsExternalPosition=!1)}s.clearPosition(),(0,o.ensureNotNull)(s.dataWindowView()).update(),ks(this._panes),this.invalidate(W.InvalidationMask.cursor())}startScaleTime(e){this._timeScale.startScale(e)}scaleTimeTo(e){this._timeScale.scaleTo(e),this.recalculateAllPanes((0,Qe.viewportChangeEvent)()),this.lightUpdate()}endScaleTime(){this._timeScale.endScale(),this.lightUpdate(),this.recalcVisibleRangeStudies(f.RecalcVisibleRangeStudiesReason.ViewportChangeUserAction)}resetTimeScale(){this._timeScale.restoreDefault(),this.recalculateAllPanes((0,Qe.viewportChangeEvent)()),this.recalcVisibleRangeStudies(f.RecalcVisibleRangeStudiesReason.ViewportChangeUserAction),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,W.InvalidationLevel.Light))}endScalePrice(e,t){e.endScalePrice(t),this.invalidate(this._paneInvalidationMask(e,W.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,W.InvalidationLevel.Light))}restorePriceScaleState(e,t,i){e.restorePriceScaleState(t,i),this.invalidate(this._paneInvalidationMask(e,W.InvalidationLevel.Light))}currentTool(){return this._currentTool}setCurrentTool(e){this._currentTool!==e&&((0,ge.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,R.isStudy)(i)?!t&&i.parentSources().includes(e):i.ownerSource()===e))}onRearrangePanes(){return this._onRearrangePanes}studyInserted(){return this._studyInserted}finishLineTool(e){const t=e.linkKey().value();(0,Le.drawOnAllCharts)().value()&&null!==t&&e.isSynchronizable()&&(0,Le.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),Le.isToolEditingNow.setValue(!0);const n=(0,o.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,Qe.sourceChangeEvent)(this._lineBeingEdited.id()));const a=this._paneInvalidationMask(n,W.InvalidationLevel.Light);this.invalidate(a);const l=e.linkKey().value();if(l&&e.isSynchronizable()&&void 0!==i&&void 0!==t){const e=(0,o.ensureNotNull)(this.externalTimeStamp(t.index));(0,Le.startChangingLineTool)({linkKey:l,model:this,symbol:this.mainSeries().symbol(),point:{price:t.price,timeStamp:e},pointIndex:i,envState:s||null})}}createLineTool(e){const{pane:t,point:i,linetool:s,linkKey:r=null,sharingMode:n=0,id:l,fromExternalModel:c}=e;let{properties:h,ownerSource:d}=e;if((0,o.assert)((0,ge.isLineToolName)(s),`Cannot create unknown line tool: ${s}`),h){const e={...gs.intervalsVisibilitiesDefaults},t=h.childs().intervalsVisibilities.state();(0,ae.merge)(e,null!=t?t:{});const i=h.state();i.intervalsVisibilities=e,h=(0,S.createLineToolProperties)(s,i,this)}const u=(0,S.createLineTool)(s,this,h,null,void 0,l);if("LineToolExecution"!==s){let e;switch(s){case"LineToolIcon":e=u.properties().childs().icon.value().toString(16).toUpperCase();break;case"LineToolEmoji":e=u.properties().childs().emoji.value();break;case"LineToolSticker":e=u.properties().childs().sticker.value()}(0,p.trackEvent)("drawings","Study_Drawing_"+s,e)}(0,S.isStudyLineTool)(u)&&(0,p.trackEvent)("studies",`Study_${u.metaInfo().id}`);const _=!u.linkKey().value()&&!r;d=(0,o.ensureDefined)(d||(0,o.ensureNotNull)(t.mainDataSource())),h||(0,S.prepareLineToolPropertiesByOwnerSource)(u.properties(),d),u.setOwnerSource(d);const m=d.priceScale();if(u.setPriceScale(m),Is&&d===this.mainSeries()&&u.share(n),t.addDataSource(u,m,!1),null!==u.preferredZOrder()&&t.insertAfter([u],this.mainSeries()),(0,Le.drawOnAllCharts)().value()){const e=u.isSynchronizable()?r||(0,se.randomHash)():null;u.linkKey().setValue(e)}else u.linkKey().setValue(r);let g;if(_&&u.enableCurrentIntervalVisibility(),u.isFixed()){const e=(0,o.ensureNotNull)((0,o.ensureNotNull)(t.mainDataSource()).firstValue()),s=this._timeScale.indexToCoordinate(i.index),r=(0,
o.ensureNotNull)(m).priceToCoordinate(i.price,e);g=u.addFixedPoint(new a.Point(s,r))}else g=u.addPoint(i);return g||(this._lineBeingCreated={lineDataSource:u,fromExternal:!!c},this._paneBeingCreatedLineOn=t,Le.isToolCreatingNow.setValue(!0)),this.fullUpdate(),u}endChangingLinetool(e,t){const i=(0,o.ensureNotNull)(this._lineBeingEdited),s=i.endChanging(!1,e,t);this._lineBeingEdited=null,Le.isToolEditingNow.setValue(!1),this._linePointBeingEdited=null,this._linePointBeingChanged=null,this.lightUpdate();const r={points:i.normalizedPoints(),interval:this.mainSeries().interval()},n=i.linkKey().value();null!==n&&i.isSynchronizable()&&!t&&(0,Le.finishChangingLineTool)({model:this,linkKey:n,symbol:this.mainSeries().symbol(),finalState:r,changes:s})}continueCreatingLine(e,t,i,s,r){const n=(0,o.ensureNotNull)(this.lineBeingCreated()),a=n.addPoint(e,t,i,r);n.updateAllViews((0,Qe.sourceChangeEvent)(n.id()));const l=new W.InvalidationMask(W.InvalidationLevel.Light);return a&&(this._paneBeingCreatedLineOn=null,this._lineBeingCreated=null,Le.isToolCreatingNow.setValue(!1)),this.invalidate(l),a}cancelCreatingLine(){const e=this.lineBeingCreated();e&&(this.removeSource(e),this._lineBeingCreated=null,this._lineCancelled.fire(),Le.isToolCreatingNow.setValue(!1),(0,Le.drawOnAllCharts)().value()&&e.isSynchronizable()&&(0,Le.cancelLineTool)({model:this}))}lineBeingCreated(){var e;return(null===(e=this._lineBeingCreated)||void 0===e?void 0:e.lineDataSource)||null}lineBeingCreateFromExternal(){var e;return(null===(e=this._lineBeingCreated)||void 0===e?void 0:e.fromExternal)||!1}paneBeingCreatedLineOn(){return this._paneBeingCreatedLineOn}lineCancelled(){return this._lineCancelled}isPhantomLine(e){return this._phantomSourceContainer.source()===e}changeLinePoint(e,t,i){const s=(0,o.ensureNotNull)(this._lineBeingEdited),r=(0,o.ensureNotNull)(this._linePointBeingEdited);let n=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,n=t.price)}s.updateAllViews((0,Qe.sourceChangeEvent)(s.id())),this.lightUpdate();const l=s.linkKey().value();if(!i&&null!==l&&s.isSynchronizable()){const e=(0,o.ensureNotNull)(this._linePointBeingChanged),i={indexesChanged:a!==e.index,pricesChanged:n!==e.price},c=s.getChangePointForSync(r);if(null!==c){const e=this.externalTimeStamp(a);null!==e&&(n=c.price,(0,Le.changeLineTool)({linkKey:l,model:this,symbol:this.mainSeries().symbol(),point:{price:n,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 n=s[i],a=n.price!==t.price,l=n.index!==t.index;if(e.getChangePointForSync(i)){const e=(0,o.ensureNotNull)(this.externalTimeStamp(t.index));(0,Le.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,Qe.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,Qe.viewportChangeEvent)()),this.lightUpdate()}endScrollTime(){this._timeScale.endScroll(),this.lightUpdate(),this.recalcVisibleRangeStudies(f.RecalcVisibleRangeStudiesReason.ViewportChangeUserAction),this._isTimeScrolling=!1}startScrollPrice(e,t,i){e.startScrollPrice(t,i)}scrollPriceTo(e,t,i){e.scrollPriceTo(t,i),this.invalidate(this._paneInvalidationMask(e,W.InvalidationLevel.Light))}endScrollPrice(e,t){e.endScrollPrice(t),this.invalidate(this._paneInvalidationMask(e,W.InvalidationLevel.Light))}addCustomSource(e,t,i=f.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 f.CustomSourceLayer.Background:this._bgCustomSources.push(s);break;case f.CustomSourceLayer.Foreground:this._fgCustomSources.push(s);break;case f.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 f.CustomSourceLayer.Background:return this._bgCustomSources;case f.CustomSourceLayer.Foreground:return this._fgCustomSources;case f.CustomSourceLayer.Topmost:return this._topmostCustomSources;default:return this._allCustomSources}}addMultiPaneSource(e){this._multiPaneSources.push(e),this._onMultipaneSourcesCollectionChanged.fire(),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._onMultipaneSourcesCollectionChanged.fire(),this._multiPaneSources.splice(t,1)),this.lightUpdate()}multiPaneSources(e){return this._multiPaneSources.filter((t=>!e.hasDataSource(t)))}onMultipaneSourcesCollectionChanged(){return this._onMultipaneSourcesCollectionChanged}rendererOptionsProvider(){return this._rendererOptionsProvider}magnet(){return this._magnet}priceAxisRendererOptions(){return this._rendererOptionsProvider.options()}dateTimeFormatter(){return this._dateTimeFormatter}dateFormatter(){return this._dateFormatter}timeFormatter(){return this._timeFormatter}isUnmergeAvailableForSource(e){if(!this._unmergeAvailable(e))return!1;return(0,o.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,
o.ensureNotNull)(this._sessions)}createSessions(e){null===this._sessions&&(this._sessions=new B((async()=>{const t=await i.e(7539).then(i.bind(i,83943));return this.addCustomSource("sessions",((i,s)=>{const r=new t.Sessions(i,s,e);return r.start(),r}),f.CustomSourceLayer.Background),this.customSourceForName("sessions")})()))}createPrePostMarket(e){this.addCustomSource("prePostMarket",((t,i)=>new PrePostMarket(t,i,e)))}watermarkSource(){return this._watermarkSource}watermarkContentProvider(){return Ps.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}async canChangeResolution(e){return this.m_mainSeries.canChangeResolution(e)}theme(){var e;const t=this.properties().childs().paneProperties.state(["horzGridProperties.style","vertGridProperties.style"]);delete t.topMargin,delete t.bottomMargin;const i=(0,o.ensureDefined)(this.mainSeries().state().state);delete i.symbol,delete i.interval,delete i.currencyId,delete i.unitId;const s={mainSourceProperties:i,sessions:null===(e=this.sessions().get())||void 0===e?void 0:e.properties().state(),chartProperties:{paneProperties:t,scalesProperties:this.properties().childs().scalesProperties.state()},version:this.version()};return s.version=this.version(),s}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(x.isStudyInputDependsOnChartColors).length>0));await Promise.all(e.map((e=>e.propertiesPatched())))}state(e,t,i,s){var r,n;const o=this.publishedChartsTimelineSource(),a=this.properties().childs(),l=a.tradingProperties.state(),c={panes:this._panes.map((r=>r.state(!0,e,!1,t,i,s))),timeScale:this._timeScale.state(e),chartProperties:{paneProperties:a.paneProperties.state(["horzGridProperties.style","vertGridProperties.style"]),scalesProperties:a.scalesProperties.state(),publishedChartsTimelineProperties:o?o.state(e):void 0,chartEventsSourceProperties:null===(r=a.chartEventsSourceProperties)||void 0===r?void 0:r.state(),tradingProperties:l,priceScaleSelectionStrategyName:a.priceScaleSelectionStrategyName.value()},sessions:null!==(n=this.sessions().state(e))&&void 0!==n?n:void 0,version:this.version(),timezone:this.timezone(),shouldBeSavedEvenIfHidden:this._shouldBeSavedEvenIfHidden,linkingGroup:this._linkingGroupIndex.value()};return s||(c.lineToolsGroups=this.lineToolsGroupModel().state(t)),c}restoreState(e,t,i){var s;Ge.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,j.factoryDefaults)("chartproperties").scalesProperties;(0,ae.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,H.migrateShowCurrencyAndShowUnitProperties)(i.showCurrency,i.showUnit),delete i.showCurrency,delete i.showUnit);{const{paneProperties:t}=e.chartProperties;t.vertGridProperties=t.vertGridProperties||(0,ae.clone)(t.gridProperties),t.horzGridProperties=t.horzGridProperties||(0,ae.clone)(t.gridProperties),"backgroundType"in t||(t.backgroundType=Zt.ColorType.Solid),"separatorColor"in t||(t.separatorColor=(0,u.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?f.TradedGroupHorizontalAlignment.Right:n>=60?f.TradedGroupHorizontalAlignment.Left:f.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 a=e.version||0,l=e.panes;let c="_seriesId";for(const e of l){const t=e.sources.find((e=>"MainSeries"===e.type));if(t){c=t.id;break}}this.panes()[0].restoreState({state:l[0],withData:t,version:a,seriesId:c,settingsMigration:r,contentOverrides:i,restoreSilently:true,reason:2});let h=1;for(let s=1;s<e.panes.length;s++){const n=e.panes[s];if(0===n.sources.length){
Ms.logWarn("Empty pane detected - restoring is skipped. idx="+s+", state="+JSON.stringify(n));continue}const o=this.panes()[h]||this.createPane();o.restoreState({state:n,withData:t,version:a,seriesId:c,settingsMigration:r,contentOverrides:i,restoreSilently:true,reason:2}),o.mainDataSource()?h+=1:this.removePane(o)}this.panes().forEach(((e,t)=>{e.collapsed().value()!==l[t].isCollapsed&&(e.collapsed().setValue(l[t].isCollapsed),this.fullUpdate())})),this._invalidateBarColorerCaches();const d=this.dataSources();let p=0;for(let e=0;e<d.length;e++){const t=d[e];(0,S.isLineTool)(t)&&(p++,t.calcIsActualSymbol())}this.updateTimeScaleBaseIndex(),this.recalculateAllPanes((0,Qe.globalChangeEvent)()),this.fullUpdate(),this.syncLollipopSources();const _=(0,o.ensureNotNull)(this.mainPane());for(const e of this._barsMarksSources)this.detachSource(e),_.addDataSource(e,this.m_mainSeries.priceScale(),!0);let m=g.TVLocalStorage.getItem("linetools_limit")||1e3;return window.is_authenticated&&window.user&&window.user.settings&&(m=window.user.settings.linetools_limit||m),this.sessions().restoreState(e.sessions,t),e.lineToolsGroups&&(this._lineToolsGroupModel=Wt.fromState(this,e.lineToolsGroups)),p>m&&p%100==0?{lines_limit_exceeded:!0,line_tools_count:p}:(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){var t;if(this._recalcVRStudiesParams.reasons.add(e),this.m_mainSeries.isStarted()&&this.m_mainSeries.isCompleted()){const i=(0,o.ensureDefined)(Vs.get(e)).adapter,s=Math.min(...Array.from(this._recalcVRStudiesParams.reasons).map((e=>(0,o.ensureDefined)(Vs.get(e)))).filter((e=>e.adapter===i)).map((e=>e.timeout)));(0,o.ensureDefined)(null===(t=this._recalcVisibleRangeStudiesImplDebouncedByAdapter.get(i))||void 0===t?void 0:t.get(s))()}else 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,_s.getDefault2Lazy)(this._syncPointCache,e.uniqueId,t.uniqueId,(()=>new qt(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,t){const i=W.InvalidationMask.light(),s=this._timeScale;i.setTimeScaleAnimation(e,null!=t?t:s.width()-s.indexToCoordinate(s.baseIndex())),this.invalidate(i)}stopTimeScaleAnimation(){this._timeScale.endScroll();const e=W.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}}onSymbolIntervalChanged(){return this._symbolIntervalChanged}_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=Ot.dateFormatProperty.value(),t=void 0;if(this._dateFormatter=new Nt.DateFormatter(e,t),this.mainSeries().isDWM())this._dateTimeFormatter=new Nt.DateFormatter(e,t),this._timeFormatter=new xt.TimeFormatter((0,Tt.getHourMinuteFormat)(Pt.timeHoursFormatProperty.value()));else{const i=M.Interval.parse(this.mainSeries().interval()),s=(0,Tt.getTimeFormatForInterval)(i,Pt.timeHoursFormatProperty.value());this._dateTimeFormatter=new Rt.DateTimeFormatter({dateFormat:e,withWeekday:t,timeFormat:s,dateTimeSeparator:"   "}),this._timeFormatter=new xt.TimeFormatter(s)}}_invalidationMaskForSource(e,t=W.InvalidationLevel.Light){if(e===this.crossHairSource())return W.InvalidationMask.cursor();if(this._watermarkSource===e)return this._paneInvalidationMask((0,o.ensureNotNull)(this.paneForSource(this.mainSeries())),t);if(-1!==this._allCustomSources.indexOf(e)){const e=new W.InvalidationMask;return e.invalidateAll(t),e}if(!(0,v.isDataSource)(e))return null;if(e.isMultiPaneEnabled())return new W.InvalidationMask(t);const i=this.paneForSource(e);return null!==i?this._paneInvalidationMask(i,t):null}_paneInvalidationMask(e,t=W.InvalidationLevel.Light){const i=new W.InvalidationMask,s=this._panes.indexOf(e);return i.invalidateAllPane(s,t),i}_invalidationMaskForSourcePriceScale(e,t=W.InvalidationLevel.Light){if(!(0,v.isDataSource)(e))return new W.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 W.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=Ls(this._bgCustomSources,t),s=Ls(this._fgCustomSources,t),r=Ls(this._topmostCustomSources,t),n=Ls(this._allCustomSources,t);(0,o.assert)(i||s||r,"Source should be presented in one of the layers"),(0,o.assert)(n,"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,o.ensureNotNull)((0,o.ensureNotNull)(t.mainDataSource()).priceScale()).height()}}
_percentPositionToPoint(e,t){const i=e.x*this._timeScale.width(),s=e.y*(0,o.ensureNotNull)((0,o.ensureNotNull)(t.mainDataSource()).priceScale()).height();return new a.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(),It.PlotRowSearchMode.NearestRight),o=r.search(s.lastBar(),It.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,u=[f.RecalcVisibleRangeStudiesReason.SeriesRestart,f.RecalcVisibleRangeStudiesReason.SeriesCompleted,f.RecalcVisibleRangeStudiesReason.StudyCreation].some((t=>e.reasons.has(t)));h&&d&&!u||(e.reasons.clear(),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()?c.colorsPalette["color-cold-gray-200"]:c.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,R.isStudy)(e)){const t=e.metaInfo().inputs.filter(x.isStudyInputDependsOnChartColors),r=e.properties().childs().inputs;t.forEach((e=>{const t=e.id===x.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().allWithoutMultipane();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,Qe.globalChangeEvent)()),this.lightUpdate()}_getAvailableCurrencies(){return!this.currencyConversionEnabled()||this.isSnapshot()?[]:(0,ae.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,ae.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()}_onSymbolIntervalChanged(){this._symbolIntervalChanged.fire()}_getBackgroundColor(e){const t=this._properties.childs().paneProperties.childs();if(t.backgroundType.value()===Zt.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,l.rgbToBlackWhiteString)((0,l.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.mainSeries(),i=t.syncModel(),s=this._undoModel.crossHairSource(),r=s.pane;if(null!==i&&null!==r){const n={timeStamp:this._timeScale.points().roughTime(s.index,i.projectTime.bind(i)),syncSourceTarget:i.syncSourceTarget()};r.mainDataSource()===t&&(n.price=s.price,n.symbol=t.symbol());let o=this._lineBeingCreated||null!==this._linePointBeingEdited||Boolean(this._sourcesBeingMoved.length);o=o&&(0,Le.drawOnAllCharts)().value(),this._undoModel.syncCrosshair(n,o,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,_.createDeferredPromise)(),r.promise.catch((()=>{})),!s.isDWM()){const t=s.symbolInfo();if(null!==t){const i=(0,o.ensureNotNull)(this.timezoneExceptExchange().value()),r=(0,Ht.cal_to_utc)((0,Ht.get_timezone)(i),new Date(e)),n=(0,ai.createTimeToBarTimeAligner)(s.interval(),t)(r);e=(0,Ht.utc_to_cal)((0,Ht.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 n=((e,t)=>{if((e=>(0,o.ensureNotNull)(i.tickMarks().indexToTime((0,o.ensureDefined)(i.tickMarks().minIndex))).valueOf()-e)(t)<0){let r=i.tickMarks().nearestIndex(t);const n=s.bars().lastIndex();if(null===n)return null;r=Math.min(r,n);let a=(0,o.ensureNotNull)(i.tickMarks().indexToTime(r)).valueOf();for(;a<t&&r<n;)r++,a=(0,o.ensureNotNull)(i.tickMarks().indexToTime(r)).valueOf();const l=(0,o.ensureNotNull)(i.visibleBarsStrictRange());if(e||!l.contains(r)){const e=i.width(),t=i.indexToCoordinate(r),s=i.coordinateToFloatIndex(t+e/2)-.5,n=Math.min(s,i.coordinateToFloatIndex(t-e/2)+.5);i.zoomToBarsRange(n,s)}return{timestamp:(0,o.ensureNotNull)(i.indexToTimePoint(r))}}return null})(this._scrollingState.centerIfVisible,this._scrollingState.targetDate);if(!n){const t=(0,o.ensureDefined)(i.tickMarks().minIndex),r=(0,o.ensureNotNull)(i.visibleBarsStrictRange()),a=r.lastBar()-r.firstBar();if(s.requestMoreDataAvailable()){const t=i.tickMarks().estimateLeft(e);i.requestMoreHistoryPoints(Math.ceil(t+a/2))}else i.zoomToBarsRange(t-a/2,t+a/2),n={timestamp:(0,o.ensureNotNull)(i.indexToTimePoint(t)),eod:!0}}if(n){if(this._scrollingState.centerIfVisible){const e=(0,o.ensureNotNull)(i.visibleBarsStrictRange());for(const t of this.panes()){for(const i of t.leftPriceScales())i.recalculatePriceRange(e);for(const i of t.rightPriceScales())i.recalculatePriceRange(e)}}this.fullUpdate(),this._scrollingState=null,r.resolve(n)}return r.promise}_setCorrectedPositionToCrosshair(e,t,i){this.crossHairSource().setPosition(e,t,i)}_onSymbolSourceCollectionChanged(e){this._clearAvailablePriceSources(),this._recalcAdjustForDividendsAvailability(),this._symbolSourceCollectionChanged.fire(e)}
_onPriceSourcesCollectionChanged(e){this._panes.some((e=>e.hasDataSource(this.m_mainSeries)))&&(this._studiesWV.setValue(this.allStudies()),this._studiesExcludeInternalWV.setValue(this.allStudies(!0)))}_unmergeAvailable(e){return e===this.m_mainSeries||(0,R.isStudy)(e)&&!e.isLinkedToSeries()&&!(0,ys.isNonSeriesStudy)(e)&&e.showInObjectTree()}_getExceedingChildStudies(e){let t=[];for(let i=0;i<e.length;++i)t=t.concat(e[i].sources||[]);let i=0;const s=[],r={};let n=0,o=1e6;for(;t.length&&--o;){const e=t[n];(e.ownerSource&&r[e.ownerSource]||!e.ownerSource)&&(r[e.id]=e,t.splice(t.indexOf(e),1),e.ownerSource&&(0,We.isStudyState)(e)&&e.state&&e.state.isChildStudy&&++i>1&&s.push(e)),n=(n+1)%t.length}return s}}},42989:(e,t,i)=>{"use strict";i.d(t,{allChartStyles:()=>r});var s=i(56570);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]))}},51804:(e,t,i)=>{"use strict";var s=i(50151).assert,r=i(93815).ChartModelBase,n=i(630).isLineTool,o=i(49483).CheckMobile,a=i(62288).InvalidationLevel,l=i(52033).Delegate;const{sourceChangeEvent:c}=i(44672);var h=i(72708).isStudy,d=i(928),u=i(64442).MainSeriesScaleRatioProperty,p=i(59769).scaleRatio,_=i(72396).StudyInserter,m=i(63829).dateFormatProperty,g=i(11497).timeHoursFormatProperty,f=i(76422),v=i(93567).StudyColorRotatorFactory,y=i(56570),S=i(12974).AppliedTimeFrame;y.enabled("fix_left_edge");class b extends r{constructor(e,t,i,s,r,n,o,a,l,c){super(e,t,i,s,r,n,o,a,l,c);var h=this;this._mainSeriesScaleRatioProperty=new u(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()||h._properties.paneProperties.legendProperties.showStudyArguments.setValue(!1)}))),d.hideAllDrawings().subscribe(this,this._onDrawingsVisibilityChanged),d.hideAllIndicators().subscribe(this,this._onIndicatorsVisibilityChanged),this._properties.scalesProperties.listeners().subscribe(this,b.prototype.fullUpdate),this._studyShiftColorStartOffset=void 0,m.subscribe(this,this._updateDateTimeFormatter),g.subscribe(this,this._updateDateTimeFormatter),this.mainSeries().properties().interval.subscribe(this,this._updateDateTimeFormatter),this._updateDateTimeFormatter(),this._studyColorRotatorFactory=new v(this),this._dataSourceCollectionChanged.subscribe(this,this._updateShowLegendProperty.bind(this)),this._properties.paneProperties.legendProperties.showLegend.subscribe(this,this._updateShowLegendProperty),this._appliedTimeFrame=new S(this),this.mainSeries().onTimeFrameApplied().subscribe(this,(function(e){var t=null!==e?{
res:this.mainSeries().interval(),val:e}:null;this.appliedTimeFrame().setValue(t)}))}startNotStartedStudies(){if(!this.m_mainSeries.isStarted())throw new Error("Cannot start studies: main series is not started");for(var e=this.dataSources(),t=0;t<e.length;t++)h(e[t])&&!e[t].isStarted()&&e[t].restart&&e[t]!==this.m_mainSeries&&e[t].restart()}_onDrawingsVisibilityChanged(e){for(var t=!1===e.value(),i=this.dataSources(),s=0;s<i.length;s++){var r=i[s],o=n(r)&&r.properties().visible.value();t&&o?f.emit("drawing_event",r.id(),"show"):!t&&o&&f.emit("drawing_event",r.id(),"hide")}this.selectionMacro((function(e){e.clearSelection()}))}_onIndicatorsVisibilityChanged(){var e=this.allStudies().filter((function(e){return e.properties().visible.value()&&e.canBeHiddenByGlobalFlag()}));if(0!==e.length){for(var t=!1,i=0;i<e.length;i++)if(this.selection().isSelected(e[i])){t=!0;break}t?this.selectionMacro((function(e){e.clearSelection()})):this.lightUpdate()}}priceScaleSlotsCount(){var e=0,t=0;this._panes.forEach((function(i){e=Math.max(i.leftPriceScales().length,e),t=Math.max(i.rightPriceScales().length,t)}));var i=e+t;if(o.any()){var s=this.paneForSource(this.mainSeries()),r=s.priceScalePosition(this.mainSeries().priceScale()),n="right"===r;return"overlay"===r&&(n=s.rightPriceScales().length>0),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,a.Light))}updateScales(e,t){this._undoModel._chartWidget._updateScalesActions()}mainSeriesScaleRatioProperty(){return this._mainSeriesScaleRatioProperty}mainSeriesScaleRatioPropertyOnChanged(){this._mainSeriesScaleRatioProperty.listeners().fire(this._mainSeriesScaleRatioProperty)}mainSeriesScaleRatio(){return p(this._timeScale,this.m_mainSeries.priceScale())}setMainSeriesScaleRatio(e){this.paneForSource(this.m_mainSeries).applyPriceScaleRatio(this.m_mainSeries.priceScale(),e)}dataSourceForId(e){for(var t,i=0;i<this._panes.length;++i)if(t=this._panes[i].dataSourceForId(e))return t;return null}onSyncScrollNeeded(e){var t=this._undoModel._chartWidget;if(t._chartWidgetCollection){var i=this.mainSeries().syncModel();if(i){var s=1e3*this._timeScale.points().roughTime(e,i.projectTime.bind(i));t._chartWidgetCollection.syncScroll(s,this)}}}createStudyInserter(e){var t=this;return new _(e,{createStudy:function(e,i,s,r,n,o,a,l,c,h,d,u){return t.insertStudyWithParams(e,i,s,n,o,a,l,c,h,d,u)}})}calculateDefaultTags(){for(var e=[],t=this.dataSources(),i=0;i<t.length;i++){var s=t[i];s.tags&&(e=e.concat(s.tags()))}return e}_sendTo(e,t){var i={},s=this;for(var r in e.forEach((function(e){var t=s.paneForSource(e),r=s._panes.indexOf(t);i[r]||(i[r]=[]),i[r].push(e)})),i){t(s._panes[r],i[r])}this.fullUpdate()}sendToBack(e){this._sendTo(e,(function(e,t){e.sendToBack(t)}))}bringToFront(e){this._sendTo(e,(function(e,t){e.bringToFront(t)}))}destroy(){this.mainSeries().properties().childs().showCountdown.unsubscribeAll(this),
this.mainSeries().onTimeFrameApplied().unsubscribeAll(this),this.mainSeries().onIntervalChanged().unsubscribeAll(this),this._appliedTimeFrame.destroy(),this.clearIntervals(),d.hideAllDrawings().unsubscribe(this,this._onDrawingsVisibilityChanged),d.hideAllIndicators().unsubscribe(this,this._onIndicatorsVisibilityChanged),this.resetDeferredStudies(),this.allStudies().forEach((e=>this.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<this._panes.length;e++)this._panes[e].destroy();this._panes.length=0,this._sessions=null,this.m_mainSeries.onStyleChanged().unsubscribe(this._timeScale,this._timeScale.invalidateVisibleBars),this._timeScale.visibleBarsStrictRangeChanged().unsubscribe(this.m_mainSeries,this.m_mainSeries.clearHighLowPriceCache),this._timeScale.visibleBarsStrictRangeChanged().unsubscribe(this.m_mainSeries,this.m_mainSeries.clearAveragePriceCache),this._timeScale.barSpacingChanged().unsubscribeAll(this),this._timeScale.onScroll().unsubscribeAll(this),this._timeScale.destroy(),m.unsubscribe(this,this._updateDateTimeFormatter),g.unsubscribe(this,this._updateDateTimeFormatter),this.mainSeries().properties().interval.unsubscribe(this,this._updateDateTimeFormatter),this._trendLineStatsCache&&this._trendLineStatsCache.destroy(),this._fibRetracementLabelsCache&&this._fibRetracementLabelsCache.destroy(),this._properties.paneProperties.legendProperties.showLegend.unsubscribeAll(this),this._dataSourceCollectionChanged.unsubscribeAll(this),this.m_crossHairSource.destroy(),super.destroy()}restoreSource(e,t,i,s,r){var n,o;n=e?this.createPane(t):this.panes()[t];var a=s.type.toLowerCase().startsWith("study");if(!(o=a?n.restoreStudy(s):n.restoreLineTool(s)))return null;var l=null;if(r?l=n.getPriceScaleById(r.id):o.ownerSource()&&(l=o.ownerSource().priceScale()),l)o.setPriceScale(l),l.addDataSource(o);else{l=n.createPriceScaleAtPosition(r.position,r.priceScaleIndex);r&&r.id&&l.setId(r.id),o.setPriceScale(l),l.addDataSource(o)}if(!e&&i&&i.overlayPriceScales){var h=this.dataSources().filter((function(e){return void 0!==i.overlayPriceScales[e.id()]}));h.forEach(n.removeSourceFromPriceScale.bind(n));var d=new Map;h.forEach((function(e){var t,s=i.overlayPriceScales[e.id()];d.has(s.id)?t=d.get(s.id):((t=n.createPriceScaleAtPosition("overlay")).restoreState(s),d.set(s.id,t)),t.addDataSource(e),e.setPriceScale(t)}))}return o.start(),o.restore&&o.restore(),e&&n.restoreState({state:i,withData:!1,version:this.version()}),a&&(this.recalculateAllPanes(c(o.id())),this.mainSeries().invalidateBarColorerCache(),this.fullUpdate()),o}getStudyShiftColorStartOffset(){return this._studyShiftColorStartOffset}setStudyShiftColorStartOffset(e){this._studyShiftColorStartOffset=e}onInReplayStateChanged(){return new l}isPriceScaleVisible(e){var t=this.paneForSource(e.mainSource()),i=t.priceScalePosition(e)
;if("overlay"===i)return!0;var s=this.priceScaleSlotsCount();return t.priceScaleIndex(e,i)<s[i]}studiesColorRotatorFactory(){return this._studyColorRotatorFactory}}e.exports=b},91920:(e,t,i)=>{"use strict";var s=i(68979).makeFont,r=i(68979).parseFont,n=i(31955).getLogger;const{drawPoly:o}=i(37743);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},46088:(e,t,i)=>{"use strict";var s;i.d(t,{ColorType:()=>s}),function(e){e.Solid="solid",e.Gradient="gradient"}(s||(s={}))},50788:(e,t,i)=>{"use strict";i.d(t,{actualCurrencyUnitVisibility:()=>h,currencyUnitVisibilityOptions:()=>l,currencyUnitVisibilityProperty:()=>a,migrateShowCurrencyAndShowUnitProperties:()=>u,restoreCurrencyUnitVisibilitySettingsValue:()=>c});var s,r=i(17656),n=i(56840),o=i.n(n);!function(e){e.SettingsKey="PriceAxisCurrencyAndUnit.visibility"}(s||(s={}));const{property:a,availableValues:l,restoreDefaultValue:c,actualBehavior:h}=(0,r.createVisibilityController)("PriceAxisCurrencyAndUnit.visibility");let d=!1;function u(e,t){d||(d=!0,void 0===o().getValue("PriceAxisCurrencyAndUnit.visibility")&&a().setValue(e||t?"alwaysOn":"alwaysOff"))}},98272:(e,t,i)=>{"use strict";i.d(t,{sourceNewCurrencyOnPinningToPriceScale:()=>r});var s=i(60074);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}},28120:(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)}}},36915:(e,t,i)=>{"use strict";i.d(t,{isLineToolState:()=>o,isMainSeriesState:()=>r,isStudyLineToolState:()=>a,isStudyState:()=>n});var s=i(15764);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)}},29137:(e,t,i)=>{"use strict";i.d(t,{DataSource:()=>l,getTranslatedStringForSource:()=>a});var s=i(45126),r=i(92184),n=i(52033),o=i(64147);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._alertStatus=new o.WatchedValue(0),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(e){return null}isFailed(){return!1}isLoading(){return!1}isPhantom(){return!1}isChildStudy(){return!1}hasChildren(){return!1}
canHaveChildren(){return!1}onClickOutside(e,t){}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,i){return null}autoScaleInfo(e,t,i){return{range:this.priceRange(e,t,i)}}stateForAlert(){return null}canHasAlert(){return!1}canHasAlertOnLineTools(){return!1}hasAlert(){return this._hasAlert.readonly()}alertCreationAvailable(){return this._alertCreationAvailable.readonly()}hasStateForAlert(){return!1}idForAlert(){return this._id}alertStatus(){return this._alertStatus.readonly()}_getAlertCreationAvailable(){return!1}_updateAlertCreationAvailable(){0}}},7576:(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(){}}},63829:(e,t,i)=>{"use strict";i.d(t,{dateFormatProperty:()=>l,restoreDateFormatSettingsValue:()=>c});var s=i(56840),r=i(17625),n=i(47462);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())))},55917:(e,t,i)=>{"use strict";i.d(t,{DefaultProperty:()=>D,allowSavingDefaults:()=>C,createDefaultsState:()=>b,extractAllPropertiesKeys:()=>P,extractState:()=>T});var s=i(27788),r=i(14314),n=i(40405),o=i(38004),a=i(48828),l=i(49984),c=i(16230),h=i(38651),d=i(98279),u=i(26843),p=i(45345),_=i(35039),m=i(52033),g=i(12168),f=i(12988),v=i(50151);const y=(0,g.getLogger)("ThemedDefaults");function S(e,t,i){for(const s of t)if((0,n.default)(e,s),i){const t=s.split(".");for(t.pop();t.length;){const i=(0,o.default)(e,t);if(!(0,d.default)(i)||0!==Object.keys(i).length)break;(0,n.default)(e,t),t.pop()}}}function b(e,t,i,n){const o=e?_.defaults:_.factoryDefaults,a=t.startsWith("study_")?(0,s.default)(o("study")):{};let l=(0,s.default)(o(t,n));return t.startsWith("study_")&&l.inputs&&delete l.inputs.symbol,"linetoolicon"===t&&e&&(l.icon=(0,_.defaults)(t).icon),"linetooemoji"===t&&e&&(l.emoji=(0,_.defaults)(t).emoji),"linetoolsticker"===t&&e&&(l.sticker=(0,_.defaults)(t).sticker),l=(0,s.default)(l),S(l,i),(0,r.default)(a,l),a}
let w=!1;function C(e){w=e}function P(e){const t=Object.keys(e),i=[];return t.forEach((t=>{const s=e[t];if((0,d.default)(s)){P(s).forEach((e=>i.push(`${t}.${e}`)))}else i.push(t)})),i}function x(e,t,i=""){const s={};for(const r of t){const n=r.split("."),o=n[0],a=e[o],l=""===i?o:`${i}.${o}`;if(e.hasOwnProperty(o))if(n.length>1){if(!(0,d.default)(a)){y.logError(`path ${l} must be an object, but it is a primitive`);continue}{const e=t.filter((e=>e.startsWith(`${o}.`))).map((e=>e.split(".").slice(1).join(".")));s[o]=x(a,e,l)}}else{if((0,d.default)(a)){y.logError(`path ${l} must be a primitive, but it is an object`);continue}s[o]=a}}return s}function T(e,t,i){if(!e)return{};let s=e;return t&&(s=x(e,t)),i&&S(s,i,!0),s}function I(e,t){e.includes(t)||e.push(t)}function M(e,t){const i=e.indexOf(t);-1!==i&&e.splice(i,1)}function A(e,t){const i=(0,l.default)(e,((e,i,s)=>{if(void 0===t[s])return e;if(!(0,c.default)(i,t[s]))if((0,d.default)(i)&&(0,d.default)(t[s])){const r=A(i,t[s]);void 0!==r&&(e[s]=r)}else e[s]=i;return e}),{});return(0,h.default)(i)?void 0:i}var L;function k(e){return e===u.StdTheme.Dark?1:0}!function(e){e[e.DefaultsKey=1]="DefaultsKey",e[e.StateKey=2]="StateKey"}(L||(L={}));class D extends f.Property{constructor(e){const{defaultName:t,nonThemedDefaultsKeys:i,themedDefaultsKeys:s,excludedDefaultsKeys:n=[],themedColors:o,allStateKeys:a,excludedStateKeys:l=[],state:c,useUserPreferences:h=!0,saveNonDefaultUserPreferencesOnly:d=!1,ignoreAllowSavingDefaults:u=!1,saveDefaultsConsumer:p=_.saveDefaults,factoryDefaultsSupplier:g=(()=>b(!1,t,[],null))}=e;super(),this._themedColors=[],this._restoreFactoryDefaultsEvent=new m.Delegate,this._defaultName=t,this._useUserPreferences=h,this._saveNonDefaultUserPreferencesOnly=d,this._ignoreAllowSavingDefaults=u,this._saveDefaultsConsumer=p,this._factoryDefaultsSupplier=g,this._allStateKeys=a,this._excludedStateKeys=l,this._nonThemedDefaultsKeys=i,this._themedDefaultsKeys=s,this._allDefaultsKeys=i||s?[...null!=i?i:[],...null!=s?s:[]]:void 0,this._themedColors=o,this._excludedDefaultsKeys=n,(0,v.assert)(void 0===this._allDefaultsKeys||0===this._excludedDefaultsKeys.length,"Defaults keys and excluded defaults keys cannot be used at the same time"),(0,v.assert)(void 0===this._allStateKeys||0===this._excludedStateKeys.length,"State keys and excluded state keys cannot be used at the same time"),this.merge((0,r.default)(this._factoryDefaultsSupplier(),this._userSettings(),T(c,a,l))),this._restoreFactoryDefaultsEvent=new m.Delegate}destroy(){var e;null===(e=this._unsubscribeWatchedTheme)||void 0===e||e.call(this),super.destroy()}applyTemplate(e,t){this.mergePreferences((0,r.default)((0,s.default)(t),e))}preferences(){return T(super.state(this._excludedDefaultsKeys),this._allDefaultsKeys)}mergePreferences(e){this.mergeAndFire(T(e,this._allDefaultsKeys,this._excludedDefaultsKeys))}addExcludedKey(e,t){1&t&&I(this._excludedDefaultsKeys,e),2&t&&I(this._excludedStateKeys,e)}removeExcludedKey(e,t){1&t&&M(this._excludedDefaultsKeys,e),2&t&&M(this._excludedStateKeys,e)}restoreFactoryDefaults(){
const e=this._factoryDefaultsSupplier();if(S(e,this._excludedDefaultsKeys),this._themedColors){const t=k(p.watchedTheme.value());for(const i of this._themedColors)(0,a.default)(e,i.path,i.colors[t])}this.mergeAndFire(e),this._defaultName.startsWith("study_")&&!this._defaultName.startsWith("study_VbPFixed")||this.saveDefaults(),this._restoreFactoryDefaultsEvent.fire()}onRestoreFactoryDefaults(){return this._restoreFactoryDefaultsEvent}childChanged(e,t){var i;super.childChanged(e,t),!this._ignoreAllowSavingDefaults&&!w||this._defaultName.startsWith("replayStudyStrategy")||this._defaultName.startsWith("study_")&&!this._defaultName.startsWith("study_VbPFixed")||!(this._allDefaultsKeys&&this._allDefaultsKeys.includes(t)||!this._allDefaultsKeys&&!(null===(i=this._excludedDefaultsKeys)||void 0===i?void 0:i.includes(t)))||this.saveDefaults()}saveDefaults(){if(!this._useUserPreferences)return;let e;if(this._saveNonDefaultUserPreferencesOnly){const t=super.state(this._excludedDefaultsKeys),i=this._factoryDefaultsSupplier();e=A(T(t,this._nonThemedDefaultsKeys),T(i,this._nonThemedDefaultsKeys,this._excludedDefaultsKeys));const s=T(i,this._themedDefaultsKeys,this._excludedDefaultsKeys),n=T(t,this._themedDefaultsKeys),o=A(n,s);(0,h.default)(o)||(e=null!=e?e:{},(0,r.default)(e,n))}else e=this.preferences();this._saveDefaultsConsumer(this._defaultName,e)}clone(e){return new D(this._options())}setThemedColors(e){if(this._themedColors=e,void 0===this._unsubscribeWatchedTheme){const e=()=>this.updateThemedColors();p.watchedTheme.subscribe(e),this._unsubscribeWatchedTheme=()=>p.watchedTheme.unsubscribe(e)}this.updateThemedColors()}updateThemedColors(e){if(!this._themedColors)return;const t=p.watchedTheme.value(),i=t===u.StdTheme.Light?u.StdTheme.Dark:u.StdTheme.Light;for(const s of this._themedColors){const r=(0,v.ensureDefined)(this.childByPath(s.path)),n=s.colors[k(i)];!e&&r.value()!==n&&r.value()||r.setValue(s.colors[k(t)])}}state(e){return T(super.state([...this._excludedStateKeys,...null!=e?e:[]]),this._allStateKeys)}_userSettings(){if(!this._useUserPreferences)return;const e=b(!0,this._defaultName,[],null);return e?T((0,s.default)(e),this._allDefaultsKeys,this._excludedDefaultsKeys):void 0}_options(){return{defaultName:this._defaultName,factoryDefaultsSupplier:this._factoryDefaultsSupplier,state:this.state(),nonThemedDefaultsKeys:this._nonThemedDefaultsKeys,themedDefaultsKeys:this._themedDefaultsKeys,excludedDefaultsKeys:this._excludedDefaultsKeys,themedColors:this._themedColors,allStateKeys:this._allStateKeys,excludedStateKeys:this._excludedDefaultsKeys,useUserPreferences:this._useUserPreferences,saveNonDefaultUserPreferencesOnly:this._saveNonDefaultUserPreferencesOnly,ignoreAllowSavingDefaults:this._ignoreAllowSavingDefaults,saveDefaultsConsumer:this._saveDefaultsConsumer}}}},35039:(e,t,i)=>{"use strict";var s=i(91140).PlDisplay;const{getHexColorByName:r}=i(19625),{generateColor:n,applyAlpha:o}=i(19063)
;var a=i(91140).TradedGroupHorizontalAlignment,l=i(5171),c=i(96333).LineToolPitchforkStyle,h=i(67467).LineToolBarsPatternMode,d=i(94113),u=d.LineStudyPlotStyle,p=d.STUDYPLOTDISPLAYTARGET,_=i(55158),m=i(94164).PriceAxisLastValueMode,g=i(92693).MagnetMode,f=i(49857).LineEnd,v=i(46088).ColorType,y=i(20596).RangeBarStyle;const{LineStyle:S}=i(85904);i(64671).VolumeFootprintTypeValues;var b=i(39429).StatsPosition,w=i(6290).sessionsPreferencesDefault,C=i(57596).axisLabelBackgroundColor;const{LINESTYLE_SOLID:P,LINESTYLE_DOTTED:x,LINESTYLE_DASHED:T}=i(51056);var I=i(31955).getLogger("Chart.Defaults");const M=r("color-black"),A=r("color-white"),L=n(A,75),k=r("color-tv-blue-50"),D=(r("color-tv-blue-400"),r("color-tv-blue-500")),E=(n(D,30),n(D,70)),V=n(D,72),B=n(D,75),R=n(D,80),N=r("color-tv-blue-600"),O=r("color-deep-blue-200"),F=r("color-deep-blue-300"),W=(r("color-deep-blue-a400"),r("color-deep-blue-500")),H=n(W,80),z=r("color-sky-blue-500"),U=n(z,80),j=r("color-sky-blue-700"),G=n(j,30),q=r("color-youtube"),$=r("color-ripe-red-200"),K=r("color-ripe-red-300"),Y=r("color-ripe-red-400"),Z=n(Y,95),X=r("color-ripe-red-500"),J=n(X,70),Q=n(X,80),ee=n(X,72),te=n(X,95),ie=r("color-ripe-red-600"),se=r("color-grapes-purple-500"),re=n(se,100),ne=n(se,80),oe=n(se,30),ae=r("color-berry-pink-500"),le=n(ae,80),ce=r("color-minty-green-100"),he=r("color-minty-green-500"),de=n(he,80),ue=n(he,72),pe=n(he,95),_e=r("color-iguana-green-300"),me=r("color-iguana-green-500"),ge=n(me,80),fe=(r("color-iguana-green-a700"),r("color-tan-orange-300")),ve=r("color-tan-orange-500"),ye=n(ve,80),Se=r("color-tan-orange-600"),be=r("color-tan-orange-700"),we=r("color-cold-gray-150"),Ce=r("color-cold-gray-300"),Pe=r("color-cold-gray-400"),xe=r("color-cold-gray-450"),Te=r("color-cold-gray-500"),Ie=r("color-cold-gray-800"),Me=n(Ie,94),Ae=n(Ie,100),Le=r("color-cold-gray-900"),ke=r("color-cold-gray-750"),De=r("color-forest-green-300"),Ee=n(De,95);var Ve=function(e){var t=function(e,t){return{color:e,visible:t}},i=function(e,t,i,s){const r={coeff:e,color:t,visible:i};return s&&(r.text=""),r},r=function(e,t,i,s,r){return{coeff:e,color:t,visible:i,linestyle:void 0===s?P:s,linewidth:void 0===r?2:r}},o=function(e,t,i){return{color:e,width:void 0===i?2:i,visible:t}},d=function(e,t,i,s,r){return{color:e,visible:t,width:i,x:s,y:r}},I=function(e,t,i,s,r,n){return{coeff1:e,coeff2:t,color:i,visible:s,linestyle:void 0===r?P:r,linewidth:void 0===n?2:n}};if(void 0===TradingView.defaultProperties){var Ie;switch(window.locale){case"ar_AE":Ie="Asia/Dubai";break;case"au":Ie="Australia/Sydney";break;case"br":Ie="America/Sao_Paulo";break;case"ca":Ie="America/Toronto";break;case"de_DE":case"it":Ie="Europe/Berlin";break;case"es":Ie="Europe/Madrid";break;case"fa_IR":Ie="Asia/Tehran";break;case"fr":case"sv_SE":Ie="Europe/Paris";break;case"he_IL":case"tr":Ie="Europe/Athens";break;case"hu_HU":case"pl":Ie="Europe/Warsaw";break;case"id":case"th_TH":case"vi_VN":Ie="Asia/Bangkok";break;case"in":Ie="Asia/Kolkata";break;case"ja":case"kr":Ie="Asia/Tokyo";break;case"ms_MY":Ie="Asia/Singapore";break
;case"ru":Ie="Europe/Moscow";break;case"uk":Ie="Europe/London";break;case"zh_CN":case"zh_TW":Ie="Asia/Shanghai";break;default:Ie="Etc/UTC"}TradingView.defaultProperties={chartproperties:{timezone:Ie,priceScaleSelectionStrategyName:"auto",paneProperties:{backgroundType:v.Solid,background:A,backgroundGradientStartColor:A,backgroundGradientEndColor:A,gridLinesMode:"both",vertGridProperties:{color:Me,style:P},horzGridProperties:{color:Me,style:P},crossHairProperties:{color:Pe,style:T,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:we},scalesProperties:{backgroundColor:A,lineColor:Ae,textColor:Le,fontSize:12,scaleSeriesOnly:!1,showSeriesLastValue:!0,seriesLastValueMode:m.LastValueAccordingToScale,showSeriesPrevCloseValue:!1,showStudyLastValue:!0,showSymbolLabels:!1,showStudyPlotLabels:!1,showBidAskLabels:!1,showPrePostMarketPriceLabel:!0,showFundamentalNameLabel:!1,showFundamentalLastValue:!0,barSpacing:_.DEFAULT_BAR_SPACING,axisHighlightColor:B,axisLineToolLabelBackgroundColorCommon:C.common,axisLineToolLabelBackgroundColorActive:C.active,showPriceScaleCrosshairLabel:!0,showTimeScaleCrosshairLabel:!0,crosshairLabelBgColorLight:Le,crosshairLabelBgColorDark:ke},mainSeriesProperties:{style:l.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:x,lineWidth:1,bidLineColor:D,askLineColor:Y},prePostMarket:{visible:!0,lineStyle:x,lineWidth:1,preMarketColor:Se,postMarketColor:D},highLowAvgPrice:{highLowPriceLinesVisible:!1,highLowPriceLabelsVisible:!1,averageClosePriceLineVisible:!1,averageClosePriceLabelVisible:!1,highLowPriceLinesColor:"",highLowPriceLinesWidth:1,averagePriceLineColor:"",averagePriceLineWidth:1},visible:!0,showPriceLine:!0,priceLineWidth:1,priceLineColor:"",baseLineColor:Ce,showPrevClosePriceLine:!1,prevClosePriceLineWidth:1,prevClosePriceLineColor:"#555555",minTick:"default",dividendsAdjustment:void 0,backAdjustment:!1,settlementAsClose:!0,sessionId:"regular",sessVis:!1,statusViewStyle:{fontSize:16,showExchange:!0,showInterval:!0,symbolTextSource:"description"},candleStyle:{upColor:he,downColor:X,drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:he,borderDownColor:X,wickColor:"#737375",wickUpColor:he,wickDownColor:X,barColorsOnPrevClose:!1,drawBody:!0},volCandlesStyle:{upColor:he,downColor:X,drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:he,borderDownColor:X,wickColor:"#737375",wickUpColor:he,wickDownColor:X,barColorsOnPrevClose:!1,
drawBody:!0},hollowCandleStyle:{upColor:he,downColor:X,drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:he,borderDownColor:X,wickColor:"#737375",wickUpColor:he,wickDownColor:X,drawBody:!0},haStyle:{upColor:he,downColor:X,drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:he,borderDownColor:X,wickColor:"#737375",wickUpColor:he,wickDownColor:X,showRealLastPrice:!1,barColorsOnPrevClose:!1,inputs:{},inputInfo:{},drawBody:!0},barStyle:{upColor:he,downColor:X,barColorsOnPrevClose:!1,dontDrawOpen:!1,thinBars:!0},hiloStyle:{color:D,showBorders:!0,borderColor:D,showLabels:!0,labelColor:D,drawBody:!0},columnStyle:{upColor:n(he,50),downColor:n(X,50),barColorsOnPrevClose:!0,priceSource:"close"},lineStyle:{color:D,linestyle:P,linewidth:2,priceSource:"close"},tpoStyle:{},svpStyle:{},lineWithMarkersStyle:{color:D,linestyle:P,linewidth:2,priceSource:"close"},steplineStyle:{color:D,linestyle:P,linewidth:2,priceSource:"close"},areaStyle:{color1:V,color2:D,linecolor:D,linestyle:P,linewidth:2,priceSource:"close",transparency:100},hlcAreaStyle:{highLineColor:he,highLineStyle:P,highLineWidth:2,lowLineColor:X,lowLineStyle:P,lowLineWidth:2,closeLineColor:xe,closeLineStyle:P,closeLineWidth:2,highCloseFillColor:de,closeLowFillColor:Q},priceAxisProperties:{autoScale:!0,autoScaleDisabled:!1,lockScale:!1,percentage:!1,percentageDisabled:!1,indexedTo100:!1,log:!1,logDisabled:!1,isInverted:!1,alignLabels:!0},renkoStyle:{upColor:he,downColor:X,borderUpColor:he,borderDownColor:X,upColorProjection:"#a9dcc3",downColorProjection:"#f5a6ae",borderUpColorProjection:"#a9dcc3",borderDownColorProjection:"#f5a6ae",wickUpColor:he,wickDownColor:X,inputs:{source:"close",sources:"Close",boxSize:3,style:"ATR",atrLength:14,percentageLTP:1,wicks:!0},inputInfo:{source:{name:"Source"},sources:{name:"Source"},boxSize:{name:"Box size"},style:{name:"Style"},atrLength:{name:"ATR length"},percentageLTP:{name:"Percentage"},wicks:{name:"Wicks"}}},pbStyle:{upColor:he,downColor:X,borderUpColor:he,borderDownColor:X,upColorProjection:"#a9dcc3",downColorProjection:"#f5a6ae",borderUpColorProjection:"#a9dcc3",borderDownColorProjection:"#f5a6ae",inputs:{source:"close",lb:3},inputInfo:{source:{name:"Source"},lb:{name:"Number of line"}}},kagiStyle:{upColor:he,downColor:X,upColorProjection:"#a9dcc3",downColorProjection:"#f5a6ae",inputs:{source:"close",style:"ATR",atrLength:14,percentageLTP:1,reversalAmount:1},inputInfo:{source:{name:"Source"},style:{name:"Style"},atrLength:{name:"ATR length"},percentageLTP:{name:"Percentage"},reversalAmount:{name:"Reversal amount"}}},pnfStyle:{upColor:he,downColor:X,upColorProjection:"#a9dcc3",downColorProjection:"#f5a6ae",inputs:{sources:"Close",reversalAmount:3,boxSize:1,style:"ATR",atrLength:14,percentageLTP:1,oneStepBackBuilding:!1},inputInfo:{sources:{name:"Source"},boxSize:{name:"Box size"},reversalAmount:{name:"Reversal amount"},style:{name:"Style"},atrLength:{name:"ATR length"},percentageLTP:{name:"Percentage"},oneStepBackBuilding:{name:"One step back building"}}},baselineStyle:{baselineColor:xe,topFillColor1:ue,
topFillColor2:pe,bottomFillColor1:te,bottomFillColor2:ee,topLineColor:he,bottomLineColor:X,topLineWidth:2,bottomLineWidth:2,priceSource:"close",transparency:50,baseLevelPercentage:50},rangeStyle:{barStyle:y.Bars,upColor:he,downColor:X,upColorProjection:"#a9dcc3",downColorProjection:"#f5a6ae",thinBars:!0,candlesUpColor:he,candlesDownColor:X,candlesBorderUpColor:he,candlesBorderDownColor:X,candlesWickUpColor:he,candlesWickDownColor:X,inputs:{range:10,phantomBars:!1},inputInfo:{range:{name:"Range"},phantomBars:{name:"Phantom bars"}}},volFootprintStyle:{}},chartEventsSourceProperties:{visible:!0,futureOnly:!0,breaks:{color:"#555555",visible:!1,style:T,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:a.Right,extendLeft:!0,lineLength:5,lineWidth:1,lineStyle:P},editorFontsList:["Verdana","Courier New","Times New Roman","Arial"],volumePaneSize:"large"},sessions:w,drawings:{magnet:!1,magnetMode:g.WeakMagnet,stayInDrawingMode:!1,drawOnAllCharts:!0,drawOnAllChartsMode:1},linetoolorder:{extendLeft:"inherit",lineLength:"inherit",lineLengthUnit:"percentage",lineColor:q,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:L,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:A,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:L,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:L,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:A,quantityTextTransparency:0,quantityFontFamily:"Verdana",quantityFontSize:9,quantityFontBold:!0,quantityFontItalic:!1,reverseButtonBorderBuyColor:"#4094e8",reverseButtonBorderSellColor:"#e75656",reverseButtonBackgroundColor:L,reverseButtonBackgroundTransparency:25,reverseButtonIconBuyColor:"#4094e8",reverseButtonIconSellColor:"#e75656",closeButtonBorderBuyColor:"#4094e8",closeButtonBorderSellColor:"#e75656",closeButtonBackgroundColor:L,closeButtonBackgroundTransparency:25,closeButtonIconBuyColor:"#4094e8",closeButtonIconSellColor:"#e75656",tooltip:"",protectTooltip:"",closeTooltip:"",reverseTooltip:""},linetoolexecution:{direction:"buy",arrowHeight:8,arrowSpacing:1,arrowBuyColor:"#4094e8",arrowSellColor:"#e75656",text:"",textColor:M,textTransparency:0,fontFamily:"Verdana",fontSize:10,fontBold:!1,fontItalic:!1,tooltip:""},linetoolicon:{color:D,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:D,linewidth:2,fillBackground:!1,backgroundColor:R,transparency:50,linestyle:P,extendLeft:!1,extendRight:!1,leftEnd:f.Normal,rightEnd:f.Normal},linetoolbeziercubic:{linecolor:W,linewidth:2,fillBackground:!1,backgroundColor:H,transparency:80,linestyle:P,extendLeft:!1,extendRight:!1,leftEnd:f.Normal,rightEnd:f.Normal},linetooltrendline:{linecolor:D,linewidth:2,linestyle:P,extendLeft:!1,extendRight:!1,leftEnd:f.Normal,rightEnd:f.Normal,showLabel:!1,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:D,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:b.Right},linetoolinfoline:{linecolor:D,linewidth:2,linestyle:P,extendLeft:!1,extendRight:!1,leftEnd:f.Normal,rightEnd:f.Normal,showLabel:!1,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:D,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:b.Center},linetooltimecycles:{linecolor:"#159980",linewidth:2,
fillBackground:!0,backgroundColor:"rgba(106, 168, 79, 0.5)",transparency:50,linestyle:P},linetoolsineline:{linecolor:"#159980",linewidth:2,linestyle:P},linetooltrendangle:{linecolor:D,linewidth:2,linestyle:P,textcolor:D,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:b.Right},linetooldisjointangle:{linecolor:he,linewidth:2,linestyle:P,fillBackground:!0,backgroundColor:de,transparency:20,extendLeft:!1,extendRight:!1,leftEnd:f.Normal,rightEnd:f.Normal,textcolor:he,fontsize:12,bold:!1,italic:!1,showPrices:!1,showPriceRange:!1,showDateTimeRange:!1,showBarsRange:!1,labelVisible:!1,labelHorzAlign:"left",labelVertAlign:"bottom",labelTextColor:he,labelFontSize:14,labelBold:!1,labelItalic:!1},linetoolflatbottom:{linecolor:ve,linewidth:2,linestyle:P,fillBackground:!0,backgroundColor:ye,transparency:20,extendLeft:!1,extendRight:!1,leftEnd:f.Normal,rightEnd:f.Normal,textcolor:ve,fontsize:12,bold:!1,italic:!1,showPrices:!1,showPriceRange:!1,showDateTimeRange:!1,showBarsRange:!1,labelVisible:!1,labelHorzAlign:"left",labelVertAlign:"bottom",labelTextColor:ve,labelFontSize:14,labelBold:!1,labelItalic:!1},linetoolriskrewardshort:{linecolor:Te,linewidth:1,textcolor:A,fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"#585858",fillBackground:!0,stopBackground:Q,profitBackground:de,stopBackgroundTransparency:80,profitBackgroundTransparency:80,drawBorder:!1,borderColor:"#667b8b",compact:!1,riskDisplayMode:"percents",accountSize:1e3,lotSize:1,risk:25,alwaysShowStats:!1,showPriceLabels:!0},linetoolriskrewardlong:{linecolor:Te,linewidth:1,textcolor:A,fontsize:12,fillLabelBackground:!0,labelBackgroundColor:"#585858",fillBackground:!0,stopBackground:Q,profitBackground:de,stopBackgroundTransparency:80,profitBackgroundTransparency:80,drawBorder:!1,borderColor:"#667b8b",compact:!1,riskDisplayMode:"percents",accountSize:1e3,lotSize:1,risk:25,alwaysShowStats:!1,showPriceLabels:!0},linetoolarrow:{linecolor:D,linewidth:2,linestyle:P,extendLeft:!1,extendRight:!1,leftEnd:f.Normal,rightEnd:f.Arrow,showLabel:!1,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:D,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:b.Right},linetoolray:{linecolor:D,linewidth:2,linestyle:P,extendLeft:!1,extendRight:!0,leftEnd:f.Normal,rightEnd:f.Normal,showLabel:!1,horzLabelsAlign:"center",vertLabelsAlign:"bottom",textcolor:D,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:b.Right},linetoolextended:{linecolor:D,linewidth:2,linestyle:P,extendLeft:!0,extendRight:!0,leftEnd:f.Normal,rightEnd:f.Normal,showLabel:!1,horzLabelsAlign:"center",
vertLabelsAlign:"bottom",textcolor:D,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:b.Right},linetoolhorzline:{linecolor:D,linewidth:2,linestyle:P,showPrice:!0,showLabel:!1,textcolor:D,fontsize:12,bold:!1,italic:!1,horzLabelsAlign:"center",vertLabelsAlign:"middle"},linetoolhorzray:{linecolor:D,linewidth:2,linestyle:P,showPrice:!0,showLabel:!1,textcolor:D,fontsize:12,bold:!1,italic:!1,horzLabelsAlign:"center",vertLabelsAlign:"top"},linetoolvertline:{linecolor:D,linewidth:2,linestyle:P,extendLine:!0,showTime:!0,showLabel:!1,horzLabelsAlign:"center",vertLabelsAlign:"middle",textcolor:D,textOrientation:"vertical",fontsize:14,bold:!1,italic:!1},linetoolcrossline:{linecolor:D,linewidth:2,linestyle:P,showPrice:!0,showTime:!0},linetoolfibtimezone:{horzLabelsAlign:"right",vertLabelsAlign:"bottom",showLabels:!0,fillBackground:!1,transparency:80,trendline:{visible:!0,color:"#808080",linewidth:1,linestyle:T},level1:r(0,Te,!0),level2:r(1,D,!0),level3:r(2,D,!0),level4:r(3,D,!0),level5:r(5,D,!0),level6:r(8,D,!0),level7:r(13,D,!0),level8:r(21,D,!0),level9:r(34,D,!0),level10:r(55,D,!0),level11:r(89,D,!0)},linetooltext:{color:D,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:D,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:A,backgroundColor:oe,borderColor:re,fontsize:14,transparency:30},linetoolcomment:{color:A,backgroundColor:D,borderColor:D,fontsize:16,transparency:0},linetoolbrush:{linecolor:z,linewidth:2,linestyle:P,smooth:5,fillBackground:!1,backgroundColor:z,transparency:50,leftEnd:f.Normal,rightEnd:f.Normal},linetoolhighlighter:{linecolor:Q,smooth:5,transparency:80},linetoolpolyline:{linecolor:z,linewidth:2,linestyle:P,fillBackground:!0,backgroundColor:U,transparency:80,filled:!1},linetoolsignpost:{emoji:"🙂",showImage:!1,plateColor:D,fontSize:12,bold:!1,italic:!1},linetoolpath:{lineColor:D,lineWidth:2,lineStyle:P,leftEnd:f.Normal,rightEnd:f.Arrow},linetoolarrowmarkleft:{color:D,arrowColor:D,fontsize:14,bold:!1,italic:!1,showLabel:!0},linetoolarrowmarkup:{color:he,arrowColor:he,fontsize:14,bold:!1,italic:!1,showLabel:!0},linetoolarrowmarkright:{color:D,arrowColor:D,fontsize:14,bold:!1,italic:!1,showLabel:!0},linetoolarrowmarkdown:{color:ie,arrowColor:ie,fontsize:14,bold:!1,italic:!1,showLabel:!0},linetoolflagmark:{flagColor:D},linetoolpricelabel:{color:A,backgroundColor:D,borderColor:D,fontWeight:"bold",fontsize:14,transparency:0},linetoolarrowmarker:{backgroundColor:N,textColor:N,bold:!0,italic:!1,fontsize:16,showLabel:!0},linetoolrectangle:{color:se,fillBackground:!0,backgroundColor:ne,linewidth:2,
transparency:50,showLabel:!1,horzLabelsAlign:"center",vertLabelsAlign:"middle",textColor:se,fontSize:14,bold:!1,italic:!1,extendLeft:!1,extendRight:!1,middleLine:{showLine:!1,lineWidth:1,lineColor:se,lineStyle:S.Dashed}},linetoolrotatedrectangle:{color:me,fillBackground:!0,backgroundColor:ge,transparency:50,linewidth:2},linetoolcircle:{color:ve,backgroundColor:ye,fillBackground:!0,linewidth:2,showLabel:!1,textColor:ve,fontSize:14,bold:!1,italic:!1},linetoolellipse:{color:X,fillBackground:!0,backgroundColor:Q,transparency:50,linewidth:2,showLabel:!1,textColor:X,fontSize:14,bold:!1,italic:!1},linetoolarc:{color:ae,fillBackground:!0,backgroundColor:le,transparency:80,linewidth:2},linetoolprediction:{linecolor:D,linewidth:2,sourceBackColor:D,sourceTextColor:A,sourceStrokeColor:D,targetStrokeColor:D,targetBackColor:D,targetTextColor:A,successBackground:me,successTextColor:A,failureBackground:X,failureTextColor:A,intermediateBackColor:"#ead289",intermediateTextColor:"#6d4d22",transparency:10,centersColor:"#202020"},linetooltriangle:{color:he,fillBackground:!0,backgroundColor:de,transparency:80,linewidth:2},linetoolcallout:{color:A,backgroundColor:G,transparency:50,linewidth:2,fontsize:14,bordercolor:j,bold:!1,italic:!1,wordWrap:!1,wordWrapWidth:200},linetoolparallelchannel:{linecolor:D,linewidth:2,linestyle:P,extendLeft:!1,extendRight:!1,fillBackground:!0,backgroundColor:R,transparency:20,showMidline:!0,midlinecolor:D,midlinewidth:1,midlinestyle:T,labelVisible:!1,labelHorzAlign:"left",labelVertAlign:"bottom",labelTextColor:D,labelFontSize:14,labelBold:!1,labelItalic:!1},linetoolelliottimpulse:{degree:7,showWave:!0,color:"#3d85c6",linewidth:2},linetoolelliotttriangle:{degree:7,showWave:!0,color:ve,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:D,mode:h.Bars,mirrored:!1,flipped:!1},linetoolghostfeed:{averageHL:20,variance:50,candleStyle:{upColor:ce,downColor:$,drawWick:!0,drawBorder:!0,borderColor:"#378658",borderUpColor:he,borderDownColor:X,wickColor:Te},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:c.Original,median:{visible:!0,color:X,linewidth:2,linestyle:P},extendLines:!1,level0:r(.25,fe,!1),level1:r(.382,_e,!1),level2:r(.5,he,!0),level3:r(.618,he,!1),level4:r(.75,z,!1),level5:r(1,D,!0),level6:r(1.5,se,!1),level7:r(1.75,ae,!1),level8:r(2,K,!1)},linetoolpitchfan:{fillBackground:!0,transparency:80,median:{visible:!0,color:X,linewidth:2,linestyle:P},level0:r(.25,fe,!1),level1:r(.382,_e,!1),level2:r(.5,z,!0),level3:r(.618,he,!1),level4:r(.75,z,!1),level5:r(1,D,!0),level6:r(1.5,se,!1),level7:r(1.75,ae,!1),level8:r(2,K,!1)},linetoolgannfan:{linewidth:2,showLabels:!0,fillBackground:!0,
transparency:80,level1:I(1,8,ve,!0),level2:I(1,4,he,!0),level3:I(1,3,me,!0),level4:I(1,2,he,!0),level5:I(1,1,z,!0),level6:I(2,1,D,!0),level7:I(3,1,se,!0),level8:I(4,1,ae,!0),level9:I(8,1,X,!0)},linetoolganncomplex:{fillBackground:!1,arcsBackground:{fillBackground:!0,transparency:80},reverse:!1,scaleRatio:"",showLabels:!0,labelsStyle:{fontSize:12,bold:!1,italic:!1},levels:[o(Te,!0),o(ve,!0),o(z,!0),o(me,!0),o(he,!0),o(Te,!0)],fanlines:[d(O,!1,2,8,1),d(X,!1,2,5,1),d(Te,!1,2,4,1),d(ve,!1,2,3,1),d(z,!0,2,2,1),d(me,!0,2,1,1),d(he,!0,2,1,2),d(he,!1,2,1,3),d(D,!1,2,1,4),d(F,!1,2,1,5),d(O,!1,2,1,8)],arcs:[d(ve,!0,2,1,0),d(ve,!0,2,1,1),d(ve,!0,2,1.5,0),d(z,!0,2,2,0),d(z,!0,2,2,1),d(me,!0,2,3,0),d(me,!0,2,3,1),d(he,!0,2,4,0),d(he,!0,2,4,1),d(D,!0,2,5,0),d(D,!0,2,5,1)]},linetoolgannfixed:{fillBackground:!1,arcsBackground:{fillBackground:!0,transparency:80},reverse:!1,levels:[o(Te,!0),o(ve,!0),o(z,!0),o(me,!0),o(he,!0),o(Te,!0)],fanlines:[d(O,!1,2,8,1),d(X,!1,2,5,1),d(Te,!1,2,4,1),d(ve,!1,2,3,1),d(z,!0,2,2,1),d(me,!0,2,1,1),d(he,!0,2,1,2),d(he,!1,2,1,3),d(D,!1,2,1,4),d(F,!1,2,1,5),d(O,!1,2,1,8)],arcs:[d(ve,!0,2,1,0),d(ve,!0,2,1,1),d(ve,!0,2,1.5,0),d(z,!0,2,2,0),d(z,!0,2,2,1),d(me,!0,2,3,0),d(me,!0,2,3,1),d(he,!0,2,4,0),d(he,!0,2,4,1),d(D,!0,2,5,0),d(D,!0,2,5,1)]},linetoolgannsquare:{color:"rgba(21, 56, 153, 0.8)",linewidth:2,linestyle:P,showTopLabels:!0,showBottomLabels:!0,showLeftLabels:!0,showRightLabels:!0,fillHorzBackground:!0,horzTransparency:80,fillVertBackground:!0,vertTransparency:80,reverse:!1,fans:t(Pe,!1),hlevel1:i(0,Te,!0),hlevel2:i(.25,ve,!0),hlevel3:i(.382,z,!0),hlevel4:i(.5,me,!0),hlevel5:i(.618,he,!0),hlevel6:i(.75,D,!0),hlevel7:i(1,Te,!0),vlevel1:i(0,Te,!0),vlevel2:i(.25,ve,!0),vlevel3:i(.382,z,!0),vlevel4:i(.5,me,!0),vlevel5:i(.618,he,!0),vlevel6:i(.75,D,!0),vlevel7:i(1,Te,!0)},linetoolfibspeedresistancefan:{fillBackground:!0,transparency:80,grid:{color:"rgba(21, 56, 153, 0.8)",linewidth:1,linestyle:P,visible:!0},linewidth:2,linestyle:P,showTopLabels:!0,showBottomLabels:!0,showLeftLabels:!0,showRightLabels:!0,reverse:!1,hlevel1:i(0,Te,!0),hlevel2:i(.25,ve,!0),hlevel3:i(.382,z,!0),hlevel4:i(.5,me,!0),hlevel5:i(.618,he,!0),hlevel6:i(.75,D,!0),hlevel7:i(1,Te,!0),vlevel1:i(0,Te,!0),vlevel2:i(.25,ve,!0),vlevel3:i(.382,z,!0),vlevel4:i(.5,me,!0),vlevel5:i(.618,he,!0),vlevel6:i(.75,D,!0),vlevel7:i(1,Te,!0)},linetoolfibretracement:{showCoeffs:!0,showPrices:!0,fillBackground:!0,transparency:80,extendLines:!1,extendLinesLeft:!1,horzLabelsAlign:"left",vertLabelsAlign:"middle",showText:!0,horzTextAlign:"center",vertTextAlign:"middle",reverse:!1,coeffsAsPercents:!1,fibLevelsBasedOnLogScale:!1,labelFontSize:12,trendline:{visible:!0,color:Te,linewidth:2,linestyle:T},levelsStyle:{linewidth:2,linestyle:P},level1:i(0,Te,!0,!0),level2:i(.236,X,!0,!0),level3:i(.382,ve,!0,!0),level4:i(.5,me,!0,!0),level5:i(.618,he,!0,!0),level6:i(.786,z,!0,!0),level7:i(1,Te,!0,!0),level8:i(1.618,D,!0,!0),level9:i(2.618,X,!0,!0),level10:i(3.618,se,!0,!0),level11:i(4.236,ae,!0,!0),level12:i(1.272,ve,!1,!0),level13:i(1.414,X,!1,!0),
level16:i(2,he,!1,!0),level14:i(2.272,ve,!1,!0),level15:i(2.414,me,!1,!0),level17:i(3,z,!1,!0),level18:i(3.272,Te,!1,!0),level19:i(3.414,D,!1,!0),level20:i(4,X,!1,!0),level21:i(4.272,se,!1,!0),level22:i(4.414,ae,!1,!0),level23:i(4.618,ve,!1,!0),level24:i(4.764,he,!1,!0)},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:P},level1:i(0,Te,!0),level2:i(.236,X,!0),level3:i(.382,ve,!0),level4:i(.5,me,!0),level5:i(.618,he,!0),level6:i(.786,z,!0),level7:i(1,Te,!0),level8:i(1.618,D,!0),level9:i(2.618,X,!0),level10:i(3.618,se,!0),level11:i(4.236,ae,!0),level12:i(1.272,ve,!1),level13:i(1.414,X,!1),level16:i(2,he,!1),level14:i(2.272,ve,!1),level15:i(2.414,me,!1),level17:i(3,z,!1),level18:i(3.272,Te,!1),level19:i(3.414,D,!1),level20:i(4,X,!1),level21:i(4.272,se,!1),level22:i(4.414,ae,!1),level23:i(4.618,ve,!1),level24:i(4.764,he,!1)},linetoolprojection:{showCoeffs:!0,fillBackground:!0,transparency:80,color1:R,color2:ne,linewidth:2,trendline:{visible:!0,color:Pe,linestyle:P},level1:r(1,"#808080",!0)},linetool5pointspattern:{color:D,textcolor:A,fillBackground:!0,backgroundColor:D,fontsize:12,bold:!1,italic:!1,transparency:85,linewidth:2},linetoolcypherpattern:{color:D,textcolor:A,fillBackground:!0,backgroundColor:D,fontsize:12,bold:!1,italic:!1,transparency:85,linewidth:2},linetooltrianglepattern:{color:W,textcolor:A,fillBackground:!0,backgroundColor:W,fontsize:12,bold:!1,italic:!1,transparency:85,linewidth:2},linetoolabcd:{color:he,textcolor:A,fontsize:12,bold:!1,italic:!1,linewidth:2},linetoolthreedrivers:{color:W,textcolor:A,fillBackground:!0,backgroundColor:"rgba(149, 40, 204, 0.5)",fontsize:12,bold:!1,italic:!1,transparency:50,linewidth:2},linetoolheadandshoulders:{color:he,textcolor:A,fillBackground:!0,backgroundColor:he,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:P},level1:r(.236,X,!0),level2:r(.382,ve,!0),level3:r(.5,me,!0),level4:r(.618,he,!0),level5:r(.786,z,!0),level6:r(1,Te,!0),level7:r(1.618,D,!1),level8:r(2.618,X,!1),level9:r(3.618,W,!1),level10:r(4.236,ae,!1),level11:r(4.618,ae,!1)},linetoolfibcircles:{showCoeffs:!0,fillBackground:!0,transparency:80,coeffsAsPercents:!1,trendline:{visible:!0,color:Te,linewidth:2,linestyle:T},level1:r(.236,X,!0),level2:r(.382,ve,!0),level3:r(.5,he,!0),level4:r(.618,me,!0),level5:r(.786,z,!0),level6:r(1,Te,!0),level7:r(1.618,D,!0),level8:r(2.618,ae,!0),level9:r(3.618,D,!0),level10:r(4.236,ae,!0),level11:r(4.618,X,!0)},linetoolfibspeedresistancearcs:{showCoeffs:!0,fillBackground:!0,transparency:80,fullCircles:!1,trendline:{visible:!0,color:Te,linewidth:2,linestyle:T},level1:r(.236,X,!0),level2:r(.382,ve,!0),level3:r(.5,he,!0),level4:r(.618,me,!0),level5:r(.786,z,!0),level6:r(1,Te,!0),level7:r(1.618,D,!0),level8:r(2.618,ae,!0),level9:r(3.618,D,!0),level10:r(4.236,ae,!0),
level11:r(4.618,X,!0)},linetooltrendbasedfibextension:{showCoeffs:!0,showPrices:!0,fillBackground:!0,transparency:80,extendLines:!1,extendLinesLeft:!1,horzLabelsAlign:"left",vertLabelsAlign:"middle",showText:!0,horzTextAlign:"center",vertTextAlign:"middle",reverse:!1,coeffsAsPercents:!1,fibLevelsBasedOnLogScale:!1,labelFontSize:12,trendline:{visible:!0,color:Te,linewidth:2,linestyle:T},levelsStyle:{linewidth:2,linestyle:P},level1:i(0,Te,!0,!0),level2:i(.236,X,!0,!0),level3:i(.382,ve,!0,!0),level4:i(.5,me,!0,!0),level5:i(.618,he,!0,!0),level6:i(.786,z,!0,!0),level7:i(1,Te,!0,!0),level8:i(1.618,D,!0,!0),level9:i(2.618,X,!0,!0),level10:i(3.618,se,!0,!0),level11:i(4.236,ae,!0,!0),level12:i(1.272,ve,!1,!0),level13:i(1.414,X,!1,!0),level16:i(2,he,!1,!0),level14:i(2.272,ve,!1,!0),level15:i(2.414,me,!1,!0),level17:i(3,z,!1,!0),level18:i(3.272,Te,!1,!0),level19:i(3.414,D,!1,!0),level20:i(4,X,!1,!0),level21:i(4.272,se,!1,!0),level22:i(4.414,ae,!1,!0),level23:i(4.618,ve,!1,!0),level24:i(4.764,he,!1,!0)},linetooltrendbasedfibtime:{showCoeffs:!0,fillBackground:!0,transparency:80,horzLabelsAlign:"right",vertLabelsAlign:"bottom",trendline:{visible:!0,color:Te,linewidth:2,linestyle:T},level1:r(0,Te,!0),level2:r(.382,X,!0),level3:r(.5,_e,!1),level4:r(.618,me,!0),level5:r(1,he,!0),level6:r(1.382,z,!0),level7:r(1.618,Te,!0),level8:r(2,D,!0),level9:r(2.382,ae,!0),level10:r(2.618,se,!0),level11:r(3,W,!0)},linetoolschiffpitchfork:{fillBackground:!0,transparency:80,style:c.Schiff,median:{visible:!0,color:X,linewidth:2,linestyle:P},extendLines:!1,level0:r(.25,fe,!1),level1:r(.382,_e,!1),level2:r(.5,he,!0),level3:r(.618,he,!1),level4:r(.75,z,!1),level5:r(1,D,!0),level6:r(1.5,se,!1),level7:r(1.75,ae,!1),level8:r(2,K,!1)},linetoolschiffpitchfork2:{fillBackground:!0,transparency:80,style:c.Schiff2,median:{visible:!0,color:X,linewidth:2,linestyle:P},extendLines:!1,level0:r(.25,fe,!1),level1:r(.382,_e,!1),level2:r(.5,he,!0),level3:r(.618,he,!1),level4:r(.75,z,!1),level5:r(1,D,!0),level6:r(1.5,se,!1),level7:r(1.75,ae,!1),level8:r(2,K,!1)},linetoolinsidepitchfork:{fillBackground:!0,transparency:80,style:c.Inside,median:{visible:!0,color:X,linewidth:2,linestyle:P},extendLines:!1,level0:r(.25,fe,!1),level1:r(.382,_e,!1),level2:r(.5,he,!0),level3:r(.618,he,!1),level4:r(.75,z,!1),level5:r(1,D,!0),level6:r(1.5,se,!1),level7:r(1.75,ae,!1),level8:r(2,K,!1)},linetoolregressiontrend:{linewidth:1,linestyle:P,styles:{upLine:{display:p.All,color:E,linestyle:P,linewidth:2},downLine:{display:p.All,color:E,linestyle:P,linewidth:2},baseLine:{display:p.All,color:J,linestyle:T,linewidth:1},extendLines:!1,showPearsons:!0,transparency:70}}},Re(TradingView.defaultProperties.chartproperties),Oe()}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:p.All,color:D,linestyle:P,linewidth:1,plottype:u.Line,histogramBase:0,title:"MA"}}}),
void 0===TradingView.defaultProperties["study_PivotPointsHighLow@tv-basicstudies"]&&(TradingView.defaultProperties["study_PivotPointsHighLow@tv-basicstudies"]={fontsize:10,borderColor:D,backColor:k,textColor:Le}),void 0===TradingView.defaultProperties["study_PivotPointsStandard@tv-basicstudies"]){var Ve=!0;TradingView.defaultProperties["study_PivotPointsStandard@tv-basicstudies"]={_hardCodedDefaultsVersion:1,fontsize:11,levelsStyle:{showLabels:!0,visibility:{P:Ve,"S1/R1":Ve,"S2/R2":Ve,"S3/R3":Ve,"S4/R4":Ve,"S5/R5":Ve},colors:{P:Se,"S1/R1":Se,"S2/R2":Se,"S3/R3":Se,"S4/R4":Se,"S5/R5":Se},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:D,linewidth:2}),void 0===TradingView.defaultProperties["study_TPOPeriodic@tv-volumebyprice"]&&(TradingView.defaultProperties["study_TPOPeriodic@tv-volumebyprice"]={styles:{splitByBlocks:!1},graphics:{tpoLevels:{tpo:{tpoPoc:{color:""},tpoPoorHigh:{color:""},tpoPoorLow:{color:""},tpoSingleprints:{color:""},tpoVah:{color:""},tpoVal:{color:""}}}}}),void 0===TradingView.defaultProperties["study_TPOSessions@tv-volumebyprice"]&&(TradingView.defaultProperties["study_TPOSessions@tv-volumebyprice"]={styles:{splitByBlocks:!1}}),void 0===TradingView.defaultProperties["study_ElliottWave@tv-basicstudies"]&&(TradingView.defaultProperties["study_ElliottWave@tv-basicstudies"]={inputs:{},level0:t(q,!1),level1:t("#008000",!1),level2:t("#0000ff",!1),level3:t("#ff00ff",!1),level4:t("#0080ff",!0),level5:t(q,!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:p.All,color:E,linestyle:P,linewidth:1},downLine:{display:p.All,color:E,linestyle:P,linewidth:1},baseLine:{display:p.All,color:J,linestyle:P,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:l.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:be,linestyle:P,linewidth:2,priceSource:"close"},lineWithMarkersStyle:{color:be,linestyle:P,linewidth:2,priceSource:"close"},steplineStyle:{color:be,linestyle:P,linewidth:2,priceSource:"close"},areaStyle:{color1:D,color2:D,linecolor:D,linestyle:P,linewidth:2,priceSource:"close",transparency:95},baselineStyle:{baselineColor:xe,topFillColor1:Ee,topFillColor2:Ee,bottomFillColor1:Z,bottomFillColor2:Z,topLineColor:De,bottomLineColor:Y,topLineWidth:2,bottomLineWidth:2,priceSource:"close",transparency:50,baseLevelPercentage:50},hiloStyle:{color:D,showBorders:!0,borderColor:D,showLabels:!0,labelColor:D,drawBody:!0},columnStyle:{upColor:n(he,50),downColor:n(X,50),barColorsOnPrevClose:!0,priceSource:"close"},hlcAreaStyle:{highLineColor:he,highLineStyle:P,highLineWidth:2,lowLineColor:X,lowLineStyle:P,lowLineWidth:2,closeLineColor:xe,closeLineStyle:P,closeLineWidth:2,highCloseFillColor:de,closeLowFillColor:Q},styles:{open:{display:p.All,color:q,linestyle:P,linewidth:1,plottype:u.Line,histogramBase:0},high:{display:p.All,color:q,linestyle:P,linewidth:1,plottype:u.Line,histogramBase:0},low:{display:p.All,color:q,linestyle:P,linewidth:1,plottype:u.Line,histogramBase:0},close:{display:p.All,color:q,linestyle:P,linewidth:1,plottype:u.Line,histogramBase:0}}}}for(var Be=e.split("."),Ne=TradingView.defaultProperties,Fe=0;Fe<Be.length;Fe++)Ne&&(Ne=Ne[Be[Fe]]);return null!=Ne?TradingView.clone(Ne):{}};function Be(e,t,i,s,r){if(s)for(var n in s){var o=n.split("."),a=c(o[0]),l=void 0!==r&&r===o[0];0!==o.length&&l&&(a=c((o=o.slice(1))[0])),0!==o.length&&e.hasOwnProperty(a)?h(e,o,s[n])||d(n):l&&d(n)}function c(e){return t&&t[e]?t[e]:e}function h(e,t,i,s){var r=c(t[0]);return!!e.hasOwnProperty(r)&&(t.length>1?h(e[r],t.slice(1),i):(e[r]&&e[r].setValue?e[r].setValue(i):e[r]=i,!0))}function d(e){i||I.logWarn("Path `"+e+"` does not exist.")}}function Re(e,t,i,s){window.__defaultsOverrides&&Be(e,t,i,window.__defaultsOverrides,s)}function Ne(e,t){window.__settingsOverrides&&Be(e,null,!1,window.__settingsOverrides,t)}function Oe(){var e=/^linetool.+/;Object.keys(TradingView.defaultProperties).forEach((function(t){e.test(t)&&Re(TradingView.defaultProperties[t],null,!1,t)}))}function Fe(e,t){return t?function(e,t){var i=Ve(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),Ne(i,e)}return i}(e,t):function(e){var t=Ve(e);if(!window._UNIT_TESTS){var i=TradingView.clone(TVSettings.getJSON(e,null));if(i){TradingView.merge(t,i);const s=e.split(".");Ne(t,void 0===s[1]?e:s[1])}}return t}(e)}Fe.create=function(e,t){if(t){var i=Ve(e);TradingView.defaultProperties[e]=TradingView.merge(t,i)}},Fe.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=Ve,window.applyDefaultOverridesToLinetools=Oe,window.applyDefaultsOverrides=Re,window.applyPropertiesOverrides=Be,window.defaults=Fe,t.applyDefaultOverridesToLinetools=Oe,t.applyDefaultsOverrides=Re,t.applyPropertiesOverrides=Be,t.defaults=Fe,t.factoryDefaults=Ve,t.saveDefaults=TradingView.saveDefaults,t.createDefaults=Fe.create,t.removeDefaults=Fe.remove},928:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DrawingSyncMode:()=>s,SelectPointMode:()=>r,activePointSelectionMode:()=>$,barTimesUnderCursor:()=>Y,beenSetLineToolLastPoint:()=>V,cancelLineTool:()=>ee,cancelledLineTool:()=>E,changeLineStyle:()=>he,changeLineTool:()=>oe,changedLineStyle:()=>U,changedLineTool:()=>F,continueLineTool:()=>Q,continuedLineTool:()=>D,copiedLineTool:()=>j,copyLineTool:()=>de,createLineTool:()=>J,createdLineTool:()=>k,crosshairLock:()=>b,cursorTool:()=>T,drawOnAllCharts:()=>Ce,drawOnAllChartsMode:()=>Pe,emojiTool:()=>P,finishChangingLineTool:()=>ae,finishLineTool:()=>ce,finishMovingLineTool:()=>re,finishedChangingLineTool:()=>W,finishedLineTool:()=>z,finishedMovingLineTool:()=>N,hideAllDrawings:()=>ye,hideAllIndicators:()=>Se,hideMarksOnBars:()=>we,iconTool:()=>C,init:()=>ge,isDirectionalMovementActive:()=>L,isStudyEditingNow:()=>K,isToolCreatingNow:()=>I,isToolEditingNow:()=>M,isToolMovingNow:()=>A,lockDrawings:()=>be,moveLineTool:()=>se,movedLineTool:()=>R,properties:()=>ve,removeLineTool:()=>le,removedLineTool:()=>H,resetToCursor:()=>m,restoreLineTool:()=>ue,restoreLineToolState:()=>pe,restoredLineTool:()=>G,restoredLineToolState:()=>q,runOnDrawingStateReady:()=>fe,setLineToolLastPoint:()=>te,startChangingLineTool:()=>ne,startMovingLineTool:()=>ie,startedChangingLineTool:()=>O,startedMovingLineTool:()=>B,stickerTool:()=>x,tool:()=>w,toolIsCursor:()=>p,toolIsMeasure:()=>_});var s,r,n=i(50151),o=i(17625),a=i(55917),l=i(64147),c=i(91676),h=i(52033),d=i(56840),u=i(76422);function p(e){return"cursor"===e||"arrow"===e||"dot"===e||"performance"===e}function _(e){return"measure"===e}function m(e=!1){if(!e&&g){if(g.childs().stayInDrawingMode.value())return}w.setValue(T.value())}!function(e){e[e.Layout=1]="Layout",e[e.Global=2]="Global"}(s||(s={})),function(e){e[e.None=0]="None",e[e.Replay=1]="Replay",e[e.Study=2]="Study"}(r||(r={}));let g=null,f=null,v=null,y=null,S=null;const b=new c.WatchedObject(null),w=new l.WatchedValue,C=new l.WatchedValue,P=new l.WatchedValue,x=new l.WatchedValue,T=new l.WatchedValue,I=new l.WatchedValue(!1),M=new l.WatchedValue(!1),A=new l.WatchedValue(!1),L=new l.WatchedValue(!1),k=new h.Delegate,D=new h.Delegate,E=new h.Delegate,V=new h.Delegate,B=new h.Delegate,R=new h.Delegate,N=new h.Delegate,O=new h.Delegate,F=new h.Delegate,W=new h.Delegate,H=new h.Delegate,z=new h.Delegate,U=new h.Delegate,j=new h.Delegate,G=new h.Delegate,q=new h.Delegate,$=new l.WatchedValue(r.None),K=new l.WatchedValue(!1),Y=new Map;function Z(e,t){const i=t||{value:!1};return t=>{i.value||(i.value=!0,e.fire(t),i.value=!1)}}
const X={value:!1},J=Z(k,X),Q=Z(D,X),ee=Z(E,X),te=Z(V,X),ie=Z(B),se=Z(R),re=Z(N),ne=Z(O),oe=Z(F),ae=Z(W),le=Z(H),ce=Z(z),he=Z(U,X),de=Z(j,X),ue=Z(G),pe=Z(q);let _e=!1,me=[];function ge(){_e||(w.setValue(d.getValue("chart.cursorPreference","cursor")),w.subscribe((e=>p(e)&&T.setValue(e)),{callWithLast:!0}),T.subscribe((e=>{e&&"performance"!==e&&d.setValue("chart.cursorPreference",e)})),g=new a.DefaultProperty({defaultName:"drawings"}),f=(0,o.createPrimitiveProperty)(),v=(0,o.createPrimitiveProperty)(),y=(0,o.createPrimitiveProperty)(),S=(0,o.createPrimitiveProperty)(),f.setValue(!1),v.setValue(!1),y.setValue(!1),S.setValue(!d.getBool("BarsMarksContainer.visibile",!0)),w.subscribe((e=>{(0,u.emit)("onSelectedLineToolChanged")})),_e=!0,me.forEach((e=>e())),me=[])}function fe(e){_e?e():me.push(e)}function ve(){return(0,n.ensureNotNull)(g)}function ye(){return(0,n.ensureNotNull)(f)}function Se(){return(0,n.ensureNotNull)(v)}function be(){return(0,n.ensureNotNull)(y)}function we(){return(0,n.ensureNotNull)(S)}function Ce(){return ve().childs().drawOnAllCharts}function Pe(){return ve().childs().drawOnAllChartsMode}},28331:(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})}}},73698:(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]))}},24526:(e,t,i)=>{"use strict";i.d(t,{customFormatters:()=>s});const s={dateFormatter:null,timeFormatter:null,tickMarkFormatter:null,priceFormatterFactory:null,studyFormatterFactory:null}},47462:(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(58683);const o={1:()=>s.t(null,void 0,i(62310)),2:()=>s.t(null,void 0,i(2507)),3:()=>s.t(null,void 0,i(92767)),4:()=>s.t(null,void 0,i(27072)),5:()=>s.t(null,{context:"short"},i(13132)),6:()=>s.t(null,void 0,i(429)),7:()=>s.t(null,void 0,i(53786)),8:()=>s.t(null,void 0,i(46450)),9:()=>s.t(null,void 0,i(6816)),10:()=>s.t(null,void 0,i(12179)),11:()=>s.t(null,void 0,i(26899)),12:()=>s.t(null,void 0,i(32084))},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"},82826:(e,t,i)=>{"use strict";i.d(t,{DateFormatter:()=>n});var s=i(24526),r=i(47462);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)}parse(e){if(""===e)return{res:!1};let t=e;return s.customFormatters&&s.customFormatters.dateFormatter&&!s.customFormatters.dateFormatter.parse&&console.warn("You need to provide a `parse` function as part of `dateFormatter`"),s.customFormatters&&s.customFormatters.dateFormatter&&s.customFormatters.dateFormatter.parse&&(t=String(s.customFormatters.dateFormatter.parse(e))),{res:!0,value:t}}}},52388:(e,t,i)=>{"use strict";i.d(t,{DateTimeFormatter:()=>o})
;var s=i(15344),r=i(82826);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)}`}}},58683:(e,t,i)=>{"use strict";i.d(t,{numDependencyFormatter:()=>n,numberToStringWithLeadingZero:()=>r});var s=i(37265);function r(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)}function n(e){const t=new Map;return i=>{const s=null!=i?i:-1;let r=t.get(s);return r||(r=e(i),t.set(s,r)),r}}},73866:(e,t,i)=>{"use strict";i.d(t,{LimitedPrecisionNumericFormatter:()=>n});var s,r=i(59623);!function(e){e[e.DefaultPrecision=1]="DefaultPrecision"}(s||(s={}));class n{constructor(e,t){this._precision=null!=e?e:1,this._numericFormatter=new r.NumericFormatter({precision:this._precision,ignoreLocaleNumberFormat:t})}format(e,t){const i=e.toFixed(this._precision),s=Math.pow(10,-this._precision);return this._numericFormatter.format(Math.max(parseFloat(i),s),t)}parse(e,t){const i=this._numericFormatter.parse(e,t);return i.res?{res:!0,value:i.value,suggest:this.format(i.value)}:i}}},53085:(e,t,i)=>{"use strict";i.d(t,{formatNumber:()=>r,parseNumber:()=>o});var s=i(60521);function r(e,t,i,r,n){if(!Number.isFinite(e))return`${e}`;const o=-1===Math.sign(e)?"-":"";e=Math.abs(e);let a=void 0===i?e.toString():e.toFixed(i);if(a.includes("e")){if(!r)return`${o}${a.replace(".",t.decimalSign)}`;{const t=new s.Big(e);a=t.lt(1)?t.toFixed():t.toString()}}const l=a.split("."),c=l[0];let h=l[1];const d=function(e,t){let i=e.length;const s=[];for(;i>0;)s.unshift(e.slice(Math.max(i-3,0),i)),i-=3;return s.join(t)}(c,t.groupingSeparator);return void 0!==i&&(h=0===i?void 0:e.toFixed(i).slice(-i)),void 0!==n&&void 0!==h&&(h=function(e,t){let i=e.length-1;for(let s=i;s>=t&&"0"===e[s];s-=1)i-=1;return e.slice(0,i+1)}(h,n)),h?`${o}${d}${t.decimalSign}${h}`:`${o}${d}`}const n=(0,i(48874).default)((e=>{const t=e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&");return new RegExp(t,"gm")}));function o(e,t){if(/^(NaN|[+|-]?Infinity)$/.test(e))return parseFloat(e);const i=n(t.groupingSeparator);return i&&(e=e.replace(i,"")),e=e.replace(t.decimalSign,"."),/^(\+|-)?\d+(\.\d+|\.)?(e(\+|-)?\d+)?$/.test(e)?parseFloat(e):NaN}},11345:(e,t,i)=>{"use strict";let s;i.d(t,{formatterOptions:()=>r,formatterOptionsLibraryOverrides:()=>n,getNumberFormat:()=>d});const r={decimalSign:".",decimalSignFractional:"'"},n={};const o={groupingSeparator:",",decimalSign:"."},a={groupingSeparator:".",decimalSign:","},l={groupingSeparator:" ",decimalSign:","},c={
groupingSeparator:"",decimalSign:"."},h=new Map([["en",o],["th",o],["ja",o],["ko",o],["zh",o],["zh_TW",o],["ar",o],["he_IL",o],["ms_MY",o],["de",a],["es",a],["it",a],["tr",a],["pt",a],["id_ID",a],["vi",a],["fr",l],["pl",l],["ru",l]]);function d(e){var t;return{...null!==(t=h.get(s||window.language||""))&&void 0!==t?t:c,...n}}},59623:(e,t,i)=>{"use strict";i.d(t,{NumericFormatter:()=>n});var s=i(53085),r=i(11345);class n{constructor(e={}){this._options=e}format(e,t){if(!Number.isFinite(e))return String(e);const{ignoreLocaleNumberFormat:i,precision:o,minPrecision:a}=this._options,l=(0,r.getNumberFormat)(i||(null==t?void 0:t.ignoreLocaleNumberFormat));return void 0===o?n._formatNoEImpl(e,l,o,a):(0,s.formatNumber)(e,l,o,void 0,a)}parse(e,t){const{ignoreLocaleNumberFormat:i,precision:n}=this._options,o=(0,r.getNumberFormat)(i||(null==t?void 0:t.ignoreLocaleNumberFormat));let a=(0,s.parseNumber)(e,o);return Number.isFinite(a)?(n&&(a=+a.toFixed(n)),{res:!0,value:a}):{res:!1}}static formatNoE(e,t){return this._formatNoEImpl(e,t)}static _formatNoEImpl(e,t,i,r){return Number.isFinite(e)?(t=null!=t?t:{groupingSeparator:"",decimalSign:"."},(0,s.formatNumber)(e,t,i,!0,r)):String(e)}}},719:(e,t,i)=>{"use strict";i.d(t,{PercentageFormatter:()=>n});var s=i(725),r=i(63273);class n extends s.PriceFormatter{constructor(e={}){void 0!==e.decimalPlaces&&(e.priceScale=Math.pow(10,e.decimalPlaces)),super(e),this.type="percentage"}state(){return{...super.state(),percent:!0}}parse(e,t){return e=e.replace("%",""),super.parse(e,t)}format(e,t={}){const{useRtlFormat:i=!0}=t,s=super.format(e,{...t,useRtlFormat:!1})+"%";return i?(0,r.forceLTRStr)(s):s}static serialize(e){return e.state()}static deserialize(e){return new n(e)}}},725:(e,t,i)=>{"use strict";i.d(t,{PriceFormatter:()=>x});var s=i(60521),r=i(31955),n=i(50151),o=i(11542),a=i(50335),l=i(37265);function c(e){return e?(0,s.Big)(e.minMove).div(e.priceScale).toNumber():NaN}function h(e){const{minTick:t,price:i,variableMinTickData:s,shouldCheckForEquality:r}=e,n=(0,a.isNumber)(t)?d(t):t;return void 0===s?n:function(e,t,i=!1){for(let s=0;s<t.length;s++){if(e<t[s].price)return t[s].minTick;if(i&&e===t[s].price)return t[s].minTick}return t[t.length-1].minTick}(i,s,r)}function d(e){const t=function(e){return(new s.Big(e).toFixed().split(".")[1]||"").length}(e),i=Math.pow(10,t);return{priceScale:i,minMove:(0,s.Big)(e).mul(i).toNumber()}}function u(e,t){var i,r,n,o,h;const u=[{minTick:(0,a.isNumber)(e)?d(e):e,price:1/0,maxIndex:1/0}];try{const e=t.split(" ").map(((e,t)=>(0,l.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,l.isEven)(e.length))throw new Error("Theme must not be event number of elements");const a=[];for(let t=0;t<e.length;t+=2){const l=null!==(i=e[t+1])&&void 0!==i?i:1/0,d=null!==(n=null===(r=a[a.length-1])||void 0===r?void 0:r.price)&&void 0!==n?n:0,u=null!==(h=null===(o=a[a.length-1])||void 0===o?void 0:o.maxIndex)&&void 0!==h?h:0,p=l===1/0?1/0:new s.Big(l).minus(d).div(c(e[t])).plus(u).toNumber();a.push({minTick:e[t],price:l,maxIndex:p})}return a}catch(e){return u}}var p=i(63273);const _=new RegExp(/^(-?)[0-9]+$/);function m(e,t,i,s){let r=0;if(e>0&&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,n.ensureNotNull)(h({price:i,minTick:null,variableMinTickData:t,shouldCheckForEquality:!0})),{priceScale:r,minMove:o,minMove2:a}=s;return{priceScale:r,minMove:o,fractionalLength:m(r,o,e,a)}}class f{constructor(e){this._formatterErrors={custom:o.t(null,void 0,i(66123)),fraction:o.t(null,void 0,i(39643)),secondFraction:o.t(null,void 0,i(70784))};const{priceScale:t,minMove:s,minMove2:r,ignoreMinMove:n,variableMinTick:a,fractionalLength:l}=e;this._priceScale=t,this._minMove=s,this._minMove2=r,this._ignoreMinMove=n,this._variableMinTickData=void 0===a?void 0:u({priceScale:t,minMove:s,minMove2:r},a),this._fractionalLength=l}formatImpl(e,t={}){const{signPositive:i,signNegative:s=!0,tailSize:r,cutFractionalByPrecision:n=!1,useRtlFormat:o=!0,variableMinTickDataPrice:a,ignoreLocaleNumberFormat:l,removeAllEndingZeros:c}=t;let h="";e<0?h=!1===s?"":"−":e&&!0===i&&(h="+");const d=h+this._formatUnsigned(Math.abs(e),r,n,a,l,c);return o?(0,p.forceLTRStr)(d):d}parse(e,t){return"+"===(e=(e=(0,p.stripLTRMarks)(e)).replace("−","-"))[0]&&(e=e.substring(1)),this._parseUnsigned(e,t)}_removeEndingZeros(e,t){for(let i=0;i<t&&"0"===e[e.length-1];i++)e=e.substring(0,e.length-1);return e}}var v=i(53085),y=i(58683),S=i(11345);const b=(0,r.getLogger)("Chart.DecimalPriceFormatter");class w extends f{constructor(e){super(e);const{minMove2:t,ignoreLocaleNumberFormat:i}=e;void 0!==t&&10!==t&&0!==t&&1!==t&&b.logDebug("invalid minmove2"),this._ignoreLocaleNumberFormat=i}hasForexAdditionalPrecision(){return 10===this._minMove2}_parseUnsigned(e,t){return this._parseAsDecimal(e,t)}_formatUnsigned(e,t,i,s,r,n){const o={price:Math.abs(e),priceScale:this._priceScale,minMove:this._minMove,fractionalLength:this._fractionalLength,tailSize:t,cutFractionalByPrecision:i,ignoreLocaleNumberFormat:r,removeAllEndingZeros:n};return void 0!==this._variableMinTickData&&(Object.assign(o,g(!1,this._variableMinTickData,null!=s?s:o.price)),this._ignoreMinMove&&(o.minMove=1)),this._formatAsDecimal(o)}_formatAsExponential(e,t){const i=Math.floor(.75*Math.log10(this._priceScale)),s=e*Math.pow(10,i),r=`e-${i}`,n=Math.log10(this._priceScale)-i;return`${s.toFixed(n).replace(".",t.decimalSign)}${r}`}_formatAsDecimal(e){
const{price:t,priceScale:i,minMove:r,fractionalLength:n=0,tailSize:o=0,cutFractionalByPrecision:a,ignoreLocaleNumberFormat:l,removeAllEndingZeros:c}=e,h=(0,S.getNumberFormat)(this._ignoreLocaleNumberFormat||l);if(t>=1e21)return t.toString().replace(".",h.decimalSign);if(i>1e15)return this._formatAsExponential(t,h);const d=Math.pow(10,o)*i/(a?1:r),u=1/d;let p;if(d>1)p=Math.floor(t);else{const e=Math.floor(Math.round(t/u)*u);p=0===Math.round((t-e)/u)?e:e+u}let _="";if(d>1){let e=a?new s.Big(t).mul(d).round(void 0,0).minus(new s.Big(p).mul(d)).toNumber():parseFloat((Math.round(t*d)-p*d).toFixed(n));e>=d&&(e-=d,p+=1),e=a?new s.Big(e).round(n,0).toNumber():parseFloat(e.toFixed(n))*r;const i=(0,y.numberToStringWithLeadingZero)(e,n+o),l=this._removeEndingZeros(i,c?i.length:o);_=l?h.decimalSign+l:l}return(0,v.formatNumber)(p,h)+_}_parseAsDecimal(e,t={}){const{ignoreLocaleNumberFormat:i}=t,s=(0,S.getNumberFormat)(this._ignoreLocaleNumberFormat||i),r=(0,v.parseNumber)(e,s);return Number.isFinite(r)?{value:r,res:!0,suggest:this.formatImpl(r)}:{error:this._formatterErrors.custom,res:!1}}}const C=(0,r.getLogger)("Chart.FractionalPriceFormatter");class P extends f{constructor(e){super(e);const{minMove2:t}=e;null!=t&&t>0&&2!==t&&4!==t&&8!==t&&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,n.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]+)\\"+S.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]+)\\"+S.formatterOptions.decimalSignFractional+"([0-9]+)\\"+S.formatterOptions.decimalSignFractional+"([0-9]+)$").exec(e),t){const e=!!t[1],i=parseInt(t[2]),s=void 0!==this._minMove2&&null!==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(null!=n&&a>=n||a<0)return{error:this._formatterErrors.secondFraction,res:!1};let l=null!=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,y.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,y.numberToStringWithLeadingZero)(c,o),i=this._getFractPart(e,2,n);d=t+S.formatterOptions.decimalSignFractional+i}else c=this._getFractPart(c,1,s),d=(0,y.numberToStringWithLeadingZero)(c*r,o);return l.toString()+S.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={}){this.type="price";const{minMove2:t,fractional:i,variableMinTick:s,ignoreMinMove:r,ignoreLocaleNumberFormat:n}=e,o=!e.minMove||r?1:e.minMove,a=(0,l.isNumber)(e.priceScale)&&(0,l.isInteger)(e.priceScale)?e.priceScale:100,c=m(a,o,i,t),h={...e,minMove:o,priceScale:a,fractionalLength:c};if(a<0)throw new TypeError("invalid base");this._priceScale=a,this._minMove=o,this._minMove2=t,this._fractional=i,this._variableMinTick=s,this._ignoreMinMove=r,this._fractionalLength=c,this._ignoreLocaleNumberFormat=n,this._implementation=i?new P(h):new w(h)}isFractional(){return!!this._fractional}state(){return{minMove:this._minMove,minMove2:this._minMove2,priceScale:this._priceScale,variableMinTick:this._variableMinTick,ignoreMinMove:this._ignoreMinMove,fractional:this._fractional}}formatChange(e,t,i){return this._implementation.formatImpl(e-t,{...i,variableMinTickDataPrice:Math.min(Math.abs(e),Math.abs(t))})}format(e,t){return this._implementation.formatImpl(e,t)}parse(e,t){return this._implementation.parse(e,t)}hasForexAdditionalPrecision(){return this._implementation.hasForexAdditionalPrecision()}static serialize(e){return e.state()}static deserialize(e){return new x(e)}}},15344:(e,t,i)=>{"use strict";i.d(t,{TimeFormatter:()=>p,hourMinuteFormat:()=>l,hourMinuteNonZeroSecondFormat:()=>o,hourMinuteSecondFormat:()=>n,hourMinuteSecondMillisecFormat:()=>a,twelveHourMinuteFormat:()=>d,twelveHourMinuteNonZeroSecondFormat:()=>h,twelveHourMinuteSecondFormat:()=>c});var s=i(24526),r=i(58683);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";var u;!function(e){e.TwentyFourHours="24-hours",e.TwelveHours="12-hours"}(u||(u={}));class p{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}}},92953:(e,t,i)=>{"use strict";i.d(t,{TimeSpanFormatter:()=>o});var s=i(11542),r=i(53085),n=i(11345);class o{format(e,t){const o=e<0;e=Math.abs(e);const a=Math.floor(e/86400);e-=86400*a;const l=Math.floor(e/3600);e-=3600*l;const c=Math.floor(e/60);e-=60*c;let h="";if(a){const e=(0,n.getNumberFormat)(null==t?void 0:t.ignoreLocaleNumberFormat);h+=(0,r.formatNumber)(a,e)+s.t(null,{context:"dates"},i(85886))+" "}return l&&(h+=l+s.t(null,{context:"dates"},i(44634))+" "),c&&(h+=c+s.t(null,{context:"dates"},i(5977))+" "),e&&(h+=e+s.t(null,{context:"dates"},i(21492))+" "),o&&(h="-"+h),h.trim()}}},46084:(e,t,i)=>{"use strict";i.d(t,{VolumeFormatter:()=>o});var s=i(11542),r=i(59623),n=i(37265);class o{constructor(e={}){this.type="volume";const{precision:t,minPrecision:i,dimensionPrecision:s,dimensionMinPrecision:n,ignoreLocaleNumberFormat:o,removeSpaceBeforeDimension:a}=e;this._precision=null!=t?t:0,this._formatter=new r.NumericFormatter({ignoreLocaleNumberFormat:o,precision:this._precision,minPrecision:null!=i?i:0}),this._dimensionPrecision=null!=s?s:3,this._dimensionFormatter=new r.NumericFormatter({ignoreLocaleNumberFormat:o,precision:this._dimensionPrecision,minPrecision:null!=n?n:0}),this._fractionalValues=void 0!==t&&t>0,this._spaceBeforeDimension=a?"":" ",this._options=e}state(){const{ignoreLocaleNumberFormat:e,...t}=this._options;return t}format(e,t){if(!(0,n.isNumber)(e))return"---";if(Math.abs(e)>=1e100)return s.t(null,void 0,i(96935));const r=Math.abs(e);let o="";(e=r<1e3?+e.toFixed(this._precision):r<1e6?1e3*+(e/1e3).toFixed(this._dimensionPrecision):r<1e9?1e6*+(e/1e6).toFixed(this._dimensionPrecision):r<1e12?1e9*+(e/1e9).toFixed(this._dimensionPrecision):1e12*+(e/1e12).toFixed(this._dimensionPrecision))<0?o="−":e>0&&(null==t?void 0:t.signPositive)&&(o="+"),
e=Math.abs(e);const a=!!(null==t?void 0:t.ignoreLocaleNumberFormat);let l,c;return e<1e3?l=this._formatNumber(e,a,this._formatter):e<1e6?(l=this._formatNumber(e/1e3,a,this._dimensionFormatter),c="K"):e<1e9?(l=this._formatNumber(e/1e6,a,this._dimensionFormatter),c="M"):e<1e12?(l=this._formatNumber(e/1e9,a,this._dimensionFormatter),c="B"):(l=this._formatNumber(e/1e12,a,this._dimensionFormatter),c="T"),c?`${o}${l}${this._spaceBeforeDimension}${c}`:`${o}${l}`}parse(e,t){if("---"===e)return{error:"not a number",res:!1,value:NaN};const i={K:1e3,M:1e6,B:1e9,T:1e12},s=(e=e.replace("−","-")).slice(-1);if(i.hasOwnProperty(s)){const r=this._formatter.parse(e.slice(0,-1).trim(),t),o=r.res?r.value:NaN;return(0,n.isNumber)(o)?{res:!0,value:o*i[s]}:{error:"not a number",res:!1,value:NaN}}{const i=this._formatter.parse(e.trim(),t),s=i.res?i.value:NaN;return(0,n.isNumber)(s)?{res:!0,value:s}:{error:"not a number",res:!1,value:NaN}}}static serialize(e){return e.state()}static deserialize(e){return new o(e)}_formatNumber(e,t,i){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 i.format(e,{ignoreLocaleNumberFormat:t})}}},41991:(e,t,i)=>{"use strict";i.d(t,{getPriceValueFormatterForSource:()=>l,getPriceValueFormatterForStudy:()=>c,shouldBeFormattedAsIndexedTo100:()=>o,shouldBeFormattedAsPercent:()=>n});var s=i(68805),r=i(60074);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,s)=>{var r;return t.formatPriceIndexedTo100(i,null!==(r=e.firstValue())&&void 0!==r?r:100,s)}:n(e)&&null!==t?(i,s)=>{var r;return t.formatPricePercentage(i,null!==(r=e.firstValue())&&void 0!==r?r:100,s)}: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)}},56468:(e,t,i)=>{"use strict";i.d(t,{AreaName:()=>s,HitTarget:()=>n,HitTestResult:()=>h,hitTestResultDataAreEqual:()=>c,shouldDefaultActionBeExecuted:()=>l,tryCallHandler:()=>a});var s,r,n,o=i(50151);function a(e,t,i,s){if(e.isTouch){if(void 0!==s)return s(e,t),!0}else if(void 0!==i)return i(e,t),!0;return!1}function l(e,t,i,s){return void 0!==t.executeDefaultAction&&(e.isTouch?Boolean(t.executeDefaultAction[s]):Boolean(t.executeDefaultAction[i]))}function c(e,t){return e&&t&&e.equals&&t.equals?e.equals(t):e===t}!function(e){e.Style="Style",e.Text="Text",e.Line="Line",e.Tooltip="Tooltip",e.Button="Button",e.SourceItemMove="SourceItemMove",e.AnchorPoint="AnchorPoint"}(s||(s={})),function(e){e[e.Both=0]="Both",e[e.Horz=1]="Horz",e[e.Vert=2]="Vert"}(r||(r={})),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"}(n||(n={}));class h{constructor(e,t,i){this._target=e,this._data=t||null,this._eraseMarker=i}target(){return this._target}data(){return this._data}mergeData(e){this._data={...(0,o.ensureNotNull)(this._data),...e}}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,t){return null!==this._data&&a(e,t,this._data.mouseDownHandler,this._data.touchStartHandler)}tryCallMouseUpOrTouchEndHandler(e,t){return null!==this._data&&a(e,t,this._data.mouseUpHandler,this._data.touchEndHandler)}tryCallMouseEnterHandler(e,t){return null!==this._data&&a(e,t,this._data.mouseEnterHandler)}tryCallMouseLeaveHandler(e,t){return null!==this._data&&a(e,t,this._data.mouseLeaveHandler)}tryCallMouseMoveHandler(e,t){return null!==this._data&&a(e,t,this._data.mouseMoveHandler)}tryCallClickOrTapHandler(e,t){return null!==this._data&&a(e,t,this._data.clickHandler,this._data.tapHandler)}tryCallDblClickOrDblTapHandler(e,t){return null!==this._data&&a(e,t,this._data.doubleClickHandler,this._data.doubleTapHandler)}tryCallContextMenuHandler(e,t){return null!==this._data&&a(e,t,this._data.contextMenuHandler,this._data.touchContextMenuHandler)}eraseMarker(){return this._eraseMarker}}},52397:(e,t,i)=>{"use strict";i.d(t,{HorizontalLinePaneView:()=>n});var s=i(50600),r=i(51056);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}}},91140:(e,t,i)=>{"use strict";var s,r,n;i.d(t,{CustomSourceLayer:()=>a,PlDisplay:()=>r,RecalcVisibleRangeStudiesReason:()=>c,TradedGroupHorizontalAlignment:()=>n,tradingPreferencesDefault:()=>o}),function(e){e[e.Initial=2]="Initial",e[e.SeriesZOrderIsAlwaysZero=3]="SeriesZOrderIsAlwaysZero",e[e.Current=3]="Current"}(s||(s={})),function(e){e[e.Money=0]="Money",e[e.Pips=1]="Pips",e[e.Percentage=2]="Percentage"}(r||(r={})),function(e){e[e.Left=0]="Left",e[e.Center=1]="Center",e[e.Right=2]="Right"}(n||(n={}));const o={showPositions:!1,positionPL:{visibility:!1,display:r.Money},bracketsPL:{visibility:!1,display:r.Money},showOrders:!1,showExecutions:!1,showExecutionsLabels:!1,showReverse:!1,extendLeft:!1,lineLength:0,horizontalAlignment:n.Right,lineWidth:0,lineStyle:0};var a,l,c,h;!function(e){e[e.Background=0]="Background",e[e.Foreground=1]="Foreground",e[e.Topmost=2]="Topmost"}(a||(a={})),function(e){e[e.Unavailable=0]="Unavailable",e[e.AvailableReadonlyAlwaysDisabled=1]="AvailableReadonlyAlwaysDisabled",e[e.AvailableReadonlyAlwaysEnabled=2]="AvailableReadonlyAlwaysEnabled",e[e.Available=3]="Available"}(l||(l={})),function(e){e[e.ViewportChangeUserAction=0]="ViewportChangeUserAction",
e[e.DataUpdate=1]="DataUpdate",e[e.SeriesRestart=2]="SeriesRestart",e[e.SeriesCompleted=3]="SeriesCompleted",e[e.StudyCreation=4]="StudyCreation"}(c||(c={})),function(e){e[e.Chart=0]="Chart"}(h||(h={}))},19466:(e,t,i)=>{"use strict";var s,r,n;i.d(t,{TitleDisplayTarget:()=>n}),function(e){e[e.AfterMainSeries=0]="AfterMainSeries"}(s||(s={})),function(e){e[e.Idle=0]="Idle",e[e.Processing=1]="Processing",e[e.Active=2]="Active",e[e.Stopped=3]="Stopped"}(r||(r={})),function(e){e[e.DataWindow=2]="DataWindow",e[e.StatusLine=8]="StatusLine"}(n||(n={}))},85049:(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}is1Tick(){return this.isTicks()&&1===this.multiplier()}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)}},31229:(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}},94260:(e,t,i)=>{"use strict";i.d(t,{IntervalsVisibilitiesProperty:()=>r});var s=i(12988);i(10892);class r extends s.Property{state(e){return super.state(e)}storeStateIfUndefined(){return!1}}},10892:(e,t,i)=>{"use strict";i.d(t,{getIntervalsVisibilitiesForMode:()=>p,isActualInterval:()=>d,makeIntervalsVisibilitiesVisibleAtInterval:()=>c,mergeIntervalVisibilitiesDefaults:()=>u});var s,r=i(14314),n=i(27788),o=i(50151),a=i(85049),l=i(31229);function c(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 a.Interval(a.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 h(e,t,i,s){return e&&s>=t&&s<=i}function d(e,t){const i=t.childs();switch(e.kind()){case a.ResolutionKind.Ticks:return i.ticks.value();case a.ResolutionKind.Seconds:if(e.multiplier()<60)return h(i.seconds.value(),i.secondsFrom.value(),i.secondsTo.value(),e.multiplier());{const t=Math.floor(e.multiplier()/60);return h(i.minutes.value(),i.minutesFrom.value(),i.minutesTo.value(),t)}case a.ResolutionKind.Minutes:if(e.multiplier()<60)return h(i.minutes.value(),i.minutesFrom.value(),i.minutesTo.value(),e.multiplier());{const t=Math.floor(e.multiplier()/60);return h(i.hours.value(),i.hoursFrom.value(),i.hoursTo.value(),t)}case a.ResolutionKind.Days:
return h(i.days.value(),i.daysFrom.value(),i.daysTo.value(),e.multiplier());case a.ResolutionKind.Weeks:return h(i.weeks.value(),i.weeksFrom.value(),i.weeksTo.value(),e.multiplier());case a.ResolutionKind.Months:return h(i.months.value(),i.monthsFrom.value(),i.monthsTo.value(),e.multiplier());case a.ResolutionKind.Range:return i.ranges.value()}return(0,o.assert)(!1,`Unsupported resolution: ${e.value()}`),!1}function u(e){return(0,r.default)((0,n.default)(l.intervalsVisibilitiesDefaults),null!=e?e:{})}function p(e,t){if(0===t||e.isTicks()&&3===t||e.isRange()&&2===t)return u();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)})),u(s)}!function(e){e[e.All=0]="All",e[e.OnlyCurrent=1]="OnlyCurrent",e[e.CurrentAndBelow=2]="CurrentAndBelow",e[e.CurrentAndAbove=3]="CurrentAndAbove"}(s||(s={}))},8025:(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={}))},66666:(e,t,i)=>{"use strict";function s(e){return Boolean(e.showInObjectTree)}i.d(t,{isDataSource:()=>s})},4340:(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"},60074:(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})},23486:(e,t,i)=>{"use strict";i.d(t,{alwaysShowLastPriceAndLastDayChange:()=>s,lastDayChangeAvailable:()=>r});i(56570);const s=!1,r=!1},15399:(e,t,i)=>{"use strict";i.d(t,{LevelsProperty:()=>m});var s=i(27788),r=i(14314),n=i(37265),o=i(55917),a=i(35039);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){const{levelsIterator:t=p,map:i={},...s}=e,r={...l,...i};s.state&&(s.state=_(s.state,r,t)),super(s),this._map=r,this._levelsIterator=t}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.preferences())}clone(){return new m(this._options())}merge(e,t){return super.merge(this._map?_(e,this._map,this._levelsIterator):e,t)}_options(){return{...super._options(),map:{...this._map},levelsIterator:this._levelsIterator}}}},85719:(e,t,i)=>{"use strict";i.d(t,{lineToolsDoNotAffectChartInvalidation:()=>s});const s=!1},62839:(e,t,i)=>{"use strict";i.d(t,{LineToolsGroup:()=>l});var s=i(52033),r=i(64147),n=i(92184);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()})}}},17658:(e,t,i)=>{"use strict";i.d(t,{LineTool5PointsPattern:()=>a});var s=i(50151),r=i(55917),n=i(29875),o=i(73305);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({defaultName:"linetool5pointspattern",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,35737)).then((e=>e.PatternWithBackgroundDefinitionViewModel))}_loadPaneViews(e){Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,77142)).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"))]))}}},30906:(e,t,i)=>{"use strict";i.d(t,{LineToolABCD:()=>a});var s=i(50151),r=i(55917),n=i(29875),o=i(73305);class a extends n.LineDataSource{constructor(e,t,s,r){const n=t||a.createProperties();super(e,n,s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,76441)).then((t=>{this._setPaneViews([new t.ABCDPaneView(this,e)])}))}pointsCount(){return 4}name(){return"ABCD Pattern"}static createProperties(e){const t=new r.DefaultProperty({defaultName:"linetoolabcd",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){
return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,66085)).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"))]))}}},87654:(e,t,i)=>{"use strict";i.d(t,{LineToolArc:()=>d});var s,r=i(50151),n=i(4652),o=i(86441),a=i(25422),l=i(55917),c=i(29875),h=i(73305);!function(e){e[e.ArcWithTwoPoints=1]="ArcWithTwoPoints",e[e.ArcWithTheePoints=2]="ArcWithTheePoints",e[e.TheLatest=2]="TheLatest"}(s||(s={}));class d extends c.LineDataSource{constructor(e,t,s,r){const n=t||d.createProperties();super(e,n,s,r),this.version=2,this._dist=null,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,15190)).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,r.ensureNotNull)(this.pointToScreenPoint(this._points[0])),t=(0,r.ensureNotNull)(this.pointToScreenPoint(this._points[1])),i=(0,r.ensureNotNull)(this.pointToScreenPoint(this._points[2]));this._dist=(0,n.distanceToLine)(e,t,i).distance;const s=t.subtract(e),a=new o.Point(-s.y,s.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},s=(0,r.ensureNotNull)(this.pointToScreenPoint(this._points[0])),l=(0,r.ensureNotNull)(this.pointToScreenPoint(this._points[1]));switch(e){case 0:{const e=(0,r.ensureNotNull)(this._dist),t=(0,r.ensureNotNull)(this.pointToScreenPoint(i)),s=l.subtract(t),n=t.add(l).scaled(.5);let a=new o.Point(-s.y,s.x);a=a.normalized();const c=n.add(a.scaled(e));this._points[0]=i,this._points[2]=(0,r.ensureNotNull)(this.screenPointToPoint(c));break}case 1:{const e=(0,r.ensureNotNull)(this._dist),t=(0,r.ensureNotNull)(this.pointToScreenPoint(i)),n=t.subtract(s),a=s.add(t).scaled(.5),l=new o.Point(-n.y,n.x).normalized(),c=a.add(l.scaled(e));this._points[1]=i,this._points[2]=(0,r.ensureNotNull)(this.screenPointToPoint(c));break}case 2:{let e=(0,r.ensureNotNull)(this.pointToScreenPoint(i));const t=(0,n.distanceToLine)(s,l,e).distance,c=l.subtract(s),h=s.add(l).scaled(.5),d=new o.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,a.translationMatrix)(-h.x,-h.y);e=(0,a.transformPoint)(v,e);let y=(0,a.transformPoint)(v,u);v=(0,a.rotationMatrix)(-f),e=(0,a.transformPoint)(v,e),y=(0,a.transformPoint)(v,y),v=(0,a.scalingMatrix)(1,_/(2*t)),e=(0,a.transformPoint)(v,e),y=(0,a.transformPoint)(v,y);const S=e.y*y.y>=0?new o.Point(u.x,u.y):new o.Point(p.x,p.y);this._points[2]=(0,r.ensureNotNull)(this.screenPointToPoint(S));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 l.DefaultProperty({defaultName:"linetoolarc",state:e});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,90490))).GeneralFiguresDefinitionsViewModelBase}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new h.LineToolColorsProperty([e.childs().color]))}}},27621:(e,t,i)=>{"use strict";i.d(t,{LineToolArrowMark:()=>a,LineToolArrowMarkDown:()=>d,LineToolArrowMarkLeft:()=>l,LineToolArrowMarkRight:()=>h,LineToolArrowMarkUp:()=>c});var s=i(55917),r=i(29875),n=i(12988),o=i(73305);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,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,54176)).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({defaultName:t,state:e});return this._configureProperties(i),i}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,67675)).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.Property("")),e.addExcludedKey("text",1)}}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")}}},66403:(e,t,i)=>{"use strict";i.d(t,{LineToolArrowMarker:()=>o});var s=i(29875),r=i(55917),n=i(12988);class o extends s.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:o.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,34823)).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({defaultName:"linetoolarrowmarker",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,86658)).then((e=>e.ArrowMarkerDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new n.Property("")),e.addExcludedKey("text",1)}}},96068:(e,t,i)=>{"use strict";i.d(t,{LineToolArrow:()=>r});var s=i(99294);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}}},11924:(e,t,i)=>{"use strict";i.d(t,{LineToolBalloon:()=>h});var s=i(50151),r=i(11542),n=i(55917),o=i(10568),a=i(12988),l=i(73305);const c=r.t(null,void 0,i(9818));class h extends o.InplaceTextLineDataSource{constructor(e,t,i,s){super(e,t||h.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()}editableTextProperties(){(0,s.assert)(!1,"unexpected method call")}static createProperties(e){const t=new n.DefaultProperty({defaultName:"linetoolballoon",state:e});return this._configureProperties(t),t}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,18046)).then((e=>e.BalloonDefinitionsViewModel))}_createPaneView(){Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,82462)).then((e=>{this._setPaneViews([new e.BalloonPaneView(this,this._model)])}))}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new a.Property(this._defaultText)),e.addExcludedKey("text",1),e.addChild("linesColors",new l.LineToolColorsProperty([e.childs().borderColor])),e.addChild("textsColors",new l.LineToolColorsProperty([e.childs().color]))}}h._defaultText=c},67467:(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={}))},81756:(e,t,i)=>{"use strict";i.d(t,{LineToolBarsPattern:()=>b});var s,r=i(50151),n=i(11542),o=i(45126),a=i(37265),l=i(97702),c=i(55917),h=i(8025),d=i(29875),u=i(67467),p=i(44672),_=i(85719);!function(e){e[e.InitialVersion=1]="InitialVersion",e[e.CorrectedPrice=2]="CorrectedPrice",e[e.TheLatest=2]="TheLatest"}(s||(s={}));const m=new o.TranslatedString("mirror bars pattern",n.t(null,void 0,i(20965))),g=new o.TranslatedString("flip bars pattern",n.t(null,void 0,i(82349))),f=n.t(null,void 0,i(28941)),v=n.t(null,void 0,i(63271)),y={0:2,1:4,2:1,3:1,4:2,5:3,6:-1},S={0:3,1:4,2:4,3:1,4:2,5:3,6:-1};class b extends d.LineDataSource{constructor(e,t=b.createProperties(),s,r){super(e,t,s,r),this._pattern=[],this._scale=1,this._pointsCoordinatePricesDiff=null;const n=t.childs().mode.value();(0,a.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,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,52666)).then((t=>{this._setPaneViews([new t.BarsPatternPaneView(this,e)])}))}pattern(){return this._pattern}isSynchronizable(){return!1}additionalActions(e){return[new l.Action({actionId:"Chart.LineTool.BarsPattern.ToggleMirrored",options:{checked:this.properties().childs().mirrored.value(),checkable:!0,label:f,onExecute:()=>{e.setProperty(this.properties().childs().mirrored,!this.properties().childs().mirrored.value(),m,_.lineToolsDoNotAffectChartInvalidation),this.updateAllViews((0,p.sourceChangeEvent)(this.id())),this._model.updateSource(this)}}}),new l.Action({actionId:"Chart.LineTool.BarsPattern.ToggleFlipped",options:{checked:this.properties().childs().flipped.value(),checkable:!0,label:v,onExecute:()=>{e.setProperty(this.properties().childs().flipped,!this.properties().childs().flipped.value(),g,_.lineToolsDoNotAffectChartInvalidation),this.updateAllViews((0,p.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,a.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()===u.LineToolBarsPatternMode.LineHL2?(i[2]+i[3])/2:t.value()?i[S[e.value()]]:i[y[e.value()]]}lastPatternPrice(){const{mode:e,flipped:t}=this.properties().childs(),i=this._pattern[this._pattern.length-1]
;return e.value()===u.LineToolBarsPatternMode.LineHL2?(i[2]+i[3])/2:t.value()?i[y[e.value()]]:i[S[e.value()]]}addPoint(e,t,i){const s=super.addPoint(e,t,!0);if(s){const e=this._model.mainSeries(),[{index:t},{index:i}]=this.points(),s=(0,r.ensureDefined)(e.nearestIndex(Math.min(t,i),h.PlotRowSearchMode.NearestRight)),n=(0,r.ensureDefined)(e.nearestIndex(Math.max(t,i),h.PlotRowSearchMode.NearestLeft));this._pattern=this._createPattern(s,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-s),this._normalizePoints(),this.createServerPoints()),this._updatePointsCoordinatePricesDiff()}return s}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 c.DefaultProperty({defaultName:"linetoolbarspattern",state:e});return this._configureProperties(t),t}_preparePoint(e,t){var i;const s=this._alignPointToRangeOfActualData(e),n=this._model.mainSeries(),o=(0,r.ensureNotNull)(n.bars().valueAt(s.index));this.properties().childs().mode.value()===u.LineToolBarsPatternMode.Bars?s.price=(0,r.ensure)(o[2]):s.price=(0,r.ensure)(o[4]);const a=(0,r.ensureNotNull)(this.priceScale()),l=(0,r.ensure)(null===(i=this.ownerSource())||void 0===i?void 0:i.firstValue()),c=.05*a.height(),h=a.priceToCoordinate(s.price,l)-c;return s.price=a.coordinateToPrice(h,l),super._preparePoint(s,t)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,1847))).BarsPatternDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.addExcludedKey("mirrored",1),e.addExcludedKey("flipped",1)}_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(),s=[];for(let n=e;n<=t;n++)s.push((0,a.clone)((0,r.ensureNotNull)(i.valueAt(n))));return s}_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;s<e.length;s++)t=Math.min(t,e[s][3]),i=Math.max(i,e[s][2]);if(t<i){const s=(t+i)/2,r=e=>s-(e-s);for(let t=0;t<e.length;t++)e[t][2]=r(e[t][2]),e[t][3]=r(e[t][3]),e[t][1]=r(e[t][1]),e[t][4]=r(e[t][4])}this._switchPointsPrice(),this.updateAllViews((0,p.sourceChangeEvent)(this.id()))}_flip(){const e=this._pattern,t=e.length;for(let i=0;i<t/2;i++){const s=e[i];e[i]=e[t-i-1],e[t-i-1]=s}this._switchPointsPrice(),this.updateAllViews((0,p.sourceChangeEvent)(this.id()))}_patternPriceDiff(){return this.lastPatternPrice()-this.firstPatternPrice()}_pricesToCoordinates(e){var t,i;const s=this.priceScale(),r=null!==(i=null===(t=this.ownerSource())||void 0===t?void 0:t.firstValue())&&void 0!==i?i:null;if(null!==r&&null!==s&&!s.isEmpty())return e.map((e=>s.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())}}},20925:(e,t,i)=>{"use strict";i.d(t,{LineToolBezierCubic:()=>o});var s=i(50151),r=i(55917),n=i(29875);class o extends n.LineDataSource{constructor(e,t,s,r){const n=t||o.createProperties();super(e,n,s,r),this._controlPoints=null,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,12487)).then((t=>{this._setPaneViews([new t.BezierCubicPaneView(this,e)])}))}pointsCount(){return 2}name(){return"Double Curve"}normalizedPointsForCreating(){const e=super.normalizedPointsForCreating();return[e[0],e[e.length-1]]}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({defaultName:"linetoolbeziercubic",state:e});return this._configureProperties(t),t}
_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,86622)).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))]}}},28904:(e,t,i)=>{"use strict";i.d(t,{LineToolBezierQuadro:()=>o});var s=i(50151),r=i(55917),n=i(29875);class o extends n.LineDataSource{constructor(e,t,s,r){const n=t||o.createProperties();super(e,n,s,r),this._controlPoint=null,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,38581)).then((t=>{this._setPaneViews([new t.BezierQuadroPaneView(this,e)])}))}pointsCount(){return 2}name(){return"Curve"}normalizedPointsForCreating(){const e=super.normalizedPointsForCreating();return[e[0],e[e.length-1]]}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({defaultName:"linetoolbezierquadro",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,86622)).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))}}},64195:(e,t,i)=>{"use strict";i.d(t,{LineToolBrushBase:()=>n});var s=i(50151),r=i(29875);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}}},28462:(e,t,i)=>{"use strict";i.d(t,{LineToolBrush:()=>o});var s=i(55917),r=i(64195),n=i(73305);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({defaultName:"linetoolbrush",state:e});return this._configureProperties(t),t}_loadPaneViews(e){Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,68716)).then((t=>{this._setPaneViews([new t.BrushPaneView(this,e)])}))}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,32364)).then((e=>e.BrushDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.addChild("backgroundsColors",new n.LineToolColorsProperty([e.childs().backgroundColor],e.childs().fillBackground))}}},62828:(e,t,i)=>{"use strict";i.d(t,{LineToolCallout:()=>l});var s,r=i(12988),n=i(55917),o=i(73305),a=i(10568);!function(e){e[e.PointsCount=2]="PointsCount",e.Name="Callout"}(s||(s={}));class l extends a.InplaceTextLineDataSource{constructor(e,t,s,r){super(e,t||l.createProperties(),s,r),this._barOffset=0,this._dragStartLeftEdgeIndex=NaN,this._timeScale=e.timeScale(),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,31463)).then((e=>{this._paneView=new e.CalloutPaneView(this,this._model,this._openTextEditor.bind(this),this._closeTextEditor.bind(this),this.onSelectionChange.bind(this)),this._setPaneViews([this._paneView])}))}pointsCount(){return 2}name(){return"Callout"}getBarOffset(){return this._barOffset}editableTextProperties(){const e=this.properties().childs();return{text:e.text,textColor:e.color,wordWrap:e.wordWrap}}removeIfEditableTextIsEmpty(){return!0}activateEditingOnCreation(){return!0}shouldBeRemovedOnDeselect(){const e=this._properties.childs().text.value().trim();return this._points.length===this.pointsCount()&&""===e}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({defaultName:"linetoolcallout",state:e});return this._configureProperties(t),t}_applyTemplateImpl(e){this.properties().childs().text.setValue(e.text),super._applyTemplateImpl(e)}_correctPoints(e,t){if(e.length<this.pointsCount()||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&&(1===this._points.length&&this._points.push(this._points[0]),this._dragStartLeftEdgeIndex=this.points()[1].index)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,29908))).CalloutDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new r.Property("")),e.addExcludedKey("text",1),e.addChild("textsColors",new o.LineToolColorsProperty([e.childs().color]))}_calculateBarOffset(){this.points().length>1&&(this._barOffset=this.points()[1].index-this.points()[0].index)}}},17333:(e,t,i)=>{"use strict";i.d(t,{LineToolCircle:()=>a});var s=i(12988),r=i(55917),n=i(73305),o=i(10568);class a extends o.InplaceTextLineDataSource{constructor(e,t,s,r){const n=t||a.createProperties();super(e,n,s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,38401)).then((({CirclePaneView:t})=>{const i=[new t(this,e,this._openTextEditor.bind(this),this._closeTextEditor.bind(this),this.onSelectionChange.bind(this))];this._setPaneViews(i)}))}pointsCount(){return 2}name(){return"Circle"}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}editableTextProperties(){const e=this.properties().childs();return{text:e.text,textColor:e.textColor,textVisible:e.showLabel}}static createProperties(e){const t=new r.DefaultProperty({defaultName:"linetoolcircle",state:e});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,99458))).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.Property("")),e.addChild("linesColors",new n.LineToolColorsProperty([e.childs().color])),e.addChild("linesWidths",new n.LineToolWidthsProperty([e.childs().linewidth])),e.addChild("backgroundsColors",new n.LineToolColorsProperty([e.childs().backgroundColor])),e.addChild("textsColors",new n.LineToolColorsProperty([e.childs().textColor],e.childs().showLabel)),e.addExcludedKey("linesColors",3),e.addExcludedKey("linesWidths",3),e.addExcludedKey("backgroundsColors",3),e.addExcludedKey("textsColors",3),e.addExcludedKey("text",1)}}},74451:(e,t,i)=>{"use strict";i.d(t,{LineToolComment:()=>n});var s=i(55917),r=i(11924);class n extends r.LineToolBalloon{constructor(e,t,i,s){super(e,t||n.createProperties(),i,s)}name(){return"Comment"}activateEditingOnCreation(){return!0}editableTextProperties(){return{text:this.properties().childs().text,textColor:this.properties().childs().color}}static createProperties(e){const t=new s.DefaultProperty({defaultName:"linetoolcomment",state:e});return n._configureProperties(t),t}_createPaneView(){Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,39157)).then((e=>{this._setPaneViews([new e.CommentPaneView(this,this._model,this._openTextEditor.bind(this),this._closeTextEditor.bind(this),this.onSelectionChange.bind(this))])}))}}n._defaultText=""},92007:(e,t,i)=>{"use strict";i.d(t,{LineToolCrossLine:()=>a});var s=i(55917),r=i(36590),n=i(52690),o=i(29875);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),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,17551)).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({defaultName:"linetoolcrossline",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,9805)).then((e=>e.CrossLineDefinitionsViewModel))}}},82407:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LineToolCyclicLines:()=>S});var s=i(29875),r=i(50151),n=i(51056),o=i(31229),a=i(6590),l=i(26843),c=i(55917),h=i(11402),d=i(38039),u=i(73305);const p={intervalsVisibilities:{...o.intervalsVisibilitiesDefaults},linewidth:2,linestyle:n.LINESTYLE_SOLID},_={
linecolor:"#80ccdb"},m=new Map([[l.StdTheme.Light,_],[l.StdTheme.Dark,_]]),g=(0,c.extractAllPropertiesKeys)((0,r.ensureDefined)(m.get(l.StdTheme.Light))),f=(0,c.extractAllPropertiesKeys)(p),v=[...g,...f,...a.commonLineToolPropertiesStateKeys];class y extends d.LineDataSourceProperty{constructor(e){super(e),this.addChild("linesColors",new u.LineToolColorsProperty([(0,r.ensureDefined)(this.child("linecolor"))])),this.addChild("linesWidths",new u.LineToolWidthsProperty([(0,r.ensureDefined)(this.child("linewidth"))]))}static create(e){return new this({defaultName:"linetoolcirclelines",factoryDefaultsSupplier:()=>(0,h.factoryDefaultsForCurrentTheme)(p,m),nonThemedDefaultsKeys:f,themedDefaultsKeys:g,allStateKeys:v,state:e})}}class S extends s.LineDataSource{constructor(e,t,s,r){super(e,t||S.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,6074)).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=y.create(e);return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,19298))).CyclicAndSineLinesPatternDefinitionsViewModel}static _addCollectedProperties(e){}}},16628:(e,t,i)=>{"use strict";i.d(t,{LineToolCypherPattern:()=>n});var s=i(17658),r=i(55917);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({defaultName:"linetoolcypherpattern",state:e});return this._configureProperties(t),t}_loadPaneViews(e){Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,8198)).then((t=>{this._setPaneViews([new t.CypherPaneView(this,e)])}))}}},76607:(e,t,i)=>{"use strict";i.d(t,{DateAndPriceBaseProperties:()=>p,allPropertiesStateKeysBase:()=>u,nonThemedFactoryDefaultsBase:()=>h,themedFactoryDefaultsBase:()=>d});var s=i(19625),r=i(24633),n=i(19063),o=i(31229),a=i(12988),l=i(38039);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.LineDataSourceProperty{constructor({nonThemedDefaultsKeys:e,themedDefaultsKeys:t,...i}){var s,r,n;super({nonThemedDefaultsKeys:e,themedDefaultsKeys:t,
templateKeys:[...null!=e?e:[],...null!=t?t:[],...u],...i});const o=null===(s=i.state)||void 0===s?void 0:s.customText;this._textProperty=new a.Property(null!==(r=null==o?void 0:o.text)&&void 0!==r?r:""),null===(n=this.childs().customText)||void 0===n||n.addChild("text",this._textProperty)}template(){const e=super.template();return e.customText.text=this._textProperty.value(),e}}},70791:(e,t,i)=>{"use strict";i.d(t,{LineToolDateAndPriceRange:()=>y});var s=i(50151),r=i(29875),n=i(61105),o=i(24633),a=i(19625),l=i(55917),c=i(11402),h=i(6590),d=i(76607);const u=(0,a.getHexColorByName)("color-tv-blue-500"),p={...d.nonThemedFactoryDefaultsBase,drawBorder:!1,borderWidth:1},_=new Map([[o.StdTheme.Light,{...d.themedFactoryDefaultsBase.get(o.StdTheme.Light),borderColor:u}],[o.StdTheme.Dark,{...d.themedFactoryDefaultsBase.get(o.StdTheme.Dark),borderColor:u}]]),m=(0,l.extractAllPropertiesKeys)((0,s.ensureDefined)(_.get(o.StdTheme.Light))),g=(0,l.extractAllPropertiesKeys)(p),f=[...m,...g,...h.commonLineToolPropertiesStateKeys,...d.allPropertiesStateKeysBase];class v extends d.DateAndPriceBaseProperties{static create(e){return new this({defaultName:"linetooldateandpricerange",factoryDefaultsSupplier:()=>(0,c.factoryDefaultsForCurrentTheme)(p,_),nonThemedDefaultsKeys:g,themedDefaultsKeys:m,allStateKeys:f,state:e})}}class y extends r.LineDataSource{constructor(e,t,s,r){super(e,t||y.createProperties(),s,r),this._volumeCalculator=null,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,93955)).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=v.create(e);return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,14336))).GeneralDatePriceRangeDefinitionsViewModel}}},42214:(e,t,i)=>{"use strict";i.d(t,{LineToolDateRange:()=>f});var s=i(50151),r=i(29875),n=i(61105),o=i(24633),a=i(55917),l=i(11402),c=i(76607),h=i(6590);const d={...c.nonThemedFactoryDefaultsBase,extendTop:!1,extendBottom:!1},u=c.themedFactoryDefaultsBase,p=(0,a.extractAllPropertiesKeys)((0,s.ensureDefined)(u.get(o.StdTheme.Light))),_=(0,a.extractAllPropertiesKeys)(d),m=[...p,..._,...h.commonLineToolPropertiesStateKeys,...c.allPropertiesStateKeysBase];class g extends c.DateAndPriceBaseProperties{static create(e){return new this({defaultName:"linetooldaterange",factoryDefaultsSupplier:()=>(0,l.factoryDefaultsForCurrentTheme)(d,u),nonThemedDefaultsKeys:_,themedDefaultsKeys:p,
allStateKeys:m,state:e})}}class f extends r.LineDataSource{constructor(e,t,s,r){super(e,t||f.createProperties(),s,r),this._volumeCalculator=null,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,33406)).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=g.create(e);return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,14336))).GeneralDatePriceRangeDefinitionsViewModel}}},57897:(e,t,i)=>{"use strict";i.d(t,{LineToolDisjointChannel:()=>a});var s=i(29875),r=i(55917),n=i(37265),o=i(12988);class a extends s.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:a.createProperties(),s,r),this.version=1,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,41376)).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({defaultName:"linetooldisjointangle",state: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(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,41585))).GeneralTrendFiguresDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.hasChild("labelText")||e.addChild("labelText",new o.Property("")),e.addExcludedKey("labelText",1)}}},65365:(e,t,i)=>{"use strict";i.d(t,{LineToolElliott:()=>m,LineToolElliottCorrection:()=>x,LineToolElliottDoubleCombo:()=>I,LineToolElliottImpulse:()=>v,LineToolElliottTriangle:()=>S,LineToolElliottTripleCombo:()=>w});var s,r,n=i(11542),o=i(45126),a=i(29875),l=i(97702),c=i(55917),h=i(73305),d=i(85719);!function(e){e[e.Supermillennium=0]="Supermillennium",e[e.Millennium=1]="Millennium",e[e.Submillennium=2]="Submillennium",e[e.GrandSupercycle=3]="GrandSupercycle",e[e.Supercycle=4]="Supercycle",e[e.Cycle=5]="Cycle",e[e.Primary=6]="Primary",e[e.Intermediate=7]="Intermediate",e[e.Minor=8]="Minor",e[e.Minute=9]="Minute",e[e.Minuette=10]="Minuette",e[e.Subminuette=11]="Subminuette",e[e.Micro=12]="Micro",e[e.Submicro=13]="Submicro",e[e.Minuscule=14]="Minuscule"}(s||(s={})),function(e){e[e.Current=4]="Current"}(r||(r={}));const u=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14],p=new o.TranslatedString("change Elliott degree",n.t(null,void 0,i(47977))),_=[{value:0,title:n.t(null,void 0,i(3348))},{value:1,title:n.t(null,void 0,i(87957))},{value:2,title:n.t(null,void 0,i(63375))},{value:3,title:n.t(null,void 0,i(57726))},{value:4,title:n.t(null,void 0,i(67948))},{value:5,title:n.t(null,void 0,i(87380))},{value:6,title:n.t(null,void 0,i(59189))},{value:7,title:n.t(null,void 0,i(10268))},{value:8,title:n.t(null,{context:"wave"},i(51077))},{value:9,title:n.t(null,{context:"wave"},i(922))},{value:10,title:n.t(null,void 0,i(14724))},{value:11,title:n.t(null,void 0,i(30585))},{value:12,title:n.t(null,void 0,i(24866))},{value:13,title:n.t(null,void 0,i(1145))},{value:14,title:n.t(null,void 0,i(78273))}];class m extends a.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:m.createProperties(),s,r),this.version=4,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,98424)).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 l.Action({actionId:"Chart.LineTool.Elliot.ChangeDegreeProperty",options:{label:n.t(null,void 0,i(23403)),subItems:u.map((t=>{const i=_.filter((e=>e.value===t))[0];return new l.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,p,d.lineToolsDoNotAffectChartInvalidation)}}})}))}})]}label(e){const t=u.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 _}static createProperties(e){const t=new c.DefaultProperty({defaultName:"linetoolelliott",state: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(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,70491))).ElliottPatternDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new h.LineToolColorsProperty([e.childs().color])),e.addExcludedKey("linesColors",3)}}class g extends m{pointsCount(){return 6}}const f=[["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 v extends g{constructor(e,t,i,s){super(e,t||v.createProperties(),i,s)}name(){return"Elliott Impulse Wave (12345)"}labelsGroup(){return f}static createProperties(e){const t=new c.DefaultProperty({defaultName:"linetoolelliottimpulse",state:e});return this._configureProperties(t),t}}const y=[["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 S extends g{constructor(e,t,i,s){super(e,t||S.createProperties(),i,s)}name(){return"Elliott Triangle Wave (ABCDE)"}labelsGroup(){return y}static createProperties(e){const t=new c.DefaultProperty({defaultName:"linetoolelliotttriangle",state:e});return this._configureProperties(t),t}}const b=[["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 w extends g{constructor(e,t,i,s){
super(e,null!=t?t:w.createProperties(),i,s)}name(){return"Elliott Triple Combo Wave (WXYXZ)"}labelsGroup(){return b}static createProperties(e){const t=new c.DefaultProperty({defaultName:"linetoolelliotttriplecombo",state:e});return this._configureProperties(t),t}}class C extends m{pointsCount(){return 4}}const P=[["0","A","B","C"],["0","a","b","c"],["0","A","B","C"],["0","a","b","c"],["0","A","B","C"]];class x extends C{constructor(e,t,i,s){super(e,null!=t?t:x.createProperties(),i,s)}name(){return"Elliott Correction Wave (ABC)"}labelsGroup(){return P}static createProperties(e){const t=new c.DefaultProperty({defaultName:"linetoolelliottcorrection",state:e});return this._configureProperties(t),t}}const T=[["0","W","X","Y"],["0","w","x","y"],["0","W","X","Y"],["0","w","x","y"],["0","W","X","Y"]];class I extends C{constructor(e,t,i,s){super(e,null!=t?t:I.createProperties(),i,s)}name(){return"Elliott Double Combo Wave (WXY)"}labelsGroup(){return T}static createProperties(e){const t=new c.DefaultProperty({defaultName:"linetoolelliottdoublecombo",state:e});return this._configureProperties(t),t}}},59002:(e,t,i)=>{"use strict";i.d(t,{LineToolEllipse:()=>h});var s=i(50151),r=i(4652),n=i(86441),o=i(12988),a=i(55917),l=i(73305),c=i(10568);class h extends c.InplaceTextLineDataSource{constructor(e,t,s,r){super(e,t||h.createProperties(),s,r),this.version=2,this._dist=null,this._fakePointAdded=!1,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,75649)).then((({EllipsePaneView:e})=>{this._setPaneViews([new e(this,this._model,this._openTextEditor.bind(this),this._closeTextEditor.bind(this),this.onSelectionChange.bind(this))])}))}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}editableTextProperties(){const e=this.properties().childs();return{text:e.text,textColor:e.textColor,textVisible:e.showLabel}}static createProperties(e){const t=new a.DefaultProperty({defaultName:"linetoolellipse",state:e});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,99458))).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.Property("")),e.addChild("linesColors",new l.LineToolColorsProperty([e.childs().color])),e.addChild("textsColors",new l.LineToolColorsProperty([e.childs().textColor],e.childs().showLabel)),e.addExcludedKey("text",1)}_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}}},72939:(e,t,i)=>{"use strict";i.d(t,{LineToolEmoji:()=>C});var s=i(19365),r=i(31955),n=i(67580),o=i(928),a=i(12027),l=i(22329),c=i(27788),h=i(14314),d=i(38039),u=i(31229),p=i(55917),_=i(6590);const m={intervalsVisibilities:{...u.intervalsVisibilitiesDefaults},size:40},g={emoji:"😀",angle:.5*Math.PI},f=(0,p.extractAllPropertiesKeys)(m),v=(0,p.extractAllPropertiesKeys)(g),y=[...f,...v,..._.commonLineToolPropertiesStateKeys];class S extends d.LineDataSourceProperty{constructor(e){super(e)}static create(e,t){return new this({defaultName:"linetoolemoji",factoryDefaultsSupplier:()=>(0,c.default)(m),nonThemedDefaultsKeys:f,themedDefaultsKeys:[],state:(0,h.default)({},g,{emoji:t},null!=e?e:{}),allStateKeys:y})}}const b=(0,r.getLogger)("Chart.LineToolEmoji");var w;!function(e){e[e.Version=1]="Version"}(w||(w={}));class C extends l.LineToolSvgIconBase{constructor(e,t,i,s){super(e,t||C.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 C._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,18009))).LineDataSourceDefinitionsViewModel}async _loadViews(){const e=this._properties.childs().emoji.value(),t=(0,s.getTwemojiUrl)(e,"svg");try{const[s,{EmojiPaneView:r}]=await Promise.all([(0,n.fetch)(t).then((e=>e.text())),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,98633))]);if(!this._isDestroyed){this._svgContent=s,this._onIconChanged.fire();const t=(0,a.svgRenderer)(s);null===t&&b.logWarn(`Couldn't create svg renderer for emoji ${e}`),this._setPaneViews([new r(this,this._model,t)])}}catch(t){b.logWarn(`An error ocurred while loading emoji content ${e}: ${t}`)}}}},56991:(e,t,i)=>{"use strict";i.d(t,{ExecutionsPositionController:()=>u,LineToolExecution:()=>_});var s=i(50151),r=i(29875),n=i(91920),o=i(55917),a=i(8025),l=i(56570),c=i(2718),h=i(44672);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<c.firstBar())return{x:-1,y:-1};const h=u._cachedByBarIndexOrderedExecutions[i]||this._pane.sourcesByGroup().all();for(let t=h.length-1;t>=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),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,256)).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({defaultName:"linetoolexecution",state:e,useUserPreferences:!1});return _._configureProperties(t),t}_isVisible(){return this._model.properties().childs().tradingProperties.childs().showExecutions.value()}}},6921:(e,t,i)=>{"use strict";i.d(t,{LineToolExtended:()=>r});var s=i(99294);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}}},96851:(e,t,i)=>{"use strict";i.d(t,{LineToolFibWithInplaceTextBase:()=>c,getLevelProps:()=>a});var s=i(50151),r=i(12988),n=i(10568);const o=new r.Property(!1);function a(e,t){return(0,s.ensureDefined)(e.child(`level${t}`))}
class l extends n.InplaceTextUndoCommand{constructor(e,t,i,s,r){super(e,t,i,s),this._levelIndex=r}_textProperty(e){return a(e.properties(),this._levelIndex).childs().text}}class c extends n.InplaceTextLineDataSource{constructor(){super(...arguments),this._inplaceEditLevelIndex=1}editableTextStyle(){return{...super.editableTextStyle(),forbidLineBreaks:!0,maxLength:50}}editableTextProperties(){const e=this.properties().childs();return{text:e.editableText,textColor:e.editableTextColor,wordWrap:o}}setInplaceEditLevelIndex(e){var t;null===(t=this._destroyEditableTextSubscriptions)||void 0===t||t.call(this);const i=this.properties(),r=i.childs().editableText,n=i.childs().editableTextColor,o=a(i,e),l=(0,s.ensureDefined)(o).childs().text,c=(0,s.ensureDefined)(o).childs().color,h={};r.setValue(l.value()),n.setValue(c.value()),r.subscribe(h,(()=>l.setValue(r.value()))),l.subscribe(h,(()=>r.setValue(l.value()))),n.subscribe(h,(()=>c.setValue(n.value()))),c.subscribe(h,(()=>n.setValue(c.value()))),this._destroyEditableTextSubscriptions=()=>{r.unsubscribeAll(h),l.unsubscribeAll(h),n.unsubscribeAll(h),c.unsubscribeAll(h)},this._inplaceEditLevelIndex=e,this._editableText.setValue(r.value())}_changeEditableTextUndoCommand(e,t){return new l(this._model,this,e,t,this._inplaceEditLevelIndex)}static _configureProperties(e){super._configureProperties(e),e.addChild("editableText",new r.Property("")),e.addChild("editableTextColor",new r.Property("")),e.addExcludedKey("editableText",3),e.addExcludedKey("editableTextColor",3)}}},42851:(e,t,i)=>{"use strict";i.d(t,{LineToolFibChannel:()=>p});var s,r,n=i(50151),o=i(11542),a=i(45126),l=i(85719),c=i(15399),h=i(73305),d=i(10568);!function(e){e[e.FibChannelWithReverse=1]="FibChannelWithReverse",e[e.FibChannelWithoutReverse=2]="FibChannelWithoutReverse",e[e.TheLatest=2]="TheLatest"}(s||(s={})),function(e){e[e.LevelsCount=24]="LevelsCount"}(r||(r={}));const u=new a.TranslatedString("erase level line",o.t(null,void 0,i(35111)));class p extends d.InplaceTextLineDataSource{constructor(e,t,s,r){super(e,t||p.createProperties(),s,r),this.version=2,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,93143)).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,u,l.lineToolsDoNotAffectChartInvalidation)}editableTextProperties(){(0,n.assert)(!1,"unexpected method call")}static createProperties(e){const t=new c.LevelsProperty({defaultName:"linetoolfibchannel",state:e,map:{range:[1,24],names:["coeff","color","visible"]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,75450))).FibDrawingsWith24LevelsDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);const t=[];for(let i=1;i<=24;i++){const s=(0,
n.ensureDefined)(e.child("level"+i));t.push((0,n.ensureDefined)(s.child("color")))}e.addChild("linesColors",new h.LineToolColorsProperty(t))}}},57994:(e,t,i)=>{"use strict";i.d(t,{LineToolFibCircles:()=>u});var s=i(50151),r=i(11542),n=i(45126),o=i(15399),a=i(73305),l=i(85719),c=i(10568);const h=new n.TranslatedString("erase level line",r.t(null,void 0,i(35111)));var d;!function(e){e[e.LevelsCount=11]="LevelsCount"}(d||(d={}));class u extends c.InplaceTextLineDataSource{constructor(e,t,s,r){super(e,t||u.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,83201)).then((e=>{this._setPaneViews([new e.FibCirclesPaneView(this,this._model)])}))}levelsCount(){return 11}pointsCount(){return 2}name(){return"Fib Circles"}processErase(e,t){const i=(0,s.ensureDefined)(this.properties().child(`level${t}`));e.setProperty(i,!1,h,l.lineToolsDoNotAffectChartInvalidation)}editableTextProperties(){(0,s.assert)(!1,"unexpected method call")}static createProperties(e){const t=new o.LevelsProperty({defaultName:"linetoolfibcircles",state:e,map:{range:[1,11]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,41618))).FibCirclesDefinitionsViewModel}_snapTo45DegreesAvailable(){return!0}static _configureProperties(e){var t,i;super._configureProperties(e);const r=e.childs(),n=[r.trendline.childs().linewidth],o=[r.trendline.childs().color];for(let r=1;r<=11;r++)n.push((0,s.ensureDefined)(null===(t=e.child("level"+r))||void 0===t?void 0:t.child("linewidth"))),o.push((0,s.ensureDefined)(null===(i=e.child("level"+r))||void 0===i?void 0:i.child("color")));e.addChild("linesColors",new a.LineToolColorsProperty(o)),e.addChild("linesWidths",new a.LineToolWidthsProperty(n))}}},33168:(e,t,i)=>{"use strict";i.d(t,{LineToolFibRetracement:()=>u});var s,r,n=i(11542),o=i(45126),a=i(15399),l=i(85719),c=i(73305),h=i(96851);!function(e){e[e.FibRetracement=1]="FibRetracement",e[e.FibRetracementV2=2]="FibRetracementV2",e[e.Latest=2]="Latest"}(s||(s={})),function(e){e[e.LevelsCount=24]="LevelsCount",e[e.PointsCount=2]="PointsCount",e.Name="Fib Retracement"}(r||(r={}));const d=new o.TranslatedString("erase level line",n.t(null,void 0,i(35111)));class u extends h.LineToolFibWithInplaceTextBase{constructor(e,t,s,r){super(e,t||u.createProperties(),s,r),this.version=2,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,65343)).then((e=>{this._paneView=new e.FibRetracementPaneView(this,this._model,this._openTextEditor.bind(this),this._closeTextEditor.bind(this),this.onSelectionChange.bind(this)),this._setPaneViews([this._paneView])}))}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,d,l.lineToolsDoNotAffectChartInvalidation)}fibLevelsBasedOnLogScale(){var e
;return this.properties().childs().fibLevelsBasedOnLogScale.value()&&!!(null===(e=this.priceScale())||void 0===e?void 0:e.isLog())}template(){const e=super.template();for(let t=1;t<=24;t++){const i=(0,h.getLevelProps)(this._properties,t);e[`level${t}`][3]=i.childs().text.value()}return e}static createProperties(e){const t=new a.LevelsProperty({defaultName:"linetoolfibretracement",state:e,map:{range:[1,24],names:["coeff","color","visible","text"]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,75450))).FibDrawingsWith24LevelsDefinitionsViewModel}_applyTemplateImpl(e){var t;for(let i=1;i<=24;i++){const s=(0,h.getLevelProps)(this._properties,i),r=e[`level${i}`];s.childs().text.setValue(null!==(t=r[3])&&void 0!==t?t:"")}super._applyTemplateImpl(e)}static _configureProperties(e){super._configureProperties(e);const t=[e.childs().trendline.childs().linewidth,e.childs().levelsStyle.childs().linewidth],i=[e.childs().trendline.childs().color];for(let t=1;t<=24;t++){const s=(0,h.getLevelProps)(e,t);i.push(s.childs().color),e.addExcludedKey(`level${t}.text`,1)}e.addChild("linesColors",new c.LineToolColorsProperty(i)),e.addChild("linesWidths",new c.LineToolWidthsProperty(t))}}},88588:(e,t,i)=>{"use strict";i.d(t,{LineToolFibSpeedResistanceArcs:()=>u});var s=i(50151),r=i(11542),n=i(45126),o=i(15399),a=i(73305),l=i(85719),c=i(10568);const h=new n.TranslatedString("erase level line",r.t(null,void 0,i(35111)));var d;!function(e){e[e.LevelsCount=11]="LevelsCount"}(d||(d={}));class u extends c.InplaceTextLineDataSource{constructor(e,t,s,r){super(e,null!=t?t:u.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,66152)).then((e=>{this._setPaneViews([new e.FibSpeedResistanceArcsPaneView(this,this._model)])}))}levelsCount(){return 11}pointsCount(){return 2}name(){return"Fib Speed Resistance Arcs"}processErase(e,t){const i=(0,s.ensureDefined)(this.properties().child(`level${t}`)).childs().visible;e.setProperty(i,!1,h,l.lineToolsDoNotAffectChartInvalidation)}editableTextProperties(){(0,s.assert)(!1,"unexpected method call")}static createProperties(e){const t=new o.LevelsProperty({defaultName:"linetoolfibspeedresistancearcs",state:e,map:{range:[1,11]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,20875))).FibSpeedResistanceArcsDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);const t=e.childs().trendline.childs(),i=[t.linewidth],r=[t.color];for(let t=1;t<=11;t++){const n=(0,s.ensureDefined)(e.child(`level${t}`)).childs();i.push(n.linewidth),r.push(n.color)}e.addChild("linesColors",new a.LineToolColorsProperty(r)),e.addChild("linesWidths",new a.LineToolWidthsProperty(i))}}},20701:(e,t,i)=>{"use strict";i.d(t,{LineToolFibSpeedResistanceFan:()=>u});var s=i(50151),r=i(11542),n=i(45126),o=i(29875),a=i(15399),l=i(73305),c=i(85719)
;const h=new n.TranslatedString("erase level line",r.t(null,void 0,i(35111)));var d;!function(e){e[e.HLevelsCount=7]="HLevelsCount",e[e.VLevelsCount=7]="VLevelsCount"}(d||(d={}));class u extends o.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:u.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,66832)).then((e=>{this._setPaneViews([new e.FibSpeedResistanceFanPaneView(this,this._model)])}))}hLevelsCount(){return 7}vLevelsCount(){return 7}pointsCount(){return 2}name(){return"Fib Speed Resistance Fan"}processErase(e,t){const i=`${t.type}level${t.index}`,r=(0,s.ensureDefined)(this.properties().child(i)).childs().visible;e.setProperty(r,!1,h,c.lineToolsDoNotAffectChartInvalidation)}static createProperties(e){e&&void 0===e.reverse&&(e.reverse=!0);const t=new a.LevelsProperty({defaultName:"linetoolfibspeedresistancefan",state:e,map:{range:[1,7],prefixes:["h","v"],names:["coeff","color","visible"]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,72605))).FibSpeedResistanceFanDefinitionsViewModel}_snapTo45DegreesAvailable(){return!0}static _configureProperties(e){var t,i;super._configureProperties(e);const r=[e.childs().grid.childs().color];for(let i=1;i<=7;i++)r.push((0,s.ensureDefined)(null===(t=e.child(`hlevel${i}`))||void 0===t?void 0:t.child("color")));for(let t=1;t<=7;t++)r.push((0,s.ensureDefined)(null===(i=e.child(`vlevel${t}`))||void 0===i?void 0:i.child("color")));e.addChild("linesColors",new l.LineToolColorsProperty(r)),e.addExcludedKey("linesColors",3)}}},84023:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LineToolFibSpiral:()=>b});var s=i(29875),r=i(50151),n=i(51056),o=i(31229),a=i(6590),l=i(19625),c=i(26843),h=i(55917),d=i(11402),u=i(38039),p=i(73305);const _={intervalsVisibilities:{...o.intervalsVisibilitiesDefaults},counterclockwise:!1,linewidth:2,linestyle:n.LINESTYLE_SOLID},m={linecolor:(0,l.getHexColorByName)("color-sky-blue-500")},g=new Map([[c.StdTheme.Light,m],[c.StdTheme.Dark,m]]),f=(0,h.extractAllPropertiesKeys)((0,r.ensureDefined)(g.get(c.StdTheme.Light))),v=(0,h.extractAllPropertiesKeys)(_),y=[...f,...v,...a.commonLineToolPropertiesStateKeys];class S extends u.LineDataSourceProperty{constructor(e){super(e),this.addChild("linesColors",new p.LineToolColorsProperty([(0,r.ensureDefined)(this.child("linecolor"))])),this.addChild("linesWidths",new p.LineToolWidthsProperty([(0,r.ensureDefined)(this.child("linewidth"))]))}static create(e){return new this({defaultName:"linetoolfibspiral",factoryDefaultsSupplier:()=>(0,d.factoryDefaultsForCurrentTheme)(_,g),nonThemedDefaultsKeys:v,themedDefaultsKeys:f,allStateKeys:y,state:e})}}class b extends s.LineDataSource{constructor(e,t,s,r){super(e,t||b.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,39029)).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(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,24277))).FibSpiralDefinitionsViewModel}static _addCollectedProperties(e){}}},8532:(e,t,i)=>{"use strict";i.d(t,{LineToolFibTimeZone:()=>p});var s=i(11542),r=i(45126),n=i(73305),o=i(15399),a=i(85719),l=i(29875);const c=new r.TranslatedString("erase level line",s.t(null,void 0,i(35111)));var h,d,u;!function(e){e[e.InitVersion=1]="InitVersion",e[e.SecondVersion=2]="SecondVersion",e[e.CurrentVersion=2]="CurrentVersion"}(h||(h={})),function(e){e[e.LevelsCount=11]="LevelsCount",e[e.PointsCount=2]="PointsCount"}(d||(d={})),function(e){e.Name="Fib Time Zone"}(u||(u={}));class p extends l.LineDataSource{constructor(e,t,s,r){super(e,t||p.createProperties(),s,r),this.version=2,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,18449)).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,c,a.lineToolsDoNotAffectChartInvalidation)}static createProperties(e){const t=new o.LevelsProperty({defaultName:"linetoolfibtimezone",state:e,map:{range:[1,11]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,23720))).FibTimezoneDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);const t=[],i=[],s=[];for(let r=1;r<=11;r++){const n=e.childs()["level"+r].childs();t.push(n.linewidth),i.push(n.color),s.push(n.linestyle)}e.addChild("linesColors",new n.LineToolColorsProperty(i)),e.addChild("linesWidths",new n.LineToolWidthsProperty(t)),e.addChild("linesStyles",new n.LineToolCollectedProperty(s)),e.hasChild("baselinecolor")&&e.removeProperty("baselinecolor"),e.hasChild("linecolor")&&e.removeProperty("linecolor"),e.hasChild("linewidth")&&e.removeProperty("linewidth"),e.hasChild("linestyle")&&e.removeProperty("linestyle")}}},90882:(e,t,i)=>{"use strict";i.d(t,{LineToolFibWedgeBase:()=>o});var s=i(50151),r=i(86441),n=i(10568);class o extends n.InplaceTextLineDataSource{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)}editableTextProperties(){(0,s.assert)(!1,"unexpected method call")}}},23591:(e,t,i)=>{"use strict";i.d(t,{LineToolFibWedge:()=>u});var s=i(50151),r=i(11542),n=i(45126),o=i(90882),a=i(15399),l=i(73305),c=i(85719);const h=new n.TranslatedString("erase level line",r.t(null,void 0,i(35111)));var d;!function(e){e[e.LevelsCount=11]="LevelsCount"}(d||(d={}));class u extends o.LineToolFibWedgeBase{constructor(e,t,s,r){super(e,null!=t?t:u.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,84417)).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,h,c.lineToolsDoNotAffectChartInvalidation)}static createProperties(e){const t=new a.LevelsProperty({defaultName:"linetoolfibwedge",state:e,map:{range:[1,11]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,49267))).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))}}},41124:(e,t,i)=>{"use strict";i.d(t,{LineToolFlagMark:()=>a});var s=i(86441),r=i(29875),n=i(55917),o=i(73305);class a extends r.LineDataSource{constructor(e,t,r,n){
super(e,t||a.createProperties(),r,n),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,36134)).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({defaultName:"linetoolflagmark",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,11138)).then((e=>e.FlagMarkDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.addChild("backgroundsColors",new o.LineToolColorsProperty([e.childs().flagColor])),e.addExcludedKey("backgroundsColors",3)}}a.version=2},90921:(e,t,i)=>{"use strict";i.d(t,{LineToolFlatBottom:()=>a});var s=i(29875),r=i(55917),n=i(37265),o=i(12988);class a extends s.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:a.createProperties(),s,r),this.version=1,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,73050)).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({defaultName:"linetoolflatbottom",state: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(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,41585))).GeneralTrendFiguresDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.hasChild("labelText")||e.addChild("labelText",new o.Property("")),e.addExcludedKey("labelText",1)}}},12121:(e,t,i)=>{"use strict";i.d(t,{createPropertiesObject:()=>a});var s=i(37265),r=i(15399);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({defaultName:e,state:t,map:{names:["width","color","visible"]},levelsIterator:n})}}function a(e,t){return new o(e,t)}},99083:(e,t,i)=>{"use strict";i.d(t,{LineToolGannComplex:()=>u});var s,r=i(86441),n=i(50151),o=i(73866),a=i(29875),l=i(59769),c=i(12121),h=i(73305),d=i(15938);!function(e){e[e.ScaleRatioStep=1e-7]="ScaleRatioStep",e[e.ScaleRatioPrecision=7]="ScaleRatioPrecision",e.ScaleRatioInitialValue=""}(s||(s={}));class u extends a.LineDataSource{constructor(e,t,s,r){super(e,t||u.createProperties(),s,r),this.version=2,this._scaleRatioFormatter=new o.LimitedPrecisionNumericFormatter(7),this.version=2,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,73017)).then((({GannComplexPaneView:e})=>{this._setPaneViews([new e(this,this.model())])}));const n=this.properties();this._adjustScaleRatio(n),n.subscribe(this,this._adjustScaleRatio),n.childs().scaleRatio.subscribe(this,this._correctFirstPoint),this._syncStateExclusions=["scaleRatio"],n.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),r=this.priceScale();return!(0,n.ensureNotNull)(r).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,n.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;s<i;s++){const i=t.levels.childs()[s].childs();e.push({index:s,visible:i.visible.value(),color:i.color.value(),width:i.width.value()})}return e}fanLinesCount(){return this.properties().childs().fanlines.childCount()}fanLines(){const e=[],t=this.properties().childs(),i=t.fanlines.childCount();for(let s=0;s<i;s++){const i=t.fanlines.childs()[s].childs();e.push({index:s,visible:i.visible.value(),x:i.x.value(),y:i.y.value(),color:i.color.value(),width:i.width.value()})}return e}arcsCount(){return this.properties().childs().arcs.childCount()}arcs(){const e=[],t=this.properties().childs(),i=t.arcs.childCount();for(let s=0;s<i;s++){const i=t.arcs.childs()[s].childs();e.push({index:s,visible:i.visible.value(),x:i.x.value(),y:i.y.value(),color:i.color.value(),width:i.width.value()})}return e}arcsBackgroundTransparency(){return this.properties().childs().arcsBackground.childs().transparency.value()}isArcsBackgroundFilled(){return this.properties().childs().arcsBackground.childs().fillBackground.value()}isLabelsVisible(){return this.properties().childs().showLabels.value()}getLabelsStyle(){const e=this.properties().childs(),{fontSize:t,bold:i,italic:s}=e.labelsStyle.childs(),r=e.levels.childCount();return{textColor:e.levels.childs()[r-1].childs().color.value(),font:d.CHART_FONT_FAMILY,fontSize:t.value(),bold:i.value(),italic:s.value()}}getScaleRatioStep(){return 1e-7}getScaleRatioFormatter(){return this._scaleRatioFormatter}getPriceDiff(){const e=this.points();if(e.length<2)return null;const[t,i]=e;return i.price-t.price}getIndexDiff(){const e=this.points();if(e.length<2)return null;const[t,i]=e;return i.index-t.index}getScaleRatio(){const e=this.getPriceDiff(),t=this.getIndexDiff();return null!==e&&null!==t&&0!==t?Math.abs(e/t):null}static createProperties(e){const t=(0,c.createPropertiesObject)("linetoolganncomplex",e);return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,53894)).then((e=>e.GannComplexAndFixedDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.addExcludedKey("scaleRatio",1);const t=[],i=[],s=e.childs();{const e=s.levels.childCount();for(let r=0;r<e;r++){const e=s.levels.childs()[r].childs();t.push(e.width),i.push(e.color)}}{const e=s.fanlines.childCount();for(let r=0;r<e;r++){const e=s.fanlines.childs()[r].childs();t.push(e.width),i.push(e.color)}}{const e=s.arcs.childCount();for(let r=0;r<e;r++){const e=s.arcs.childs()[r].childs();t.push(e.width),i.push(e.color)}}e.addChild("linesColors",new h.LineToolColorsProperty(i)),e.addChild("linesWidths",new h.LineToolWidthsProperty(t))}_correctScaleRatio(){const e=this.properties().childs(),t=this.getScaleRatio();e.scaleRatio.setValue(t)}_getAdjustedScaleRatio(){const e=this.model().mainSeries().priceScale(),t=this.model().timeScale();return(0,l.scaleRatio)(t,e)}_adjustScaleRatio(e){const t=e.scaleRatio.value()
;""!==t&&null!==t||e.scaleRatio.setValue(this._getAdjustedScaleRatio())}_correctPoint(e){if(this._points.length<2)return;const t=this.getIndexDiff();if(null===t)return;const i=this.properties().childs().scaleRatio.value();if(null!==i){const s=this._points[e],r=0===e?this._points[1]:this._points[0],n=s.price-r.price>0,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().length<this.pointsCount())return;const e=this._getScreenPoints();if(null===e)return;const t=(0,n.ensureNotNull)(this.screenPointToPoint(e[1]));this.setPoint(1,t),this._pointAdded.unsubscribe(this,this._migratePoint)}_getScreenPoints(){const e=this._calcAngle();if(null===e)return null;let[t,i]=this.points();this.isReversed()&&([t,i]=[i,t]);const s=(0,n.ensureNotNull)(this.pointToScreenPoint(t)),o=(0,n.ensureNotNull)(this.pointToScreenPoint(i)),a=Math.sqrt(Math.pow(s.x-o.x,2)+Math.pow(s.y-o.y,2)),l=new r.Point(Math.cos(e),-Math.sin(e)),c=l.normalized(),h=c.x<0?-1:1,d=c.y<0?-1:1;return[s.addScaled(l,a),s.add(new r.Point(5*a*h,5*a*d))]}_calcAngle(){const[e,t]=this.points(),i=(0,n.ensureNotNull)(this.pointToScreenPoint(e));let s=(0,n.ensureNotNull)(this.pointToScreenPoint(t)).subtract(i);if(s.length()>0){s=s.normalized();let e=Math.acos(s.x);return s.y>0&&(e=-e),e}return null}}},85259:(e,t,i)=>{"use strict";var s=i(45126).TranslatedString,r=i(85719).lineToolsDoNotAffectChartInvalidation,n=i(29875).LineDataSource,o=i(15399).LevelsProperty,a=i(73305),l=a.LineToolWidthsProperty,c=a.LineToolColorsProperty,h=new s("erase level line",i.i18next(null,void 0,i(35111)));class d extends n{constructor(e,t,s,r){super(e,t||d.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,79890)).then((({GannFanPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}levelsCount(){return d.LevelsCount}pointsCount(){return 2}name(){return"Gann Fan"}processErase(e,t){var i="level"+t,s=this.properties()[i].visible;e.setProperty(s,!1,h,r)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,72443))).GannFanDefinitionsViewModel}static createProperties(e){var t=new o({defaultName:"linetoolgannfan",state:e,map:{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 c(i)),e.addChild("linesWidths",new l(t))}}d.LevelsCount=9,t.LineToolGannFan=d},8308:(e,t,i)=>{"use strict";i.d(t,{LineToolGannFixed:()=>l});var s=i(86441),r=i(50151),n=i(29875),o=i(73305),a=i(12121);class l extends n.LineDataSource{
constructor(e,t,s,r){super(e,t||l.createProperties(),s,r),this._constructor="LineToolGannFixed",Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,57736)).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;s<i;s++){const i=t.levels.childs()[s].childs();e.push({index:s,visible:i.visible.value(),color:i.color.value(),width:i.width.value()})}return e}fanLinesCount(){return this.properties().childs().fanlines.childCount()}fanLines(){const e=[],t=this.properties().childs(),i=t.fanlines.childCount();for(let s=0;s<i;s++){const i=t.fanlines.childs()[s].childs();e.push({index:s,visible:i.visible.value(),x:i.x.value(),y:i.y.value(),color:i.color.value(),width:i.width.value()})}return e}arcsCount(){return this.properties().childs().arcs.childCount()}arcs(){const e=[],t=this.properties().childs(),i=t.arcs.childCount();for(let s=0;s<i;s++){const i=t.arcs.childs()[s].childs();e.push({index:s,visible:i.visible.value(),x:i.x.value(),y:i.y.value(),color:i.color.value(),width:i.width.value()})}return e}arcsBackgroundTransparency(){return this.properties().childs().arcsBackground.childs().transparency.value()}isArcsBackgroundFilled(){return this.properties().childs().arcsBackground.childs().fillBackground.value()}static createProperties(e){const t=(0,a.createPropertiesObject)("linetoolgannfixed",e);return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,53894)).then((e=>e.GannComplexAndFixedDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e);const t=[],i=[],s=e.childs();{const e=s.levels.childCount();for(let r=0;r<e;r++){const e=s.levels.childs()[r].childs();t.push(e.width),i.push(e.color)}}{const e=s.fanlines.childCount();for(let r=0;r<e;r++){const e=s.fanlines.childs()[r].childs();t.push(e.width),i.push(e.color)}}{const e=s.arcs.childCount();for(let r=0;r<e;r++){const e=s.arcs.childs()[r].childs();t.push(e.width),i.push(e.color)}}e.addChild("linesColors",new o.LineToolColorsProperty(i)),e.addChild("linesWidths",new o.LineToolWidthsProperty(t))}_calcAngle(){const e=this.points();if(e.length<2)return null
;const[t,i]=e,s=this.pointToScreenPoint(t),r=this.pointToScreenPoint(i);if(null===s||null===r)return null;let n=r.subtract(s);if(n.length()<=0)return null;n=n.normalized();let o=Math.acos(n.x);return n.y>0&&(o=-o),o}_reversePoints(){const[e,t]=this._points;this._points[0]=t,this._points[1]=e,this._normalizePoints(),this.restart()}}},9770:(e,t,i)=>{"use strict";var s=i(29875).LineDataSource,r=i(15399).LevelsProperty,n=i(73305).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 e<t?-1:e>t?1:0})),e}();class l extends s{constructor(e,t,s,r){super(e,t||l.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.t.bind(i,10349,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<s*n||r*n<a;)a<s*n?n*=.1:r*n<a&&(n*=10);for(var l=r*n,c=o.length-2;c>=0&&!(o[c]*n<a);--c)l=o[c]*n;return e.price=t.price+(i>=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]<i);--s);return s+=i>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(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,27340))).GannSquareDefinitionsViewModel}static createProperties(e){var t=new r({defaultName:"linetoolgannsquare",state:e,map:{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.addExcludedKey("linesColors",3)}}l.HLevelsCount=7,l.VLevelsCount=7,t.LineToolGannSquare=l},37968:(e,t,i)=>{"use strict";i.d(t,{LineToolGhostFeed:()=>c})
;var s=i(55917),r=i(29875),n=i(50151),o=i(37265);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._bars.length)this._bars.splice(e,this._bars.length-e);else for(;this._bars.length<e;)this._bars.push(this._createBar())}_createBar(){const e=this._source.properties().averageHL.value(),t=this._source.properties().variance.value()/100,i=(0,n.ensureNotNull)(this._source.ownerSource()).base();let s=Math.random();const r=e*(1-2*s)*t;s=Math.random();const o=e*(1+(.5-s)*t),a=r-o/2,l=a+o;return{o:(a+Math.random()*o)/i,h:l/i,l:a/i,c:(a+Math.random()*o)/i}}}var l=i(44672);class c extends r.LineDataSource{constructor(e,t,s,r){const n=t||c.createProperties();if(super(e,n,s,r),this._segments=[],this._finished=!1,this._segmentsPixelsWhileMoving=null,!s){const e=Math.round(this._calculateATR());n.childs().averageHL.setValue(e)}n.childs().averageHL.listeners().subscribe(this,this._regenerate),n.childs().variance.listeners().subscribe(this,this._regenerate),this._currentAverageHL=n.childs().averageHL.value(),this._currentVariance=n.childs().variance.value(),this._currentInterval=e.mainSeries().interval(),this.properties().onRestoreFactoryDefaults().subscribe(this,this._handleRestoringFactoryDefaults),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,14049)).then((t=>{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;e<this._points.length;e++)this._createPointProperty(e);return!0}}const s=super.addPoint(e,t,i);return this._points.length>1&&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<this.points().length-1){
const i=this.points()[e+1].index-t.index;this._segments[e].setSize(Math.abs(i))}}state(e){const t=super.state(e);return t.segments=this._segments.map((e=>({bars:[...e.bars()]}))),t}restoreData(e){e.segments&&(this._segments=e.segments.map(((e,t)=>new a(this,t,e.bars)))),this._currentAverageHL=this.properties().childs().averageHL.value(),this._currentVariance=this.properties().childs().variance.value()}onData(e){super.onData(e);if(!this.pointsProperty().childs().points.child("0"))for(let e=0;e<this._points.length;e++)this._createPointProperty(e);this._currentInterval!==this._model.mainSeries().interval()&&(this._regenerate(),this._currentInterval=this._model.mainSeries().interval())}cloneData(e){this._segments=e._segments.map((e=>e.clone(this)))}startMoving(e,t,i,s){super.startMoving(e,t,i,s),this._preparePixelSegments()}move(e,t,i,s){super.move(e,t,i,s),this._restoreSegmentsFromPixels()}endMoving(e,t){return this._segmentsPixelsWhileMoving=null,super.endMoving(e,t)}static createProperties(e){const t=new s.DefaultProperty({defaultName:"linetoolghostfeed",state:e});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,9786))).GhostFeedDefinitionsViewModel}_handleRestoringFactoryDefaults(){const e=Math.round(this._calculateATR());this.properties().childs().averageHL.setValue(e)}_regenerate(){this._currentAverageHL=this.properties().childs().averageHL.value(),this._currentVariance=this.properties().childs().variance.value(),this._segments.forEach((e=>e.generate())),this.updateAllViews((0,l.sourceChangeEvent)(this.id())),this._model.updateSource(this)}_calculateATR(){const e=this._model.mainSeries(),t=[];e.bars().each(((e,i)=>{const s=i[2],r=i[3];return null!=s&&null!=r&&t.push(s-r),!1}));let i=0===t.length?0:t.reduce(((e,t)=>e+t),0)/t.length;return i*=e.base(),i}_preparePixelSegments(){var e,t;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===i||null===s||i.isEmpty()||!i.isLog())return;const r=this.points();this._segmentsPixelsWhileMoving=this._segments.map(((e,t)=>{const n=r[t].price,o=r[t+1].price,a=i.priceToCoordinate(n,s),l=(i.priceToCoordinate(o,s)-a)/(e.bars().length-1);return{bars:e.bars().map(((e,t)=>{const r=a+t*l,n=i.coordinateToPrice(r,s);return{open:i.priceToCoordinate(n+e.o,s)-r,high:i.priceToCoordinate(n+e.h,s)-r,low:i.priceToCoordinate(n+e.l,s)-r,close:i.priceToCoordinate(n+e.c,s)-r}}))}}))}_restoreSegmentsFromPixels(){var e,t;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===i||null===s||null===this._segmentsPixelsWhileMoving)return;const r=this.points();this._segmentsPixelsWhileMoving.forEach(((e,t)=>{const n=this._segments[t],o=r[t].price,a=r[t+1].price,l=i.priceToCoordinate(o,s),c=(i.priceToCoordinate(a,s)-l)/(e.bars.length-1),h=n.bars().map(((t,r)=>{const n=e.bars[r],o=l+r*c,a=i.coordinateToPrice(o,s);return{...t,
o:i.coordinateToPrice(n.open+o,s)-a,h:i.coordinateToPrice(n.high+o,s)-a,l:i.coordinateToPrice(n.low+o,s)-a,c:i.coordinateToPrice(n.close+o,s)-a}}));n.setBars(h)}))}}},47267:(e,t,i)=>{"use strict";i.d(t,{LineToolHeadAndShoulders:()=>o});var s=i(55917),r=i(29875),n=i(73305);class o extends r.LineDataSource{constructor(e,t,s,r){const n=t||o.createProperties();super(e,n,s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,29634)).then((t=>{this._setPaneViews([new t.LineToolHeadAndShouldersPaneView(this,e)])}))}pointsCount(){return 7}name(){return"Head and Shoulders"}static createProperties(e){const t=new s.DefaultProperty({defaultName:"linetoolheadandshoulders",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,35737)).then((e=>e.PatternWithBackgroundDefinitionViewModel))}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new n.LineToolColorsProperty([e.childs().color])),e.addChild("textsColors",new n.LineToolColorsProperty([e.childs().textcolor]))}}},65539:(e,t,i)=>{"use strict";i.d(t,{LineToolHighlighter:()=>n});var s=i(55917),r=i(64195);class n extends r.LineToolBrushBase{constructor(e,t,i,s){super(e,t||n.createProperties(),i,s),this._loadPaneViews(e)}smooth(){return this.properties().childs().smooth.value()}name(){return"Highlighter"}static createProperties(e){const t=new s.DefaultProperty({defaultName:"linetoolhighlighter",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,14542)).then((e=>e.HighlighterDefinitionsViewModel))}_loadPaneViews(e){Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,64332)).then((t=>{this._setPaneViews([new t.HighlighterPaneView(this,e)])}))}}},36590:(e,t,i)=>{"use strict";i.d(t,{LineToolHorzLinePriceAxisView:()=>n});var s=i(98558),r=i(19063);class n extends s.PriceAxisView{constructor(e){super(),this._source=e}_updateRendererData(e,t,i){e.visible=!1;const s=this._source.points(),n=this._source.priceScale();if(0===s.length||null===n||n.isEmpty())return;const o=s[0];if(!isFinite(o.price))return;const a=this._source.ownerSource(),l=null!==a?a.firstValue():null;if(null===l)return;const c=(0,r.resetTransparency)(this._source.properties().linecolor.value());i.background=c,i.textColor=this.generateTextColor(c),i.coordinate=n.priceToCoordinate(o.price,l),e.text=n.formatPrice(o.price,l),e.visible=!0}}},43636:(e,t,i)=>{"use strict";i.d(t,{LineToolHorzLine:()=>a});var s=i(12988),r=i(55917),n=i(10568),o=i(36590);class a extends n.InplaceTextLineDataSource{constructor(e,t,s,r){super(e,t||a.createProperties(),s,r),this._priceAxisView=new o.LineToolHorzLinePriceAxisView(this),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,38117)).then((({HorzLinePaneView:e})=>{this._setPaneViews([new e(this,this._model,this._openTextEditor.bind(this),this._closeTextEditor.bind(this),this.onSelectionChange.bind(this))])}))}state(e){const t=super.state(e)
;return t.points&&0!==t.points.length&&(t.points[0].offset=0),t}pointsCount(){return 1}name(){return"Horizontal Line"}priceAxisViews(e,t){return this.isSourceHidden()||t!==this.priceScale()||!this._model.selection().isSelected(this)&&!this.properties().childs().showPrice.value()||e!==this._model.paneForSource(this)?null:[this._priceAxisView]}timeAxisViews(){return null}timeAxisPoints(){return[]}updateAllViews(e){super.updateAllViews(e),this._priceAxisView.update(e)}canHasAlert(){return!0}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}denormalizeTimePoints(){this._points=[],this._timePoint.length>0&&this._points.push({price:this._timePoint[0].price,index:0})}clearData(){const e=this._points;super.clearData(),this._points=e}editableTextProperties(){const e=this.properties().childs();return{text:e.text,textColor:e.textcolor,textVisible:e.showLabel}}static createProperties(e){const t=new r.DefaultProperty({defaultName:"linetoolhorzline",state:e});return this._configureProperties(t),t}_getAlertPlots(){return[this.points()[0].price]}_pointsForPointset(){return[]}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,84190)).then((e=>e.HorizontalLineDefinitionsViewModel))}_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.Property("")),e.addExcludedKey("text",1)}}},47845:(e,t,i)=>{"use strict";i.d(t,{LineToolHorzRay:()=>a});var s=i(55917),r=i(12988),n=i(36590),o=i(29875);class a extends o.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:a.createProperties(),s,r),this._priceAxisView=new n.LineToolHorzLinePriceAxisView(this),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,66451)).then((({HorzRayPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}pointsCount(){return 1}name(){return"Horizontal Ray"}priceAxisViews(e,t){return this.isSourceHidden()||t!==this.priceScale()||!this._model.selection().isSelected(this)&&!this.properties().childs().showPrice.value()||e!==this._model.paneForSource(this)?null:[this._priceAxisView]}updateAllViews(e){super.updateAllViews(e),this._priceAxisView.update(e)}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}canHasAlert(){return!0}static createProperties(e){const t=new s.DefaultProperty({defaultName:"linetoolhorzray",state:e});return this._configureProperties(t),t}_getAlertPlots(){const e=this._points[0],t={index:e.index+1,price:e.price},i=this._linePointsToAlertPlot([e,t],null,!1,!0);return null!==i?[i]:[]}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,22707))).HorizontalRayDefinitionsViewModel}_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 r.Property("")),e.addExcludedKey("text",1)}}},15510:(e,t,i)=>{"use strict";i.d(t,{LineToolIcon:()=>P});var s=i(928),r=i(12027),n=i(22329),o=i(31955),a=i(27788),l=i(14314),c=i(19625),h=i(38039),d=i(31229),u=i(55917),p=i(6590),_=i(73305);const m=(0,c.getHexColorByName)("color-tv-blue-500"),g={intervalsVisibilities:{...d.intervalsVisibilitiesDefaults},color:m,size:40},f={icon:61720,angle:.5*Math.PI},v=(0,u.extractAllPropertiesKeys)(g),y=(0,u.extractAllPropertiesKeys)(f),S=[...v,...y,...p.commonLineToolPropertiesStateKeys];class b extends h.LineDataSourceProperty{constructor(e){super(e),this.addChild("backgroundsColors",new _.LineToolColorsProperty([this.childs().color]))}static create(e,t){return new this({defaultName:"linetoolicon",factoryDefaultsSupplier:()=>(0,a.default)(g),nonThemedDefaultsKeys:v,themedDefaultsKeys:[],state:(0,l.default)({},f,{icon:t},null!=e?e:{}),allStateKeys:S})}}const w=(0,o.getLogger)("Chart.LineToolIcon");var C;!function(e){e[e.Version=1]="Version"}(C||(C={}));class P extends n.LineToolSvgIconBase{constructor(e,t,i,s){super(e,t||P.createProperties(),i,s),this.version=1,this._loadViews()}name(){return"Icon"}template(){return this._properties.template()}static createProperties(e){const t=b.create(e,s.iconTool.value());return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,19532)).then((e=>e.IconsDefinitionsViewModel))}async _loadViews(){const[{getSvgContentForCharCode:e,getSvgRenderer:t},{IconPaneView:s}]=await Promise.all([i.e(7987).then(i.bind(i,25482)),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,11735))]);if(!this._isDestroyed){const i=this._properties.childs().icon.value();this._svgContent=e(i),this._onIconChanged.fire();const n=t(r.svgRenderer,i);null===n&&w.logWarn(`Couldn't create svg renderer for icon ${i}`),this._setPaneViews([new s(this,this._model,n)])}}}},6590:(e,t,i)=>{"use strict";i.d(t,{commonLineToolPropertiesStateKeys:()=>s});const s=["symbolStateVersion","zOrderVersion","frozen","title","symbolInfo","interval","symbol","currencyId","unitId","visible","intervalsVisibilities.ticks","intervalsVisibilities.seconds","intervalsVisibilities.secondsFrom","intervalsVisibilities.secondsTo","intervalsVisibilities.minutes","intervalsVisibilities.minutesFrom","intervalsVisibilities.minutesTo","intervalsVisibilities.hours","intervalsVisibilities.hoursFrom","intervalsVisibilities.hoursTo","intervalsVisibilities.days","intervalsVisibilities.daysFrom","intervalsVisibilities.daysTo","intervalsVisibilities.weeks","intervalsVisibilities.weeksFrom","intervalsVisibilities.weeksTo","intervalsVisibilities.months","intervalsVisibilities.monthsFrom","intervalsVisibilities.monthsTo","intervalsVisibilities.ranges"];var r;!function(e){e[e.NotShared=0]="NotShared",e[e.SharedInLayout=1]="SharedInLayout",e[e.GloballyShared=2]="GloballyShared"}(r||(r={}))},51065:(e,t,i)=>{"use strict";i.d(t,{LineToolInfoLine:()=>n});var s,r=i(99294);!function(e){
e.ConstructorName="LineToolInfoLine",e.Name="Info Line"}(s||(s={}));class n extends r.LineToolTrendLine{constructor(e,t,i,s){super(e,t||n.createProperties(),i,s)}pointsCount(){return 2}name(){return"Info Line"}static createProperties(e){const t=r.LineToolTrendLine._createPropertiesImpl("linetoolinfoline",e);return n._configureProperties(t),t}}},10568:(e,t,i)=>{"use strict";i.d(t,{InplaceTextLineDataSource:()=>f,InplaceTextUndoCommand:()=>g});var s=i(16230),r=i(50151),n=i(86441),o=i(19625),a=i(11542),l=i(45126),c=i(64147),h=i(60265),d=i(29875),u=i(44672);var p=i(85719);const _={selectionColor:(0,o.getHexColorByName)("color-tv-blue-500"),cursorColor:(0,o.getHexColorByName)("color-black")},m={selectionColor:(0,o.getHexColorByName)("color-white"),cursorColor:(0,o.getHexColorByName)("color-white")};class g extends h.UndoCommand{constructor(e,t,s,r){var n;super(new l.TranslatedString("change {title} text",a.t(null,void 0,i(57122))).format({title:new l.TranslatedString(t.name(),t.translatedType())}),!0,!p.lineToolsDoNotAffectChartInvalidation),this._sourceId=t.id(),this._model=e,this._oldValue=s,this._newValue=r,this._changeVisibility=!1===(null===(n=t.editableTextProperties().textVisible)||void 0===n?void 0:n.value())}redo(){var e;const t=this._source();this._textProperty(t).setValue(this._newValue),this._changeVisibility&&(null===(e=this._textVisibilityProperty(t))||void 0===e||e.setValue(!0))}undo(){var e;const t=this._source();this._textProperty(t).setValue(this._oldValue),this._changeVisibility&&(null===(e=this._textVisibilityProperty(t))||void 0===e||e.setValue(!1))}_textProperty(e){return e.editableTextProperties().text}_textVisibilityProperty(e){return e.editableTextProperties().textVisible}_source(){return(0,r.ensureNotNull)(this._model.dataSourceForId(this._sourceId))}}class f extends d.LineDataSource{constructor(e,t,s,r){super(e,t,s,r),this._container=null,this._editableText=new c.WatchedValue(""),this._activateTextEditingEl=null,this._paneView=null,this._selectionData={},this._editingOnCreation=!1,this._editableText.subscribe((()=>{this.updateAllViewsAndRedraw((0,u.sourceChangeEvent)(this.id()))})),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,15852)).then((t=>{this._cursorPaneView=new t.InplaceTextCursorPaneView(this,e),this._additionalCursorDataGetters&&this._cursorPaneView.setAdditionalCursorData(...this._additionalCursorDataGetters)}))}destroy(){this._editableText.unsubscribe(),this._closeTextEditor(),super.destroy()}editableTextStyle(){return{...this._model.dark().value()?m:_}}removeIfEditableTextIsEmpty(){return!1}activateEditingOnCreation(){return!1}topPaneViews(e){return e.hasDataSource(this)&&!window.TradingView.printing&&this._cursorPaneView?(this._cursorPaneView.update((0,u.sourceChangeEvent)(this.id())),[this._cursorPaneView]):null}editableText(){return this._editableText}textEditingEl(){return this._activateTextEditingEl}activateTextEditingOn(e,t){this._activateTextEditingEl=e,this._editingOnCreation=!!t,this.updateAllViewsAndRedraw((0,u.sourceChangeEvent)(this.id()))}onSelectionChange(e){
const t={};void 0!==e&&(e.start===e.end?t.cursorPosition=e.start:t.selectionRange=[Math.min(e.start,e.end),Math.max(e.start,e.end)]),(0,s.default)(t,this._selectionData)||(this._selectionData=t,this._paneViews.forEach((e=>{e.forEach((e=>{"setSelectionRange"in e&&e.setSelectionRange(t.selectionRange)}))})),this._cursorPaneView.setCursorPosition(t.cursorPosition),this.updateAllViewsAndRedraw((0,u.sourceChangeEvent)(this.id())))}setAdditionalCursorData(e,t){this._cursorPaneView?this._cursorPaneView.setAdditionalCursorData(e,t):this._additionalCursorDataGetters=[e,t]}async _openTextEditor(e,t,s,o,a){if(null!==this._container)return;this._activateTextEditingEl=null;const l=this.isFixed()?(0,r.ensureDefined)(this.fixedPoint()):(0,r.ensureNotNull)(this.pointToScreenPoint(this._points[0])),c=new n.Point(l.x,l.y);this._container=document.createElement("div"),this._container.style.position="absolute",this._container.style.top="0",this._container.style.bottom="0",this._container.style.left="0",this._container.style.right="0",this._container.style.overflow="hidden",this._container.style.pointerEvents="none",e.appendChild(this._container);const h=this.editableTextProperties(),d=this.editableTextStyle();this._editableText.setValue(h.text.value());const{updateChartEditorText:p,closeChartEditorText:_}=await Promise.all([i.e(9275),i.e(2227),i.e(5592)]).then(i.bind(i,99514));if(null===this._container||this._isDestroyed)return;this._closeChartEditorText=_;const m={position:c,textInfo:t,placeholder:s,text:this._editableText,textColor:h.textColor,wordWrap:h.wordWrap,forbidLineBreaks:d.forbidLineBreaks,maxLength:d.maxLength,onClose:o,onSelectionChange:a};p(this._container,m),this.updateAllViewsAndRedraw((0,u.sourceChangeEvent)(this.id()))}_closeTextEditor(){var e;if(null===this._container||this._isDestroyed)return;const t=this.editableTextProperties().text.value(),i=this._editableText.value();t!==i&&(this._editingOnCreation?this.editableTextProperties().text.setValue(i):this._model.undoModel().undoHistory().pushUndoCommand(this._changeEditableTextUndoCommand(t,i))),this._editingOnCreation=!1,this.onSelectionChange(),null===(e=this._closeChartEditorText)||void 0===e||e.call(this,this._container),this._closeChartEditorText=void 0,this._container.remove(),this._container=null,this.updateAllViewsAndRedraw((0,u.sourceChangeEvent)(this.id()))}_changeEditableTextUndoCommand(e,t){return new g(this._model,this,e,t)}}},36696:(e,t,i)=>{"use strict";i.d(t,{drawSelection:()=>o,getSymbolCoordinatesInfo:()=>n});var s=i(63273),r=i(7114);function n(e){const{symbolPosition:t,textWidth:i,textByLines:n,lineHeight:o,font:a,textAlign:l,lineSpacing:c=0}=e;let h=-c,d=0;const u=(0,s.isRtl)(),p=o+c;let _=0,m=0,g="";for(let e=0;e<n.length;e++){let s=t-_;const{wrappedLinePart:o,wrappedLineEnd:c,hidden:f,text:v}=n[e],y=e<n.length-1?n[e+1]:null;if(f||(g=v),y&&s>v.length){_+=v.length+(o&&!c?0:1),f||(h+=p);continue}f&&(h-=p);const S=o&&!c&&v.length===s&&y&&!y.hidden;if(f&&(g+=" ",s=g.length),"center"===l)if(S)d=i/2;else{const e=(0,r.measureText)(g,a).width,t=(0,
r.measureText)(g.slice(0,s),a).width,n=i/2;d=u?n+e/2-t:n-e/2+t}else if("right"===l&&!u||"left"===l&&u||"end"===l)if(S)d=i;else{const e=(0,r.measureText)(g.slice(s),a).width;d=u?e:i-e}else if(S)d=0;else{const e=(0,r.measureText)(g.slice(0,s),a).width;d=u?i-e:e}S?(m=e+1,h+=p):m=e;break}return{x:d,y:h,lineNumber:m}}function o(e,t,i){const{lines:n,selectionStart:o,selectionEnd:l,left:c,right:h,color:d,font:u,lineHeight:p,lineSpacing:_=0}=i;e.save();const m=(c+h)/2,g=p+_,f=(0,s.isRtl)();e.fillStyle=d;const{horizontalPixelRatio:v,verticalPixelRatio:y}=t;if(o.lineNumber===l.lineNumber){const t=Math.round(o.x*v),i=Math.round(o.y*y),s=Math.round(l.x*v);e.fillRect(Math.min(t,s),i,Math.abs(t-s),Math.round(g*y))}else{const t=(0,r.measureText)(" ",u).width;let i=0;for(let s=o.lineNumber;s<=l.lineNumber;s+=1){const r=s===o.lineNumber,d=s===l.lineNumber,p=n[s];if(p.hidden)continue;const _=a(p.text,u);let S,b,w=!1;"center"===e.textAlign?(S=r?o.x:f?m+_/2:m-_/2,b=d?l.x:f?m-_/2:m+_/2):"right"===e.textAlign||f&&"start"===e.textAlign||!f&&"end"===e.textAlign?(S=r?o.x:h-_,b=d?l.x:h,w=!0):(S=r?o.x:c,b=d?l.x:c+_);let C=Math.min(S,b),P=Math.max(S,b);d||p.wrappedLinePart&&!p.wrappedLineEnd||(w?C-=t:P+=t);const x=Math.round(C*v),T=Math.round(P*v),I=Math.round((o.y+i*g)*y),M=Math.round((o.y+(i+1)*g)*y);e.fillRect(x,I,T-x,M-I),i+=1}}e.restore()}function a(e,t){return(0,r.measureText)(e,t).width}},20690:(e,t,i)=>{"use strict";var s=i(15399).LevelsProperty,r=i(64002).LineToolPitchfork;class n extends r{constructor(e,t,i,s){super(e,t||n.createProperties(),i,s)}name(){return"Inside Pitchfork"}static createProperties(e){var t=new s({defaultName:"linetoolinsidepitchfork",state:e,map:{range:[0,8]}});return this._configureProperties(t),t}}t.LineToolInsidePitchfork=n},15764:(e,t,i)=>{"use strict";var s;i.d(t,{isLineDrawnWithPressedButton:()=>c,isLineToolDrawWithoutPoints:()=>d,isLineToolFinishRequiredWhenCreatedByApi:()=>h,isLineToolName:()=>l,isMtpPredictorToolName:()=>o,isStudyLineToolName:()=>a,isTextToolName:()=>u});var r=i(19888);const n=new Set([]);function o(e){return n.has(e)}function a(e){return"LineToolRegressionTrend"===e||"LineToolVbPFixed"===e||"LineToolFixedRangeVolumeProfile"===e||"LineToolAnchoredVolumeProfile"===e||"LineToolAnchoredVWAP"===e}function l(e){return e in(s||(s=i.t(r,2)))||a(e)}function c(e){return"LineToolBrush"===e||"LineToolHighlighter"===e}function h(e){return c(e)||"LineToolPath"===e||"LineToolPolyline"===e||"LineToolGhostFeed"===e}function d(e){return"LineToolTweet"===e||"LineToolIdea"===e||"LineToolImage"===e}function u(e){switch(e){case"LineToolBalloon":case"LineToolComment":case"LineToolText":case"LineToolTextAbsolute":case"LineToolCallout":case"LineToolNote":case"LineToolNoteAbsolute":case"LineToolSignpost":return!0}return!1}},20834:(e,t,i)=>{"use strict";i.d(t,{LineDataSourcePointIndexProperty:()=>r});var s=i(12988);class r extends s.Property{constructor(e,t){super(),this._waitingPointsetUpdate=!1,this._lineSource=e,this._pointIndex=t,this._cachedIndex=this.value()}value(){const e=this._lineSource.points()
;return 0===e.length?this._cachedIndex:e[this._pointIndex].index}setValue(e){this._cachedIndex=e;const t=this._lineSource.points(),i=e=>{const t=this._lineSource.points()[this._pointIndex];if(t.index===e)return;t.index=e,this._lineSource.startChanging(this._pointIndex,t),this._setPointImpl(t),this._lineSource.model().updateSource(this._lineSource),this._listeners.fire(this,"");const i=this._lineSource.endChanging(!0,!1);this._lineSource.syncMultichartState(i)};if(0===t.length){const e=()=>{i(this._cachedIndex),this._waitingPointsetUpdate=!1};if(this._waitingPointsetUpdate)return;this._lineSource.pointsetUpdated().subscribe(this,e,!0),this._waitingPointsetUpdate=!0}else i(e)}_setPointImpl(e){this._lineSource.setPoint(this._pointIndex,e)}}},90793:(e,t,i)=>{"use strict";i.d(t,{LineToolPriceAxisView:()=>o});var s=i(50151),r=i(98558),n=i(19063);class o extends r.PriceAxisView{constructor(e,t){super(),this._source=e,this._data=t,this._properties=e.model().properties().childs().scalesProperties}_updateRendererData(e,t,i){e.visible=!1;const s=this._source.model();if(!s.timeScale()||s.timeScale().isEmpty())return;const r=this._source.priceScale();if(null===r||r.isEmpty())return;if(!s.selection().isSelected(this._source)&&!this._source.isForcedDrawPriceAxisLabel())return;if(null===s.timeScale().visibleBarsStrictRange())return;const o=this._source.priceAxisPoints(),a=this._data.pointIndex;if(o.length<=a)return;const l=o[a];if(!isFinite(l.price))return;const c=this._source.ownerSource(),h=null!==c?c.firstValue():null;if(null===h)return;let d=this._data.backgroundPropertyGetter?this._data.backgroundPropertyGetter():null;null===d&&(d=this._getBgColor()),i.background=(0,n.resetTransparency)(d),i.borderColor="#2E84A6",i.textColor=this.generateTextColor(i.background),i.coordinate=r.priceToCoordinate(l.price,h),e.text=this._formatPrice(l.price,h),e.visible=!0}_getBgColor(){return this._active?this._properties.childs().axisLineToolLabelBackgroundColorActive.value():this._properties.childs().axisLineToolLabelBackgroundColorCommon.value()}_formatPrice(e,t){return(0,s.ensureNotNull)(this._source.priceScale()).formatPrice(e,t)}}},38039:(e,t,i)=>{"use strict";i.d(t,{LineDataSourceProperty:()=>a});var s=i(27788),r=i(14314),n=i(50151),o=i(55917);class a extends o.DefaultProperty{constructor({templateKeys:e,...t}){super({ignoreAllowSavingDefaults:!0,saveNonDefaultUserPreferencesOnly:!0,...t}),this._templateKeys=(0,n.ensureDefined)(e||this._allDefaultsKeys)}template(){return(0,o.extractState)(this.state(),this._templateKeys,[])}applyTemplate(e){this.mergeAndFire((0,o.extractState)((0,r.default)((0,s.default)(this._factoryDefaultsSupplier()),e),this._templateKeys))}}},14169:(e,t,i)=>{"use strict";i.d(t,{LineDataSourceTimeAxisView:()=>r});var s=i(66156);class r extends s.TimeAxisView{constructor(e,t){super(e.model()),this._active=!1,this._source=e,this._pointIndex=t,this._properties=e.model().properties().childs().scalesProperties}setActive(e){this._active=e}_getBgColor(){
return this._active?this._properties.childs().axisLineToolLabelBackgroundColorActive.value():this._properties.childs().axisLineToolLabelBackgroundColorCommon.value()}_getIndex(){if(!this._model.selection().isSelected(this._source))return null;const e=this._source.timeAxisPoints();return e.length<=this._pointIndex?null:e[this._pointIndex].index}_isVisible(){return!0}}},29875:(e,t,i)=>{"use strict";i.d(t,{LineDataSource:()=>O});var s=i(86441),r=i(50151),n=i(76422),o=i(31955),a=i(56570),l=i(53388),c=i(2740),h=i(52033),d=i(18832),u=i(64147),p=i(62288),_=i(10074),m=i(10892),g=i(31229),f=i(68805),v=i(76350),y=i(85049),S=i(12988),b=i(928),w=i(29137),C=i(94260),P=i(37265),x=i(44672),T=i(60074),I=i(20834);class M extends S.Property{constructor(e,t){super(),this._lineSource=e,this._pointIndex=t,e.pointAdded().subscribe(this,(e=>{this._pointIndex===e&&this._listeners.fire(this,`${e}`)})),e.pointChanged().subscribe(this,(e=>{this._pointIndex===e&&this._listeners.fire(this,`${e}`)}))}value(){const e=this._lineSource.points()[this._pointIndex].price,t=(0,r.ensureNotNull)(this._lineSource.ownerSource()).formatter();if(t.parse){const i=t.format(e),s=t.parse(i);return s.res?s.value:e}return e}setValue(e){const t=this._lineSource.points()[this._pointIndex];t.price=parseFloat(""+e),this._lineSource.startChanging(this._pointIndex,t),this._lineSource.setPoint(this._pointIndex,t),this._lineSource.model().updateSource(this._lineSource),this._listeners.fire(this,"");const i=this._lineSource.endChanging(!0,!1);this._lineSource.syncMultichartState(i)}}var A=i(14169),L=i(90793),k=i(73305),D=i(98523),E=i(35039);const V=(0,o.getLogger)("Chart.LineDataSource"),B=a.enabled("datasource_copypaste");class R{constructor(){this._states=[]}start(e){this._states.push(e)}finish(e){const t=(0,r.ensureDefined)(this._states.pop());return s=t,(i=e).length!==s.length?{indexesChanged:!0,pricesChanged:!0}:i.reduce(((e,t,i)=>{const r=s[i];return e.indexesChanged=e.indexesChanged||t.index!==r.index,e.pricesChanged=e.pricesChanged||t.price!==r.price,e}),{indexesChanged:!1,pricesChanged:!1});var i,s}isEmpty(){return 0===this._states.length}}let N=0;class O extends w.DataSource{constructor(e,t,i,s){if(super(s),this.version=1,this.toolname="",this.customization={forcePriceAxisLabel:!1,disableErasing:!1,disableSave:!1,showInObjectsTree:!0},this._currentPointsetAndSymbolId=null,this._pointChanged=new h.Delegate,this._pointAdded=new h.Delegate,this._priceAxisViews=[],this._timeAxisViews=[],this._timePoint=[],this._points=[],this._lastPoint=null,this._paneViews=new Map,this._normalizedPointsChanged=new h.Delegate,this._fixedPointsChanged=new h.Delegate,this._changeStatesStack=new R,this._startMovingPoint=null,this._currentMovingPoint=null,this._isActualSymbol=!1,this._isActualInterval=!1,this._isActualCurrency=!1,this._isActualUnit=!1,this._sharingMode=new u.WatchedValue(0),this._onTemplateApplying=new h.Delegate,this._onTemplateApplied=new h.Delegate,this._syncStateExclusions=[],this._definitionsViewModel=null,this._syncLineStyleMuted=!1,
this._onIsActualIntervalChange=new h.Delegate,this._onPointsetUpdatedDelegate=new h.Delegate,this._linkKey=new u.WatchedValue(null),this._serverUpdateTime=null,this._boundCalcIsActualSymbol=this.calcIsActualSymbol.bind(this),this._alignerCache=null,this._alertUndoMode=!1,this._onAlertStatusChanged=()=>{this.updateAllViewsAndRedraw((0,x.sourceChangeEvent)(this.id()))},this._model=e,this._properties=t,this._localAndServerAlertsMismatch=!1,this._properties.hasChild("interval")||this._properties.addChild("interval",new S.Property(e.mainSeries().interval())),this.calcIsActualSymbol(),this._properties.childs().intervalsVisibilities.listeners().subscribe(this,this.calcIsActualSymbol),this._properties.subscribe(this,(()=>this.propertiesChanged())),this._createPointsProperties(),this.pointsCount()>0)for(let e=0;e<this.pointsCount();e++)this._priceAxisViews.push(this.createPriceAxisView(e)),this._timeAxisViews.push(new A.LineDataSourceTimeAxisView(this,e));this._properties.childs().visible.subscribe(this,(e=>{const t=!1===(0,b.hideAllDrawings)().value();e.value()?e.value()&&t&&n.emit("drawing_event",this._id,"show"):(this._model.selection().isSelected(this)&&this._model.selectionMacro((e=>{e.removeSourceFromSelection(this)})),t&&n.emit("drawing_event",this._id,"hide")),this._onSourceHiddenMayChange()})),(0,b.hideAllDrawings)().subscribe(this,this._onSourceHiddenMayChange),this._sessionConnected=this._model.chartApi().isConnected().spawn(),this._sessionConnected.subscribe((e=>{e||(this._currentPointsetAndSymbolId=null)})),this._alertStatus.subscribe(this._onAlertStatusChanged),this._definitionsViewModel=null}destroy(){this._paneViews.forEach(((e,t)=>this._destroyPanePaneViews(t))),this.stop(),null!==this._definitionsViewModel&&(this._definitionsViewModel.destroy(),this._definitionsViewModel=null),null!==this._ownerSource&&(this._ownerSource.currencyChanged().unsubscribeAll(this),this._ownerSource.unitChanged().unsubscribeAll(this),(0,T.isSymbolSource)(this._ownerSource)&&(this._ownerSource.symbolResolved().subscribe(this,this._boundCalcIsActualSymbol),this._ownerSource.isActingAsSymbolSource().unsubscribe(this._boundCalcIsActualSymbol))),this.ownerSourceChanged().unsubscribeAll(this),(0,b.hideAllDrawings)().unsubscribeAll(this),this._sessionConnected.destroy(),this._alertStatus.unsubscribe(this._onAlertStatusChanged),super.destroy()}priceScale(){return this._ownerSource?this._ownerSource.priceScale():null}createPriceAxisView(e){return new L.LineToolPriceAxisView(this,{pointIndex:e})}model(){return this._model}symbol(){return this._properties.childs().symbol.value()}linkKey(){return this._linkKey}serverUpdateTime(){return this._serverUpdateTime}setServerUpdateTime(e){this._serverUpdateTime=e}boundToSymbol(){return!0}isAvailableInFloatingWidget(){return!0}points(){const e=[];for(let t=0;t<this._points.length;t++){const i=this._points[t];e.push({index:i.index,price:i.price,time:i.time})}return this._lastPoint&&e.push(this._correctLastPoint(this._lastPoint)),
!this.isFixed()&&this._currentMovingPoint&&this._startMovingPoint&&this._correctPoints(e),e}timeAxisPoints(){return this.points()}priceAxisPoints(){return this.points()}fixedPoint(){var e;let t;const i=this.priceScale();if(this._positionPercents&&null!==i&&!i.isEmpty()){const e=this._positionPercents,r=this._model.timeScale().width()*e.x,n=i.height()*e.y;t=new s.Point(r,n)}else void 0!==this._fixedPoint&&(t=null===(e=this._fixedPoint)||void 0===e?void 0:e.clone());if(this._currentMovingPoint&&this._startMovingPoint&&void 0!==t){const e=this._correctFixedPoint(t);e.didCorrect&&(t=e.point)}return t}positionPercents(){return this._positionPercents}normalizedPoints(){return this._timePoint}normalizedPointsForCreating(){return this.normalizedPoints()}normalizedPointsChanged(){return this._normalizedPointsChanged}fixedPointChanged(){return this._fixedPointsChanged}geometry(){const e=(0,r.ensureNotNull)(this.priceScale());return this.points().map((t=>{const i=(0,r.ensureNotNull)(this.pointToScreenPoint(t)),n=i.x/this._model.timeScale().width(),o=i.y/e.height();return new s.Point(n,o)}))}widthsProperty(){var e;return null!==(e=this._properties.childs().linesWidths)&&void 0!==e?e:null}lineColorsProperty(){var e;return null!==(e=this._properties.childs().linesColors)&&void 0!==e?e:null}backgroundColorsProperty(){var e;return null!==(e=this._properties.childs().backgroundsColors)&&void 0!==e?e:null}textColorsProperty(){var e;return null!==(e=this._properties.childs().textsColors)&&void 0!==e?e:null}pointsProperty(){return this._pointsProperty}hasEditableCoordinates(){return!0}startMoving(e,t,i,s){this.isFixed()&&this.restoreFixedPoint(),this._startMovingPoint=e}move(e,t,i,s){if(i&&(i.shiftOnly()||i.modShift()))if(this.isFixed()){const t=this._alignScreenPointHorizontallyOrVertically((0,r.ensureDefined)(e.screen));this._currentMovingPoint={screen:t}}else{const t=this._alignPointHorizontallyOrVertically((0,r.ensureDefined)(e.logical)),i=(0,r.ensureNotNull)(this.pointToScreenPoint(t));this._currentMovingPoint={logical:t,screen:i}}else this._currentMovingPoint=e;this.updateAllViews((0,x.sourceChangeEvent)(this.id()))}endMoving(e,t,i){let s=!1,o=!1;if(this._currentMovingPoint&&this._startMovingPoint){if(this.isFixed()){const e=this._correctFixedPoint((0,r.ensureDefined)(this._fixedPoint));e.didCorrect&&(this._fixedPoint=e.point,this._fixedPointsChanged.fire())}else{const e=(0,r.ensureDefined)(this._currentMovingPoint.logical),t=(0,r.ensureDefined)(this._startMovingPoint.logical);s=e.index!==t.index,o=e.price!==t.price;if(this._correctPoints(this._points,i)){n.emit("drawing_event",this._id,"move"),n.emit("drawing_event",this._id,"points_changed");for(let e=0;e<this._points.length;e++)this._pointChanged.fire(e)}}this._startMovingPoint=null,this._currentMovingPoint=null}const a={indexesChanged:s,pricesChanged:o};return this.isFixed()?(this.calcPositionPercents(),this.updateAllViews((0,x.sourceChangeEvent)(this.id())),a):(this.updateAllViews((0,x.sourceChangeEvent)(this.id())),
s&&!e?(this._properties.childs().interval.setValue(this._model.mainSeries().interval()),this._normalizePoints(),this.createServerPoints()):(this._copyPricesWithoutNormalization(),this._normalizedPointsChanged.fire()),a)}startMovingPoint(){return this._startMovingPoint?{...this._startMovingPoint}:null}currentMovingPoint(){return this._currentMovingPoint?{...this._currentMovingPoint}:null}startChanging(e,t){void 0!==e&&void 0!==t&&(e<this._priceAxisViews.length&&this._priceAxisViews[e].setActive(!0),e<this._timeAxisViews.length&&this._timeAxisViews[e].setActive(!0)),this._changeStatesStack.start(this.points())}endChanging(e,t,i){const s=this._changeStatesStack.finish(this.points());s.indexesChanged&&this._changeStatesStack.isEmpty()?(this._properties.childs().interval.setValue(this._model.mainSeries().interval()),this._normalizePoints(),t||this.createServerPoints()):(this._copyPricesWithoutNormalization(),this._normalizedPointsChanged.fire()),n.emit("drawing_event",this._id,"points_changed");for(let e=0;e<this._priceAxisViews.length;e++)this._priceAxisViews[e].setActive(!1);for(let e=0;e<this._timeAxisViews.length;e++)this._timeAxisViews[e].setActive(!1);return s}setPoint(e,t,i,s){if(i&&i.shift()&&this._snapTo45DegreesAvailable()){const i=0===e?1:e-1;this._snapPoint45Degree(t,this.points()[i])}this._setPoint(e,t)}getPoint(e){return this.points()[e]||null}alignCrossHairToAnchor(e){return!0}alignCrossHairToMovePoint(){return!1}setLastPoint(e,t){return this._lastPoint=this._preparePoint(e,t),this.updateAllViews((0,x.sourceChangeEvent)(this.id())),this._lastPoint}lastPoint(){return this._lastPoint}getChangePointForSync(e){return this.getPoint(e)}setPoints(e){this._points=e}isForcedDrawPriceAxisLabel(){return this.customization.forcePriceAxisLabel}clearData(){this._points=[]}denormalizeTimePoints(){let e=[];for(let t=0;t<this._timePoint.length;t++){const i=this._model.timeScale().denormalizeTimePoint(this._timePoint[t]);if(void 0===i){e=[];break}e.push({index:i,price:this._timePoint[t].price})}e.length>0&&(this._points=e)}restorePoints(e,t,i){const s=this._timePoint.length>0&&!(0,P.deepEquals)(this._timePoint,e)[0];this._timePoint=(0,d.deepCopy)(e),this._points=t,i||this.denormalizeTimePoints(),s&&this._normalizedPointsChanged.fire()}restorePositionPercents(e){this._positionPercents=e}calcIsActualSymbol(){const e=this.ownerSource();if(null===e)this._isActualSymbol=!1;else{const t=(0,r.ensureNotNull)(e.symbolSource()),i=t.symbolInfo();if(i){this._migrateSymbolProperty(i);const e=this._properties.childs().symbol,s=e.value();if(this._isActualSymbol=t.symbolSameAsCurrent(s),this._isActualSymbol){const r=(0,f.extractLineToolSymbolFromSymbolInfo)(i,t.symbol());(0,v.areEqualSymbols)(s,r)||(V.logWarn('Possible drawing "migrating" detected from "'+s+'" to "'+r+'"'),V.logWarn("Series symbolInfo: "+JSON.stringify(t.symbolInfo())),V.logWarn(`${(new Error).stack}`)),e.setValue(r)}}}this.calcIsActualInterval(),this.calcIsActualCurrency(),this.calcIsActualUnit(),this._onSourceHiddenMayChange()}calcIsActualCurrency(){
const e=this.ownerSource();if(null===e)return void(this._isActualCurrency=!1);let t=this._properties.childs().currencyId.value();if(null!==t){const i=e.symbolSource();0,this._isActualCurrency=t===(0,f.symbolCurrency)(i.symbolInfo(),void 0,!0)}else{const t=(0,r.ensureNotNull)(e.symbolSource());this._isActualCurrency=null!==t.symbolInfo()&&!t.isConvertedToOtherCurrency()}this._onSourceHiddenMayChange()}calcIsActualUnit(){const e=this.ownerSource();if(null===e)return void(this._isActualUnit=!1);const t=this._properties.childs().unitId.value();if(null!==t)this._isActualUnit=t===(0,r.ensureNotNull)(e.symbolSource()).unit();else{const t=(0,r.ensureNotNull)(e.symbolSource());this._isActualUnit=null!==t.symbolInfo()&&!t.isConvertedToOtherUnit()}this._onSourceHiddenMayChange()}calcIsActualInterval(){const e=this._isActualInterval,t=this._properties,i=this._model.mainSeries();this._isActualInterval=(0,m.isActualInterval)(y.Interval.parse(i.interval()),t.childs().intervalsVisibilities),!this._isActualInterval&&this._model.selection().isSelected(this)&&this._model.selectionMacro((e=>e.removeSourceFromSelection(this))),this._isActualInterval!==e&&this._onIsActualIntervalChange.fire(),this._onSourceHiddenMayChange()}paneViews(e){if(this.isSourceHidden())return null;const t=this._getPaneViews(this.isMultiPaneAvailable()?e:void 0);if(null===t)return null;if(1===t.length)return[t[0]];const i=[];for(let e=t.length-1;e>=0;--e)i.push(t[e]);return i}priceAxisViews(e,t){if(t!==this.priceScale()||this.isSourceHidden())return null;if(this._model.lineBeingEdited()===this){const e=this._model.linePointBeingEdited();if(null!==e&&e<this._priceAxisViews.length){const t=this._priceAxisViews.slice(),i=t[e];return t.splice(e,1),t.push(i),t}return this._priceAxisViews}return this._priceAxisViews}timeAxisViews(){if(this.isSourceHidden())return null;if(this._model.lineBeingEdited()===this){const e=this._model.linePointBeingEdited();if(null!==e&&e<this._timeAxisViews.length){const t=this._timeAxisViews.slice(),i=t[e];return t.splice(e,1),t.push(i),t}return this._timeAxisViews}return this._timeAxisViews}isSavedInChart(){return!this.customization.disableSave}isSavedInStudyTemplates(){return!1}setSavingInChartEnabled(e){this.customization.disableSave=!e}shouldBeRemovedOnDeselect(){return!1}getOrderTemplate(){return null}getSourceIcon(){return{type:"loadSvg",svgId:"linetool."+this.toolname}}alertId(){return this._alertId}async waitSettingAlertId(){this._pendingAlertIdPromise&&(this._alertId=await this._pendingAlertIdPromise)}async setAlert(e,t={}){throw new Error("not implemented")}async restoreAlert(e,t){throw new Error("not implemented")}editAlert(e){}async getAlert(){try{const e=await this._getChartAlert();if(!e)throw V.logError("Failed to get alert, alert will not be saved with drawing in chart"),new Error("got_no_alert");return e}catch(e){if("not_exists"===e)throw new Error(e);return V.logError(`Getting alert failed: ${e instanceof Error?e.message:e}`),null}}getAlertSync(){return null}async synchronizeAlert(e=!1){}syncAlert(e){0}stateForAlert(){
return null}getAlertIsActive(){return!1}detachAlert(){}removeAlert(){}deleteAlert(){}areLocalAndServerAlertsMismatch(){return!1}showInObjectTree(){return this.customization.showInObjectsTree}setShowInObjectsTreeEnabled(e){this.customization.showInObjectsTree=e}start(){this.createServerPoints()}processHibernate(){this.canBeHibernated()?this.isStarted()&&this.stop():this.isStarted()||this.start()}canBeHibernated(){return this.isSourceHidden()}onData(e){"pointset_error"!==e.method?e.params.customId===this._currentPointsetIdWithPrefix()&&this._onPointsetUpdated(e.params.plots):V.logError(`Error getting pointset: ${e.params[0]} ${e.params[1]}`)}isBeingEdited(){return this===this._model.lineBeingEdited()}isActualSymbol(){return this._isActualSymbol}isActualCurrency(){return this._isActualCurrency}isActualInterval(){return this._isActualInterval}isActualUnit(){return this._isActualUnit}onIsActualIntervalChange(){return this._onIsActualIntervalChange}setOwnerSource(e){null!==this._ownerSource&&(this._ownerSource.currencyChanged().unsubscribeAll(this),this._ownerSource.unitChanged().unsubscribeAll(this)),null!==this._ownerSource&&(0,T.isSymbolSource)(this._ownerSource)&&(this._ownerSource.symbolResolved().unsubscribe(this,this._boundCalcIsActualSymbol),this._ownerSource.isActingAsSymbolSource().unsubscribe(this._boundCalcIsActualSymbol)),super.setOwnerSource(e),e&&(this.setPriceScale(e.priceScale()),e.currencyChanged().subscribe(this,this.calcIsActualCurrency),e.unitChanged().subscribe(this,this.calcIsActualUnit),this.calcIsActualSymbol(),this._migrateZOrder(),this._updateAlertCreationAvailable()),(0,T.isSymbolSource)(e)&&(e.symbolResolved().subscribe(this,this._boundCalcIsActualSymbol),e.isActingAsSymbolSource().subscribe(this._boundCalcIsActualSymbol))}dataAndViewsReady(){return this._paneViews.size>0}pointAdded(){return this._pointAdded}pointChanged(){return this._pointChanged}pointsetUpdated(){return this._onPointsetUpdatedDelegate}pointToScreenPoint(e){var t;const i=this._model.timeScale(),r=this.priceScale(),n=null===(t=this.ownerSource())||void 0===t?void 0:t.firstValue();if(!r||r.isEmpty()||i.isEmpty()||null==n)return null;const o=i.indexToCoordinate(e.index),a=r.priceToCoordinate(e.price,n);return new s.Point(o,a)}screenPointToPoint(e){var t;const i=this.priceScale(),s=null===(t=this.ownerSource())||void 0===t?void 0:t.firstValue();if(null==s||!isFinite(s)||null===i)return null;const r=this._model.timeScale().coordinateToIndex(e.x);return{price:i.coordinateToPrice(e.y,s),index:r}}calcMiddlePoint(e,t){return new s.Point((e.x+t.x)/2,(e.y+t.y)/2)}addPoint(e,t,i){const s=this._preparePoint(e,t);return this._addPointIntenal(s,t,i)}addFixedPoint(e){return this._fixedPoint=e,this.calcPositionPercents(),!0}calcPositionPercents(){const e=this.priceScale();if(!e||e.isEmpty()||void 0===this._fixedPoint)return;const t=this._fixedPoint.x/this._model.timeScale().width(),i=this._fixedPoint.y/e.height();return this._positionPercents={x:t,y:i},this._positionPercents}restoreFixedPoint(){this._fixedPoint=this.fixedPoint()}
propertiesChanged(e){this.calcIsActualInterval(),this.updateAllViewsAndRedraw((0,x.sourceChangeEvent)(this.id())),e||this._syncLineStyleIfNeeded(),void 0===this._pendingPropertyChangedEvent&&(this._pendingPropertyChangedEvent=setTimeout((()=>{this._pendingPropertyChangedEvent=void 0,n.emit("drawing_event",this._id,"properties_changed")}),0))}state(e){var t;const i={type:this.toolname,id:this.id(),state:this.properties().state(this._propertiesStateExclusions()),points:(0,d.deepCopy)(this._timePoint),zorder:this.zorder(),ownerSource:null===(t=this.ownerSource())||void 0===t?void 0:t.id()};return i.isSelectionEnabled=this.isSelectionEnabled(),i.userEditEnabled=this.userEditEnabled(),this.linkKey().value()&&(i.linkKey=this.linkKey().value()),delete i.state.points,e&&(i.indexes=this._points),this.isFixed()&&(i.positionPercents=this._positionPercents||this.calcPositionPercents()),"version"in this&&1!==this.version&&(i.version=this.version),i}updateAllViews(e){this._isActualSymbol&&this._isActualCurrency&&this._isActualUnit&&this._isActualInterval&&this._properties.childs().visible.value()&&(this._updateAllPaneViews(e),this._priceAxisViews.forEach((t=>t.update(e))),this._timeAxisViews.forEach((t=>t.update(e))))}updateAllViewsAndRedraw(e){this.updateAllViews(e),this._model.updateSource(this)}tags(){return[this.toolname]}properties(){return this._properties}restoreExternalPoints(e,t){if(this._timePoint=(0,d.deepCopy)(e.points),t.indexesChanged){if(this.properties().childs().interval.setValue(e.interval),!this.isActualSymbol())return this._clearServerPoints(),void this._normalizedPointsChanged.fire();this.createServerPoints()}else{const t=Math.min(this._points.length,e.points.length);for(let i=0;i<t;i++)this._points[i].price=e.points[i].price}this._normalizedPointsChanged.fire()}restoreExternalState(e){this.properties().mergeAndFire(e)}applyTemplate(e){this._onTemplateApplying.fire(e),this._applyTemplateImpl(e),this.calcIsActualSymbol(),this.updateAllViews((0,x.sourceChangeEvent)(this.id())),this.model().lightUpdate(),this._onTemplateApplied.fire()}template(){return this.properties().preferences()}isFixed(){return!1}isLocked(){const e=this.properties().child("frozen");return void 0!==e&&e.value()}isSourceHidden(){return!this._properties.childs().visible.value()||(0,b.hideAllDrawings)().value()&&this.canBeHidden()||!this._isActualInterval||!this._isActualSymbol||!this._isActualCurrency||!this._isActualUnit}isSynchronizable(){return this.priceScale()===this._model.mainSeries().priceScale()}copiable(){return B}cloneable(){return null!==this._ownerSource&&null!==this._ownerSource.firstValue()}movable(){return!0}async getPropertyDefinitionsViewModel(){if(null===this._definitionsViewModel){const e=await this._getPropertyDefinitionsViewModelClass();return null===e||this._isDestroyed?null:(this._definitionsViewModel=new e(this._model.undoModel(),this),this._definitionsViewModel)}return this._definitionsViewModel}title(){return this.translatedType()}translatedType(){var e
;return null!==(e=D.lineToolsLocalizedNames[this.toolname])&&void 0!==e?e:"Line Tool"}name(){return"Line Tool"}createServerPoints(){if(!this._isActualSymbol)return;if(!this._model.chartApi().isConnected().value())return;if(this._clearServerPoints(),this._model.timeScale().isEmpty())return;if(0===this._timePoint.length&&this._points.length>0&&this._normalizePoints(),!this._readyToCreatePointset())return;const e=this._pointsForPointset();if(0===e.length)return;++N,this._currentPointsetAndSymbolId={pointsetId:N,symbolId:(0,r.ensureNotNull)(this._model.mainSeries().seriesSource().symbolInstanceId())};const t=(0,_.getServerInterval)(this.properties().childs().interval.value());this._model.chartApi().createPointset(this._currentPointsetIdWithPrefix(),"turnaround",this._currentPointsetAndSymbolId.symbolId,t,e,this.onData.bind(this))}finish(){}realign(){var e;this.calcIsActualSymbol(),this.isFixed()||this.isSourceHidden()||this._model.lineBeingCreated()===this||this._model.lineBeingEdited()===this||(null===(e=this._currentPointsetAndSymbolId)||void 0===e?void 0:e.symbolId)===this._model.mainSeries().seriesSource().symbolInstanceId()||this._clearServerPoints(),null===this._model.mainSeries().symbolInfo()&&(this._alignerCache=null),this.updateAllViews((0,x.sourceChangeEvent)(this.id()))}stop(){this._clearServerPoints()}restart(){this.isFixed()||(this._currentPointsetAndSymbolId=null,this.createServerPoints())}isStarted(){return null!==this._currentPointsetAndSymbolId}convertYCoordinateToPriceForMoving(e,t){var i;const s=(0,r.ensureNotNull)(this.priceScale());if(s.isEmpty())return null;const n=this.ownerSource(),o=(0,r.ensure)(null===(i=n||t)||void 0===i?void 0:i.firstValue());return s.coordinateToPrice(e,o)}syncMultichartState(e){const t={points:this._timePoint,interval:this._model.mainSeries().interval()},i=this.linkKey().value();if(null!==i&&this.isSynchronizable()){const s={model:this._model,linkKey:i,symbol:this._model.mainSeries().symbol(),finalState:t,changes:e};(0,b.finishChangingLineTool)(s)}}enableCurrentIntervalVisibility(){let e=this.properties().childs().intervalsVisibilities.state();void 0!==e&&(e=(0,m.mergeIntervalVisibilitiesDefaults)(e),(0,m.makeIntervalsVisibilitiesVisibleAtInterval)(e,this._model.mainSeries().intervalObj()),this.properties().childs().intervalsVisibilities.mergeAndFire(e))}clonePositionOffset(){return this.isFixed()?{barOffset:0,xCoordOffset:20,yCoordOffset:20}:{barOffset:0,xCoordOffset:0,yCoordOffset:-40}}sharingMode(){return this._sharingMode}share(e){this.isSynchronizable()&&this._sharingMode.setValue(e)}syncLineStyleState(){const e=this.properties().state(this._syncStateExclusions);return delete e.interval,e.intervalsVisibilities=(0,m.mergeIntervalVisibilitiesDefaults)(e.intervalsVisibilities),e}moveLineTool(e){e.forEach(((e,t)=>this._setPoint(t,e))),this._normalizePoints()}_setPoint(e,t){this._points[e]&&(this._points[e].index===t.index?this._points[e].price=t.price:this._points[e]=t,this._pointChanged.fire(e))}_correctLastPoint(e){return(0,P.clone)(e)}_pointsForPointset(){
return this._timePoint.map((e=>[e.time_t,e.offset]))}_snapPoint45Degree(e,t,i){const s=this._model.timeScale(),n=s.indexToCoordinate(t.index),o=s.indexToCoordinate(e.index)-n,a=(0,r.ensureNotNull)(this.priceScale()),l=t.price,c=e.price,h=(0,r.ensureNotNull)((0,r.ensureNotNull)(this.ownerSource()).firstValue()),d=a.priceToCoordinate(l,h),u=a.priceToCoordinate(c,h)-d,p=Math.round(Math.atan2(o,u)/Math.PI*4);if(2===Math.abs(p))i||(e.price=l);else if(0===Math.abs(p)||4===Math.abs(p))i||(e.index=t.index);else{const t=Math.sqrt(o*o+u*u),i=o<0?-1:1,r=u<0?-1:1;let l=Math.max(Math.abs(u),Math.abs(o));l/=l*Math.sqrt(2)/t;const c=Math.round(s.coordinateToIndex(n+l*i)),p=Math.abs(s.indexToCoordinate(c)-n),_=a.coordinateToPrice(d+p*r,h);e.index=c,e.price=_}}_normalizePoint(e){return{...this._model.timeScale().normalizeBarIndex(e.index),price:e.price}}_normalizePoints(){this._timePoint=[];for(let e=0;e<this._points.length;e++)if(void 0!==this._points[e].index){const t=this._normalizePoint(this._points[e]);if(!t.time_t){this._timePoint=[];break}this._timePoint.push(t)}this._normalizedPointsChanged.fire()}_getStartBarAligner(){const e=this._model.mainSeries().interval();if(null===this._alignerCache||this._alignerCache.resolution!==this._model.mainSeries().interval()){const t=this._model.mainSeries().symbolInfo();if(!t)return null;this._alignerCache={resolution:e,aligner:(0,l.createTimeToBarTimeAligner)(e,t)}}return this._alignerCache.aligner}_utcTimeInCurrentResolution(e){if(void 0!==e.time){const t=this._model.timezoneExceptExchange().value();if(null!==t){const i=(0,c.cal_to_utc)((0,c.get_timezone)(t),new Date(1e3*e.time)),s=this._getStartBarAligner();return s?s(i)/1e3:null}}return null}_setPaneViews(e,t,i){if(this._isDestroyed)for(const t of e)t.destroy&&t.destroy();else this._paneViews.set(t,e),void 0!==t&&i&&t.onDestroyed().subscribe(this,(()=>this._destroyPanePaneViews(t))),this._model.lightUpdate()}_getPaneViews(e){return this._paneViews.get(e)||null}_updateAllPaneViews(e){this._paneViews.forEach((t=>{for(const i of t)i.update(e)}))}_alignPointHorizontallyOrVertically(e){const t=(0,r.ensureNotNull)(this.pointToScreenPoint(e)),i=(0,r.ensureDefined)((0,r.ensureNotNull)(this._startMovingPoint).logical),s=(0,r.ensureDefined)((0,r.ensureNotNull)(this._startMovingPoint).screen),n=Math.abs(s.x-t.x),o=Math.abs(s.y-t.y);if(n<10&&o<10)return e;return{index:n<o?i.index:e.index,price:n<o?e.price:i.price}}_alignScreenPointHorizontallyOrVertically(e){const t=(0,r.ensureDefined)((0,r.ensureNotNull)(this._startMovingPoint).screen),i=Math.abs(t.x-e.x),n=Math.abs(t.y-e.y);return i<10&&n<10?e:i<n?new s.Point(t.x,e.y):new s.Point(e.x,t.y)}_correctPoints(e,t){var i,s,n,o;const a=(0,r.ensure)(null===(i=this._currentMovingPoint)||void 0===i?void 0:i.screen),l=(0,r.ensure)(null===(s=this._startMovingPoint)||void 0===s?void 0:s.screen),c=a.subtract(l);if(c.length()<1&&!t)return!1;const h=Math.round((0,r.ensure)(null===(n=this._currentMovingPoint)||void 0===n?void 0:n.logical).index-(0,
r.ensure)(null===(o=this._startMovingPoint)||void 0===o?void 0:o.logical).index);for(const t of e){const e=(0,r.ensureNotNull)(this.pointToScreenPoint(t)).add(c);t.index=t.index+h,t.price=(0,r.ensureNotNull)(this.screenPointToPoint(e)).price}return!0}_correctFixedPoint(e){if(void 0===this._fixedPoint)return{didCorrect:!1,point:e};const t=(0,r.ensureDefined)((0,r.ensureNotNull)(this._currentMovingPoint).screen),i=(0,r.ensureDefined)((0,r.ensureNotNull)(this._startMovingPoint).screen),s=t.subtract(i);return s.length()>=1?{didCorrect:!0,point:e.add(s)}:{didCorrect:!1,point:e}}_currentPointsetIdWithPrefix(){return"pointset_"+(0,r.ensureNotNull)(this._currentPointsetAndSymbolId).pointsetId}_clearServerPoints(){null!==this._currentPointsetAndSymbolId&&this._model.chartApi().isConnected().value()&&this._model.chartApi().removePointset(this._currentPointsetIdWithPrefix()),this._currentPointsetAndSymbolId=null}_createPointProperty(e){const t=this._pointsProperty.childs().points;t.addProperty(""+e,{});const i=t[e];i.addChild("price",new M(this,e)),i.addChild("bar",new I.LineDataSourcePointIndexProperty(this,e))}_createPointsProperties(){this._pointsProperty=new S.Property,this._pointsProperty.addChild("points",new S.Property);for(let e=0;e<this.pointsCount();e++)this._createPointProperty(e)}_alignPointToRangeOfActualData(e){const t=(0,r.ensureNotNull)(this._model.mainSeries().bars().firstIndex()),i=(0,r.ensureNotNull)(this._model.mainSeries().bars().lastIndex());let s=Math.max(e.index,t);return s=Math.min(s,i),{...e,index:s}}_migrateSymbolProperty(e){const t=this._properties.childs();if(t.symbolStateVersion.value()<2){const i=(0,r.ensureNotNull)(this.ownerSource()),s=(0,r.ensureNotNull)(i.symbolSource()),n=this._model.mainSeries();if(s===n)return void t.symbolStateVersion.setValueSilently(2);if(null===n.symbolInfo())return;if(null===s.symbolInfo())return;n.symbolSameAsCurrent(t.symbol.value())&&t.symbol.setValueSilently((0,f.extractLineToolSymbolFromSymbolInfo)(e,s.symbol())),t.symbolStateVersion.setValueSilently(2)}}_migrateZOrder(){const e=this._properties.childs();e.zOrderVersion.value()<2&&(this.ownerSource()===this.model().mainSeries()&&this.setZorder(this.zorder()-this.model().mainSeries().obsoleteZOrder()),e.zOrderVersion.setValueSilently(2))}_preparePoint(e,t){const i=e;return t&&t.shift()&&this.points().length>=2&&this._snapTo45DegreesAvailable()&&this._snapPoint45Degree(i,this.points()[this.points().length-2]),i}_addPointIntenal(e,t,i){this._points.push(e);const s=this._points.length===this.pointsCount();return s?(this._lastPoint=null,i||(this._normalizePoints(),this.createServerPoints())):this._lastPoint=e,this._pointAdded.fire(this._points.length-1),s}_onSourceHiddenMayChange(){this.isSourceHidden()&&this._model.selectionMacro((e=>{e.removeSourceFromSelection(this)})),this._model.invalidate(p.InvalidationMask.validateAction((()=>{this!==this._model.lineBeingCreated()&&(this._isDestroyed||this.processHibernate())})))}_saveAlertIdInState(){return!0}_onPointsetUpdated(e){if(0!==e.length){for(let t=0;t<e.length;t++){
const i=e[t],s=this._timePoint[i.index],r={index:i.value[0],time:i.value[1],price:s.price};this._points.length<=i.index?(this._points.push(r),this._pointAdded.fire(this._points.length-1)):(this._points[i.index]=r,this._pointChanged.fire(i.index))}0,this._onPointsetUpdatedDelegate.fire(),this.updateAllViewsAndRedraw((0,x.sourceChangeEvent)(this.id()))}}_snapTo45DegreesAvailable(){return!1}_onMainSeriesSymbolResolved(){const e=this.ownerSource();null===e||this._model.mainSeries()===e.symbolSource()||this.isSourceHidden()||this.createServerPoints()}_readyToCreatePointset(){return this._timePoint.length>0}_propertiesStateExclusions(){return[]}_syncLineStyleIfNeeded(){const e=this.linkKey().value();!this._syncLineStyleMuted&&e&&(0,b.changeLineStyle)({linkKey:e,state:this.syncLineStyleState(),model:this._model})}_muteSyncLineStyle(){this._syncLineStyleMuted=!0}_unmuteSyncLineStyleWithoutApplyingChanges(){this.propertiesChanged(),this._syncLineStyleMuted=!1}_applyTemplateImpl(e){e.intervalsVisibilities=(0,m.mergeIntervalVisibilitiesDefaults)(e.intervalsVisibilities);const t=this.properties();t.applyTemplate(e,(0,E.factoryDefaults)(this.toolname.toLowerCase())),t.saveDefaults(),this.propertiesChanged()}_getPropertyDefinitionsViewModelClass(){return Promise.resolve(null)}_getAlertPlots(){return[]}_getUndoHistory(){return this._model.undoModel().undoHistory()}_synchronizeAlert(e){}_linePointsToAlertPlot(e,t,i,s){return null}_getAlertCreationAvailable(){return!1}static _configureProperties(e){if(this._addCollectedProperties(e),e.hasChild("symbolStateVersion")||e.addChild("symbolStateVersion",new S.Property(1)),e.hasChild("zOrderVersion")||e.addChild("zOrderVersion",new S.Property(1)),e.hasChild("visible")||e.addChild("visible",new S.Property(!0)),e.hasChild("frozen")||e.addChild("frozen",new S.Property(!1)),e.hasChild("symbol")||e.addChild("symbol",new S.Property("")),e.hasChild("currencyId")||e.addChild("currencyId",new S.Property(null)),e.hasChild("unitId")||e.addChild("unitId",new S.Property(null)),e.addExcludedKey("symbolStateVersion",1),e.addExcludedKey("zOrderVersion",1),e.addExcludedKey("visible",1),e.addExcludedKey("frozen",1),e.addExcludedKey("symbol",1),e.addExcludedKey("currencyId",1),e.addExcludedKey("unitId",1),e.hasChild("intervalsVisibilities")){const t=(0,P.merge)((0,P.clone)(g.intervalsVisibilitiesDefaults),e.childs().intervalsVisibilities.state());e.removeProperty("intervalsVisibilities"),e.addChild("intervalsVisibilities",new C.IntervalsVisibilitiesProperty(t))}else e.addChild("intervalsVisibilities",new C.IntervalsVisibilitiesProperty(g.intervalsVisibilitiesDefaults));e.hasChild("title")||e.addChild("title",new S.Property("")),e.addExcludedKey("symbolInfo",1),e.addExcludedKey("points",1),e.addExcludedKey("interval",1),e.addExcludedKey("title",1),e.hasChild("singleChartOnly")&&e.removeProperty("singleChartOnly"),e.hasChild("font")&&e.removeProperty("font")}static _addCollectedProperties(e){e.hasChild("linewidth")&&e.addChild("linesWidths",new k.LineToolWidthsProperty([(0,
r.ensureDefined)(e.child("linewidth"))])),e.hasChild("linecolor")&&e.addChild("linesColors",new k.LineToolColorsProperty([(0,r.ensureDefined)(e.child("linecolor"))])),e.hasChild("backgroundColor")&&e.addChild("backgroundsColors",new k.LineToolColorsProperty([(0,r.ensureDefined)(e.child("backgroundColor"))])),e.hasChild("textColor")&&e.addChild("textsColors",new k.LineToolColorsProperty([(0,r.ensureDefined)(e.child("textColor"))])),e.hasChild("linestyle")&&e.addChild("linesStyles",new k.LineToolCollectedProperty([(0,r.ensureDefined)(e.child("linestyle"))])),e.addExcludedKey("linesWidths",3),e.addExcludedKey("linesColors",3),e.addExcludedKey("backgroundsColors",3),e.addExcludedKey("textsColors",3),e.addExcludedKey("linesStyles",3)}_areAlertsOnLineToolProhibited(){return null!==this._ownerSource&&!this._ownerSource.canHasAlertOnLineTools()}_removeAlertSubscriptions(){var e;null===(e=this._unsubscribeAlertCallbacks)||void 0===e||e.call(this),this._unsubscribeAlertCallbacks=void 0}_addAlertSubscriptions(e,t={}){}_destroyPanePaneViews(e){const t=this._paneViews.get(e);if(void 0!==t)for(const e of t)e.destroy&&e.destroy();void 0!==e&&e.onDestroyed().unsubscribeAll(this),this._paneViews.delete(e)}_copyPricesWithoutNormalization(){const e=Math.min(this._points.length,this._timePoint.length);for(let t=0;t<e;t++)this._timePoint[t].price=this._points[t].price}async _getChartAlert(){throw new Error("not implemented")}async _syncAlertWithAlertFacade(e={}){try{const t=await this.getAlert();if(!t)return;if(this._addAlertSubscriptions(t,e),e.syncAlertFocus){const e=this._model.selection().isSelected(this);t.setSelected(e)}}catch(e){if(e instanceof Error&&"not_exists"===e.message&&this.hasAlert().value()){this._alertStatus.setValue(0);return void(await getChartAlertsFacade()).removeAlertFromAllChartsSilently(this.id(),(0,r.ensureDefined)(this._alertId))}V.logError("Failed to set alert, alert will not be saved with drawing in chart")}}}},73305:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LineToolCollectedProperty:()=>c,LineToolColorsProperty:()=>d,LineToolMultiplePropertyBaseImpl:()=>l,LineToolWidthsProperty:()=>h,MultipleLineColorsProperty:()=>_,MultipleLineWidthsProperty:()=>p});var s=i(31955),r=i(52033),n=i(34776);const o=(0,s.getLogger)("Chart.LineToolCollectedProperty");class a{applyValue(e,t){e.setValue(t)}}class l{constructor(e,t){this._onChange=new r.Delegate,this._properties=e,e.forEach(((e,t)=>e.subscribe(this,((e,i)=>{this._onChange.fire(this,`${t}.${i}`)})))),this._showIfProperty=t}visible(){var e;return!this._showIfProperty||(null===(e=this._showIfProperty)||void 0===e?void 0:e.value())}value(){if(0===this._properties.length)return o.logError("Incorrect call, should not request value of 0 properties"),"mixed";const e=this._properties[0].value();return 1===this._properties.length||this._properties.every((t=>t.value()===e))?e:"mixed"}state(){}merge(){}destroy(){this._properties.forEach((e=>e.unsubscribeAll(this))),this._onChange.destroy()}subscribe(e,t){this._onChange.subscribe(e,t)}unsubscribe(e,t){this._onChange.unsubscribe(e,t)}
unsubscribeAll(e){this._onChange.unsubscribeAll(e)}storeStateIfUndefined(){return!0}weakReference(){return(0,n.weakReference)(this)}ownership(){return(0,n.ownership)(this)}}class c extends l{setValue(e,t,i){if("mixed"===e)return;const s=null!=i?i:new a;this._properties.forEach((t=>s.applyValue(t,e)))}}class h extends c{}class d extends c{firstColor(){return this._properties[0].value()}}class u extends l{setValue(e,t,i){if("mixed"===e)return;const s=null!=i?i:new a;this._properties.forEach((t=>t.setValue(e,void 0,s)))}}class p extends u{}class _ extends u{}},19888:(e,t,i)=>{"use strict";t.LineToolFibRetracement=i(33168).LineToolFibRetracement,t.LineToolFibChannel=i(42851).LineToolFibChannel,t.LineToolFibSpeedResistanceArcs=i(88588).LineToolFibSpeedResistanceArcs,t.LineToolProjection=i(12120).LineToolProjection,t.LineToolTrendBasedFibExtension=i(68554).LineToolTrendBasedFibExtension,t.LineToolElliott=i(65365).LineToolElliott,t.LineToolFibCircles=i(57994).LineToolFibCircles,t.LineToolVertLine=i(56096).LineToolVertLine,t.LineToolCrossLine=i(92007).LineToolCrossLine,t.LineToolBarsPattern=i(81756).LineToolBarsPattern,t.LineToolTrendBasedFibTime=i(27172).LineToolTrendBasedFibTime,t.LineToolFibTimeZone=i(8532).LineToolFibTimeZone,t.LineToolCircleLines=i(82407).LineToolCyclicLines,t.LineToolDateRange=i(42214).LineToolDateRange,t.LineToolPriceRange=i(23234).LineToolPriceRange,t.LineToolDateAndPriceRange=i(70791).LineToolDateAndPriceRange,t.LineToolParallelChannel=i(56621).LineToolParallelChannel,t.LineToolTrendAngle=i(83776).LineToolTrendAngle,t.LineToolTrendLine=i(99294).LineToolTrendLine,t.LineToolInfoLine=i(51065).LineToolInfoLine,t.LineToolArrowMark=i(27621).LineToolArrowMark,t.LineToolExecution=i(56991).LineToolExecution,t.LineToolPitchfan=i(83779).LineToolPitchfan,t.LineToolGannSquare=i(9770).LineToolGannSquare,t.LineToolFibSpeedResistanceFan=i(20701).LineToolFibSpeedResistanceFan,t.LineToolGannComplex=i(99083).LineToolGannComplex,t.LineToolGannFixed=i(8308).LineToolGannFixed,t.LineToolGannFan=i(85259).LineToolGannFan,t.LineToolFibWedge=i(23591).LineToolFibWedge,t.LineToolPitchfork=i(64002).LineToolPitchfork,t.LineToolDisjointAngle=i(57897).LineToolDisjointChannel,t.LineToolFlatBottom=i(90921).LineToolFlatBottom,t.LineToolIcon=i(15510).LineToolIcon,t.LineToolEmoji=i(72939).LineToolEmoji,t.LineToolSticker=i(86915).LineToolSticker,t.LineToolRotatedRectangle=i(23550).LineToolRotatedRectangle,t.LineToolFibSpiral=i(84023).LineToolFibSpiral,t.LineToolHeadAndShoulders=i(47267).LineToolHeadAndShoulders,t.LineToolTriangle=i(39737).LineToolTriangle,t.LineToolTrianglePattern=i(33865).LineToolTrianglePattern,t.LineTool5PointsPattern=i(17658).LineTool5PointsPattern,t.LineToolThreeDrivers=i(46660).LineToolThreeDrivers,t.LineToolABCD=i(30906).LineToolABCD,t.LineToolPolyline=i(51691).LineToolPolyline,t.LineToolPath=i(14150).LineToolPath,t.LineToolPrediction=i(29356).LineToolPrediction,t.LineToolPriceLabel=i(83710).LineToolPriceLabel,t.LineToolPriceNote=i(16299).LineToolPriceNote,t.LineToolNote=i(2341).LineToolNote,
t.LineToolNoteAbsolute=i(2341).LineToolNoteAbsolute,t.LineToolArrowMarker=i(66403).LineToolArrowMarker,t.LineToolSignpost=i(28820).LineToolSignpost,t.LineToolBrush=i(28462).LineToolBrush,t.LineToolArc=i(87654).LineToolArc,t.LineToolCallout=i(62828).LineToolCallout,t.LineToolBalloon=i(11924).LineToolBalloon,t.LineToolComment=i(74451).LineToolComment,t.LineToolText=i(424).LineToolText,t.LineToolHorzLine=i(43636).LineToolHorzLine,t.LineToolHorzRay=i(47845).LineToolHorzRay,t.LineToolRectangle=i(34054).LineToolRectangle,t.LineToolCircle=i(17333).LineToolCircle,t.LineToolEllipse=i(59002).LineToolEllipse,t.LineToolTimeCycles=i(97409).LineToolTimeCycles,t.LineToolSineLine=i(8066).LineToolSineLine,t.LineToolGhostFeed=i(37968).LineToolGhostFeed,t.LineToolBezierQuadro=i(28904).LineToolBezierQuadro,t.LineToolBezierCubic=i(20925).LineToolBezierCubic,t.LineToolArrow=i(96068).LineToolArrow,t.LineToolRay=i(36224).LineToolRay,t.LineToolExtended=i(6921).LineToolExtended,t.LineToolSchiffPitchfork=i(63533).LineToolSchiffPitchfork,t.LineToolSchiffPitchfork2=i(68802).LineToolSchiffPitchfork2,t.LineToolInsidePitchfork=i(20690).LineToolInsidePitchfork,t.LineToolTextAbsolute=i(424).LineToolTextAbsolute,t.LineToolArrowMarkLeft=i(27621).LineToolArrowMarkLeft,t.LineToolArrowMarkRight=i(27621).LineToolArrowMarkRight,t.LineToolArrowMarkUp=i(27621).LineToolArrowMarkUp,t.LineToolArrowMarkDown=i(27621).LineToolArrowMarkDown,t.LineToolFlagMark=i(41124).LineToolFlagMark,t.LineToolCypherPattern=i(16628).LineToolCypherPattern,t.LineToolElliottImpulse=i(65365).LineToolElliottImpulse,t.LineToolElliottTriangle=i(65365).LineToolElliottTriangle,t.LineToolElliottTripleCombo=i(65365).LineToolElliottTripleCombo,t.LineToolElliottCorrection=i(65365).LineToolElliottCorrection,t.LineToolElliottDoubleCombo=i(65365).LineToolElliottDoubleCombo,t.LineToolRiskRewardLong=i(82650).LineToolRiskRewardLong,t.LineToolRiskRewardShort=i(82650).LineToolRiskRewardShort,t.LineToolPosition=i(40265).LineToolPosition,t.LineToolOrder=i(64732).LineToolOrder,t.LineToolHighlighter=i(65539).LineToolHighlighter},81776:(e,t,i)=>{"use strict";i.d(t,{LineToolTradingPriceAxisView:()=>r});var s=i(90793);class r extends s.LineToolPriceAxisView{_formatPrice(e,t){return this._source.formatter().format(e)}}},15511:(e,t,i)=>{"use strict";i.d(t,{LineToolWithRelativePriceCoordinate:()=>f,getNoDataPosition:()=>m,getSeriesPosition:()=>g,positionToCoordinate:()=>u});var s,r,n=i(50151),o=i(8025),a=i(10568),l=i(928);function c(e,t,i){const s=e.barFunction();switch(e.style()){case 3:case 10:case 2:case 14:case 15:return s(t.value);default:return t.value[-1===i?3:2]}}function h(e){return e>=0?1:-1}function d(e,t){return-1===h(e)!==t?-1:1}function u(e,t,i,s){const r=Math.min(t,Math.max(0,1===s?i:t-i));return i-s*Math.abs(r*e/100)}function p(e,t,i){const s=e.index();return null===s?null:{index:s,price:t.coordinateToPrice(t.height()/2,i)}}function _(e,t){const i=e.data().bars(),s=i.first(),r=i.last();if(null===s||null===r)return null;let n;const a=t.index();if(null===a){if(void 0===t.time)return null
;const e=t.time(),a=s.value[0],l=r.value[0];if(e<a-86400||e>l)return null;n=i.searchByTime(e,o.PlotRowSearchMode.NearestRight,4)}else n=i.search(a);return null===n?null:{index:n.index,price:c(e,n,h(t.position()))}}function m(e,t,i,s){const r=p(e,t,s);if(null===r)return null;const n=d(e.position(),t.isInverted());return{index:r.index,price:r.price,poleStartY:t.height(),visualDirection:1,positionPointDirection:n,startsOnSeriesData:!1,priceCoordinate:t.priceToCoordinate(r.price,s),indexCoordinate:i.indexToCoordinate(r.index)}}function g(e,t,i=!0){const s=_(e,t),r=e.priceScale(),o=e.model().timeScale(),a=(0,n.ensureNotNull)(e.firstValue());if(null===s)return m(t,r,o,a);let l=0;const c=e.properties().childs(),h=r.priceToCoordinate(s.price,a),u=d(t.position(),r.isInverted());if(i)switch(e.style()){case 16:l=1===u?c.hlcAreaStyle.childs().highLineWidth.value()/2:c.hlcAreaStyle.childs().lowLineWidth.value()/2;break;case 3:l=c.areaStyle.childs().linewidth.value()/2;break;case 2:l=c.lineStyle.childs().linewidth.value()/2;break;case 14:l=c.lineWithMarkersStyle.childs().linewidth.value()/2;break;case 15:l=c.steplineStyle.childs().linewidth.value()/2;break;case 10:const e=Math.abs(100-c.baselineStyle.childs().baseLevelPercentage.value());l=r.height()*e/100>h?c.baselineStyle.childs().topLineWidth.value()/2:c.baselineStyle.childs().bottomLineWidth.value()/2;break;case 1:case 9:case 8:case 12:case 4:case 7:l=3;break;case 0:l=c.barStyle.childs().thinBars.value()?3:Math.max(3,.25*o.barSpacing());break;case 11:l=c.rangeStyle.childs().thinBars.value()?3:Math.max(3,.25*o.barSpacing());break;case 5:l=Math.max(4,.25*o.barSpacing());break;case 6:l=Math.max(5,.25*o.barSpacing())}const p=h-u*l;return{index:s.index,price:s.price,poleStartY:p,visualDirection:u,positionPointDirection:u,startsOnSeriesData:!0,priceCoordinate:h,indexCoordinate:o.indexToCoordinate(s.index)}}!function(e){e[e.Label=0]="Label",e[e.Body=1]="Body"}(s||(s={})),function(e){e[e.OneDaySeconds=86400]="OneDaySeconds"}(r||(r={}));class f extends a.InplaceTextLineDataSource{constructor(){super(...arguments),this._startMovingAnchorY=NaN}priceSource(){return this.ownerSource()}editableTextProperties(){(0,n.assert)(!1,"unexpected method call")}addPoint(e,t,i){return super.addPoint(this._updatePositionAndCorrectPoint(e),t,i)}setPoint(e,t,i){super.setPoint(e,this._updatePositionAndCorrectPoint(t,!this.isPhantom()&&!this._allowChangeAnchorHorizontally()),i),this._syncPosition()}setPointAndChangeIndex(e,t,i){super.setPoint(e,this._updatePositionAndCorrectPoint(t,!1),i),this._syncPosition()}startMoving(e,t,i,s){s||(this._startMovingAnchorY=(0,n.ensureNotNull)(this._anchorYCoordinate())),super.startMoving(e,t,i)}move(e,t,i,s){var r;const o=(0,n.ensureDefined)((0,n.ensureNotNull)(this.startMovingPoint()).logical),a=(0,n.ensureDefined)(e.logical);if(!s&&0===t){const e=this._points[0],t=a.index-o.index,i=(0,n.ensureNotNull)(this.priceScale()),s=(0,
n.ensure)(null===(r=this.ownerSource())||void 0===r?void 0:r.firstValue()),l=i.priceToCoordinate(a.price,s)-i.priceToCoordinate(o.price,s),c=this._startMovingAnchorY+l,h=i.coordinateToPrice(c,s);this._updatePositionAndCorrectPoint({index:e.index+t,price:h})}super.move(e,t,i),s||this._syncPosition()}_allowChangeAnchorHorizontally(){return!1}_updatePositionAndCorrectPoint(e,t){t&&(e.index=this._points[0].index);const i=this.priceSource();if(null===i)return e;const s=i.priceScale(),r=i.firstValue();if(null===s||s.isEmpty()||null===r)return e;const n=s.height();let o=n/2,a=e.price>=s.coordinateToPrice(o,r)?1:-1;const l=this._model.mainSeries();if(i===l){const t=l.data().search(this._baseSeriesIndexForPoint(e));if(null!==t){const i=c(l,t,-1),n=c(l,t,1);a=e.price>=i?1:-1,o=s.priceToCoordinate(1===a?n:i,r),e.price=1===a?Math.max(n,e.price):e.price}}const h=1===(-1===a!==s.isInverted()?-1:1)?o:n-o,d=s.priceToCoordinate(e.price,r),u=Math.min(n,Math.abs(d-o)),p=Math.max(0,Math.min(100,100*u/h))*a;return this.properties().childs().position.setValue(p),e}_baseSeriesIndexForPoint(e){return e.index}_syncPosition(){const e=this.linkKey().value();if(null!==e){const t={position:this.properties().childs().position.value()};(0,l.changeLineStyle)({linkKey:e,state:t,model:this._model})}}_anchorYCoordinate(){const e=this.priceSource();if(null===e)return null;const t=e.priceScale(),i=e.firstValue();if(null===t||t.isEmpty()||null===i)return null;const s=this._model.mainSeries(),r=this.customEvent();if(null===r)return null;let n=null;if(e===s&&(n=_(s,r)),null===n&&(n=p(r,t,i)),null===n)return null;const o=r.position(),a=t.priceToCoordinate(n.price,i);return u(o,t.height(),a,d(o,t.isInverted()))}}},98523:(e,t,i)=>{"use strict";i.d(t,{lineToolsLocalizedNames:()=>r});var s=i(11542);const r={LineTool5PointsPattern:s.t(null,void 0,i(42231)),LineToolABCD:s.t(null,void 0,i(46712)),LineToolArc:s.t(null,void 0,i(59324)),LineToolArrow:s.t(null,void 0,i(11858)),LineToolArrowMarkDown:s.t(null,void 0,i(73193)),LineToolArrowMarkLeft:s.t(null,void 0,i(1949)),LineToolArrowMarkRight:s.t(null,void 0,i(86275)),LineToolArrowMarkUp:s.t(null,void 0,i(62453)),LineToolBalloon:s.t(null,void 0,i(70540)),LineToolComment:s.t(null,void 0,i(9818)),LineToolBarsPattern:s.t(null,void 0,i(81994)),LineToolBezierCubic:s.t(null,void 0,i(77125)),LineToolBezierQuadro:s.t(null,void 0,i(78609)),LineToolBrush:s.t(null,void 0,i(43539)),LineToolCallout:s.t(null,void 0,i(25381)),LineToolCircleLines:s.t(null,void 0,i(84031)),LineToolCypherPattern:s.t(null,void 0,i(93191)),LineToolDateAndPriceRange:s.t(null,void 0,i(47017)),LineToolDateRange:s.t(null,void 0,i(85444)),LineToolDisjointAngle:s.t(null,void 0,i(91544)),LineToolElliottCorrection:s.t(null,void 0,i(80943)),LineToolElliottDoubleCombo:s.t(null,void 0,i(75112)),LineToolElliottImpulse:s.t(null,void 0,i(61114)),LineToolElliottTriangle:s.t(null,void 0,i(72359)),LineToolElliottTripleCombo:s.t(null,void 0,i(76129)),LineToolEllipse:s.t(null,void 0,i(78996)),LineToolExtended:s.t(null,void 0,i(52788)),
LineToolFibChannel:s.t(null,void 0,i(59005)),LineToolFibCircles:s.t(null,void 0,i(82330)),LineToolFibRetracement:s.t(null,void 0,i(55986)),LineToolFibSpeedResistanceArcs:s.t(null,void 0,i(33880)),LineToolFibSpeedResistanceFan:s.t(null,void 0,i(2395)),LineToolFibSpiral:s.t(null,void 0,i(39014)),LineToolFibTimeZone:s.t(null,void 0,i(30622)),LineToolFibWedge:s.t(null,void 0,i(85042)),LineToolFlagMark:s.t(null,void 0,i(14600)),LineToolImage:s.t(null,void 0,i(68065)),LineToolFlatBottom:s.t(null,void 0,i(45051)),LineToolAnchoredVWAP:s.t(null,void 0,i(84541)),LineToolGannComplex:s.t(null,void 0,i(44763)),LineToolGannFixed:s.t(null,void 0,i(60707)),LineToolGannFan:s.t(null,void 0,i(48683)),LineToolGannSquare:s.t(null,void 0,i(47460)),LineToolHeadAndShoulders:s.t(null,void 0,i(21928)),LineToolHorzLine:s.t(null,void 0,i(21795)),LineToolHorzRay:s.t(null,void 0,i(25487)),LineToolIcon:s.t(null,void 0,i(37913)),LineToolEmoji:s.t(null,void 0,i(73456)),LineToolSticker:s.t(null,void 0,i(43114)),LineToolInsidePitchfork:s.t(null,void 0,i(41686)),LineToolNote:s.t(null,void 0,i(94389)),LineToolNoteAbsolute:s.t(null,void 0,i(63209)),LineToolSignpost:s.t(null,void 0,i(67751)),LineToolParallelChannel:s.t(null,void 0,i(59256)),LineToolPitchfan:s.t(null,void 0,i(34156)),LineToolPitchfork:s.t(null,void 0,i(19634)),LineToolPolyline:s.t(null,void 0,i(39949)),LineToolPath:s.t(null,void 0,i(371)),LineToolPrediction:s.t(null,void 0,i(20138)),LineToolPriceLabel:s.t(null,void 0,i(91282)),LineToolArrowMarker:s.t(null,void 0,i(36352)),LineToolPriceRange:s.t(null,void 0,i(68941)),LineToolProjection:s.t(null,void 0,i(75747)),LineToolRay:s.t(null,void 0,i(50318)),LineToolRectangle:s.t(null,void 0,i(26001)),LineToolCircle:s.t(null,void 0,i(91944)),LineToolRegressionTrend:s.t(null,void 0,i(2460)),LineToolRiskRewardLong:s.t(null,void 0,i(74832)),LineToolRiskRewardShort:s.t(null,void 0,i(8075)),LineToolFixedRangeVolumeProfile:s.t(null,{context:"study"},i(25705)),LineToolAnchoredVolumeProfile:s.t(null,{context:"study"},i(89633)),LineToolRotatedRectangle:s.t(null,void 0,i(56820)),LineToolSchiffPitchfork:s.t(null,void 0,i(57681)),LineToolSchiffPitchfork2:s.t(null,void 0,i(42608)),LineToolSineLine:s.t(null,void 0,i(39090)),LineToolText:s.t(null,{context:"tool"},i(91405)),LineToolTextAbsolute:s.t(null,void 0,i(42669)),LineToolThreeDrivers:s.t(null,void 0,i(46982)),LineToolTimeCycles:s.t(null,void 0,i(46852)),LineToolTrendAngle:s.t(null,void 0,i(35757)),LineToolTrendBasedFibExtension:s.t(null,void 0,i(80583)),LineToolTrendBasedFibTime:s.t(null,void 0,i(72159)),LineToolTrendLine:s.t(null,void 0,i(97339)),LineToolInfoLine:s.t(null,void 0,i(15992)),LineToolTriangle:s.t(null,void 0,i(1671)),LineToolTrianglePattern:s.t(null,void 0,i(90148)),LineToolVertLine:s.t(null,void 0,i(29535)),LineToolCrossLine:s.t(null,void 0,i(74334)),LineToolHighlighter:s.t(null,void 0,i(69476)),LineToolPriceNote:s.t(null,void 0,i(97512)),LineToolVbPFixed:s.t(null,void 0,i(40693)),LineToolGhostFeed:s.t(null,void 0,i(46808))}},15491:(e,t,i)=>{"use strict";i.d(t,{lineToolsStudyIds:()=>s})
;const s={LineToolAnchoredVWAP:"AnchoredVWAP@tv-basicstudies",LineToolRegressionTrend:"RegressionTrend@tv-basicstudies",LineToolFixedRangeVolumeProfile:"VbPFixed@tv-basicstudies",LineToolVbPFixed:"VbPFixed@tv-volumebyprice"}},630:(e,t,i)=>{"use strict";i.r(t),i.d(t,{cloneLineTool:()=>Ve,createLineTool:()=>Ce,createLineToolProperties:()=>xe,createStudyLineToolProperties:()=>Te,getNewToolProperties:()=>ve,initAllLineToolsFromContent:()=>we,initLineTool:()=>be,isEditableTextLineTool:()=>De,isLineTool:()=>Me,isStudyLineTool:()=>Ae,isTrading:()=>Le,lineToolByLinkKey:()=>Be,prepareLineToolPropertiesByOwnerSource:()=>Pe,setNewToolProperties:()=>ge,supportsPhantomMode:()=>Ie,tryFindStudyLineToolNameByStudyId:()=>Ee,unsetNewToolProperties:()=>fe});var s=i(98279),r=i(50151),n=i(86441),o=i(10892),a=i(64755),l=i(29875),c=i(55917),h=i(68159),d=i(14019),u=i(65383),p=i(71838),_=i(67317);class m extends p.StudyDataSource{constructor(e,t,i,s){super(e,t.seriesSource(),i,s),this._series=t}_createStudyError(e){var t;return(0,_.createStudyError)(this._getStudyErrorDescription(e),null===(t=this._series.symbolInfo())||void 0===t?void 0:t.exchange)}}var g=i(16685),f=i(60107),v=i(44672),y=i(678),S=i(27538);class b extends S.StatusProviderBase{constructor(e){super(),this._source=e}errorStatus(){const e=this._source.status();return e.type===y.StudyStatusType.Error?{error:this.sourceStatusText(),solutionId:(0,y.studyStatusSolutionId)(e),title:(0,y.studyStatusTitle)(e),studyFeature:(0,y.studyStatusFeature)(e)}:null}getSplitTitle(){return this._source.titleInParts()}text(){return this._source.translatedType()}sourceStatusText(){return(0,y.convertStudyStatusToString)(this._source.status(),!0)}}var w=i(62288),C=i(27777);class P extends C.StatusView{constructor(e){super(e.statusProvider({}))}getSplitTitle(){return this._statusProvider.getSplitTitle()}}class x extends l.LineDataSource{constructor(e,t,s,r,n,o){super(e,r,n,o),this._indexes=null,this._inputs=null,this._definitionsViewModel=null,this._pointsetPoints=null,this._loadedPlots=null,this._loadedGraphics=null,this._beingCreatedPaneView=null,this._anchorsPaneView=null,this._isLegendDisplayed=!1,Promise.all([Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,8938)),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,19583))]).then((t=>{const{LineToolBeingCreatedPaneView:i}=t[0],{StudyLineDataSourceAnchorsPaneView:s}=t[1];this._beingCreatedPaneView=new i(this,e),this._anchorsPaneView=new s(this,this.model()),this._model.lightUpdate()})),this._metaInfo=t,this._dataSource=new m(e.chartApi(),e.mainSeries(),s,t),this._dataSource.dataCleared().subscribe(this,this._onDataCleared),this._dataSource.dataUpdated().subscribe(this,this._onDataUpdated),this._dataSource.studyStatusChanged().subscribe(this,this._onStudyStatusChanged),this._statusProvider=new b(this),this._statusView=new P(this),this._showStudyArgumentsProperty=e.properties().childs().paneProperties.childs().legendProperties.childs().showStudyArguments}isDisplayedInLegend(){return this._isLegendDisplayed}titleInParts(){const e=[]
;if(this._showStudyArgumentsProperty.value()&&this._inputs)for(const t of this._metaInfo.inputs){if(!0===t.isHidden||"bool"===t.type)continue;const i=this._inputs[t.id];e.push(i.toString())}return[this.name(),e]}destroy(){this._dataSource.dataUpdated().unsubscribeAll(this),this._dataSource.dataCleared().unsubscribeAll(this),this._dataSource.studyStatusChanged().unsubscribeAll(this),this._dataSource.destroy(),null!==this._definitionsViewModel&&(this._definitionsViewModel.destroy(),this._definitionsViewModel=null),this._unsubscribeApplyInputsOnSeriesCompleted(),this._isDestroyed=!0,super.destroy()}stop(){super.stop(),this._isDestroyed||(this._dataSource.stop(),this.clearData())}start(){super.start(),this._isDestroyed||null===this._inputs||this._dataSource.start()}metaInfo(){return this._metaInfo}graphicsInfo(){return this._metaInfo.graphics}series(){return this._model.mainSeries()}translatedType(){return this._metaInfo.description}name(){return this._metaInfo.description}studyId(){return this._metaInfo.id}setPoint(e,t,i){super.setPoint(e,this._preparePoint(t,i))}move(e){}clearData(){this._clearAllDataExceptPointsetPoints(),this._pointsetPoints=null,this.updateAllViews((0,v.sourceChangeEvent)({sourceId:this.id(),clearData:!0})),super.clearData()}data(){return this.plots()}plots(){return this._loadedPlots||this._dataSource.plots()}graphics(){return this._loadedGraphics||this._dataSource.graphics()}valueAt(e,t){var i,s;return null!==(s=null===(i=this.ownerSource())||void 0===i?void 0:i.symbolSource().valueAt(e,t))&&void 0!==s?s:null}firstValue(){return this._model.mainSeries().firstValue()}state(e){const t={...super.state(e),metaInfo:this.metaInfo().state()};return e&&(t.data=this.plots().state(),t.nonseriesindexes=this._indexes,t.graphics=(0,d.saveStudyGraphics)(this.graphics(),null)),t}restoreData(e){var t;void 0!==e.data&&(this._loadedPlots=new a.PlotList((0,f.studyPlotFunctionMap)(this._metaInfo),f.studyEmptyPlotValuePredicate),this._loadedPlots.restoreState(e.data)),this._indexes=null!==(t=e.nonseriesindexes)&&void 0!==t?t:this._indexes,this._loadedGraphics=e.graphics?(0,d.loadStudyGraphics)(e.graphics):this._loadedGraphics}getPropertyDefinitionsViewModel(){return null===this._definitionsViewModel?this._getPropertyDefinitionsViewModelClass().then((e=>null===e||this._isDestroyed?null:(null===this._definitionsViewModel&&(this._definitionsViewModel=new e(this._model.undoModel(),this)),this._definitionsViewModel))):Promise.resolve(this._definitionsViewModel)}paneViews(e){let t=[];if(this.isSourceHidden())return t;if(this._isReady()&&this._changeStatesStack.isEmpty()){const i=super.paneViews(e);null!==i&&(t=t.concat(i))}else null!==this._beingCreatedPaneView&&t.push(this._beingCreatedPaneView);return null!==this._anchorsPaneView&&t.push(this._anchorsPaneView),t}propertiesChanged(e){super.propertiesChanged(e),this._onStudyInputsMayChange()}dataAndViewsReady(){return super.dataAndViewsReady()&&this._isReady()}endChanging(e,t){const i=super.endChanging(e,t)
;return i.indexesChanged?this.clearData():this._updateAnchorsPrice(!0),i}moveData(e){this._dataSource.moveData(e)}restorePoints(e,t,i){super.restorePoints(e,t,i),this._updateAnchorsPrice(!0)}statusProvider(e){return this._statusProvider}statusView(){return this._statusView}legendView(){return null}dataProblemModel(){return null}dataUpdatedModeModel(){return null}marketStatusModel(){return null}onStatusChanged(){return this._dataSource.studyStatusChanged()}status(){return this._dataSource.studyStatus()}recalcStudyIfNeeded(){}static createPropertiesFromStudyMetaInfoAndState(e,t,i,s){const r=(0,_.prepareStudyPropertiesForLoadChart)(e,t,i,s);return this._configureProperties(r),r}_onStudyStatusChanged(e,t){let i;switch(t.type){case g.StudyStatusType.Error:i=!0;break;case g.StudyStatusType.Completed:i=!1;break;default:return}if(i===this._isLegendDisplayed)return;this._isLegendDisplayed=i;const s=this._model.paneForSource(this);if(s){const e=this._model.panes().indexOf(s),t=w.InvalidationMask.invalidateLegendWidgetLayout(e);this.model().invalidate(t)}}_studyId(){return this._dataSource.studyId()}_isReady(){return!0}_updateAllPaneViews(e){var t,i;super._updateAllPaneViews(e),null===(t=this._beingCreatedPaneView)||void 0===t||t.update(),null===(i=this._anchorsPaneView)||void 0===i||i.update(e)}_getPointTime(e,t){const i=e.index,s=this._model.timeScale().indexToTimePoint(i);return null!==s?s:t||void 0===e.time?null:this._utcTimeInCurrentResolution(e)}_updateAnchorsPrice(e){}_onPointsetUpdated(e){super._onPointsetUpdated(e),this._pointsetPoints=this._points.map((e=>({price:e.price,index:e.index,time:e.time}))),this._onStudyInputsMayChange()}_onDataCleared(){this.updateAllViews((0,v.sourceChangeEvent)({sourceId:this.id(),clearData:!0})),this._model.updateSource(this)}_onDataUpdated(e,t,i){var s;this._updateAnchorsPrice(),this.updateAllViews((0,v.sourceChangeEvent)({sourceId:this.id(),firstUpdatedTimePointIndex:null===(s=e[0])||void 0===s?void 0:s.index})),this._model.updateSource(this)}_onStudyInputsMayChange(){let e=null;if(null!==this._pointsetPoints&&this._pointsetPoints.length===this.pointsCount()&&(e=this._studyInputs(this._pointsetPoints),null===e&&(this._clearAllDataExceptPointsetPoints(),this.updateAllViews((0,v.sourceChangeEvent)(this.id())))),null!==e){const t=this.metaInfo().inputs.map((e=>e.id)),i=Object.keys(e);for(const s of i)t.includes(s)||delete e[s]}this._areInputsEqual(this._inputs,e)||this._applyStudyInputs(e)}_preparePoint(e,t){return super._preparePoint(this._alignPointToRangeOfActualData(e),t)}_getPropertyDefinitionsViewModelClass(){return Promise.resolve(null)}_subscribeApplyInputsOnSeriesCompleted(){this._unsubscribeApplyInputsOnSeriesCompleted(),this._model.mainSeries().dataEvents().completed().subscribe(this,(()=>this._onStudyInputsMayChange()),!0)}_unsubscribeApplyInputsOnSeriesCompleted(){this._model.mainSeries().dataEvents().completed().unsubscribeAll(this)}_onInputsChanged(){0}_clearAllDataExceptPointsetPoints(){this._inputs=null,this._dataSource.clearData(),this._loadedPlots=null,
this._indexes=null,this._loadedGraphics=null}static _createPropertiesFromStudyIdAndState(e,t){const i=h.StudyMetaInfo.getStudyPropertyRootNameById(e),s=new c.DefaultProperty({defaultName:i,state:t});return this._configureProperties(s),s}static _configureProperties(e){super._configureProperties(e),e.removeExcludedKey("intervalsVisibilities",1)}_areInputsEqual(e,t){return null===t?null===e:null!==e&&(0,u.areStudyInputsEqual)(this._metaInfo.inputs,e,t)}_applyStudyInputs(e){const t=this._inputs;this._inputs=e,null!==e&&(this._unsubscribeApplyInputsOnSeriesCompleted(),this._dataSource.setInputs(e),null===t&&this.isStarted()&&!this._dataSource.isStarted()&&this._dataSource.start()),this._onInputsChanged()}}var T=i(19888),I=i.t(T,2),M=i(37265),A=i(12988),L=i(93280),k=i(73305),D=i(16227);class E extends D.StudyPriceAxisView{_showPaneLabel(){return!1}_showAxisLabel(){const e=this._model.properties().childs().scalesProperties.childs();return this._visible()&&"VWAP"===this._data.plotIndex&&e.showStudyLastValue.value()}_visible(){const e=this._source.properties().childs().styles.childs()[this._data.plotIndex].childs().display.value();return this._source.properties().childs().axisLabelVisible.value()&&Boolean(4&e)}}var V=i(78198);class B extends V.StudyPlotPaneView{constructor(e,t,i,s){super(e,t,i,s),this._line=e}_makeSureRendererIsValid(){(this._dataInvalidated||this._viewportInvalidated)&&this._updateImplFull(this._viewportInvalidated)&&(this._dataInvalidated=null),this._viewportInvalidated=!1}_updateRenderer(e,t){super._updateRenderer(e,t),this._addAlertsRenderer()}_addAlertsRenderer(){return!1}}var R,N=i(31955);!function(e){e.MainSeries="MainSeries",e.Study="Study",e.StudyLineTool="StudyLineTool",e.StudyStrategy="StudyStrategy",e.ReplayStudyStrategy="ReplayStudyStrategy"}(R||(R={}));var O=i(46463),F=(i(86129),i(3308)),W=i(8025);class H extends x{lastValueData(e,t,i){const s={noData:!0},n=this.priceScale();if(this._model.timeScale().isEmpty()||null===this.priceScale()||null===n||n.isEmpty()||this.plots().isEmpty())return s;const o=this._model.timeScale().visibleBarsStrictRange();if(null===o)return s;const a=this._studyProps();if(!a.childs().visible.value())return s;const l=this.plots().search(o.lastBar(),W.PlotRowSearchMode.NearestLeft,1);if(null===l)return s;const c=o.contains(l.index),h=!t&&c?l:(0,r.ensureNotNull)(this.plots().last()),d=this.metaInfo().plots.findIndex((t=>t.id===e));if(d<0||!h||!(0,F.default)(h.value[d+1]))return s;const u=h.value[d+1];if(null==u)return s;const p=(0,r.ensureDefined)(a.childs().styles.child(e)),_=(0,r.ensureNotNull)(this.firstValue()),m=n.priceToCoordinate(u,_);return{...n.getFormattedValues(u,_),noData:!1,price:u,color:p.childs().color.value(),coordinate:m,floatCoordinate:m,index:h.index}}priceLabelText(e){const t=(0,r.ensureDefined)(this._metaInfo.styles);return(0,r.ensureDefined)(t[e]).title}offset(e){return 0}getMinFirstBarIndexForPlot(){return-1/0}isPlotVisibleAt(e,t){return(this._studyProps().childs().styles.childs()[e].childs().display.value()&t)===t}_studyProps(){
return this.properties()}}var z=i(65458),U=i(16638),j=i(15491);const G=(0,N.getLogger)("Chart.AnchoredVWAP"),q=(0,r.ensureDefined)(j.lineToolsStudyIds.LineToolAnchoredVWAP);function $(e,t,i,s){return"calculate_stDev"in(0,r.ensureDefined)(e.inputs)||void 0===s.inputs.find((e=>"calculate_stDev"===e.id))||((0,r.ensureDefined)(t.inputs).calculate_stDev=!1),t.styles&&(K(t.styles.VWAP),K(t.styles.UpperBand),K(t.styles.LowerBand),K(t.styles.UpperBand_2),K(t.styles.LowerBand_2),K(t.styles.UpperBand_3),K(t.styles.LowerBand_3)),t}function K(e){void 0!==e&&void 0!==e.visible&&(e.display=e.visible?15:0,delete e.visible)}class Y extends H{constructor(e,t,i,s,n){i=i||(0,r.ensureNotNull)((0,U.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:q}));const o=null!=t?t:Y.createProperties();super(e,i,"anchoredvwap",o,s,n);const[a,l,c,h,d,u,p]=this.metaInfo().plots,_=e.mainSeries(),m=[new B(this,_,e,a.id)];l&&c&&(m.push(new V.StudyPlotPaneView(this,_,e,l.id)),m.push(new V.StudyPlotPaneView(this,_,e,c.id))),h&&d&&u&&p&&(m.push(new V.StudyPlotPaneView(this,_,e,h.id)),m.push(new V.StudyPlotPaneView(this,_,e,d.id)),m.push(new V.StudyPlotPaneView(this,_,e,u.id)),m.push(new V.StudyPlotPaneView(this,_,e,p.id))),this._properties.childs().areaBackground&&m.splice(0,0,new O.AreaBackgroundPaneView(this,e)),this._priceAxisViews=this.metaInfo().plots.map((e=>new E(this,{plotIndex:e.id}))),m.push(...this._priceAxisViews.map((e=>new z.PanePriceAxisView(e,this,this._model)))),this._anchorPriceCalculated=!1,this._onInputsReadyCallbacks=[],this._setPaneViews(m),e.properties().childs().scalesProperties.childs().showStudyLastValue.subscribe(this,this._onShowStudyLastValueChanged),o.onRestoreFactoryDefaults().subscribe(this,this._onRestoreFactoryDefaults),this._hasAlert.subscribe(this.processHibernate.bind(this),{callWithLast:!0})}destroy(){this.properties().onRestoreFactoryDefaults().unsubscribeAll(this),this.model().properties().childs().scalesProperties.childs().showStudyLastValue.unsubscribeAll(this),this._onInputsReadyCallbacks=[],super.destroy()}canHasAlert(){return!0}pointsCount(){return 1}updateAllViews(e){super.updateAllViews(e),this._priceAxisViews.forEach((t=>t.update(e)))}firstValue(){return this._model.mainSeries().firstValue()}priceRange(e,t,i){if(!this._isReady()||this.isSourceHidden()||i.targetPriceScale!==this.priceScale())return null;const s=this.plots().minMaxOnRangeCached(e,t,[{name:this.metaInfo().plots[0].id,offset:0}]);if(null===s)return null;const n=(0,r.ensureNotNull)(this.priceScale());return n.isLog()?new L.PriceRange(n.priceToLogical(s.min),n.priceToLogical(s.max)):new L.PriceRange(s.min,s.max)}isIncludedInAutoScale(){return!0}restoreData(e){super.restoreData(e),void 0!==e.data&&(this._anchorPriceCalculated=!0)}properties(){return super.properties()}sourceId(){return this._studyId()}hasStateForAlert(){return!1}stateForAlert(){throw new Error("Not implemented")}inputsForAlertState(){null===this._inputs&&G.logWarn("Could not get inputsForAlertState if VWAP has no inputs");const{start_time:e,source:t}=this.inputs();return{
start_time:e,source:t}}inputs(){return(0,r.ensureNotNull)(this._inputs)}idForAlert(){return super.idForAlert()}defaultPlotIdForAlert(){return this.metaInfo().plots[0].id}canBeHibernated(){return super.canBeHibernated()&&!this._hasAlert.value()}static createProperties(e){const t=h.StudyMetaInfo.getStudyPropertyRootNameById(q),i=(0,r.ensureNotNull)((0,U.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:q})),s=(0,c.createDefaultsState)(!0,t,[],(0,U.studyMetaInfoRepository)().studyVersioning());return this.createPropertiesFromStudyMetaInfoAndState(i,i,(0,M.merge)((0,M.clone)(s),null!=e?e:{}),(0,U.studyMetaInfoRepository)().studyVersioning())}static studyId(){return q}static createPropertiesFromStudyMetaInfoAndState(e,t,i,s){const r=(0,_.prepareStudyPropertiesForLoadChart)(e,t,i,s,$);return this._configureProperties(r),r}_onPointsetUpdated(e){super._onPointsetUpdated(e),this._onStudyInputsMayChange()}_studyInputs(e){(0,r.assert)(1===e.length,"all the line tool points should be defined");const t=e[0],i=this._getPointTime(t,!1);return null===i?(this._subscribeApplyInputsOnSeriesCompleted(),null):{...this.properties().childs().inputs.state(["start_time"]),start_time:1e3*i}}_isReady(){return super._isReady()&&(null!==this._inputs||this._anchorPriceCalculated)&&this.model().lineBeingEdited()!==this}_onDataCleared(){super._onDataCleared(),this._anchorPriceCalculated=!1}_onInputsChanged(){if(super._onInputsChanged(),this._updateAlertCreationAvailable(),null!==this._inputs){for(const e of this._onInputsReadyCallbacks)try{e(this._inputs)}catch(e){G.logError(e.stack||e.message)}this._onInputsReadyCallbacks=[]}}_clearAllDataExceptPointsetPoints(){super._clearAllDataExceptPointsetPoints(),this._updateAlertCreationAvailable()}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,27873))).AnchoredVWAPDefinitionsViewModel}_updateAnchorsPrice(e){if(!e&&(this._anchorPriceCalculated||!this.isActualSymbol()))return;const t=this.firstValue(),i=this.points();if(null===t||0===i.length)return;const s=i[0].index,r=this.plots().valueAt(s);if(null===r)return;const n=r[1];null!=n&&(this._points[0].price=n,this._timePoint[0].price=n,this._anchorPriceCalculated=!0)}_synchronizeAlert(e){this._onInputsReady((()=>super._synchronizeAlert(e)))}static _configureProperties(e){super._configureProperties(e),e.hasChild("axisLabelVisible")||e.addChild("axisLabelVisible",new A.Property(true));const t=e.childs().styles.childs().VWAP.childs().linewidth,i=e.childs().styles.childs().VWAP.childs().color;e.addChild("linesWidths",new k.LineToolWidthsProperty([t])),e.addChild("linesColors",new k.LineToolColorsProperty([i]))}_onInputsReady(e){null!==this._inputs?e(this._inputs):this._onInputsReadyCallbacks.push(e)}_onShowStudyLastValueChanged(){this._priceAxisViews.forEach((e=>e.update((0,v.sourceChangeEvent)(this.id())))),this.model().updateSource(this)}_onRestoreFactoryDefaults(){this.properties().childs().axisLabelVisible.setValue(true)}}var Z=i(50503);const X=(0,
r.ensureDefined)(j.lineToolsStudyIds.LineToolRegressionTrend);function J(e){return void 0!==e.startPrice&&void 0!==e.endPrice}function Q(e,t,i,s){return t.styles&&(ee(t.styles.baseLine),ee(t.styles.downLine),ee(t.styles.upLine)),t}function ee(e){void 0!==e&&void 0!==e.visible&&(e.display=e.visible?15:0,delete e.visible)}class te extends x{constructor(e,t,s,n,o){super(e,s=null!=s?s:(0,r.ensureNotNull)((0,U.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:X})),"linreg_",null!=t?t:te.createProperties(),n,o),this.version=2,this._trendData=null,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,90185)).then((e=>{this._setPaneViews([new e.RegressionTrendPaneView(this,this._model)])}))}formatter(){throw new Error("This method should never be called")}pointsCount(){return 2}clearData(){this._trendData=null,super.clearData()}state(e){var t;const i=super.state(e);return e?{...i,nonseriesdata:null!==(t=this._trendData)&&void 0!==t?t:void 0}:i}restoreData(e){var t;super.restoreData(e),this._trendData=null!==(t=e.nonseriesdata)&&void 0!==t?t:null}startIndex(){if(null===this._trendData||null===this._indexes)return null;const e=this._indexes[this._trendData.startIndex];return e!==Z.INVALID_TIME_POINT_INDEX?e:null}endIndex(){if(null===this._trendData||null===this._indexes)return null;const e=this._indexes[this._trendData.endIndex];return e!==Z.INVALID_TIME_POINT_INDEX?e:null}baseLine(){return null===this._trendData?null:this._trendData.baseLine}downLine(){return null===this._trendData?null:this._trendData.downLine}upLine(){return null===this._trendData?null:this._trendData.upLine}pearsons(){return null===this._trendData?null:this._trendData.pearsons}recalcStudyIfNeeded(){this._onStudyInputsMayChange()}cloneable(){return!1}static createProperties(e){const t=h.StudyMetaInfo.getStudyPropertyRootNameById(X),i=(0,r.ensureNotNull)((0,U.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:X})),s=(0,c.createDefaultsState)(!0,t,[],(0,U.studyMetaInfoRepository)().studyVersioning());return this.createRegressionTrendPropertiesFromStudyMetaInfoAndState(i,i,(0,M.merge)((0,M.clone)(s),null!=e?e:{}),(0,U.studyMetaInfoRepository)().studyVersioning())}static createRegressionTrendPropertiesFromStudyMetaInfoAndState(e,t,i,s){const r=(0,_.prepareStudyPropertiesForLoadChart)(e,t,i,s,Q);return this._configureProperties(r),r}static studyId(){return X}_studyInputs(e){(0,r.assert)(2===e.length,"all the line tool points should be defined");const[t,i]=e;if(t.index===i.index)return null;const s=this._getPointTime(t.index<=i.index?t:i,!0),n=this._getPointTime(i.index>=t.index?i:t,!0);return null===s||null===n?(this._subscribeApplyInputsOnSeriesCompleted(),null):{...this.properties().childs().inputs.state(),"first bar time":1e3*s,"last bar time":1e3*n}}_onDataUpdated(e,t,i){null!==t&&(t.indexes_replace||(this._trendData=t.data),"nochange"!==i&&(this._indexes=i),super._onDataUpdated(e,t,i))}_isReady(){
return null!==this._trendData&&void 0!==this._trendData.startIndex&&void 0!==this._trendData.endIndex&&J(this._trendData.upLine)&&J(this._trendData.baseLine)&&J(this._trendData.downLine)}_updateAnchorsPrice(){if(!this._trendData||(0,M.isNaN)(this._trendData.baseLine.startPrice)||(0,M.isNaN)(this._trendData.baseLine.endPrice))return;const{startPrice:e,endPrice:t}=this._trendData.baseLine;2===this._points.length&&(this._points[0].price=(0,r.ensureDefined)(e),this._points[1].price=(0,r.ensureDefined)(t),this._timePoint[0].price=(0,r.ensureDefined)(e),this._timePoint[1].price=(0,r.ensureDefined)(t))}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(9321),i.e(8278),i.e(4482),i.e(5450),i.e(607)]).then(i.bind(i,42838))).RegressionTrendDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);const t=e.childs().styles.childs(),i=[t.upLine.childs().linewidth,t.downLine.childs().linewidth,t.baseLine.childs().linewidth];e.addChild("linesWidths",new k.LineToolWidthsProperty(i))}}var ie=i(77973);const se=(0,r.ensureDefined)(j.lineToolsStudyIds.LineToolVbPFixed);function re(e,t,i,s){return t.styles&&(ne(t.styles.developingPoc),ne(t.styles.developingVAHigh),ne(t.styles.developingVALow)),t}function ne(e){void 0!==e&&void 0!==e.visible&&(e.display=e.visible?15:0,delete e.visible)}class oe extends x{constructor(e,t,i,s,r){super(e,i||(0,U.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:se}),"vbpfixed_",null!=t?t:oe.createProperties(),s,r),this._createPaneViews().then((e=>{this._setPaneViews(e),e.forEach((e=>e.update((0,v.sourceChangeEvent)({sourceId:this.id(),clearData:!0}))))})),this.clearData()}pointsCount(){return 2}boundToSymbol(){return!1}offset(e){return 0}getMinFirstBarIndexForPlot(){return-1/0}calcIsActualSymbol(){this._isActualSymbol=!0,this._isActualCurrency=!0,this._isActualUnit=!0,this.calcIsActualInterval()}cloneable(){return!1}isSynchronizable(){return!1}isPlotVisibleAt(e,t){return(this.properties().childs().styles.childs()[e].childs().display.value()&t)===t}preferredZOrder(){return 0}static createProperties(e){const t=h.StudyMetaInfo.getStudyPropertyRootNameById(se),i=(0,r.ensureNotNull)((0,U.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:se})),s=(0,c.createDefaultsState)(!0,t,[],(0,U.studyMetaInfoRepository)().studyVersioning());return this.createPropertiesFromStudyMetaInfoAndState(i,i,(0,M.merge)((0,M.clone)(s),null!=e?e:{}),(0,U.studyMetaInfoRepository)().studyVersioning())}static createPropertiesFromStudyMetaInfoAndState(e,t,i,s){const r=(0,_.prepareStudyPropertiesForLoadChart)(e,t,i,s,re);return this._configureProperties(r),r}static studyId(){return se}_studyInputs(e){(0,r.assert)(2===e.length,"all the line tool points should be defined");const[t,i]=e,s=Math.max(t.index,i.index),n=this._model.mainSeries().bars().lastIndex(),o=this._getPointTime(t.index<=i.index?t:i,!0),a=this._getPointTime(i.index>=t.index?i:t,!0);if(null===o||null===a)return this._subscribeApplyInputsOnSeriesCompleted(),null;return{
...this.properties().childs().inputs.state(),first_bar_time:1e3*o,last_bar_time:1e3*a,subscribeRealtime:n===s,mapRightBoundaryToBarStartTime:!!this._needExtendToBarsEnding()||void 0}}_isReady(){return!(0,d.isStudyGraphicsEmpty)(this.graphics())}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(9321),i.e(8278),i.e(4482),i.e(5450),i.e(607)]).then(i.bind(i,31507))).StudyLineDataSourceDefinitionsViewModel}_onDataUpdated(){this._updateAnchors(),this.updateAllViews((0,v.sourceChangeEvent)(this.id())),this._model.updateSource(this)}_updateAnchors(){const e=this._calculateAnchors();if(!e)return;const[{index:t,price:i},{index:s,price:r}]=e;if(this._timePoint.length&&(this._timePoint[0].price=i,this._timePoint[1].price=r),this._points.length){const e=this.model().timeScale(),n=e.indexToTimePoint(t),o=e.indexToTimePoint(t);this._points[0]={index:t,price:i,time:(0,M.isNumber)(n)?n:void 0},this._points[1]={index:s,price:r,time:(0,M.isNumber)(o)?o:void 0}}}_calculateAnchors(){let e=null,t=null,i=null,s=null;if(this.graphics().hhists().forEach((r=>{r.forEach((r=>{const{priceLow:n,priceHigh:o,firstBarTime:a,lastBarTime:l}=r;(!e||n<e)&&(e=n),(!t||o>t)&&(t=o),(!i||a<i)&&(i=a),(!s||l>s)&&(s=l)}))})),!((0,ie.default)(e)||(0,ie.default)(t)||(0,ie.default)(s)||(0,ie.default)(i)))return[{price:t,index:i},{price:e,index:s}]}_updateAnchorsPrice(){const e=this._calculateAnchors();if(!e)return;const[{price:t},{price:i}]=e;this._timePoint.length&&(this._timePoint[0].price=t,this._timePoint[1].price=i),this._points.length&&(this._points[0].price=t,this._points[1].price=i)}async _createPaneViews(){var e;const t=this._metaInfo,s=t.graphics,r=[],n=this._needExtendToBarsEnding();if(s.hhists){const{HHistPaneView:t}=await i.e(507).then(i.bind(i,56208)),s=null===(e=this.properties().childs().graphics.childs().polygons)||void 0===e?void 0:e.childs();r.push(new t(this,this._model,void 0,null==s?void 0:s.histBoxBg,n))}if(s.horizlines){const{HorizLinePaneView:e}=await i.e(507).then(i.bind(i,95258));r.push(new e(this,this._model,void 0,n))}return t.plots.length>0&&r.push(this._createStudyPlotPaneView(t.plots[0].id,n)),t.plots.length>1&&r.push(this._createStudyPlotPaneView(t.plots[1].id,n)),t.plots.length>2&&r.push(this._createStudyPlotPaneView(t.plots[2].id,n)),r}_createStudyPlotPaneView(e,t){return new V.StudyPlotPaneView(this,this._model.mainSeries(),this._model,e,t)}_needExtendToBarsEnding(){var e;return void 0!==(null===(e=this.metaInfo().defaults.inputs)||void 0===e?void 0:e.mapRightBoundaryToBarStartTime)}}const ae=(0,r.ensureDefined)(j.lineToolsStudyIds.LineToolFixedRangeVolumeProfile);class le extends oe{constructor(e,t,i,s,r){super(e,t,i||(0,U.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:ae}),s,r)}calcIsActualSymbol(){x.prototype.calcIsActualSymbol.apply(this)}boundToSymbol(){return!0}isSynchronizable(){return this.priceScale()===this._model.mainSeries().priceScale()}static studyId(){return ae}static createProperties(e){const t=h.StudyMetaInfo.getStudyPropertyRootNameById(ae),i=(0,r.ensureNotNull)((0,
U.studyMetaInfoRepository)().findByIdSync({type:"java",studyId:ae})),s=(0,c.createDefaultsState)(!0,t,[],(0,U.studyMetaInfoRepository)().studyVersioning());return this.createPropertiesFromStudyMetaInfoAndState(i,i,(0,M.merge)((0,M.clone)(s),null!=e?e:{}),(0,U.studyMetaInfoRepository)().studyVersioning())}static createPropertiesFromStudyMetaInfoAndState(e,t,i,s){const r=(0,_.prepareStudyPropertiesForLoadChart)(e,t,i,s);return this._configureProperties(r),r}}var ce=i(36009),he=i(68805),de=i(15764);const ue={},pe={};Object.assign(ue,I),pe.LineToolAnchoredVWAP=Y,pe.LineToolRegressionTrend=te,pe.LineToolVbPFixed=oe,pe.LineToolFixedRangeVolumeProfile=le;const _e=["LineToolRegressionTrend","LineToolAnchoredVWAP","LineToolFixedRangeVolumeProfile","LineToolVbPFixed"];let me=null;function ge(e,t,i){return null!==me&&me.tool===e&&me.toolData===t||(me={properties:xe(e,void 0,i),tool:e,toolData:t}),me.properties}function fe(){me=null}function ve(e){return null!==me&&me.tool===e?me.properties:null}const ye=new Map([["LineToolPriceNote",async()=>(await Promise.resolve().then(i.bind(i,16299))).LineToolPriceNote],["LineToolNote",async()=>(await Promise.resolve().then(i.bind(i,2341))).LineToolNote],["LineToolNoteAbsolute",async()=>(await Promise.resolve().then(i.bind(i,2341))).LineToolNoteAbsolute],["LineToolFibSpiral",async()=>(await Promise.resolve().then(i.bind(i,84023))).LineToolFibSpiral],["LineToolCircleLines",async()=>(await Promise.resolve().then(i.bind(i,82407))).LineToolCyclicLines]]);let Se=new Map;async function be(e){if((0,de.isStudyLineToolName)(e)){if(await(0,U.studyMetaInfoRepository)().findAllJavaStudies(),pe[e])return;const t=(0,r.ensureDefined)(Se.get(e));return void(pe[e]=await t())}if(ue[e])return;if(!ue.hasOwnProperty(e))return;const t=(0,r.ensureDefined)(ye.get(e));ue[e]=await t()}async function we(e){if(!e)return;const t=new Set;("charts"in e?e.charts:[e]).forEach((e=>{e.panes.forEach((e=>{e.sources.forEach((e=>{(0,de.isLineToolName)(e.type)&&t.add(e.type)}))}))})),await Promise.all(Array.from(t).map((e=>be(e))))}function Ce(e,t,i,s,n,o){let a;if((0,r.assert)((0,de.isLineToolName)(e),"Unknown line tool: "+e),n||i||(i=ve(e)||void 0),_e.includes(e)){a=new((0,r.ensureDefined)(pe[e]))(t,i,(0,r.ensureDefined)(s),n,o)}else{a=new((0,r.ensureDefined)(ue[e]))(t,i,n,o)}return a.toolname=e,fe(),a}function Pe(e,t){const i=(0,r.ensureNotNull)(t.symbolSource()),s=i.symbolInfo(),n=s?(0,he.extractLineToolSymbolFromSymbolInfo)(s,i.symbol()):i.symbol();e.childs().symbol.setValue(n),i.model().currencyConversionEnabled()&&i.isConvertedToOtherCurrency()&&e.childs().currencyId.setValue(i.currency()),i.model().unitConversionEnabled()&&i.isConvertedToOtherUnit()&&e.childs().unitId.setValue(i.unit()),e.childs().symbolStateVersion.setValue(2),e.childs().zOrderVersion.setValue(2)}function xe(e,t,i,s){if((0,r.assert)((0,de.isLineToolName)(e),`${e} should be name of the line tool`),_e.includes(e)){return(0,r.ensureDefined)(pe[e]).createProperties(t)}return(0,r.ensureDefined)(ue[e]).createProperties(t,s)}function Te(e,t,i,s,n){if((0,
r.assert)((0,de.isStudyLineToolName)(e),`${e} should be name of the study line tool`),_e.includes(e)){return(0,r.ensureDefined)(pe[e]).createPropertiesFromStudyMetaInfoAndState(t,i,s,n)}throw new Error(`Property creation is not implemented for study line tool ${e}`)}function Ie(e){(0,r.assert)((0,de.isLineToolName)(e),`${e} should be name of the line tool`);const t=I[e];return void 0!==t&&Boolean(t.supportPhantomMode)}function Me(e){return e instanceof l.LineDataSource}function Ae(e){return e instanceof x}function Le(e){return e instanceof ce.LineToolTrading}const ke=["editableTextStyle","editableText","editableTextProperties"];function De(e){return(0,s.default)(e)&&ke.every((t=>t in e))}function Ee(e){let t=null;return e===j.lineToolsStudyIds.LineToolRegressionTrend?t="LineToolRegressionTrend":e===j.lineToolsStudyIds.LineToolVbPFixed?t="LineToolVbPFixed":e===j.lineToolsStudyIds.LineToolFixedRangeVolumeProfile&&(t="LineToolFixedRangeVolumeProfile"),t}function Ve(e,t,i,s){const a=t.toolname,l=t.properties().state();l.intervalsVisibilities=(0,o.mergeIntervalVisibilitiesDefaults)(null==l?void 0:l.intervalsVisibilities);const c=xe(t.toolname,l);c.childs().visible.setValue(!0);const h=(0,r.ensureNotNull)(t.ownerSource()),d=Ce(a,e,c);void 0!==s&&d.setId(s),d.setOwnerSource(h),d.toolname=a;const u=d.clonePositionOffset();if(t.isFixed()){const e=(0,r.ensureDefined)(t.fixedPoint()),s=i?e.add(new n.Point(u.xCoordOffset,u.yCoordOffset)):e;d.addFixedPoint(s)}const p=t.normalizedPoints(),_=i?function(e,t,i){const s=(0,r.ensureNotNull)(t.priceScale()),n=(0,r.ensureNotNull)(t.firstValue());return e.map((e=>{const t=e.price,r=s.priceToCoordinate(t,n)+i.yCoordOffset,o=s.coordinateToPrice(r,n);return{time_t:e.time_t,price:o,offset:e.offset+i.barOffset}}))}(p,h,u):p,m=t.points();return d.restorePoints(_,m),d.cloneData&&d.cloneData(t),d.recalculateStateByData&&d.recalculateStateByData(),d}function Be(e,t){var i;return null!==(i=e.dataSources().find((e=>Me(e)&&e.linkKey().value()===t)))&&void 0!==i?i:null}},2341:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LineToolNote:()=>y,LineToolNoteAbsolute:()=>S});var s=i(12988),r=i(10568),n=i(50151),o=i(19625),a=i(24633),l=i(55917),c=i(11402),h=i(6590),d=i(38039);const u={fontSize:14,bold:!1,italic:!1,drawBackground:!0,drawBorder:!1,fixedSize:!0},p=new Map([[a.StdTheme.Light,{textColor:o.colorsPalette["color-cold-gray-900"],backgroundColor:o.colorsPalette["color-white"],backgroundTransparency:0,borderColor:o.colorsPalette["color-cold-gray-150"],markerColor:o.colorsPalette["color-tv-blue-500"]}],[a.StdTheme.Dark,{textColor:o.colorsPalette["color-cold-gray-200"],backgroundColor:o.colorsPalette["color-cold-gray-800"],backgroundTransparency:0,borderColor:o.colorsPalette["color-cold-gray-700"],markerColor:o.colorsPalette["color-tv-blue-500"]}]]),_=(0,l.extractAllPropertiesKeys)((0,n.ensureDefined)(p.get(a.StdTheme.Light))),m=(0,l.extractAllPropertiesKeys)(u),g=[..._,...m,...h.commonLineToolPropertiesStateKeys,"text"];class f extends d.LineDataSourceProperty{static create(e,t){return new this({defaultName:e,
factoryDefaultsSupplier:()=>(0,c.factoryDefaultsForCurrentTheme)(u,p),nonThemedDefaultsKeys:m,themedDefaultsKeys:_,allStateKeys:g,state:t})}}var v;!function(e){e[e.Version=1]="Version"}(v||(v={}));class y extends r.InplaceTextLineDataSource{constructor(e,t,s,r){super(e,null!=t?t:y.createProperties(),s,r),this.version=1,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,52898)).then((e=>{this._setPaneViews([new e.NotePaneView(this,this._model,this._openTextEditor.bind(this),this._closeTextEditor.bind(this),this.onSelectionChange.bind(this))])}))}pointsCount(){return 1}name(){return"Note"}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}state(e){const t=super.state(e);return e&&(t.state.fixedSize=!1),t}activateEditingOnCreation(){return!0}editableTextProperties(){const e=this.properties().childs();return{text:e.text,textColor:e.textColor}}static createProperties(e){null!=e&&void 0!==e.markerColor&&void 0===e.borderColor&&(e.borderColor=e.markerColor);const t=f.create(this._defaultsKey(),e);return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,14531))).NoteDefinitionsViewModel}_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.Property("")),e.addExcludedKey("text",1)}static _defaultsKey(){return"linetoolnote"}}class S extends y{constructor(e,t,i,s){super(e,null!=t?t:S.createProperties(),i,s)}name(){return"Anchored Note"}isFixed(){return!0}hasEditableCoordinates(){return!1}static _defaultsKey(){return"linetoolnoteabsolute"}}},64732:(e,t,i)=>{"use strict";var s=i(36009).LineToolTrading,r=i(81776).LineToolTradingPriceAxisView,n=i(91920),o=i(29875).LineDataSource,a=i(55917).DefaultProperty;const l=i(56570);var c=i(2718).sortSourcesPreOrdered.LineToolOrder;function h(e){return null==e?e="":e+="",e}class d{constructor(e){this._line=e,this._data={bodyText:"order",quantityText:"0"},this._editable=!0,this._cancellable=!0,this._mode="",this._direction="buy",this._active=!0}setMode(e){return this._mode=e,this._line.updateAllViewsAndRedraw(),this}setDirection(e){return this._direction=e,this._line.updateAllViewsAndRedraw(),this}setActive(e){return this._active=e,this._line.updateAllViewsAndRedraw(),this}setEditable(e){return this._editable=e,this._line.updateAllViewsAndRedraw(),this}getEditable(){return this._editable}setCancellable(e){return this._cancellable=e,this._line.updateAllViewsAndRedraw(),this}getCancellable(){return this._cancellable}hasMoveCallback(){return this.isFunction(this._onMoveCallback)}hasModifyCallback(){return this.isFunction(this._onModifyCallback)}getPrice(){return this._line.points().length>0?this._line.points()[0].price:this._line._timePoint.length>0?this._line._timePoint[0].price:void 0}setPrice(e){if(this._line.points().length>0){var t=this._line.points()[0];t.price=e,this._line.setPoint(0,t),
this._line.updateAllViewsAndRedraw()}return this._line._timePoint.length>0&&(this._line._timePoint[0].price=e),this}getText(){return this._data.bodyText}setText(e){return this._data.bodyText=e||"",this._line.updateAllViewsAndRedraw(),this}setTooltip(e){return this._line.properties().tooltip.setValue(h(e)),this}getTooltip(){return this._line.properties().tooltip.value()}setModifyTooltip(e){return this._line.properties().modifyTooltip.setValue(h(e)),this}getModifyTooltip(){return this._line.properties().modifyTooltip.value()}setCancelTooltip(e){return this._line.properties().cancelTooltip.setValue(h(e)),this}getCancelTooltip(){return this._line.properties().cancelTooltip.value()}getQuantity(){return this._data.quantityText}setQuantity(e){return this._data.quantityText=e||"",this._line.updateAllViewsAndRedraw(),this}getExtendLeft(){var e=this._line.properties().extendLeft.value();return"inherit"===e?this._line._model.properties().tradingProperties.extendLeft.value():e}setExtendLeft(e){return this._line.properties().extendLeft.setValue(e),this}getLineLength(){var e=this._line.properties().lineLength.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineLength.value():e}setLineLength(e,t="percentage"){const i=t&&"pixel"===t?e:Math.max(0,Math.min(e,100));return this._line.properties().lineLength.setValue(i),this._line.properties().lineLengthUnit.setValue(t),this}getLineLengthUnit(){return this._line.properties().lineLengthUnit.value()}getLineColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.lineActiveBuyColor.value():e.lineInactiveBuyColor.value():this._active?e.lineActiveSellColor.value():e.lineInactiveSellColor.value()}setLineColor(e){return"buy"===this._direction?this._active?this.setLineActiveBuyColor(e):this.setLineInactiveBuyColor(e):this._active?this.setLineActiveSellColor(e):this.setLineInactiveSellColor(e),this}setLineActiveBuyColor(e){return this._line.properties().lineActiveBuyColor.setValue(e),this}setLineInactiveBuyColor(e){return this._line.properties().lineInactiveBuyColor.setValue(e),this}setLineActiveSellColor(e){return this._line.properties().lineActiveSellColor.setValue(e),this}setLineInactiveSellColor(e){return this._line.properties().lineInactiveSellColor.setValue(e),this}getLineStyle(){var e=this._line.properties().lineStyle.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineStyle.value():e}setLineStyle(e){return this._line.properties().lineStyle.setValue(e),this}getLineWidth(){var e=this._line.properties().lineWidth.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineWidth.value():e}setLineWidth(e){return this._line.properties().lineWidth.setValue(e),this}getBodyBorderColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.bodyBorderActiveBuyColor.value():e.bodyBorderInactiveBuyColor.value():this._active?e.bodyBorderActiveSellColor.value():e.bodyBorderInactiveSellColor.value()}setBodyBorderColor(e){
return"buy"===this._direction?this._active?this.setBodyBorderActiveBuyColor(e):this.setBodyBorderInactiveBuyColor(e):this._active?this.setBodyBorderActiveSellColor(e):this.setBodyBorderInactiveSellColor(e),this}setBodyBorderActiveBuyColor(e){return this._line.properties().bodyBorderActiveBuyColor.setValue(e),this}setBodyBorderInactiveBuyColor(e){return this._line.properties().bodyBorderInactiveBuyColor.setValue(e),this}setBodyBorderActiveSellColor(e){return this._line.properties().bodyBorderActiveSellColor.setValue(e),this}setBodyBorderInactiveSellColor(e){return this._line.properties().bodyBorderInactiveSellColor.setValue(e),this}getBodyBackgroundColor(){return n.getColorFromProperties(this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency)}setBodyBackgroundColor(e){return n.setColorToProperties(e,this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency),this}getBodyTextColor(){var e=this._line.properties();return"limit"===this._mode?this._active?e.bodyTextActiveLimitColor.value():e.bodyTextInactiveLimitColor.value():"stop"===this._mode?this._active?e.bodyTextActiveStopColor.value():e.bodyTextInactiveStopColor.value():"buy"===this._direction?this._active?e.bodyTextActiveBuyColor.value():e.bodyTextInactiveBuyColor.value():this._active?e.bodyTextActiveSellColor.value():e.bodyTextInactiveSellColor.value()}setBodyTextColor(e){return"limit"===this._mode?this._active?this.setBodyTextActiveLimitColor(e):this.setBodyTextInactiveLimitColor(e):"stop"===this._mode?this._active?this.setBodyTextActiveStopColor(e):this.setBodyTextInactiveStopColor(e):"buy"===this._direction?this._active?this.setBodyTextActiveBuyColor(e):this.setBodyTextInactiveBuyColor(e):this._active?this.setBodyTextActiveSellColor(e):this.setBodyTextInactiveSellColor(e),this}setBodyTextInactiveLimitColor(e){return this._line.properties().bodyTextInactiveLimitColor.setValue(e),this}setBodyTextActiveLimitColor(e){return this._line.properties().bodyTextActiveLimitColor.setValue(e),this}setBodyTextInactiveStopColor(e){return this._line.properties().bodyTextInactiveStopColor.setValue(e),this}setBodyTextActiveStopColor(e){return this._line.properties().bodyTextActiveStopColor.setValue(e),this}setBodyTextInactiveBuyColor(e){return this._line.properties().bodyTextInactiveBuyColor.setValue(e),this}setBodyTextActiveBuyColor(e){return this._line.properties().bodyTextActiveBuyColor.setValue(e),this}setBodyTextInactiveSellColor(e){return this._line.properties().bodyTextInactiveSellColor.setValue(e),this}setBodyTextActiveSellColor(e){return this._line.properties().bodyTextActiveSellColor.setValue(e),this}getBodyFont(){return n.getFontFromProperties(this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic)}setBodyFont(e){return n.setFontToProperties(e,this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic),this
}getQuantityBorderColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.quantityBorderActiveBuyColor.value():e.quantityBorderInactiveBuyColor.value():this._active?e.quantityBorderActiveSellColor.value():e.quantityBorderInactiveSellColor.value()}setQuantityBorderColor(e){return"buy"===this._direction?this._active?this.setQuantityBorderActiveBuyColor(e):this.setQuantityBorderInactiveBuyColor(e):this._active?this.setQuantityBorderActiveSellColor(e):this.setQuantityBorderInactiveSellColor(e),this}setQuantityBorderActiveBuyColor(e){return this._line.properties().quantityBorderActiveBuyColor.setValue(e),this}setQuantityBorderInactiveBuyColor(e){return this._line.properties().quantityBorderInactiveBuyColor.setValue(e),this}setQuantityBorderActiveSellColor(e){return this._line.properties().quantityBorderActiveSellColor.setValue(e),this}setQuantityBorderInactiveSellColor(e){return this._line.properties().quantityBorderInactiveSellColor.setValue(e),this}getQuantityBackgroundColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.quantityBackgroundActiveBuyColor.value():e.quantityBackgroundInactiveBuyColor.value():this._active?e.quantityBackgroundActiveSellColor.value():e.quantityBackgroundInactiveSellColor.value()}setQuantityBackgroundColor(e){return"buy"===this._direction?this._active?this.setQuantityBackgroundActiveBuyColor(e):this.setQuantityBackgroundInactiveBuyColor(e):this._active?this.setQuantityBackgroundActiveSellColor(e):this.setQuantityBackgroundInactiveSellColor(e),this}setQuantityBackgroundActiveBuyColor(e){return this._line.properties().quantityBackgroundActiveBuyColor.setValue(e),this}setQuantityBackgroundInactiveBuyColor(e){return this._line.properties().quantityBackgroundInactiveBuyColor.setValue(e),this}setQuantityBackgroundActiveSellColor(e){return this._line.properties().quantityBackgroundActiveSellColor.setValue(e),this}setQuantityBackgroundInactiveSellColor(e){return this._line.properties().quantityBackgroundInactiveSellColor.setValue(e),this}getQuantityTextColor(){return n.getColorFromProperties(this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency)}setQuantityTextColor(e){return n.setColorToProperties(e,this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency),this}getQuantityFont(){return n.getFontFromProperties(this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic)}setQuantityFont(e){return n.setFontToProperties(e,this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic),this}getCancelButtonBorderColor(){var e=this._line.properties()
;return"buy"===this._direction?this._active?e.cancelButtonBorderActiveBuyColor.value():e.cancelButtonBorderInactiveBuyColor.value():this._active?e.cancelButtonBorderActiveSellColor.value():e.cancelButtonBorderInactiveSellColor.value()}setCancelButtonBorderColor(e){return"buy"===this._direction?this._active?this.setCancelButtonBorderActiveBuyColor(e):this.setCancelButtonBorderInactiveBuyColor(e):this._active?this.setCancelButtonBorderActiveSellColor(e):this.setCancelButtonBorderInactiveSellColor(e),this}setCancelButtonBorderActiveBuyColor(e){return this._line.properties().cancelButtonBorderActiveBuyColor.setValue(e),this}setCancelButtonBorderInactiveBuyColor(e){return this._line.properties().cancelButtonBorderInactiveBuyColor.setValue(e),this}setCancelButtonBorderActiveSellColor(e){return this._line.properties().cancelButtonBorderActiveSellColor.setValue(e),this}setCancelButtonBorderInactiveSellColor(e){return this._line.properties().cancelButtonBorderInactiveSellColor.setValue(e),this}getCancelButtonBackgroundColor(){return n.getColorFromProperties(this._line.properties().cancelButtonBackgroundColor,this._line.properties().cancelButtonBackgroundTransparency)}setCancelButtonBackgroundColor(e){return n.setColorToProperties(e,this._line.properties().cancelButtonBackgroundColor,this._line.properties().cancelButtonBackgroundTransparency),this}getCancelButtonIconColor(){var e=this._line.properties();return"buy"===this._direction?this._active?e.cancelButtonIconActiveBuyColor.value():e.cancelButtonIconInactiveBuyColor.value():this._active?e.cancelButtonIconActiveSellColor.value():e.cancelButtonIconInactiveSellColor.value()}setCancelButtonIconColor(e){return"buy"===this._direction?this._active?this.setCancelButtonIconActiveBuyColor(e):this.setCancelButtonIconInactiveBuyColor(e):this._active?this.setCancelButtonIconActiveSellColor(e):this.setCancelButtonIconInactiveSellColor(e),this}setCancelButtonIconActiveBuyColor(e){return this._line.properties().cancelButtonIconActiveBuyColor.setValue(e),this}setCancelButtonIconInactiveBuyColor(e){return this._line.properties().cancelButtonIconInactiveBuyColor.setValue(e),this}setCancelButtonIconActiveSellColor(e){return this._line.properties().cancelButtonIconActiveSellColor.setValue(e),this}setCancelButtonIconInactiveSellColor(e){return this._line.properties().cancelButtonIconInactiveSellColor.setValue(e),this}block(){this._blocked=!0,this._line.updateAllViewsAndRedraw()}unblock(){this._blocked=!1,this._line.updateAllViewsAndRedraw()}getBlocked(){return this._blocked}isFunction(e){return"function"==typeof e}onCancel(e,t){return t?this.isFunction(t)&&(this._onCancelData=e,this._onCancelCallback=t):this.isFunction(e)&&(this._onCancelCallback=e),this}callOnCancel(){this.isFunction(this._onCancelCallback)&&this._onCancelCallback.call(this,this._onCancelData)}isOnCancelCallbackPresent(){return this.isFunction(this._onCancelCallback)}onModify(e,t){return t?this.isFunction(t)&&(this._onModifyData=e,this._onModifyCallback=t):this.isFunction(e)&&(this._onModifyCallback=e),this}callOnModify(){
this.isFunction(this._onModifyCallback)&&this._onModifyCallback.call(this,this._onModifyData)}onMove(e,t){return t?this.isFunction(t)&&(this._onMoveData=e,this._onMoveCallback=t):this.isFunction(e)&&(this._onMoveCallback=e),this}callOnMove(){this.isFunction(this._onMoveCallback)&&this._onMoveCallback.call(this,this._onMoveData)}onMoving(e,t){return t?this.isFunction(t)&&(this._onMovingData=e,this._onMovingCallback=t):this.isFunction(e)&&(this._onMovingCallback=e),this}callOnMoving(){this.isFunction(this._onMovingCallback)&&this._onMovingCallback.call(this,this._onMovingData)}onContextMenu(e,t){return t?this.isFunction(t)&&(this._onContextMenuData=e,this._onContextMenuCallback=t):this.isFunction(e)&&(this._onContextMenuCallback=e),this}shouldShowContextMenu(){return this.isFunction(this._onContextMenuCallback)}callOnContextMenu(){if(this.isFunction(this._onContextMenuCallback))return this._onContextMenuCallback.call(this,this._onContextMenuData)}remove(){this._line._model.removeSource(this._line),delete this._line}}class u extends s{constructor(e,t){super(e,t||u.createProperties()),this._adapter=new d(this),this.setSelectionEnabled(!0),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,92281)).then((({OrderPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}zorder(){return c}isSpeciallyZOrderedSource(){return!0}setPoint(e,t){this._points[e]=t,this._normalizePoints()}addPoint(e,t){return this._points.push(e),this._lastPoint=null,this._normalizePoints(),this.createServerPoints(),!0}name(){return"Order"}move(e,t,i,s){var r=this._startMovingPoint&&this._currentMovingPoint&&this._startMovingPoint.logical.price!==this._currentMovingPoint.logical.price;super.move(e,t,i,s),r&&this._adapter.callOnMoving()}endMoving(e){var t=this._startMovingPoint&&this._currentMovingPoint&&this._startMovingPoint.logical.price!==this._currentMovingPoint.logical.price;super.endMoving(),!e&&t&&this._adapter.callOnMove()}createPriceAxisView(e){var t={pointIndex:e,backgroundPropertyGetter:()=>this._adapter.getLineColor()};return this._priceAxisView=new r(this,t),this._priceAxisView}paneViews(){return TradingView.printing&&!l.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showOrders.value()?o.prototype.paneViews.call(this):null}priceAxisViews(e,t){return TradingView.printing&&!l.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showOrders.value()?o.prototype.priceAxisViews.call(this,e,t):null}adapter(){return this._adapter}hasContextMenu(){return this._adapter.shouldShowContextMenu()}contextMenuItems(){return this._adapter.callOnContextMenu()}movable(){return Boolean(this._adapter._onMoveCallback)}formatter(){return this._formatter}static createProperties(e){var t=new a({defaultName:"linetoolorder",state:e,useUserPreferences:!1});return this._configureProperties(t),t}}t.LineToolOrder=u},56621:(e,t,i)=>{"use strict";i.d(t,{LineToolParallelChannel:()=>d});var s,r=i(50151),n=i(86441),o=i(55917),a=i(928),l=i(29875),c=i(37265),h=i(12988);!function(e){
e[e.LeftBottomAnchor=0]="LeftBottomAnchor",e[e.RightBottomAnchor=1]="RightBottomAnchor",e[e.LeftTopAnchor=2]="LeftTopAnchor",e[e.RightTopAnchor=3]="RightTopAnchor",e[e.TopMiddleAnchor=4]="TopMiddleAnchor",e[e.BottomMiddleAnchor=5]="BottomMiddleAnchor"}(s||(s={}));class d extends l.LineDataSource{constructor(e,t,s,r){super(e,t||d.createProperties(),s,r),this._priceAxisViews.push(this.createPriceAxisView(3)),this._coordOffsetWhileMovingOrChanging=null,this._pendingPriceOffset=null,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,86595)).then((({ParallelChannelPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}paneViews(e){return null!==this._pendingPriceOffset&&this._applyPendingPriceOffset(),super.paneViews(e)}setLastPoint(e,t){t&&t.shift()&&2===this.points().length&&this._snapPoint45Degree(e,this.points()[0]);const i=(0,c.clone)(e);return super.setLastPoint(e),i}startMoving(e,t,i,s){super.startMoving(e,t,i,s),this._coordOffsetWhileMovingOrChanging=this._findPixelsHeight()}endMoving(e,t,i){return this._coordOffsetWhileMovingOrChanging=null,super.endMoving(e,t,i)}startChanging(e,t){super.startChanging(e,t),this._coordOffsetWhileMovingOrChanging=this._findPixelsHeight()}endChanging(e,t,i){return this._coordOffsetWhileMovingOrChanging=null,super.endChanging(e,t,i)}restoreExternalPoints(e,t,i){const s=i?e.points:this._timePoint.map(((t,i)=>({price:t.price,offset:e.points[i].offset,time_t:e.points[i].time_t})));if(super.restoreExternalPoints({...e,points:s},t),t.pricesChanged&&this._points.length===s.length)for(let e=0;e<s.length;e++)this._points[e].price=s[e].price}restorePoints(e,t,i){super.restorePoints(e,t,i),this._alertCreationAvailable.setValue(super.alertCreationAvailable().value()&&this._isTimePointsValid())}setPoint(e,t,i,s){var n;if(this._points[0].index===this._points[1].index&&e>=4)return;this._snapPointBeforeChange(e,t,i);const o=(0,r.ensureNotNull)(this.pointToScreenPoint(this._points[0])),l=(0,r.ensureNotNull)(this.pointToScreenPoint(this._points[1])),c=(0,r.ensureNotNull)(this.pointToScreenPoint(t)),h=(0,r.ensureNotNull)(this._coordOffsetWhileMovingOrChanging),d=(0,r.ensureNotNull)(this.priceScale()),u=(0,r.ensure)(null===(n=this.ownerSource())||void 0===n?void 0:n.firstValue());switch(e){case 0:super.setPoint(e,t,i),this._points[2].price=d.coordinateToPrice(c.y+h,u);break;case 1:super.setPoint(e,t,i);break;case 2:super.setPoint(e,t,i),this._points[0].price=d.coordinateToPrice(c.y-h,u),this._points[0].index=t.index;break;case 3:this._points[1].price=d.coordinateToPrice(c.y-h,u),this._points[1].index=t.index;break;case 4:{const e=l.subtract(o),t=(c.x-o.x)/e.x,i=o.addScaled(e,t),s=c.y-i.y;this._points[2].price=d.coordinateToPrice(o.y+s,u);break}case 5:{const e=l.subtract(o),t=(c.x-o.x)/e.x,i=o.addScaled(e,t),s=c.y-i.y;this._points[0].price=d.coordinateToPrice(o.y+s,u),this._points[1].price=d.coordinateToPrice(l.y+s,u);break}}const p=this.linkKey().value();if(p&&!s&&e<4){const e=this._points.map((e=>e.price));(0,a.changeLineStyle)({model:this._model,linkKey:p,state:{prices:e}})}}state(e){
const t=super.state(e);return this._pendingPriceOffset&&(t.priceOffset=this._pendingPriceOffset),t}restoreExternalState(e){const{prices:t,...i}=e;if(t&&this.isActualSymbol())for(let e=0;e<t.length;e++)this._points[e].price=this._timePoint[e].price=t[e];super.restoreExternalState(i)}restoreData(e){void 0!==e.priceOffset&&(this._pendingPriceOffset=e.priceOffset)}getPoint(e){if(e<3)return super.getPoint(e);const t=this.pointToScreenPoint(this._points[0]),i=this.pointToScreenPoint(this._points[1]),s=this.pointToScreenPoint(this._points[2]);if(!t||!i||!s)return null;switch(e){case 3:{const e=s.y-t.y,r=i.add(new n.Point(0,e));return this.screenPointToPoint(r)}case 4:{const e=s.y-t.y,r=i.add(new n.Point(0,e)),o=s.add(r).scaled(.5);return this.screenPointToPoint(o)}case 5:{const e=t.add(i).scaled(.5);return this.screenPointToPoint(e)}}return null}alignCrossHairToAnchor(e){return e<=3}pointsCount(){return 3}name(){return"Parallel Channel"}hasEditableCoordinates(){return!1}addPoint(e,t,i){const s=this.points().length;return t&&t.shift()&&2===s&&this._snapPoint45Degree(e,this.points()[0]),2===this._points.length&&(e=this._convertLastPointTo3rdPoint((0,r.ensureNotNull)(this._lastPoint))),super.addPoint(e,t)}timeAxisPoints(){return this._axisPoints()}priceAxisPoints(){return this._axisPoints()}canHasAlert(){return!0}template(){const e=super.template();return e.labelText=this.properties().childs().labelText.value(),e}hasStateForAlert(){return!1}static createProperties(e){const t=new o.DefaultProperty({defaultName:"linetoolparallelchannel",state:e});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,73653))).ParallelChannelDefinitionsViewModel}_applyTemplateImpl(e){var t;super._applyTemplateImpl(e),this.properties().childs().labelText.setValue(null!==(t=e.labelText)&&void 0!==t?t:"")}_getAlertPlots(){const e=this.getPoint(3);if(!e)return[];const t=[this._points[0],this._points[1],this._points[2],e],i=(e,t)=>e.index<=t.index?[e,t]:[t,e],s=i(t[0],t[1]),r=i(t[2],t[3]);let n,o,a,l;t[2].price<t[0].price?(o=r,n=s):(o=s,n=r);const c=this.properties().childs().extendLeft.value(),h=this.properties().childs().extendRight.value();return t[0].index<=t[1].index?(a=c,l=h):(a=h,l=c),[this._linePointsToAlertPlot(n,"Upper",a,l),this._linePointsToAlertPlot(o,"Lower",a,l)].filter((e=>null!==e))}_correctLastPoint(e){if(this._points.length<2||this._points[1].index===this._points[0].index)return e;const t=(0,r.ensureNotNull)(this.pointToScreenPoint(e)),i=(0,r.ensureNotNull)(this.pointToScreenPoint(this._points[1])),s=(0,r.ensureNotNull)(this.pointToScreenPoint(this._points[0])),o=i.subtract(s),a=(t.x-s.x)/o.x,l=s.addScaled(o,a),c=t.y-l.y,h=s.add(new n.Point(0,c));return(0,r.ensureNotNull)(this.screenPointToPoint(h))}static _configureProperties(e){super._configureProperties(e),e.hasChild("labelText")||e.addChild("labelText",new h.Property("")),e.addExcludedKey("labelText",1)}_isTimePointsValid(){
return this._timePoint.every((e=>Number.isFinite(e.price)))}_axisPoints(){const e=this.points(),t=this._points[0]?this.pointToScreenPoint(this._points[0]):null,i=this._points[1]?this.pointToScreenPoint(this._points[1]):null,s=this._points[2]?this.pointToScreenPoint(this._points[2]):null;if(t&&i&&s){const o=i.y-t.y,a=s.add(new n.Point(0,o));e.push((0,r.ensureNotNull)(this.screenPointToPoint(a)))}return e}_convertLastPointTo3rdPoint(e){const t=(0,r.ensureNotNull)(this.pointToScreenPoint(e)),i=(0,r.ensureNotNull)(this.pointToScreenPoint(this._points[1])),s=(0,r.ensureNotNull)(this.pointToScreenPoint(this._points[0])),o=i.subtract(s),a=(t.x-s.x)/o.x,l=s.addScaled(o,a),c=t.y-l.y,h=s.add(new n.Point(0,c));return(0,r.ensureNotNull)(this.screenPointToPoint(h))}_findPixelsHeight(){const e=this.pointToScreenPoint(this._points[2]),t=this.pointToScreenPoint(this._points[0]);return e&&t?e.y-t.y:null}_applyPendingPriceOffset(){const e=this._pendingPriceOffset;if(null===e||this._points.length<3)return;const t=this.priceScale(),i=(0,r.ensureNotNull)(this.ownerSource()).firstValue();if(!t||t.isEmpty()||null===i)return;const s=e+this._points[0].price,n=e+this._points[1].price,o=.5*(s+n)-e,a=.5*(s+n),l=t.priceToCoordinate(o,i),c=t.priceToCoordinate(a,i)-l,h=t.priceToCoordinate(this._points[0].price,i)+c,d=t.coordinateToPrice(h,i);this._points[2].price=d,this._timePoint[2].price=d,this._points[2].index=this._points[0].index,this._timePoint[2].time_t=this._timePoint[0].time_t,this._timePoint[2].offset=this._timePoint[0].offset,this._pendingPriceOffset=null}_snapPointBeforeChange(e,t,i){if(i&&i.shift())switch(e){case 0:case 1:this._snapPoint45Degree(t,this._points[1-e]);break;case 2:case 3:const i=(0,r.ensureNotNull)(this.getPoint(5-e));this._snapPoint45Degree(t,i)}}}},14150:(e,t,i)=>{"use strict";i.d(t,{LineToolPath:()=>c});var s=i(50151),r=i(86441),n=i(55917),o=i(61993),a=i(29875),l=i(73305);class c extends a.LineDataSource{constructor(e,t,s,r){const n=t||c.createProperties();super(e,n,s,r),this._finished=!1,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,99035)).then((t=>{this._setPaneViews([new t.PathPaneView(this,e)])}))}pointsCount(){return-1}name(){return"Path"}hasEditableCoordinates(){return!1}finish(){this._finished=!0,this._lastPoint=null,this._normalizePoints(),this.createServerPoints()}addPoint(e,t,i,n){var a;if(this._finished)return!0;const l=(0,s.ensureNotNull)(this.priceScale()),c=this._model.timeScale().indexToCoordinate(e.index),h=e.price,d=(0,s.ensure)(null===(a=this.ownerSource())||void 0===a?void 0:a.firstValue()),u=l.priceToCoordinate(h,d);if(this._points.length>0){const e=this._points[this._points.length-1],i=this._model.timeScale().indexToCoordinate(e.index),s=e.price,a=l.priceToCoordinate(s,d),h=new r.Point(c,u).subtract(new r.Point(i,a)).length();if(!(null==t?void 0:t.isApiEvent())&&h<(0,o.interactionTolerance)().minDistanceBetweenPoints&&!n)return this._lastPoint=null,this._normalizePoints(),this.createServerPoints(),!0}return super.addPoint(e,t,i)}static createProperties(e){const t=new n.DefaultProperty({
defaultName:"linetoolpath",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,39878)).then((e=>e.PathDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.addChild("linesWidths",new l.LineToolWidthsProperty([(0,s.ensureDefined)(e.child("lineWidth"))])),e.addChild("linesColors",new l.LineToolColorsProperty([e.childs().lineColor]))}}},83779:(e,t,i)=>{"use strict";var s=i(45126).TranslatedString,r=i(85719).lineToolsDoNotAffectChartInvalidation,n=i(29875).LineDataSource,o=i(15399).LevelsProperty,a=i(73305),l=a.LineToolWidthsProperty,c=a.LineToolColorsProperty,h=new s("erase level line",i.i18next(null,void 0,i(35111)));class d extends n{constructor(e,t,s,r){super(e,t||d.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,4086)).then((({PitchfanLinePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}levelsCount(){return d.LevelsCount}pointsCount(){return 3}name(){return"Pitchfan"}processErase(e,t){var i="level"+t,s=this.properties()[i].visible;e.setProperty(s,!1,h,r)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,56641))).PitchBaseDefinitionsViewModel}static createProperties(e){var t=new o({defaultName:"linetoolpitchfan",state:e,map:{range:[0,8]}});return this._configureProperties(t),t}static _configureProperties(e){super._configureProperties(e);for(var t=[e.child("median").child("linewidth")],i=[e.child("median").child("color")],s=0;s<=this.LevelsCount;s++)t.push(e.child("level"+s).child("linewidth")),i.push(e.child("level"+s).child("color"));e.addChild("linesColors",new c(i)),e.addChild("linesWidths",new l(t))}}d.LevelsCount=8,t.LineToolPitchfan=d},96333:(e,t,i)=>{"use strict";var s;i.d(t,{LineToolPitchforkStyle:()=>s}),function(e){e[e.Original=0]="Original",e[e.Schiff=1]="Schiff",e[e.Inside=2]="Inside",e[e.Schiff2=3]="Schiff2"}(s||(s={}))},64002:(e,t,i)=>{"use strict";var s=i(45126).TranslatedString,r=i(85719).lineToolsDoNotAffectChartInvalidation,n=i(29875).LineDataSource,o=i(15399).LevelsProperty,a=i(97702).Action,l=i(33388).ACTION_ID,c=i(96333).LineToolPitchforkStyle,h=null,d=i(73305),u=d.LineToolWidthsProperty,p=d.LineToolColorsProperty,_=new s("erase level line",i.i18next(null,void 0,i(35111))),m=new s("change {title} style",i.i18next(null,void 0,i(98463)));class g extends n{constructor(e,t,i,s){super(e,t||g.createProperties(),i,s),this._properties.style.listeners().subscribe(this,this._recreatePaneView),this._recreatePaneView()}levelsCount(){return g.LevelsCount}additionalActions(e){for(var t=[],n=[{title:i.i18next(null,void 0,i(46005)),actionId:l.ChartLineToolPitchforkChangeTypeToOriginal},{title:i.i18next(null,void 0,i(70382)),actionId:l.ChartLineToolPitchforkChangeTypeToModifiedSchiff},{title:i.i18next(null,void 0,i(91612)),actionId:l.ChartLineToolPitchforkChangeTypeToInside},{title:i.i18next(null,void 0,i(69904)),
actionId:l.ChartLineToolPitchforkChangeTypeToSchiff}],o=0;o<4;o++){var c=new a({actionId:n[o].actionId,options:{checked:this.properties().style.value()===o,checkable:!0,label:n[o].title,payload:{target:this,value:o},onExecute:function(t){var i=t.getPayload(),n=i.target;e.setProperty(n.properties().style,i.value,m.format({title:new s(n.name(),n.title())}),r),n.updateAllViews(),n._model.updateSource(n)}}});t.push(c)}return[t[0],t[3],t[1],t[2]]}_recreatePaneView(){if(null!==h){var e=[];this._properties.style.value()===c.Original?e=[new h.PitchforkLinePaneView(this,this._model)]:this._properties.style.value()===c.Schiff?e=[new h.SchiffPitchforkLinePaneView(this,this._model)]:this._properties.style.value()===c.Schiff2?e=[new h.SchiffPitchfork2LinePaneView(this,this._model)]:this._properties.style.value()===c.Inside&&(e=[new h.InsidePitchforkLinePaneView(this,this._model)]),this._setPaneViews(e)}else Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,68470)).then((e=>{null===h&&(h=e),this._recreatePaneView()}))}pointsCount(){return 3}name(){return"Pitchfork"}processErase(e,t){var i="level"+t,s=this.properties()[i].visible;e.setProperty(s,!1,_,r)}static createProperties(e){var t=new o({defaultName:"linetoolpitchfork",state:e,map:{range:[0,8]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,10258))).PitchForkDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);for(var t=[e.child("median").child("linewidth")],i=[e.child("median").child("color")],s=0;s<=this.LevelsCount;s++)t.push(e.child("level"+s).child("linewidth")),i.push(e.child("level"+s).child("color"));e.addChild("linesColors",new p(i)),e.addChild("linesWidths",new u(t))}}g.LevelsCount=8,t.LineToolPitchfork=g},51691:(e,t,i)=>{"use strict";i.d(t,{LineToolPolyline:()=>l});var s=i(50151),r=i(86441),n=i(55917),o=i(61993),a=i(29875);class l extends a.LineDataSource{constructor(e,t,s,r){const n=t||l.createProperties();super(e,n,s,r),this._finished=!1,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,65765)).then((t=>{this._setPaneViews([new t.PolylinePaneView(this,e)])}))}pointsCount(){return-1}name(){return"Polyline"}hasEditableCoordinates(){return!1}finish(){this._finished=!0,this._lastPoint=null,this._normalizePoints(),this.createServerPoints()}addPoint(e,t,i,n){var a;if(this._finished)return!0;const l=(0,s.ensureNotNull)(this.priceScale()),c=this._model.timeScale().indexToCoordinate(e.index),h=e.price,d=(0,s.ensure)(null===(a=this.ownerSource())||void 0===a?void 0:a.firstValue()),u=l.priceToCoordinate(h,d),p=(0,o.interactionTolerance)().minDistanceBetweenPoints;if(this._points.length>0){const e=this._points[this._points.length-1],i=this._model.timeScale().indexToCoordinate(e.index),s=e.price,o=l.priceToCoordinate(s,d),a=new r.Point(c,u).subtract(new r.Point(i,o)).length();if(!(null==t?void 0:t.isApiEvent())&&a<p&&!n)return this._lastPoint=null,this._normalizePoints(),this.createServerPoints(),!0
;const h=this._points[0],_=this._model.timeScale().indexToCoordinate(h.index),m=l.priceToCoordinate(h.price,d),g=new r.Point(c,u).subtract(new r.Point(_,m)).length();if(!(null==t?void 0:t.isApiEvent())&&g<p&&!n)return this.properties().childs().filled.setValue(!0),this._lastPoint=null,this._normalizePoints(),this.createServerPoints(),!0}return super.addPoint(e,t,i)}setPoint(e,t,i){var n;super.setPoint(e,t,i);const a=this.priceScale();if(!(this._model.timeScale().isEmpty()||null===a||a.isEmpty()||e!==this._points.length-1&&0!==e)){const i=(0,s.ensure)(null===(n=this.ownerSource())||void 0===n?void 0:n.firstValue()),l=this._model.timeScale().indexToCoordinate(t.index),c=a.priceToCoordinate(t.price,i),h=e===this._points.length-1?this._points[0]:this._points[this._points.length-1],d=this._model.timeScale().indexToCoordinate(h.index),u=a.priceToCoordinate(h.price,i);new r.Point(l,c).subtract(new r.Point(d,u)).length()<(0,o.interactionTolerance)().minDistanceBetweenPoints&&this.properties().childs().filled.setValue(!0)}}static createProperties(e){const t=new n.DefaultProperty({defaultName:"linetoolpolyline",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,16963)).then((e=>e.PolylinesDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.addExcludedKey("filled",1)}}},40265:(e,t,i)=>{"use strict";var s=i(36009).LineToolTrading,r=i(29875).LineDataSource,n=i(81776).LineToolTradingPriceAxisView,o=i(91920),a=i(55917).DefaultProperty;const l=i(56570);var c=i(2718).sortSourcesPreOrdered.LineToolPosition;function h(e){return null==e?e="":e+="",e}class d{constructor(e){this._line=e,this._data={bodyText:"position",quantityText:"0"},this._closeEnabled=!0,this._direction="buy",this._profitState="neutral"}setDirection(e){return this._direction=e,this._line.updateAllViewsAndRedraw(),this}setProfitState(e){return this._profitState=e,this._line.updateAllViewsAndRedraw(),this}getPrice(){return this._line.points().length>0?this._line.points()[0].price:this._line._timePoint.length>0?this._line._timePoint[0].price:void 0}setPrice(e){if(this._line.points().length>0){var t=this._line.points()[0];t.price=e,this._line.setPoint(0,t),this._line.updateAllViewsAndRedraw()}return this._line._timePoint.length>0&&(this._line._timePoint[0].price=e),this}getText(){return this._data.bodyText}setText(e){return this._data.bodyText=e||"",this._line.updateAllViewsAndRedraw(),this}setTooltip(e){return this._line.properties().tooltip.setValue(h(e)),this}getTooltip(){return this._line.properties().tooltip.value()}setProtectTooltip(e){return this._line.properties().protectTooltip.setValue(h(e)),this}getProtectTooltip(){return this._line.properties().protectTooltip.value()}setCloseTooltip(e){return this._line.properties().closeTooltip.setValue(h(e)),this}getCloseTooltip(){return this._line.properties().closeTooltip.value()}setReverseTooltip(e){return this._line.properties().reverseTooltip.setValue(h(e)),this}
getReverseTooltip(){return this._line.properties().reverseTooltip.value()}getQuantity(){return this._data.quantityText}setQuantity(e){return this._data.quantityText=e||"",this._line.updateAllViewsAndRedraw(),this}getExtendLeft(){var e=this._line.properties().extendLeft.value();return"inherit"===e?this._line._model.properties().tradingProperties.extendLeft.value():e}setExtendLeft(e){return this._line.properties().extendLeft.setValue(e),this}getLineLength(){var e=this._line.properties().lineLength.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineLength.value():e}getLineLengthUnit(){return this._line.properties().lineLengthUnit.value()}setLineLength(e,t="percentage"){const i=t&&"pixel"===t?e:Math.max(0,Math.min(e,100));return this._line.properties().lineLength.setValue(i),this._line.properties().lineLengthUnit.setValue(t),this}getLineColor(){var e=this._line.properties();return("buy"===this._direction?e.lineBuyColor:e.lineSellColor).value()}setLineColor(e){return"buy"===this._direction?this.setLineBuyColor(e):this.setLineSellColor(e),this}setLineBuyColor(e){return this._line.properties().lineBuyColor.setValue(e),this}setLineSellColor(e){return this._line.properties().lineSellColor.setValue(e),this}getLineStyle(){var e=this._line.properties().lineStyle.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineStyle.value():e}setLineStyle(e){return this._line.properties().lineStyle.setValue(e),this}getLineWidth(){var e=this._line.properties().lineWidth.value();return"inherit"===e?this._line._model.properties().tradingProperties.lineWidth.value():e}setLineWidth(e){return this._line.properties().lineWidth.setValue(e),this}getBodyBorderColor(){var e=this._line.properties();return("buy"===this._direction?e.bodyBorderBuyColor:e.bodyBorderSellColor).value()}setBodyBorderColor(e){return"buy"===this._direction?this.setBodyBorderBuyColor(e):this.setBodyBorderSellColor(e),this}setBodyBorderBuyColor(e){return this._line.properties().bodyBorderBuyColor.setValue(e),this}setBodyBorderSellColor(e){return this._line.properties().bodyBorderSellColor.setValue(e),this}getBodyBackgroundColor(){return o.getColorFromProperties(this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency)}setBodyBackgroundColor(e){return o.setColorToProperties(e,this._line.properties().bodyBackgroundColor,this._line.properties().bodyBackgroundTransparency),this}getBodyTextColor(){var e=this._line.properties();return("positive"===this._profitState?e.bodyTextPositiveColor:"negative"===this._profitState?e.bodyTextNegativeColor:e.bodyTextNeutralColor).value()}setBodyTextColor(e){return"positive"===this._profitState?this.setBodyTextPositiveColor(e):"negative"===this._profitState?this.setBodyTextNegativeColor(e):this.setBodyTextNeutralColor(e),this}setBodyTextPositiveColor(e){return this._line.properties().bodyTextPositiveColor.setValue(e),this}setBodyTextNegativeColor(e){return this._line.properties().bodyTextNegativeColor.setValue(e),this}setBodyTextNeutralColor(e){
return this._line.properties().bodyTextNeutralColor.setValue(e),this}getBodyFont(){return o.getFontFromProperties(this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic)}setBodyFont(e){return o.setFontToProperties(e,this._line.properties().bodyFontFamily,this._line.properties().bodyFontSize,this._line.properties().bodyFontBold,this._line.properties().bodyFontItalic),this}getQuantityBorderColor(){var e=this._line.properties();return("buy"===this._direction?e.quantityBorderBuyColor:e.quantityBorderSellColor).value()}setQuantityBorderColor(e){return"buy"===this._direction?this.setQuantityBorderBuyColor(e):this.setQuantityBorderSellColor(e),this}setQuantityBorderBuyColor(e){return this._line.properties().quantityBorderBuyColor.setValue(e),this}setQuantityBorderSellColor(e){return this._line.properties().quantityBorderSellColor.setValue(e),this}getQuantityBackgroundColor(){var e=this._line.properties();return("buy"===this._direction?e.quantityBackgroundBuyColor:e.quantityBackgroundSellColor).value()}setQuantityBackgroundColor(e){return"buy"===this._direction?this.setQuantityBackgroundBuyColor(e):this.setQuantityBackgroundSellColor(e),this}setQuantityBackgroundBuyColor(e){return this._line.properties().quantityBackgroundBuyColor.setValue(e),this}setQuantityBackgroundSellColor(e){return this._line.properties().quantityBackgroundSellColor.setValue(e),this}getQuantityTextColor(){return o.getColorFromProperties(this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency)}setQuantityTextColor(e){return o.setColorToProperties(e,this._line.properties().quantityTextColor,this._line.properties().quantityTextTransparency),this}getQuantityFont(){return o.getFontFromProperties(this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic)}setQuantityFont(e){return o.setFontToProperties(e,this._line.properties().quantityFontFamily,this._line.properties().quantityFontSize,this._line.properties().quantityFontBold,this._line.properties().quantityFontItalic),this}getReverseButtonBorderColor(){var e=this._line.properties();return("buy"===this._direction?e.reverseButtonBorderBuyColor:e.reverseButtonBorderSellColor).value()}setReverseButtonBorderColor(e){return"buy"===this._direction?this.setReverseButtonBorderBuyColor(e):this.setReverseButtonBorderSellColor(e),this}setReverseButtonBorderBuyColor(e){return this._line.properties().reverseButtonBorderBuyColor.setValue(e),this}setReverseButtonBorderSellColor(e){return this._line.properties().reverseButtonBorderSellColor.setValue(e),this}getReverseButtonBackgroundColor(){return o.getColorFromProperties(this._line.properties().reverseButtonBackgroundColor,this._line.properties().reverseButtonBackgroundTransparency)}setReverseButtonBackgroundColor(e){
return o.setColorToProperties(e,this._line.properties().reverseButtonBackgroundColor,this._line.properties().reverseButtonBackgroundTransparency),this}getReverseButtonIconColor(){var e=this._line.properties();return("buy"===this._direction?e.reverseButtonIconBuyColor:e.reverseButtonIconSellColor).value()}setReverseButtonIconColor(e){return"buy"===this._direction?this.setReverseButtonIconBuyColor(e):this.setReverseButtonIconSellColor(e),this}setReverseButtonIconBuyColor(e){return this._line.properties().reverseButtonIconBuyColor.setValue(e),this}setReverseButtonIconSellColor(e){return this._line.properties().reverseButtonIconSellColor.setValue(e),this}getCloseButtonBorderColor(){var e=this._line.properties();return("buy"===this._direction?e.closeButtonBorderBuyColor:e.closeButtonBorderSellColor).value()}setCloseButtonBorderColor(e){return"buy"===this._direction?this.setCloseButtonBorderBuyColor(e):this.setCloseButtonBorderSellColor(e),this}setCloseButtonBorderBuyColor(e){return this._line.properties().closeButtonBorderBuyColor.setValue(e),this}setCloseButtonBorderSellColor(e){return this._line.properties().closeButtonBorderSellColor.setValue(e),this}getCloseButtonBackgroundColor(){return o.getColorFromProperties(this._line.properties().closeButtonBackgroundColor,this._line.properties().closeButtonBackgroundTransparency)}setCloseButtonBackgroundColor(e){return o.setColorToProperties(e,this._line.properties().closeButtonBackgroundColor,this._line.properties().closeButtonBackgroundTransparency),this}getCloseButtonIconColor(){var e=this._line.properties();return("buy"===this._direction?e.closeButtonIconBuyColor:e.closeButtonIconSellColor).value()}setCloseButtonIconColor(e){return"buy"===this._direction?this.setCloseButtonIconBuyColor(e):this.setCloseButtonIconSellColor(e),this}setCloseButtonIconBuyColor(e){return this._line.properties().closeButtonIconBuyColor.setValue(e),this}setCloseButtonIconSellColor(e){return this._line.properties().closeButtonIconSellColor.setValue(e),this}block(){this._blocked=!0,this._line.updateAllViewsAndRedraw()}unblock(){this._blocked=!1,this._line.updateAllViewsAndRedraw()}isFunction(e){return"function"==typeof e}onReverse(e,t){return t?this.isFunction(t)&&(this._onReverseData=e,this._onReverseCallback=t):this.isFunction(e)&&(this._onReverseCallback=e),this}callOnReverse(){this.isFunction(this._onReverseCallback)&&this._onReverseCallback.call(this,this._onReverseData)}isOnReverseCallbackPresent(){return this.isFunction(this._onReverseCallback)}onClose(e,t){return t?this.isFunction(t)&&(this._onCloseData=e,this._onCloseCallback=t):this.isFunction(e)&&(this._onCloseCallback=e),this}setCloseEnabled(e){return this._closeEnabled===e||(this._closeEnabled=e,this._onCloseCallback&&this._line.updateAllViewsAndRedraw()),this}isCloseEnabled(){return this._closeEnabled}callOnClose(){this.isFunction(this._onCloseCallback)&&this._closeEnabled&&this._onCloseCallback.call(this,this._onCloseData)}isOnCloseCallbackPresent(){return this._closeEnabled&&this.isFunction(this._onCloseCallback)}onModify(e,t){
return t?this.isFunction(t)&&(this._onModifyData=e,this._onModifyCallback=t):this.isFunction(e)&&(this._onModifyCallback=e),this}callOnModify(){this.isFunction(this._onModifyCallback)&&this._onModifyCallback.call(this,this._onModifyData)}onContextMenu(e,t){return t?this.isFunction(t)&&(this._onContextMenuData=e,this._onContextMenuCallback=t):this.isFunction(e)&&(this._onContextMenuCallback=e),this}shouldShowContextMenu(){return this.isFunction(this._onContextMenuCallback)}callOnContextMenu(){if(this.isFunction(this._onContextMenuCallback))return this._onContextMenuCallback.call(this,this._onContextMenuData)}remove(){this._line._model.removeSource(this._line),delete this._line}}class u extends s{constructor(e,t){super(e,t||u.createProperties()),this._adapter=new d(this),Promise.all([i.e(2870),i.e(1583)]).then(i.t.bind(i,38420,19)).then((({PositionPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}adapter(){return this._adapter}zorder(){return c}isSpeciallyZOrderedSource(){return!0}setPoint(e,t){this._points[e]=t,this._normalizePoints()}addPoint(e,t){return this._points.push(e),this._lastPoint=null,this._normalizePoints(),this.createServerPoints(),!0}name(){return"Position"}createPriceAxisView(e){return this._priceAxisView=new n(this,{pointIndex:e,backgroundPropertyGetter:()=>this._adapter.getLineColor()}),this._priceAxisView}paneViews(){return TradingView.printing&&!l.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showPositions.value()?r.prototype.paneViews.call(this):null}priceAxisViews(e,t){return TradingView.printing&&!l.enabled("snapshot_trading_drawings")?null:this._model.properties().tradingProperties.showPositions.value()?r.prototype.priceAxisViews.call(this,e,t):null}hasContextMenu(){return this._adapter.shouldShowContextMenu()}contextMenuItems(){return this._adapter.callOnContextMenu()}formatter(){return this._formatter}static createProperties(e){var t=new a({defaultName:"linetoolposition",state:e,useUserPreferences:!1});return this._configureProperties(t),t}}t.LineToolPosition=u},27442:(e,t,i)=>{"use strict";var s,r;i.d(t,{AlertStatus:()=>s,Direction:()=>r}),function(e){e[e.Waiting=0]="Waiting",e[e.Success=1]="Success",e[e.Failure=2]="Failure"}(s||(s={})),function(e){e[e.Up=1]="Up",e[e.Down=2]="Down"}(r||(r={}))},29356:(e,t,i)=>{"use strict";i.d(t,{LineToolPrediction:()=>l});var s=i(50151),r=i(55917),n=i(12988),o=i(29875),a=i(27442);class l extends o.LineDataSource{constructor(e,t,s,r){const n=t||l.createProperties();super(e,n,s,r),this._predictionPaneView=null;const o=this._model.mainSeries();o.properties().childs().interval.subscribe(this,(()=>{this.setStatus(a.AlertStatus.Waiting)})),o.dataEvents().dataUpdated().subscribe(this,this.recalculateStateByData),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,75872)).then((t=>{this._predictionPaneView=new t.PredictionPaneView(this,e),this._setPaneViews([this._predictionPaneView])}))}destroy(){const e=this._model.mainSeries();e.properties().childs().interval.unsubscribeAll(this),
e.dataEvents().dataUpdated().unsubscribeAll(this),super.destroy()}dataAndViewsReady(){return super.dataAndViewsReady()&&Boolean(this._predictionPaneView&&this._predictionPaneView.iconsReady())}cloneable(){return!1}isSynchronizable(){return!1}status(){return this._properties.childs().status.value()}setStatus(e){return this._properties.childs().status.setValue(e)}pointsCount(){return 2}name(){return"Forecast"}restorePoints(e,t,i){super.restorePoints(e,t,i),this.recalculateStateByData()}recalculateStateByData(){if(this.isSourceHidden())return;if(this._points.length<2)return;if(this._model.mainSeries().bars().isEmpty())return;const e=this._points[1];if(this.status())return void(e.index>this._model.timeScale().baseIndex()&&this.setStatus(a.AlertStatus.Waiting));const t=this._model.mainSeries().bars().valueAt(e.index);if(null===t)return;const i=this.direction();if(i===a.Direction.Up&&(0,s.ensure)(t[2])>=e.price)this.setStatus(a.AlertStatus.Success);else if(i===a.Direction.Down&&(0,s.ensure)(t[3])<=e.price)this.setStatus(a.AlertStatus.Success);else{const t=(0,s.ensureNotNull)(this._model.mainSeries().bars().lastIndex());e.index!==t&&this.setStatus(a.AlertStatus.Failure)}}addPoint(e,t,i){const s=super.addPoint(e,t,i);return s&&this.recalculateStateByData(),s}endChanging(e,t){const i=super.endChanging(e,t);return this.setStatus(a.AlertStatus.Waiting),this.recalculateStateByData(),i}onData(e){super.onData(e),this.recalculateStateByData()}endMoving(e,t,i){const s=super.endMoving(e,t,i);return this.setStatus(a.AlertStatus.Waiting),this.recalculateStateByData(),s}direction(){if(this._points.length<2)return a.Direction.Up;const e=this._points[0];return this._points[1].price>e.price?a.Direction.Up:a.Direction.Down}static createProperties(e){const t=new r.DefaultProperty({defaultName:"linetoolprediction",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,26486)).then((e=>e.PredictionDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.hasChild("status")||e.addChild("status",new n.Property(a.AlertStatus.Waiting))}}},83710:(e,t,i)=>{"use strict";var s=i(29875).LineDataSource,r=i(55917).DefaultProperty,n=i(73305).LineToolColorsProperty;class o extends s{constructor(e,t,s,r){super(e,t||o.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.t.bind(i,97105,19)).then((({PriceLabelPaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}pointsCount(){return 1}name(){return"Price Label"}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,89785))).PriceLabelDefinitionsViewModel}static createProperties(e){var t=new r({defaultName:"linetoolpricelabel",state:e});return this._configureProperties(t),t}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new n([e.childs().borderColor])),e.addChild("textsColors",new n([e.childs().color]))}}t.LineToolPriceLabel=o},16299:(e,t,i)=>{
"use strict";i.r(t),i.d(t,{LineToolPriceNote:()=>C});var s=i(50151),r=i(29875),n=i(19625),o=i(24633),a=i(6590),l=i(73305),c=i(31229),h=i(55917),d=i(11402),u=i(12988),p=i(38039);const _={intervalsVisibilities:{...c.intervalsVisibilitiesDefaults},showLabel:!1,horzLabelsAlign:"center",vertLabelsAlign:"top",fontSize:14,bold:!1,italic:!1,priceLabelFontSize:12,priceLabelBold:!1,priceLabelItalic:!1},m=(0,n.getHexColorByName)("color-tv-blue-500"),g={lineColor:m,textColor:m,priceLabelBackgroundColor:m,priceLabelBorderColor:m,priceLabelTextColor:(0,n.getHexColorByName)("color-white")},f=new Map([[o.StdTheme.Light,g],[o.StdTheme.Dark,g]]),v=(0,h.extractAllPropertiesKeys)((0,s.ensureDefined)(f.get(o.StdTheme.Light))),y=(0,h.extractAllPropertiesKeys)(_),S=[...v,...y,...a.commonLineToolPropertiesStateKeys,"text"];class b extends p.LineDataSourceProperty{constructor(e){var t,i;super(e),this._textProperty=new u.Property(null!==(i=null===(t=e.state)||void 0===t?void 0:t.text)&&void 0!==i?i:""),this.addChild("text",this._textProperty),this.addChild("linesColors",new l.LineToolColorsProperty([(0,s.ensureDefined)(this.child("lineColor"))])),this.addChild("backgroundsColors",new l.LineToolColorsProperty([(0,s.ensureDefined)(this.child("priceLabelBackgroundColor"))])),this.addChild("textsColors",new l.LineToolColorsProperty([(0,s.ensureDefined)(this.child("priceLabelTextColor"))]))}template(){return{...super.template(),text:this._textProperty.value()}}static create(e){return new this({defaultName:"linetoolpricenote",factoryDefaultsSupplier:()=>(0,d.factoryDefaultsForCurrentTheme)(_,f),nonThemedDefaultsKeys:y,themedDefaultsKeys:v,allStateKeys:S,state:e})}}var w=i(44672);class C extends r.LineDataSource{constructor(e,t,s,r){super(e,t||C.createProperties(),s,r),this._labelMovingDelta=null,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,1174)).then((t=>{this._setPaneViews([new t.PriceNotePaneView(this,e)])}))}pointsCount(){return 2}name(){return"Price Note"}template(){return this._properties.template()}startMoving(e,t,i){if(1===t){if(this.isSourceHidden())return;const i=(0,s.ensureDefined)(e.logical),r=this.points()[1];this._labelMovingDelta={index:r.index-i.index,price:r.price-i.price},this.startChanging(t,i)}else this._labelMovingDelta=null,super.startMoving(e,t,i)}move(e,t,i){if(null!==this._labelMovingDelta){const t=(0,s.ensureDefined)(e.logical),r={index:t.index+this._labelMovingDelta.index,price:t.price+this._labelMovingDelta.price};this.setPoint(1,r,i),this.updateAllViews((0,w.sourceChangeEvent)(this.id()))}else super.move(e,t,i)}endMoving(e,t,i){return null!==this._labelMovingDelta?(this._labelMovingDelta=null,this.endChanging(!1,e)):super.endMoving(e,t,i)}static createProperties(e){const t=b.create(e);return this._configureProperties(t),t}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}async _getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,286)).then((e=>e.PriceNoteDefinitionsViewModel))}_snapTo45DegreesAvailable(){
return!0}static _addCollectedProperties(e){}}},23234:(e,t,i)=>{"use strict";i.d(t,{LineToolPriceRange:()=>g});var s=i(29875),r=i(50151),n=i(24633),o=i(55917),a=i(11402),l=i(76607),c=i(6590);const h={...l.nonThemedFactoryDefaultsBase,extendLeft:!1,extendRight:!1},d=l.themedFactoryDefaultsBase,u=(0,o.extractAllPropertiesKeys)((0,r.ensureDefined)(d.get(n.StdTheme.Light))),p=(0,o.extractAllPropertiesKeys)(h),_=[...u,...p,...c.commonLineToolPropertiesStateKeys,...l.allPropertiesStateKeysBase];class m extends l.DateAndPriceBaseProperties{static create(e){return new this({defaultName:"linetoolpricerange",factoryDefaultsSupplier:()=>(0,a.factoryDefaultsForCurrentTheme)(h,d),nonThemedDefaultsKeys:p,themedDefaultsKeys:u,allStateKeys:_,state:e})}}class g extends s.LineDataSource{constructor(e,t,s,r){super(e,t||g.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,64661)).then((e=>{this._setPaneViews([new e.PriceRangePaneView(this,this._model)])}))}pointsCount(){return 2}name(){return"Price Range"}template(){return this._properties.template()}static createProperties(e){const t=m.create(e);return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,14336))).GeneralDatePriceRangeDefinitionsViewModel}}},12120:(e,t,i)=>{"use strict";i.d(t,{LineToolProjection:()=>a});var s,r=i(90882),n=i(15399),o=i(73305);!function(e){e[e.LevelsCount=1]="LevelsCount"}(s||(s={}));class a extends r.LineToolFibWedgeBase{constructor(e,t,s,r){super(e,null!=t?t:a.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,31869)).then((e=>{this._setPaneViews([new e.ProjectionLinePaneView(this,this._model)])}))}levelsCount(){return 1}name(){return"Projection"}static createProperties(e){const t=new n.LevelsProperty({defaultName:"linetoolprojection",state:e,map:{range:[1,1]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,48306))).ProjectionDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new o.LineToolColorsProperty([e.childs().trendline.childs().color]))}}},36224:(e,t,i)=>{"use strict";i.d(t,{LineToolRay:()=>r});var s=i(99294);class r extends s.LineToolTrendLine{constructor(e,t,i,s){super(e,null!=t?t:r.createProperties(),i,s)}name(){return"Ray"}static createProperties(e){const t=s.LineToolTrendLine._createPropertiesImpl("linetoolray",e);return r._configureProperties(t),t}}},34054:(e,t,i)=>{"use strict";i.d(t,{LineToolRectangle:()=>h});var s,r=i(50151),n=i(86441),o=i(55917),a=i(12988),l=i(10568),c=i(73305);!function(e){e[e.LeftTopAnchor=0]="LeftTopAnchor",e[e.TopMiddleAnchor=6]="TopMiddleAnchor",e[e.RightTopAnchor=3]="RightTopAnchor",e[e.RightMiddleAnchor=5]="RightMiddleAnchor",e[e.RightBottomAnchor=1]="RightBottomAnchor",e[e.BottomMiddleAnchor=7]="BottomMiddleAnchor",e[e.LeftBottomAnchor=2]="LeftBottomAnchor",
e[e.LeftMiddleAnchor=4]="LeftMiddleAnchor"}(s||(s={}));class h extends l.InplaceTextLineDataSource{constructor(e,t,s,r){const n=t||h.createProperties();super(e,n,s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,41883)).then((({RectanglePaneView:t})=>{const i=[new t(this,e,this._openTextEditor.bind(this),this._closeTextEditor.bind(this),this.onSelectionChange.bind(this))];this._setPaneViews(i)}))}pointsCount(){return 2}textColorsProperty(){return this.properties().childs().showLabel.value()?super.textColorsProperty():null}name(){return"Rectangle"}setPoint(e,t,i){if(e<2&&super.setPoint(e,t,i),i&&i.shift()){const i=this._getAnchorPointForIndex(e);if(e>=4)return this._correctMiddlePoints(e,t,i),void this._normalizePoints();this._snapPoint45Degree(t,i)}switch(e){case 2:this._points[1].price=t.price,this._points[0].index=t.index;break;case 3:this._points[0].price=t.price,this._points[1].index=t.index;break;case 4:this._points[0].index=t.index;break;case 5:this._points[1].index=t.index;break;case 6:this._points[0].price=t.price;break;case 7:this._points[1].price=t.price}this._normalizePoints()}getPoint(e){return e<2?super.getPoint(e):this._getAnchorPointForIndex(e)}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}editableTextProperties(){const e=this.properties().childs();return{text:e.text,textColor:e.textColor,textVisible:e.showLabel}}static createProperties(e,t){const i=new o.DefaultProperty({defaultName:"linetoolrectangle",state:e,useUserPreferences:t});return this._configureProperties(i),i}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,15041)).then((e=>e.RectangleDefinitionsViewModel))}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}_snapPoint45Degree(e,t,i){const s=this._priceScale,n=this.ownerSource();if(null===s||null===n)return;const o=n.firstValue();if(null===o)return;const a=this._model.timeScale(),l=(0,r.ensureNotNull)(this.pointToScreenPoint(e)),c=(0,r.ensureNotNull)(this.pointToScreenPoint(t)),h=l.x-c.x,d=l.y-c.y,u=h<0?-1:1,p=d<0?-1:1,_=Math.max(Math.abs(h),Math.abs(d)),m=Math.round(a.coordinateToIndex(c.x+_*u)),g=Math.abs(a.indexToCoordinate(m)-c.x),f=s.coordinateToPrice(c.y+g*p,o);e.index=m,e.price=f}_correctMiddlePoints(e,t,i){e<6?this._correctRightLeftMiddlePoint(e,t,i):this._correctTopBottomMiddlePoint(e,t,i)}_correctRightLeftMiddlePoint(e,t,i){const s=(0,r.ensureNotNull)(this.pointToScreenPoint(t)),o=(0,r.ensureNotNull)(this.pointToScreenPoint(i)),a=(0,r.ensureNotNull)(this.pointToScreenPoint(this._points[0])),l=(0,r.ensureNotNull)(this.pointToScreenPoint(this._points[1]));let c=s.x-o.x;if(0===c)return;const h=a.x<l.x?1:-1,d=a.y<l.y?1:-1;switch(c*=h,e){case 4:{const e=l.y-d*c/2,t=(0,r.ensureNotNull)(this.screenPointToPoint(new n.Point(l.x,e)));this._points[1].price=t.price;const i=(0,r.ensureNotNull)(this.screenPointToPoint(new n.Point(a.x+h*c,a.y+d*c/2)));this._points[0].price=i.price,this._points[0].index=i.index;break}case 5:{
const e=a.y-d*c/2,t=(0,r.ensureNotNull)(this.screenPointToPoint(new n.Point(a.x,e)));this._points[0].price=t.price;const i=(0,r.ensureNotNull)(this.screenPointToPoint(new n.Point(l.x+h*c,l.y+d*c/2)));this._points[1].price=i.price,this._points[1].index=i.index;break}}}_correctTopBottomMiddlePoint(e,t,i){const s=this._priceScale,o=this.ownerSource();if(null===s||null===o)return;const a=this._model.timeScale(),l=o.firstValue();if(null===l)return;const c=(0,r.ensureNotNull)(this.pointToScreenPoint(t)),h=(0,r.ensureNotNull)(this.pointToScreenPoint(i)),d=(0,r.ensureNotNull)(this.pointToScreenPoint(this._points[0])),u=(0,r.ensureNotNull)(this.pointToScreenPoint(this._points[1])),p=c.y-h.y,_=p<0?-1:1,m=d.x<u.x?1:-1,g=d.y<u.y?1:-1;switch(e){case 6:{const e=Math.floor(u.x-m*p/2),t=(0,r.ensureNotNull)(this.screenPointToPoint(new n.Point(e,u.y))),i=Math.abs(this._points[1].index-t.index),o=m*g*_*Math.ceil(i/2);if(0===o)return;this._points[1].index=this._points[1].index-o;const c=_*Math.abs(a.indexToCoordinate(this._points[1].index)-u.x);this._points[0].price=s.coordinateToPrice(d.y+c,l),this._points[0].index=this._points[0].index+o;break}case 7:{const e=Math.floor(d.x-m*p/2),t=(0,r.ensureNotNull)(this.screenPointToPoint(new n.Point(e,d.y))),i=Math.abs(this._points[0].index-t.index),o=m*g*_*Math.ceil(i/2);if(0===o)return;this._points[0].index=this._points[0].index-o;const c=_*Math.abs(a.indexToCoordinate(this._points[0].index)-d.x);this._points[1].price=s.coordinateToPrice(u.y+c,l),this._points[1].index=this._points[1].index+o;break}}}_snapTo45DegreesAvailable(){return!0}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new a.Property("")),e.addChild("linesColors",new c.LineToolColorsProperty([e.childs().color])),e.addChild("textsColors",new c.LineToolColorsProperty([e.childs().textColor],e.childs().showLabel)),e.addExcludedKey("text",1),e.addExcludedKey("linesColors",1),e.addExcludedKey("textsColors",1)}_getAnchorPointForIndex(e){const t=this.points(),i=t[0],s=t[1];let r=0,n=0;switch(e){case 0:r=i.price,n=i.index;break;case 1:r=s.price,n=s.index;break;case 2:r=s.price,n=i.index;break;case 3:r=i.price,n=s.index;break;case 4:r=(s.price+i.price)/2,n=i.index;break;case 5:r=(s.price+i.price)/2,n=s.index;break;case 6:r=i.price,n=(s.index+i.index)/2;break;case 7:r=s.price,n=(s.index+i.index)/2}return{index:n,price:r}}}},76386:(e,t,i)=>{"use strict";var s;i.d(t,{RiskDisplayMode:()=>s}),function(e){e.Percentage="percents",e.Money="money"}(s||(s={}))},76050:(e,t,i)=>{"use strict";var s;i.d(t,{RiskRewardPointIndex:()=>s}),function(e){e[e.Entry=0]="Entry",e[e.Close=1]="Close",e[e.ActualEntry=2]="ActualEntry",e[e.ActualClose=3]="ActualClose"}(s||(s={}))},82650:(e,t,i)=>{"use strict";i.d(t,{LineToolRiskRewardLong:()=>T,LineToolRiskRewardShort:()=>x});var s=i(50151),r=i(8025),n=i(93280),o=i(29875),a=i(76386),l=i(76050),c=i(98558),h=i(19063);class d extends c.PriceAxisView{constructor(e,t){super(),this._source=e,this._data=t}_updateRendererData(e,t,i){if(e.visible=!1,!this._showAxisLabel())return
;const s=this._source.priceScale();if(0===this._source.points().length||null===s||s.isEmpty())return;const r=this._source.ownerSource(),n=null!==r?r.firstValue():null;if(null===n)return;const o=this._data.priceProperty.value(),a=(0,h.resetTransparency)(this._data.colorProperty.value());i.background=a,i.textColor=this.generateTextColor(a),i.coordinate=s.priceToCoordinate(o,n),e.text=s.formatPrice(o,n),e.visible=!0}_showAxisLabel(){return this._source.properties().childs().showPriceLabels.value()||this._source.model().selection().isSelected(this._source)}}var u=i(12988);class p extends u.Property{constructor(e,t){super(),this._lineSource=e,this._pointIndex=t}value(){const e=this._lineSource.points()[this._pointIndex].price;return this._formatAndParsePrice(e)}state(){return this.value()}merge(e,t){return this.setValue(e),t?[]:null}_formatAndParsePrice(e){var t;const i=(0,s.ensureNotNull)(this._lineSource.ownerSource()),r=(null===(t=i.defaultFormatter)||void 0===t?void 0:t.call(i))||i.formatter();if(r.parse){const t=r.format(e),i=r.parse(t);return i.res?i.value:e}return e}}class _ extends p{constructor(e){super(e,0)}setValue(e){if(this._lineSource.isSourceHidden()){const t=this._lineSource.normalizedPoints();return t[this._pointIndex].price=parseFloat(e.toString()),void this._lineSource.restorePoints(t,[])}const t=this._lineSource.points()[this._pointIndex];this._lineSource.startChanging(this._pointIndex,t),t.price=parseFloat(e.toString()),this._lineSource.setPoint(this._pointIndex,t),this._lineSource.recalculate(),this._lineSource.model().updateSource(this._lineSource),this._listeners.fire(this,""),this._lineSource.endChanging(!1,!1),this._lineSource.syncPriceLevels()}}class m extends p{constructor(e){super(e,1)}value(){const e=this._lineSource.stopPrice();return this._formatAndParsePrice(e)}setValue(e){const t=Math.round(Math.abs(e-this._lineSource.entryPrice())*this._lineSource.ownerSourceBase());this._lineSource.properties().childs().stopLevel.setValue(t),this._lineSource.syncPriceLevels()}}class g extends p{constructor(e){super(e,2)}value(){const e=this._lineSource.profitPrice();return this._formatAndParsePrice(e)}setValue(e){const t=Math.round(Math.abs(e-this._lineSource.entryPrice())*this._lineSource.ownerSourceBase());this._lineSource.properties().childs().profitLevel.setValue(t),this._lineSource.syncPriceLevels()}}var f,v=i(37265),y=i(928),S=i(44672),b=i(43290);function w(e){return parseFloat(e.toFixed(2))}!function(e){e[e.InitialVersion=1]="InitialVersion",e[e.CurrentVersion=2]="CurrentVersion"}(f||(f={}));class C extends o.LineDataSource{constructor(e,t,r,o){super(e,t,r,o),this._syncStateExclusions=["points","entryPrice","stopPrice","targetPrice","stopLevel","profitLevel","riskSize","qty","amountTarget","amountStop"],this._riskInChange=!1,this.version=2,t.hasChild("stopLevel")||t.hasChild("profitLevel")||(t.addProperty("stopLevel",0),t.addProperty("profitLevel",0),this.ownerSourceChanged().subscribe(this,(()=>{const i=(0,
s.ensureNotNull)(e.timeScale().visibleBarsStrictRange()),r=i.firstBar(),o=i.lastBar(),a=(0,s.ensureNotNull)(this.ownerSource()),l=a.priceScale();if(l){let e=(0,s.ensureNotNull)(a.priceRange(r,o,{targetPriceScale:l,scaleSeriesOnly:null==l?void 0:l.isScaleSeriesOnly()}));if(l.isLog()){const t=l.logicalToPrice(e.minValue()),i=l.logicalToPrice(e.maxValue());e=new n.PriceRange(t,i)}if(e&&!e.isEmpty()){const i=Math.round(.2*e.length()*this.ownerSourceBase());t.merge({stopLevel:i,profitLevel:i})}}}),!0));const c=t.childs();c.stopLevel.listeners().subscribe(this,this.recalculate),c.stopLevel.listeners().subscribe(null,(()=>{this.properties().childs().stopPrice.childChanged(null,"")})),c.profitLevel.listeners().subscribe(this,this.recalculate),c.profitLevel.listeners().subscribe(null,(()=>{this.properties().childs().targetPrice.childChanged(null,"")})),t.addChild("entryPrice",new _(this)),t.addChild("stopPrice",new m(this)),t.addChild("targetPrice",new g(this)),t.hasChild("riskSize")||t.addProperty("riskSize",0),t.hasChild("qty")||t.addProperty("qty",0),t.hasChild("amountTarget")||t.addProperty("amountTarget",c.accountSize.value()),t.hasChild("amountStop")||t.addProperty("amountStop",c.accountSize.value()),t.addExcludedKey("riskSize",1),t.addExcludedKey("qty",1),t.addExcludedKey("amountTarget",1),t.addExcludedKey("amountStop",1),c.risk.subscribe(this,this._recalculateRiskSize),c.accountSize.subscribe(this,this._recalculateRiskSize),c.riskDisplayMode.subscribe(this,this._recalculateRisk),c.riskDisplayMode.subscribe(this,this._recalculateRiskSize),c.entryPrice.subscribe(this,this._recalculateRiskSize),c.stopPrice.subscribe(this,this._recalculateRiskSize),c.profitLevel.subscribe(this,this._recalculateRiskSize),c.profitLevel.subscribe(this,this.syncPriceLevels.bind(this)),c.stopLevel.subscribe(this,this._recalculateRiskSize),c.stopLevel.subscribe(this,this.syncPriceLevels.bind(this)),c.qty.subscribe(this,this._recalculateRiskSize),this.ownerSourceChanged().subscribe(null,((e,t)=>{e&&e.barsProvider().dataUpdated().unsubscribeAll(this),t&&t.barsProvider().dataUpdated().subscribe(this,this._onSeriesUpdated)})),this.pointAdded().subscribe(this,(e=>{switch(e){case l.RiskRewardPointIndex.Entry:case l.RiskRewardPointIndex.Close:this._recalculateRiskSize(),this._recalculateQty()}})),this.pointChanged().subscribe(this,(e=>{switch(e){case l.RiskRewardPointIndex.Entry:case l.RiskRewardPointIndex.Close:this._recalculateRiskSize(),this._recalculateQty()}})),c.riskDisplayMode.value()===a.RiskDisplayMode.Percentage&&c.risk.value()>100&&c.riskDisplayMode.setValueSilently(a.RiskDisplayMode.Money),c.entryPrice.subscribe(this,this._recalculateQty),c.stopPrice.subscribe(this,this._recalculateQty),c.riskSize.subscribe(this,this._recalculateQty),c.entryPrice.subscribe(this,this._recalculateAmount),c.profitLevel.subscribe(this,this._recalculateAmount),c.stopLevel.subscribe(this,this._recalculateAmount),c.accountSize.subscribe(this,this._recalculateAmount),c.riskSize.subscribe(this,this._recalculateAmount),c.qty.subscribe(this,this._recalculateAmount),
this._entryPriceAxisView=new d(this,{colorProperty:c.linecolor,priceProperty:c.entryPrice}),this._stopPriceAxisView=new d(this,{colorProperty:c.stopBackground,priceProperty:c.stopPrice}),this._profitPriceAxisView=new d(this,{colorProperty:c.profitBackground,priceProperty:c.targetPrice}),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,1971)).then((({RiskRewardPaneView:t})=>{const i=[new t(this,e)];this._setPaneViews(i)}))}destroy(){var e;null===(e=this.ownerSource())||void 0===e||e.barsProvider().dataUpdated().unsubscribeAll(this),this.ownerSourceChanged().unsubscribeAll(this),super.destroy()}hasEditableCoordinates(){return!1}setOwnerSource(e){super.setOwnerSource(e);const t=this.ownerSource();t&&t.symbolSource().symbolInfo()&&(this._recalculateAmount(),this._recalculateRiskSize(),this._recalculateQty())}pointsCount(){return 2}priceAxisPoints(){const e=this._points[0],t=this._properties.childs();return[{...e,price:t.stopPrice.value()},{...e,price:t.entryPrice.value()},{...e,price:t.targetPrice.value()}]}priceAxisViews(e,t){return this.isSourceHidden()||t!==this.priceScale()||this._model.paneForSource(this)!==e?null:[this._entryPriceAxisView,this._stopPriceAxisView,this._profitPriceAxisView]}updateAllViews(e){this.isActualSymbol()&&this.properties().childs().visible.value()&&((0,y.hideAllDrawings)().value()&&this.userEditEnabled()||(super.updateAllViews(e),this._entryPriceAxisView.update(e),this._stopPriceAxisView.update(e),this._profitPriceAxisView.update(e)))}migrateVersion(e,t,i){if(1===e&&this._points.length>=1){const e=[];e.push(this._points[0]);let t=this._points[0];if(t={price:t.price,index:this._getClosePointIndex(t.index)},e.push(t),this._points[1]&&e.push(this._points[1]),this._points[2]&&e.push(this._points[2]),this._points=e,this._timePoint.length>=1){const t=[],i=this._timePoint[0];t.push(i);const s={price:i.price,time_t:i.time_t,offset:this._getClosePointIndex(i.offset)};t.push(s),this._timePoint[1]&&e.push(this._points[1]),this._timePoint[2]&&e.push(this._points[2]),this._timePoint=t}}}restoreExternalState(e){if((0,v.isNumber)(e.entryPrice)){if(e=Object.assign({},e),!this.isActualSymbol()){this._timePoint[0].price=e.entryPrice,delete e.entryPrice}this.properties().merge(e)}else super.restoreExternalState(e)}addPoint(e,t,i){e.price=this._roundPrice(e.price),super.addPoint(e,void 0,!0);const s={price:e.price,index:this._getClosePointIndex(e.index)};super._addPointIntenal(s,void 0,!0);const r=this._calculateActualEntry(e,s);if(r){super._addPointIntenal(r,void 0,!0);const e=this._findClosePoint(r,s);e&&super._addPointIntenal(e,void 0,!0)}return this._lastPoint=null,this._normalizePoints(),this.createServerPoints(),!0}setPoint(e,t,i,s){if(this.isSourceHidden())return;const r=this.properties().childs();switch(this._muteSyncLineStyle(),e){case 0:this._changeEntryPoint(t);break;case 2:r.stopPrice.setValue(this.prepareStopPrice(t.price));break;case 3:r.targetPrice.setValue(this.prepareProfitPrice(t.price));break;case 1:t.price=this._points[0].price,super.setPoint(1,t),this.recalculate()}
this._unmuteSyncLineStyleWithoutApplyingChanges(),this.syncPriceLevels()}getPoint(e){if(this.isSourceHidden())return null;switch(e){case 0:return this._points[0];case 1:return{index:this._points[1].index,price:this._points[0].price};case 2:return{index:this._points[0].index,price:this.stopPrice()};case 3:return{index:this._points[0].index,price:this.profitPrice()}}return null}setPoints(e){this.isSourceHidden()||(this._muteSyncLineStyle(),super.setPoints(e),this.recalculate(),this._unmuteSyncLineStyleWithoutApplyingChanges(),this.syncPriceLevels())}start(){super.start(),this.recalculate()}startMoving(e,t,i,r){const n=(0,s.ensureDefined)(e.logical);n.price=this._roundPrice(n.price),super.startMoving(e,t,i)}move(e,t,i,r){const n=(0,s.ensureDefined)(e.logical);n.price=this._roundPrice(n.price),super.move(e,t,i),this.recalculate(),this._entryPriceAxisView.update((0,S.sourceChangeEvent)(this.id()))}axisPoints(){if(!this._points[l.RiskRewardPointIndex.ActualEntry])return[];const e=this._points[l.RiskRewardPointIndex.ActualEntry];let t=null;if(4===this._points.length)t=this._points[l.RiskRewardPointIndex.ActualClose];else{const e=this.lastBarData();if(!e)return[];t={index:e.index,price:e.closePrice}}return[e,t]}recalculateStateByData(){this.recalculate()}recalculate(){if(0===this.points().length)return;const e=this.properties().childs(),t=e.targetPrice.value(),i=e.stopPrice.value(),s=[this._points[0],this._points[1]],r=this._calculateActualEntry(this.points()[0],this.points()[1]);if(r){s.push(r);const e=this._findClosePoint(r,this.points()[1]);e&&s.push(e)}this._points=s,t!==e.targetPrice.value()&&e.targetPrice.listeners().fire(e.targetPrice,""),i!==e.stopPrice.value()&&e.stopPrice.listeners().fire(e.stopPrice,"")}syncPriceLevels(){const e=this.linkKey().value();if(e){const t=this.properties().childs(),i={entryPrice:t.entryPrice.value(),stopLevel:t.stopLevel.value(),profitLevel:t.profitLevel.value()};(0,y.changeLineStyle)({linkKey:e,state:i,model:this._model})}}entryPrice(){const e=this.points();return 0===e.length?this._timePoint[0].price:e[0].price}lastBarData(){var e;const t=null===(e=this.ownerSource())||void 0===e?void 0:e.barsProvider();if(!t)return null;const i=t.bars().firstIndex(),n=t.bars().lastIndex();if(null===i||null===n||isNaN(i)||isNaN(n))return null;const o=this.points();if(4===o.length){const e=o[l.RiskRewardPointIndex.ActualClose];return e.index<i?null:{closePrice:e.price,index:Math.min(n,e.index)}}const a=o[l.RiskRewardPointIndex.Close];if(a.index<i)return null;const c=Math.min(n,a.index),h=t.bars().search(c,r.PlotRowSearchMode.NearestLeft);return null===h?null:{closePrice:(0,s.ensure)(h.value[4]),index:h.index}}ownerSourceBase(){var e;const t=null===(e=this.ownerSource())||void 0===e?void 0:e.symbolSource().symbolInfo();return t?t.pricescale/t.minmov:100}getOrderTemplate(){return null}template(){const e=this.properties().childs(),t=super.template();return t.stopLevel=e.stopLevel.value(),t.profitLevel=e.profitLevel.value(),t}_applyTemplateImpl(e){const{targetPrice:t,stopPrice:i,entryPrice:s,...r}=e
;super._applyTemplateImpl(r);const n=this.properties().childs();void 0!==e.stopLevel&&n.stopLevel.setValue(e.stopLevel),void 0!==e.profitLevel&&n.profitLevel.setValue(e.profitLevel)}_propertiesStateExclusions(){return[...super._propertiesStateExclusions(),"entryPrice","stopPrice","targetPrice"]}_correctPoints(e,t){if(!this.isActualSymbol())return!1;const i=super._correctPoints(e.slice(0,this.pointsCount()),t);for(let t=0;t<e.length;t++){const i=e[t];i.price=this._roundPrice(i.price)}return i}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,2243))).RiskRewardDefinitionsViewModel}_recalculateRiskSize(){if(this._riskInChange)return;const e=this.properties().childs(),t=e.risk.value(),i=e.riskDisplayMode.value(),s=e.accountSize.value();i===a.RiskDisplayMode.Percentage?e.riskSize.setValue(t/100*s):t>s?(e.risk.setValue(s),e.riskSize.setValue(s)):e.riskSize.setValue(t)}_roundPrice(e){const t=this.ownerSourceBase();return Math.round(e*t)/t}_ownerSourcePointValue(){var e,t,i;return null!==(i=null===(t=null===(e=this.ownerSource())||void 0===e?void 0:e.symbolSource().symbolInfo())||void 0===t?void 0:t.pointvalue)&&void 0!==i?i:1}static _configureProperties(e){o.LineDataSource._configureProperties(e),e.addExcludedKey("stopLevel",1),e.addExcludedKey("profitLevel",1),e.addExcludedKey("stopPrice",1),e.addExcludedKey("targetPrice",1),e.addExcludedKey("entryPrice",1)}_onSeriesUpdated(e,t,i){this.isSourceHidden()||this._points.length<2||null!==i&&i.index>Math.max(this._points[0].index,this._points[1].index)||this.recalculateStateByData()}_recalculateRisk(){const e=this.properties().childs(),t=e.riskDisplayMode.value(),i=e.riskSize.value(),s=e.accountSize.value();let r=e.risk.value();r=t===a.RiskDisplayMode.Percentage?w(i/s*100):w(s/100*r),this._riskInChange=!0,e.risk.setValue(parseFloat(this._riskFormatter(t).format(r,{ignoreLocaleNumberFormat:!0}))),this._riskInChange=!1}_recalculateAmount(){if(0===this.points().length)return;const e=this.properties().childs(),t=e.accountSize.value(),i=e.entryPrice.value(),s=e.qty.value(),r=e.stopPrice.value(),n=e.targetPrice.value(),o=this._ownerSourcePointValue();e.amountTarget.setValue(this._amountTarget(t,n,i,s,o)),e.amountStop.setValue(this._amountStop(t,r,i,s,o))}_recalculateQty(){if(0===this.points().length)return;const e=this.properties().childs(),t=e.entryPrice.value(),i=e.stopPrice.value(),s=e.riskSize.value()/(Math.abs(t-i)*this._ownerSourcePointValue());e.qty.setValue(s)}_calculateActualEntry(e,t){const i=this.ownerSource();if(!i)return null;const r=i.barsProvider().bars();if(r.isEmpty())return null;const n=(0,s.ensureNotNull)(r.firstIndex()),o=Math.max(e.index,n),a=e.price,l=(0,s.ensureNotNull)(r.lastIndex()),c=Math.min(l,t.index);for(const e of r.rangeIterator(o,c+1)){const t=e.value;if(null!==t&&(0,s.ensure)(t[2])>=a&&(0,s.ensure)(t[3])<=a)return{index:e.index,price:a}}return null}_riskFormatter(e){return e===a.RiskDisplayMode.Percentage?(0,b.getNumericFormatter)(2):(0,b.getNumericFormatter)()}
_getClosePointIndex(e){const t=this._model.timeScale(),i=Math.round(t.width()/t.barSpacing());return e+Math.max(3,Math.round(.15*i))}_findClosePoint(e,t){const i=this.ownerSource();if(!i)return null;const r=i.barsProvider().bars(),n=(0,s.ensureNotNull)(r.firstIndex()),o=Math.max(e.index,n),a=(0,s.ensureNotNull)(r.lastIndex()),l=Math.min(a,t.index);for(const e of r.rangeIterator(o,l+1)){const t=e.value;if(null===t)continue;const i=this._checkStopPrice(t);if(null!=i)return{index:e.index,price:i}}return null}_changeEntryPoint(e){const t=this.properties().childs(),i=t.stopPrice.value(),s=t.targetPrice.value(),r=1/this.ownerSourceBase(),n=Math.min(i,s)+r,o=Math.max(i,s)-r;e.price=Math.max(n,Math.min(o,this._roundPrice(e.price))),this.setPoints([e,{...this._points[1],price:e.price}]),t.stopPrice.setValue(i),t.targetPrice.setValue(s)}}var P=i(55917);class x extends C{constructor(e,t,i,s){super(e,null!=t?t:x.createProperties(),i,s)}name(){return"Risk/Reward short"}stopPrice(){return this.entryPrice()+this.properties().childs().stopLevel.value()/this.ownerSourceBase()}calculatePL(e){return this.entryPrice()-e}profitPrice(){return this.entryPrice()-this.properties().childs().profitLevel.value()/this.ownerSourceBase()}prepareStopPrice(e){e=this._roundPrice(e);const t=this.entryPrice()+1/this.ownerSourceBase();return Math.max(e,t)}prepareProfitPrice(e){e=this._roundPrice(e);const t=this.entryPrice()-1/this.ownerSourceBase();return Math.min(e,t)}static createProperties(e){const t=new P.DefaultProperty({defaultName:"linetoolriskrewardshort",state:e});return this._configureProperties(t),t}_amountTarget(e,t,i,s,r){return w(e+(i-t)*s*r)}_amountStop(e,t,i,s,r){return w(e-(t-i)*s*r)}_checkStopPrice(e){const t=this.stopPrice(),i=this.profitPrice();return(0,s.ensure)(e[2])>=t?this.stopPrice():(0,s.ensure)(e[3])<=i?this.profitPrice():null}_orderSide(){throw new Error("not supported")}}class T extends C{constructor(e,t,i,s){super(e,null!=t?t:T.createProperties(),i,s)}name(){return"Risk/Reward long"}stopPrice(){return this.entryPrice()-this.properties().childs().stopLevel.value()/this.ownerSourceBase()}profitPrice(){return this.entryPrice()+this.properties().childs().profitLevel.value()/this.ownerSourceBase()}calculatePL(e){return e-this.entryPrice()}prepareStopPrice(e){e=this._roundPrice(e);const t=this.entryPrice()-1/this.ownerSourceBase();return Math.min(e,t)}prepareProfitPrice(e){e=this._roundPrice(e);const t=this.entryPrice()+1/this.ownerSourceBase();return Math.max(e,t)}static createProperties(e){const t=new P.DefaultProperty({defaultName:"linetoolriskrewardlong",state:e});return this._configureProperties(t),t}_amountTarget(e,t,i,s,r){return w(e+(t-i)*s*r)}_amountStop(e,t,i,s,r){return w(e-(i-t)*s*r)}_checkStopPrice(e){const t=this.stopPrice(),i=this.profitPrice();return(0,s.ensure)(e[3])<=t?this.stopPrice():(0,s.ensure)(e[2])>=i?this.profitPrice():null}_orderSide(){throw new Error("not supported")}}},23550:(e,t,i)=>{"use strict"
;var s=i(86441).Point,r=i(4652).distanceToLine,n=i(29875).LineDataSource,o=i(55917).DefaultProperty,a=i(73305).LineToolColorsProperty;class l extends n{constructor(e,t,s,r){super(e,t||l.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.t.bind(i,78270,19)).then((({RotatedRectanglePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}startChanging(e,t){if(super.startChanging(e,t),0===e||1===e){var i=this._getPaneViews()[0],s=i._points[0],n=i._points[1],o=i._points[2];this._distance=r(s,n,o).distance}}setPoint(e,t,i){if(super.setPoint(e,t,i),0===e||1===e){var r=this._getPaneViews()[0];r.update();var n=r._points[0],o=r._points[1].subtract(n),a=new s(o.y,-o.x).normalized().scaled(this._distance),l=n.add(a),c=this.screenPointToPoint(l);this._points[2]=c}}endChanging(e,t){delete this._distance,super.endChanging(e,t)}pointsCount(){return 3}name(){return"Rotated Rectangle"}hasEditableCoordinates(){return!1}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,90490))).GeneralFiguresDefinitionsViewModel}_snapTo45DegreesAvailable(){return!0}static createProperties(e){var t=new o({defaultName:"linetoolrotatedrectangle",state:e});return this._configureProperties(t),t}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new a([e.color]))}}t.LineToolRotatedRectangle=l},63533:(e,t,i)=>{"use strict";var s=i(15399).LevelsProperty,r=i(64002).LineToolPitchfork;class n extends r{constructor(e,t,i,s){super(e,t||n.createProperties(),i,s)}name(){return"Modified Schiff Pitchfork"}static createProperties(e){var t=new s({defaultName:"linetoolschiffpitchfork",state:e,map:{range:[0,8]}});return this._configureProperties(t),t}}t.LineToolSchiffPitchfork=n},68802:(e,t,i)=>{"use strict";var s=i(15399).LevelsProperty,r=i(64002).LineToolPitchfork;class n extends r{constructor(e,t,i,s){super(e,t||n.createProperties(),i,s)}name(){return"Schiff Pitchfork"}static createProperties(e){var t=new s({defaultName:"linetoolschiffpitchfork2",state:e,map:{range:[0,8]}});return this._configureProperties(t),t}}t.LineToolSchiffPitchfork2=n},28820:(e,t,i)=>{"use strict";i.d(t,{LineToolSignpost:()=>u});var s=i(19625),r=i(55917),n=i(12988),o=i(29875),a=i(73305),l=i(15511);class c extends n.Property{constructor(e){super(),this._source=e,e.pointAdded().subscribe(this,(()=>this.listeners().fire(this,""))),e.pointChanged().subscribe(this,(()=>this.listeners().fire(this,"")))}value(){const e=this._source.properties().childs().position.value();return parseFloat(e.toFixed(2))}setValue(e){this._source.properties().childs().position.setValue(e),this._source.model().updateSource(this._source),this.listeners().fire(this,""),this._source.syncMultichartState({pricesChanged:!1,indexesChanged:!1})}}var h=i(20834);class d extends h.LineDataSourcePointIndexProperty{constructor(e,t){super(e,t),this._source=e}_setPointImpl(e){this._source.setPointAndChangeIndex(this._pointIndex,e)}}class u extends l.LineToolWithRelativePriceCoordinate{constructor(e,t,r,o){
super(e,null!=t?t:u.createProperties(),r,o),this._textColorProperty=new n.Property("transparent"),this._setTextColorByTheme=e=>{this._textColorProperty.setValue(e?(0,s.getHexColorByName)("color-cold-gray-200"):(0,s.getHexColorByName)("color-cold-gray-900"))},e.dark().subscribe(this._setTextColorByTheme,{callWithLast:!0}),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,3646)).then((t=>{this._setPaneViews([new t.SignpostPaneView(this,e,this._openTextEditor.bind(this),this._closeTextEditor.bind(this),this.onSelectionChange.bind(this))])}))}destroy(){this._model.dark().unsubscribe(this._setTextColorByTheme),super.destroy()}pointsCount(){return 1}name(){return"Signpost"}customEvent(){return{index:()=>{var e,t;return null!==(t=null===(e=this.points()[0])||void 0===e?void 0:e.index)&&void 0!==t?t:null},position:()=>this.properties().childs().position.value()}}showInObjectTree(){return!this.isPhantom()&&super.showInObjectTree()}isPhantom(){return this._model.isPhantomLine(this)}clonePositionOffset(){return{barOffset:1,xCoordOffset:0,yCoordOffset:0}}template(){const e=super.template(),t=this.properties().childs();return e.text=t.text.value(),e.position=t.position.value(),e}shouldBeRemovedOnDeselect(){const e=this._properties.childs();if(e.showImage.value())return!1;return""===e.text.value().trim()}editableTextProperties(){return{text:this.properties().childs().text,textColor:this._textColorProperty}}activateEditingOnCreation(){return!0}static createProperties(e){const t=new r.DefaultProperty({defaultName:"linetoolsignpost",state:e});return this._configureProperties(t),t}_createPointProperty(e){super._createPointProperty(e);const t=this._pointsProperty.childs().points[e];t.removeProperty("price"),t.removeProperty("bar"),t.addChild("price",new c(this)),t.addChild("bar",new d(this,0))}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text),this.properties().childs().position.setValue(e.position)}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,91051)).then((e=>e.SignpostDefinitionsViewModel))}static _configureProperties(e){o.LineDataSource._configureProperties(e),e.hasChild("text")||e.addChild("text",new n.Property("")),e.hasChild("position")||e.addChild("position",new n.Property(50)),e.addExcludedKey("text",1),e.addExcludedKey("position",1),e.addChild("backgroundsColors",new a.LineToolColorsProperty([e.childs().plateColor]))}}u.supportPhantomMode=!0},8066:(e,t,i)=>{"use strict";i.d(t,{LineToolSineLine:()=>n});var s=i(55917),r=i(29875);class n extends r.LineDataSource{constructor(e,t,s,r){super(e,t||n.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,14661)).then((e=>{this._setPaneViews([new e.SineLinePaneView(this,this._model)])}))}pointsCount(){return 2}name(){return"Sine Line"}static createProperties(e){const t=new s.DefaultProperty({defaultName:"linetoolsineline",state:e});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){
return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,19298))).CyclicAndSineLinesPatternDefinitionsViewModel}}},86915:(e,t,i)=>{"use strict";i.d(t,{LineToolSticker:()=>b});var s=i(928),r=i(12027),n=i(22329),o=i(31955),a=i(27788),l=i(14314),c=i(38039),h=i(31229),d=i(55917),u=i(6590);const p={intervalsVisibilities:{...h.intervalsVisibilitiesDefaults},size:110},_={sticker:"bitcoin",angle:.5*Math.PI},m=(0,d.extractAllPropertiesKeys)(p),g=(0,d.extractAllPropertiesKeys)(_),f=[...m,...g,...u.commonLineToolPropertiesStateKeys];class v extends c.LineDataSourceProperty{constructor(e){super(e)}static create(e,t){return new this({defaultName:"linetoolsticker",factoryDefaultsSupplier:()=>(0,a.default)(p),nonThemedDefaultsKeys:m,themedDefaultsKeys:[],allStateKeys:f,state:(0,l.default)({},_,{sticker:t},null!=e?e:{})})}}const y=(0,o.getLogger)("Chart.LineToolSticker");var S;!function(e){e[e.Version=1]="Version"}(S||(S={}));class b extends n.LineToolSvgIconBase{constructor(e,t,i,s){super(e,t||b.createProperties(),i,s),this.version=1,this._loadViews()}name(){return"Sticker"}static createProperties(e){const t=v.create(e,s.stickerTool.value());return b._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,18009))).LineDataSourceDefinitionsViewModel}async _loadViews(){const[{getSvgContentForSticker:e,getSvgRenderer:t},{StickerPaneView:s}]=await Promise.all([i.e(5598).then(i.bind(i,47992)),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,44386))]);if(!this._isDestroyed){const i=this._properties.childs().sticker.value();this._svgContent=e(i),this._onIconChanged.fire();const n=t(r.svgRenderer,i);null===n&&y.logWarn(`Couldn't create svg renderer for sticker ${i}`),this._setPaneViews([new s(this,this._model,n)])}}}},22329:(e,t,i)=>{"use strict";i.d(t,{LineToolSvgIconBase:()=>c});var s,r=i(50151),n=i(86441),o=i(25422),a=i(52033),l=i(29875);!function(e){e[e.AnchorLimit=80]="AnchorLimit"}(s||(s={}));class c extends l.LineDataSource{constructor(e,t,i,s){super(e,t,i,s),this._onIconChanged=new a.Delegate,this._svgContent=null,this._changePointData=null,this._loadViews()}pointsCount(){return 1}hasEditableCoordinates(){return!1}getAnchorLimit(){return 80}getChangePointForSync(e){return null}startChanging(e,t){const i=(0,r.ensureNotNull)(this.pointToScreenPoint(this._points[0])),s=this.properties().childs(),a=s.size.value();let l;if(t)l=(0,r.ensureNotNull)(this.pointToScreenPoint(t));else{let e=new n.Point(0,Math.max(80,a)/2);const t=(0,o.rotationMatrix)(s.angle.value());e=(0,o.transformPoint)(t,e),l=i.add(e)}const c=i.subtract(l).length();this._changePointData={centerPoint:i,initialLength:c,initialSize:a},super.startChanging(e,t)}setPoint(e,t,i){const{centerPoint:s,initialLength:n,initialSize:o}=(0,r.ensureNotNull)(this._changePointData),a=(0,r.ensureNotNull)(this.pointToScreenPoint(t)),l=this.properties().childs();if(0===e||1===e){const t=a.subtract(s).normalized();let i=Math.acos(-t.x);Math.asin(t.y)>0&&(i=2*Math.PI-i),
0===e&&(i+=Math.PI),l.angle.setValue(i)}else{const e=o*(s.subtract(a).length()/n);l.size.setValue(e)}}getSourceIcon(){const e=this.svgContent();return null===e?null:{type:"svgContent",content:e}}onSourceIconChanged(){return this._onIconChanged}svgContent(){return this._svgContent}static _configureProperties(e){super._configureProperties(e),e.addExcludedKey("angle",1)}}},424:(e,t,i)=>{"use strict";i.d(t,{LineToolText:()=>d,LineToolTextAbsolute:()=>u});var s,r=i(50151),n=i(86441),o=i(12988),a=i(55917),l=i(73305),c=i(44672),h=i(10568);!function(e){e[e.MinWidth=100]="MinWidth"}(s||(s={}));class d extends h.InplaceTextLineDataSource{constructor(e,t,s,r){const n=t||d.createProperties();super(e,n,s,r),this._barSpacing=e.timeScale().barSpacing(),this._recalculatePointsOnCenter=!1,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,13589)).then((({TextPaneView:t})=>{const i=this._recalculatePointsOnCenter?(e,t)=>{this._recalculatePointsOnCenter&&this._recalculateCenterPosition(e,t)}:void 0;this._paneView=new t(this,e,void 0,void 0,void 0,void 0,void 0,i,this._openTextEditor.bind(this),this._closeTextEditor.bind(this),this.onSelectionChange.bind(this)),this._setPaneViews([this._paneView])}))}centerPosition(){this._recalculatePointsOnCenter=!0}setPoint(e,t,i){const s=this.properties().childs();let n;if(1===e&&s.wordWrapWidth.value()){const e=this.model().timeScale();n=this.isFixed()?(0,r.ensureDefined)(this.fixedPoint()).x:e.indexToCoordinate(this.points()[0].index);const i=e.indexToCoordinate(t.index)-n-~~(s.fontsize.value()/6);if(!isFinite(i))return;s.wordWrapWidth.setValue(Math.max(100,i))}}pointsCount(){return 1}name(){return"Text"}editableTextProperties(){const e=this.properties().childs();return{text:e.text,textColor:e.color,wordWrap:e.wordWrap}}removeIfEditableTextIsEmpty(){return!0}activateEditingOnCreation(){return!0}setPriceScale(e){super.setPriceScale(e),e&&e.priceRange()&&(this._priceDencity=e.height()/(0,r.ensureNotNull)(e.priceRange()).length(),this._isPriceDencityLog=e.isLog())}restoreSize(){const e=(0,r.ensureNotNull)(this.priceScale());this._barSpacing=this.model().timeScale().barSpacing(),this._priceDencity=e.height()/(0,r.ensureNotNull)(e.priceRange()).length(),this.updateAllViewsAndRedraw((0,c.sourceChangeEvent)(this.id()))}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}state(e){const t=super.state(e);return e&&(t.state.fixedSize=!1),t}barSpacing(){return this._barSpacing}priceDencity(){return this._priceDencity}isPriceDencityLog(){return this._isPriceDencityLog}hasEditableCoordinates(){return!1}shouldBeRemovedOnDeselect(){return""===this._properties.childs().text.value().trim()}static createProperties(e){const t=new a.DefaultProperty({defaultName:"linetooltext",state:e});return this._configureProperties(t),t}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text)}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,27975)).then((e=>e.TextDefinitionsViewModel))}
static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new o.Property("")),e.addChild("linesColors",new l.LineToolColorsProperty([e.childs().borderColor])),e.addChild("textsColors",new l.LineToolColorsProperty([e.childs().color])),e.addExcludedKey("text",1),e.addExcludedKey("linesColors",3),e.addExcludedKey("textsColors",3)}_recalculateCenterPosition(e,t){const i=this.isFixed()?(0,r.ensureDefined)(this.fixedPoint()):(0,r.ensureNotNull)(this.pointToScreenPoint(this._points[0])),s=new n.Point(i.x-e/2,i.y-t/2),o=(0,r.ensureNotNull)(this.screenPointToPoint(s));this.setPoints([o]),this._normalizePoints(),this.createServerPoints(),this.updateAllViewsAndRedraw((0,c.sourceChangeEvent)(this.id()))}}class u extends d{constructor(e,t){super(e,t||u.createProperties())}name(){return"Anchored Text"}hasEditableCoordinates(){return!1}isFixed(){return!0}static createProperties(e){const t=new a.DefaultProperty({defaultName:"linetooltextabsolute",state:e});return this._configureProperties(t),t}}},46660:(e,t,i)=>{"use strict";i.d(t,{LineToolThreeDrivers:()=>o});var s=i(55917),r=i(29875),n=i(73305);class o extends r.LineDataSource{constructor(e,t,s,r){const n=t||o.createProperties();super(e,n,s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,6822)).then((t=>{this._setPaneViews([new t.LineToolThreeDrivesPaneView(this,e)])}))}pointsCount(){return 7}name(){return"Three Drives Pattern"}static createProperties(e){const t=new s.DefaultProperty({defaultName:"linetoolthreedrivers",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,66085)).then((e=>e.PatternWithoutBackgroundDefinitionsViewModel))}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new n.LineToolColorsProperty([e.childs().color])),e.addChild("textsColors",new n.LineToolColorsProperty([e.childs().textcolor])),e.addChild("linesWidths",new n.LineToolWidthsProperty([e.childs().linewidth])),e.hasChild("backgroundsColors")&&e.removeProperty("backgroundsColors")}}},97409:(e,t,i)=>{"use strict";i.d(t,{LineToolTimeCycles:()=>o});var s=i(27788),r=i(55917),n=i(29875);class o extends n.LineDataSource{constructor(e,t,s,r){super(e,null!=t?t:o.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,80485)).then((e=>{this._setPaneViews([new e.TimeCyclesPaneView(this,this._model)])}))}pointsCount(){return 2}name(){return"Time Cycles"}setPoint(e,t){const i=(0,s.default)(t),r=this._points[0],n=this._points[1];r.price=i.price,n.price=i.price,this._points[e]=i,this._normalizePoints()}addPoint(e,t,i){const s=super.addPoint(e,t,!0);if(s){const e=this._points[0];this._points[1].price=e.price,i||(this._normalizePoints(),this.createServerPoints())}return s}static createProperties(e){const t=new r.DefaultProperty({defaultName:"linetooltimecycles",state:e});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){
return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,84437))).TimeCyclesPatternDefinitionsViewModel}}},36009:(e,t,i)=>{"use strict";const s=i(29875).LineDataSource,r=i(92934).alignToStep,n=i(24526).customFormatters,o=i(68805).createSeriesFormatter;class a extends s{constructor(e,t){super(e,t),this.customization.forcePriceAxisLabel=!0,this.customization.disableErasing=!0,this.customization.showInObjectsTree=!1,this._createFormatter(e.mainSeries().symbolInfo()),this.setSelectionEnabled(!1)}isSynchronizable(){return!1}pointsCount(){return a.POINTS_COUNT}hasContextMenu(){return!1}state(){return null}startMoving(){super.startMoving.apply(this,arguments),this._cursorMoved=!1}endMoving(){super.endMoving.apply(this,arguments),this._cursorMoved=!1}userEditEnabled(){return!0}movable(){return!1}canBeHidden(){return!1}isUserDeletable(){return!1}showInObjectTree(){return!1}doesMovingAffectsUndo(){return!1}isAvailableInFloatingWidget(){return!1}timeAxisViews(){return null}cloneable(){return!1}copiable(){return!1}_correctPoints(e,t){this._currentMovingPoint&&this._startMovingPoint?this._currentMovingPoint.logical.price-this._startMovingPoint.logical.price&&(this._cursorMoved=!0):this._cursorMoved=!1;for(var i=1/this.priceScale().mainSource().base(),s=0;s<e.length;s++){var n=e[s];this._cursorMoved&&(n.price=this._currentMovingPoint.logical.price),n.price=r(n.price,i),e[s]=n}}_createFormatter(e){let t=null;t=n&&n.priceFormatterFactory&&n.priceFormatterFactory(e),null==t&&(t=null),this._formatter=null!==t?t:o(e,"default",!1,!0)}}a.POINTS_COUNT=1,e.exports.LineToolTrading=a},83776:(e,t,i)=>{"use strict";i.d(t,{LineToolTrendAngle:()=>h});var s=i(86441),r=i(50151),n=i(55917),o=i(10568),a=i(12988),l=i(44672);class c extends a.Property{constructor(e){super(),this._lineSource=e}value(){return Math.round(180*this._lineSource.angle()/Math.PI)}setValue(e){const t=e*Math.PI/180,i=(0,r.ensureNotNull)(this._lineSource.pointToScreenPoint(this._lineSource.points()[0])),n=Math.cos(t),o=-Math.sin(t),a=new s.Point(n,o),c=i.addScaled(a,this._lineSource.distance()),h=(0,r.ensureNotNull)(this._lineSource.screenPointToPoint(c));this._lineSource.setPoint(1,h);const d=this._lineSource.model();d.updateSource(this._lineSource),this._lineSource.updateAllViews((0,l.sourceChangeEvent)(this._lineSource.id())),d.updateSource(this._lineSource)}notifyChanged(){this._listeners.fire(this,"")}}class h extends o.InplaceTextLineDataSource{constructor(e,t,s,r){const n=t||h.createProperties();super(e,n,s,r),this._angle=0,this._distance=0,n.addChild("angle",new c(this)),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,82595)).then((({TrendAnglePaneView:t})=>{const i=[new t(this,e)];this._setPaneViews(i)}))}isSynchronizable(){return!1}pointsCount(){return 2}name(){return"Trend Angle"}angle(){return this._angle}distance(){return this._distance}addPoint(e,t){const i=super.addPoint(e,t);return i&&this._calculateAngle(),i}setLastPoint(e,t){const i=super.setLastPoint(e,t);return this.points().length>1&&this._calculateAngle(),i}axisPoints(){
if(this.points().length<2)return[];const e=[this.points()[0]],t=(0,r.ensureNotNull)(this.pointToScreenPoint(this.points()[0])),i=Math.cos(this._angle)*this._distance,n=-Math.sin(this._angle)*this._distance,o=t.add(new s.Point(i,n)),a=(0,r.ensureNotNull)(this.screenPointToPoint(o));return e.push(a),e}timeAxisPoints(){return this.axisPoints()}priceAxisPoints(){return this.axisPoints()}setPoint(e,t,i){super.setPoint(e,t,i),this.points().length>1&&1===e&&this._calculateAngle()}restoreData(e){var t,i;this._angle=null!==(t=e.angle)&&void 0!==t?t:0,this._distance=null!==(i=e.distance)&&void 0!==i?i:0}state(e){const t=super.state(e);return t.angle=this._angle,t.distance=this._distance,t}cloneData(e){this._angle=e.angle(),this._distance=e.distance()}canHasAlert(){return!0}editableTextProperties(){(0,r.assert)(!1,"unexpected method call")}static createProperties(e){e&&void 0===e.showPercentPriceRange&&(e.showPercentPriceRange=e.showPriceRange,e.showPipsPriceRange=e.showPriceRange);const t=new n.DefaultProperty({defaultName:"linetooltrendangle",state:e});return this._configureProperties(t),t}_snapTo45DegreesAvailable(){return!0}_getAlertPlots(){const e=this._linePointsToAlertPlot(this._points,null,this._properties.childs().extendLeft.value(),this._properties.childs().extendRight.value());return null===e?[]:[e]}_calculateAngle(){const e=(0,r.ensureNotNull)(this.pointToScreenPoint(this.points()[0]));let t=(0,r.ensureNotNull)(this.pointToScreenPoint(this.points()[1])).subtract(e);const i=t.length();i>0?(t=t.normalized(),this._angle=Math.acos(t.x),t.y>0&&(this._angle=-this._angle),this._distance=i):this._angle=0;this.properties().childs().angle.notifyChanged()}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,30574)).then((e=>e.TrendAngleDefinitionsViewModel))}}},68554:(e,t,i)=>{"use strict";i.d(t,{LineToolTrendBasedFibExtension:()=>d});var s=i(11542),r=i(45126),n=i(15399),o=i(73305),a=i(85719),l=i(96851);const c=new r.TranslatedString("erase level line",s.t(null,void 0,i(35111)));var h;!function(e){e[e.Version=2]="Version",e[e.LevelsCount=24]="LevelsCount",e[e.PointsCount=3]="PointsCount",e.Name="Trend-Based Fib Extension"}(h||(h={}));class d extends l.LineToolFibWithInplaceTextBase{constructor(e,t,s,r){super(e,t||d.createProperties(),s,r),this.version=2,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,90413)).then((({TrendBasedFibExtensionPaneView:e})=>{this._setPaneViews([new e(this,this._model,this._openTextEditor.bind(this),this._closeTextEditor.bind(this),this.onSelectionChange.bind(this))])}))}levelsCount(){return 24}pointsCount(){return 3}name(){return"Trend-Based Fib Extension"}migrateVersion(e,t){1===e&&this.properties().childs().extendLines.setValue(!0)}processErase(e,t){const i="level"+t,s=this.properties().childs()[i].childs().visible;e.setProperty(s,!1,c,a.lineToolsDoNotAffectChartInvalidation)}fibLevelsBasedOnLogScale(){var e
;return this.properties().childs().fibLevelsBasedOnLogScale.value()&&Boolean(null===(e=this.priceScale())||void 0===e?void 0:e.isLog())}template(){const e=super.template();for(let t=1;t<=24;t++){const i=(0,l.getLevelProps)(this._properties,t);e[`level${t}`][3]=i.childs().text.value()}return e}static createProperties(e){const t=new n.LevelsProperty({defaultName:"linetooltrendbasedfibextension",state:e,map:{names:["coeff","color","visible","linestyle","linewidth","text"],range:[0,24]}});return this._configureProperties(t),t}_applyTemplateImpl(e){var t;for(let i=1;i<=24;i++){const s=(0,l.getLevelProps)(this._properties,i),r=e[`level${i}`];s.childs().text.setValue(null!==(t=r[3])&&void 0!==t?t:"")}super._applyTemplateImpl(e)}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,75450))).FibDrawingsWith24LevelsDefinitionsViewModel}static _configureProperties(e){const t=e.childs();super._configureProperties(e);const i=[t.trendline.childs().color];for(let t=1;t<=24;t++){const s=(0,l.getLevelProps)(e,t);i.push(s.childs().color),e.addExcludedKey(`level${t}.text`,1)}e.addChild("linesColors",new o.LineToolColorsProperty(i));const s=[t.trendline.childs().linewidth,t.levelsStyle.childs().linewidth];e.addChild("linesWidths",new o.LineToolWidthsProperty(s))}}},27172:(e,t,i)=>{"use strict";i.d(t,{LineToolTrendBasedFibTime:()=>p});var s=i(11542),r=i(45126),n=i(29875),o=i(15399),a=i(73305),l=i(85719);const c=new r.TranslatedString("erase level line",s.t(null,void 0,i(35111)));var h,d,u;!function(e){e[e.InitVersion=1]="InitVersion",e[e.CurrentVersion=1]="CurrentVersion"}(h||(h={})),function(e){e[e.LevelsCount=11]="LevelsCount",e[e.PointsCount=3]="PointsCount"}(d||(d={})),function(e){e.Name="Trend-Based Fib Time"}(u||(u={}));class p extends n.LineDataSource{constructor(e,t,s,r){super(e,t||p.createProperties(),s,r),this.version=1,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,57175)).then((({TrendBasedFibTimePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}levelsCount(){return 11}pointsCount(){return 3}name(){return"Trend-Based Fib Time"}processErase(e,t){const i="level"+t,s=this.properties().childs()[i].childs().visible;e.setProperty(s,!1,c,l.lineToolsDoNotAffectChartInvalidation)}static createProperties(e){const t=new o.LevelsProperty({defaultName:"linetooltrendbasedfibtime",state:e,map:{range:[1,11]}});return this._configureProperties(t),t}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,46662))).TrendBasedFibTimeDefinitionsViewModel}static _configureProperties(e){super._configureProperties(e);const t=e.childs(),i=[t.trendline.childs().linewidth],s=[t.trendline.childs().color];for(let e=1;e<=11;e++)i.push(t["level"+e].childs().linewidth),s.push(t["level"+e].childs().color);e.addChild("linesColors",new a.LineToolColorsProperty(s)),e.addChild("linesWidths",new a.LineToolWidthsProperty(i))}}},99294:(e,t,i)=>{"use strict";i.d(t,{LineToolTrendLine:()=>l})
;var s,r=i(55917),n=i(12988),o=i(10568),a=i(90793);!function(e){e[e.PointsCount=2]="PointsCount",e.Name="Trend Line"}(s||(s={}));class l extends o.InplaceTextLineDataSource{constructor(e,t,s,r){super(e,t||l.createProperties(),s,r),this._trendLinePaneView=null,Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,29710)).then((({TrendLinePaneView:e})=>{this._trendLinePaneView=new e(this,this._model,this._openTextEditor.bind(this),this._closeTextEditor.bind(this),this.onSelectionChange.bind(this)),this._setPaneViews([this._trendLinePaneView])}))}dataAndViewsReady(){return super.dataAndViewsReady()&&null!==this._trendLinePaneView&&this._trendLinePaneView.iconsReady()}pointsCount(){return 2}name(){return"Trend Line"}canHasAlert(){return!0}showPriceLabels(){return this._properties.childs().showPriceLabels.value()}createPriceAxisView(e){return new a.LineToolPriceAxisView(this,{pointIndex:e,backgroundPropertyGetter:()=>this.showPriceLabels()?this._properties.childs().linecolor.value():null})}isForcedDrawPriceAxisLabel(){return this.showPriceLabels()}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}editableTextProperties(){const e=this.properties().childs();return{text:e.text,textColor:e.textcolor,textVisible:e.showLabel}}static createProperties(e,t){return l._createPropertiesImpl("linetooltrendline",e,t)}_getAlertPlots(){const e=this._linePointsToAlertPlot(this._points,null,this._properties.childs().extendLeft.value(),this._properties.childs().extendRight.value());return null===e?[]:[e]}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,26360))).TrendLineDefinitionsViewModel}_applyTemplateImpl(e){super._applyTemplateImpl(e),this.properties().childs().text.setValue(e.text||"")}_snapTo45DegreesAvailable(){return!0}static _createPropertiesImpl(e,t,i){t&&void 0===t.showPercentPriceRange&&(t.showPercentPriceRange=t.showPriceRange,t.showPipsPriceRange=t.showPriceRange);const s=new r.DefaultProperty({defaultName:e,state:t,useUserPreferences:i});return this._configureProperties(s),s}static _configureProperties(e){super._configureProperties(e),e.hasChild("text")||e.addChild("text",new n.Property("")),e.addExcludedKey("text",1)}}},33865:(e,t,i)=>{"use strict";i.d(t,{LineToolTrianglePattern:()=>o});var s=i(55917),r=i(29875),n=i(73305);class o extends r.LineDataSource{constructor(e,t,s,r){const n=t||o.createProperties();super(e,n,s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,41123)).then((t=>{this._setPaneViews([new t.LineToolTrianglePatternPaneView(this,e)])}))}pointsCount(){return 4}name(){return"Triangle Pattern"}static createProperties(e){const t=new s.DefaultProperty({defaultName:"linetooltrianglepattern",state:e});return this._configureProperties(t),t}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,35737)).then((e=>e.PatternWithBackgroundDefinitionViewModel))}static _configureProperties(e){super._configureProperties(e),
e.addChild("linesColors",new n.LineToolColorsProperty([e.childs().color])),e.addChild("textsColors",new n.LineToolColorsProperty([e.childs().textcolor])),e.addChild("backgroundsColors",new n.LineToolColorsProperty([e.childs().backgroundColor]))}}},39737:(e,t,i)=>{"use strict";var s=i(29875).LineDataSource,r=i(55917).DefaultProperty,n=i(73305).LineToolColorsProperty;class o extends s{constructor(e,t,s,r){super(e,t||o.createProperties(),s,r),Promise.all([i.e(2870),i.e(1583)]).then(i.t.bind(i,86448,19)).then((({TrianglePaneView:e})=>{this._setPaneViews([new e(this,this._model)])}))}pointsCount(){return 3}name(){return"Triangle"}async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,90490))).GeneralFiguresDefinitionsViewModel}static createProperties(e){var t=new r({defaultName:"linetooltriangle",state:e});return this._configureProperties(t),t}static _configureProperties(e){super._configureProperties(e),e.addChild("linesColors",new n([e.childs().color]))}}t.LineToolTriangle=o},52690:(e,t,i)=>{"use strict";i.d(t,{LineToolVertLineTimeAxisView:()=>r});var s=i(14169);class r extends s.LineDataSourceTimeAxisView{constructor(e){super(e,0)}_getBgColor(){return this._source.properties().linecolor.value()}_getAlwaysInViewPort(){return!1}_getIndex(){const e=this._source.points();return 0===e.length?null:e[0].index}}},56096:(e,t,i)=>{"use strict";i.d(t,{LineToolVertLine:()=>c});var s=i(50151),r=i(86441),n=i(55917),o=i(12988),a=i(10568),l=i(52690);class c extends a.InplaceTextLineDataSource{constructor(e,t,s,r){const n=t||c.createProperties();super(e,n,s,r),this._verticalLinePaneViews=new WeakMap,this._timeAxisView=new l.LineToolVertLineTimeAxisView(this),this._paneViewFactory=null,this.properties().childs().extendLine.subscribe(this,(()=>e.lightUpdate())),Promise.all([i.e(2870),i.e(1583)]).then(i.bind(i,63307)).then((t=>{this._paneViewFactory=i=>new t.VertLinePaneView(this,e,i,this._openTextEditor.bind(this),this._closeTextEditor.bind(this),this.onSelectionChange.bind(this)),this._model.lightUpdate()})),this.setAdditionalCursorData(this._additionalCursorData.bind(this),this._positionToCoordinate.bind(this))}destroy(){this.properties().childs().extendLine.unsubscribeAll(this),super.destroy()}pointsCount(){return 1}name(){return"Vertical Line"}timeAxisViews(){return this.isSourceHidden()?null:this.properties().childs().showTime.value()?[this._timeAxisView]:null}updateAllViews(e){super.updateAllViews(e),this._timeAxisView.update(e)}canHasAlert(){return!0}template(){const e=super.template();return e.text=this.properties().childs().text.value(),e}isMultiPaneAvailable(){return!0}isMultiPaneEnabled(){return this.properties().childs().extendLine.value()}paneViews(e){if(e=(0,s.ensureDefined)(e),!this.isMultiPaneEnabled()&&this._model.paneForSource(this)!==e)return null;if(null===this._getPaneViews(e)&&null!==this._paneViewFactory){const t=this._paneViewFactory(e);this._verticalLinePaneViews.set(e,t),this._setPaneViews([t],e,!0)}return super.paneViews(e)}
priceAxisViews(){return null}priceAxisPoints(){return[]}pointToScreenPoint(e){const t=this._model.timeScale();if(t.isEmpty())return null;const i=t.indexToCoordinate(e.index);return new r.Point(i,0)}convertYCoordinateToPriceForMoving(e){return 0}editableTextProperties(){const e=this.properties().childs();return{text:e.text,textColor:e.textcolor,textVisible:e.showLabel}}static createProperties(e){null!=e&&(void 0===e.textOrientation&&(e.textOrientation="horizontal"),void 0===e.extendLine&&(e.extendLine=!1));const t=new n.DefaultProperty({defaultName:"linetoolvertline",state:e});return this._configureProperties(t),t}_normalizePoint(e){var t;const i=null!==(t=this._model.timeScale().indexToTimePoint(e.index))&&void 0!==t?t:this._utcTimeInCurrentResolution(e);return null!==i?{price:e.price,time_t:i,offset:0}:super._normalizePoint(e)}_getAlertPlots(){const e=this._points[0],t={index:e.index,price:e.price+1},i=this._linePointsToAlertPlot([e,t],null,!0,!0);return null===i?[]:[i]}_getPropertyDefinitionsViewModelClass(){return Promise.all([i.e(8697),i.e(8278),i.e(5450),i.e(8537)]).then(i.bind(i,34353)).then((e=>e.VerticalLineDefinitionsViewModel))}_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.Property("")),e.addExcludedKey("text",1)}_additionalCursorData(){return(0,s.ensureDefined)(this._verticalLinePaneViews.get((0,s.ensureNotNull)(this._model.paneForSource(this)))).additionalCursorData()}_positionToCoordinate(e){return(0,s.ensureDefined)(this._verticalLinePaneViews.get((0,s.ensureNotNull)(this._model.paneForSource(this)))).positionToCoordinate(e)}}},92693:(e,t,i)=>{"use strict";var s;i.d(t,{MagnetMode:()=>s}),function(e){e[e.WeakMagnet=0]="WeakMagnet",e[e.StrongMagnet=1]="StrongMagnet"}(s||(s={}))},81171:(e,t,i)=>{"use strict";i.d(t,{magnetEnabled:()=>_,magnetMode:()=>m,setIsMagnetEnabled:()=>g,setMagnetMode:()=>f});var s=i(55917),r=i(64147),n=i(92693),o=i(928),a=i(15764),l=i(72522);const c=new r.WatchedValue(!1),h=new r.WatchedValue(n.MagnetMode.WeakMagnet),d=(0,l.modifierPressed)(),u=(0,l.shiftPressed)();function p(){const e=d.value();if(u.value()&&(o.isToolEditingNow.value()||o.isToolCreatingNow.value()))return void c.setValue(!1);let t,i;if(o.activePointSelectionMode.value()===o.SelectPointMode.Replay)t=i=!1;else{const s=o.tool.value(),r=o.isStudyEditingNow.value()||o.activePointSelectionMode.value()===o.SelectPointMode.Study;t=e&&((0,a.isLineToolName)(s)||o.isToolEditingNow.value()||(0,o.toolIsMeasure)(s)||r),i=(0,o.properties)().childs().magnet.value()}h.setValue(!i&&t?n.MagnetMode.StrongMagnet:(0,o.properties)().childs().magnetMode.value()),c.setValue(t?!i:i)}function _(){return c}function m(){return h}function g(e){(0,s.allowSavingDefaults)(!0),(0,o.properties)().childs().magnet.setValue(e),(0,s.allowSavingDefaults)(!1)}function f(e){(0,s.allowSavingDefaults)(!0),(0,o.properties)().childs().magnetMode.setValue(e),(0,
o.properties)().childs().magnet.setValue(!0),(0,s.allowSavingDefaults)(!1)}(0,o.runOnDrawingStateReady)((()=>{(0,o.properties)().childs().magnet.subscribe(null,p),(0,o.properties)().childs().magnetMode.subscribe(null,p),d.subscribe(p),u.subscribe(p),o.tool.subscribe(p),o.isToolEditingNow.subscribe(p),p()}))},64442:(e,t,i)=>{"use strict";i.d(t,{MainSeriesScaleRatioProperty:()=>o});var s,r=i(52033),n=i(34776);!function(e){e[e.StepForChangeValue=.1]="StepForChangeValue",e[e.MinValue=1e-7]="MinValue",e[e.MaxValue=99999999]="MaxValue"}(s||(s={}));class o{constructor(e){this._changed=new r.Delegate,this._model=e}destroy(){this._changed.destroy()}getStepChangeValue(){return.1}getMinValue(){return 1e-7}getMaxValue(){return 99999999}value(){return this._model.mainSeriesScaleRatio()}setValue(e,t){(e!==this.value()||t)&&(this._model.setMainSeriesScaleRatio(e),this._onChanged())}state(){return null}clone(){return new o(this._model)}listeners(){return this._changed}subscribe(e,t){this._changed.subscribe(e,t)}unsubscribe(e,t){this._changed.unsubscribe(e,t)}unsubscribeAll(e){this._changed.unsubscribeAll(e)}storeStateIfUndefined(){return!0}weakReference(){return(0,n.weakReference)(this)}ownership(){return(0,n.ownership)(this)}_onChanged(){this._changed.fire(this,"")}}},44672:(e,t,i)=>{"use strict";i.r(t),i.d(t,{ChangeEventType:()=>s,globalChangeEvent:()=>a,selectionChangeEvent:()=>d,sourceChangeEvent:()=>n,viewportChangeEvent:()=>c});var s,r=i(27147);function n(e){return(0,r.default)(e)?{type:"data-source-change",sourceId:e}:{type:"data-source-change",...e}}!function(e){e.DataSourceChange="data-source-change",e.ViewportChange="viewport-change",e.GlobalChange="global-change",e.SelectionChange="selection-change"}(s||(s={}));const o={type:"global-change"};function a(){return o}const l={type:"viewport-change"};function c(e){return e?{type:"viewport-change",pane:e}:l}const h={type:"selection-change"};function d(){return h}},18172:(e,t,i)=>{"use strict";i.d(t,{unpackNonSeriesData:()=>n});var s=i(30551),r=i(50151);async function n(e){if(""===e)return null;const t=JSON.parse(e);if(!(0,s.isObject)(t)||"function"==typeof t)throw new Error("Non-object content in the non-series envelope");if((0,s.hasProperty)(t,"indexes_replace"))return{indexes_replace:!0};const i={indexes_replace:!1};if((0,s.hasProperty)(t,"offsets")&&(i.offsets=t.offsets),(0,s.hasProperty)(t,"isUpdate")){if("boolean"!=typeof t.isUpdate)throw new Error('Invalid type of "isUpdate" field');i.isUpdate=t.isUpdate}return(0,s.hasProperty)(t,"data")&&(i.data=t.data),(0,s.hasProperty)(t,"graphicsCmds")&&(i.graphicsCmds=function(e){if(!(0,s.isObject)(e))throw new Error("Graphics commands should be wrapped in an object");if((0,s.hasProperty)(e,"create"),(0,s.hasProperty)(e,"erase")){const t=e.erase;(0,r.assert)(Array.isArray(t),"Collection of erase commands should be array");for(const e of t){if(!(0,s.isObject)(e)||!(0,s.hasProperty)(e,"action"))throw new Error("Command should be an object with 'action' property");(0,
r.assert)("all"===e.action||"one"===e.action,"Erase command action should be 'all' or 'one'")}}return e}(t.graphicsCmds)),i}},82587:(e,t,i)=>{"use strict";i.d(t,{notAvailable:()=>r});var s=i(11542);const r=i(56570).enabled("use_na_string_for_not_available_values")?s.t(null,void 0,i(90091)):"∅"},43290:(e,t,i)=>{"use strict";i.d(t,{getNumericFormatter:()=>h,getPercentageFormatter:()=>d,getPipFormatter:()=>_,getVolumeFormatter:()=>u});var s=i(59623),r=i(719),n=i(4362),o=i(725);class a extends o.PriceFormatter{constructor(e){const{priceScale:t,minMove:i=1,type:s,typespecs:r,minMove2:o,ignoreLocaleNumberFormat:a}=e;("forex"===s||(0,n.isCFDSymbol)(s,r))&&o?(super({priceScale:o,ignoreLocaleNumberFormat:a}),this._isForex=!0):(super({priceScale:1,ignoreLocaleNumberFormat:a}),this._isForex=!1),this._pipPriceScale=t,this._pipMinMove=i,this._pipMinMove2=o}format(e,t={}){const{signPositive:i,tailSize:s,ignoreLocaleNumberFormat:r}=t;let n=this._isForex?this._pipMinMove2:this._pipMinMove;return void 0===n&&(n=NaN),super.format(e*this._pipPriceScale/n,{signPositive:i,tailSize:s,ignoreLocaleNumberFormat:r})}}var l=i(46084),c=i(58683);const h=(0,c.numDependencyFormatter)((e=>new s.NumericFormatter({precision:e}))),d=(0,c.numDependencyFormatter)((e=>new r.PercentageFormatter({priceScale:Math.pow(10,null!=e?e:2),minMove:1}))),u=(0,c.numDependencyFormatter)((e=>new l.VolumeFormatter({precision:e}))),p=new WeakMap;function _(e){let t=p.get(e);return t||(t=new a({priceScale:e.pricescale,minMove:e.minmov,minMove2:e.minmove2,type:e.type,typespecs:e.typespecs}),p.set(e,t)),t}},72791:(e,t,i)=>{"use strict";var s;i.d(t,{PaneCursorType:()=>s}),function(e){e[e.Default=0]="Default",e[e.Pointer=1]="Pointer",e[e.Eraser=2]="Eraser",e[e.Dot=3]="Dot",e[e.Grabbing=4]="Grabbing",e[e.ZoomIn=5]="ZoomIn",e[e.VerticalResize=6]="VerticalResize",e[e.HorizontalResize=7]="HorizontalResize",e[e.DiagonalNeSwResize=8]="DiagonalNeSwResize",e[e.DiagonalNwSeResize=9]="DiagonalNwSeResize",e[e.Text=10]="Text"}(s||(s={}))},65458:(e,t,i)=>{"use strict";i.d(t,{PanePriceAxisView:()=>n});var s=i(2844);class r{constructor(e){this._priceAxisViewRenderer=null,this._rendererOptions=null,this._align="right",this._textWidthCache=e}setParams(e,t,i,s,r){this._priceAxisViewRenderer=e,this._rendererOptions=t,this._align=r}draw(e,t){null!==this._rendererOptions&&null!==this._priceAxisViewRenderer&&this._priceAxisViewRenderer.draw(e,t,this._rendererOptions,this._textWidthCache,this._align)}hitTest(e,t){var i,s;return void 0===(null===(i=this._priceAxisViewRenderer)||void 0===i?void 0:i.hitTest)?null:null===(s=this._priceAxisViewRenderer)||void 0===s?void 0:s.hitTest(e,t,this._align)}}class n{constructor(e,t,i){this._renderer=null,this._invalidated=!0,this._priceAxisView=e,this._textWidthCache=new s.TextWidthCache(100),this._dataSource=t,this._chartModel=i,this._fontSize=-1,this._panePriceAxisViewRenderer=new r(this._textWidthCache)}update(e){this._invalidated=!0}renderer(e){return this._invalidated&&this._updateImpl(e),this._renderer}_position(){
const e=this._chartModel.crossHairSource(),t=this._dataSource===e?e.pane:this._chartModel.paneForSource(this._dataSource);if(null===t)return null;const i=this._priceScale();if(null===i)return null;let s=t.priceScalePosition(i);return"overlay"===s&&(s=t.priceScalePosition(t.defaultPriceScale())),"overlay"===s?null:s}_updateImpl(e){this._renderer=null;const t=this._position();if(null===t)return;const i=this._chartModel.priceAxisRendererOptions();i.fontSize!==this._fontSize&&(this._fontSize=i.fontSize,this._textWidthCache.reset()),this._panePriceAxisViewRenderer.setParams(this._priceAxisView.paneRenderer(),i,e.mediaSize.width,e.mediaSize.height,t),this._renderer=this._panePriceAxisViewRenderer,this._invalidated=!1}_priceScale(){return this._dataSource.priceScale()}}},67716:(e,t,i)=>{"use strict";i.d(t,{AreaBackgroundItem:()=>h,AreaBackgroundItemsGroup:()=>l,AreaBackgroundRenderer:()=>d,CachedMap:()=>c});var s,r,n=i(50151),o=i(30125),a=i(59152);!function(e){e[e.Solid=0]="Solid",e[e.Gradient=1]="Gradient"}(s||(s={})),function(e){e[e.PurgeCachedMapCacheIterations=50]="PurgeCachedMapCacheIterations"}(r||(r={}));class l extends a.CachedContainer{constructor(e){super(),this.color=e}}class c{constructor(){this._map=new Map,this._usedKeys=new Set,this._invalidations=0}invalidateCache(){this._invalidations+=1,50===this._invalidations&&(this._deleteUnused(),this._invalidations=0),this._usedKeys.clear(),this._map.forEach(((e,t)=>e.invalidateCache()))}get(e){const t=this._map.get(e);return void 0!==t&&this._usedKeys.add(e),t}set(e,t){this._usedKeys.add(e),this._map.set(e,t)}[Symbol.iterator](){const e=Array.from(this._usedKeys)[Symbol.iterator]();return{[Symbol.iterator](){return this},next:()=>{const t=e.next();return t.value?{value:[t.value,(0,n.ensureDefined)(this._map.get(t.value))],done:!1}:{value:void 0,done:!0}}}}forEach(e){this._map.forEach(((t,i)=>{this._usedKeys.has(i)&&e(t,i)}))}delete(e){const t=this._map.get(e);void 0!==t&&t.invalidateCache(),this._usedKeys.delete(e)}_deleteUnused(){const e=[];this._map.forEach(((t,i)=>{this._usedKeys.has(i)||e.push(i)}));for(const t of e)this._map.delete(t)}}class h extends a.CachedContainer{constructor(){super(),this.points1=new a.CachedContainer,this.points2=new a.CachedContainer,this.push(this.points1),this.push(this.points2)}addPoints1Point(e,t){let i=this.points1.newItem();null!==i?(i.x=e,i.y=t):i={x:e,y:t},this.points1.push(i)}addPoints2Point(e,t){let i=this.points2.newItem();null!==i?(i.x=e,i.y=t):i={x:e,y:t},this.points2.push(i)}invalidateCache(){this.points1.invalidateCache(),this.points2.invalidateCache()}}class d extends o.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=null,this._data=null!=e?e:null}setData(e){this._data=e}hitTest(e){return null}_drawImpl(e){var t,i;if(null===this._data)return;const{context:s,horizontalPixelRatio:r,verticalPixelRatio:n}=e,o=.25*this._data.barSpacing;for(const[,e]of this._data.colorAreas){s.beginPath();for(let t=0;t<e.length();t++){const i=e.at(t);if(i.points1.isEmpty()||i.points2.isEmpty())continue
;const a=i.points1.at(0).x,l=i.points1.at(0).y;if(s.moveTo(Math.round(a*r),l*n),1!==i.points1.length()&&1!==i.points2.length()){for(const e of i.points1.iterator(1))s.lineTo(Math.round(e.x*r),e.y*n);for(const e of i.points2.iterator(i.points2.length()-1,!0))s.lineTo(Math.round(e.x*r),e.y*n)}else{const e=i.points2.at(0).x,t=i.points2.at(0).y;s.lineTo(Math.round((a+o)*r),l*n),s.lineTo(Math.round((e+o)*r),t*n),s.lineTo(Math.round((e-o)*r),t*n),s.lineTo(Math.round((a-o)*r),l*n)}}if(s.closePath(),0===e.color.type)s.fillStyle=e.color.color;else{const r=s.createLinearGradient(0,e.color.coordinate1*n,0,e.color.coordinate2*n);r.addColorStop(0,null!==(t=e.color.color1)&&void 0!==t?t:"transparent"),r.addColorStop(1,null!==(i=e.color.color2)&&void 0!==i?i:"transparent"),s.fillStyle=r}s.fill()}}}},2271:(e,t,i)=>{"use strict";i.d(t,{PaneRendererArea:()=>o});var s=i(74010),r=i(61993),n=i(37743);class o extends s.PaneRendererLine{constructor(e){e.forceLineColor=!1,super(e)}_drawImpl(e){var t,i,o,a,l;const c=this._data;if(0===c.items.length)return;let h=null!==(i=null===(t=this._data.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,d=(null!==(a=null===(o=this._data.visibleItemsRange)||void 0===o?void 0:o.endItemIndex)&&void 0!==a?a:this._data.items.length)-1;for(;h<d&&!(0,r.coordinateIsValid)(c.items[h].y);)h++;for(;d>=0&&!(0,r.coordinateIsValid)(c.items[d].y);)d--;if(h>d)return;const{context:u,horizontalPixelRatio:p,verticalPixelRatio:_}=e;u.save(),u.scale(p,_),u.lineCap="round",u.strokeStyle=c.lineColor,u.lineWidth=c.lineWidth,(0,n.setLineStyle)(u,c.lineStyle),u.lineWidth=1;const m={},g=new s.PaneRendererLineItemsIterator(this._data.items,h,d+1,this._data.skipHoles);for(;g.next();){const e=g.currentValue();let t;t=(0,s.isValidPoint)(e)&&e.style?e.style.color:c.lineColor;const i=g.nextValue();if((0,s.isValidPoint)(i)&&(null==i?void 0:i.style)){const s=i.style.color;if(t!==s){const t=m[s]||[];t.push(e),m[s]=t}}const r=m[t]||[];r.push(e),m[t]=r}for(const e of Object.keys(m)){const t=m[e];u.beginPath();let i=0;for(let r=0;r<t.length;r++){const n=t[r];(0,s.isValidPoint)(n)&&(n.style&&(null===(l=n.style)||void 0===l?void 0:l.color)!==e&&(u.moveTo(Math.round(t[i].center),c.bottom),this._walkLine(u,t.slice(i,r),!0,c.bottom,!0),i=r))}if(u.moveTo(Math.round(t[i].center),c.bottom),this._walkLine(u,t.slice(i,t.length),!0,c.bottom,!0),u.closePath(),c.isSeries){const e=u.createLinearGradient(0,0,0,c.bottom);e.addColorStop(0,c.color1),e.addColorStop(1,c.color2),u.fillStyle=e,c.simpleMode=!0}else u.fillStyle=e;u.fill()}u.lineWidth=c.lineWidth,u.restore(),super._drawImpl(e)}}},30125:(e,t,i)=>{"use strict";i.d(t,{BitmapCoordinatesPaneRenderer:()=>r});var s=i(27714);class r{draw(e,t){new s.CanvasRenderingTarget2D(e,t.mediaSize,t.bitmapSize).useBitmapCoordinateSpace((e=>this._drawImpl(e)))}drawBackground(e,t){new s.CanvasRenderingTarget2D(e,t.mediaSize,t.bitmapSize).useBitmapCoordinateSpace((e=>this._drawBackgroundImpl(e)))}_drawBackgroundImpl(e){}}},95201:(e,t,i)=>{"use strict";i.d(t,{CompositeRenderer:()=>s});class s{
constructor(){this._renderers=[],this._globalAlpha=1}setGlobalAlpha(e){this._globalAlpha=e}append(e){this._renderers.push(e)}insert(e,t){this._renderers.splice(t,0,e)}clear(){this._renderers.length=0}isEmpty(){return 0===this._renderers.length}draw(e,t){for(let i=0;i<this._renderers.length;i++)e.save(),e.globalAlpha=this._globalAlpha,this._renderers[i].draw(e,t),e.restore()}drawBackground(e,t){e.save(),e.globalAlpha=this._globalAlpha;for(let i=0;i<this._renderers.length;i++){const s=this._renderers[i];s.drawBackground&&s.drawBackground(e,t)}e.restore()}hitTest(e,t){let i=null;for(let s=this._renderers.length-1;s>=0;s--){const r=this._renderers[s].hitTest(e,t);null!==r&&(null===i||r.target()>i.target())&&(i=r)}return i}doesIntersectWithBox(e,t){return this._renderers.some((i=>!!i.doesIntersectWithBox&&i.doesIntersectWithBox(e,t)))}}},37743:(e,t,i)=>{"use strict";i.r(t),i.d(t,{addHorizontalLineToPath:()=>d,addLineToPath:()=>x,addPixelPerfectLineToPath:()=>I,addVerticalLineToPath:()=>p,clearRectWithGradient:()=>c,clipPolygonByEdge:()=>A,computeDashPattern:()=>P,createCircle:()=>b,drawHorizontalLine:()=>u,drawLine:()=>T,drawPixelPerfectLine:()=>M,drawPoly:()=>w,drawRoundRect:()=>f,drawRoundRectWithInnerBorder:()=>v,drawVerticalLine:()=>_,fillRectInnerBorder:()=>h,fillRectWithBorder:()=>S,scaleDrawRoundRectRadii:()=>m,scaledDashPattern:()=>y,setLineStyle:()=>C});var s=i(86441),r=i(5531),n=i(51056),o=i(85904),a=i(7114),l=i(64034);function c(e,t,i,s,r,n,o){e.save(),e.globalCompositeOperation="copy";const a=e.createLinearGradient(0,0,0,r);a.addColorStop(0,n),a.addColorStop(1,o),e.fillStyle=a,e.fillRect(t,i,s,r),e.restore()}function h(e,t,i,s,r,n){e.fillRect(t+n,i,s-2*n,n),e.fillRect(t+n,i+r-n,s-2*n,n),e.fillRect(t,i,n,r),e.fillRect(t+s-n,i,n,r)}function d(e,t,i,s){const r=e.lineWidth%2?.5:0;e.moveTo(i,t+r),e.lineTo(s,t+r)}function u(e,t,i,s){e.beginPath(),d(e,t,i,s),e.stroke()}function p(e,t,i,s){const r=e.lineWidth%2?.5:0;e.moveTo(t+r,i),e.lineTo(t+r,s)}function _(e,t,i,s){e.beginPath(),p(e,t,i,s),e.stroke()}function m(e,t){return Array.isArray(e)?e.map((e=>Math.round(e*t))):Math.round(e*t)}function g(e,t){return Array.isArray(e)?e.map((e=>0===e?e:e+t)):e+t}function f(e,t,i,s,r,n,o){let a,l,c,h;if(Array.isArray(n))if(2===n.length){const e=Math.max(0,n[0]),t=Math.max(0,n[1]);a=e,l=e,c=t,h=t}else{if(4!==n.length)throw new Error("Wrong border radius - it should be like css border radius");a=Math.max(0,n[0]),l=Math.max(0,n[1]),c=Math.max(0,n[2]),h=Math.max(0,n[3])}else{const e=Math.max(0,n);a=e,l=e,c=e,h=e}o||e.beginPath(),e.moveTo(t+a,i),e.lineTo(t+s-l,i),0!==l&&e.arcTo(t+s,i,t+s,i+l,l),e.lineTo(t+s,i+r-c),0!==c&&e.arcTo(t+s,i+r,t+s-c,i+r,c),e.lineTo(t+h,i+r),0!==h&&e.arcTo(t,i+r,t,i+r-h,h),e.lineTo(t,i+a),0!==a&&e.arcTo(t,i,t+a,i,a)}function v(e,t,i,s,r,n,a=0,l=0,c="",h=o.LineStyle.Solid){if(e.save(),!l||!c||c===n)return f(e,t,i,s,r,a),e.fillStyle=n,e.fill(),void e.restore();const d=l/2;if("transparent"!==n){const d="transparent"!==c&&h!==o.LineStyle.Solid;f(e,d?t:t+l,d?i:i+l,d?s:s-2*l,d?r:r-2*l,d?a:g(a,-l)),e.fillStyle=n,
e.fill()}if("transparent"!==c){f(e,t+d,i+d,s-l,r-l,g(a,-d)),e.lineWidth=l,e.strokeStyle=c,C(e,h),e.closePath(),e.stroke()}e.restore()}function y(e,t){return t=Math.max(1,t),e.map((e=>e*t))}function S(e,t,i,s,r,o,l,c,h){const{context:d}=e,p=o%2/2,_=t+p,m=s+p;let g,f;if(c){const{borderMode:e,borderWidth:a,color:l,dashPattern:h,lineStyle:u}=c;switch(e){case"outer":{const e=-o/2-a/2,t=-a/2;f={left:_+e,right:m-e,top:i+t,bottom:r-t};break}case"center":{const e=a%2/2;f={left:t+e,right:s+e,top:i+e,bottom:r+e};break}case"inner":{const e=-o/2+a/2,t=a/2;f={left:_+e,right:m-e,top:i+t,bottom:r-t}}}d.strokeStyle=l,d.lineWidth=a;let p=-1;h?d.setLineDash(y(h,a)):void 0!==u&&(C(d,u),u===n.LINESTYLE_SOLID&&(p=1)),g={left:f.left+p*a/2,top:f.top+p*a/2,right:f.right-p*a/2,bottom:f.bottom-p*a/2}}if(l&&(d.fillStyle=l.color,g||(g={left:_-o/2,right:m+o/2,top:i,bottom:r}),d.fillRect(g.left,g.top,g.right-g.left,g.bottom-g.top)),h){const{lineWidth:n,lineColor:o,lineStyle:l,excludeBoundaries:c}=h;d.save(),d.lineCap="butt",d.lineWidth=n,d.strokeStyle=o,C(d,l);const p=()=>u(d,Math.floor((i+r)/2),t,s);c?(0,a.drawWithExclusionAreaByScope)(e,c,p):p(),d.restore()}f&&d.strokeRect(f.left,f.top,f.right-f.left,f.bottom-f.top)}function b(e,t,i,s){e.beginPath(),e.arc(t,i,s,0,2*Math.PI,!1),e.closePath()}function w(e,t,i){e.beginPath(),e.moveTo(t[0].x,t[0].y);for(const i of t)e.lineTo(i.x,i.y);e.closePath(),e.stroke(),i&&e.fill()}function C(e,t){let i=[];t!==n.LINESTYLE_SOLID&&(i=P(e.lineWidth,t)),e.setLineDash(i)}function P(e,t){return[[e,2*e],[5*e,6*e],[6*e,6*e],[e,4*e],[2*e,e]][t-1]}function x(e,t,i,s,r){e.moveTo(t,i),e.lineTo(s,r)}function T(e,t,i,s,r){isFinite(t)&&isFinite(s)&&isFinite(i)&&isFinite(r)&&(e.beginPath(),x(e,t,i,s,r),e.stroke())}function I(e,t,i,s,r,n){const{horizontalPixelRatio:o,verticalPixelRatio:a}=n;t===s?p(e,Math.round(t*o),i*a,r*a):i===r?d(e,Math.round(i*a),t*o,s*o):x(e,t*o,i*a,s*o,r*a)}function M(e,t,i,s,r,n=l.dpr1PixelRatioInfo){e.beginPath(),I(e,t,i,s,r,n),e.stroke()}function A(e,t,i,n){const o=(0,s.equalPoints)(i,n[0])?(0,s.equalPoints)(i,n[1])?null:n[1]:n[0];return null!==e&&null!==o?(0,r.intersectPolygonAndHalfplane)(e,(0,s.halfplaneThroughPoint)((0,s.lineThroughPoints)(t,i),o)):null}},61993:(e,t,i)=>{"use strict";i.d(t,{coordinateIsValid:()=>g,extendAndClipLineSegment:()=>h,fillScaledRadius:()=>v,getArrowPoints:()=>d,interactionTolerance:()=>m,optimalBarWidth:()=>u,optimalCandlestickWidth:()=>p,optimalHiLoWidth:()=>_,setValidLineStyle:()=>f,strokeScaledRadius:()=>y});var s=i(86441),r=i(5531),n=i(69186),o=i(37265),a=i(37743);const l={common:13,line:13,minDistanceBetweenPoints:10,series:14,curve:10,anchor:13,esd:4},c={common:3,line:3,minDistanceBetweenPoints:5,series:2,curve:3,anchor:2,esd:0};function h(e,t,i,n,o,a){if((0,s.equalPoints)(e,t))return null;const l=new s.Point(0,0),c=new s.Point(i,n);if(o){if(a){const i=(0,r.intersectLineAndBox)((0,s.lineThroughPoints)(e,t),(0,s.box)(l,c));return Array.isArray(i)?i:null}{const i=(0,r.intersectRayAndBox)(t,e,(0,s.box)(l,c));return null===i||(0,s.equalPoints)(t,i)?null:(0,
s.lineSegment)(t,i)}}if(a){const i=(0,r.intersectRayAndBox)(e,t,(0,s.box)(l,c));return null===i||(0,s.equalPoints)(e,i)?null:(0,s.lineSegment)(e,i)}{const i=(0,r.intersectLineSegmentAndBox)((0,s.lineSegment)(e,t),(0,s.box)(l,c));return Array.isArray(i)?i:null}}function d(e,t,i,s,r){const n=.5*i,o=Math.sqrt(2),a=t.subtract(e),l=a.normalized();let c=5*i;s&&(c=Math.min(c,.35*a.length()));const h=1*n;if(c*o*.2<=h)return[];const d=l.scaled(c),u=t.subtract(d),p=l.transposed(),_=1*c,m=p.scaled(_),g=u.add(m),f=u.subtract(m),v=g.subtract(t).normalized().scaled(h),y=f.subtract(t).normalized().scaled(h),S=r?t:t.add(v),b=r?t:t.add(y),w=n*(o-1),C=p.scaled(w),P=Math.min(c-1*n/o,n*o*1),x=l.scaled(P),T=t.subtract(C),I=t.add(C),M=t.subtract(x);return[[g,S],[b,f],[T,M.subtract(C)],[I,M.add(C)]]}function u(e,t){return t=t||1,Math.floor(.3*e*t)}function p(e,t){if(e>=2.5&&e<=4)return Math.floor(3*t);const i=1-.2*Math.atan(Math.max(4,e)-4)/(.5*Math.PI),s=Math.floor(e*i*t),r=Math.floor(e*t),n=Math.min(s,r);return Math.max(Math.floor(t),n)}function _(e){return.4*e}function m(){return(0,n.lastMouseOrTouchEventInfo)().isTouch?l:c}function g(e){return null!=e&&!(0,o.isNaN)(e)}function f(e,t){void 0!==t&&(0,a.setLineStyle)(e,t)}function v(e,t){const i=Math.max(1,Math.floor(t))%2?.5:0;return Math.round(e*t)+i}function y(e,t,i){const s=Math.max(1,Math.floor(t))%2?.5:0;return Math.round(e*t)+(s!==i%2?.5:0)}},50600:(e,t,i)=>{"use strict";i.d(t,{HorizontalLineRenderer:()=>l});var s=i(56468),r=i(37743),n=i(61993),o=i(30125),a=i(7114);class l extends o.BitmapCoordinatesPaneRenderer{constructor(){super(...arguments),this._data=null,this._hitTest=new s.HitTestResult(s.HitTarget.Regular)}setData(e){this._data=e}setHitTest(e){this._hitTest=e}hitTest(e){if(null===this._data||!1===this._data.visible||null===this._hitTest)return null;const t=(0,n.interactionTolerance)().line,i=Math.abs(e.y-this._data.y)<=t+this._data.linewidth/2,s=void 0===this._data.left||this._data.left-e.x<=t,r=void 0===this._data.right||e.x-this._data.right<=t;return i&&s&&r?this._hitTest:null}_drawImpl(e){if(null===this._data||!1===this._data.visible)return;const{context:t,horizontalPixelRatio:i,verticalPixelRatio:s,mediaSize:n}=e;if(this._data.y<-this._data.linewidth/2||this._data.y>n.height+this._data.linewidth/2)return;t.lineCap="butt",t.strokeStyle=this._data.color,t.lineWidth=Math.max(1,Math.floor(this._data.linewidth*i)),void 0!==this._data.linestyle&&(0,r.setLineStyle)(t,this._data.linestyle);const o=void 0!==this._data.left?Math.max(this._data.left,0):0,l=void 0!==this._data.right?Math.min(this._data.right,n.width):n.width,c=Math.round(this._data.y*s),h=Math.round(o*i),d=Math.round(l*i),u=this._data.excludeBoundaries;void 0!==u&&(0,a.addExclusionAreaByScope)(e,u),(0,r.drawHorizontalLine)(t,c,h,d)}}},49857:(e,t,i)=>{"use strict";var s;i.d(t,{LineEnd:()=>s}),function(e){e[e.Normal=0]="Normal",e[e.Arrow=1]="Arrow",e[e.Circle=2]="Circle"}(s||(s={}))},74010:(e,t,i)=>{"use strict";i.d(t,{PaneRendererLine:()=>p,PaneRendererLineItemsIterator:()=>u,isValidPoint:()=>d})
;var s=i(50151),r=i(86441),n=i(4652),o=i(56468),a=i(61993),l=i(37743),c=i(30125);const h={y:NaN};function d(e){return null!==e&&!isNaN(e.y)}class u{constructor(e,t,i,r){this._calculatedPrev={index:null,currentBreakProcessed:!1,value:null},this._calculatedCurrent={index:null,currentBreakProcessed:!1,value:null},this._calculatedNext={index:null,currentBreakProcessed:!1,value:null},this._preallocatedVariable={index:null,currentBreakProcessed:!1,value:null},e.length&&((0,s.assert)(t<=i,"First index must be less or equal to last index"),(0,s.assert)(t<e.length,"First index must be less then array length"),(0,s.assert)(i<=e.length,"Last index must be less or equal to array length")),this._items=e,this._firstIndexWithRange=t,this._lastIndexWithRange=i,this._skipHoles=r}next(){if(0===this._items.length)return!1;if(null!==this._calculatedNext.index)return null!==this._calculatedNext.value&&(this._calculatedPrev=this._calculatedCurrent,this._calculatedCurrent=this._calculatedNext,this._calculatedNext={index:null,currentBreakProcessed:!1,value:null},!0);let e;this._preallocatedVariable={...this._calculatedCurrent};do{null===this._preallocatedVariable.index?(this._preallocatedVariable.index=this._firstIndexWithRange,this._preallocatedVariable.currentBreakProcessed=!1,e=this._preallocatedVariable.index<this._lastIndexWithRange):(this._incrementPointer(this._preallocatedVariable),e=this._isValidPointer(this._preallocatedVariable)),e&&this._calcVaue(this._preallocatedVariable)}while(e&&this._skipHoles&&!d(this._preallocatedVariable.value));return e&&(this._calculatedPrev=this._calculatedCurrent,this._calculatedCurrent=this._preallocatedVariable,this._calculatedNext={index:null,currentBreakProcessed:!1,value:null}),e}prevValue(){return this._calculatedPrev.value}currentValue(){return(0,s.ensureNotNull)(this._calculatedCurrent.value)}currentValueIsLast(){return(0,s.ensureNotNull)(this._calculatedCurrent.index)===this._items.length-1}currentValueIsFirst(){return 0===(0,s.ensureNotNull)(this._calculatedCurrent.index)}nextValue(){if(null!==this._calculatedNext.index)return this._calculatedNext.value;let e;this._calculatedNext={...this._calculatedCurrent,value:null};do{this._incrementPointer(this._calculatedNext),e=this._isValidPointer(this._calculatedNext),e?this._calcVaue(this._calculatedNext):this._calculatedNext.value=null}while(e&&this._skipHoles&&!d(this._calculatedNext.value));return this._calculatedNext.value}atStart(){return this._calculatedCurrent.index===this._firstIndexWithRange&&!this._calculatedCurrent.currentBreakProcessed}atEnd(){const e=(0,s.ensureNotNull)(this._calculatedCurrent.index);return e<this._lastIndexWithRange&&(this._calculatedCurrent.currentBreakProcessed||!this._needBreakBefore(e))}_needBreakBefore(e){return!!this._items[e].breakBefore&&!this._skipHoles}_calcVaue(e){const t=(0,s.ensureNotNull)(e.index);this._needBreakBefore(t)&&!e.currentBreakProcessed?e.value=h:e.value=this._items[t]}_incrementPointer(e){const t=(0,s.ensureNotNull)(e.index)
;this._needBreakBefore(t)&&!this._calculatedCurrent.currentBreakProcessed?e.currentBreakProcessed=!0:(e.index=t+1,e.currentBreakProcessed=!1)}_isValidPointer(e){const t=(0,s.ensureNotNull)(e.index);return t<this._lastIndexWithRange||t===this._lastIndexWithRange-1&&this._needBreakBefore(t)&&e.currentBreakProcessed}}class p extends c.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e}hitTest(e){var t,i,s,l;const c=(0,a.interactionTolerance)().series+this._data.lineWidth/2;let h=null!==(i=null===(t=this._data.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,d=(null!==(l=null===(s=this._data.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==l?l:this._data.items.length)-1;for(;d-h>2;){const t=Math.round((d+h)/2);this._data.items[t].center<=e.x?h=t:d=t}h=Math.max(1,h-1),d=Math.min(this._data.items.length-1,d+1);for(let t=h;t<=d;++t){const i=this._data.items[t-1],s=this._data.items[t],a=i.center,l=s.center;if((0,n.distanceToSegment)(new r.Point(a,i.y),new r.Point(l,s.y),new r.Point(e.x,e.y)).distance<=c)return this._data.hittest?this._data.hittest:new o.HitTestResult(o.HitTarget.Regular)}return null}_drawImpl(e){const{context:t,horizontalPixelRatio:i,verticalPixelRatio:s}=e;t.scale(i,s),t.lineCap="round",t.lineJoin="round",t.strokeStyle=this._data.lineColor,t.fillStyle=this._data.lineColor,t.lineWidth=this._data.lineWidth,(0,l.setLineStyle)(t,this._data.lineStyle),(0,a.setValidLineStyle)(t,this._data.lineStyle),this._data.simpleMode?this._drawSimpleMode(t,i,s):this._drawLines(t)}_drawSimpleMode(e,t,i){var s,r,n,o;e.beginPath(),this._walkLine(e,this._data.items,!1,NaN),e.stroke();const a=this._data.lineWidth+2;if(this._data.withMarkers&&2*a<this._data.barSpacing){e.scale(1/t,1/i);const l=Math.max(1,Math.floor(t))%2/2,c=a*i+l,h=2*Math.PI;e.beginPath();const d=null!==(r=null===(s=this._data.visibleItemsRange)||void 0===s?void 0:s.startItemIndex)&&void 0!==r?r:0;for(let s=(null!==(o=null===(n=this._data.visibleItemsRange)||void 0===n?void 0:n.endItemIndex)&&void 0!==o?o:this._data.items.length)-1+1;s-- >=d;){const r=this._data.items[s];if(r){const s=Math.round(r.center*t)+l,n=r.y*i;e.moveTo(s,n),e.arc(s,n,c,0,h)}}e.fill()}}_walkLine(e,t,i,s,r){var n,o,a,l;if(!t)return;const c=.25*this._data.barSpacing;let h,p,_=null;const m=r?0:null!==(o=null===(n=this._data.visibleItemsRange)||void 0===n?void 0:n.startItemIndex)&&void 0!==o?o:0,g=r?t.length:Math.min(null!==(l=null===(a=this._data.visibleItemsRange)||void 0===a?void 0:a.endItemIndex)&&void 0!==l?l:t.length,t.length);if(m>g||m>=t.length)return;const f=new u(t,m,g,this._data.skipHoles);for(;f.next();){if(h=f.currentValue(),p=f.nextValue(),d(h)){const t=Math.round(h.center);_&&d(_)?(e.lineTo(t,h.y),i&&!d(p)&&e.lineTo(t,s)):p&&d(p)?i?(f.atStart()||e.lineTo(t,s),e.lineTo(t,h.y)):e.moveTo(t,h.y):i?(f.atStart()||e.lineTo(t-c,s),e.lineTo(t-c,h.y),e.lineTo(t+c,h.y),e.lineTo(t+c,s)):(e.moveTo(t-c,h.y),e.lineTo(t+c,h.y))}_=h}}_drawLines(e){var t,i,s,r;if(!this._data.items.length)return;let n,o,l=null;const c=.25*this._data.barSpacing
;e.beginPath();const h=null!==(i=null===(t=this._data.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,p=null!==(r=null===(s=this._data.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:this._data.items.length;if(h>p||h>=this._data.items.length)return;const _=this._data.items[h];_&&e.moveTo(_.center,_.y);let m,g=e.strokeStyle,f=e.lineWidth;const v=new u(this._data.items,h,p,this._data.skipHoles);for(;v.next();){let t,i,s;l=v.prevValue(),n=v.currentValue(),o=v.nextValue();let r=!1;if(d(n)&&(n.style&&!this._data.forceLineColor?(t=n.style.color,i=n.style.width,s=n.style.style):(t=this._data.lineColor,i=this._data.lineWidth,s=this._data.lineStyle),this._data.ignorePaletteLineWidth&&(i=this._data.lineWidth),r=t!==g||i!==f||s!==m),r)if(g=t,f=i,m=s,e.stroke(),e.beginPath(),e.strokeStyle=t,e.lineWidth=i,(0,a.setValidLineStyle)(e,s),d(l))e.moveTo(l.center,l.y);else{const t=n;e.moveTo(t.center,t.y)}y=l,b=o,d(S=n)&&(d(y)?e.lineTo(S.center,S.y):b&&d(b)?e.moveTo(S.center,S.y):(e.moveTo(S.center-c,S.y),e.lineTo(S.center+c,S.y)))}var y,S,b;e.stroke()}}},75919:(e,t,i)=>{"use strict";i.d(t,{MediaCoordinatesPaneRenderer:()=>r});var s=i(27714);class r{draw(e,t){new s.CanvasRenderingTarget2D(e,t.mediaSize,t.bitmapSize).useMediaCoordinateSpace((e=>this._drawImpl(e)))}drawBackground(e,t){new s.CanvasRenderingTarget2D(e,t.mediaSize,t.bitmapSize).useMediaCoordinateSpace((e=>this._drawBackgroundImpl(e)))}_drawBackgroundImpl(e){}}},59152:(e,t,i)=>{"use strict";var s;i.d(t,{CachedContainer:()=>n,ObjectValuesCache:()=>o}),function(e){e[e.PurgeCachedContainerCacheIterations=3e3]="PurgeCachedContainerCacheIterations"}(s||(s={}));class r{constructor(e,t,i,s){this._items=e,this._actualLength=t,this._step=s?-1:1,this._currentIndex=i-this._step}[Symbol.iterator](){return this}next(){return this._currentIndex+=this._step,this._currentIndex>=this._actualLength||this._currentIndex<0?{value:void 0,done:!0}:{done:!1,value:this._items[this._currentIndex]}}}class n{constructor(){this._items=[],this._actualLength=0,this._invalidations=0}push(e){this._items.length===this._actualLength?this._items.push(e):this._items[this._actualLength]!==e&&(this._items[this._actualLength]=e),this._actualLength+=1}newItem(){const e=this._items.length>this._actualLength?this._items[this._actualLength]:null;return null!==e&&Boolean(e.invalidateCache)&&e.invalidateCache(),e}invalidateCache(){this._invalidations+=1,3e3===this._invalidations&&(this._items.splice(this._actualLength),this._invalidations=0),this._actualLength=0}at(e){return this._items[e]}data(){return this._items}length(){return this._actualLength}isEmpty(){return 0===this._actualLength}iterator(e,t){return new r(this._items,this._actualLength,e,t)}}class o extends n{constructor(){super(...arguments),this._startIndex=0}setStartIndex(e){this._startIndex=e}isValidIndex(e){return e>=this._startIndex}at(e){const t=e-this._startIndex;for(;t>=this._actualLength;)this._items.length<=t?this._items.push(this._newObject()):this._clearObject(this._items[this._actualLength]),
this._actualLength+=1;return this._items[t]}}},62189:(e,t,i)=>{"use strict";i.d(t,{RectangleRenderer:()=>p});var s,r=i(50151),n=i(86441),o=i(34026),a=i(4652),l=i(19063),c=i(51056),h=i(56468),d=i(37743),u=i(30125);!function(e){e[e.HitTestTolerance=3]="HitTestTolerance"}(s||(s={}));class p extends u.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=null,this._forceOverrideTransparency=Boolean(e)}setData(e){this._data=e}hitTest(e,t){if(null===this._data||this._data.points.length<2||this._data.nohittest)return null;const i=t.mediaSize.width,s=(0,n.box)(...this._data.points),r=s.min,o=s.max,l=new n.Point(o.x,r.y),c=new n.Point(r.x,o.y),d=this._extendAndHitTestLineSegment(e,r,l,i);if(null!==d)return d;const u=this._extendAndHitTestLineSegment(e,c,o,i);if(null!==u)return u;let p=(0,a.distanceToSegment)(l,o,e);if(p.distance<=3)return new h.HitTestResult(h.HitTarget.MovePoint);if(p=(0,a.distanceToSegment)(r,c,e),p.distance<=3)return new h.HitTestResult(h.HitTarget.MovePoint);if(this._data.middleLine){const t=s.min.add(s.max).scaled(.5),r=this._extendAndHitTestLineSegment(e,new n.Point(s.min.x,t.y),new n.Point(s.max.x,t.y),i);if(null!==r)return r}return this._data.fillBackground?this._hitTestBackground(e,r,o,i):null}getColor(){const e=(0,r.ensure)(this._data);return void 0===e.transparency?e.backcolor:(0,l.generateColor)(e.backcolor,e.transparency,this._forceOverrideTransparency)}_drawImpl(e){if(null===this._data||this._data.points.length<2||this._data.linewidth<=0&&!this._data.fillBackground)return;const{horizontalPixelRatio:t,verticalPixelRatio:i,bitmapSize:s}=e,{extendLeft:r,extendRight:o,linewidth:a,middleLine:l}=this._data,h=(0,n.box)(...this._data.points),u=this._data.linewidth?Math.max(1,Math.floor(this._data.linewidth*t)):0,p=this._data.fillBackground?this.getColor():void 0,_=Math.max(1,Math.floor(t)),m=r?-a:Math.round(h.min.x*t),g=o?s.width+a:Math.round(h.max.x*t),f=Math.round(h.min.y*i),v=Math.round(h.max.y*i);(0,d.fillRectWithBorder)(e,m,f,g,v,_,void 0===p?void 0:{color:p},0===u?void 0:{color:this._data.color,lineStyle:c.LINESTYLE_SOLID,borderWidth:u,borderMode:"center"},l?{...l,lineWidth:Math.max(1,Math.floor(l.lineWidth*i))}:void 0)}_extendAndHitTestLineSegment(e,t,i,s){const r=this._extendAndClipLineSegment(t,i,s);if(null!==r){if((0,a.distanceToSegment)(r[0],r[1],e).distance<=3)return new h.HitTestResult(h.HitTarget.MovePoint)}return null}_extendAndClipLineSegment(e,t,i){const s=(0,r.ensureNotNull)(this._data);if((0,n.equalPoints)(e,t)&&!s.extendLeft&&!s.extendRight)return null;const o=Math.min(e.x,t.x),a=Math.max(e.x,t.x),l=s.extendLeft?0:Math.max(o,0),c=s.extendRight?i:Math.min(a,i);return l>c||c<=0||l>=i?null:[new n.Point(l,e.y),new n.Point(c,t.y)]}_hitTestBackground(e,t,i,s){var r,a;const l=this._extendAndClipLineSegment(t,i,s);return null!==l&&(0,o.pointInBox)(e,(0,n.box)(l[0],l[1]))?new h.HitTestResult(null!==(a=null===(r=this._data)||void 0===r?void 0:r.backgroundHitTarget)&&void 0!==a?a:h.HitTarget.MovePointBackground):null}}},12027:(e,t,i)=>{"use strict";i.d(t,{svgRenderer:()=>T})
;var s=i(50151),r=i(31955);const n=(0,r.getLogger)("Chart.SvgParser");function o(e,t){const i=e.split(/[,\s]/).map((e=>parseFloat(e.trim())));let s=0;for(const e of i){if(!Number.isFinite(e)&&s<t)return null;s+=1}return i}const a=/([a-zA-Z]+)\((.*)\)/g;function l(e){var t;const i=null===(t=e.getAttribute("transform"))||void 0===t?void 0:t.toLowerCase();if(void 0===i)return null;const s=[];let r;a.lastIndex=0;do{if(r=a.exec(i),null!==r){const e=r[1],t=r[2];switch(e){case"matrix":const i=o(t,6);null!==i&&s.push({type:e,a:i[0],b:i[1],c:i[2],d:i[3],e:i[4],f:i[5]});break;case"rotate":const r=o(t,1);null!==r&&s.push({type:e,a:r[0],x:r[1],y:r[2]});break;case"translate":const a=o(t,1);null!==a&&s.push({type:e,x:a[0],y:a[1]});break;case"scale":const l=o(t,1);null!==l&&s.push({type:e,x:l[0],y:l[1]});break;default:n.logWarn(`Unsupported transform operation: ${e}`)}}}while(null!==r);return 0===s.length?null:s}function c(e,t){var i,s;for(const r of t)switch(r.type){case"matrix":e.transform(r.a,r.b,r.c,r.d,r.e,r.f);break;case"rotate":void 0!==r.x&&void 0!==r.y&&e.translate(r.x,r.y),e.rotate(r.a*Math.PI/180),void 0!==r.x&&void 0!==r.y&&e.translate(-r.x,-r.y);break;case"scale":e.scale(r.x,null!==(i=r.y)&&void 0!==i?i:r.x);break;case"translate":e.translate(r.x,null!==(s=r.y)&&void 0!==s?s:0)}}function h(e,t){var i;return parseFloat(null!==(i=e.getAttribute(t))&&void 0!==i?i:"")}const d=/^url\(#(.*)\)/;function u(e){var t,i;return null!==(i=null===(t=d.exec(e))||void 0===t?void 0:t[1])&&void 0!==i?i:null}function p(e,t,i){const r={},n=e.getAttribute("fill");if(null!==n){const e=u(n);r.getFillStyle=null!==e?i=>(0,s.ensureDefined)(t.getStyle(e,i)):e=>n}const o=e.getAttribute("stroke");if(null!==o){const e=u(o);r.getStrokeStyle=null!==e?i=>(0,s.ensureDefined)(t.getStyle(e,i)):e=>o}const a=h(e,"stroke-width");Number.isFinite(a)&&(r.strokeWidth=a);const c=h(e,"opacity");Number.isFinite(c)&&(r.fillOpacity=c,r.strokeOpacity=c);const d=h(e,"stroke-opacity");Number.isFinite(d)&&(r.strokeOpacity=d);const p=h(e,"fill-opacity");if(Number.isFinite(p)&&(r.fillOpacity=p),i){const t=l(e);null!==t&&(r.transform=t)}return r}class _{constructor(e){this._transformOperations=e}apply(e,t){null!==this._transformOperations?(e.save(),c(e,this._transformOperations)):e.restore()}}class m{constructor(e,t,i){this._styleData={...i,...p(e,t,!0)}}apply(e,t){if(!this._isValid())return;const{getFillStyle:i,getStrokeStyle:s,strokeWidth:r,transform:n,strokeOpacity:o,fillOpacity:a}=this._styleData,l=void 0!==n||void 0!==o||void 0!==a;l&&(e.save(),void 0!==n&&c(e,n)),this._render(e);const h=null==i?void 0:i(e);"none"!==h&&(t.doNotApplyColors||(void 0!==a&&(e.globalAlpha=a),e.fillStyle=null!=h?h:"black"),this._fill(e));const d=null==s?void 0:s(e);void 0!==d&&"none"!==d&&(void 0!==r&&(e.lineWidth=r),t.doNotApplyColors||(void 0!==a&&(e.globalAlpha=a),e.strokeStyle=d),this._stroke(e)),l&&e.restore()}_fill(e){e.fill()}_stroke(e){e.stroke()}}class g extends m{constructor(e,t,i){var s;super(e,t,i);const r=e.getAttribute("d");this._path=null!==r?new Path2D(r):null,
this._fillRule=null!==(s=e.getAttribute("fill-rule"))&&void 0!==s?s:void 0}_fill(e){e.fill((0,s.ensureNotNull)(this._path),this._fillRule)}_stroke(e){e.stroke((0,s.ensureNotNull)(this._path))}_render(e){}_isValid(){return null!==this._path}}class f extends m{constructor(e,t,i){super(e,t,i),this._cx=h(e,"cx"),this._cy=h(e,"cy"),this._r=h(e,"r")}_render(e){e.beginPath(),e.arc(this._cx,this._cy,this._r,0,2*Math.PI)}_isValid(){return Number.isFinite(this._cx)&&Number.isFinite(this._cy)&&Number.isFinite(this._r)}}class v extends m{constructor(e,t,i){super(e,t,i),this._cx=h(e,"cx"),this._cy=h(e,"cy"),this._rx=h(e,"rx"),this._ry=h(e,"ry")}_render(e){e.beginPath(),e.ellipse(this._cx,this._cy,this._rx,this._ry,0,0,2*Math.PI)}_isValid(){return Number.isFinite(this._cx)&&Number.isFinite(this._cy)&&Number.isFinite(this._rx)&&Number.isFinite(this._ry)}}class y{constructor(e){this._originalViewBox=e}apply(e,t){const i=t.targetViewBox;e.translate(i.x,i.y),e.scale(i.width/this._originalViewBox.width,i.height/this._originalViewBox.height),e.beginPath(),e.rect(0,0,this._originalViewBox.width,this._originalViewBox.height),e.clip(),e.translate(-this._originalViewBox.x,-this._originalViewBox.y)}}const S=(0,r.getLogger)("Chart.SvgParser");function b(e){const t=e.getAttribute("gradientUnits");if("objectBoundingBox"===t)return void S.logWarn(`Unsupported linearGradient gradientUnits: ${t}`);const i=[],s=e.getElementsByTagName("stop");for(let e=0;e<s.length;++e){const t=s[e],r=h(t,"offset"),n=t.getAttribute("stop-color");null!==n&&i.push([Number.isFinite(r)?r:0,n])}const r=h(e,"x1"),n=h(e,"y1"),o=h(e,"x2"),a=h(e,"y2");return e=>{const t=e.createLinearGradient(r,n,o,a);for(const e of i)t.addColorStop(e[0],e[1]);return t}}const w=(0,r.getLogger)("Chart.SvgParser");const C=new DOMParser,P=(0,r.getLogger)("Chart.SvgParser");function x(e,t,i,s){var r;const n=e.children;let o,a=s;"g"!==e.tagName&&"svg"!==e.tagName||(a={...a,...p(e,i,!1)},o=null!==(r=l(e))&&void 0!==r?r:void 0),void 0!==o&&t.push(new _(o));for(let e=0;e<n.length;++e){const s=n[e];"defs"!==s.tagName&&x(s,t,i,a)}switch(void 0!==o&&t.push(new _(null)),e.tagName){case"g":case"svg":case"defs":break;case"path":t.push(new g(e,i,s));break;case"circle":t.push(new f(e,i,s));break;case"ellipse":t.push(new v(e,i,s));break;default:P.logWarn(`Unsupported tag name: ${e.tagName}`)}}function T(e){const t=C.parseFromString(e,"application/xml"),i=[],r=t.getElementsByTagName("svg")[0],n=(0,s.ensureNotNull)(r.getAttribute("viewBox")).split(" ").map(parseFloat),o={x:n[0],y:n[1],width:n[2],height:n[3]};i.push(new y(o));let a={getStyle:()=>{}};const l=r.getElementsByTagName("defs");return l.length>0&&(a=function(e){const t={},i=e.children;for(let e=0;e<i.length;++e){const s=i[e],r=s.getAttribute("id");r&&("linearGradient"===s.tagName?t[r]=b(s):w.logWarn(`Unsupported defs tag: ${s.tagName}`))}const s=new WeakMap;return{getStyle:(e,i)=>{const r=t[e];if(!r)return;let n=s.get(i);void 0===n&&(n=new Map,s.set(i,n));const o=n.get(e);if(void 0!==o)return o;const a=r(i);return n.set(e,a),a}}}(l[0])),x(r,i,a),{
viewBox:()=>o,render:(e,t)=>{e.save();for(const s of i)s.apply(e,t);e.restore()}}}},39429:(e,t,i)=>{"use strict";var s;i.d(t,{StatsPosition:()=>s}),function(e){e[e.Left=0]="Left",e[e.Center=1]="Center",e[e.Right=2]="Right",e[e.Auto=3]="Auto"}(s||(s={}))},3385:(e,t,i)=>{"use strict";i.d(t,{PaneRendererStepLine:()=>f,StepLineDecoration:()=>s});var s,r,n=i(4652),o=i(86441),a=i(19063),l=i(56468),c=i(61993),h=i(37743),d=i(30125),u=i(74010);!function(e){e[e.None=0]="None",e[e.Diamonds=1]="Diamonds"}(s||(s={})),function(e){e[e.SmallDiamondsSize=8]="SmallDiamondsSize",e[e.SmallDiamondsRadius=2]="SmallDiamondsRadius",e[e.LargeDiamondsSize=21]="LargeDiamondsSize",e[e.LargeDiamondsRadius=5]="LargeDiamondsRadius",e[e.LargeDiamondsTransparency=85]="LargeDiamondsTransparency",e[e.LeftUnplottableXCoord=-50]="LeftUnplottableXCoord"}(r||(r={}));class p{constructor(e){this._forceExtendFirstBar=!!e}initialize(e,t,i){var s,r,n,o;const{context:a,horizontalPixelRatio:l,verticalPixelRatio:c}=t,d=e.lineStyle;a.lineCap="butt",a.lineJoin="round";const u=Math.max(Math.floor(null!==(r=null===(s=i.style)||void 0===s?void 0:s.width)&&void 0!==r?r:e.lineWidth*l));void 0!==d&&(0,h.setLineStyle)(a,d);const p=u%2?.5:0;a.moveTo(Math.round(i.center*l)+p,Math.round(i.y*c)+p),a.strokeStyle=null!==(o=null===(n=i.style)||void 0===n?void 0:n.color)&&void 0!==o?o:e.lineColor,a.lineWidth=u}startFragment(e,t,i,s){e.beginPath();const r=i.firstItem&&i.extendToBarsEndings?t.center:t.left;e.moveTo(isNaN(r)?-50:r,t.y)}finishFragment(e,t,i){t&&i&&e.lineTo(t.left,i.y),e.stroke()}hitTest(e,t,i,s){var r,a;if(!(0,u.isValidPoint)(t))return!1;const l=null!==(a=null===(r=t.style)||void 0===r?void 0:r.width)&&void 0!==a?a:e.lineWidth,h=(0,c.interactionTolerance)().series+l/2,{left:d,y:p}=t,_=isNaN(d)?-50:d;let m,g;return i&&(0,u.isValidPoint)(i)?(m=i.left,g=i.y):(m=t.right,g=t.y),!(_<s.x-h&&m<s.x-h||_>s.x+h&&m>s.x+h)&&((0,n.distanceToSegment)((0,o.point)(_,p),(0,o.point)(m,p),s).distance<h||p!==g&&(0,n.distanceToSegment)((0,o.point)(m,p),(0,o.point)(m,g),s).distance<h)}applyColor(e,t){e.strokeStyle=t}applyLineWidth(e,t){e.lineWidth=t}drawItem(e,t,i,s){const r=e.context;void 0!==s&&r.lineTo(t.left,s.y),r.lineTo(!i.firstItem||i.extendToBarsEndings||this._forceExtendFirstBar?t.left:t.center,t.y),r.lineTo(i.lastItem&&!i.extendToBarsEndings?t.center:t.right,t.y)}}class _{constructor(){this._lineWidth=1}initialize(e,t,i){var s,r,n,o;const{context:a,horizontalPixelRatio:l}=t;this.applyColor(a,null!==(r=null===(s=i.style)||void 0===s?void 0:s.color)&&void 0!==r?r:e.lineColor),this._lineWidth=Math.max(Math.floor(null!==(o=null===(n=i.style)||void 0===n?void 0:n.width)&&void 0!==o?o:e.lineWidth*l))}startFragment(e,t,i,s){e.beginPath()}finishFragment(e){e.fill()}drawItem(e,t,i,s){if(i.valIsNotSameAsPrev&&!isNaN(t.left)){const i=e.context;i.save(),i.translate(t.left,t.y),i.rotate(Math.PI/4);const s=this._scaleByLineWidth(this._lineWidth);i.scale(s,s),this._drawItemRotatedAndTranslated(e),i.restore()}}applyLineWidth(e,t){this._lineWidth=t}hitTest(e,t,i,s){var r,n
;if(!t.valIsNotSameAsPrev)return!1;const a=s.subtract((0,o.point)(t.left,t.y));return this._hitTestTranslated(a,null!==(n=null===(r=t.style)||void 0===r?void 0:r.width)&&void 0!==n?n:e.lineWidth)}_scaleByLineWidth(e){return Math.sqrt(e)}}class m extends _{applyColor(e,t){e.fillStyle=t}_hitTestTranslated(e,t){return Math.abs(e.x)+Math.abs(e.y)<8*this._scaleByLineWidth(t)/2}_drawItemRotatedAndTranslated(e){(0,h.drawRoundRect)(e.context,-4,-4,8,8,2,!0)}}class g extends _{applyColor(e,t){e.fillStyle=(0,a.applyTransparency)(t,85)}_hitTestTranslated(e,t){return Math.abs(e.x)+Math.abs(e.y)<21*this._scaleByLineWidth(t)/2}_drawItemRotatedAndTranslated(e){(0,h.drawRoundRect)(e.context,-10.5,-10.5,21,21,5,!0)}}class f extends d.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=null,this._data=null!=e?e:null}setData(e){this._data=e}hitTest(e){var t,i;const r=this._data;if(null===r||0===r.items.length)return null;const{items:n,visibleItemsRange:o,skipHoles:a}=r,c=null!==(t=null==o?void 0:o.startItemIndex)&&void 0!==t?t:0,h=null!==(i=null==o?void 0:o.endItemIndex)&&void 0!==i?i:n.length;if(h<=c)return null;const d=r.decoration===s.Diamonds?[new p,new g]:[new p];const _=new u.PaneRendererLineItemsIterator(n,c,h,a);for(;_.next();){const t=_.currentValue(),i=_.nextValue();for(const s of d)if((0,u.isValidPoint)(t)&&s.hitTest(r,t,(0,u.isValidPoint)(i)?i:null,e))return new l.HitTestResult(l.HitTarget.Regular)}return null}_drawImpl(e){if(null===this._data||0===this._data.items.length)return;(this._data.decoration===s.Diamonds?[new p(!0),new m,new g]:[new p]).forEach((t=>this._drawDecorationItem(e,t)))}_drawDecorationItem(e,t){var i,s,r,n,o,a,l,c,h,d;if(null===this._data||0===this._data.items.length)return;const{lineWidth:p,lineColor:_,items:m,visibleItemsRange:g,skipHoles:f,extendToBarsEndings:v}=this._data,{context:y,horizontalPixelRatio:S,verticalPixelRatio:b}=e;let w=Math.max(Math.floor((null!==(s=null===(i=m[0].style)||void 0===i?void 0:i.width)&&void 0!==s?s:p)*S)),C=w%2?.5:0;t.initialize(this._data,e,m[0]);const P=null!==(r=null==g?void 0:g.startItemIndex)&&void 0!==r?r:0,x=null!==(n=null==g?void 0:g.endItemIndex)&&void 0!==n?n:m.length;if(x<=P)return;let T,I,M;y.beginPath(),t.applyColor(y,null!==(a=null===(o=m[P].style)||void 0===o?void 0:o.color)&&void 0!==a?a:_),t.applyLineWidth(y,w);let A=!1;const L=new u.PaneRendererLineItemsIterator(m,P,x,f);for(;L.next();){const i=L.currentValue();if(!(0,u.isValidPoint)(i)){T=void 0,A=!0;continue}const s=null!==(c=null===(l=i.style)||void 0===l?void 0:l.color)&&void 0!==c?c:_,r=null!==(d=null===(h=i.style)||void 0===h?void 0:h.width)&&void 0!==d?d:p,n=s!==I,o=r!==M,a={firstItem:L.currentValueIsFirst(),lastItem:L.currentValueIsLast(),extendToBarsEndings:v,valIsNotSameAsPrev:i.valIsNotSameAsPrev},m={y:Math.round(i.y*b)+C,left:Math.round(i.left*S)+C,center:Math.round(i.center*S)+C,right:Math.round(i.right*S)+C};(n||o||A)&&(I&&M&&t.finishFragment(y,m,T),n&&t.applyColor(y,s),o&&(w=Math.max(1,Math.floor(r*S)),C=w%2?.5:0,t.applyLineWidth(y,w)),t.startFragment(y,m,a,T),A=!1,I=s,M=r),
t.drawItem(e,m,a,T),T=m}t.finishFragment(y)}}},17330:(e,t,i)=>{"use strict";i.d(t,{TextRenderer:()=>D,calculateLabelPosition:()=>m,fontSize:()=>A,getTextBoundaries:()=>g,lineSpacing:()=>M,needTextExclusionPath:()=>f,wordWrap:()=>S});var s=i(86441),r=i(50151),n=i(34026),o=i(63273),a=i(56468),l=i(37743),c=i(36696),h=i(37265),d=i(7114),u=i(51056),p=i(29981),_=i(2844);function m(e,t,i,r,n){const o=.5*(t.x+i.x);let a=i.y;return t.y>i.y?(a-=e.height/2+r.y,a=Math.max(e.height/2,a)):(a+=e.height/2+r.y,a=Math.min(n-e.height/2,a)),new s.Point(o,a)}function g(e,t,i){if(e.isOutOfScreen(t,i))return null;const s=e.getPolygonPoints();return 0===s.length?null:s}function f(e){const t=e.getLinesInfo().lines;if(t.length%2==0)return!1;if(""===t[Math.floor(t.length/2)].text.trim())return!1;return!0}function v(e){const t=[];do{const i=e.match(/\s+/);if(!i||void 0===i.index||-1===i.index){t.push({word:e,spaces:""});break}t.push({word:e.slice(0,i.index),spaces:i[0]}),e=e.slice(i.index+i[0].length)}while(e.length);return t}function y(e,t,i,s){const r=[],n=[];for(let t=0;t<e.length;++t)n.push(t);for(;e.length;){const o=Math.max(1,(0,p.upperbound)(n,s,((s,r)=>(0,d.measureText)(e.slice(0,r+1),t,i).width>s),0,e.length));r.push(e.slice(0,o)),e=e.slice(o)}return r}function S(e,t,i,s=!0,r){r=(0,h.isString)(r)?parseInt(r):r;const n=(e+="").split(/\r\n|\r|\n|$/).map((e=>({text:e,hidden:!1,wrappedLinePart:!1,wrappedLineEnd:!1})));if(!(0,h.isNumber)(r)||!isFinite(r)||r<=0)return n;if((0,d.measureText)("x",t,i).width>r)return n;const o=[];for(let e=0;e<n.length;e++){const a=n[e];if((0,d.measureText)(a.text,t,i).width<=r){o.push(a);continue}const l=v(a.text),c=!0;let h="",u=0;for(;u<l.length;){const e=l[u];let n=`${h}${e.word}`,a=(0,d.measureText)(n,t,i).width;if(a>r){if(""!==h)o.push({text:h,hidden:!1,wrappedLinePart:c,wrappedLineEnd:!1}),h="";else if(1===n.length)o.push({text:n,hidden:!1,wrappedLinePart:c,wrappedLineEnd:!0}),e.word="";else{const s=y(n,t,i,r);for(let e=0;e<s.length-1;e+=1)o.push({text:s[e],hidden:!1,wrappedLinePart:c,wrappedLineEnd:!1});e.word=s[s.length-1]}continue}let p=n.length;if(n=`${h}${e.word}${e.spaces}`,a=(0,d.measureText)(n,t,i).width,a<r){h=n,u+=1;continue}const _=y(n,t,i,r);for(let e=0;e<_.length;e+=1){const t=_[e];p-=t.length;const i={text:t,hidden:e>0,wrappedLinePart:c,wrappedLineEnd:u===l.length-1&&e===_.length-1};i.hidden&&s||o.push(i)}h="",u+=1}""!==h&&o.push({text:h,wrappedLinePart:c,hidden:!1,wrappedLineEnd:!0})}return o}function b(e,t,i){if(0===i)return e.clone();const r=(e.x-t.x)*Math.cos(i)-(e.y-t.y)*Math.sin(i)+t.x,n=(e.x-t.x)*Math.sin(i)+(e.y-t.y)*Math.cos(i)+t.y;return new s.Point(r,n)}function w(e,t){var i,s,r;const n=null===(i=e.decorator)||void 0===i?void 0:i.geometry(e),o=Math.round(t+T(e)+I(e)+(null!==(s=null==n?void 0:n.width)&&void 0!==s?s:0)+(0===e.text.length?0:null!==(r=null==n?void 0:n.decoratorAndTextMargin)&&void 0!==r?r:0));return o%2?o+1:o}function C(e,t){return A(e)*t+M(e)*(t-1)+2*P(e)}function P(e){
return void 0!==e.boxPaddingVert?e.boxPaddingVert*k(e):void 0!==e.boxPadding?e.boxPadding*k(e):A(e)/3}function x(e){return void 0!==e.boxPaddingHorz?e.boxPaddingHorz*k(e):void 0!==e.boxPadding?e.boxPadding*k(e):A(e)/3}function T(e){return void 0!==e.boxPaddingLeft?e.boxPaddingLeft*k(e):x(e)}function I(e){return void 0!==e.boxPaddingRight?e.boxPaddingRight*k(e):x(e)}function M(e){return(e.padding||0)*k(e)}function A(e){return Math.ceil(L(e)*k(e))}function L(e){return e.fontsize||e.fontSize||30}function k(e){const t=Math.min(1,Math.max(.2,Math.min(e.scaleX||1,e.scaleY||1)));if(1===t)return t;const i=L(e);return Math.ceil(t*i)/i}class D{constructor(e,t){this._data=null,this._textWidthCache=new _.TextWidthCache,this._internalData=null,this._boxSize=null,this._polygonPoints=null,this._linesInfo=null,this._fontInfo=null,this._centerTextRotationPoint=null,this._rotationPoint=null,this._hitTest=t||new a.HitTestResult(a.HitTarget.MovePoint,{areaName:a.AreaName.Text}),void 0!==e&&this.setData(e)}setHitTest(e){this._hitTest=e}data(){return this._data}updateData(e){this.setData({...(0,r.ensureNotNull)(this._data),...e})}setData(e){null!==e?((0,r.assert)(!e.decorator||void 0===e.wordWrapWidth,"Decorator is not supported with wordWrapWidth"),void 0===e.text&&(e.text=""),e.horzTextAlign||(e.horzTextAlign=e.horzAlign),!function(e,t){if(null===e||null===t)return null===e==(null===t);if(void 0===e.points!=(void 0===t.points))return!1;if(void 0!==e.points&&void 0!==t.points){if(e.points.length!==t.points.length)return!1;for(let r=0;r<e.points.length;++r)if(i=e.points[r],s=t.points[r],i.x!==s.x||i.y!==s.y)return!1}var i,s;return e.text===t.text&&e.decorator===t.decorator&&e.vertAlign===t.vertAlign&&e.horzAlign===t.horzAlign&&e.horzTextAlign===t.horzTextAlign&&e.font===t.font&&e.offsetX===t.offsetX&&e.offsetY===t.offsetY&&e.bold===t.bold&&e.italic===t.italic&&e.fontsize===t.fontsize&&e.fontSize===t.fontSize&&e.backgroundRoundRect===t.backgroundRoundRect&&e.forceTextAlign===t.forceTextAlign&&e.wordWrapWidth===t.wordWrapWidth&&e.forceCalculateMaxLineWidth===t.forceCalculateMaxLineWidth&&e.padding===t.padding&&e.scaleY===t.scaleY&&e.scaleX===t.scaleX&&e.highlightBorder===t.highlightBorder&&e.boxPadding===t.boxPadding&&e.boxPaddingVert===t.boxPaddingVert&&e.boxPaddingLeft===t.boxPaddingLeft&&e.boxPaddingRight===t.boxPaddingRight&&e.boxPaddingHorz===t.boxPaddingHorz&&e.angle===t.angle&&e.maxHeight===t.maxHeight&&(0,h.deepEquals)(e.boxShadow,t.boxShadow)[0]}(this._data,e)?(this._data=e,this._internalData=null,this._boxSize=null,this._polygonPoints=null,this._centerTextRotationPoint=null,this._rotationPoint=null,this._linesInfo=null,this._fontInfo=null):this._data=e):this._data=null}hitTest(e){return null===this._data||void 0===this._data.points||0===this._data.points.length?null:(0,n.pointInPolygon)(e,this.getPolygonPoints())?this._hitTest:null}doesIntersectWithBox(e){return null!==this._data&&void 0!==this._data.points&&0!==this._data.points.length&&(0,n.pointInBox)(this._data.points[0],e)}measure(){if(null===this._data)return{width:0,
height:0};const e=this._getBoxSize();return{width:e.boxWidth,height:e.boxHeight}}rect(){if(null===this._data)return{x:0,y:0,width:0,height:0};const e=this._getInternalData();return{x:e.boxLeft,y:e.boxTop,width:e.boxWidth,height:e.boxHeight}}isOutOfScreen(e,t){if(null===this._data||void 0===this._data.points||0===this._data.points.length)return!0;const i=this._getInternalData();if(i.boxLeft+i.boxWidth<0||i.boxLeft>e){const i=(0,s.box)(new s.Point(0,0),new s.Point(e,t));return this.getPolygonPoints().every((e=>!(0,n.pointInBox)(e,i)))}return!1}setPoints(e,t){(0,r.ensureNotNull)(this._data).points=e,this._hitTest=t||new a.HitTestResult(a.HitTarget.MovePoint)}setPoint(e,t,i){const s=(0,r.ensureNotNull)(this._data);this.setData({...s,points:[e],offsetX:null!=t?t:s.offsetX,offsetY:null!=i?i:s.offsetY})}point(){var e,t,i;return null!==(i=null===(t=null===(e=this._data)||void 0===e?void 0:e.points)||void 0===t?void 0:t[0])&&void 0!==i?i:null}fontStyle(e){return null===this._data?"":this._getFontInfo().fontStyle}lineHeight(){return null===this._data?0:A(this._data)}lineSpacing(){return null===this._data?0:M(this._data)}draw(e,t){var i;if(null===this._data||void 0===this._data.points||0===this._data.points.length)return;const{mediaSize:n,horizontalPixelRatio:o,verticalPixelRatio:a}=t;if(this.isOutOfScreen(n.width,n.height))return;const c=this._getInternalData(),h=(0,r.ensureNotNull)(this.rotation()),p=(0,s.point)(h.x*o,h.y*a);e.save(),0!==h.angle&&(e.translate(p.x,p.y),e.rotate(h.angle),e.translate(-p.x,-p.y));const _=this._getFontInfo().fontSize;e.textBaseline=c.textBaseLine,e.textAlign=c.textAlign,e.font=this.fontStyle();const{scaledLeft:m,scaledRight:g,scaledTop:f,scaledBottom:v}=function(e,t){const{horizontalPixelRatio:i,verticalPixelRatio:s}=t,r=Math.round(e.boxLeft*i),n=Math.round(e.boxTop*s);return{scaledLeft:r,scaledRight:r+Math.round(e.boxWidth*i),scaledTop:n,scaledBottom:n+Math.round(e.boxHeight*s)}}(c,t);if(this._data.backgroundColor||this._data.borderColor||this._data.highlightBorder&&this._data.wordWrapWidth){const t=this._data.borderWidth||Math.max(_/12,1),i=Math.round(t*o),s=i/2;let r=!1;if(this._data.boxShadow){e.save();const{shadowColor:t,shadowBlur:i,shadowOffsetX:s=0,shadowOffsetY:n=0}=this._data.boxShadow;e.shadowColor=t,e.shadowBlur=i,e.shadowOffsetX=s,e.shadowOffsetY=n,r=!0}if(this._data.backgroundRoundRect)this._data.backgroundColor&&((0,l.drawRoundRect)(e,m,f,g-m,v-f,this._data.backgroundRoundRect*o),e.fillStyle=this._data.backgroundColor,e.fill(),r&&(e.restore(),r=!1)),this._data.borderColor&&((0,l.drawRoundRect)(e,m-s,f-s,g-m+i,v-f+i,this._data.backgroundRoundRect*o+i),e.strokeStyle=this._data.borderColor,e.lineWidth=i,e.stroke(),r&&(e.restore(),r=!1));else if(this._data.backgroundColor&&(e.fillStyle=this._data.backgroundColor,e.fillRect(m,f,g-m,v-f),r&&(e.restore(),r=!1)),this._data.borderColor||this._data.highlightBorder){let t;this._data.borderColor?(e.strokeStyle=this._data.borderColor,t=i):(e.strokeStyle=this._data.highlightBorderColor||this._data.color,(0,l.setLineStyle)(e,u.LINESTYLE_DASHED),
t=Math.max(1,Math.floor(o))),e.lineWidth=t,e.beginPath(),e.moveTo(m-t/2,f-t/2),e.lineTo(m-t/2,v+t/2),e.lineTo(g+t/2,v+t/2),e.lineTo(g+t/2,f-t/2),e.lineTo(m-t/2,f-t/2),e.stroke(),r&&e.restore()}}this._drawSelectionIfNeeded(e,t),e.fillStyle=this._data.color;const y=(m+Math.round(c.textHorizStart*o))/o,S=.05*_;let b=(f+Math.round((c.textVertStart+S)*a))/a;const w=M(this._data),C=this.getLinesInfo();for(const t of C.lines)(0,d.drawScaled)(e,o,a,(()=>e.fillText(t.text,y,b))),b+=_+w;null===(i=this._data.decorator)||void 0===i||i.draw(e,t,this._data,c),e.restore()}getPolygonPoints(){if(null!==this._polygonPoints)return this._polygonPoints;if(null===this._data)return[];const e=this._data.angle||0,{boxLeft:t,boxTop:i,boxWidth:r,boxHeight:n}=this._getInternalData(),o=this._getRotationPoint();return this._polygonPoints=[b(new s.Point(t,i),o,e),b(new s.Point(t+r,i),o,e),b(new s.Point(t+r,i+n),o,e),b(new s.Point(t,i+n),o,e)],this._polygonPoints}centerTextRotation(){var e;if(null===this._centerTextRotationPoint&&null!==this._data){const t=null!==(e=this._data.angle)&&void 0!==e?e:0,i=this._getRotationPoint(),{textLeft:r,textTop:n,textRight:o,textBottom:a}=this._getInternalData(),l=b(new s.Point((r+o)/2,(n+a)/2),i,t);this._centerTextRotationPoint={x:l.x,y:l.y,angle:t}}return this._centerTextRotationPoint}rotation(){var e;if(null===this._rotationPoint&&null!==this._data){const t=null!==(e=this._data.angle)&&void 0!==e?e:0,i=this._getRotationPoint();this._rotationPoint={x:i.x,y:i.y,angle:t}}return this._rotationPoint}getLinesInfo(){if(null===this._linesInfo){const e=(0,r.ensureNotNull)(this._data),t=S(e.text,this.fontStyle(),this._textWidthCache,!1,e.wordWrapWidth);let i=t.filter((e=>!e.hidden));if(void 0!==e.maxHeight){const t=function(e){const t=(0,r.ensureDefined)(e.maxHeight),i=A(e),s=M(e);return Math.floor((t+s)/(i+s))}(e);i.length>t&&(i=i.slice(0,t))}this._linesInfo={linesMaxWidth:this._getLinesMaxWidth(i),linesIncludingHidden:t,lines:i}}return this._linesInfo}positionToCoordinate(e){const t=(0,r.ensureNotNull)(this._data),i=this._getInternalData(),s=this.getLinesInfo(),{x:n,y:o,lineNumber:a}=(0,c.getSymbolCoordinatesInfo)({symbolPosition:e,textWidth:i.textRight-i.textLeft,textByLines:s.linesIncludingHidden,lineHeight:A(t),font:this.fontStyle(),textAlign:i.textAlign,lineSpacing:this.lineSpacing()});return{x:n+i.textLeft,y:o+i.textTop,lineNumber:a}}_getInternalData(){var e,t,i;if(null!==this._internalData)return this._internalData;const s=(0,r.ensureNotNull)(this._data),n=this._getBoxSize(),a=n.boxWidth,l=n.boxHeight,c=(0,r.ensureDefined)(s.points)[0];let h=c.y;switch(s.vertAlign){case"bottom":h-=l+s.offsetY;break;case"middle":h-=l/2;break;case"top":h+=s.offsetY}let d=c.x;const u=T(s),p=I(s),_=P(s),m=null===(e=s.decorator)||void 0===e?void 0:e.geometry(s),g=null!==(t=null==m?void 0:m.width)&&void 0!==t?t:0,f=0===s.text.length?0:null!==(i=null==m?void 0:m.decoratorAndTextMargin)&&void 0!==i?i:0,v=null==m?void 0:m.ignoreRtl,y=g+f;let S;const b=h+_+A(s)/2;let w;switch(s.horzAlign){case"left":d+=s.offsetX;break;case"center":d-=a/2
;break;case"right":d-=a+s.offsetX}const C=(0,o.isRtl)(),x=C&&!v,M=x?d+a-p-g:d+u;switch((0,r.ensureDefined)(s.horzTextAlign)){case"left":w="start",S=M+y,C&&(s.forceTextAlign?w="left":(S=x?M-f:d+a-p,w="right"));break;case"center":w="center";const e=a-u-p-y;S=x?M-f-e/2:M+y+e/2;break;case"right":w="end",S=x?M-f:d+a-p,C&&s.forceTextAlign&&(w="right")}return this._internalData={boxLeft:d,boxTop:h,boxWidth:a,boxHeight:l,textLeft:d+u+(x?0:y),textRight:d+a-p-(x?y:0),textTop:h+_,textBottom:h+l-_,textHorizStart:S-d,textVertStart:b-h,textAlign:w,textBaseLine:"middle",decoratorLeft:M,decoratorWidth:g},this._internalData}_getFontInfo(){if(null===this._fontInfo){const e=(0,r.ensureNotNull)(this._data),t=A(e),i=(e.bold?"bold ":"")+(e.italic?"italic ":"")+t+"px "+e.font;this._fontInfo={fontStyle:i,fontSize:t}}return this._fontInfo}_drawSelectionIfNeeded(e,t){const i=(0,r.ensureNotNull)(this._data),s=A((0,r.ensureNotNull)(this._data));if(i.selectionHighlight){const r=this.positionToCoordinate(i.selectionHighlight.start),n=this.positionToCoordinate(i.selectionHighlight.end),o=this._getInternalData();(0,c.drawSelection)(e,t,{lines:this.getLinesInfo().linesIncludingHidden,selectionStart:r,selectionEnd:n,left:o.textLeft,right:o.textRight,color:i.selectionHighlight.color,font:this.fontStyle(),lineHeight:s,lineSpacing:this.lineSpacing()})}}_getLinesMaxWidth(e){const t=this.fontStyle();if(null!==this._data&&this._data.wordWrapWidth&&!this._data.forceCalculateMaxLineWidth)return this._data.wordWrapWidth*k(this._data);let i=0;for(const s of e)i=Math.max(i,(0,d.measureText)(s.text,t,this._textWidthCache).width);return i}_getBoxSize(){if(null===this._boxSize){const e=this.getLinesInfo(),t=(0,r.ensureNotNull)(this._data);this._boxSize={boxWidth:w(t,e.linesMaxWidth),boxHeight:C(t,e.lines.length)}}return this._boxSize}_getRotationPoint(){const{boxLeft:e,boxTop:t,boxWidth:i,boxHeight:n}=this._getInternalData(),{horzAlign:o,vertAlign:a}=(0,r.ensureNotNull)(this._data);let l,c;switch(o){case"center":l=e+i/2;break;case"left":l=e;break;case"right":l=e+i}switch(a){case"middle":c=t+n/2;break;case"top":c=t;break;case"bottom":c=t+n}return new s.Point(l,c)}}},91046:(e,t,i)=>{"use strict";i.d(t,{TrendLineRenderer:()=>p,drawArrow:()=>u});var s=i(50151),r=i(4652),n=i(49857),o=i(56468),a=i(37743),l=i(61993),c=i(7114),h=i(51056);function d(e,t,i,s,r){t.save(),t.fillStyle="#000000",t.beginPath(),t.arc(e.x*r,e.y*r,i*r,0,2*Math.PI,!1),t.fill(),s.strokeWidth&&(t.lineWidth=s.strokeWidth,t.stroke()),t.restore()}function u(e,t,i,s,r,n=!1){if(t.subtract(e).length()<1)return;const o=(0,l.getArrowPoints)(e,t,s,n,!0).slice(0,2);let a=null;const{horizontalPixelRatio:c,verticalPixelRatio:h}=r;for(let e=0;e<o.length;++e){const t=o[e][0],s=o[e][1];(null===a||a.subtract(t).length()>1)&&i.moveTo(t.x*c,t.y*h),i.lineTo(s.x*c,s.y*h),a=s}}class p{constructor(){this._data=null,this._hittest=new o.HitTestResult(o.HitTarget.MovePoint)}setData(e){this._data=e}setHitTest(e){this._hittest=e}draw(e,t){const i=this._data;if(null===i)return;if("points"in i&&i.points.length<2)return
;const{horizontalPixelRatio:s}=t;if(void 0!==i.excludeBoundaries){e.save();for(const s of i.excludeBoundaries)(0,c.addExclusionArea)(e,t,s)}const{linestyle:r,lineCap:n=(r===h.LINESTYLE_SOLID?"round":"butt")}=i;e.lineCap=n,e.lineJoin="round",e.strokeStyle=i.color,e.lineWidth=Math.max(1,Math.floor(i.linewidth*s)),(0,a.setLineStyle)(e,r);const o=i.points[0],l=i.points[1];let d=[];e.beginPath(),i.overlayLineEndings?d=[o.clone(),l.clone()]:this._drawEnds(e,[o,l],i.linewidth,t);const u=this._extendAndClipLineSegment(o,l,t);null!==u&&i.linewidth>0&&(0,a.addPixelPerfectLineToPath)(e,u[0].x,u[0].y,u[1].x,u[1].y,t),i.overlayLineEndings&&this._drawEnds(e,d,i.linewidth,t),e.stroke(),void 0!==i.excludeBoundaries&&e.restore()}hitTest(e,t){var i;const s=this._data;if(null===s)return null;if("points"in s&&s.points.length<2)return null;const n=(null!==(i=s.hitTestTolerance)&&void 0!==i?i:(0,l.interactionTolerance)().line)+s.linewidth/2,o=s.points[0],a=s.points[1],c=this._extendAndClipLineSegment(o,a,t);if(null!==c){if((0,r.distanceToSegment)(c[0],c[1],e).distance<=n)return this._hittest}return null}_extendAndClipLineSegment(e,t,i){const r=(0,s.ensureNotNull)(this._data);return(0,l.extendAndClipLineSegment)(e,t,i.mediaSize.width,i.mediaSize.height,r.extendleft,r.extendright)}_drawEnds(e,t,i,r){const o=t[0],a=t[1],l=(0,s.ensureNotNull)(this._data);switch(l.leftend){case n.LineEnd.Arrow:u(a,o,e,i,r);break;case n.LineEnd.Circle:d(o,e,i,(0,s.ensureDefined)(l.endstyle),r.horizontalPixelRatio)}switch(l.rightend){case n.LineEnd.Arrow:u(o,a,e,i,r);break;case n.LineEnd.Circle:d(a,e,i,(0,s.ensureDefined)(l.endstyle),r.horizontalPixelRatio)}}}},95173:(e,t,i)=>{"use strict";i.d(t,{VerticalLineRenderer:()=>l});var s=i(56468),r=i(37743),n=i(61993),o=i(7114),a=i(30125);class l extends a.BitmapCoordinatesPaneRenderer{constructor(){super(...arguments),this._data=null,this._hitTest=new s.HitTestResult(s.HitTarget.MovePoint)}setData(e){this._data=e}setHitTest(e){this._hitTest=e}hitTest(e){if(null===this._data||null===this._hitTest)return null;const t=(0,n.interactionTolerance)().line,i=Math.abs(e.x-this._data.x)<=t+this._data.linewidth/2,s=void 0===this._data.top||this._data.top-e.y<=t,r=void 0===this._data.bottom||e.y-this._data.bottom<=t;return i&&s&&r?this._hitTest:null}_drawImpl(e){if(null===this._data||this._data.linewidth<=0)return;const{context:t,horizontalPixelRatio:i,verticalPixelRatio:s,mediaSize:n}=e;if(this._data.x<-this._data.linewidth/2||this._data.x>n.width+this._data.linewidth/2)return;t.lineCap="butt",t.strokeStyle=this._data.color,t.lineWidth=Math.max(1,Math.floor(this._data.linewidth*i)),void 0!==this._data.linestyle&&(0,r.setLineStyle)(t,this._data.linestyle);const a=void 0!==this._data.top?Math.max(this._data.top,0):0,l=void 0!==this._data.bottom?Math.min(this._data.bottom,n.height):n.height,c=Math.round(this._data.x*i),h=Math.floor(a*s),d=Math.ceil(l*s),u=this._data.excludeBoundaries;void 0!==u&&(0,o.addExclusionAreaByScope)(e,u),(0,r.drawVerticalLine)(t,c,h,d)}}},2718:(e,t,i)=>{"use strict";i.d(t,{sortSources:()=>r,
sortSourcesPreOrdered:()=>s});const s={LatestUpdates:10000001,BarMarks:10000002,TimeScaleMarks:10000003,ChartEventsSource:10000004,Dividends:10000005,Splits:10000006,Earnings:10000007,RollDates:10000008,FutureContractExpiration:10000009,LineToolOrder:10000010,LineToolPosition:10000011,LineToolExecution:10000012,AlertLabelInactive:10000013,AlertLabel:10000014};function r(e,t){if(0===e.length)return[];if(!t)return[...e].sort(((e,t)=>e.zorder()-t.zorder()));if(!(t.model().mainPane()===t))return[...e].sort(((e,t)=>e.zorder()-t.zorder()));const i=t.model().panes(),s=i.indexOf(t),r=e=>i.findIndex((t=>t.hasDataSource(e)));return e.map((e=>{const i=!t.hasDataSource(e);return{source:e,isMultipane:i,aboveSeries:e.zorder()>t.model().mainSeries().zorder(),paneIndex:i?r(e):s}})).sort(((e,t)=>e.isMultipane||t.isMultipane?e.isMultipane&&!t.isMultipane?t.aboveSeries?-1:1:!e.isMultipane&&t.isMultipane?e.aboveSeries?1:-1:e.paneIndex-t.paneIndex:e.source.zorder()-t.source.zorder())).map((e=>e.source))}},64755:(e,t,i)=>{"use strict";i.d(t,{PlotList:()=>u,mergeMinMax:()=>p});var s=i(50151),r=i(29981),n=i(50503),o=i(31955),a=i(8025);const l=(0,o.getLogger)("Chart.PlotList"),c=30;function h(e){return e.index}function d(e){return e.value[0]}class u{constructor(e=null,t=null){this._items=[],this._start=0,this._end=0,this._shareRead=!1,this._minMaxCache=new Map,this._rowSearchCacheByIndex=new Map,this._rowSearchCacheByIndexWithoutEmptyValues=new Map,this._rowSearchCacheByTime=new Map,this._rowSearchCacheByTimeWithoutEmptyValues=new Map,this._plotFunctions=e||new Map,this._emptyValuePredicate=t}clear(){this._items=[],this._start=0,this._end=0,this._shareRead=!1,this._minMaxCache.clear(),this._invalidateSearchCaches()}first(){return this.size()>0?this._items[this._start]:null}last(){return this.size()>0?this._items[this._end-1]:null}firstIndex(){return this.size()>0?this._indexAt(this._start):null}lastIndex(){return this.size()>0?this._indexAt(this._end-1):null}clone(){const e=this.firstIndex(),t=this.lastIndex();return null===e||null===t?new u:this.range(e,t)}size(){return this._end-this._start}isEmpty(){return 0===this.size()}contains(e){return null!==this.search(e,a.PlotRowSearchMode.Exact)}valueAt(e){const t=this.search(e);return null!==t?t.value:null}add(e,t){if(this._shareRead)return l.logDebug("add: readonly collection modification attempt"),!1;const i={index:e,value:t},s=this._nonCachedSearch(e,a.PlotRowSearchMode.Exact,h);return this._invalidateSearchCaches(),null===s?(this._items.splice(this._lowerbound(e,h),0,i),this._start=0,this._end=this._items.length,!0):(this._items[s]=i,!1)}search(e,t=a.PlotRowSearchMode.Exact,i){return this._searchImpl(e,t,this._rowSearchCacheByIndex,this._rowSearchCacheByIndexWithoutEmptyValues,h,i)}searchByTime(e,t=a.PlotRowSearchMode.Exact,i){return this._searchImpl(e,t,this._rowSearchCacheByTime,this._rowSearchCacheByTimeWithoutEmptyValues,d,i)}fold(e,t){let i=t;for(let t=this._start;t<this._end;++t){i=e(this._indexAt(t),this._valueAt(t),i)}return i}findFirst(e,t){
const i=void 0!==t&&Math.min(this._start+t,this._end)||this._end;for(let t=this._start;t<i;++t){const i=this._indexAt(t),s=this._valueAt(t);if(e(i,s))return{index:i,value:s}}return null}findLast(e,t){const i=void 0!==t&&Math.max(this._end-t,this._start)||this._start;for(let t=this._end-1;t>=i;--t){const i=this._indexAt(t),s=this._valueAt(t);if(e(i,s))return{index:i,value:s}}return null}each(e){for(let t=this._start;t<this._end;++t){if(e(this._indexAt(t),this._valueAt(t)))break}}reduce(e,t){let i=t;for(let t=this._start;t<this._end;++t){i=e(i,this._indexAt(t),this._valueAt(t))}return i}range(e,t){const i=new u(this._plotFunctions,this._emptyValuePredicate);return i._items=this._items,i._start=this._lowerbound(e,h),i._end=this._upperbound(t),i._shareRead=!0,i}plottableRange(e){const t=new u(this._plotFunctions,this._emptyValuePredicate);return t._items=this._items,t._start=this._upperbound(n.UNPLOTTABLE_TIME_POINT_INDEX),t._end=this._end,t._shareRead=!0,!0===e&&t._start>this._start&&(t._start-=1),t}rangeCountback(e,t){if(null===this.firstIndex())return new u;const i=new u(this._plotFunctions,this._emptyValuePredicate);return i._items=this._items,i._end=this._upperbound(e),i._start=Math.max(this._start,i._end-t),i._shareRead=!0,i}rangeIterator(e,t){const i=this._lowerbound(e,h),s=this._upperbound(t);return this._rangeIteratorImpl(i,s)}fullRangeIterator(){return this._rangeIteratorImpl(this._start,this._end)}minMaxOnRangeCached(e,t,i){if(this.isEmpty())return null;let s=null;for(const r of i){s=p(s,this._minMaxOnRangeCachedImpl(e-r.offset,t-r.offset,r.name))}return s}minMaxOnRange(e,t,i){if(this.isEmpty())return null;let s=null;for(const r of i){s=p(s,this._minMaxOnRange(e-r.offset,t-r.offset,r.name))}return s}merge(e){return this._shareRead?(l.logDebug("merge: readonly collection modification attempt"),null):0===e.length?null:this.isEmpty()||e[e.length-1].index<this._items[0].index?this._prepend(e):e[0].index>this._items[this._items.length-1].index?this._append(e):1===e.length&&e[0].index===this._items[this._items.length-1].index?(this._updateLast(e[0]),e[0]):this._merge(e)}addTail(e,t=!1){if(0===e.length)return;let i=0;t&&this._end-this._start>0&&(i=1,this._items[this._end-this._start-1].value=e[0].value);for(let t=i;t<e.length;++t){const i=e[t],s=this.lastIndex();if(null===s){l.logError("Can't add tail to the empty plotlist");break}this.add(s+1,i.value)}this._invalidateSearchCaches()}move(e){if(this._shareRead)return void l.logDebug("move: readonly collection modification attempt");if(0===e.length)return;const t=this._items.slice();for(const i of e){const e=this._bsearch(i.old,h);if(null!==e&&void 0!==t[e])if(i.new===n.INVALID_TIME_POINT_INDEX)t[e]=void 0;else{t[e]={index:i.new,value:t[e].value};const s=this._bsearch(i.new,h);if(null!==s){const e=t[s];void 0!==e&&e.index===i.new&&(t[s]=void 0)}}}this._items=t.filter((e=>void 0!==e)).sort(((e,t)=>e.index-t.index)),this._invalidateSearchCaches(),this._minMaxCache.clear(),this._start=0,this._end=this._items.length}remove(e){
if(this._shareRead)return l.logDebug("remove: readonly collection modification attempt"),null;const t=this._nonCachedSearch(e,a.PlotRowSearchMode.NearestRight,h);if(null===t)return null;const i=this._items.splice(t);return this._end=this._items.length,this._minMaxCache.clear(),this._invalidateSearchCaches(),i.length>0?i[0]:null}state(){const e=this._items.slice(this._start,this._end);return{start:0,end:e.length,data:e}}restoreState(e){e?(this._start=e.start,this._end=e.end,this._shareRead=!1,this._items=e.data,this._minMaxCache.clear(),this._invalidateSearchCaches()):this.clear()}_indexAt(e){return this._items[e].index}_valueAt(e){return this._items[e].value}_length(){return this._items.length}_searchImpl(e,t,i,s,r,n){const o=void 0!==n?i:s,a=void 0!==n?1e4*(t+1)+n:t;let l=o.get(e);if(void 0!==l){const e=l.get(a);if(void 0!==e)return e}const c=this._nonCachedSearch(e,t,r,n);if(null===c)return null;const h={index:this._indexAt(c),value:this._valueAt(c)};return void 0===l&&(l=new Map,o.set(e,l)),l.set(a,h),h}_nonCachedSearch(e,t,i,s){const r=this._lowerbound(e,i),n=r===this._end||e!==i(this._items[r]);if(n&&t!==a.PlotRowSearchMode.Exact)switch(t){case a.PlotRowSearchMode.NearestLeft:return this._searchNearestLeft(r,s);case a.PlotRowSearchMode.NearestRight:return this._searchNearestRight(r,s);default:throw new TypeError("Unknown search mode")}if(void 0===s||n||t===a.PlotRowSearchMode.Exact)return n?null:r;switch(t){case a.PlotRowSearchMode.NearestLeft:return this._nonEmptyNearestLeft(r,s);case a.PlotRowSearchMode.NearestRight:return this._nonEmptyNearestRight(r,s);default:throw new TypeError("Unknown search mode")}}_nonEmptyNearestRight(e,t){const i=(0,s.ensure)(this._emptyValuePredicate),r=(0,s.ensure)(t);for(;e<this._end&&i(this._valueAt(e),r);)e+=1;return e===this._end?null:e}_nonEmptyNearestLeft(e,t){const i=(0,s.ensureNotNull)(this._emptyValuePredicate),r=(0,s.ensure)(t);for(;e>=this._start&&i(this._valueAt(e),r);)e-=1;return e<this._start?null:e}_searchNearestLeft(e,t){if(e===this._start)return null;const i=e-1,s=i!==this._end?i:null;return void 0!==t&&null!==s?this._nonEmptyNearestLeft(s,t):s}_searchNearestRight(e,t){const i=e,s=i!==this._end?i:null;return void 0!==t&&null!==s?this._nonEmptyNearestRight(s,t):s}_bsearch(e,t){const i=this._lowerbound(e,t);return i!==this._end&&e===t(this._items[i])?i:null}_lowerbound(e,t){return(0,r.lowerbound)(this._items,e,((e,i)=>t(e)<i),this._start,this._end)}_upperbound(e){return(0,r.upperbound)(this._items,e,((e,t)=>t.index>e),this._start,this._end)}_plotMinMax(e,t,i){let s=null;const r=this._plotFunctions.get(i);if(void 0===r)throw new Error(`Plot "${i}" is not registered`);for(let i=e;i<t;i++){const e=r(this._items[i].value);null==e||Number.isNaN(e)||(null===s?s={min:e,max:e}:(e<s.min&&(s.min=e),e>s.max&&(s.max=e)))}return s}_invalidateCacheForRow(e){const t=Math.floor(e.index/c);this._minMaxCache.forEach((e=>e.delete(t)))}_prepend(e){return(0,s.assert)(!this._shareRead,"collection should not be readonly"),(0,s.assert)(0!==e.length,"plotRows should not be empty"),
this._invalidateSearchCaches(),this._minMaxCache.clear(),this._items=e.concat(this._items),this._start=0,this._end=this._items.length,e[0]}_append(e){return(0,s.assert)(!this._shareRead,"collection should not be readonly"),(0,s.assert)(0!==e.length,"plotRows should not be empty"),this._invalidateSearchCaches(),this._minMaxCache.clear(),this._items=this._items.concat(e),this._start=0,this._end=this._items.length,e[0]}_updateLast(e){(0,s.assert)(!this.isEmpty(),"plot list should not be empty");const t=this._items[this._end-1];(0,s.assert)(t.index===e.index,"last row index should match new row index"),this._invalidateCacheForRow(e),this._invalidateSearchCaches(),this._items[this._end-1]=e}_merge(e){return(0,s.assert)(0!==e.length,"plot rows should not be empty"),this._invalidateSearchCaches(),this._minMaxCache.clear(),this._items=function(e,t){const i=function(e,t){const i=e.length,s=t.length;let r=i+s,n=0,o=0;for(;n<i&&o<s;)e[n].index<t[o].index?n++:e[n].index>t[o].index?o++:(n++,o++,r--);return r}(e,t),s=new Array(i);let r=0,n=0;const o=e.length,a=t.length;let l=0;for(;r<o&&n<a;)e[r].index<t[n].index?(s[l]=e[r],r++):e[r].index>t[n].index?(s[l]=t[n],n++):(s[l]=t[n],r++,n++),l++;for(;r<o;)s[l]=e[r],r++,l++;for(;n<a;)s[l]=t[n],n++,l++;return s}(this._items,e),this._start=0,this._end=this._items.length,e[0]}_minMaxOnRangeCachedImpl(e,t,i){if(this.isEmpty())return null;let r=null;const n=(0,s.ensureNotNull)(this.firstIndex()),o=(0,s.ensureNotNull)(this.lastIndex()),a=Math.max(e,n),l=Math.min(t,o),h=Math.ceil(a/c)*c,d=Math.max(h,Math.floor(l/c)*c);r=p(r,this._minMaxOnRange(a,Math.min(h,t,l),i));let u=this._minMaxCache.get(i);void 0===u&&(u=new Map,this._minMaxCache.set(i,u));for(let e=Math.max(h+1,a);e<d;e+=c){const t=Math.floor(e/c);let s=u.get(t);if(void 0===s){const e=t*c,r=(t+1)*c-1;s=this._minMaxOnRange(e,r,i),u.set(t,s)}r=p(r,s)}r=p(r,this._minMaxOnRange(d,l,i));return r}_minMaxOnRange(e,t,i){return this._plotMinMax(this._lowerbound(e,h),this._upperbound(t),i)}_rangeIteratorImpl(e,t){let i=e-1;return{[Symbol.iterator](){return this},next:()=>(i+=1,i>=t?{done:!0,value:void 0}:{done:!1,value:this._items[i]})}}_invalidateSearchCaches(){this._rowSearchCacheByIndex.clear(),this._rowSearchCacheByIndexWithoutEmptyValues.clear(),this._rowSearchCacheByTime.clear(),this._rowSearchCacheByTimeWithoutEmptyValues.clear()}}function p(e,t){if(null===e)return t;if(null===t)return e;return{min:Math.min(e.min,t.min),max:Math.max(e.max,t.max)}}},98558:(e,t,i)=>{"use strict";i.d(t,{PriceAxisView:()=>p});var s,r=i(86441),n=i(34026),o=i(69186),a=i(63273),l=i(7114),c=i(56468),h=i(37743);!function(e){e[e.HitTestTolerance=0]="HitTestTolerance",e[e.HitTestToleranceTouch=10]="HitTestToleranceTouch",e[e.AdditionalVisibilityTolerance=3]="AdditionalVisibilityTolerance",e[e.IconLabelExistingAlertWidth=12]="IconLabelExistingAlertWidth",e[e.IconLabelExistingAlertHeight=10.73]="IconLabelExistingAlertHeight",e[e.IconLabelExistingAlertHorzMargin=11]="IconLabelExistingAlertHorzMargin"}(s||(s={}));new Path2D("");class d{constructor(e,t){this._bodyBox=null,
this.setData(e,t)}setData(e,t){this._data=e,this._commonData=t}lastDrawnBodyBox(){return this._bodyBox}draw(e,t,i,s,n){var o,c,d,u;const p=this._data,{mediaSize:_,bitmapSize:m,horizontalPixelRatio:g,verticalPixelRatio:f}=t;if(!p.visible||this._isOutOfScreen(i,_.height))return;const v=this._commonData,y=void 0!==p.labelIcon,S=i.borderSize,b=i.paddingTop+v.additionalPaddingTop,w=i.paddingBottom+v.additionalPaddingBottom,C=i.paddingInner,P=p.ignoreAdditionalPaddingInner?0:i.additionalPaddingInner,x=i.paddingOuter,T=i.fontSize;let I=p.text,M=p.textColor||v.textColor,A=p.secondLine||"",L=v.secondLineTextColor||M,k=p.thirdLine||"";const D=v.thirdLineTextColor||M;0===A.length&&(A=k,L=D,k=""),0===I.length&&(I=A,M=L,A=k,L=D,k=""),e.save(),void 0!==v.globalAlpha&&(e.globalAlpha*=v.globalAlpha),e.font=i.font;const E=s.yMidCorrection(e,I)*f,V=Math.ceil(s.measureText(e,I)),B=T+b+w,R=(null!==(o=p.labelIconMinWidth)&&void 0!==o?o:0)*g,N=Boolean(A),O=Boolean(k),F=N?Math.ceil(s.measureText(e,A)):0,W=O?Math.ceil(s.measureText(e,k)):0,H=S+C+x+V+P,z=F>0?S+C+x+F+P:0,U=W>0?S+C+x+W+P:0,j=Math.max(H,z,U),G=Math.max(1,Math.floor(f));let q=Math.round(B*f);q%2!=G%2&&(q+=1);const $=Math.round((T+i.lineSpacing)*f),K=Math.round(2*(T+i.lineSpacing)*f),Y=Math.max(1,Math.floor(S*g)),Z=p.separatorVisible?Y:0,X=p.borderVisible?Y:0,J=y?Math.max(q,R):Math.round(j*g),Q=Math.round(P*g),ee=m.width,te=Math.ceil(C*g),ie=Math.round((null!==(c=v.fixedCoordinate)&&void 0!==c?c:v.coordinate)*f)-Math.floor(.5*f),se=Math.floor(ie+G/2-q/2),re=se+q,ne="right"===n,oe=void 0!==p.xCoord?Math.round(p.xCoord*g)+(ne?1:-1)*Math.round(J/2):ne?ee-Z:Z,ae=ee;let le,ce=oe;const he=null!==(d=p.backgroung)&&void 0!==d?d:v.background;e.fillStyle=he;const de=2*f;if(e.textAlign=ne?"right":"left",e.textBaseline="middle",ne?(ce=oe-J,le=oe-Q-te-1):(ce=oe+J,le=oe+Q+te),this._bodyBox=null,I||y){const t=O?q+K:N?q+$:q,s=null!==(u=v.borderColor)&&void 0!==u?u:he,n=void 0!==p.xCoord?de:0;if(((i,s,o)=>{if(ne){(0,h.drawRoundRectWithInnerBorder)(e,ce,se,J,t,i,p.overridenRadius?(0,h.scaleDrawRoundRectRadii)(p.overridenRadius,f):[de,n,n,de],X,s,o);const a=(0,r.point)(ce/g,se/f),l=a.add((0,r.point)(J/g,t/f));this._bodyBox=(0,r.box)(a,l)}else{(0,h.drawRoundRectWithInnerBorder)(e,oe,se,J,t,i,p.overridenRadius?(0,h.scaleDrawRoundRectRadii)(p.overridenRadius,f):[n,de,de,n],X,s,o);const a=(0,r.point)(oe/g,se/f),l=a.add((0,r.point)(J/g,t/f));this._bodyBox=(0,r.box)(a,l)}})(he,s,v.borderStyle),p.separatorVisible&&(e.fillStyle=i.paneBackgroundColor,e.fillRect(ne?ae-Z:0,se,Z,re-se)),y){if(0===p.labelIcon)this._drawPlusIcon(e,oe,ce,se,ie,re,G);return void e.restore()}e.save(),e.translate(le,(se+re)/2+E),(0,l.drawScaled)(e,g,f,(()=>{e.fillStyle=M,e.fillText(I,0,0)})),e.restore()}N&&(e.fillStyle=L,e.save(),e.translate(le,(se+re)/2+E+$),(0,l.drawScaled)(e,g,f,(()=>{e.fillText((0,a.startWithLTR)(A),0,0)})),e.restore()),O&&(e.fillStyle=D,e.save(),e.translate(le,(se+re)/2+E+K),(0,l.drawScaled)(e,g,f,(()=>{e.fillText((0,a.startWithLTR)(k),0,0)})),e.restore()),e.restore()}topBottomTotalHeight(e){
const t=this._lines();if(!this._data.visible||0===t)return{top:0,bottom:0,total:0};const i=e.fontSize/2+e.paddingTop+this._commonData.additionalPaddingTop,s=(t-.5)*e.fontSize+(t-1)*e.lineSpacing+e.paddingBottom+this._commonData.additionalPaddingBottom;return{top:i,bottom:s,total:i+s}}hitTest(e){return function(e,t){var i;const s=(0,o.lastMouseOrTouchEventInfo)().isTouch?10:0,a=e.hitTestData;if(void 0===a||!e.visible)return null;const{itemBox:l,clickHandler:h,tooltip:d}=a;if(l){const o=(0,r.box)(new r.Point(l.min.x-s,l.min.y-s),new r.Point(l.max.x+s,l.max.y+s));if((0,n.pointInBox)(t,o))return new c.HitTestResult(null!==(i=e.hitTarget)&&void 0!==i?i:c.HitTarget.Custom,{clickHandler:null==h?void 0:h.bind(null,t),tapHandler:null==h?void 0:h.bind(null,t),hoverModelFromAxis:a.hoverModelFromAxis,activeItem:a.activeItem,tooltip:d})}return null}(this._data,e)}_drawPlusIcon(e,t,i,s,r,n,o){e.fillStyle=this._commonData.textColor,e.strokeStyle=this._commonData.textColor,e.lineWidth=o;const a=Math.abs(t-i);let l=Math.round(.35*a);l%2!=o%2&&(l+=1);let c=Math.round(.65*a);c%2!=o%2&&(c+=1);const h=Math.floor((a-l)/2),d=Math.min(t,i),u=d+Math.floor(a/2-o/2);e.fillRect(d+h,r,l,o),e.fillRect(u,s+h,o,l),e.beginPath(),e.arc(u+o/2,r+o/2,c/2,0,2*Math.PI,!1),e.stroke()}_drawClockExistingAlertIcon(e,t,i,s,r,n){}_lines(){const e=this._data;return(e.text?1:0)+(e.secondLine?1:0)+(e.thirdLine?1:0)}_isOutOfScreen(e,t){var i;const s=this._commonData,r=null!==(i=s.fixedCoordinate)&&void 0!==i?i:s.coordinate,{total:n}=this.topBottomTotalHeight(e),o=n/this._lines();return r-o/2-3>t||r+(n-o/2)+3<0}}var u=i(19063);class p{constructor(e){this._commonRendererData={coordinate:0,textColor:"#FFF",background:"#000",additionalPaddingBottom:0,additionalPaddingTop:0},this._axisRendererData={text:"",visible:!1,separatorVisible:!1,borderVisible:!1,ignoreAdditionalPaddingInner:!1},this._paneRendererData={text:"",visible:!1,separatorVisible:!0,borderVisible:!1,ignoreAdditionalPaddingInner:!0},this._invalidated=!0,this._active=!1,this._axisRenderer=new(e||d)(this._axisRendererData,this._commonRendererData),this._paneRenderer=new(e||d)(this._paneRendererData,this._commonRendererData)}setActive(e){this._active=e}text(){return this._updateRendererDataIfNeeded(),this._axisRendererData.text}secondLineText(){return this._updateRendererDataIfNeeded(),this._axisRendererData.secondLine}thirdLineText(){return this._updateRendererDataIfNeeded(),this._axisRendererData.thirdLine}background(){return this._updateRendererDataIfNeeded(),this._commonRendererData.background}color(){return this._updateRendererDataIfNeeded(),this.generateTextColor(this.background())}generateTextColor(e){return(0,u.colorFromBackground)(e)}coordinate(){return this._updateRendererDataIfNeeded(),this._commonRendererData.coordinate}floatCoordinate(){var e;return this._updateRendererDataIfNeeded(),null!==(e=this._commonRendererData.floatCoordinate)&&void 0!==e?e:this._commonRendererData.coordinate}update(e){this._invalidated=!0}topBottomTotalHeight(e){this._updateRendererDataIfNeeded()
;const{top:t,bottom:i,total:s}=this._axisRenderer.topBottomTotalHeight(e),{top:r,bottom:n,total:o}=this._paneRenderer.topBottomTotalHeight(e);return{top:Math.max(t,r),bottom:Math.max(i,n),total:Math.max(s,o)}}getFixedCoordinate(){return this._commonRendererData.fixedCoordinate||0}setFixedCoordinate(e){this._commonRendererData.fixedCoordinate=e}isVisible(){return this._updateRendererDataIfNeeded(),this._axisRendererData.visible||this._paneRendererData.visible}isAxisLabelVisible(){return this._updateRendererDataIfNeeded(),this._axisRendererData.visible}isPaneLabelVisible(){return this._updateRendererDataIfNeeded(),this._paneRendererData.visible}renderer(){return this._updateRendererDataIfNeeded(),this._axisRenderer}paneRenderer(){return this._updateRendererDataIfNeeded(),this._paneRenderer}setPaneRendererLabelIcon(e){this._paneRendererData.labelIcon=e}setPaneLabelVisible(e){this._paneRendererData.visible=e,this._invalidated=!0}ignoreAlignment(){return!1}_updateRendererDataIfNeeded(){this._invalidated&&(this._commonRendererData.fixedCoordinate=void 0,this._updateRendererData(this._axisRendererData,this._paneRendererData,this._commonRendererData),this._invalidated=!1)}}},45579:(e,t,i)=>{"use strict";i.d(t,{PriceDataSource:()=>a,isPriceDataSource:()=>o});var s=i(29137),r=i(52033),n=i(60074);function o(e){return e instanceof a}class a extends s.DataSource{constructor(e,t){super(t),this._formatterChanged=new r.Delegate,this._priceStepChanged=new r.Delegate,this._currencyChanged=new r.Delegate,this._unitChanged=new r.Delegate,this._priceRangeReadyChanged=new r.Delegate,this._priceStep=null,this._priceRangeReady=!0,this._model=e}base(){return 0}model(){return this._model}currencyChanged(){return this._currencyChanged}isCurrencySource(){return!0}isDisplayedInLegend(){return!0}unitChanged(){return this._unitChanged}isUnitSource(){return!0}priceRange(e,t,i){return null}isDraggable(){return!0}priceLineColor(e){return e}formatterChanged(){return this._formatterChanged}priceStep(e){return this._priceStep}priceStepChanged(){return this._priceStepChanged}isIncludedInAutoScale(){return!0}correctScaleMargins(e){return e}priceRangeReady(){return this._priceRangeReady}priceRangeReadyChanged(){return this._priceRangeReadyChanged}disablePriceRangeReady(){const e=this.priceScale();null===e||e.isAutoScale()||e.mainSource()!==this||(this._priceRangeReady=!1,e.recalculatePriceRangeOnce()),this._priceRangeReadyChanged.fire(!1)}statusView(){return null}legendView(){return null}marketStatusModel(){return null}dataUpdatedModeModel(){return null}dataProblemModel(){return null}canHasAlertOnLineTools(){return!0}_enablePriceRangeReady(){this._priceRangeReady=!0,this._priceRangeReadyChanged.fire(!0)}_onSourceCurrencyChanged(){(0,n.isActingAsSymbolSource)(this)||this._currencyChanged.fire()}_onSourceUnitChanged(){(0,n.isActingAsSymbolSource)(this)||this._unitChanged.fire()}_onSourcePriceRangeReadyChanged(e){(0,n.isActingAsSymbolSource)(this)||e||this.disablePriceRangeReady()}}},37626:(e,t,i)=>{"use strict";i.d(t,{PriceLineAxisView:()=>l,
SeriesPriceLineAxisView:()=>c,StudyPriceLineAxisView:()=>h});var s=i(98558),r=i(50151),n=i(51056),o=i(37743);class a{constructor(e,t){this.setData(e,t)}setData(e,t){this._data=e,this._commonData=t}draw(e,t,i,s,a){var l;if(!this._data.visible)return;const{bitmapSize:c,verticalPixelRatio:h}=t,d=null!==(l=this._commonData.fixedCoordinate)&&void 0!==l?l:this._commonData.coordinate;e.lineWidth=Math.max(1,Math.floor((0,r.ensureDefined)(this._data.linewidth)*h)),e.lineCap="butt",(0,o.setLineStyle)(e,void 0===this._data.linestyle?n.LINESTYLE_DOTTED:this._data.linestyle),e.strokeStyle=this._commonData.textColor,(0,o.drawHorizontalLine)(e,Math.round(d*h),0,c.width)}topBottomTotalHeight(e){return{top:0,bottom:0,total:0}}}class l extends s.PriceAxisView{constructor(e){super(e||a)}ignoreAlignment(){return!0}_updateRendererData(e,t,i){if(t.visible=!1,e.visible=!1,!this._isVisible())return;const s=this._value();s.noData||(i.background="",i.textColor=this._priceLineColor(s.color),i.coordinate=s.coordinate,i.floatCoordinate=s.floatCoordinate,e.linewidth=this._lineWidth(),e.linestyle=this._lineStyle(),e.backgroundAreaVisible=this._backgroundAreaVisible(),e.backgroundAreaColor=this._backgroundAreaColor(),e.backgroundAreaHeight=this._backgroundAreaHeight(),e.visible=!0)}_lineStyle(){return n.LINESTYLE_DOTTED}_backgroundAreaVisible(){return!1}_backgroundAreaColor(){return""}_backgroundAreaHeight(){return 0}}class c extends l{constructor(e){super(),this._series=e}_value(){return this._series.lastValueData(void 0,!0)}_priceLineColor(e){return this._series.priceLineColor(e)}_lineWidth(){return this._series.properties().childs().priceLineWidth.value()}_isVisible(){const e=this._series.model().properties().childs().scalesProperties.childs().showSeriesLastValue.value();return this._series.properties().childs().showPriceLine.value()&&e}}class h extends l{constructor(e,t){super(),this._study=e,this._plotname=t}_value(){return this._study.lastValueData(this._plotname,!0)}_lineWidth(){return this._study.properties().childs().styles.childs()[this._plotname].childs().linewidth.value()}_lineStyle(){return n.LINESTYLE_DOTTED}_priceLineColor(e){return e}_isVisible(){const e=this._study.model().properties().childs().scalesProperties.childs().showStudyLastValue.value(),t=this._study.isPlotVisibleAt(this._plotname,1);return this._study.properties().childs().styles.childs()[this._plotname].childs().trackPrice.value()&&e&&t}}},94164:(e,t,i)=>{"use strict";var s;i.d(t,{PriceAxisLastValueMode:()=>s}),function(e){e[e.LastPriceAndPercentageValue=0]="LastPriceAndPercentageValue",e[e.LastValueAccordingToScale=1]="LastValueAccordingToScale"}(s||(s={}))},49256:(e,t,i)=>{"use strict";i.d(t,{fromIndexedTo100:()=>c,fromLog:()=>p,fromPercent:()=>o,getCurrentModePriceText:()=>g,getOppositeModePriceText:()=>f,logFormulaForBase:()=>_,logFormulasAreSame:()=>m,toIndexedTo100:()=>h,toIndexedTo100Range:()=>d,toLog:()=>u,toPercent:()=>a,toPercentRange:()=>l});var s=i(93280),r=i(9859);const n={logicalOffset:4,coordOffset:1e-4};function o(e,t){return t<0&&(e=-e),e/100*t+t}
function a(e,t){const i=100*(e-t)/(t||1);return t<0?-i:i}function l(e,t){const i=a(e.minValue(),t),r=a(e.maxValue(),t);return new s.PriceRange(i,r)}function c(e,t){return t<0&&(e=-e),(e-=100)/100*t+t}function h(e,t){const i=100*(e-t)/t+100;return t<0?-i:i}function d(e,t){const i=h(e.minValue(),t),r=h(e.maxValue(),t);return new s.PriceRange(i,r)}function u(e,t){const i=Math.min(10**305-t.coordOffset,Math.abs(e));if(i<1e-25)return 0;const s=(0,r.log10)(i+t.coordOffset)+t.logicalOffset;return e<0?-s:s}function p(e,t){const i=Math.abs(e);if(i<1e-15)return 0;const s=Math.pow(10,Math.min(i-t.logicalOffset,305))-t.coordOffset;return e<0?-s:s}function _(e){if(null===e)return n;const t=1/e;if(t>=1||t<1e-15)return n;const i=Math.abs(Math.log10(e)),s=n.logicalOffset+i;return{logicalOffset:s,coordOffset:1/Math.pow(10,s)}}function m(e,t){return e.logicalOffset===t.logicalOffset&&e.coordOffset===t.coordOffset}function g(e,t){return e.isPercentage()?t.formattedPricePercentage:e.isIndexedTo100()?t.formattedPriceIndexedTo100:t.formattedPriceAbsolute}function f(e,t){return e.isPercentage()||e.isIndexedTo100()?t.formattedPriceAbsolute:t.formattedPricePercentage}},93280:(e,t,i)=>{"use strict";i.d(t,{PriceRange:()=>n});var s=i(37265);const r=(0,i(31955).getLogger)("Chart.PriceRange");class n{constructor(e,t){if(null!==e&&"object"==typeof e){const t=e;this._minValue=t.m_minValue,this._maxValue=t.m_maxValue}else{const i=e;this._minValue=i,void 0!==t&&(this._maxValue=t)}}equals(e){return this._minValue===e._minValue&&this._maxValue===e._maxValue}clone(){return new n(this._minValue,this._maxValue)}minValue(){return this._minValue}setMinValue(e){this._minValue=e}maxValue(){return this._maxValue}setMaxValue(e){this._maxValue=e}length(){return this._maxValue-this._minValue}isEmpty(){return this._maxValue===this._minValue||this._maxValue!=this._maxValue||this._minValue!=this._minValue}serialize(){return{m_maxValue:this._maxValue,m_minValue:this._minValue}}state(){return{max:this._maxValue,min:this._minValue}}merge(e){return new n(Math.min(this.minValue(),e.minValue()),Math.max(this.maxValue(),e.maxValue()))}apply(e,t){this._minValue=Math.min(this._minValue,e),this._maxValue=Math.max(this._maxValue,t)}set(e,t){this._minValue=e,this._maxValue=t}scaleAroundCenter(e){if(!(0,s.isNumber)(e))return void r.logDebug("PriceRange.scaleAroundCenter: invalid coeff");if(0===this._maxValue-this._minValue)return;const t=.5*(this._maxValue+this._minValue);let i=this._maxValue-t,n=this._minValue-t;i*=e,n*=e,this._maxValue=t+i,this._minValue=t+n}shift(e){(0,s.isNumber)(e)?(this._maxValue+=e,this._minValue+=e):r.logDebug("PriceRange.shift: invalid coeff")}containsStrictly(e){return e.minValue()>this._minValue&&e.maxValue()<this._maxValue}static compare(e,t){return null===e||null===t?e===t:e.equals(t)}}},17625:(e,t,i)=>{"use strict";i.d(t,{createPrimitiveProperty:()=>r});var s=i(12988);function r(e){return new s.Property(e)}},11402:(e,t,i)=>{"use strict";i.d(t,{factoryDefaultsForCurrentTheme:()=>l});var s=i(14314),r=i(27788),n=i(50151),o=i(45345),a=i(26843)
;function l(e,t){var i;const l=null!==(i=o.watchedTheme.value())&&void 0!==i?i:a.StdTheme.Light,c=(0,r.default)(e);return(0,s.default)(c,(0,n.ensureDefined)(t.get(l))),c}},39158:(e,t,i)=>{"use strict";i.d(t,{combineProperty:()=>r});var s=i(17625);function r(e,...t){const i=()=>e(...t.map((e=>e.value()))),r=(0,s.createPrimitiveProperty)(i()),n=()=>r.setValue(i()),o={};for(const e of t)e.subscribe(o,n);return r.destroy=()=>{t.forEach((e=>e.unsubscribeAll(o))),t.forEach((e=>e.release()))},r}},42752:(e,t,i)=>{"use strict";i.d(t,{convertPropertyToWatchedValue:()=>r});var s=i(64147);function r(e){const t=new s.WatchedValue(e.value());let i=!1;e.subscribe(t,(()=>{i||(i=!0,t.setValue(e.value()),i=!1)}));const r=()=>{i||(i=!0,e.setValue(t.value()),i=!1)};return t.subscribe(r),t.spawn((()=>{e.unsubscribeAll(t),t.unsubscribe(r)}))}},99531:(e,t,i)=>{"use strict";i.d(t,{combineProperty:()=>o.combineProperty,createWVFromGetterAndSubscription:()=>s.createWVFromGetterAndSubscription,createWVFromGetterAndSubscriptions:()=>r.createWVFromGetterAndSubscriptions,createWVFromProperty:()=>n});var s=i(12184),r=i(23869);function n(e){return(0,s.createWVFromGetterAndSubscription)((()=>e.value()),e)}i(17625);var o=i(39158)},12184:(e,t,i)=>{"use strict";i.d(t,{createWVFromGetterAndSubscription:()=>r});var s=i(64147);function r(e,t){const i=new s.WatchedValue(e()),r={};t.subscribe(r,(()=>{i.setValue(e())}));return i.readonly().spawn((()=>t.unsubscribeAll(r)))}},23869:(e,t,i)=>{"use strict";i.d(t,{createWVFromGetterAndSubscriptions:()=>r});var s=i(64147);function r(e,t){const i=new s.WatchedValue(e()),r={};t.forEach((t=>t.subscribe(r,(()=>{i.setValue(e())}))));return i.readonly().spawn((()=>t.forEach((e=>e.unsubscribeAll(r)))))}},12988:(e,t,i)=>{"use strict";i.d(t,{Property:()=>d});var s=i(3308),r=i(27147),n=i(68888),o=i(62942),a=i(50151),l=i(52033),c=i(34776);function h(e){return null===e||(0,s.default)(e)&&Number.isFinite(e)||(0,r.default)(e)||(0,n.default)(e)}class d{constructor(e){if(this._listeners=new l.Delegate,this._muteChildChanges=!1,this._childs=[],this._dependents=[],void 0!==e)if(h(e))this._value=e;else for(const[t,i]of Object.entries(e))this.addProperty(t,i)}destroy(){var e,t;this.listeners().destroy();for(const i of this._childs)null===(t=null===(e=this.child(i))||void 0===e?void 0:e.destroy)||void 0===t||t.call(e)}merge(e,t){let i=null,s=0;if(t&&(i=[],s=i.length),void 0===e)return i;if(h(e))return this._value!==e&&(null==i||i.push(this)),this._value=e,i;if(Array.isArray(e))for(let s=0;s<e.length;s++){const r=this.childs()[s];if(r){const n=r.merge(e[s],t);null==i||i.push(...n)}else{const t=this.addProperty(`${s}`,e[s]);null==i||i.push(t)}}else for(const[s,r]of Object.entries(e)){const e=this.childs()[s];if(e){const s=e.merge(r,t);null==i||i.push(...s)}else{const e=this.addProperty(s,r);null==i||i.push(e)}}return i&&i.length>s&&i.push(this),i}mergeAndFire(e){const t=(0,a.ensureNotNull)(this.merge(e,!0));this._muteChildChanges=!0;for(const e of t)e._muteChildChanges=!0;for(const e of t)e._muteChildChanges=!1,e.listeners().fire(e,"")
;this._muteChildChanges=!1,t.length>0&&this.listeners().fire(this,"")}state(e){let t=(0,o.default)(this.value)?this.value():void 0;void 0===t&&(t={});for(const i of this._childs){if(e&&-1!==e.indexOf(i))continue;const s=this.childs()[i];let r;if(e){const t=[];for(const s of e)s.startsWith(i+".")&&t.push(s.substring(i.length+1));r=null==s?void 0:s.state(t)}else r=null==s?void 0:s.state();(void 0!==r||(null==s?void 0:s.storeStateIfUndefined()))&&(t[i]=r)}return t}clone(){return new d(this.state())}value(){return this._value}listeners(){return this._listeners}childCount(){return this._childs.length}childNames(){return this._childs}child(e){return this.childs()[e]}childByPath(e){let t=this;for(const i of e.split(".")){if(void 0===t)break;t=t.child(i)}return t}hasChild(e){return this._childs.includes(e)}setValue(e,t){(this._value!==e||t)&&(this._value=e,this._listeners.fire(this,""))}setValueSilently(e){this._value=e}addProperty(e,t){const i=new d(t);return this[e]=i,this._childs.push(e),i.subscribe(this,((t,i)=>this.childChanged(t,i?`${e}.${i}`:e))),i}removeProperty(e){this[e].unsubscribeAll(this),delete this[e],this._childs=this._childs.filter((t=>t!==e))}addChild(e,t){const i=this;i[e]&&i[e].unsubscribeAll(this),i[e]=t,-1===this._childs.indexOf(e)&&this._childs.push(e),t.subscribe(this,((t,i)=>this.childChanged(t,i?`${e}.${i}`:e)))}childChanged(e,t){this._muteChildChanges||this._listeners.fire(this,t)}subscribe(e,t){this.listeners().subscribe(e,t,!1)}unsubscribe(e,t){this.listeners().unsubscribe(e,t)}unsubscribeAll(e){this.listeners().unsubscribeAll(e)}childs(){return this}storeStateIfUndefined(){return!0}ownership(){return(0,c.ownership)(this)}weakReference(){return(0,c.weakReference)(this)}addDependent(e){this._dependents.push(e)}removeDependent(e){const t=this._dependents.indexOf(e);t>=0&&this._dependents.splice(t,1)}dependents(){return this._dependents}}},76742:(e,t,i)=>{"use strict";i.d(t,{QuotesProvider:()=>o});var s=i(90277),r=i(52033),n=i(92184);class o{constructor(e="full",t){var i;this._quotes=null,this._quoteSessionSymbol=null,this._quoteSessionClientId="",this._pausedQuoteSessionSymbol=null,this._quotesUpdate=new r.Delegate,this._quoteSymbolChanged=new r.Delegate,this._multiplexerType=e,this._hibernated=t,null===(i=this._hibernated)||void 0===i||i.subscribe((e=>{e?this.pause():this.resume()}))}setQuotesSessionSymbol(e){this._quoteSessionSymbol!==e&&(this._pausedQuoteSessionSymbol=null,this._quoteSessionClientId||(this._quoteSessionClientId="series-"+(0,n.guid)()),this._unsubscribeQuoteSession(),this._quoteSessionSymbol=e,this._quoteSymbolChanged.fire(),e&&this._subscribeQuoteSession(e))}symbol(){return this._quoteSessionSymbol}quotesUpdate(){return this._quotesUpdate}quoteSymbolChanged(){return this._quoteSymbolChanged}quotes(){return this._quotes}async quotesSnapshot(e){return(0,s.getQuoteSessionInstance)("simple").snapshot(e)}isPaused(){return null!==this._pausedQuoteSessionSymbol}pause(){null===this._pausedQuoteSessionSymbol&&(this._pausedQuoteSessionSymbol=this._quoteSessionSymbol,
this._unsubscribeQuoteSession())}resume(){null!==this._pausedQuoteSessionSymbol&&(this._subscribeQuoteSession(this._pausedQuoteSessionSymbol),this._pausedQuoteSessionSymbol=null)}destroy(){var e;this._unsubscribeQuoteSession(),null===(e=this._hibernated)||void 0===e||e.release()}_onUpdate(e,t){this._quotes=e&&e.values||null,t&&t.values&&this._quotesUpdate.fire(e,t)}_subscribeQuoteSession(e){this._quoteSessionSymbol=e,(0,s.getQuoteSessionInstance)(this._multiplexerType).subscribe(this._quoteSessionClientId,this._quoteSessionSymbol,this._onUpdate.bind(this))}_unsubscribeQuoteSession(){this._quoteSessionSymbol&&((0,s.getQuoteSessionInstance)(this._multiplexerType).unsubscribe(this._quoteSessionClientId,this._quoteSessionSymbol),this._quoteSessionSymbol=null,this._quotes=null)}}},64034:(e,t,i)=>{"use strict";i.d(t,{dpr1PixelRatioInfo:()=>r,equalPixelRatios:()=>o,equalRenderingInfos:()=>n});var s=i(27714);const r={horizontalPixelRatio:1,verticalPixelRatio:1};function n(e,t){return(0,s.equalSizes)(e.mediaSize,t.mediaSize)&&(0,s.equalSizes)(e.bitmapSize,t.bitmapSize)&&o(e,t)}function o(e,t){return e.horizontalPixelRatio===t.horizontalPixelRatio&&e.verticalPixelRatio===t.verticalPixelRatio}},10074:(e,t,i)=>{"use strict";i.r(t),i.d(t,{compareResolutions:()=>_,convertResolutionsFromSettings:()=>A,getApplicableIntervalForFrequency:()=>m,getCustomResolutions:()=>D,getDefaultResolution:()=>w,getMaxResolutionValue:()=>I,getRangeResolution:()=>S,getResolutionByChartStyle:()=>C,getResolutionsFromSettings:()=>M,getServerInterval:()=>P,getTimeBasedResolution:()=>b,getTranslatedResolution:()=>E,getTranslatedResolutionModel:()=>V,intervalIsSupported:()=>W,isAvailable:()=>v,isIntervalEnabled:()=>F,isResolutionMultiplierValid:()=>x,isSecondsEnabled:()=>R,isTicksEnabled:()=>N,maxResolutionValues:()=>d,mergeResolutions:()=>L,normalizeIntervalString:()=>f,resolutionOrder:()=>u,setLastUsedResolution:()=>y,sortResolutions:()=>k});var s=i(11542),r=i(85049),n=i(68805),o=i(56840),a=i(82992),l=i(97144),c=i(37265),h=i(56570);const d={[r.ResolutionKind.Ticks]:1,[r.ResolutionKind.Seconds]:60,[r.ResolutionKind.Minutes]:1440,[r.SpecialResolutionKind.Hours]:24,[r.ResolutionKind.Days]:365,[r.ResolutionKind.Weeks]:52,[r.ResolutionKind.Months]:12,[r.ResolutionKind.Range]:1e6,[r.ResolutionKind.Invalid]:NaN},u={[r.ResolutionKind.Ticks]:0,[r.ResolutionKind.Seconds]:1,[r.ResolutionKind.Minutes]:2,[r.SpecialResolutionKind.Hours]:3,[r.ResolutionKind.Days]:4,[r.ResolutionKind.Weeks]:5,[r.ResolutionKind.Months]:6,[r.ResolutionKind.Range]:7,[r.ResolutionKind.Invalid]:8};function p(e){const t=r.Interval.parse(e),i=t.multiplier()||1;return t.isMinuteHours()?[r.SpecialResolutionKind.Hours,i/60]:[t.kind(),i]}function _(e,t){if(e===t)return 0;const[i,s]=p(e),[r,n]=p(t);return i!==r?u[i]-u[r]:s-n}function m(e,t){return _(t,e)>=0?t:e}var g;function f(e){return r.Interval.parse(e).value()}function v(e){const t=r.Interval.parse(e);if(!R()&&t.isSeconds())return!1;if(!N()&&t.isTicks())return!1;const i=t.value(),s=a.linking.dataFrequencyResolution.value()
;if(void 0!==s&&_(i,s)<0)return!1;const n=a.linking.supportedResolutions.value();return void 0!==n?void 0!==n.find((e=>f(e)===i)):t.isSeconds()?Boolean(a.linking.seconds.value()):t.isTicks()?Boolean(a.linking.ticks.value()):t.isIntraday()?Boolean(a.linking.intraday.value()):t.isDWM()}function y(e){r.Interval.isValid(e)&&(r.Interval.isRange(e)?o.setValue("chart.lastUsedRangeResolution",e):o.setValue("chart.lastUsedTimeBasedResolution",e))}function S(e){const t=o.getValue("chart.lastUsedRangeResolution");if(void 0!==t&&r.Interval.isRange(t))return t;let i="100R";for(const t of e){const e=r.Interval.parse(t);if(e.isRange()){const t=e.value();if("100R"===t)return t;i=t}}return i}function b(e){const t=o.getValue("chart.lastUsedTimeBasedResolution");if(void 0!==t&&r.Interval.isTimeBased(t))return t;let i="1D";for(const t of e){const e=r.Interval.parse(t);if(e.isTimeBased()){const t=e.value();if("1D"===t)return t;i=t}}return i}function w(e){return e?"100R":"1D"}function C(e,t,i){const s=n.isRangeStyle(e),o=r.Interval.isRange(t);return!s&&o?b(i):s&&!o?S(i):t}function P(e){return r.Interval.isRange(e)?"1":e}function x(e){const{interval:t,guiResolutionKind:i}=r.Interval.parseExt(e);if(!t.isValid())return!1;const s=t.multiplier();return(i===r.SpecialResolutionKind.Hours?s/60:s)<=T(i)}function T(e){const t=d[e];return Number.isNaN(t)?1:t}function I(e){return T(r.Interval.parseExt(e).guiResolutionKind)}function M(e){const t=A(o.getJSON(e,[]));return(0,l.uniq)(t.filter(x).map(f))}function A(e){return Array.isArray(e)?e:Object.keys(e).map(r.Interval.normalize).filter(c.notNull)}function L(...e){let t=[].concat(...e);return t=(0,l.uniq)(t.filter(x).map(f)),k(t)}function k(e){return e.sort(_)}function D(){return[]}function E(e){const{multiplier:t,shortKind:i}=V(e);return`${t}${i}`}function V(e,t){const i=r.Interval.parse(e);let s=i.multiplier(),n=i.kind();if(!i.isValid()){if(t)return null;throw new TypeError("Can't translate invalid interval")}return i.isMinuteHours()&&(s=Math.floor(s/60),n=r.SpecialResolutionKind.Hours),{multiplier:s.toString(),shortKind:B(n),hint:`${s} ${B(n,s)}`,mayOmitMultiplier:i.isDWM()&&1===s,mayOmitShortKind:i.isMinutes()&&!i.isMinuteHours()}}function B(e,t){if(!t)return{[r.ResolutionKind.Invalid]:"",[r.ResolutionKind.Ticks]:s.t(null,{context:"interval_short"},i(82901)),[r.ResolutionKind.Seconds]:s.t(null,{context:"interval_short"},i(68823)),[r.ResolutionKind.Minutes]:s.t(null,{context:"interval_short"},i(68430)),[r.SpecialResolutionKind.Hours]:s.t(null,{context:"interval_short"},i(38048)),[r.ResolutionKind.Days]:s.t(null,{context:"interval_short"},i(38691)),[r.ResolutionKind.Weeks]:s.t(null,{context:"interval_short"},i(7408)),[r.ResolutionKind.Months]:s.t(null,{context:"interval_short"},i(77995)),[r.ResolutionKind.Range]:s.t(null,{context:"interval_short"},i(93934))}[e];switch(e){case r.ResolutionKind.Ticks:return s.t(null,{plural:"ticks",count:t},i(11913));case r.ResolutionKind.Days:return s.t(null,{plural:"days",count:t},i(41807));case r.ResolutionKind.Weeks:return s.t(null,{plural:"weeks",count:t
},i(48898));case r.ResolutionKind.Months:return s.t(null,{plural:"months",count:t},i(98393));case r.ResolutionKind.Seconds:return s.t(null,{plural:"seconds",count:t},i(33232));case r.ResolutionKind.Minutes:return s.t(null,{plural:"minutes",count:t},i(78318));case r.SpecialResolutionKind.Hours:return s.t(null,{plural:"hours",count:t},i(42328));case r.ResolutionKind.Range:return s.t(null,{plural:"ranges",count:t},i(89937));default:return e}}function R(){return h.enabled("seconds_resolution")}function N(){return h.enabled("tick_resolution")||false}function O(e){return!(!R()&&e.isSeconds())&&!(!N()&&e.isTicks())}function F(e){return O(r.Interval.parse(e))}function W(e){if(h.enabled("allow_supported_resolutions_set_only")){const t=r.Interval.normalize(e);return null!==t&&v(t)}{const t=r.Interval.parse(e);if(!t.isValid()||!O(t))return!1;if(!h.enabled("custom_resolutions")){const t=r.Interval.normalize(e),i=window.ChartApiInstance.defaultResolutions().filter(F);if(!t||-1===i.indexOf(t))return!1}const i=a.linking.dataFrequencyResolution.value();if(void 0!==i&&m(i,t.value())!==t.value())return!1;if(t.isTicks())return a.linking.ticks.value();if(t.isIntraday())return a.linking.intraday.value();{const e=a.linking.supportedResolutions.value();return!e||e.includes(t.value())}}}!function(e){e.CustomUserResolutionsKey="IntervalWidget.intervals",e.LastUsedRangeResolutionKey="chart.lastUsedRangeResolution",e.LastUsedTimeBasedResolutionKey="chart.lastUsedTimeBasedResolution",e.DefaultRangeResolution="100R",e.DefaultTimeBasedResolution="1D"}(g||(g={}))},59769:(e,t,i)=>{"use strict";i.d(t,{barSpacingByScaleRatio:()=>o,priceRangeByScaleRatio:()=>n,scaleRatio:()=>r});var s=i(93280);function r(e,t){if(t.isLog()||e.isEmpty()||t.isEmpty())return null;const i=function(e){if(e.isEmpty())return null;const t=e.priceRange();if(null===t)return null;const i=t.length();return e.internalHeight()/i}(t);if(null===i)return null;return e.getValidBarSpacing()/Math.max(1e-10,i)}function n(e,t,i){if(e.isLog()||null===i||e.isEmpty())return null;const r=e.priceRange();if(null===r||r.isEmpty())return null;const n=e.internalHeight()/(t/i),o=r.length();if(n===o)return r;const a=(n-o)/2;return new s.PriceRange(r.minValue()-a,r.maxValue()+a)}function o(e,t){if(e.isLog()||null===t||e.isEmpty())return null;const i=e.priceRange();if(null===i)return null;const s=i.length();return e.internalHeight()/s*t}},34391:(e,t,i)=>{"use strict";i.d(t,{allPriceScaleSelectionStrategyInfo:()=>c,createPriceScaleSelectionStrategy:()=>l});var s=i(50151),r=i(11542),n=i(72708);class o{constructor(e){this._priceScalesLimit=8,this._metaInfo=e}metaInfo(){return this._metaInfo}findSuitableScale(e,t,i,s){if(void 0!==s)return this._tryToGetDesiredPriceScale(e,t,s,i);if((0,n.isStudy)(t)){const s=t.metaInfo();if("Volume"===s.shortId&&e.containsMainSeries())return e.createPriceScaleAtPosition("overlay");const r=t.desiredPriceScalePosition();if(null!==r)return this._tryToGetDesiredPriceScale(e,t,r,i);if(void 0!==i&&((0,
n.isStudy)(i)||e.isMainPane())&&s.is_price_study)return this._getPriceScaleTheSameAsForSource(i,e)}let r=!1;if((0,n.isStudy)(t)){const i=t.metaInfo().groupingKey;if(void 0!==i){const t=e.model().findNonOverlayStudyWithGroupingKey(i,e);if(null!==t)return this._getPriceScaleTheSameAsForSource(t.study,t.pane)}r=Boolean(t.metaInfo().is_price_study)}else t===e.model().mainSeries()&&(r=!0);if(r){const t=this._findFirstScaleForPriceStudy(e);if(null!==t)return t}return this.createNewPriceScaleIfPossible(e)}canCreateNewPriceScale(e){return e.leftPriceScales().length+e.rightPriceScales().length<this._priceScalesLimit}_getPriceScaleTheSameAsForSource(e,t){return t.isOverlay(e)?t.createPriceScaleAtPosition("overlay"):(0,s.ensureNotNull)(e.priceScale())}_priceScaleIsPrice(e,t){const i=e.mainSource();return!!i&&(i===t.mainSeries()||!!(0,n.isStudy)(i)&&Boolean(i.metaInfo().is_price_study))}_findFirstScaleForPriceStudy(e){const t=e.model();for(let i=0;i<this._priceScalesLimit;i++){if(e.rightPriceScales().length>i&&this._priceScaleIsPrice(e.rightPriceScales()[i],t))return e.rightPriceScales()[i];if(e.leftPriceScales().length>i&&this._priceScaleIsPrice(e.leftPriceScales()[i],t))return e.leftPriceScales()[i]}return null}_targetPriceScaleIndex(e,t){if(e.mainSource()===t.mainSeries())return 0}_tryToGetDesiredPriceScale(e,t,i,r){switch(i){case"left":return this.canCreateNewPriceScale(e)?e.createPriceScaleAtPosition("left"):e.createPriceScaleAtPosition("overlay");case"right":return this.canCreateNewPriceScale(e)?e.createPriceScaleAtPosition("right"):e.createPriceScaleAtPosition("overlay");case"as-series":return void 0!==r?(0,s.ensureNotNull)(r.priceScale()):e.isMainPane()?(0,s.ensureNotNull)((0,s.ensureNotNull)(e.mainDataSource()).priceScale()):this.createNewPriceScaleIfPossible(e);case"overlay":return e.createPriceScaleAtPosition("overlay")}}}const a=[{name:"left",title:r.t(null,void 0,i(61507)),ctor:class extends o{constructor(e){super(e)}apply(e){const t=e.model();e.rightPriceScales().slice(0).forEach((i=>e.movePriceScale(i,"left",this._targetPriceScaleIndex(i,t))))}createNewPriceScaleIfPossible(e){return this.canCreateNewPriceScale(e)?e.createPriceScaleAtPosition("left"):e.createPriceScaleAtPosition("overlay")}}},{name:"right",title:r.t(null,void 0,i(97800)),ctor:class extends o{constructor(e){super(e)}apply(e){const t=e.model();e.leftPriceScales().slice(0).forEach((i=>e.movePriceScale(i,"right",this._targetPriceScaleIndex(i,t))))}createNewPriceScaleIfPossible(e){return this.canCreateNewPriceScale(e)?e.createPriceScaleAtPosition("right"):e.createPriceScaleAtPosition("overlay")}}},{name:"auto",title:r.t(null,void 0,i(21469)),ctor:class extends o{constructor(e){super(e)}apply(e){if(e.containsMainSeries()){const t=(0,s.ensureNotNull)((0,s.ensureNotNull)(e.mainDataSource()).priceScale());e.movePriceScale(t,"right",0)}const t=e.model();for(;e.leftPriceScales().length>e.rightPriceScales().length;){const i=e.leftPriceScales()[e.leftPriceScales().length-1];e.movePriceScale(i,"right",this._targetPriceScaleIndex(i,t))}
for(;e.rightPriceScales().length-e.leftPriceScales().length>1;){const i=e.rightPriceScales()[e.rightPriceScales().length-1];e.movePriceScale(i,"left",this._targetPriceScaleIndex(i,t))}}createNewPriceScaleIfPossible(e){if(!this.canCreateNewPriceScale(e))return e.createPriceScaleAtPosition("overlay");const t=e.leftPriceScales().length<e.rightPriceScales().length?"left":"right";return e.createPriceScaleAtPosition(t)}}}];function l(e){const t=(0,s.ensureDefined)(a.find((t=>t.name===e)));return new t.ctor(t)}function c(){return a}},66540:(e,t,i)=>{"use strict";i.d(t,{SelectionIndexes:()=>r});var s=i(50151);class r{constructor(e){this._baseIndex=null,this._offsetInBar=null,this._offsetInTime=null,this._barsBetweenPoints=null,this._timescale=e}indexes(){const e=this._timescale.visibleBarsStrictRange();if(null===e)return[];const t=e.firstBar(),i=e.lastBar();if(null===this._offsetInTime||null===this._barsBetweenPoints){const e=this._timescale.barSpacing();this._barsBetweenPoints=Math.floor(120/e),this._offsetInBar=i%this._barsBetweenPoints,this._offsetInTime=this._timescale.indexToTimePoint(this._offsetInBar),this._baseIndex=this._timescale.baseIndex()}const r=this._timescale.baseIndex();this._baseIndex!==r&&(this._baseIndex=r,this._offsetInBar=(0,s.ensureNotNull)(this._timescale.timePointToIndex(this._offsetInTime)));const n=(0,s.ensureNotNull)(this._offsetInBar),o=[];let a=Math.floor((t-n)/this._barsBetweenPoints);const l=Math.floor((i-n)/this._barsBetweenPoints);for(;a<=l;a++)o.push(n+a*this._barsBetweenPoints);return o}clear(){this._offsetInBar=null,this._offsetInTime=null,this._baseIndex=null,this._barsBetweenPoints=null}}},11064:(e,t,i)=>{"use strict";i.d(t,{SelectionRenderer:()=>h});var s=i(34026),r=i(19625),n=i(56468),o=i(72791),a=i(30125);const l=r.colorsPalette["color-tv-blue-600"];var c;!function(e){e[e.Radius=3.5]="Radius",e[e.Tolerance=2]="Tolerance"}(c||(c={}));class h extends a.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e||null}setData(e){this._data=e}hitTest(e){var t;if(!this._data||!this._data.visible)return null;for(let i=0;i<this._data.points.length;i++){const s=this._data.points[i];if(s.subtract(e).length()<=5.5)return new n.HitTestResult(this._data.hittestResult,{pointIndex:s.pointIndex,cursorType:null!==(t=s.cursorType)&&void 0!==t?t:o.PaneCursorType.Default})}return null}doesIntersectWithBox(e){return!!this._data&&this._data.points.some((t=>(0,s.pointInBox)(t,e)))}_drawImpl(e){if(null===this._data||!this._data.visible)return;const{context:t,horizontalPixelRatio:i}=e;t.strokeStyle=void 0!==this._data.color?this._data.color:l,t.lineCap="butt";const s=Math.max(1,Math.floor(i));t.lineWidth=s;const r=this._data.vertOffset||0;for(let i=0;i<this._data.points.length;++i){const o=this._data.points[i];(n=o,Number.isFinite(n.x)&&Number.isFinite(n.y))&&(t.fillStyle=this._data.bgColors[i],this._drawMarker(e,{center:o.x,y:o.y},r,s))}var n}_drawMarker(e,t,i,s){const{context:r,horizontalPixelRatio:n,verticalPixelRatio:o}=e;let a=Math.round(3.5*n*2);a%2!=s%2&&(a+=1)
;let l=Math.round(a+2*(.5*s+.75*n));l%2!=s%2&&(l+=1);const c=Math.round(t.center*n),h=Math.round((t.y+i)*o),d=s%2/2;r.beginPath(),r.arc(c+d,h+d,l/2,0,2*Math.PI,!0),r.closePath(),r.fill(),r.beginPath(),r.arc(c+d,h+d,a/2,0,2*Math.PI,!0),r.closePath(),r.stroke()}}},90799:(e,t,i)=>{"use strict";i.d(t,{SeriesBarColorer:()=>p});var s=i(19625),r=i(50151),n=(i(20596),i(8025)),o=i(96e3);const a=(0,s.getHexColorByName)("color-minty-green-500"),l=(0,s.getHexColorByName)("color-ripe-red-500");function c(e){return{barColor:e.upColor.value(),barBorderColor:e.borderUpColor?e.borderUpColor.value():e.borderColor.value()}}function h(e){return{barColor:e.downColor.value(),barBorderColor:e.borderDownColor?e.borderDownColor.value():e.borderColor.value()}}function d(e,t){return e.borderUpColorProjection&&e.borderUpColor?{barColor:t?e.upColorProjection.value():e.upColor.value(),barBorderColor:t?e.borderUpColorProjection.value():e.borderUpColor.value()}:{barColor:t?e.upColorProjection.value():e.upColor.value()}}function u(e,t){return e.borderDownColorProjection&&e.borderDownColor?{barColor:t?e.downColorProjection.value():e.downColor.value(),barBorderColor:t?e.borderDownColorProjection.value():e.borderDownColor.value()}:{barColor:t?e.downColorProjection.value():e.downColor.value()}}class p extends o.AbstractBarColorer{constructor(e){super(),this._series=e}applyBarStyle(e,t,i,s){const r=i;r.barColor=void 0,r.barBorderColor=void 0,r.barWickColor=void 0,r.isBarHollow=void 0,r.isBarUp=void 0,r.upColor=void 0,r.downColor=void 0,r.isTwoColorBar=void 0,r.isMergedBar=void 0;const n=this._series.properties();switch(n.childs().style.value()){case 2:case 18:case 14:case 15:this._applyLineStyle(i,n);break;case 3:this._applyAreaStyle(i,n);break;case 16:this._applyHLCAreaStyle(e,t,i,s,n);break;case 0:this._applyBarStyle(e,i,s,n);break;case 17:case 1:case 19:this._applyCandleStyle(e,i,s,n);break;case 9:this._applyHollowCandleStyle(e,i,s,n);break;case 8:this._applyHAStyle(e,t,i,s,n);break;case 10:this._applyBaseLineStyle(e,t,i,s,n);break;case 12:this._applyHiLoStyle(t,i,n);break;case 13:this._applyColumnStyle(e,i,s,n);break;case 4:this._applyRenkoStyle(e,t,i,s,n);break;case 7:this._applyPBStyle(e,t,i,s,n);break;case 5:this._applyKagiStyle(e,t,i,s,n);break;case 6:this._applyPnfStyle(e,t,i,s,n);break;case 11:this._applyRangeStyle(e,t,i,s,n)}return i}static upColor(e,t){const i=e.childs(),s=i.style.value();switch(s){case 18:return{barColor:i.tpoStyle.childs().color.value()};case 20:return{barColor:i.svpStyle.childs().volumeProfile.childs().volumeColorUp.value()};case 2:return{barColor:i.lineStyle.childs().color.value()};case 14:return{barColor:i.lineWithMarkersStyle.childs().color.value()};case 15:return{barColor:i.steplineStyle.childs().color.value()};case 3:return{barColor:i.areaStyle.childs().linecolor.value()};case 16:return{barColor:i.hlcAreaStyle.childs().closeLineColor.value(),barBorderColor:a};case 0:return{barColor:i.barStyle.childs().upColor.value()};case 17:return c(i.volFootprintStyle.childs());case 19:return c(i.volCandlesStyle.childs());case 1:
return c(i.candleStyle.childs());case 9:return c(i.hollowCandleStyle.childs());case 8:return c(i.haStyle.childs());case 10:return{barColor:i.baselineStyle.childs().topLineColor.value()};case 12:return{barColor:i.hiloStyle.childs().color.value(),barBorderColor:e.childs().hiloStyle.childs().borderColor.value()};case 13:return{barColor:i.columnStyle.childs().upColor.value()};case 4:return d(i.renkoStyle.childs(),t);case 7:return d(i.pbStyle.childs(),t);case 5:return d(i.kagiStyle.childs(),t);case 6:return d(i.pnfStyle.childs(),t);case 11:return{barColor:""}}(0,r.ensureNever)(s)}static downColor(e,t){const i=e.childs(),s=i.style.value();switch(s){case 2:return{barColor:i.lineStyle.childs().color.value()};case 18:return{barColor:i.tpoStyle.childs().color.value()};case 20:return{barColor:i.svpStyle.childs().volumeProfile.childs().volumeColorUp.value()};case 14:return{barColor:i.lineWithMarkersStyle.childs().color.value()};case 15:return{barColor:i.steplineStyle.childs().color.value()};case 3:return{barColor:i.areaStyle.childs().linecolor.value()};case 16:return{barColor:i.hlcAreaStyle.childs().closeLineColor.value(),barBorderColor:l};case 0:return{barColor:i.barStyle.childs().downColor.value()};case 17:return h(i.volFootprintStyle.childs());case 1:return h(i.candleStyle.childs());case 19:return h(i.volCandlesStyle.childs());case 9:return h(i.hollowCandleStyle.childs());case 8:return h(i.haStyle.childs());case 10:return{barColor:i.baselineStyle.childs().bottomLineColor.value()};case 12:return{barColor:i.hiloStyle.childs().color.value(),barBorderColor:e.childs().hiloStyle.childs().borderColor.value()};case 13:return{barColor:i.columnStyle.childs().downColor.value()};case 4:return u(i.renkoStyle.childs(),t);case 7:return u(i.pbStyle.childs(),t);case 5:return u(i.kagiStyle.childs(),t);case 6:return u(i.pnfStyle.childs(),t);case 11:return{barColor:""}}(0,r.ensureNever)(s)}_applyLineStyle(e,t){e.barColor=p.upColor(t).barColor}_applyAreaStyle(e,t){e.barColor=p.upColor(t).barColor}_applyHLCAreaStyle(e,t,i,s,r){var n;const o=this._isUp(e,!1,s,(null===(n=this._series.data().first())||void 0===n?void 0:n.index)!==e)?p.upColor(r,t):p.downColor(r,t);i.barColor=o.barColor,i.barBorderColor=o.barBorderColor}_applyBarStyle(e,t,i,s){const r=this._isUp(e,!1,i,s.childs().barStyle.childs().barColorsOnPrevClose.value())?p.upColor(s):p.downColor(s);t.barColor=r.barColor,t.barBorderColor=r.barBorderColor}_applyCandleStyle(e,t,i,s){var r;const n=s.childs(),o=1===n.style.value()?n.candleStyle.childs():19===n.style.value()?n.volCandlesStyle.childs():n.volFootprintStyle.childs(),a=this._isUp(e,!1,i,o.barColorsOnPrevClose.value()&&(null===(r=this._series.data().first())||void 0===r?void 0:r.index)!==e),l=a?p.upColor(s):p.downColor(s);t.barColor=l.barColor,t.barBorderColor=l.barBorderColor,t.barWickColor=a?o.wickUpColor?o.wickUpColor.value():o.wickColor.value():o.wickDownColor?o.wickDownColor.value():o.wickColor.value()}_applyHollowCandleStyle(e,t,i,s){var r
;const n=s.childs().hollowCandleStyle.childs(),o=this._isUp(e,!1,i,(null===(r=this._series.data().first())||void 0===r?void 0:r.index)!==e),a=o?p.upColor(s):p.downColor(s);t.barColor=a.barColor,t.barBorderColor=a.barBorderColor,t.barWickColor=o?n.wickUpColor?n.wickUpColor.value():n.wickColor.value():n.wickDownColor?n.wickDownColor.value():n.wickColor.value();const l=this._findBar(e,!1,i);t.isBarHollow=l[1]<=l[4]}_applyHAStyle(e,t,i,s,r){const n=r.childs().haStyle.childs(),o=this._isUp(e,t,s,n.barColorsOnPrevClose.value()),a=o?p.upColor(r):p.downColor(r);i.barColor=a.barColor,i.barBorderColor=a.barBorderColor,i.barWickColor=o?n.wickUpColor.value():n.wickDownColor.value()}_applyBaseLineStyle(e,t,i,s,n){const o=this._findBar(e,t,s),a=n.childs().baselineStyle.childs(),l=this._series.priceScale(),c=Math.round(l.height()*(Math.abs(100-a.baseLevelPercentage.value())/100)),h=(0,r.ensureNotNull)(this._series.firstValue()),d=l.coordinateToPrice(c,h);o[4]>d?i.barColor=p.upColor(n,t).barColor:i.barColor=p.downColor(n,t).barColor}_applyHiLoStyle(e,t,i){const s=p.upColor(i,e);t.barColor=s.barColor,t.barBorderColor=s.barBorderColor}_applyColumnStyle(e,t,i,s){const r=s.childs().columnStyle.childs(),n=this._isUp(e,!1,i,r.barColorsOnPrevClose.value())?p.upColor(s):p.downColor(s);t.color=n.barColor,t.barColor=t.color}_applyRenkoStyle(e,t,i,s,r){}_applyPBStyle(e,t,i,s,r){}_applyKagiStyle(e,t,i,s,r){}_applyPnfStyle(e,t,i,s,r){}_applyRangeStyle(e,t,i,s,r){}_applySVPStyle(e,t,i,s){}_findBar(e,t,i){return i?i.value:this._getSeriesBars(t).valueAt(e)||[]}_findPrevBar(e,t,i){if(i&&i.previousValue)return i.previousValue;const s=this._series.bars().search(e-1,n.PlotRowSearchMode.NearestLeft,4);return null!==s?s.value:[]}_getSeriesBars(e){return e?this._series.nsBars():this._series.bars()}_isUp(e,t,i,s){const r=this._findBar(e,t,i);if(s){return this._findPrevBar(e,t,i)[4]<=r[4]}return r[1]<=r[4]}}},41450:(e,t,i)=>{"use strict";i.d(t,{SeriesBase:()=>hi});var s=i(50151),r=i(49483),n=i(51768),o=i(76422),a=i(31955),l=i(14426),c=i(45579),h=i(91140),d=i(3070),u=i(64755),p=i(8025),_=i(93280),m=i(12988),g=i(68805),f=i(91007),v=i(725),y=i(5171),S=i(27777),b=i(11542),w=i(56570),C=i(22365),P=i(27538),x=i(24708);i(64671);function T(e){const t="QUANDL"===(e=e||{}).exchange,s={title:"",description:"",interval:"",exchange:"",provider:"",chartStyle:"",sessionDescription:"",priceSource:""};let r="";if(e.description&&t)if(2===e.description.split("/").length)r=e.description.split("/")[1];else{e.description.split("'").filter((e=>e.length)).forEach((e=>{let t=[];t=e&&("/"===e[0]||/\d+\/\(?/.test(e))?[e]:e.split("/").filter((e=>e.length)),r+=t[2===t.length?1:0]}))}else r=e.description?e.description:e.symbol;if(e.ticker?(s.title=e.ticker,s.description=I(r)):s.title=I(r),e.interval&&(s.interval=(0,x.translatedIntervalString)(e.interval)),t&&e.description){const t=/[\w_]+\/[\w_]+/.exec(e.description);t&&t[0]?s.provider=I(t[0].split("/")[0]):s.provider=I(e.description.split("/")[0])}return e.exchange&&(s.exchange=I(e.exchange)),s.chartStyle=I(function(e){return e.inputs,
8===e.style?b.t(null,void 0,i(63876)):""}(e)),e.sessionDescription&&(s.sessionDescription=I(e.sessionDescription)),void 0!==e.priceSource&&(s.priceSource=I(e.priceSource)),s}function I(e){return e.replace(/'/g,"")}var M=i(62825);const A=b.t(null,void 0,i(70963)),L=b.t(null,void 0,i(75546)),k=w.enabled("hide_unresolved_symbols_in_legend"),D=w.enabled("symbol_info_price_source");class E extends P.StatusProviderBase{constructor(e,t,i){super(),this._series=e,this._statusViewProperties=t,this._options=i||{}}text(){return function(e){const t=T(e);return(e.ticker?t.description:t.title)+(t.interval?", "+t.interval:"")+function(e,t=", "){return(e.provider?`${t}${e.provider}`:"")+(e.exchange?`${t}${e.exchange}`:"")+(e.chartStyle?`${t}${e.chartStyle}`:"")+(e.branding?`${t}${e.branding}`:"")+(e.sessionDescription?`${t}${e.sessionDescription}`:"")+(e.priceSource?`${t}${e.priceSource}`:"")}(t)}(this._getTitleGenerationOptions())}getSplitTitle(){return T(this._getTitleGenerationOptions())}bold(){return!1}size(){return this._statusViewProperties.childs().fontSize.value()+"px"}errorStatus(){const e=this._series.unsupportedResolutionState().value(),t=e?(0,M.getErrorFromUnsupportedResolutionState)(e):this._series.seriesErrorMessage();return null!==t?{error:t,title:e?L:A}:null}_getTitleGenerationOptions(){var e;const t=this._series.symbolInfo(),i=this._statusViewProperties.childs(),s=this._series.symbolTextSourceProxyProperty().value();let r;i.showExchange.value()&&t&&(r=(0,g.getSymbolExchange)(t));const n=null!==(e=D&&(null==t?void 0:t.price_source_id)?this._series.model().availablePriceSources(this._series.getSymbolString()).name(t.price_source_id):null)&&void 0!==e?e:void 0,o=this._series.getInputsProperties().state();return 17===this._series.style()&&(o.type=this._series.properties().childs().volFootprintStyle.childs().type.value()),{description:B(s,t),exchange:r,symbol:k&&null===t?"":this._series.symbol(),interval:i.showInterval.value()&&!this._options.hideResolution?this._series.interval():void 0,style:this._series.properties().childs().style.value(),inputs:o,boxSize:this._series.data().boxSize,reversalAmount:this._series.data().reversalAmount,ticker:V(s,t),priceSource:n}}}function V(e,t){return"ticker-and-description"!==e?"":null!==t?t.name:void 0}function B(e,t){if(null!==t)return"ticker"===e?t.name:"long-description"===e&&void 0!==t.long_description?t.long_description:(0,C.getTranslatedSymbolDescription)({pro_name:t.pro_name||void 0,short_name:t.name||void 0,description:t.description||void 0,short_description:t.short_description||void 0,local_description:t.local_description||void 0,language:t.language||void 0})}class R extends S.StatusView{constructor(e,t,i){super(new E(e,t,i)),this._invalidated=!0,this._series=e,this._series.onRestarted().subscribe(this,this.update),this._series.dataEvents().symbolResolved().subscribe(this,this.update),this._series.dataEvents().completed().subscribe(this,this.update),this._series.boxSizeValue().subscribe(this.update.bind(this)),
t.childs().symbolTextSource.listeners().subscribe(this,this.update)}getSeriesPrecision(){let e=4;const t=this._series.symbolInfo();return t&&t.pricescale&&(e=Math.round(Math.log(t.pricescale)/Math.log(10))),e}round(e){const t=this.getSeriesPrecision(),i=Math.round(e*Math.pow(10,t))/Math.pow(10,t);return i?i.toString():""}update(){this._invalidated=!0}text(){return this._updateImpl(),super.text()}bold(){return this._updateImpl(),super.bold()}size(){return this._updateImpl(),super.size()}getSplitTitle(){return this._updateImpl(),this._statusProvider.getSplitTitle()}_updateImpl(){this._invalidated&&(this._bold=this._statusProvider.bold(),this._size=this._statusProvider.size(),this._text=this._statusProvider.text(),this._invalidated=!1)}}var N=i(50335),O=i(7576),F=i(928),W=i(15764);const H=r.CheckMobile.any(),z=w.enabled("hide_resolution_in_legend");class U extends O.DataWindowView{constructor(e,t){super(),this._invalidated=!0,this._series=e,this._model=t,this.update()}update(){this._invalidated=!0}items(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items}series(){return this._series}_updateImpl(){var e,t;const i=this._getValuesProvider();this._valuesProvider!==i&&(this._valuesProvider=i,this._items=this._valuesProvider.getItems().map((e=>new O.DataWindowItem(e.id,e.title,"",e.unimportant))));const s=this._series.symbolInfo();if(s){const e=[s.name];if(z||e.push((0,x.translatedIntervalString)(this._series.interval())),(0,g.isEconomicSymbol)(s)){const t=(0,g.getSourceForEconomySymbol)(s);null!==t&&e.push(t)}else e.push((0,r.onWidget)()||"forex"===s.type?s.exchange:s.listed_exchange);this._header=e.join(` ${g.symbolTitleSeparator} `),this._title=s.description}else this._header=this._series.symbol();let n=this._model.crossHairSource().appliedIndex();w.enabled("use_last_visible_bar_value_in_legend")&&!(0,N.isNumber)(n)&&(n=null!==(t=null===(e=this._model.timeScale().visibleBarsStrictRange())||void 0===e?void 0:e.lastBar())&&void 0!==t?t:NaN);const o=this._valuesProvider.getValues(n);for(let e=0;e<o.length;++e){const t=o[e],i=this._items[e];i.setValue(t.value),i.setVisible(t.visible),i.setColor(t.color),i.setTitle(t.title)}}_getValuesProvider(){return this._series.dataWindowValuesProvider()}_showLastPriceAndChangeOnly(){return H&&(null===this._model.crossHairSource().pane||(0,W.isLineToolName)(F.tool.value())||null!==this._model.lineBeingEdited())}}var j=i(99531);const G=b.t(null,void 0,i(72445));class q extends U{constructor(e,t){super(e,t),this._backgroundColorSpawn=t.backgroundTopColor().spawn(),this._backgroundColorSpawn.subscribe(this.update.bind(this));const i=t.properties().childs().paneProperties.childs().legendProperties.childs();this._visibilityProperty=(0,j.combineProperty)(((e,t,i,s)=>e||t||i||s),i.showBarChange.weakReference(),i.showSeriesOHLC.weakReference(),i.showVolume.weakReference(),i.showLastDayChange.weakReference()),this._visibilityProperty.subscribe(this,this.update)}areValuesVisible(){return this._visibilityProperty.value()}additional(){return null}marketTitle(){
const e=this._series.marketStatusModel().status().value();return this._showLastPriceAndChangeOnly()&&("pre_market"===e||"post_market"===e)?`${G}:`:""}destroy(){this._backgroundColorSpawn.destroy(),this._visibilityProperty.destroy()}_getValuesProvider(){return this._series.legendValuesProvider()}}var $,K=i(90823),Y=i(50788),Z=i(85049),X=i(14381),J=i(40644),Q=i(92184);!function(e){e[e.ExtrapolateBarsLimit=2e3]="ExtrapolateBarsLimit"}($||($={}));let ee=0;class te{constructor(e,t){this._extrapolatedData=[],this._cacheForFuture=!1,this._modelId=ee++,this._builderCache=null,this._uniqueId=(0,Q.randomHashN)(6),this._resolution=t,this._symbolInfo=e,this._valid=Boolean(e.timezone)&&Boolean(e.session),this._session=new X.SessionInfo(e.timezone,e.session,e.session_holidays,e.corrections)}syncSourceTarget(){return{uniqueId:this._uniqueId,resolution:this._resolution,symbolInfo:this._symbolInfo,session:this._session.state()}}getSymbolInfo(){return this._symbolInfo}getSession(){return this._session}getResolution(){return this._resolution}uniqueId(){return this._modelId}distance(e,t){if(!this.isValid())return{success:!1};if(e>t)return{success:!1};if(e===t)return{success:!0,result:0};let i=this._extrapolatedData.length,s=0!==i?this._extrapolatedData[0]:null,r=null!==s?this._extrapolatedData[i-1]:null;const n=e<t;if(1e3*e===s&&this._cacheForFuture===n||(this._extrapolatedData=[1e3*e],i=1,s=null,r=null),null===s||null!==r&&1e3*t>r){const s=(0,J.extrapolateBarsFrontToTime)(this.barBuilder(),r||1e3*e,1e3*t,2e3,!0);this._extrapolatedData=this._extrapolatedData.concat(s.times),i=this._extrapolatedData.length,this._cacheForFuture=n}if(r=this._extrapolatedData[i-1],r<1e3*t)return{success:!1};const o=this._extrapolatedData.indexOf(1e3*t);return-1===o?{success:!1}:{success:!0,result:o}}projectTime(e,t){if(!this.isValid())return e;let i=this._extrapolatedData.length,s=i>0?this._extrapolatedData[0]:null,r=null!==s?this._extrapolatedData[i-1]:null;const n=t>=0;1e3*e===s&&this._cacheForFuture===n||(this._extrapolatedData=[1e3*e],i=1,s=null,r=null);const o=Math.abs(t);if(null===s||o>=i){const s=(0,J.extrapolateBarsFrontByCount)(this.barBuilder(),r||1e3*e,Math.sign(t)*(o-i+1),!0);this._extrapolatedData=this._extrapolatedData.concat(s.times),i=this._extrapolatedData.length,this._cacheForFuture=n}return i<o?e:this._extrapolatedData[o]/1e3}isValid(){return this._valid}dataSize(){return this._extrapolatedData.length}createNewModelWithResolution(e){return new te(this._symbolInfo,e)}barBuilder(){return null===this._builderCache&&(this._builderCache=(0,X.newBarBuilder)(this._resolution,this._session,this._session)),this._builderCache}}var ie=i(91676),se=i(22118);i(13665);(0,a.getLogger)("Chart.Definitions.Series");var re;function ne(e,t){return"TickByTick"===e?{mode:e,updatePeriod:t}:{mode:e}}async function oe(e,t,i){const s=[];return(0,se.isDelay)(e.delay)?async function(e){const t=[];return(0,se.witoutRealtime)(e)?t.push(ne("DelayNoRealtime")):t.push(ne("DelayToRealtime")),t}(e):(0,se.isEod)(e,t)?(s.push(ne("EOD")),s):s}!function(e){
e.DelayToRealtime="DelayToRealtime",e.DelayNoRealtime="DelayNoRealtime",e.TFEXDelayForGuest="TFEXDelayForGuest",e.MOEXDelayForGuest="MOEXDelayForGuest",e.NGMDelayForGuest="NGMDelayForGuest",e.MILDelayForGuest="MILDelayForGuest",e.ICESGDelayForGuest="ICESGDelayForGuest",e.TAIFEXDelayForGuest="TAIFEXDelayForGuest",e.TURQUOISEDelayForGuest="TURQUOISEDelayForGuest",e.ADXDelayForGuest="ADXDelayForGuest",e.TRADEGATEDelayForGuest="TRADEGATEDelayForGuest",e.LUXSEDelayForGuest="LUXSEDelayForGuest",e.NSENGDelayForGuest="NSENGDelayForGuest",e.FINRADelayForGuest="FINRADelayForGuest",e.DEForGuest="DEForGuest",e.CHIXAuDelayForGuest="CHIXAuDelayForGuest",e.EOD="EOD",e.TickByTick="TickByTick",e.BATSToRealtime="BATSToRealtime",e.DelayWithoutMarketAgreement="DelayWithoutMarketAgreement",e.DelayWithoutPaidForProffessional="DelayWithoutPaidForProffessional",e.TVCalculatedPair="TVCalculatedPair"}(re||(re={}));class ae{constructor(e,t,i){this._dataUpdatedInfoStatus=new ie.WatchedObject(null),this._symbolInfo=e,this._status=t,this._updatePeriod=i,this._symbolInfo.subscribe(this._update.bind(this)),this._status.subscribe(this._update.bind(this)),this._updatePeriod.subscribe(this._update.bind(this))}destroy(){this._symbolInfo.release(),this._status.release(),this._updatePeriod.release()}status(){return this._dataUpdatedInfoStatus.readonly()}symbolName(){const e=this._symbolInfo.value();return null!==e?e.name:""}time(){const e=this._symbolInfo.value(),t=null!==e&&e.delay&&e.delay>0?e.delay:900;return Math.round(t/60)}listedExchange(){const e=this._symbolInfo.value();return null!==e?e.listed_exchange:""}async description(){const e=this._symbolInfo.value();if(null===e)return"";return{}.description||e.listed_exchange}exchange(){const e=this._symbolInfo.value();return null!==e?e.exchange:""}proName(){const e=this._symbolInfo.value();return null!==e?e.pro_name:""}country(){var e;return(null===(e=this._symbolInfo.value())||void 0===e?void 0:e.country)||""}proPerm(){const e=this._symbolInfo.value();return null!==e?e.pro_perm:""}firstReplacedByBatsExchange(){const e=this._symbolInfo.value();return e&&(0,se.firstReplacedByBatsExchange)(e)}isSpread(){const e=this._symbolInfo.value();return null!==e&&"spread"===e.type}async _update(){const e=this._symbolInfo.value();if(null===e)return void this._dataUpdatedInfoStatus.setValue(null);const t=this._status.value();if("string"==typeof t)return void this._dataUpdatedInfoStatus.setValue(null);if(2===t||1===t)return;const i=await oe(e,t,this._updatePeriod.value());0!==i.length?this._dataUpdatedInfoStatus.setValue(i):this._dataUpdatedInfoStatus.setValue(null)}}i(67580);var le=i(37265);(0,a.getLogger)("Chart.DataProblemModel");class ce{constructor(e,t){this._mainDataProblem=new ie.WatchedObject(null),this._supportPortalProblems=new ie.WatchedObject([]),this._allDataProblems=new ie.WatchedObject([]),this._pushStreamHandler=null,this._destroyed=!1,this._quotesProvider=e,this._quotesProvider.quotesUpdate().subscribe(this,this._update.bind(this)),this._symbolInfo=t,this._symbolInfo.subscribe((e=>{
e||this._mainDataProblem.setValue(null)})),this._mainDataProblem.subscribe((()=>this._updateAllDataProblems())),this._supportPortalProblems.subscribe((()=>this._updateAllDataProblems())),this._requestSupportPortalProblems()}destroy(){this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._symbolInfo.release(),this._destroyed=!0}dataProblems(){return this._allDataProblems}_resetStatus(){this._mainDataProblem.setValue(null)}_update(e){void 0===e.values||void 0===e.values.data_problem?this._resetStatus():this._mainDataProblem.setValue((0,le.clone)(e.values.data_problem))}_updateAllDataProblems(){const e=this._mainDataProblem.value(),t=this._supportPortalProblems.value();this._allDataProblems.setValue(null===e?t:[e,...t])}async _requestSupportPortalProblems(){0}}var he=i(76742),de=i(19063),ue=i(98558),pe=i(94164);function _e(e){return e<10?`0${e}`:e.toString()}var me=i(49256),ge=i(44672);const fe=w.enabled("force_exchange_as_title"),ve=w.enabled("chart_style_hilo_last_price");const ye={alwaysShowGlobalLast:!1,visibleOnHistoryOnly:!1,showCountdown:!0,showSymbolLabel:!0,useSolidBodyColor:!0};class Se extends ue.PriceAxisView{constructor(e,t,i){super(),this._previousCountdown="",this._source=e,this._model=t,this._options={...ye,...i}}updateCountdown(){this._countdownText()!==this._previousCountdown&&(this.update((0,ge.sourceChangeEvent)(this._source.id())),this._model.updateSourcePriceScale(this._source))}_getSource(){return this._source}_getModel(){return this._model}_isCountdownEnabled(){return this._options.showCountdown}_countdownText(){const e=Z.Interval.parse(this._source.interval());if(e.isDWM()||e.isTicks()||e.isSeconds()&&1===e.multiplier())return"";const t=this._source.data().bars().last();if(null===t)return"";const i=1e3*(0,s.ensure)(t.value[0]),r=Z.Interval.parse(this._source.interval()).inMilliseconds(),n=i.valueOf()+r;let o=Math.round((n-this._currentTime())/1e3);if(o<=0)return"";o=Math.min(o,r/1e3);let a=null;o>=3600&&(a=_e(Math.floor(o/3600))),o%=3600;const l=_e(Math.floor(o/60));o%=60;const c=_e(Math.floor(o));return null!==a?`${a}:${l}:${c}`:`${l}:${c}`}_updateRendererData(e,t,i){var r;if(e.visible=!1,t.visible=!1,!this._source.isVisible())return;const n=this._source.properties().childs();if(!ve&&12===n.style.value())return;const o=this._model.timeScale().visibleBarsStrictRange(),a=this._source.data().last();if(null===o||null===a)return;if(this._options.visibleOnHistoryOnly&&o.contains(a.index))return;const l=this._model.properties().childs().scalesProperties.childs();let c=l.showSeriesLastValue.value(),h=this._isCountdownEnabled()&&n.showCountdown.value()&&(12===(d=n.style.value())?ve:(0,g.isTimeBasedStyle)(d))&&(this._options.alwaysShowGlobalLast||o.contains(a.index));var d;let u=this._options.showSymbolLabel&&l.showSymbolLabels.value();const p=l.seriesLastValueMode.value()===pe.PriceAxisLastValueMode.LastPriceAndPercentageValue,_=this._source.lastValueData(void 0,this._options.alwaysShowGlobalLast);if(_.noData)return;const m=8===n.style.value()
;if((c||h||u)&&m&&n.haStyle.childs().showRealLastPrice.value()){const e=this._source.lastValueData(void 0,!1),t=this._source.lastValueData(void 0,!0);e.noData||t.noData||e.index!==t.index||(c=!1,h=!1,u=!1)}const f=(0,de.resetTransparency)(this._source.priceLineColor(_.color));if(this._options.useSolidBodyColor?(i.background=f,i.borderColor=void 0):(i.background=this._model.backgroundColorAtYPercentFromTop((null!==(r=i.fixedCoordinate)&&void 0!==r?r:i.coordinate)/(0,s.ensureNotNull)(this._model.paneForSource(this._source)).height()),i.borderColor=f),i.coordinate=_.coordinate,i.floatCoordinate=_.floatCoordinate,c||h){const t=this._axisFirstLineText(_,c);e.text=t,this._options.useSolidBodyColor?(i.textColor=this.generateTextColor(i.background),e.borderVisible=!1):(e.borderVisible=!0,i.textColor=f),e.textColor=i.textColor;const s=c&&p?(0,me.getOppositeModePriceText)(this._source.priceScale(),_):"";e.secondLine=s,i.secondLineTextColor=i.textColor;const r=h?this._countdownText():"";this._previousCountdown=r,e.thirdLine=r,i.thirdLineTextColor=(0,de.generateColor)(i.textColor,25),0===t.length&&0===s.length&&0===r.length||(e.visible=!0)}u&&(t.text=this._paneText(u),t.visible=t.text.length>0)}_paneText(e){let t="";const i=this._source.symbolInfo();return fe?t=(0,g.displayedSymbolExchange)(i):e&&(t=(0,g.displayedSymbolName)(i)),t}_axisFirstLineText(e,t){return t?(0,me.getCurrentModePriceText)(this._source.priceScale(),e):""}_currentTime(){return window.ChartApiInstance.serverTime()}}var be=i(18112),we=i(37626);class Ce extends Se{lastPrice(){return this._getSource().data().lastProjectionPrice}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const r=this._getModel(),n=this._getSource(),o=n.priceScale(),a=r.timeScale(),l=this.lastPrice();if(a.isEmpty()||o.isEmpty()||void 0===l)return;const c=a.visibleBarsStrictRange();if(null===c)return;const h=c.firstBar(),d=c.lastBar(),u=n.data(),_=u.search(d,p.PlotRowSearchMode.NearestLeft);if(null===_)return;const m=n.nearestIndex(h,p.PlotRowSearchMode.NearestRight);if(void 0===m)return;const g=n.model().properties().childs().scalesProperties.childs(),f=(0,s.ensureNotNull)(u.valueAt(m))[4];let v=i.background,y=g.showSeriesLastValue.value(),S=!1,b=!1,w=!1;const C=n.lastValueData(4,!1),P=n.properties().childs();if(8===P.style.value()&&P.haStyle.childs().showRealLastPrice.value()){const e=n.lastValueData(4,!0);if(e.noData||e.color===i.background||(v=(0,de.resetTransparency)(e.color)),!e.noData&&!C.noData){const t=e.index===C.index;S=t&&g.showSymbolLabels.value(),b=g.seriesLastValueMode.value()===pe.PriceAxisLastValueMode.LastPriceAndPercentageValue,y=y&&t,w=t&&this._isCountdownEnabled()&&P.showCountdown.value()}}else{const e=n.barColorer().barStyle(_.index,!0);v=(0,de.resetTransparency)(e.barColor)}if(i.background=v,i.textColor=this.generateTextColor(v),i.secondLineTextColor=i.textColor,i.thirdLineTextColor=(0,de.generateColor)(i.textColor,25),i.coordinate=o.priceToCoordinate(l,f),e.visible=y||w,!C.noData){const i=n.priceScale().isPercentage()
;C.formattedPriceAbsolute=o.formatPriceAbsolute(l),C.formattedPricePercentage=o.formatPricePercentage(l,f,{signPositive:!0}),C.text=i?C.formattedPricePercentage:C.formattedPriceAbsolute,e.text=this._axisFirstLineText(C,y),e.secondLine=y&&b?i?C.formattedPriceAbsolute:C.formattedPricePercentage:"",e.thirdLine=w?this._countdownText():"",t.text=this._paneText(S)}t.visible=S}}var Pe=i(65458),xe=i(52397),Te=i(19625),Ie=i(51056);const Me={light:{lineStyle:Ie.LINESTYLE_DOTTED,lineWidth:1,backgroundColor:Te.colorsPalette["color-tv-blue-50"],lineColor:Te.colorsPalette["color-cold-gray-500"]},dark:{lineStyle:Ie.LINESTYLE_DOTTED,lineWidth:1,backgroundColor:Te.colorsPalette["color-tv-blue-a800"],lineColor:Te.colorsPalette["color-cold-gray-500"]}};function Ae(e){return e?Me.dark:Me.light}class Le extends xe.HorizontalLinePaneView{constructor(e,t,i){super(),this._model=e,this._isVisible=t.lineVisible,this._lineColor=t.lineColor,this._lineWidth=t.lineWidth,this._getValue=i}_updateImpl(){const e=this._lineRendererData;if(e.visible=!1,!this._isVisible.value())return;const t=this._model.mainSeries(),i=t.priceScale(),s=t.firstValue(),r=this._getValue();if(null===s||null===r)return;const n=Ae(this._model.dark().value()),o=this._lineColor.value()||n.lineColor,a=this._lineWidth.value()||n.lineWidth;e.visible=!0,e.y=i.priceToCoordinate(r,s),e.linestyle=n.lineStyle,e.linewidth=a,e.color=o}}class ke extends ue.PriceAxisView{constructor(e,t,i,s){super(),this._model=e,this._label=t,this._isVisible=i.labelVisible,this._backgroundColor=i.lineColor,this._getValue=s}_updateRendererData(e,t,i){if(e.visible=!1,t.visible=!1,!this._isVisible.value())return;const s=this._model.mainSeries(),r=s.priceScale(),n=s.firstValue(),o=this._getValue();if(null===n||null===o)return;const a=Ae(this._model.dark().value()),l=(0,de.resetTransparency)(this._backgroundColor.value()||a.backgroundColor);e.visible=!0,t.visible=!0,e.text=r.formatPriceAbsolute(o),t.text=this._label,i.coordinate=r.priceToCoordinate(o,n),i.background=l,i.textColor=this.generateTextColor(l)}}class De extends we.PriceLineAxisView{constructor(e,t,i){super(),this._model=e,this._isLineVisible=t,this._getValue=i}_isVisible(){return this._isLineVisible.value()}_lineWidth(){return Ae(this._model.dark().value()).lineWidth}_lineStyle(){return Ae(this._model.dark().value()).lineStyle}_priceLineColor(e){return Ae(this._model.dark().value()).lineColor}_value(){const e=this._model.mainSeries(),t=e.priceScale(),i=e.firstValue(),s=this._getValue();if(null===i||null===s)return{noData:!0};const r=t.priceToCoordinate(s,i);return{noData:!1,floatCoordinate:r,coordinate:r,color:"",formattedPricePercentage:"",formattedPriceAbsolute:"",formattedPriceIndexedTo100:"",text:"",index:0}}}var Ee;!function(e){e[e.High=0]="High",e[e.Low=1]="Low"}(Ee||(Ee={}));const Ve=b.t(null,void 0,i(78254)),Be=b.t(null,void 0,i(65318));function Re(e,t,i,s){const r=new Le(e,i,s),n=new ke(e,i.label,i,s);return{paneView:r,panePriceAxisView:new Pe.PanePriceAxisView(n,t,e),priceAxisView:n,priceLineAxisView:new De(e,i.lineVisible,s)}}const Ne={
light:{lineStyle:Ie.LINESTYLE_DOTTED,lineWidth:1,textColor:(0,Te.getHexColorByName)("color-cold-gray-900"),backgroundColor:(0,Te.getHexColorByName)("color-tv-blue-50"),lineColor:(0,Te.getHexColorByName)("color-cold-gray-500")},dark:{lineStyle:Ie.LINESTYLE_DOTTED,lineWidth:1,textColor:(0,Te.getHexColorByName)("color-white"),backgroundColor:(0,Te.getHexColorByName)("color-tv-blue-a800"),lineColor:(0,Te.getHexColorByName)("color-cold-gray-500")}};function Oe(e){return e?Ne.dark:Ne.light}class Fe extends xe.HorizontalLinePaneView{constructor(e,t,i){super(),this._model=e,this._isVisible=t.lineVisible,this._lineColor=t.lineColor,this._lineWidth=t.lineWidth,this._getValue=i}_updateImpl(){const e=this._lineRendererData;if(e.visible=!1,!this._isVisible.value())return;const t=this._model.mainSeries(),i=t.priceScale(),s=t.firstValue(),r=this._getValue();if(null===s||null===r)return;const n=Oe(this._model.dark().value()),o=this._lineColor.value()?this._lineColor.value():n.lineColor,a=this._lineWidth.value()?this._lineWidth.value():n.lineWidth;e.visible=!0,e.y=i.priceToCoordinate(r,s),e.linestyle=n.lineStyle,e.linewidth=a,e.color=o}}class We extends ue.PriceAxisView{constructor(e,t,i,s){super(),this._model=e,this._label=t,this._isVisible=i,this._getValue=s}_updateRendererData(e,t,i){if(e.visible=!1,t.visible=!1,!this._isVisible.value())return;const s=this._model.mainSeries(),r=s.priceScale(),n=s.firstValue(),o=this._getValue();if(null===n||null===o)return;const a=Oe(this._model.dark().value());e.visible=!0,t.visible=!0,e.text=r.formatPriceAbsolute(o),t.text=this._label,i.coordinate=r.priceToCoordinate(o,n),i.background=a.backgroundColor,i.textColor=a.textColor}}class He extends we.PriceLineAxisView{constructor(e,t,i){super(),this._model=e,this._isLineVisible=t,this._getValue=i}_isVisible(){return this._isLineVisible.value()}_lineWidth(){return Oe(this._model.dark().value()).lineWidth}_lineStyle(){return Oe(this._model.dark().value()).lineStyle}_priceLineColor(e){return Oe(this._model.dark().value()).lineColor}_value(){const e=this._model.mainSeries(),t=e.priceScale(),i=e.firstValue(),s=this._getValue();if(null===i||null===s)return{noData:!0};const r=t.priceToCoordinate(s,i);return{noData:!1,floatCoordinate:r,coordinate:r,color:"",formattedPricePercentage:"",formattedPriceAbsolute:"",formattedPriceIndexedTo100:"",text:"",index:0}}}var ze;!function(e){e[e.Avg=0]="Avg"}(ze||(ze={}));const Ue=b.t(null,void 0,i(73025));function je(e,t,i,s){const r=i.childs(),n=function(e,t,i,s){const r=new Fe(e,i,s),n=new We(e,i.label,i.labelVisible,s),o=new Pe.PanePriceAxisView(n,t,e),a=new He(e,i.lineVisible,s);return{paneView:r,panePriceAxisView:o,priceAxisView:n,priceLineAxisView:a}}(e,t,{label:Ue,labelVisible:r.averageClosePriceLabelVisible,lineVisible:r.averageClosePriceLineVisible,lineColor:r.averagePriceLineColor,lineWidth:r.averagePriceLineWidth},(()=>s(0)));return{paneViews:[n.paneView],panePriceAxisViews:[n.panePriceAxisView],priceAxisViews:[n.priceAxisView],priceLineAxisViews:[n.priceLineAxisView]}}var Ge=i(76748);const qe={open:b.t(null,{
context:"in_legend"},i(46728)),high:b.t(null,{context:"in_legend"},i(43253)),low:b.t(null,{context:"in_legend"},i(89923)),close:b.t(null,{context:"in_legend"},i(2696)),hl2:b.t(null,{context:"in_legend"},i(61372)),hlc3:b.t(null,{context:"in_legend"},i(55096)),ohlc4:b.t(null,{context:"in_legend"},i(94174))};class $e extends Ge.SeriesValuesProvider{constructor(e,t){super(e,t);const i=t.properties().childs().paneProperties.childs().legendProperties.childs();this._showBarChange=i.showBarChange,this._showLastDayChange=i.showLastDayChange,this._showSeriesOHLC=i.showSeriesOHLC,this._showVolume=i.showVolume,this._seriesStyle=e.properties().childs().style;const s=this._emptyValues[0],r=this._emptyValues[1],n=this._emptyValues[2];s.title=qe.open,r.title=qe.high,n.title=qe.low,s.unimportant=!0,r.unimportant=!0,n.unimportant=!0,this._emptyValues[6].title="",this._emptyValues[8].title="",this._emptyValues[4].title=""}getValues(e){var t,i,s;const r=super.getValues(e),n=this._series.style(),o=12!==n,a=this._showSeriesOHLC.value(),l=o&&this._showBarChange.value(),c=o&&this._showLastDayChange.value();if(this._showLastPriceAndChangeOnly()){const e=r[5];return e.visible=e.visible&&a,(t=r[6]).visible&&(t.visible=l),r[8].visible=!1,r}const h=12!==n&&16!==n,d=12!==n,u=this._series.intervalObj().is1Tick(),p=r[7];p.visible=p.visible&&this._showVolume.value();const _=(0,g.isPriceSourceStyle)(this._seriesStyle.value()),m=a&&!_,f=a&&_;if(r[0].visible=m&&h&&!u,r[1].visible=m&&!u,r[2].visible=m&&!u,r[3].visible=m&&d,r[3].title=u?"":qe.close,r[4].visible=f,(i=r[6]).visible&&(i.visible=l),(s=r[8]).visible&&(s.visible=c),16===n){const e=this._series.properties().childs().hlcAreaStyle.childs();r[1].color=e.highLineColor.value(),r[2].color=e.lowLineColor.value(),r[3].color=e.closeLineColor.value()}return r}}var Ke,Ye=i(52033),Ze=i(76350),Xe=i(73698),Je=i(86441);class Qe{constructor(){this._data=null}setData(e){this._data=e}data(){return this._data}draw(e,t){const i=this._data;if(null===i)return;const{horizontalPixelRatio:s,verticalPixelRatio:r}=t;e.save();const n=Math.max(1,Math.floor(s)),o=n%2/2,a=Math.round(i.center.x*s)+o,l=i.center.y*r;e.fillStyle=i.seriesLineColor,e.beginPath();const c=Math.max(2,1.5*i.seriesLineWidth)*s;e.arc(a,l,c,0,2*Math.PI,!1),e.fill(),e.fillStyle=i.fillColor,e.beginPath(),e.arc(a,l,i.radius*s,0,2*Math.PI,!1),e.fill(),e.lineWidth=n,e.strokeStyle=i.strokeColor,e.beginPath(),e.arc(a,l,i.radius*s+n/2,0,2*Math.PI,!1),e.stroke(),e.restore()}hitTest(e){return null}}function et(e){return e}!function(e){e[e.AnimationPeriod=2600]="AnimationPeriod",e[e.Stage1Period=.25]="Stage1Period",e[e.Stage2Period=.275]="Stage2Period",e[e.Stage3Period=.475]="Stage3Period",e[e.Stage1StartCircleRadius=4]="Stage1StartCircleRadius",e[e.Stage1EndCircleRadius=10]="Stage1EndCircleRadius",e[e.Stage1StartFillAlpha=.25]="Stage1StartFillAlpha",e[e.Stage1EndFillAlpha=0]="Stage1EndFillAlpha",e[e.Stage1StartStrokeAlpha=.4]="Stage1StartStrokeAlpha",e[e.Stage1EndStrokeAlpha=.8]="Stage1EndStrokeAlpha",e[e.Stage2StartCircleRadius=10]="Stage2StartCircleRadius",
e[e.Stage2EndCircleRadius=14]="Stage2EndCircleRadius",e[e.Stage2StartFillAlpha=0]="Stage2StartFillAlpha",e[e.Stage2EndFillAlpha=0]="Stage2EndFillAlpha",e[e.Stage2StartStrokeAlpha=.8]="Stage2StartStrokeAlpha",e[e.Stage2EndStrokeAlpha=0]="Stage2EndStrokeAlpha",e[e.Stage3StartCircleRadius=14]="Stage3StartCircleRadius",e[e.Stage3EndCircleRadius=14]="Stage3EndCircleRadius",e[e.Stage3StartFillAlpha=0]="Stage3StartFillAlpha",e[e.Stage3EndFillAlpha=0]="Stage3EndFillAlpha",e[e.Stage3StartStrokeAlpha=0]="Stage3StartStrokeAlpha",e[e.Stage3EndStrokeAlpha=0]="Stage3EndStrokeAlpha"}(Ke||(Ke={}));const tt=[{start:0,end:.25,startRadius:4,endRadius:10,startFillAlpha:.25,endFillAlpha:0,startStrokeAlpha:.4,endStrokeAlpha:.8,easing:et},{start:.25,end:.525,startRadius:10,endRadius:14,startFillAlpha:0,endFillAlpha:0,startStrokeAlpha:.8,endStrokeAlpha:0,easing:et},{start:.525,end:1,startRadius:14,endRadius:14,startFillAlpha:0,endFillAlpha:0,startStrokeAlpha:0,endStrokeAlpha:0,easing:et}];function it(e,t,i,s){const r=i+(s-i)*t;return(0,de.applyTransparency)(e,(0,de.alphaToTransparency)(r))}const st=(0,Te.getHexColorByName)("color-minty-green-400"),rt=(0,Te.getHexColorByName)("color-ripe-red-500");function nt(e,t,i){const s=e%2600/2600;let r;for(const e of tt)if(s>=e.start&&s<=e.end){r=e;break}if(void 0===r)throw new Error("Last price animation internal logic error");const n=r.easing((s-r.start)/(r.end-r.start));return{fillColor:it(i,n,r.startFillAlpha,r.endFillAlpha),strokeColor:it(i,n,r.startStrokeAlpha,r.endStrokeAlpha),radius:(o=n,a=r.startRadius,l=r.endRadius,a+(l-a)*o)};var o,a,l}class ot{constructor(e){this._renderer=new Qe,this._invalidated=!0,this._stageInvalidated=!0,this._startTime=performance.now(),this._endTime=this._startTime-1,this._prevRenderedPrice=null,this._series=e}update(e){if(this._invalidated=!0,"data-source-change"===e.type&&e.sourceId===this._series.id()&&e.realtime&&this._series.seriesLoaded()){const e=performance.now(),t=this._endTime-e;if(t>0)return void(t<650&&(this._endTime+=2600));this._startTime=e,this._endTime=e+2600}}invalidateStage(){this._stageInvalidated=!0}animationActive(){return performance.now()<=this._endTime}stopAnimation(){this._endTime=this._startTime-1}renderer(e){return this._invalidated?(this._updateImpl(e),this._invalidated=!1,this._stageInvalidated=!1):this._stageInvalidated&&(this._updateRendererDataStage(),this._stageInvalidated=!1),this._renderer}_updateImpl(e){this._renderer.setData(null);const t=this._series.model().timeScale(),i=t.visibleBarsStrictRange(),s=this._series.firstValue(),r=this._series.lastValueData(void 0,!0,!0);if(null===i||null===s||void 0===r.index||void 0===r.price||!i.contains(r.index))return;const n=new Je.Point(t.indexToCoordinate(r.index),this._series.priceScale().priceToCoordinate(r.price,s)),o=r.color,a=this._series.properties().childs();let l;switch(this._series.style()){case 3:l=a.areaStyle.childs().linewidth.value();break;case 10:const t=a.baselineStyle,i=Math.round(e.mediaSize.height*(Math.abs(100-t.childs().baseLevelPercentage.value())/100))
;l=n.y<=i?t.childs().topLineWidth.value():t.childs().bottomLineWidth.value();break;case 14:l=a.lineWithMarkersStyle.childs().linewidth.value();break;case 15:l=a.steplineStyle.childs().linewidth.value();break;default:l=a.lineStyle.childs().linewidth.value()}this._lastBaseColor=null===this._prevRenderedPrice||this._prevRenderedPrice===r.price?o:this._prevRenderedPrice<r.price?st:rt;const c=nt(this._duration(),0,this._lastBaseColor);this._renderer.setData({seriesLineColor:o,seriesLineWidth:l,fillColor:c.fillColor,strokeColor:c.strokeColor,radius:c.radius,center:n}),this._prevRenderedPrice=r.price}_updateRendererDataStage(){const e=this._renderer.data();if(null!==e){const t=nt(this._duration(),e.seriesLineColor,this._lastBaseColor);e.fillColor=t.fillColor,e.strokeColor=t.strokeColor,e.radius=t.radius}}_duration(){return this.animationActive()?performance.now()-this._startTime:2599}}var at=i(62288),lt=i(64147),ct=i(18172),ht=i(4340);class dt{constructor(){this._created=new Ye.Delegate,this._modified=new Ye.Delegate,this._loading=new Ye.Delegate,this._completed=new Ye.Delegate,this._error=new Ye.Delegate,this._symbolError=new Ye.Delegate,this._symbolResolved=new Ye.Delegate,this._seriesError=new Ye.Delegate,this._symbolNotPermitted=new Ye.Delegate,this._symbolInvalid=new Ye.Delegate,this._symbolGroupNotPermitted=new Ye.Delegate,this._chartTypeNotPermitted=new Ye.Delegate,this._intradaySpreadNotPermitted=new Ye.Delegate,this._intradayExchangeNotPermitted=new Ye.Delegate,this._customIntervalNotPermitted=new Ye.Delegate,this._secondsIntervalNotPermitted=new Ye.Delegate,this._ticksIntervalNotPermitted=new Ye.Delegate,this._barReceived=new Ye.Delegate,this._seriesTimeFrame=new Ye.Delegate,this._dataUpdated=new Ye.Delegate,this._unsupportedResolutionRequested=new Ye.Delegate}destroy(){this._created.destroy(),this._modified.destroy(),this._loading.destroy(),this._completed.destroy(),this._error.destroy(),this._symbolError.destroy(),this._symbolResolved.destroy(),this._seriesError.destroy(),this._symbolInvalid.destroy(),this._symbolNotPermitted.destroy(),this._symbolGroupNotPermitted.destroy(),this._chartTypeNotPermitted.destroy(),this._intradaySpreadNotPermitted.destroy(),this._intradayExchangeNotPermitted.destroy(),this._customIntervalNotPermitted.destroy(),this._secondsIntervalNotPermitted.destroy(),this._ticksIntervalNotPermitted.destroy(),this._barReceived.destroy(),this._seriesTimeFrame.destroy(),this._dataUpdated.destroy(),this._unsupportedResolutionRequested.destroy()}created(){return this._created}modified(){return this._modified}loading(){return this._loading}completed(){return this._completed}error(){return this._error}symbolError(){return this._symbolError}symbolResolved(){return this._symbolResolved}seriesError(){return this._seriesError}symbolInvalid(){return this._symbolInvalid}symbolNotPermitted(){return this._symbolNotPermitted}symbolGroupNotPermitted(){return this._symbolGroupNotPermitted}chartTypeNotPermitted(){return this._chartTypeNotPermitted}intradaySpreadNotPermitted(){
return this._intradaySpreadNotPermitted}intradayExchangeNotPermitted(){return this._intradayExchangeNotPermitted}customIntervalNotPermitted(){return this._customIntervalNotPermitted}secondsIntervalNotPermitted(){return this._secondsIntervalNotPermitted}ticksIntervalNotPermitted(){return this._ticksIntervalNotPermitted}barReceived(){return this._barReceived}seriesTimeFrame(){return this._seriesTimeFrame}dataUpdated(){return this._dataUpdated}unsupportedResolutionRequested(){return this._unsupportedResolutionRequested}fireCompleted(e){this._completed.fire(e)}fireCreated(e){this._created.fire(e)}fireModified(){this._modified.fire()}fireLoading(e){this._loading.fire(e)}fireError(){this._error.fire()}fireSymbolError(e){this._symbolError.fire(e),this.fireError()}fireSymbolResolved(e){this._symbolResolved.fire(e)}fireSeriesError(e){this._seriesError.fire(e),this.fireError()}fireSymbolInvalid(){this._symbolInvalid.fire()}fireSymbolNotPermitted(e){this._symbolNotPermitted.fire(e)}fireSymbolGroupNotPermitted(e){this._symbolGroupNotPermitted.fire(e)}fireChartTypeNotPermitted(e){this._chartTypeNotPermitted.fire(e),this.fireError()}fireIntradaySpreadNotPermitted(){this._intradaySpreadNotPermitted.fire(),this.fireError()}fireIntradayExchangeNotPermitted(){this._intradayExchangeNotPermitted.fire(),this.fireError()}fireCustomIntervalNotPermitted(e){this._customIntervalNotPermitted.fire(e),this.fireError()}fireSecondsIntervalNotPermitted(){this._secondsIntervalNotPermitted.fire(),this.fireError()}fireTicksIntervalNotPermitted(){this._ticksIntervalNotPermitted.fire(),this.fireError()}fireBarReceived(e){this._barReceived.fire(e)}fireSeriesTimeFrame(e,t,i,s,r){this._seriesTimeFrame.fire(e,t,i,s,r)}fireDataUpdated(e,t,i,s){this._dataUpdated.fire(e,t,i,s)}fireUnsupportedResolutionRequested(){this._unsupportedResolutionRequested.fire()}}var ut=i(52270);const pt=(0,a.getLogger)("Chart.SeriesDataSource");var _t;!function(e){e[e.Idle=0]="Idle",e[e.AwaitingConnection=1]="AwaitingConnection",e[e.AwaitingFirstDataUpdate=2]="AwaitingFirstDataUpdate",e[e.Active=3]="Active"}(_t||(_t={}));let mt=1;let gt=1;function ft(e){return e.startDate?e.endDate||e.count?e.endDate?["from_to",e.startDate,e.endDate]:["bar_count",e.startDate,(0,s.ensure)(e.count)]:["from_to",e.startDate]:e.count||300}function vt(e){return(0,le.isString)(e.symbol)?e.symbol:e.symbol.symbol}function yt(e,t){(0,le.isString)(e.symbol)?e.symbol=t:e.symbol.symbol=t}class St{constructor(e,t,i,s){this._extSymbol=null,this._lastResolvedSymbol="",this._createSeriesOverriddenParams=0,this._instanceId=null,this._symbolInstanceId=null,this._resolution=null,this._timeFrame=null,this._data=new d.SeriesData,this._dataEvents=new dt,this._status=_t.Idle,this._turnaroundCounter=1,this._boundOnGatewayIsConnectedChanged=this._onGatewayIsConnectedChanged.bind(this),this._ongoingDataUpdate=Promise.resolve(),this._gateway=e,this._turnaroundPrefix=t,this._createSeriesParams=ft(null!=i?i:{count:300}),this._timeFrame=s||null,this._gateway.isConnected().subscribe(this._boundOnGatewayIsConnectedChanged)}
destroy(){this.stop(),this._gateway.isConnected().unsubscribe(this._boundOnGatewayIsConnectedChanged)}modifySeries(e,t,i=null,r=!1,n=null){r&&(pt.logNormal("Due to force flag clearing symbol & resolution to force re-requesting data."),this._extSymbol=null,this._resolution=null);const o=vt(e),a=!this.symbolSameAsResolved(o);if(a&&(this._lastResolvedSymbol=""),this._extSymbol&&!a){yt(e,vt(this._extSymbol))}const l=this._extSymbol,c=this._resolution;if(this._extSymbol=e,this._resolution=t,null===this._instanceId)return void(this._timeFrame=i);const h=!(0,le.deepEquals)(l,e)[0];h&&yt(this._extSymbol,o);const d=null===c||!Z.Interval.isEqual(c,t);(h||d||null!==i)&&(this._timeFrame=null,(h||d)&&this._turnaroundCounter++,h&&this._resolveSymbol(),this._gateway.modifySeries(this._instanceId,this.turnaround(),(0,s.ensureNotNull)(this._symbolInstanceId),this._resolution,n,i,this._onMessage.bind(this)),this._dataEvents.fireModified())}requestMoreData(e){null!==this._instanceId&&this._gateway.requestMoreData(this._instanceId,e,this._onMessage.bind(this))}requestMoreTickmarks(e){null!==this._instanceId&&this._gateway.requestMoreTickmarks(this._instanceId,e,this._onMessage.bind(this))}setFutureTickmarksMode(e){null!==this._instanceId&&this._gateway.setFutureTickmarksMode(e)}isStarted(){return this._status!==_t.Idle}isActive(){return this._status===_t.Active}resolution(){return this._resolution}start(){this.isStarted()?pt.logNormal("start: data source is already started, nothing to do"):((0,s.assert)(null!==this._extSymbol,"symbol must be set before start"),(0,s.assert)(null!==this._resolution,"resolution must be set before start"),this._gateway.isConnected().value()?this._createSeries():this._changeStatusTo(_t.AwaitingConnection))}stop(){this.isStarted()?(null!==this._instanceId&&(this._gateway.removeSeries(this._instanceId),this._instanceId=null),this._symbolInstanceId=null,this._changeStatusTo(_t.Idle)):pt.logNormal("stop: data source is already stopped, nothing to do")}instanceId(){return this._instanceId}data(){return this._data}setData(e){this._data=e}clearData(){this.isStarted()?this._enqueueUpdate((()=>this._clearDataImpl())):this._clearDataImpl()}dataEvents(){return this._dataEvents}turnaround(){return`${this._turnaroundPrefix}${this._turnaroundCounter}`}symbolInstanceId(){return this._symbolInstanceId}symbol(){return this._extSymbol}moveData(e){this._enqueueUpdate((()=>this._data.moveData(e)))}setInitialRequestOptions(e){this._createSeriesOverriddenParams=ft(e)}symbolSameAsResolved(e){return null!==this._extSymbol&&(0,ut.symbolSameAsResolved)(e,vt(this._extSymbol),this._lastResolvedSymbol)}resolvedSymbol(){return null===this._extSymbol?null:vt(this._extSymbol)}_resolveSymbol(){null!==this._extSymbol&&(this._symbolInstanceId=this._gateway.resolveSymbol("sds_sym_"+mt++,(0,Xe.encodeExtendedSymbolOrGetSimpleSymbolString)(this._extSymbol),this._onMessage.bind(this)))}_clearDataImpl(){this._data.clear()}_changeStatusTo(e){(0,s.assert)(this._status!==e,"Source and destination status should be distinct"),
pt.logNormal(`Status changed from ${_t[this._status]} to ${_t[e]}`),this._status=e}_createSeries(){(0,s.assert)(this._status!==_t.Active,'Status should not be "Active" when creating a study'),this._instanceId="sds_"+gt++,this._resolveSymbol();const e=this._createSeriesOverriddenParams||this._createSeriesParams;this._createSeriesOverriddenParams&&(this._createSeriesOverriddenParams=0),this._gateway.createSeries(this._instanceId,this.turnaround(),(0,s.ensureNotNull)(this._symbolInstanceId),(0,s.ensureNotNull)(this._resolution),e,this._timeFrame,this._onMessage.bind(this)),this._timeFrame=null,this._changeStatusTo(_t.AwaitingFirstDataUpdate),this._dataEvents.fireCreated(this._instanceId)}_onGatewayIsConnectedChanged(e){e?this._onGatewayConnected():this._onGatewayDisconnected()}_onGatewayConnected(){this._status===_t.AwaitingConnection&&this._createSeries()}_onGatewayDisconnected(){this._status!==_t.Idle&&this._status!==_t.AwaitingConnection&&(this._instanceId=null,this._changeStatusTo(_t.AwaitingConnection)),this._turnaroundCounter=1}_onMessage(e){this._enqueueUpdate((()=>this._onMessageImpl(e)))}async _onMessageImpl(e){switch(e.method){case"symbol_resolved":{const[t,i]=e.params;if(t!==this._symbolInstanceId){null!==this._symbolInstanceId&&pt.logNormal(`Resolve for old symbol, expected: ${this._symbolInstanceId}, actual ${e.params[0]}`);break}this._onSymbolResolved(i);break}case"symbol_error":if(e.params[0]!==this._symbolInstanceId){null!==this._symbolInstanceId&&pt.logNormal(`Symbol error for old symbol, expected: ${this._symbolInstanceId}, actual ${e.params[0]}`);break}this._onSymbolError(e);break;case"series_timeframe":{const[t,i,s,r,n,o,a]=e.params;if(!this._checkTurnaround(t,i)){pt.logNormal(`Time frame for old data, expected: ${this._symbolInstanceId} (${this.turnaround()}), actual ${t} (${i})`);break}this._onSeriesTimeFrame(s,r,n,o,a);break}case"series_error":{const[t,i]=e.params;if(!this._checkTurnaround(t,i)){pt.logNormal(`Series error for old data, expected: ${this._symbolInstanceId} (${this.turnaround()}), actual ${t} (${i})`);break}this._onSeriesError(e.params[2]);break}case"series_loading":{const[t,i]=e.params;if(!this._checkTurnaround(t,i))break;this._onSeriesLoading(e.time);break}case"series_completed":{const[t,i,s,r]=e.params;if(!this._checkTurnaround(t,s)){pt.logNormal(`Series completed for old data, expected: ${this._symbolInstanceId} (${this.turnaround()}), actual ${t} (${s})`);break}this._onSeriesCompleted(i,e.time,r);break}case"data_update":if(!this._checkTurnaround(e.params.customId,e.params.turnaround)){pt.logNormal(`Data update for old data, expected: ${this._symbolInstanceId} (${this.turnaround()}), actual ${e.params.customId} (${e.params.turnaround})`);break}await this._onDataUpdate(e.params.plots,e.params.nonseries,e.params.lastBar);break;case"clear_data":if(e.params.turnaround!==this.turnaround()){pt.logNormal(`Clear data for old data, expected: ${this.turnaround()}, actual ${e.params.turnaround}`);break}this._clearDataImpl(),this._dataEvents.fireDataUpdated(void 0,!1,null,!1)}}
_onSeriesError(e){let t,i;if("string"==typeof e)i={error:e},t=e;else if(i=e,e.ctx){const i={};Object.entries(e.ctx).forEach((([e,t])=>{i[e]=t.toString()})),t=e.error.format(i)}else t=e.error;if(t.startsWith("study_not_auth:")){const e=t.split(":",2)[1].split("@",2)[0];if(["BarSetRenko","BarSetPriceBreak","BarSetKagi","BarSetPnF"].includes(e))this._dataEvents.fireChartTypeNotPermitted(e);else if("BarSetSpread"===e)this._dataEvents.fireIntradaySpreadNotPermitted();else if("BarSetRange"===e){const e=`${(0,s.ensureNotNull)(this._extSymbol).inputs.range}R`;this._dataEvents.fireCustomIntervalNotPermitted(e)}}else{if(t.startsWith("unsupported"))return void this._dataEvents.fireUnsupportedResolutionRequested();"resolution_not_entitled"===t?this._dataEvents.fireIntradayExchangeNotPermitted():"custom_resolution"===t?this._dataEvents.fireCustomIntervalNotPermitted((0,s.ensureNotNull)(this._resolution)):"seconds_not_entitled"===t?this._dataEvents.fireSecondsIntervalNotPermitted():"ticks_not_entitled"===t&&this._dataEvents.fireTicksIntervalNotPermitted()}this._dataEvents.fireSeriesError(i)}_onSeriesTimeFrame(e,t,i,s,r){this._dataEvents.fireSeriesTimeFrame(e,t,i,null==s||s,r)}_onSymbolError(e){if(e.params[1]===ht.permissionDenied)switch(e.params[2]){case ht.SymbolErrorPermissionDeniedReason.Symbol:this._dataEvents.fireSymbolNotPermitted(e.params[3]);break;case ht.SymbolErrorPermissionDeniedReason.GroupPermission:this._dataEvents.fireSymbolGroupNotPermitted(e.params[3]);break;default:this._dataEvents.fireSymbolNotPermitted(e.params[2])}else e.params[1]===ht.invalidSymbol&&this._dataEvents.fireSymbolInvalid();this._dataEvents.fireSymbolError(e.params[1])}_onSymbolResolved(e){this._lastResolvedSymbol=(0,s.ensureNotNull)((0,g.extractSymbolNameFromSymbolInfo)(e,"")),this._dataEvents.fireSymbolResolved(e)}async _onDataUpdate(e,t,i){this._onDataUnpacked(e,i,await async function(e){if(void 0===e)return{projectionPlots:[],boxSize:null};if(""===e.d||"nochange"===e.indexes)return null;const t=await(0,ct.unpackNonSeriesData)(e.d);if(null===t||t.indexes_replace)return null;const i=e.indexes,{bars:s,price:r,boxSize:n,reversalAmount:o}=t.data,a=(s||[]).map((e=>{let t;return"factor"in e?t=e.factor:"additionalPrice"in e&&(t=e.additionalPrice),{index:i[e.time],value:[0,e.open,e.high,e.low,e.close,e.volume,t]}}));return{lastPrice:r,projectionPlots:a,reversalAmount:o,boxSize:n}}(t))}_enqueueUpdate(e){return this._ongoingDataUpdate=this._ongoingDataUpdate.then(e,e),this._ongoingDataUpdate}_onDataUnpacked(e,t,i){if(this._status===_t.Idle)return;this._status===_t.AwaitingFirstDataUpdate&&(this._changeStatusTo(_t.Active),this._clearDataImpl());const s=this._data.bars().size(),r=this._data.bars().firstIndex(),n=this._data.mergeRegularBars(e);null!==i&&(this._data.nsBars().clear(),this._data.nsBars().merge(i.projectionPlots),this._data.lastProjectionPrice=i.lastPrice,null!==i.boxSize&&(this._data.boxSize=i.boxSize),this._data.reversalAmount=i.reversalAmount);const o=null===r,a=o||null!==n&&n.index<r;this._dataEvents.fireDataUpdated(t,a,n,o),
s!==this._data.bars().size()&&null!==n&&this._dataEvents.fireBarReceived(n)}_onSeriesLoading(e){this._dataEvents.fireLoading(e)}_onSeriesCompleted(e,t,i){this._dataEvents.fireCompleted({updateMode:e,time:t,flags:i})}_checkTurnaround(e,t){return this._instanceId===e&&(void 0===t||t===this.turnaround())}}var bt=i(10074);class wt extends xe.HorizontalLinePaneView{constructor(e){super(),this._series=e,this._model=e.model()}}const Ct=w.enabled("chart_style_hilo_last_price");class Pt extends wt{constructor(e){super(e),this._lineRendererData.linestyle=Ie.LINESTYLE_DOTTED}_updateImpl(){this._lineRendererData.visible=!1;const e=this._series.properties().childs();if(!e.showPriceLine.value())return;if(!Ct&&12===e.style.value())return;const t=this._series.lastValueData(void 0,!0);t.noData||(this._lineRendererData.visible=!0,this._lineRendererData.y=t.coordinate,this._lineRendererData.color=this._series.priceLineColor(t.color),this._lineRendererData.linewidth=e.priceLineWidth.value())}}var xt=i(12374),Tt=i(83379),It=i(53766),Mt=i(99800),At=i(72476),Lt=i(80941),kt=i(84626),Dt=i(70527),Et=i(95201),Vt=i(61993),Bt=i(11064),Rt=i(25201);class Nt extends At.SeriesCandlesPaneView{renderer(){this._invalidated&&(this._updateImpl(null),this._invalidated=!1);const e=this._source.priceScale();if(!e)return null;const t=this._source.properties().childs().haStyle.childs(),i=this._model.timeScale().barSpacing(),s={bars:this._bars,barSpacing:i,bodyVisible:t.drawBody.value(),borderVisible:t.drawBorder.value(),borderColor:t.borderColor.value(),wickColor:t.wickColor.value(),barWidth:(0,Vt.optimalBarWidth)(i),wickVisible:t.drawWick.value(),isPriceScaleInverted:e.isInverted()},r=new Et.CompositeRenderer;return r.append(new Rt.PaneRendererCandles(s)),this._model.selection().isSelected(this._source)&&this._isMarkersEnabled&&this._selectionData&&r.append(new Bt.SelectionRenderer(this._selectionData)),r}}var Ot=i(15599),Ft=i(93250),Wt=i(15716),Ht=i(90799),zt=i(72708),Ut=i(24526),jt=i(88145),Gt=(i(20596),i(19466)),qt=i(42989);class $t extends wt{constructor(e){super(e)}_updateImpl(){this._lineRendererData.visible=!1;const e=this._series.priceScale().mode();if(!e.percentage&&!e.indexedTo100)return;const t=this._series.firstValue();null!==t&&(this._lineRendererData.visible=!0,this._lineRendererData.y=this._series.priceScale().priceToCoordinate(t,t),this._lineRendererData.color=this._series.properties().childs().baseLineColor.value())}}var Kt=i(88960),Yt=i(678);const Zt=w.enabled("price_scale_always_last_bar_value"),Xt=w.enabled("display_data_mode"),Jt=(r.CheckMobile.any(),!w.enabled("hide_series_legend_item")),Qt=w.enabled("hide_price_scale_global_last_bar_value"),ei=w.enabled("show_average_close_price_line_and_label"),ti=w.enabled("no_bars_status"),ii=w.enabled("charting_library_debug_mode"),si=w.enabled("chart_style_hilo_last_price"),ri=(0,a.getLogger)("Chart.Series"),ni=w.enabled("pre_post_market_sessions");const oi={countdownEnabled:!0,lastPriceAnimationEnabled:!0};function ai(e,t,i){return void 0===t?null:`${e}=${t} (${i?"changed":"unchanged"})`}
function li(e){const t=e.state();return t.data.forEach((e=>e.value.splice(7,1))),t}function ci(e){const{seriesStatus:t,additionalStudyStatus:i}=e;if(y.seriesLoadingStatuses.has(t))return 2;if(i){if(4!==t&&i.type===Yt.StudyStatusType.Error)return 13;if(y.seriesReadyStatuses.has(t)&&(i.type===Yt.StudyStatusType.Loading||i.type===Yt.StudyStatusType.Undefined))return 2}return t}class hi extends c.PriceDataSource{constructor(e,t,i,r){var n,o,a;t.removeProperty("currencyId"),super(e,"_seriesId"),this.requestingStyleIsNotSupported=new Ye.Delegate,this.requestingStyleSupportRecovered=new Ye.Delegate,this._paneView=null,this._futureBarsPaneView=null,this._projectionBarsPaneView=null,this._waterlineView=null,this._priceLineView=null,this._gotoDateView=null,this._baseHorizontalLineView=null,this._priceStep=null,this._symbolInfo=new lt.WatchedValue(null),this._isPrePostMarketPricesAvailableProperty=new m.Property(!1),this._isBackAdjustmentForbiddenProperty=new m.Property(!0),this._isSettlementAsCloseForbiddenProperty=new m.Property(!0),this._highLowPriceCache=new Map,this._averagePriceCache=new Map,this._prevClosePriceAxisView=null,this._priceScaleAboutToBeChanged=new Ye.Delegate,this._onRestarted=new Ye.Delegate,this._onStatusChanged=new Ye.Delegate,this._tagsChanged=new Ye.Delegate,this._intervalChanged=new Ye.Delegate,this._sessionIdChanged=new Ye.Delegate,this._requestMoreDataAvailable=!0,this._lineStyleLastPriceCirclePaneView=new ot(this),this._prevClosePriceLineView=null,this._dataPoweredBy=null,this._symbolResolvingActive=new lt.WatchedValue(!1),this._predictBars=0,this._syncModel=null,this._data=null,this._lastCompleteFlags=null,this._haStyle={studyId:(0,s.ensureNotNull)((0,g.chartStyleStudyId)(8,!0))},this._renkoStyle={studyId:(0,s.ensureNotNull)((0,g.chartStyleStudyId)(4,!0))},this._pbStyle={studyId:(0,s.ensureNotNull)((0,g.chartStyleStudyId)(7,!0))},this._kagiStyle={studyId:(0,s.ensureNotNull)((0,g.chartStyleStudyId)(5,!0))},this._pnfStyle={studyId:(0,s.ensureNotNull)((0,g.chartStyleStudyId)(6,!0))},this._rangeStyle={studyId:(0,s.ensureNotNull)((0,g.chartStyleStudyId)(11,!0))},this._volFootprintStyle={studyId:(0,s.ensureNotNull)((0,g.chartStyleStudyId)(17,!0))},this._tpoStyle={studyId:(0,s.ensureNotNull)((0,g.chartStyleStudyId)(18,!0))},this._svpStyle={studyId:(0,s.ensureNotNull)((0,g.chartStyleStudyId)(20,!0))},this._barColorerCache=null,this._boxSizeValue=new lt.WatchedValue,this._base=100,this._pointValue=1,this._formattingDeps=null,this._defaultFormatter=new v.PriceFormatter({priceScale:this._base}),this._formatter=new v.PriceFormatter({priceScale:this._base}),this._ignoreMinMoveFormatter=new v.PriceFormatter({priceScale:this._base}),this._ignoreMinMovePriceStep=null,this._lastBarCloseTime=null,this._onSessionIdPropertyChangedBound=this._onSessionIdPropertyChanged.bind(this),this._ignoreSessionIdProxyPropertyChanges=!1,this._textSourceIsAlwaysTickerRestrictionEnabled=!1,this._lastPriceAnimationActive=!1,this._currentSession="out_of_session",this._onStyleChanged=new Ye.Delegate,this._intervalObj=null,
this._obsoleteZOrder=0,this._seriesErrorMessage=null,this._seriesAlwaysFalseHibernatedVW=new lt.WatchedValue(!1),this._styleToRecover=null,this._precomputedBarStyles=new WeakMap,this._doNotShowLastAvailableBar=!1,this._gotoDateResultCleared=!1,this._endOfDataPaneView=null,this._pendingTimeRange=null,this._replaySubscriber=new lt.WatchedValue(null),this._symbolIntervalChanged=new Ye.Delegate,this._isReplayResolutionAvailableForUser=null,this._onInReplayStateChanged=new Ye.Delegate,this._replayExitedDueUnsupportedInterval=new Ye.Delegate,this._replayExitedDueUnavailableForUserInterval=new Ye.Delegate,this._onTimeFrameApplied=new Ye.Delegate,this._seriesLoaded=!1,this._seriesCompleted=!1,this._status=new lt.WatchedValue({seriesStatus:0}),this._prevRequestedInterval="",this._isActingAsSymbolSource=new lt.WatchedValue(!0),this._unsupportedResolutionState=new lt.WatchedValue(null),this._countdownUpdateTimer=null,this._deferredDestroyed=(0,l.createDeferredPromise)(),this._volumePointWeights=null,this._studyBindings=null,this._updateTimeScaleTimePointWeights=()=>{0},this._seriesStatus=(0,Kt.combine)(ci,this._status.weakReference()),this._seriesSource=new St(e.chartApi(),"s",r);const c=this._seriesSource.dataEvents();c.symbolResolved().subscribe(this,this._onSymbolResolved),c.symbolError().subscribe(this,this._onSymbolError),c.seriesTimeFrame().subscribe(this,this._onSeriesTimeFrame),c.seriesError().subscribe(this,this._onSeriesError),c.loading().subscribe(this,this._onSeriesLoading),c.completed().subscribe(this,this._onSeriesCompleted),c.dataUpdated().subscribe(this,this._onDataUpdated),c.barReceived().subscribe(this,this._onBarReceived),c.unsupportedResolutionRequested().subscribe(this,this._onUnsupportedResolutionRequested),this._quotesProvider=new he.QuotesProvider(void 0,e.collapsed().spawnOwnership()),this._quotesProvider.quotesUpdate().subscribe(this,this._onQuotesUpdate);const h=t.childs();if(t.hasChild("extendedHours")){(0,s.ensureDefined)(h.extendedHours).value()&&!t.hasChild("sessionId")&&t.addChild("sessionId",new m.Property("extended")),t.removeProperty("extendedHours")}t.hasChild("sessionId")||t.addChild("sessionId",new m.Property(f.SubsessionId.Regular)),(0,qt.allChartStyles)().includes(h.style.value())||h.style.setValueSilently(2);const d=h.lineStyle.childs();if(h.lineStyle.hasChild("styleType")){let e,t;const i=d.styleType.value();0===i&&(t=14,e=h.lineWithMarkersStyle.childs()),1===i&&(t=15,e=h.steplineStyle.childs()),e&&(e.color.setValueSilently(d.color.value()),e.linestyle.setValueSilently(d.linestyle.value()),e.linewidth.setValueSilently(d.linewidth.value()),e.priceSource.setValueSilently(d.priceSource.value())),void 0!==t&&2===h.style.value()&&h.style.setValue(t),h.lineStyle.removeProperty("styleType")}null===(n=this._studyBindings)||void 0===n||n.bindToSeriesProperties(t),this._setProperties(t),this._sessionIdProxyProperty=new m.Property(h.sessionId.value()),h.sessionId.subscribe(this,(()=>this._updateSessionIdProxyProperty())),
this._sessionIdProxyProperty.subscribe(this,this._onSessionIdProxyPropertyChanged),this._symbolTextSourceProxyProperty=new m.Property,this._recalcSymbolTextSourceProxyProperty(),h.statusViewStyle.childs().symbolTextSource.subscribe(this,this._recalcSymbolTextSourceProxyProperty),this._symbolTextSourceProxyProperty.subscribe(this,(()=>e.lightUpdate())),this._options=(0,le.merge)((0,le.clone)(oi),i),this._prevChartStyle=h.style.value(),this._priceAxisView=new Se(this,e,{alwaysShowGlobalLast:!Qt,showCountdown:i.countdownEnabled});let u=null;Zt||Qt||(u=new Se(this,e,{visibleOnHistoryOnly:!0,showSymbolLabel:!1,showCountdown:!1,alwaysShowGlobalLast:!1,useSolidBodyColor:!1})),this._priceLinePriceAxisView=new we.SeriesPriceLineAxisView(this),this._priceLineAxisViews=[this._priceLinePriceAxisView];const p=new Ce(this,e,{showCountdown:i.countdownEnabled});this._priceAxisViews=[this._priceAxisView,p],null!==u&&this._priceAxisViews.push(u),this._panePriceAxisView=new Pe.PanePriceAxisView(this._priceAxisView,this,e),this._historyPricePanePriceAxisView=null!==u?new Pe.PanePriceAxisView(u,this,e):null,this._projectionPriceAxisView=new Pe.PanePriceAxisView(p,this,e),this._labelPaneViews=[this._panePriceAxisView,this._projectionPriceAxisView],null!==this._historyPricePanePriceAxisView&&this._labelPaneViews.push(this._historyPricePanePriceAxisView),this._highLowAvgPaneViews=[],this._averagePaneViews=[],ei&&this._createAverageViews(),this._createHighLowAvgViews(),this._subscribeRestartToSessionIdChange(),h.visible.subscribe(this,this._updateLastPriceAnimationActive),this._updateLastPriceAnimationActive(),h.minTick.subscribe(this,this._onFormatterPropsChanged),this._dataWindowView=new U(this,e),this._legendView=new q(this,e),this._statusView=new R(this,h.statusViewStyle),this._marketStatusModel=new K.MarketStatusModel(this._quotesProvider),this._dataUpdatedModeModel=Xt?new ae(this._symbolInfo.spawn().ownership(),this._seriesStatus.spawn().ownership(),(0,j.createWVFromGetterAndSubscription)((()=>{var e;return null===(e=this._lastCompleteFlags)||void 0===e?void 0:e.rt_update_period}),c.completed()).ownership()):null,this._dataProblemModel=new ce(this._quotesProvider,this._symbolInfo.spawn().ownership()),this._symbolResolvingActive.subscribe((()=>e.realignLineTools())),this._intervalChanged.subscribe(this,(()=>e.realignLineTools())),null===(o=this._studyBindings)||void 0===o||o.syncStudy(this.style()),this.createPaneView(),this._properties.addExcludedKey("visible",1),this._properties.addExcludedKey("currencyId",1),this._futureBarsPaneView=null,this._priceLineView=null,this._baseHorizontalLineView=new $t(this);for(const[,e]of Object.entries(y.STYLE_SHORT_NAMES))null===(a=this._properties.child(`${e}Style`))||void 0===a||a.subscribe(this,(()=>this.invalidateBarStylesCache()));const _=h.renkoStyle.childs().inputs.childs();_.boxSize.subscribe(this,this.restart),_.style.subscribe(this,this.restart),_.atrLength.subscribe(this,this.restart),_.percentageLTP.subscribe(this,this.restart),_.wicks.subscribe(this,this.restart),
_.sources.subscribe(this,this.restart),h.pbStyle.childs().inputs.childs().lb.subscribe(this,this.restart);const S=h.kagiStyle.childs().inputs.childs();S.reversalAmount.subscribe(this,this.restart),S.style.subscribe(this,this.restart),S.atrLength.subscribe(this,this.restart),S.percentageLTP.subscribe(this,this.restart);const b=h.pnfStyle.childs().inputs.childs();b.boxSize.subscribe(this,this.restart),b.reversalAmount.subscribe(this,this.restart),b.sources.subscribe(this,this.restart),b.style.subscribe(this,this.restart),b.atrLength.subscribe(this,this.restart),b.percentageLTP.subscribe(this,this.restart),b.oneStepBackBuilding.subscribe(this,this.restart),h.rangeStyle.childs().inputs.childs().phantomBars.subscribe(this,this.restart),this._isDWMProperty=new m.Property(this.isDWM()),this._onRestarted.subscribe(this,(()=>this._isDWMProperty.setValue(this.isDWM()))),h.showCountdown.subscribe(this,this._onShowCountdownChanged),this._onShowCountdownChanged(h.showCountdown),this._recreatePriceFormattingDependencies(),h.lineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),h.lineWithMarkersStyle.childs().priceSource.subscribe(this,this._updateBarFunction),h.steplineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),h.areaStyle.childs().priceSource.subscribe(this,this._updateBarFunction),h.baselineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),h.columnStyle.childs().priceSource.subscribe(this,this._updateBarFunction),this._updateBarFunction(),this._isInReplay=(0,Kt.combine)((e=>null!==e),this._replaySubscriber.weakReference()),this._legendValuesProvider=new $e(this,this.model()),this._dataWindowValuesProvider=new Ge.SeriesValuesProvider(this,this.model())}setId(e){var t;super.setId(e),null===(t=(0,be.getPersistentLogger)())||void 0===t||t.addPersistentLogEntry(`Set series Id to ${e}`,a.LOGLEVEL.INFO,"chart.series")}supportsPressedChunks(){return!0}pressedChunks(e,t){return this.data().pressedChunks(e,t)}seriesErrorMessage(){const{seriesStatus:e,additionalStudyStatus:t}=this._status.value();return this.isFailed()?this._seriesErrorMessage:y.seriesLoadingStatuses.has(e)?null:(null==t?void 0:t.type)===Yt.StudyStatusType.Error?(0,Yt.convertStudyStatusToString)({type:Yt.StudyStatusType.Error,errorDescription:t.errorDescription},!0):null}destroy(){this._seriesStatus.destroy(),this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._quotesProvider.destroy(),this.clearGotoDateResult(),this._legendView.destroy(),this._marketStatusModel.destroy(),this._studyBindings&&this._studyBindings.destroy(),null!==this._dataUpdatedModeModel&&this._dataUpdatedModeModel.destroy(),this._dataProblemModel.destroy(),this._paneView&&this._paneView.destroy&&this._paneView.destroy(),this._seriesSource.destroy(),this._quotesProvider.quotesUpdate().unsubscribeAll(this),this._quotesProvider.destroy(),this._model.timeScale().visibleBarsStrictRangeChanged().unsubscribeAll(this),this._unsubscribeRestartToSessionIdChange(),this._replayExitedDueUnsupportedInterval.destroy(),
this._replayExitedDueUnavailableForUserInterval.destroy(),this._onTimeFrameApplied.destroy(),this._deferredDestroyed.resolve(),this._properties.destroy(),this._isInReplay.destroy(),super.destroy()}isActingAsSymbolSource(){return this._isActingAsSymbolSource.readonly()}barColorer(){if(this._barColorerCache)return this._barColorerCache;let e=null;const t=this._model.dataSources();for(let i=t.length-1;i>=0;i--){const r=t[i];if((0,zt.isStudy)(r)&&r.hasBarColorer()&&!r.isSourceHidden()){const t=(0,s.ensureNotNull)(r.barColorer());null===e?e=t:e.pushBackBarColorer(t)}}return null===e?e=new Ht.SeriesBarColorer(this):e.pushBackBarColorer(new Ht.SeriesBarColorer(this)),this._barColorerCache=e,e}createPaneView(){this._paneView=null,this._projectionBarsPaneView=null,this._waterlineView=null,this._priceLineView=this.hasClosePrice()?new Pt(this):null;const e=this._properties.childs().style.value();switch(e){case 0:this._paneView=new Mt.SeriesBarsPaneView(this,this._model);break;case 17:case 19:case 1:this._paneView=new At.SeriesCandlesPaneView(this,this._model,1===e||19===e?1:.2);break;case 2:case 18:case 14:case 15:this._paneView=new Lt.SeriesLinePaneView(this,this._model);break;case 3:this._paneView=new kt.SeriesAreaPaneView(this,this._model);break;case 16:this._paneView=new Dt.SeriesHLCAreaPaneView(this,this._model);break;case 8:this._paneView=new Nt(this,this._model);break;case 9:this._paneView=new Ot.SeriesHollowCandlesPaneView(this,this._model);break;case 13:this._paneView=new It.SeriesColumnsPaneView(this,this._model);break;case 10:{this._paneView=new Ft.SeriesBaselinePaneView(this,this._model);const e=this._properties.childs().baselineStyle.childs();this._waterlineView=new xt.SeriesWaterlinePaneView({paneHeight:()=>this.priceScale().height(),color:()=>e.baselineColor.value(),baseLevelPercentage:()=>e.baseLevelPercentage.value()});break}case 12:this._paneView=new Tt.SeriesHiLoPaneView(this,this._model)}if(null===this._paneView)throw Error("Unknown chart style assigned: "+e)}properties(){return this._properties}zorder(){return 0}quotesProvider(){return this._quotesProvider}currentSession(){return this._currentSession}syncModel(){if(!this._syncModel){const e=this.symbolInfo(),t=this.interval();if(!e||!t)return null;this._syncModel=new te(e,t)}return this._syncModel}labelPaneViews(){return this._labelPaneViews}topPaneViews(){const e=[];if(null!==this._gotoDateView&&e.push(this._gotoDateView),this._lastPriceAnimationActive){const t=this._lineStyleLastPriceCirclePaneView;t.animationActive()&&setTimeout((()=>this._model.invalidate(at.InvalidationMask.cursor())),0),t.invalidateStage(),e.push(t)}return 0!==e.length?e:null}paneViews(e){var t,i;if(!this.properties().childs().visible.value()||!this._model.isSnapshot()&&!this._wasCompletedBefore())return null;const r=[(0,s.ensureNotNull)(this._baseHorizontalLineView),(0,s.ensureNotNull)(this._paneView)];return r.push(...null!==(i=null===(t=this._studyBindings)||void 0===t?void 0:t.paneViews(e))&&void 0!==i?i:[]),this._endOfDataPaneView&&r.push(this._endOfDataPaneView),
this._futureBarsPaneView&&r.push(this._futureBarsPaneView),this._projectionBarsPaneView&&r.push(this._projectionBarsPaneView),null!==this._waterlineView&&r.push(this._waterlineView),null!==this._priceLineView&&r.push(this._priceLineView),window.TradingView.printing&&this._lastPriceAnimationActive&&(this._lineStyleLastPriceCirclePaneView.stopAnimation(),r.push(this._lineStyleLastPriceCirclePaneView)),r.push(...this._highLowAvgPaneViews),r.push(...this._averagePaneViews),r}priceAxisViews(e,t){return e.findTargetPriceAxisViews(this,t,this._priceAxisViews,this._priceLineAxisViews)}clearHighLowPriceCache(){this._highLowPriceCache.clear()}clearAveragePriceCache(){this._averagePriceCache.clear()}priceScale(){return(0,s.ensureNotNull)(this._priceScale)}setPriceScale(e){this._priceScale!==e&&(this._priceScaleAboutToBeChanged.fire(),this._priceScale=e,this._properties.removeProperty("priceAxisProperties"),this._properties.addChild("priceAxisProperties",e.properties()),this._properties.childs().priceAxisProperties.childChanged(null,""),(0,o.emit)("series_event","price_scale_changed"),this._priceScaleChanged.fire(e))}priceScaleChanged(){return this._priceScaleChanged}priceScaleAboutToBeChanged(){return this._priceScaleAboutToBeChanged}applyPreferences(e){const t=(0,le.clone)(e);this.priceScale().setMode({autoScale:t.priceAxisProperties.autoScale,percentage:t.priceAxisProperties.percentage,log:t.priceAxisProperties.log,lockScale:t.priceAxisProperties.lockScale}),this.setChartStyleWithIntervalIfNeeded(t.style);const{style:i,interval:s,...r}=t;this._properties.mergePreferences(r),this._properties.saveDefaults(),this.createPaneView(),this.invalidateBarStylesCache()}disconnect(){var e;null===(e=this._studyBindings)||void 0===e||e.stop(),this._seriesSource.stop(),this._predictBars=0,this._updateStatus({...this._status.value(),seriesStatus:0}),this._model.isSnapshot()||this._symbolInfo.setValue(null)}isStarted(){return this._seriesSource.isStarted()}isCompleted(){return this._seriesCompleted}restart(){if(5===this._status.value().seriesStatus)return;this._seriesLoaded=!1,this._seriesCompleted=!1,this._lastCompleteFlags=null,this._onRestarted.fire(),this._setStatus(1),this._updateSymbolInfo(null);let e=this._properties.childs().interval.value();Z.Interval.isEqual(e,this._prevRequestedInterval)&&this._notifyIntervalChanged(e);let t=null;this._pendingTimeRange&&(t=this._pendingTimeRange,this._pendingTimeRange=null),this._onBeforeModifySeries(this.getSymbolString(),e),this._onTimeFrameApplied.fire(t),e=(0,bt.getServerInterval)(e),this._data=null,this.model().recalcVisibleRangeStudies(h.RecalcVisibleRangeStudiesReason.SeriesRestart),this._seriesSource.modifySeries(this._getResolvingSymbolObject(),e,t),this._seriesSource.isStarted()||this._seriesSource.start(),this._prevRequestedInterval=this.interval(),this.updateAllViews((0,ge.sourceChangeEvent)(this.id())),this._model.lightUpdate()}isSymbolInvalid(){return 4===this._status.value().seriesStatus}getSymbolString(){return(0,
Xe.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getSymbolObject())}getAlertSymbolString(){return(0,Xe.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getSymbolObject(this.actualSymbol()))}invalidateBarStylesCache(e){ri.logDebug("Invalidate style cache starting from "+e),this._clearStylePlot(this.bars(),e),this._clearStylePlot(this.nsBars())}isLoading(){return y.seriesLoadingStatuses.has(this.statusWV().value())}isFailed(){const e=this.status();return 12===e||4===e||10===e||14===e}isStatusError(){return 12===this.status()}unsupportedResolutionState(){return this._unsupportedResolutionState.readonly()}actualSymbol(){return(0,g.actualSymbol)(this.symbolInfo(),this.symbol())}proSymbol(){return(0,g.proSymbol)(this.symbolInfo(),this.symbol())}onStyleChanged(){return this._onStyleChanged}style(){return this.properties().childs().style.value()}setStyle(e){this.setSymbolParams({style:e})}isRangeBasedStyle(){return(0,g.isRangeBasedStyle)(this.style())}symbolSameAsCurrent(e){return this.symbol()===e||(0,Ze.symbolSameAsCurrent)(e,this.symbolInfo())}symbolSameAsResolved(e){return this._model.isSnapshot()?this.symbolSameAsCurrent(e):this._seriesSource.symbolSameAsResolved(e)}status(){return this._seriesStatus.value()}statusWV(){return this._seriesStatus}compositeStatusVW(){return this._status}symbol(){return this.properties().childs().symbol.value()}symbolChanged(){return this.properties().childs().symbol.listeners()}seriesSource(){return this._seriesSource}symbolInfo(){return this._symbolInfo.value()}symbolResolved(){return this.dataEvents().symbolResolved()}symbolResolvingActive(){return this._symbolResolvingActive}symbolHibernated(){return this._seriesAlwaysFalseHibernatedVW}getSymbolName(){var e,t;return null!==(t=null===(e=this.symbolInfo())||void 0===e?void 0:e.name)&&void 0!==t?t:""}firstValue(){const e=this.firstBar();return null===e?null:this._barFunction(e,0)}firstBar(){const e=this.model().timeScale().visibleBarsStrictRange();if(null===e)return null;const t=e.firstBar(),i=this.data().search(t,p.PlotRowSearchMode.NearestRight);return null!==i?i.value:null}formatter(e=!0){return e?this._formatter:this._ignoreMinMoveFormatter}defaultFormatter(){return this._defaultFormatter}priceStep(e=!0){return e?this._priceStep:this._ignoreMinMovePriceStep}bars(){return this.data().bars()}nsBars(){return this.data().nsBars()}interval(){return this.properties().childs().interval.value()}setInterval(e){this.setSymbolParams({interval:e})}intervalObj(){const e=this.interval();if(null!==this._intervalObj&&this._intervalObj.resolutionString===e)return this._intervalObj.interval;const t=Z.Interval.parse(e);return this._intervalObj={resolutionString:e,interval:t},t}prevClose(){const e=this.priceScale();if(e.isEmpty()||this.data().isEmpty())return null;const t=this.quotes(),i=this.firstValue();if(null===t||null===i)return null;const s=t.prev_close_price;return void 0===s?null:{coordinate:e.priceToCoordinate(s,i),floatCoordinate:e.priceToCoordinate(s,i),formattedPricePercentage:e.formatPricePercentage(s,i,{signPositive:!0}),
formattedPriceAbsolute:e.formatPriceAbsolute(s),formattedPriceIndexedTo100:e.formatPriceIndexedTo100(s,i)}}priceLineColor(e){return this.properties().childs().priceLineColor.value()||e}hasClosePrice(){return si||12!==this.properties().childs().style.value()}lastValueData(e,t,i){var s;const r={noData:!0},n=this.priceScale();if(this.model().timeScale().isEmpty()||n.isEmpty()||this.data().isEmpty())return r;const o=this.model().timeScale().visibleBarsStrictRange(),a=this.firstValue();if(null===o||null===a)return r;let l,c;if(t){const e=this.data().bars().last();if(null===e)return r;l=e.value,c=e.index}else{const e=this.data().bars().search(o.lastBar(),p.PlotRowSearchMode.NearestLeft);if(null===e)return r;l=e.value,c=e.index}const h=null!==(s=void 0!==e?l[e]:this._barFunction(l,2))&&void 0!==s?s:NaN,d=this.barColorer().barStyle(c,!1),u=n.priceToCoordinate(h,a),_={...n.getFormattedValues(h,a,!0),noData:!1,color:d.barColor,floatCoordinate:u,coordinate:u,index:c};return i&&(_.price=h),_}isDWM(){return this.intervalObj().isDWM()}isPulse(){var e;const t=this.symbolInfo();return null!==t&&(null!==(e=t.resolutions)&&void 0!==e?e:[]).length>0}data(){var e;return null!==(e=this._data)&&void 0!==e?e:this._seriesSource.data()}clearData(){var e;(0,s.assert)(null===this._data,"Cannot clear loaded data"),null===(e=this._studyBindings)||void 0===e||e.clearData(),this._seriesSource.clearData()}nearestData(e,t){var i;return null!==(i=this.data().search(e,t))&&void 0!==i?i:void 0}nearestIndex(e,t){var i;return null===(i=this.nearestData(e,t))||void 0===i?void 0:i.index}nearestValue(e,t,i){var s;const r=this.nearestData(e,i);return null!==(s=null==r?void 0:r.value[t])&&void 0!==s?s:void 0}onSymbolIntervalChanged(){return this._symbolIntervalChanged}onIntervalChanged(){return this._intervalChanged}onStatusChanged(){return this._onStatusChanged}onRestarted(){return this._onRestarted}fixLastBar(e){0}requestMoreData(e){var t,i;if(!y.seriesReadyStatuses.has(this._status.value().seriesStatus))return;if(this._model.timeScale().isEmpty())return;const r=this._model.timeScale().visibleBarsStrictRange();if(null===r)return;if(0===this.bars().size())return;const n=r.lastBar()-(0,s.ensureNotNull)(this.data().last()).index;if(this._predictBars<n&&(this._predictBars=n,this._seriesSource.requestMoreTickmarks(n)),!this._requestMoreDataAvailable)return;const o=(0,s.ensureNotNull)(this.bars().firstIndex()),a=e||Math.max(o-r.firstBar(),o-(null!==(i=null===(t=this._studyBindings)||void 0===t?void 0:t.requestMoreDataIndex())&&void 0!==i?i:o));a<=0||(Number.isFinite(a)?(this._requestMoreDataAvailable=!1,this._seriesSource.requestMoreData(a),this._setStatus(2)):ri.logWarn("requestMoreData: invalid bar count: "+a+", visible bars: ["+r.firstBar()+", "+r.lastBar()+"], last index: "+(0,s.ensureNotNull)(this.data().last()).index+", predicted bars: "+this._predictBars+", required bars:"+e))}isNeedRestart(e){return 5!==this._status.value().seriesStatus&&(void 0===e&&(e=this.properties().childs().style.value()),(0,g.styleChangeRequiresRestart)(this._prevChartStyle,e))}
isStyleSupported(e){return!0}sessionId(){return this.properties().childs().sessionId.value()}sessionIdChanged(){return this._sessionIdChanged}priceRange(e,t,i){var r,n;const o=this._priceScale;if(this.data().isEmpty()||!o)return null;if(o.isLockScale()){const e=this._model.mainSeriesScaleRatio();if(null!==e){const i=o.internalHeight()/(this.model().timeScale().barSpacing()/e),r=(0,s.ensureNotNull)(this.data().search(t,p.PlotRowSearchMode.NearestLeft)).value,n=((0,s.ensure)(r[2])+(0,s.ensure)(r[3]))/2;return new _.PriceRange(n-.5*i,n+.5*i)}}const a=this.priceSource();let l,c,h;if(null!==a?(l=this.data().bars().minMaxOnRangeCached(e,t,[{name:a,offset:0}]),c=this.data().nsBars().minMaxOnRangeCached(e,t,[{name:a,offset:0}])):(l=this.data().bars().minMaxOnRangeCached(e,t,[{name:"low",offset:0},{name:"high",offset:0}]),c=this.data().nsBars().minMaxOnRange(e,t,[{name:"low",offset:0},{name:"high",offset:0}])),l=(0,u.mergeMinMax)(l,c),null===l)h=new _.PriceRange(-.5,.5);else if(l.min===l.max){const e=5/(null!==(n=null===(r=this.symbolInfo())||void 0===r?void 0:r.pricescale)&&void 0!==n?n:100);h=new _.PriceRange(l.min-e,l.max+e)}else h=new _.PriceRange(l.min,l.max);return o.isLog()?new _.PriceRange(o.priceToLogical(h.minValue()),o.priceToLogical(h.maxValue())):h}autoScaleInfo(e,t,i){var s,r,n,o;let a={range:this.priceRange(e,t,{...i,scaleSeriesOnly:!0}),topPixelMargin:null===(r=null===(s=this._paneView)||void 0===s?void 0:s.topPixelMargin)||void 0===r?void 0:r.call(s),bottomPixelMargin:null===(o=null===(n=this._paneView)||void 0===n?void 0:n.bottomPixelMargin)||void 0===o?void 0:o.call(n)};if(!i.scaleSeriesOnly){const s=this._model.allStudies().filter((e=>e.isVisible())),r=(e,t)=>void 0===e?t:void 0===t?e:Math.max(e,t),n=s.map((s=>s.autoScaleInfo(e,t,{...i,forceOverlayOnly:!0})));this._studyBindings&&n.push(...this._studyBindings.autoScaleInfos(e,t,i));const o=(e,t)=>({range:e.range?t.range?e.range.merge(t.range):e.range:t.range,topPixelMargin:r(e.topPixelMargin,t.topPixelMargin),bottomPixelMargin:r(e.bottomPixelMargin,t.bottomPixelMargin)});a=n.reduce(o,a)}return a}onChartStyleChanged(){var e,t;this._updateBarFunction(),this.isNeedRestart()&&(this.data().clear(),this.model().timeScale().scrollToRealtime(!1),this.restart());const i=this.properties();this._prevChartStyle!==i.childs().style.value()&&(null===(e=this._studyBindings)||void 0===e||e.syncStudy(this.style())),this._prevChartStyle=i.childs().style.value(),this._onStyleChanged.fire(i.childs().style.value()),this.invalidateBarStylesCache(),this._updateLastPriceAnimationActive(),(null===(t=this._styleToRecover)||void 0===t?void 0:t.originalStyle)!==this.style()&&(this._styleToRecover=null),this._updateTimeScaleTimePointWeights()}setChartStyleWithIntervalIfNeeded(e,t){const i=this.interval(),s=null!=t?t:(0,bt.getResolutionByChartStyle)(e,i,this._model.defaultResolutions()),r=Z.Interval.isEqual(s,i);this.setSymbolParams({interval:r?void 0:s,style:e})}getInputsProperties(){var e;const t=this._properties.child(`${this.getStyleShortName()}Style`)
;return null!==(e=null==t?void 0:t.childs().inputs)&&void 0!==e?e:new m.Property}getInputsInfoProperties(){var e,t;const i=null===(e=this._studyBindings)||void 0===e?void 0:e.getInputsInfoProperties();if(i)return i;const s=this._properties.child(`${this.getStyleShortName()}Style`);return null!==(t=null==s?void 0:s.childs().inputInfo)&&void 0!==t?t:new m.Property}getSourceIcon(){return{type:"loadSvg",svgId:`series.${this.style()}`}}purgeSymbolInfo(){this._symbolInfo.setValue(null)}idForAlert(){return super.idForAlert()}hasStateForAlert(){return!1}stateForAlert(){throw new Error("Not implemented")}styleStudyInfos(){return{haStyle:this._haStyle,renkoStyle:this._renkoStyle,pbStyle:this._pbStyle,kagiStyle:this._kagiStyle,pnfStyle:this._pnfStyle,rangeStyle:this._rangeStyle,volFootprintStyle:this._volFootprintStyle,tpoStyle:this._tpoStyle,svpStyle:this._svpStyle}}dataEvents(){return this._seriesSource.dataEvents()}isSpread(){var e;return"spread"===(null===(e=this.symbolInfo())||void 0===e?void 0:e.type)}isYield(){const e=this.symbolInfo();return null!==e&&(0,jt.isYield)(e)}dividendsAdjustmentProperty(){return null}sessionIdProxyProperty(){return this._sessionIdProxyProperty}symbolTextSourceProxyProperty(){return this._symbolTextSourceProxyProperty}setTextSourceIsAlwaysTickerRestrictionEnabled(e){this._textSourceIsAlwaysTickerRestrictionEnabled=e,this._recalcSymbolTextSourceProxyProperty()}isDWMProperty(){return this._isDWMProperty}isPrePostMarketPricesAvailableProperty(){return this._isPrePostMarketPricesAvailableProperty}isSettlementAsCloseForbiddenProperty(){return this._isSettlementAsCloseForbiddenProperty}isBackAdjustmentForbiddenProperty(){return this._isBackAdjustmentForbiddenProperty}getStyleShortName(){const e=this.style(),t=y.STYLE_SHORT_NAMES[e];return(0,s.assert)(!!t,`Missed short name for style ${e}`),t}invalidateBarColorerCache(){this._barColorerCache=null,this.invalidateBarStylesCache()}replayExitedDueUnsupportedInterval(){throw new Error("Not implemented")}replayExitedDueUnavailableForUserInterval(){throw new Error("Not implemented")}onTimeFrameApplied(){return this._onTimeFrameApplied}onInReplayStateChanged(){throw new Error("Not implemented")}dataWindowView(){return this._dataWindowView}statusView(){return Jt?this._statusView:null}legendView(){return this._legendView}marketStatusModel(){return this._marketStatusModel}isMainSeries(){return!0}dataUpdatedModeModel(){return this._dataUpdatedModeModel}dataProblemModel(){return this._dataProblemModel}setDefaultTimeframe(e){this._pendingTimeRange=e}loadDataTo(e){const t=this._properties.childs().interval.value();this._onTimeFrameApplied.fire(e),this._seriesSource.modifySeries(this._getResolvingSymbolObject(),(0,bt.getServerInterval)(t),e)}isInReplay(){return this._isInReplay}quotes(){return this.data().isEmpty()?null:this._quotesProvider.quotes()}base(){return this._base}pointValue(){return this._pointValue}barCloseTime(){return this._lastBarCloseTime}priceSource(){let e=null;const t=this._properties.childs();switch(t.style.value()){case 2:
e=t.lineStyle.childs().priceSource.value();break;case 18:e=t.tpoStyle.childs().priceSource.value();break;case 14:e=t.lineWithMarkersStyle.childs().priceSource.value();break;case 15:e=t.steplineStyle.childs().priceSource.value();break;case 3:e=t.areaStyle.childs().priceSource.value();break;case 10:e=t.baselineStyle.childs().priceSource.value();break;case 13:e=t.columnStyle.childs().priceSource.value()}return e}updateAllViews(e){var t,i,s,r,n,o,a,l,c,h;null===(t=this._paneView)||void 0===t||t.update(e),this._dataWindowView.update(),this._legendView.update(),this._statusView.update(),this._averagePaneViews.forEach((t=>t.update(e))),this._highLowAvgPaneViews.forEach((t=>t.update(e))),this._labelPaneViews.forEach((t=>t.update(e))),this._priceAxisViews.forEach((t=>t.update(e))),this._priceLineAxisViews.forEach((t=>t.update(e))),null===(i=this._futureBarsPaneView)||void 0===i||i.update(e),null===(s=this._projectionBarsPaneView)||void 0===s||s.update(e),null===(r=this._waterlineView)||void 0===r||r.update(e),null===(n=this._priceLineView)||void 0===n||n.update(e),null===(o=this._gotoDateView)||void 0===o||o.update(e),null===(a=this._endOfDataPaneView)||void 0===a||a.update(e),null===(l=this._baseHorizontalLineView)||void 0===l||l.update(e);const d=this._model.activeStrategySource().value();null==d||d.updateAllViews(e),null===(c=this._model.replayStudyStrategy().value())||void 0===c||c.updateAllViews(e),this._lineStyleLastPriceCirclePaneView.update(e),null===(h=this._studyBindings)||void 0===h||h.updateAllViews(e)}styleStudyInfo(e){return this.styleStudyInfos()[e]}barFunction(){return this._barFunction}precomputedBarStyle(e){return this._precomputedBarStyles.get(e)}setPrecomputedBarStyle(e,t){this._precomputedBarStyles.set(e,t)}symbolParams(){return(0,Ze.symbolParams)(this)}compareSymbolParams(e){return(0,Ze.compareSymbolParams)(this,e,this._model.unitConversionEnabled())}setSymbolParams(e){const{symbol:t,currency:i,unit:r,style:n,interval:o}=e,{symbolChanged:a,intervalChanged:l,currencyChanged:c,unitChanged:h,styleChanged:d}=this.compareSymbolParams(e),u=[ai("symbol",t,a),ai("interval",o,l),ai("currency",i,c),ai("unit",r,h),ai("style",n,d)].filter((e=>null!==e)).join("; ");ri.logInfo(`Applying series symbol params: ${u}`);const p=this.properties().childs();void 0!==t&&p.symbol.setValue(t),void 0!==i&&p.currencyId.setValue(i),void 0!==r&&p.unitId.setValue(r),l&&p.interval.setValue((0,s.ensureDefined)(o)),void 0!==n&&d&&p.style.setValue(n);let _=!1;d&&(_=this.isNeedRestart(),this.onChartStyleChanged()),!_&&(a||l||c||h)&&this._applySymbolParamsChanges({symbolChanged:a,currencyChanged:c,unitChanged:h,intervalChanged:l,styleChanged:d}),(a||c||h)&&this.model().checkLineToolSelection()}setSymbol(e){this.setSymbolParams({symbol:e})}currency(){return this.properties().childs().currencyId.value()||null}setCurrency(e){this.setSymbolParams({currency:e})}isConvertedToOtherCurrency(){return(0,g.isConvertedToOtherCurrency)(this.symbolInfo())}unit(){return this.properties().childs().unitId.value()||null}setUnit(e){this.setSymbolParams({
unit:e})}measureUnitId(){return(0,g.measureUnitId)(this.symbolInfo())}isConvertedToOtherUnit(){return(0,g.isConvertedToOtherUnit)(this.symbolInfo(),this._model.unitConversionEnabled())}valueAt(e,t){var i,s;return null!==(s=null===(i=this.data().search(e))||void 0===i?void 0:i.value[t])&&void 0!==s?s:null}symbolSource(){return this}barsProvider(){return this}title(e){return this.symbolTitle(e)}name(){return this.symbolTitle(Gt.TitleDisplayTarget.StatusLine)}symbolTitle(e,t,i,s="exchange"){let r=this.properties().childs().symbol.value();const n=this.symbolInfo();if(null!==n){const{type:e}=n;r=(0,g.symbolTitle)(n,t,"forex"===e?"exchange":s)}return i?r:`${r}, ${(0,x.translatedIntervalString)(this.properties().childs().interval.value())}`}setObsoleteZOrder(e){this._obsoleteZOrder=e}obsoleteZOrder(){return this._obsoleteZOrder}legendValuesProvider(){return this._legendValuesProvider}dataWindowValuesProvider(){return this._dataWindowValuesProvider}statusProvider(e){return new E(this,this.properties().childs().statusViewStyle,e)}moveItem(e,t,i){if(10===this.style()&&0===t){const t=this.priceScale(),i=this.properties().childs().baselineStyle,s=t.height(),r=100-e.y/s*100,n=r<0?0:Math.round(10*r)/10;i.childs().baseLevelPercentage.setValue(Math.max(Math.min(n,100),0))}}rerequestData(){this._applySymbolParamsChanges({force:!0})}switchToReplay(e,t){throw new Error("Not implemented")}switchToRealtime(){throw new Error("Not implemented")}async canChangeResolution(e){return!0}requestMoreDataAvailable(){return this._requestMoreDataAvailable}seriesLoaded(){return this._seriesLoaded}endOfData(){var e;return void 0!==(null===(e=this._lastCompleteFlags)||void 0===e?void 0:e.data_completed)}endOfDataType(){var e,t;return null!==(t=null===(e=this._lastCompleteFlags)||void 0===e?void 0:e.data_completed)&&void 0!==t?t:null}dataPoweredBy(){return null}boxSizeValue(){return this._boxSizeValue}isUserDeletable(){return!1}changeTimeFrame(){(0,n.trackEvent)("GUI","Change timeframe")}onTagsChanged(){return this._tagsChanged}state(e){var t,i;const s=this.obsoleteZOrder();let r={type:"MainSeries",id:this.id(),zorder:s,haStyle:this._haStyle,renkoStyle:this._renkoStyle,pbStyle:this._pbStyle,kagiStyle:this._kagiStyle,pnfStyle:this._pnfStyle,rangeStyle:this._rangeStyle,volFootprintStyle:this._volFootprintStyle,tpoStyle:this._tpoStyle,svpStyle:this._svpStyle,formattingDeps:this._formattingDeps,studyBindings:null===(t=this._studyBindings)||void 0===t?void 0:t.state(!!e)};const n=this.properties().state();if(n.symbol=(0,g.symbolToSaveInState)(null!==(i=this.symbolInfo())&&void 0!==i?i:this._model.chartApi().lastSymbolResolveInfo(n.symbol),n.symbol),this._model.unitConversionEnabled()||(n.unitId=null),r.state=n,e){let e=this.bars();const t=this._model.timeScale().visibleExtendedDataRange(e,0);null!==t&&(e=e.range(t.firstBar(),t.lastBar())),r={...r,bars:li(e),nsBars:li(this.nsBars()),symbolInfo:this.symbolInfo(),rtPrice:this.data().lastProjectionPrice,boxSize:this.data().boxSize,reversalAmount:this.data().reversalAmount}}return r}restoreState(e,t){var i,s,r
;t&&this._setStatus(5),!this._model.unitConversionEnabled()&&e.state&&delete e.state.unitId,e.state&&Z.Interval.isRange(e.state.interval)&&(e.state.style=11);const n=e.state;if(void 0!==n){const e=n.style,t=void 0;t&&!this._model.isSnapshot()&&(n.style=2,runOrGoProWithoutSync((()=>{n.style=e}),t.feature,{feature:t.featureName}))}if(this._properties.mergeAndFire(e.state),this._properties.hasChild("esdBreaksStyle")&&this._properties.removeProperty("esdBreaksStyle"),this._prevChartStyle=this.properties().childs().style.value(),this.createPaneView(),t){const t=e;this.restoreData(t.bars,t.nsBars,t.symbolInfo,t.rtPrice,t.boxSize,t.reversalAmount)}e.formattingDeps&&(this._formattingDeps=e.formattingDeps,this._recreatePriceFormattingDependencies()),null===(i=this._studyBindings)||void 0===i||i.restoreState(null!==(s=e.studyBindings)&&void 0!==s?s:{},t),null===(r=this._studyBindings)||void 0===r||r.syncStudy(this.style())}restoreData(e,t,i,s,r,n){this._updateStatus({seriesStatus:5}),this._data=new d.SeriesData,this._data.bars().restoreState(e),this._data.nsBars().restoreState(t),this._updateSymbolInfo(i),this._data.lastProjectionPrice=s,this._data.boxSize=r;const o=this.properties().childs();r||(6===o.style.value()?this._data.boxSize=o.pnfStyle.childs().inputs.childs().boxSize.value():4===o.style.value()&&(this._data.boxSize=o.renkoStyle.childs().inputs.childs().boxSize.value())),this._data.reversalAmount=n,n||5===o.style.value()&&(this._data.reversalAmount=o.kagiStyle.childs().inputs.childs().reversalAmount.value())}async setGotoDateResult(e,t){this._gotoDateResultCleared=!1;const s=await Promise.all([i.e(6778),i.e(4079)]).then(i.bind(i,40481));this._gotoDateResultCleared||(this._gotoDateView=new s.GotoDateView(this,e,t),this._gotoDateView.doNotShowLastAvailableBar(this._doNotShowLastAvailableBar),this._model.updateSource(this))}clearGotoDateResult(){this._gotoDateView=null,this._gotoDateResultCleared=!0}doNotShowLastAvailableBar(e){var t;this._doNotShowLastAvailableBar=e,null===(t=this._gotoDateView)||void 0===t||t.doNotShowLastAvailableBar(e)}dataUpdated(){return this.dataEvents().dataUpdated()}moveData(e){this._seriesSource.moveData(e),null!==this._volumePointWeights&&this._volumePointWeights.moveData(e)}async seriesCreated(){const e=this._seriesSource.instanceId();if(null!==e)return e;const t=await Promise.race([this._deferredDestroyed.promise.then((()=>{})),this._model.isSnapshot()?Promise.resolve(null):new Promise((e=>{this.dataEvents().created().subscribe(this,e,!0)}))]);if(void 0===t)throw new Error("Series has been destroyed");return t}_updateBarFunction(){this._barFunction=(0,Wt.barFunctionByStyle)(this.style(),this.priceSource())}_setProperties(e){e.hasChild("timeframe")||e.merge({timeframe:""}),e.hasChild("shortName")||e.merge({shortName:""}),e.hasChild("currencyId")||e.addChild("currencyId",new m.Property(null)),e.hasChild("unitId")||e.addChild("unitId",new m.Property(null)),this._properties=e;const t=e.childs();t.currencyId.subscribe(this,this._onCurrencyChanged),t.unitId.subscribe(this,this._onUnitChanged),
t.timeframe.subscribe(this,this.changeTimeFrame),e.subscribe(this,this._onPropertiesChanged)}_updateSessionIdProxyProperty(e){const t=this._properties.childs().sessionId.value();let i=t;if(e){const e=this.symbolInfo();null!==e&&(i=e.subsession_id||t)}this._ignoreSessionIdProxyPropertyChanges=!0,this._sessionIdProxyProperty.setValue(i),this._ignoreSessionIdProxyPropertyChanges=!1}_onSessionIdProxyPropertyChanged(){this._ignoreSessionIdProxyPropertyChanges||this._properties.childs().sessionId.setValue(this._sessionIdProxyProperty.value()),this._updateLastPriceAnimationActive()}_onSymbolResolved(e){this._seriesErrorMessage=null,this._updateSymbolInfo(e),this._model.updateSource(this),this._model.onWidget()||((0,n.trackEvent)("Symbol",e.listed_exchange,e.name),(0,n.trackEvent)("Symbol Type",e.type,e.listed_exchange));const t=e.minmov/e.pricescale,i=this.properties().childs();4===i.style.value()&&i.renkoStyle.childs().inputs.childs().boxSize.value()<t?i.renkoStyle.childs().inputs.merge({boxSize:t}):6===i.style.value()&&i.pnfStyle.childs().inputs.childs().boxSize.value()<t?i.pnfStyle.childs().inputs.merge({boxSize:t}):5===i.style.value()&&i.kagiStyle.childs().inputs.childs().reversalAmount.value()<t&&i.kagiStyle.childs().inputs.merge({reversalAmount:t}),this._checkChartStyle(),this._formattingDeps={format:e.format,pricescale:e.pricescale,minmov:e.minmov,fractional:e.fractional,minmove2:e.minmove2,variable_tick_size:e.variable_tick_size}}_onSymbolError(e){this._setStatus(4),this._properties.childs().shortName.setValue(this._properties.childs().symbol.value()),this._model.clearAllStudies(),this.updateAllViews((0,ge.sourceChangeEvent)(this.id())),this._model.updateSource(this),e!==ht.permissionDenied&&this._model.resetTimeScale(),this._symbolResolvingActive.setValue(!1)}_sendTelemetryCounter(e,t){}_getTelemetryAdditionalData(e,t){return{}}_onSeriesTimeFrame(e,t,i,s,r){const n=(0,g.isSingleValueBasedStyle)(this.style())?e+.5:e;let o=t;if(void 0===r)null!==i&&"period-back"!==i.type||(o+=this._model.studyAwareDefaultRightOffset());else if(r.applyDefaultRightMargin)o+=this._model.studyAwareDefaultRightOffset();else if(r.percentRightMargin){const e=t-n+1,i=Math.max(0,Math.min(.99,r.percentRightMargin/100));o+=i*e/(1-i)}this._model.setTimeViewport(n,o)}_onSeriesError(e){let t=e.error;const i=e.ctx;if(i){const e={};Object.keys(i).forEach((t=>{e[t]=i[t].toString()})),t=t.format(e)}ii&&ri.logNormal("Error reason: "+t),this._seriesErrorMessage=t;const s="unknown_symbol"!==t?12:ti&&this.symbolInfo()?10:4;this._setStatus(s),this._seriesLoaded=!0,this._enablePriceRangeReady()}_onSeriesLoading(e){this._setStatus(2)}_onDataUpdated(e,t,i,r){var n;this.symbolInfo();if(null!==this._volumePointWeights){const e=t?this.bars().fullRangeIterator():i?this.bars().rangeIterator(i.index,(0,s.ensureNotNull)(this.bars().lastIndex())):null;if(null!==e)for(const t of e)this._volumePointWeights.setVolume(t.index,t.value[5])}
t?this._requestMoreDataAvailable=!0:this._lastPriceAnimationActive&&this._seriesLoaded&&this._lineStyleLastPriceCirclePaneView.update((0,ge.sourceChangeEvent)(this.id())),this._lastBarCloseTime=e&&e.closeTime||null,this._boxSizeValue.setValue(this.data().boxSize),this._statusView.update(),this.clearAveragePriceCache(),this.clearHighLowPriceCache();const o=this.model(),a=(0,s.ensureNotNull)(o.paneForSource(this));o.recalculatePane(a,(0,ge.sourceChangeEvent)({sourceId:this.id(),realtime:!t,firstUpdatedTimePointIndex:null!==(n=null==i?void 0:i.index)&&void 0!==n?n:void 0})),o.updateSource(this)}_setStatus(e){const t={...this._status.value(),seriesStatus:e};this._updateStatus(t),this._statusView.update(),this.model().updateSource(this),this._onStatusChanged.fire()}_onBarReceived(e){this.model().recalcVisibleRangeStudies(h.RecalcVisibleRangeStudiesReason.DataUpdate)}_onUnsupportedResolutionRequested(){const e=(0,s.ensureNotNull)(this._getStateForUnsupportedResolution());this._seriesErrorMessage=e.reason,this._unsupportedResolutionState.setValue(e),this._setStatus(14),this._seriesLoaded=!0,this._seriesSource.clearData(),this._model.timeScale().points().clear(),this._enablePriceRangeReady()}_getStateForUnsupportedResolution(){const e=this.symbolInfo();if(null===e)return null;const t=this.interval(),i=(0,M.getResolutionUnsupportedReason)(e,t);if(null===i)return null;const r=e.name;if("less_than_frequency"!==i)return{ticker:r,reason:i,unsupportedResolution:t,applicableResolution:"D"};{const n=(0,s.ensureDefined)(e.data_frequency);let o=(0,bt.getApplicableIntervalForFrequency)(n,t);this._model.defaultResolutions();return{ticker:r,reason:i,applicableResolution:o,unsupportedResolution:t}}}_recreateFormatter(){var e,t,i,s,r;let n=null;n=null!==(t=null===(e=null===Ut.customFormatters||void 0===Ut.customFormatters?void 0:Ut.customFormatters.priceFormatterFactory)||void 0===e?void 0:e.call(Ut.customFormatters,this.symbolInfo(),this.properties().childs().minTick.value()))&&void 0!==t?t:null,null!==n?(this._formatter=n,this._ignoreMinMoveFormatter=n):(this._defaultFormatter=(0,g.createSeriesFormatter)(null!==(i=this.symbolInfo())&&void 0!==i?i:this._formattingDeps,"default"),this._formatter=(0,g.createSeriesFormatter)(null!==(s=this.symbolInfo())&&void 0!==s?s:this._formattingDeps,this.properties().childs().minTick.value()),this._ignoreMinMoveFormatter=(0,g.createSeriesFormatter)(this.symbolInfo(),this.properties().childs().minTick.value(),!0)),null===(r=this._priceScale)||void 0===r||r.updateFormatter(),this._formatterChanged.fire()}_recreatePriceStep(){const{minMove:e,priceScale:t}=(0,g.getSeriesPriceFormattingState)(this.symbolInfo()),i=e/t;this._ignoreMinMovePriceStep=1/t,this._priceStep!==i&&(this._priceStep=i,this._priceStepChanged.fire())}_recreatePriceFormattingDependencies(){this._recreateFormatter(),this._recreatePriceStep()}_onQuotesUpdate(e,t){void 0!==e.values.current_session&&e.values.current_session!==this._currentSession&&(this._currentSession=e.values.current_session,this._updateLastPriceAnimationActive())}
_updateIsPrePostMarketPricesForbiddenProperty(){const e=(0,g.symbolHasPreOrPostMarket)(this.symbolInfo())&&(this.isDWM()||(0,g.isRegularSessionId)(this.sessionIdProxyProperty().value()));this._isPrePostMarketPricesAvailableProperty.setValue(e)}_updateSettlementAsCloseForbiddenProperty(){}_updateBackAdjustmentForbiddenProperty(){}_removeReplaySubscriber(){throw new Error("Not implemented")}_getSymbolForApi(){return this.symbol()}_getSymbolObject(e){const t=this._getExtendedSymbolObject(e),i=this.properties().childs().style.value();if(y.SYMBOL_STRING_DATA.hasOwnProperty(i)&&!y.chartStylesWithAttachedStudies.includes(i)){return{symbol:t,type:this.styleStudyInfo(this.getStyleShortName()+"Style").studyId+"!",inputs:this.getInputsProperties().state()}}return t}_getExtendedSymbolObject(e){const t={symbol:null!=e?e:this._getSymbolForApi()},i=this.properties().childs();null!==this.currency()&&(t["currency-id"]=this.currency());const s=this.unit();return this._model.unitConversionEnabled()&&null!==s&&(t["unit-id"]=s),!this.isDWM()&&ni&&(t.session=i.sessionId.value()),t}_checkChartStyle(){const e=this.style();(0,g.isCloseBasedSymbol)(this.symbolInfo())?(0,g.isSingleValueBasedStyle)(e)||(this.requestingStyleIsNotSupported.fire(),this._styleToRecover={correctedStyle:this.style(),originalStyle:e}):null!==this._styleToRecover&&(this.requestingStyleSupportRecovered.fire(this._styleToRecover.originalStyle),this._styleToRecover=null)}_updateSymbolInfo(e){if(this._symbolInfo.setValue(e),e){const t=this._properties.childs();t.shortName.setValue(e.name);const i=(0,g.extractSymbolNameFromSymbolInfo)(e,this.symbol());i&&t.symbol.setValue(i);const s=(0,g.symbolCurrency)(e),r=(0,g.symbolUnit)(e,this._model.unitConversionEnabled());"alwaysOff"===(0,Y.currencyUnitVisibilityProperty)().value()||s===t.currencyId.value()&&r===t.unitId.value()||this._model.fullUpdate(),t.currencyId.setValue(s),t.unitId.setValue(r),this._updateSessionIdProxyProperty(!0)}this._base=e?e.pricescale/e.minmov:100,this._pointValue=e&&e.pointvalue||1;const t=(0,Xe.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getExtendedSymbolObject());this._quotesProvider.setQuotesSessionSymbol(t),this._marketStatusModel.setSymbolInfo(e),e&&this._recreatePriceFormattingDependencies(),this._statusView.update(),this.priceScale().updateFormatter(),this._symbolResolvingActive.setValue(!e),ni&&this._updateIsPrePostMarketPricesForbiddenProperty()}_createHighLowAvgViews(){const e=this.properties().childs().highLowAvgPrice,t=this._getHighLowPrice.bind(this),i=function(e,t,i,s){const r=i.childs(),n=Re(e,t,{label:Ve,labelVisible:r.highLowPriceLabelsVisible,lineVisible:r.highLowPriceLinesVisible,lineColor:r.highLowPriceLinesColor,lineWidth:r.highLowPriceLinesWidth},(()=>s(0))),o=Re(e,t,{label:Be,labelVisible:r.highLowPriceLabelsVisible,lineVisible:r.highLowPriceLinesVisible,lineColor:r.highLowPriceLinesColor,lineWidth:r.highLowPriceLinesWidth},(()=>s(1)));return{paneViews:[n.paneView,o.paneView],panePriceAxisViews:[n.panePriceAxisView,o.panePriceAxisView],
priceAxisViews:[n.priceAxisView,o.priceAxisView],priceLineAxisViews:[n.priceLineAxisView,o.priceLineAxisView]}}(this._model,this,e,t);this._highLowAvgPaneViews.push(...i.paneViews),this._labelPaneViews.push(...i.panePriceAxisViews),this._priceAxisViews.push(...i.priceAxisViews),this._priceLineAxisViews.push(...i.priceLineAxisViews)}_createAverageViews(){const e=this.properties().childs().highLowAvgPrice,t=this._getAveragePrice.bind(this),i=je(this._model,this,e,t);this._averagePaneViews.push(...i.paneViews),this._labelPaneViews.push(...i.panePriceAxisViews),this._priceAxisViews.push(...i.priceAxisViews),this._priceLineAxisViews.push(...i.priceLineAxisViews)}_getHighLowPrice(e){if(!this._highLowPriceCache.has(e)){const e=this._model.timeScale().visibleBarsStrictRange();if(null===e)return null;const t=function(e,t,i){return e.minMaxOnRangeCached(t,i,[{name:"low",offset:0},{name:"high",offset:0}])}(this._model.mainSeries().bars(),e.firstBar(),e.lastBar());if(null===t)return null;this._highLowPriceCache.set(1,t.min),this._highLowPriceCache.set(0,t.max)}return this._highLowPriceCache.get(e)}_getAveragePrice(e){if(!this._averagePriceCache.has(e)){const e=this._model.timeScale().visibleBarsStrictRange();if(null===e)return null;const t=function(e,t,i){0;const s=(0,d.barFunction)("close");let r=0,n=0;for(let o=t;o<=i;o++){const t=e.valueAt(o);null!==t&&(r+=s(t),n++)}return n?r/n:null}(this._model.mainSeries().bars(),e.firstBar(),e.lastBar());if(null===t)return null;this._averagePriceCache.set(0,t)}return this._averagePriceCache.get(e)}_onSeriesCompleted(e){var t;if(14===this._status.value().seriesStatus)return;this._seriesErrorMessage=null;let i=e.updateMode;switch("pulsed"===i&&(i="delayed"),i){case"streaming":this._setStatus(3);break;case"endofday":this._setStatus(6);break;case"delayed":this._setStatus(8);break;case"replay":this._setStatus(11)}i.match(/delayed_streaming/)&&this._setStatus(9),this._lastCompleteFlags=null!==(t=e.flags)&&void 0!==t?t:null;const r=(0,s.ensureNotNull)(this._model.paneForSource(this));r.recalculatePriceScale(this.priceScale(),(0,ge.sourceChangeEvent)(this.id()));const n=at.InvalidationMask.full();null!==this._model.appliedTimeFrame().value()&&n.lockVisibleTimeRangeOnResize(),this._model.invalidate(n),!this.priceScale().isLockScale()||this.model().timeScale().isEmpty()||this._seriesLoaded||(this.model().timeScale().correctOffset(),this.model().timeScale().correctBarSpacing(),this.model().resetPriceScale(r,this.priceScale())),this._seriesLoaded=!0,this._seriesCompleted=!0,this.model().recalcVisibleRangeStudies(h.RecalcVisibleRangeStudiesReason.SeriesCompleted),this.model().recalcStudyBasedLineTools(),this._enablePriceRangeReady()}_notifyIntervalChanged(e){var t,i;const s={timeframe:null!==(t=this._pendingTimeRange)&&void 0!==t?t:void 0};this._intervalChanged.fire(e,s),this._pendingTimeRange=null!==(i=s.timeframe)&&void 0!==i?i:null}_onCurrencyChanged(){this._currencyChanged.fire()}_onUnitChanged(){this._unitChanged.fire()}async _applySymbolParamsChanges(e){this._lastCompleteFlags=null,
this.clearGotoDateResult();const t=this.interval();this.currency(),this.unit();Z.Interval.isRange(t)&&this._properties.childs().rangeStyle.childs().inputs.childs().range.setValue(Z.Interval.parse(t).multiplier());const{symbolChanged:i,intervalChanged:s,currencyChanged:r,unitChanged:n,force:o}=e,a=ni&&s&&Z.Interval.parse(t).isDWM()!=Z.Interval.parse(t).isDWM();if(this._syncModel=null,this._prevRequestedInterval=t,5!==this._status.value().seriesStatus&&(!this._seriesSource.isStarted()||i||r||n||a)&&this._updateSymbolInfo(null),5===this._status.value().seriesStatus)return void this._model.realignLineTools();this._setStatus(1),ni&&this._updateIsPrePostMarketPricesForbiddenProperty(),this._symbolIntervalChanged.fire(),s&&this._notifyIntervalChanged(t),this._onRestarted.fire(),this._seriesLoaded=!1,this._seriesCompleted=!1,this._lineStyleLastPriceCirclePaneView.stopAnimation();let l=null;this._pendingTimeRange&&(l=this._pendingTimeRange,this._pendingTimeRange=null),this._onTimeFrameApplied.fire(l),this._onBeforeModifySeries(this.getSymbolString(),t);const c=this._shouldDefineNumberOfBarsForModifySeries(e)&&this._visibleBarsCount()||null;this.model().recalcVisibleRangeStudies(h.RecalcVisibleRangeStudiesReason.SeriesRestart),this._data=null,this._seriesSource.modifySeries(this._getResolvingSymbolObject(),(0,bt.getServerInterval)(t),l,o,c),this._seriesSource.isStarted()||(this._predictBars=0,this._seriesSource.start()),(i||r||n)&&this.disablePriceRangeReady(),this.updateAllViews((0,ge.sourceChangeEvent)(this.id())),this._model.lightUpdate()}_onBeforeModifySeries(e,t){const i=null;null==i||i.modifySeries(e,t)}_getResolvingSymbolObject(){let e=this._getSymbolObject(this._symbolForResolve());const t=null;return t&&(e=t.generateReplaySymbol(e)),e}_onSessionIdPropertyChanged(){this._sessionIdChanged.fire(),this.isDWM()||(this.restart(),this._updateLastPriceAnimationActive())}_subscribeRestartToSessionIdChange(){this.properties().childs().sessionId.subscribe(this,this._onSessionIdPropertyChangedBound)}_unsubscribeRestartToSessionIdChange(){this.properties().childs().sessionId.unsubscribe(this,this._onSessionIdPropertyChangedBound)}_updateLastPriceAnimationActive(){if(!this._options.lastPriceAnimationEnabled||w.enabled("disable_pulse_animation"))return;const e=this._lastPriceAnimationActive,t=this.properties().childs(),i=t.style.value(),s=3===i||10===i||2===i||14===i||15===i;if(!this._model.isSnapshot()&&t.visible.value()&&s){const e=this.currentSession(),t=!(0,g.isRegularSessionId)(this.sessionIdProxyProperty().value())&&!this.isDWM();this._lastPriceAnimationActive="market"===e||t&&("pre_market"===e||"post_market"===e)}else this._lastPriceAnimationActive=!1;this._lastPriceAnimationActive&&e!==this._lastPriceAnimationActive&&this.model().invalidate(at.InvalidationMask.cursor())}_onPropertiesChanged(e){const t=this._properties.childs();e!==t.symbol&&e!==t.interval&&e!==t.timeframe&&(this._tagsChanged.fire(),this.createPaneView(),this.updateAllViews((0,ge.sourceChangeEvent)(this._id)),this.model().updateSource(this),(0,
o.emit)("series_properties_changed",this._id))}_recalcSymbolTextSourceProxyProperty(){this._textSourceIsAlwaysTickerRestrictionEnabled?this._symbolTextSourceProxyProperty.setValue("ticker"):this._symbolTextSourceProxyProperty.setValue(this._properties.childs().statusViewStyle.childs().symbolTextSource.value())}_clearStylePlot(e,t){if(0===e.size())return;if(void 0===t&&e!==this.nsBars())return void(this._precomputedBarStyles=new WeakMap);const i=null!=t?t:(0,s.ensureNotNull)(e.firstIndex()),r=(0,s.ensureNotNull)(e.lastIndex())+1;e.range(i,r).each(((e,t)=>(this._precomputedBarStyles.delete(t),!1)))}_visibleBarsCount(){const e=this._model.timeScale().visibleBarsStrictRange();return null==e?void 0:e.count()}_symbolForResolve(){var e;const t=this.symbol();return this._seriesSource.symbolSameAsResolved(t)&&null!==(e=this._seriesSource.resolvedSymbol())&&void 0!==e?e:t}_shouldDefineNumberOfBarsForModifySeries(e){return w.enabled("request_only_visible_range_on_reset")&&e.force||!1}_onShowCountdownChanged(e){e.value()?this._countdownUpdateTimer=this._model.setInterval((()=>{var e,t;return null===(t=(e=this._priceAxisView).updateCountdown)||void 0===t?void 0:t.call(e)}),500):null!==this._countdownUpdateTimer&&(this._model.clearInterval(this._countdownUpdateTimer),this._countdownUpdateTimer=null)}_onFormatterPropsChanged(){this._recreateFormatter(),this._model.fullUpdate()}_updateStatus(e){14!==e.seriesStatus&&this._unsupportedResolutionState.setValue(null),this._status.setValue(e)}_wasCompletedBefore(){var e,t;return this.isCompleted()&&(null===(t=null===(e=this._studyBindings)||void 0===e?void 0:e.wasCompletedBefore())||void 0===t||t)}}},5171:(e,t,i)=>{"use strict";var s;i.r(t),i.d(t,{ChartStyle:()=>W,OldLineStyleTypes:()=>w,SERIES_STATUS_TEXT:()=>b,STATUS_CALCULATION_ERROR:()=>f,STATUS_DELAYED:()=>u,STATUS_DELAYED_STREAMING:()=>p,STATUS_EOD:()=>h,STATUS_ERROR:()=>g,STATUS_INVALID_SYMBOL:()=>l,STATUS_LOADING:()=>o,STATUS_NO_BARS:()=>_,STATUS_OFFLINE:()=>r,STATUS_PULSE:()=>d,STATUS_READY:()=>a,STATUS_REPLAY:()=>m,STATUS_RESOLVING:()=>n,STATUS_SNAPSHOT:()=>c,STATUS_UNSUPPORTED_RESOLUTION:()=>v,STYLE_AREA:()=>T,STYLE_BARS:()=>C,STYLE_BASELINE:()=>E,STYLE_CANDLES:()=>P,STYLE_COLUMNS:()=>R,STYLE_HEIKEN_ASHI:()=>k,STYLE_HILO:()=>B,STYLE_HLC_AREA:()=>F,STYLE_HOLLOW_CANDLES:()=>D,STYLE_KAGI:()=>M,STYLE_LINE:()=>x,STYLE_LINE_WITH_MARKERS:()=>N,STYLE_PB:()=>L,STYLE_PNF:()=>A,STYLE_RANGE:()=>V,STYLE_RENKO:()=>I,STYLE_SHORT_NAMES:()=>H,STYLE_STEPLINE:()=>O,SYMBOL_STRING_DATA:()=>z,Status:()=>s,chartStylesWithAttachedStudies:()=>U,seriesLoadingStatuses:()=>S,seriesReadyStatuses:()=>y}),function(e){e[e.Offline=0]="Offline",e[e.Resolving=1]="Resolving",e[e.Loading=2]="Loading",e[e.Ready=3]="Ready",e[e.InvalidSymbol=4]="InvalidSymbol",e[e.Snapshot=5]="Snapshot",e[e.EOD=6]="EOD",e[e.Pulse=7]="Pulse",e[e.Delayed=8]="Delayed",e[e.DelayedSteaming=9]="DelayedSteaming",e[e.NoBars=10]="NoBars",e[e.Replay=11]="Replay",e[e.Error=12]="Error",e[e.CalculationError=13]="CalculationError",e[e.UnsupportedResolution=14]="UnsupportedResolution"}(s||(s={}))
;const r=0,n=1,o=2,a=3,l=4,c=5,h=6,d=7,u=8,p=9,_=10,m=11,g=12,f=13,v=14,y=new Set([3,6,7,8,9,11]),S=new Set([1,2]),b={[r]:"connecting",[n]:"loading",[o]:"loading",[a]:"realtime",[l]:"invalid",[c]:"snapshot",[h]:"endofday",[d]:"endofday",[u]:"delayed",[p]:"delayed_streaming",[_]:"forbidden",[m]:"replay",[g]:"error",[f]:"calculation_error",[v]:"unsupported_resolution"};var w;!function(e){e[e.Markers=0]="Markers",e[e.Stepline=1]="Stepline",e[e.Simple=2]="Simple"}(w||(w={}));const C=0,P=1,x=2,T=3,I=4,M=5,A=6,L=7,k=8,D=9,E=10,V=11,B=12,R=13,N=14,O=15,F=16;var W;!function(e){e[e.Bar=0]="Bar",e[e.Candle=1]="Candle",e[e.Line=2]="Line",e[e.Area=3]="Area",e[e.Renko=4]="Renko",e[e.Kagi=5]="Kagi",e[e.PnF=6]="PnF",e[e.LineBreak=7]="LineBreak",e[e.HeikinAshi=8]="HeikinAshi",e[e.HollowCandle=9]="HollowCandle",e[e.Baseline=10]="Baseline",e[e.Range=11]="Range",e[e.HiLo=12]="HiLo",e[e.Column=13]="Column",e[e.LineWithMarkers=14]="LineWithMarkers",e[e.Stepline=15]="Stepline",e[e.HLCArea=16]="HLCArea",e[e.VolFootprint=17]="VolFootprint",e[e.TPO=18]="TPO",e[e.VolCandle=19]="VolCandle",e[e.SVP=20]="SVP"}(W||(W={}));const H={0:"bar",1:"candle",9:"hollowCandle",2:"line",14:"lineWithMarkers",15:"stepline",3:"area",16:"hlcArea",4:"renko",7:"pb",5:"kagi",6:"pnf",8:"ha",10:"baseline",11:"range",12:"hilo",13:"column",17:"volFootprint",18:"tpo",19:"volCandles",20:"svp"},z={4:{type:"BarSetRenko@tv-prostudies",basicStudyVersion:73},7:{type:"BarSetPriceBreak@tv-prostudies",basicStudyVersion:34},5:{type:"BarSetKagi@tv-prostudies",basicStudyVersion:73},6:{type:"BarSetPnF@tv-prostudies",basicStudyVersion:73},8:{type:"BarSetHeikenAshi@tv-basicstudies",basicStudyVersion:60},11:{type:"BarSetRange@tv-basicstudies",basicStudyVersion:72},17:{type:"Footprint@tv-volumebyprice",basicStudyVersion:104},18:{type:"TPOPeriodic@tv-volumebyprice",basicStudyVersion:104},20:{type:"VbPSessions@tv-volumebyprice",basicStudyVersion:126}},U=[17,18,20]},3070:(e,t,i)=>{"use strict";i.d(t,{SeriesData:()=>m,barFunction:()=>u,seriesPlotFunctionMap:()=>h});var s,r,n=i(50151),o=i(64755),a=i(29981);!function(e){e[e.FromLeft=-1]="FromLeft",e[e.FromRight=1]="FromRight"}(s||(s={})),function(e){e[e.Time=0]="Time",e[e.Open=1]="Open",e[e.High=2]="High",e[e.Low=3]="Low",e[e.Close=4]="Close",e[e.Volume=5]="Volume",e[e.Adt=6]="Adt"}(r||(r={}));const l={open:e=>e[1],high:e=>e[2],low:e=>e[3],close:e=>e[4],hl2:e=>(e[2]+e[3])/2,hlc3:e=>(e[2]+e[3]+e[4])/3,ohlc4:e=>(e[1]+e[2]+e[3]+e[4])/4},c=["open","high","low","close","hl2","hlc3","ohlc4"];function h(){const e=new Map;return c.forEach(((t,i)=>{e.set(t,u(t))})),e}var d;function u(e,t,i){const s=l[null!=t?t:e],r=l[e],n=l[null!=i?i:e];return(e,t)=>{switch(t){case 0:return s(e);case 2:return n(e);default:return r(e)}}}function p(e,t){return null==e[t]}!function(e){e[e.FirstPrice=0]="FirstPrice",e[e.LastPrice=1]="LastPrice",e[e.LastValuePrice=2]="LastValuePrice"}(d||(d={}));const _=[{barsToMerge:10,forBarspacingLargerThen:.03},{barsToMerge:30,forBarspacingLargerThen:.01},{barsToMerge:100,forBarspacingLargerThen:.003},{barsToMerge:500,
forBarspacingLargerThen:0}];class m{constructor(){this._pressedChunks={chunks:new Map,priceSource:"uninitialized"},this.m_bars=new o.PlotList(h(),p),this.m_nsBars=new o.PlotList(h(),p),this._clearPressedChunks()}bars(){return this.m_bars}nsBars(){return this.m_nsBars}pressedChunks(e,t){if(t!==this._pressedChunks.priceSource){this._pressedChunks.priceSource=t;const e=this.m_bars.first();e&&(this._clearPressedChunks(),this._rebuildPressedChunks(e))}const i=(0,n.ensureDefined)(_.find((t=>t.forBarspacingLargerThen<=e)));return(0,n.ensureDefined)(this._pressedChunks.chunks.get(i.barsToMerge))}mergeRegularBars(e){const t=this.m_bars.size(),i=this.m_bars.merge(e);return i&&"uninitialized"!==this._pressedChunks.priceSource&&(t===this.m_bars.size()&&i.index===this.m_bars.lastIndex()?this._updateLatestChunks():this._rebuildPressedChunks(i)),i}size(){return this.m_bars.size()+this.m_nsBars.size()}each(e){this.m_bars.each(e),this.m_nsBars.each(e)}clear(){this.m_bars.clear(),this.m_nsBars.clear(),this.lastProjectionPrice=void 0,this._clearPressedChunks()}clone(){const e=new m;return e.lastProjectionPrice=this.lastProjectionPrice,e.boxSize=this.boxSize,e.reversalAmount=this.reversalAmount,e.m_bars=this.m_bars.clone(),e.m_nsBars=this.m_bars.clone(),e}isEmpty(){return this.m_bars.isEmpty()&&this.m_nsBars.isEmpty()}first(){return this.m_bars.isEmpty()?this.m_nsBars.first():this.m_bars.first()}last(){return this.m_nsBars.isEmpty()?this.m_bars.last():this.m_nsBars.last()}search(e,t,i){return this.nsBars().isEmpty()?this.bars().search(e,t,i):this.bars().isEmpty()||(0,n.ensureNotNull)(this.nsBars().firstIndex())<=e?this.nsBars().search(e,t,i):this.bars().search(e,t,i)}valueAt(e){const t=this.search(e);return null!==t?t.value:null}plotValueToTimePointIndex(e,t,i){if(i===s.FromRight){const i=(i,s)=>{const r=s[t];return null!=r&&e>=r},s=this.m_bars.findLast(i);if(null!==s)return s.index;const r=this.m_nsBars.findLast(i);return null!==r?r.index:this.m_bars.firstIndex()}if(i===s.FromLeft){const i=(i,s)=>{const r=s[t];return null!=r&&e<=r},s=this.m_bars.findFirst(i);if(null!==s)return s.index;const r=this.m_nsBars.findFirst(i);return null!==r?r.index:this.m_bars.lastIndex()}throw new Error("plotValueToTimePointIndex: unsupported search mode")}moveData(e){this.m_bars.move(e),this.m_nsBars.move(e),this.m_bars.size()>0&&this._rebuildPressedChunks((0,n.ensureNotNull)(this.m_bars.first()))}_rebuildPressedChunks(e){const t=this._pressedChunks.priceSource;if("uninitialized"===t)return;const i=e.index,s=l[t],r=(e,t,i)=>{let r=null;for(const n of e){const e=s(n.value);r&&n.index-r.startTime>=i.barsToMerge&&(t.push(r),r=null),r?(r.endTime=n.index,r.high=Math.max(r.high,e),r.low=Math.min(r.low,e),r.close=e):r={startTime:n.index,endTime:n.index,open:e,high:e,low:e,close:e}}r&&t.push(r)};_.forEach((e=>{const t=(0,n.ensureDefined)(this._pressedChunks.chunks.get(e.barsToMerge)),s=(0,a.lowerbound)(t,i,((e,t)=>e.endTime<t));if(0===s&&t.length>0){const i=t[0].startTime-1,s=(0,n.ensureNotNull)(this.m_bars.firstIndex()),o=this.m_bars.rangeIterator(s,i),a=[]
;r(o,a,e);const l=a.concat(t);this._pressedChunks.chunks.set(e.barsToMerge,l)}else{const i=(0,n.ensureNotNull)(this.m_bars.lastIndex());t.splice(s);let o=(0,n.ensureNotNull)(this.m_bars.firstIndex());t.length&&(o=t[t.length-1].endTime+1);const a=this.m_bars.rangeIterator(o,i);r(a,t,e)}}))}_updateLatestChunks(){const e=(0,n.ensureNotNull)(this.m_bars.last());_.forEach((t=>{const i=(0,n.ensureDefined)(this._pressedChunks.chunks.get(t.barsToMerge)),s=e.value[4],r=i[i.length-1];r.high=Math.max(r.high,s),r.low=Math.min(r.low,s),r.close=s,r.endTime=e.index}))}_clearPressedChunks(){_.forEach((e=>this._pressedChunks.chunks.set(e.barsToMerge,[])))}}},61105:(e,t,i)=>{"use strict";i.d(t,{SeriesTimeRangeVolumeCalculator:()=>s});class s{constructor(e){this._value=null,this._series=e,this._series.dataEvents().dataUpdated().subscribe(this,this._onSeriesUpdated)}destroy(){this._series.dataEvents().dataUpdated().unsubscribeAll(this)}volume(e,t){if(null!==this._value&&this._value.from===e&&this._value.to===t)return this._value.value;let i=0;const s=this._series.data().bars(),r=s.firstIndex(),n=s.lastIndex();if(null!==r&&e<r&&t<r||null!==n&&e>n&&t>n)i=NaN;else{const s=this._series.data().bars().rangeIterator(Math.min(e,t),Math.max(e,t));for(const e of s){const t=e.value[5];if(void 0===t){i=NaN;break}i+=t}}return this._value={from:e,to:t,value:i},i}_onSeriesUpdated(e,t){if(null===this._value)return;if(t)return void(this._value=null);const i=this._series.data().bars().lastIndex();(null===i||i<=this._value.to)&&(this._value=null)}}},68805:(e,t,i)=>{"use strict";i.r(t),i.d(t,{actualSymbol:()=>fe,chartStyleStudyId:()=>z,createSeriesFormatter:()=>K,displayedSymbolExchange:()=>ge,displayedSymbolName:()=>me,extractLineToolSymbolFromSymbolInfo:()=>he,extractSymbolNameFromSymbolInfo:()=>ce,getChartStyleByResolution:()=>H,getDefaultStyle:()=>W,getLastUsedRawDataStyle:()=>F,getLastUsedSingleValueBasedStyle:()=>O,getLastUsedStyle:()=>N,getSeriesDisplayErrorWV:()=>Me,getSeriesPriceFormattingState:()=>$,getSourceForEconomySymbol:()=>pe,getSymbolDelaySeconds:()=>Ae,getSymbolExchange:()=>xe,getTranslatedChartStyleName:()=>x,hasProjection:()=>G,hasVolume:()=>Ce,isCloseBasedSymbol:()=>Se,isConvertedToOtherCurrency:()=>Q,isConvertedToOtherUnit:()=>se,isEconomicSymbol:()=>Pe,isFutureContinuousSymbolWithBackajustment:()=>Te,isFuturesContractSymbol:()=>Ie,isMeasureUnitSymbol:()=>be,isPriceSourceStyle:()=>q,isRangeBasedStyle:()=>I,isRangeStyle:()=>A,isRawDataStyle:()=>V,isRegularSessionId:()=>ye,isRequiringRestartSeriesStyles:()=>T,isSingleValueBasedStyle:()=>E,isStyleSupportedForReplay:()=>k,isTimeBasedStyle:()=>L,isValidStyle:()=>D,measureUnitId:()=>we,preparePriceAxisProperties:()=>U,proSymbol:()=>ve,setLastUsedRawDataStyle:()=>R,setLastUsedStyle:()=>B,styleChangeRequiresRestart:()=>M,symbolBaseCurrency:()=>J,symbolCurrency:()=>Z,symbolCurrencyConvertible:()=>Y,symbolCurrentContract:()=>ne,symbolHasEconomicEvents:()=>le,symbolHasPreOrPostMarket:()=>oe,symbolHasSeveralSessions:()=>ae,symbolOriginalCurrency:()=>X,symbolOriginalUnit:()=>ie,symbolTitle:()=>_e,
symbolTitleSeparator:()=>ue,symbolToSaveInState:()=>de,symbolUnit:()=>te,symbolUnitConvertible:()=>ee,symbolUnitConvertibleGroupsIfExist:()=>re});var s=i(11542),r=i(56840),n=(i(49483),i(88145)),o=i(5171),a=i(85049),l=i(725),c=i(56570),h=i(46084),d=i(719),u=i(4362),p=i(88960),_=i(99531);const m=c.enabled("pay_attention_to_ticker_not_symbol"),g=c.enabled("uppercase_instrument_names"),f=c.enabled("charting_library_single_symbol_request"),v=c.enabled("use_ticker_on_symbol_info_update"),y=c.enabled("hide_object_tree_and_price_scale_exchange_label");var S;!function(e){e.LastUsedStyleKey="chart.lastUsedStyle",e.LastUsedSingleValueBasedStyle="chart.lastUsedSingleValueBasedStyle",e.LastUsedRawDataStyle="chart.rawDataStyle"}(S||(S={}));const b=[4,5,6,7,8],w=[4,5,6,7,11],C=[0,1,9,19,2,14,15,3,16,10,8,12,13,18,17,20],P=[2,14,15,10,3,13,18];function x(e){return{0:s.t(null,void 0,i(27377)),1:s.t(null,void 0,i(45054)),2:s.t(null,void 0,i(3554)),14:s.t(null,void 0,i(9394)),15:s.t(null,void 0,i(69217)),3:s.t(null,void 0,i(34456)),16:s.t(null,void 0,i(99906)),9:s.t(null,void 0,i(13459)),10:s.t(null,void 0,i(59213)),12:s.t(null,void 0,i(98236)),13:s.t(null,void 0,i(55761)),4:s.t(null,void 0,i(88130)),7:s.t(null,void 0,i(43588)),5:s.t(null,void 0,i(83490)),6:s.t(null,void 0,i(76519)),11:s.t(null,void 0,i(55169)),8:s.t(null,void 0,i(63876)),17:s.t(null,void 0,i(92763)),18:s.t(null,void 0,i(17809)),19:s.t(null,void 0,i(93722)),20:s.t(null,void 0,i(83298))}[e]}function T(e){return-1!==b.indexOf(e)}function I(e){return-1!==w.indexOf(e)}function M(e,t){return!A(e)&&!A(t)&&!(e===t||!T(e)&&!T(t))}function A(e){return 11===e}function L(e){return-1!==C.indexOf(e)}function k(e){return 8!==e&&17!==e&&18!==e&&20!==e&&L(e)}function D(e){return I(e)||L(e)}function E(e){switch(e){case 3:case 10:case 2:case 14:case 15:case 13:return!0;default:return!1}}function V(e){return!o.SYMBOL_STRING_DATA[e]}function B(e,t){D(e)&&(11!==e&&r.setValue("chart.lastUsedStyle",e),V(e)&&R(e),Se(t)&&E(e)&&r.setValue("chart.lastUsedSingleValueBasedStyle",e))}function R(e){r.setValue("chart.rawDataStyle",e)}function N(){const e=r.getInt("chart.lastUsedStyle");return void 0===e?1:e}function O(){const e=r.getInt("chart.lastUsedSingleValueBasedStyle");return void 0===e?14:e}function F(){return r.getInt("chart.rawDataStyle",1)}function W(e){return e?11:1}function H(e,t){const i=A(t),s=a.Interval.isRange(e);return!i&&s?W(!0):i&&!s?W(!1):t}function z(e,t){const i=o.SYMBOL_STRING_DATA[e];return void 0===i?null:t?`${i.type}-${i.basicStudyVersion}`:i.type}function U(e){const t=e.priceAxisProperties,i=t.lockScale.value(),s=6===e.style.value();(s||i)&&(t.log.setValue(!1),t.percentage.setValue(!1)),t.logDisabled.setValue(!(!s&&!i)),t.percentageDisabled.setValue(!(!s&&!i))}const j=[4,7,5,6];function G(e){return-1!==j.indexOf(e)}function q(e){return P.includes(e)}function $(e,t="default",i=!1){let s,r,n,o=100,a=1;if("default"===t)null!=e&&(({pricescale:o,minmov:a,minmove2:r,fractional:s}=e),n=e.variable_tick_size||void 0);else{let e=t.split(",");3!==e.length&&(e=["100","1","false"]),
o=parseInt(e[0]),a=parseInt(e[1]),s="true"===e[2]}return i&&(a=1),{priceScale:o,minMove:a,fractional:s,minMove2:r,variableMinTick:n,ignoreMinMove:i}}function K(e,t,i=!1){const{priceScale:s,minMove:r,fractional:n,minMove2:o,variableMinTick:a}=$(e,t,i);if(null!=e){const l=e.format;if("default"===t&&"volume"===l)return new h.VolumeFormatter({precision:2});if("percent"===l)return new d.PercentageFormatter({priceScale:s,minMove:r,fractional:n,minMove2:o,variableMinTick:a,ignoreMinMove:i})}return new l.PriceFormatter({priceScale:s,minMove:r,fractional:n,minMove2:o,variableMinTick:a,ignoreMinMove:i})}function Y(e){return null!==e&&"spread"!==e.type}function Z(e,t,i){if(null===e)return null;const s=!t||i?e.currency_id:e.currency_code;return void 0===s||""===s?null:s}function X(e,t){const i=t?e.original_currency_code:e.original_currency_id;return null!=i?i:Z(e,t)}function J(e){return e.base_currency_id||null}function Q(e){if(null===e||!Y(e))return!1;const t=X(e);return null!==t&&t!==Z(e)}function ee(e,t){return t&&null!==e&&"spread"!==e.type}function te(e,t){if(null===e||!t)return null;const i=e.unit_id;return void 0===i||""===i?null:i}function ie(e,t){return t?e.original_unit_id||te(e,t):null}function se(e,t){return!(null===e||!ee(e,t))&&(void 0!==e.original_unit_id&&e.original_unit_id!==e.unit_id)}function re(e,t){return null!==e&&ee(e,t)?e.unit_conversion_types||null:[]}function ne(e){return"futures"===e.type&&e.front_contract||null}function oe(e){return null!==e&&void 0!==e.subsessions&&e.subsessions.some((e=>"premarket"===e.id||"postmarket"===e.id))}function ae(e){return null!==e&&void 0!==e.subsessions&&e.subsessions.filter((e=>!e.private)).length>1}function le(e){return null!==e&&("forex"===e.type||(0,u.isCFDSymbol)(e.type,e.typespecs)||(0,n.hasCryptoTypespec)(e.typespecs||[]))}function ce(e,t,i,s){let r=e&&(i&&e.pro_name||e.full_name||e.name);return f&&t?r=t:(v||!s&&m)&&e&&e.ticker&&(r=e.ticker),g&&r&&(r=r.toUpperCase()),r}function he(e,t){return ce(e,null,!0,!0)||t}function de(e,t){var i,s;return e&&null!==(s=null!==(i=e.ticker)&&void 0!==i?i:e.pro_name)&&void 0!==s?s:t}const ue="·";function pe(e,t){var i,s;return Pe(e)&&null!==(s=null===(i=e.source2)||void 0===i?void 0:i.description)&&void 0!==s?s:null}function _e(e,t,i="exchange"){var s;const r=null!==(s=pe(e))&&void 0!==s?s:e[i];return t||y?e.name:`${e.name} ${ue} ${r}`}function me(e){let t=e&&(ne(e)||e.name)||"";return t.length>40&&(t=t.substring(0,37)+"..."),t.trim()}function ge(e){const t=e?e.exchange:"";return g?t.toUpperCase():t}function fe(e,t){return null!==e?e.full_name:t}function ve(e,t){var i;return null!==(i=null==e?void 0:e.pro_name)&&void 0!==i?i:t}function ye(e){return"regular"===e||"us_regular"===e}function Se(e){return"c"===(null==e?void 0:e.visible_plots_set)}function be(e){return null!==e&&("unit"===e.measure&&null!==we(e))}function we(e){var t;return null!==(t=null==e?void 0:e.value_unit_id)&&void 0!==t?t:null}function Ce(e){return"ohlcv"===e.visible_plots_set}function Pe(e){return null!==e&&"economic"===e.type}function xe(e){const t=pe(e)
;if(null!==t)return t;return e.exchange}function Te(e){var t;return null!==e&&"futures"===e.type&&Boolean(e.has_backadjustment&&(null===(t=e.typespecs)||void 0===t?void 0:t.includes("continuous")))}function Ie(e){var t;return null!==e&&"futures"===e.type&&!Boolean(null===(t=e.typespecs)||void 0===t?void 0:t.includes("continuous"))}function Me(e){return(0,p.combine)(((t,i)=>{switch(t){case 4:{const t=e.seriesErrorMessage();return null!==t&&("resolution_not_entitled"===t||"custom_resolution"===t||"seconds_not_entitled"===t||"ticks_not_entitled"===t||t.startsWith("study_not_auth:"))?null:{type:"invalid_symbol"}}case 13:{const t=e.seriesErrorMessage();return null===t?null:{type:"calculations_error",errorMessage:t}}case 14:{const t=e.unsupportedResolutionState().value();return null===t?null:{type:"unsupported_resolution",reason:t.reason}}case 1:case 2:return null;default:if(i)return{type:"no_data"}}return null}),e.statusWV().weakReference(),(0,_.createWVFromGetterAndSubscription)((()=>!e.bars().size()&&!e.isInReplay().value()),e.dataEvents().dataUpdated()).ownership(),(0,_.createWVFromGetterAndSubscription)((()=>({})),e.model().onChartThemeLoaded()).ownership())}function Ae(e){var t;return Math.max(0,null!==(t=null==e?void 0:e.delay)&&void 0!==t?t:0)}},32549:(e,t,i)=>{"use strict";TradingView.TIME_PLOT=0,TradingView.OPEN_PLOT=1,TradingView.HIGH_PLOT=2,TradingView.LOW_PLOT=3,TradingView.CLOSE_PLOT=4,TradingView.ADT_PLOT=6;var s=i(41450).SeriesBase,r=i(5171);class n extends s{}Object.assign(n,r),TradingView.Series=n,t.Series=n,t.isSeries=function(e){return e instanceof n}},84626:(e,t,i)=>{"use strict";i.d(t,{SeriesAreaPaneView:()=>l});var s=i(19063),r=i(2271),n=i(95201),o=i(11064),a=i(36897);class l extends a.SeriesSingleLinePaneView{renderer(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);const e=this._source.priceScale();if(!e)return null;const t=this._source.properties().childs().areaStyle.childs(),i=t.transparency.value(),a={simpleMode:!1,barSpacing:this._model.timeScale().barSpacing(),items:this._items,lineColor:t.linecolor.value(),lineStyle:t.linestyle.value(),lineWidth:t.linewidth.value(),isSeries:!0,withMarkers:!1,bottom:e.height(),color1:(0,s.generateColor)(t.color1.value(),i),color2:(0,s.generateColor)(t.color2.value(),i),skipHoles:!0},l=new n.CompositeRenderer;return l.append(new r.PaneRendererArea(a)),this._model.selection().isSelected(this._source)&&this._isMarkersEnabled&&this._selectionData&&l.append(new o.SelectionRenderer(this._selectionData)),l}}},59432:(e,t,i)=>{"use strict";i.d(t,{PaneRendererBars:()=>n});var s=i(61993),r=i(3774);class n extends r.PaneRendererSeriesBase{constructor(e){super(),this._bars=e.bars,this._dontDrawOpen=e.dontDrawOpen,this._thinBars=e.thinBars}_drawImpl(e){const{context:t,horizontalPixelRatio:i,verticalPixelRatio:s}=e;t.save();let r=null;for(const e of this._bars){let n=this._calcRealBarWidth(e.right-e.left,i);if(n>=2){Math.max(1,Math.floor(i))%2!=n%2&&n--}const o=this._thinBars?Math.min(n,Math.floor(i)):n,a=o<=n&&e.right-e.left>=Math.floor(1.5*i)
;r!==e.color&&(t.fillStyle=e.color,r=e.color);const l=Math.floor(.5*o),c=Math.round(e.center*i),h=c-l,d=o,u=h+d-1,p=Math.min(e.high,e.low),_=Math.max(e.high,e.low),m=Math.round(p*s)-l,g=Math.round(_*s)+l,f=Math.max(g-m,o);t.fillRect(h,m,d,f);const v=Math.ceil(1.5*n);if(a){const i=c-v,r=c+v,n=Math.min(h-i,r-u);if(!this._dontDrawOpen){let r=Math.max(m,Math.round(e.open*s)-l),o=r+d-1;o>m+f-1&&(o=m+f-1,r=o-d+1),t.fillRect(i,r,n,o-r+1)}let o=Math.max(m,Math.round(e.close*s)-l),a=o+d-1;a>m+f-1&&(a=m+f-1,o=a-d+1),t.fillRect(u+1,o,n,a-o+1)}}t.restore()}_getTolerance(){return(0,s.interactionTolerance)().series}_calcRealBarWidth(e,t){const i=Math.floor(t);return Math.max(i,Math.floor((0,s.optimalBarWidth)(e,t)))}}},99800:(e,t,i)=>{"use strict";i.d(t,{SeriesBarsPaneView:()=>a});var s=i(95201),r=i(11064),n=i(24997),o=i(59432);class a extends n.SeriesBarCandlesPaneView{renderer(){this._invalidated&&(this._updateImpl(null),this._invalidated=!1);const e=this._source.properties().childs(),t={bars:this._bars,dontDrawOpen:e.barStyle.childs().dontDrawOpen.value(),thinBars:11===e.style.value()?e.rangeStyle.childs().thinBars.value():e.barStyle.childs().thinBars.value()},i=new s.CompositeRenderer;return i.append(new o.PaneRendererBars(t)),this._model.selection().isSelected(this._source)&&this._isMarkersEnabled&&this._selectionData&&i.append(new r.SelectionRenderer(this._selectionData)),i}_createItem(e,t,i){const s={center:NaN,open:NaN,high:NaN,low:NaN,close:NaN,color:i.barColor,left:NaN,right:NaN,timePointIndex:e};return(0,n.baseBarCandlesUpdater)(t,s)?s:null}}},93250:(e,t,i)=>{"use strict";i.d(t,{SeriesBaselinePaneView:()=>g});var s,r=i(19063),n=i(95201),o=i(86441),a=i(5531),l=i(4652),c=i(61993),h=i(29981),d=i(75919),u=i(56468);!function(e){e[e.Top=0]="Top",e[e.Bottom=1]="Bottom"}(s||(s={}));class p extends d.MediaCoordinatesPaneRenderer{constructor(){super(...arguments),this._data=null}setData(e){this._data=e}hitTest(e){if(null===this._data)return null;const{items:t,topLineWidth:i,bottomLineWidth:s}=this._data,r=(0,c.interactionTolerance)().series+(i+s)/4,n=(0,h.lowerbound)(t,e,((e,t)=>e.center<=t.x)),a=Math.max(1,n-1),d=Math.min(t.length-1,n+1);for(let i=a;i<=d;++i){const s=t[i-1],n=t[i],{distance:a}=(0,l.distanceToSegment)((0,o.point)(s.center,s.y),(0,o.point)(n.center,n.y),(0,o.point)(e.x,e.y));if(a<=r)return new u.HitTestResult(u.HitTarget.Regular)}return null}_drawImpl(e){if(null===this._data)return;const{items:t,baseLevelCoordinate:i,bottom:s,bottomFillColor1:r,bottomFillColor2:n,topFillColor1:l,topFillColor2:h,topLineColor:d,bottomLineColor:u,topLineWidth:p,bottomLineWidth:_}=this._data;if(!function(e){if(0===e.length)return!1;const t=e.findIndex((e=>(0,c.coordinateIsValid)(e.y)));if(-1===t)return!1;let i=e.length-1;for(;i>t&&!(0,c.coordinateIsValid)(e[i].y);)i--;return!(t>i)}(t))return;const m=e.context,{topItems:g,bottomItems:f}=function(e,t){const i=[],s=[];let r=null;for(let n=0;n<e.length;n++){let l=e[n];const h=e[n+1]||{};if((0,c.coordinateIsValid)(l.y))l.y<=t&&i.push(l),l.y>=t&&s.push(l),r=l;else{if(null===r)continue;l=r}
if((0,c.coordinateIsValid)(h.y)&&(l.y>t&&h.y<t||l.y<t&&h.y>t))if(Math.abs(l.center-h.center)<1){const e={center:l.center,y:t};i.push(e),s.push(e)}else{const e=(0,a.intersectLineSegments)((0,o.point)(l.center,l.y),(0,o.point)(h.center,h.y),(0,o.point)(l.center,t),(0,o.point)(h.center,t));if(null!==e){const t={center:l.center+(h.center-l.center)*e,y:l.y+(h.y-l.y)*e};i.push(t),s.push(t)}}}return{topItems:i,bottomItems:s}}(t,i);m.lineCap="round",m.lineJoin="round",0!==g.length&&(m.beginPath(),m.moveTo(g[0].center,i),this._makeLine(m,g,!0,0),m.closePath(),m.fillStyle=this._makeLinearGradient(m,l,h,i-s,i),m.fill(),m.beginPath(),this._makeLine(m,g,!1,0),m.lineWidth=p,m.strokeStyle=d,m.stroke()),0!==f.length&&(m.beginPath(),m.moveTo(f[0].center,i),this._makeLine(m,f,!0,1),m.closePath(),m.fillStyle=this._makeLinearGradient(m,r,n,i,i+s),m.fill(),m.beginPath(),this._makeLine(m,f,!1,1),m.lineWidth=_,m.strokeStyle=u,m.stroke())}_makeLine(e,t,i,s){if(null===this._data)return;const r=t.findIndex((e=>(0,c.coordinateIsValid)(e.y)));if(-1===r)return;const{barSpacing:n,baseLevelCoordinate:o}=this._data,a=.25*n;let l;const h=t.length;for(let n=r;n<h;n++){const h=t[n],d=t[n+1]||{};if((0,c.coordinateIsValid)(h.y)){if(0===s){if(l&&l.y>=o&&h.y>=o){e.moveTo(h.center,h.y);continue}}else if(l&&l.y<=o&&h.y<=o){e.moveTo(h.center,h.y);continue}if(l&&(0,c.coordinateIsValid)(l.y))e.lineTo(h.center,h.y),i&&!(0,c.coordinateIsValid)(d.y)&&e.lineTo(h.center,o);else if(d&&(0,c.coordinateIsValid)(d.y))i?(n!==r&&e.lineTo(h.center,o),e.lineTo(h.center,h.y)):e.moveTo(h.center,h.y);else if(i){if(0===n)continue;n!==r&&e.lineTo(h.center-a,o),e.lineTo(h.center-a,h.y),e.lineTo(h.center+a,h.y),e.lineTo(h.center+a,o)}else e.moveTo(h.center-a,h.y),e.lineTo(h.center+a,h.y);l=h}}}_makeLinearGradient(e,t,i,s,r){const n=e.createLinearGradient(0,s,0,r);return n.addColorStop(0,t),n.addColorStop(1,i),n}}var _=i(11064),m=i(36897);class g extends m.SeriesSingleLinePaneView{constructor(){super(...arguments),this._renderer=new p,this._topFillColor1="",this._topFillColor2="",this._bottomFillColor1="",this._bottomFillColor2="",this._topLineColor="",this._bottomLineColor="",this._topLineWidth=0,this._bottomLineWidth=0,this._barSpacing=0,this._bottom=0,this._baseLevelCoordinate=0}renderer(){this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer.setData({items:this._items,topFillColor1:this._topFillColor1,topFillColor2:this._topFillColor2,bottomFillColor1:this._bottomFillColor1,bottomFillColor2:this._bottomFillColor2,topLineColor:this._topLineColor,bottomLineColor:this._bottomLineColor,topLineWidth:this._topLineWidth,bottomLineWidth:this._bottomLineWidth,barSpacing:this._barSpacing,baseLevelCoordinate:this._baseLevelCoordinate,bottom:this._bottom});const e=new n.CompositeRenderer;return e.append(this._renderer),this._model.selection().isSelected(this._source)&&this._isMarkersEnabled&&this._selectionData&&e.append(new _.SelectionRenderer(this._selectionData)),e}_updateImpl(){super._updateImpl();const e=this._source.priceScale();if(!e)return
;const t=this._source.properties().childs().baselineStyle.childs(),i=t.transparency.value();this._topFillColor1=(0,r.generateColor)(t.topFillColor1.value(),i),this._topFillColor2=(0,r.generateColor)(t.topFillColor2.value(),i),this._bottomFillColor1=(0,r.generateColor)(t.bottomFillColor1.value(),i),this._bottomFillColor2=(0,r.generateColor)(t.bottomFillColor2.value(),i),this._topLineColor=t.topLineColor.value(),this._bottomLineColor=t.bottomLineColor.value(),this._topLineWidth=t.topLineWidth.value(),this._bottomLineWidth=t.bottomLineWidth.value(),this._barSpacing=this._model.timeScale().barSpacing(),this._bottom=e.height(),this._baseLevelCoordinate=Math.round(this._bottom*(Math.abs(100-t.baseLevelPercentage.value())/100))}}},12374:(e,t,i)=>{"use strict";i.d(t,{SeriesWaterlinePaneView:()=>a});var s=i(52397),r=i(72791),n=i(56468),o=i(51056);class a extends s.HorizontalLinePaneView{constructor(e){super(),this._getters=e;const t={cursorType:r.PaneCursorType.VerticalResize,activeItem:0,areaName:n.AreaName.SourceItemMove};this._lineRenderer.setHitTest(new n.HitTestResult(n.HitTarget.MovePoint,t)),this._lineRendererData.visible=!0,this._lineRendererData.linestyle=o.LINESTYLE_SPARSE_DOTTED}_updateImpl(){const{baseLevelPercentage:e,paneHeight:t,color:i}=this._getters,s=Math.abs(100-e());this._lineRendererData.y=Math.round(t()*(s/100)),this._lineRendererData.color=i()}}},3774:(e,t,i)=>{"use strict";i.d(t,{PaneRendererSeriesBase:()=>n});var s=i(56468),r=i(30125);class n extends r.BitmapCoordinatesPaneRenderer{constructor(){super(...arguments),this._bars=[]}hitTest(e){const t=this._bars;if(0===t.length)return null;const i=this._getTolerance(),s=t[0],r=t[t.length-1];if(e.x<s.left-i)return null;if(e.x>r.right+i)return null;let n=0,o=t.length-1,a=-1;for(;n<=o;){const i=Math.floor((n+o)/2),s=t[i];if(e.x>=s.left&&e.x<=s.right){a=i;break}e.x>s.right?n=i+1:o=i-1}if(-1===a)return null;if(this._isPointAtBar(t[a],e.y,i))return this._getHitTest();let l=a;for(;l>=1&&e.x-t[l-1].right<i;)l--;let c=a;for(;c<=t.length-2&&t[c+1].left-e.x<i;)c++;const h=Math.max(0,l),d=Math.min(t.length-1,c);for(let s=h;s<=d;s++)if(s!==a&&this._isPointAtBar(t[s],e.y,i))return this._getHitTest();return null}_getHitTest(){return new s.HitTestResult(s.HitTarget.Regular)}_isPointAtBar(e,t,i){const s=Math.min(e.high,e.low),r=Math.max(e.high,e.low);return s-i<=t&&t<=r+i}}},25201:(e,t,i)=>{"use strict";i.d(t,{PaneRendererCandles:()=>h});var s,r=i(50151),n=i(56468),o=i(37743),a=i(61993),l=i(3774);function c(e,t,i,s){const r=Math.floor(t);return e.map((e=>{let n=(0,a.optimalCandlestickWidth)((e.right-e.left)*s,t);n>=2&&r%2!=n%2&&n--;const o=Math.floor(.5*n),l=function(e,t){let i=Math.floor(1*t);e<=2*i&&(i=Math.floor(.5*(e-1)));const s=Math.max(Math.floor(t),i);if(e<=2*s)return Math.max(Math.floor(t),Math.floor(1*t));return s}(n,t),c=Math.round(e.center*t),h=c-o,d=h+n-1,u=Math.abs(Math.max(e.open,e.close)-Math.min(e.open,e.close))*i,p=Math.round(Math.min(e.open,e.close)*i),_=Math.round(Math.max(e.open,e.close)*i);let m=Math.min(Math.floor(t),Math.floor(n*t))
;m=Math.max(Math.floor(t),Math.min(m,n));const g=Math.floor(.5*m);return{rawBodyHeight:u,top:p,bottom:_,center:c,left:h,right:d,candleWidth:n,high:Math.round(e.high*i),low:Math.round(e.low*i),wickWidth:m,wickOffset:g,borderWidth:l}}))}!function(e){e[e.BarBorderWidth=1]="BarBorderWidth"}(s||(s={}));class h extends l.PaneRendererSeriesBase{constructor(e){super(),this._scaleCoeff=1,this._borderVisible=!1,this._wickVisible=!1,this._bodyVisible=!0,this._borderColor=void 0,this._wickColor=void 0,this._hittest=void 0,this._isPriceScaleInverted=!1,e&&this.setData(e)}setData(e){var t;this._bars=e.bars,this._scaleCoeff=null!==(t=e.scaleCoeff)&&void 0!==t?t:1,this._borderVisible=e.borderVisible,this._bodyVisible=e.bodyVisible,this._wickVisible=e.wickVisible,this._borderColor=e.borderColor,this._wickColor=e.wickColor,this._hittest=e.hittest,this._isPriceScaleInverted=e.isPriceScaleInverted}hitTest(e){return this._wickVisible||this._borderVisible||this._bodyVisible?super.hitTest(e):null}_drawImpl(e){const{context:t,horizontalPixelRatio:i,verticalPixelRatio:s}=e;if(0===this._bars.length)return;const r=c(this._bars,i,s,this._scaleCoeff);this._wickVisible&&this._drawWicks(t,r),this._borderVisible&&this._drawBorder(t,r),this._bodyVisible&&this._drawCandles(t,r)}_getTolerance(){return(0,a.interactionTolerance)().series}_getHitTest(){return this._hittest||new n.HitTestResult(n.HitTarget.Regular)}_isPointAtBar(e,t,i){const s=this._bodyVisible||this._borderVisible,r=this._wickVisible;if(!s&&!r)return!1;if(s){const s=r?Math.min(e.high,e.low):Math.min(e.open,e.close),n=r?Math.max(e.high,e.low):Math.max(e.open,e.close);return s-i<=t&&t<=n+i}{const s=Math.min(e.open,e.close),r=Math.max(e.open,e.close);return e.high-i<=t&&t<=s+i||r-i<=t&&t<=e.low+i}}_drawWicks(e,t){let i="",s=null;this._bars.forEach(((n,o)=>{const a=n.wickColor?n.wickColor:(0,r.ensureDefined)(this._wickColor);a!==i&&(e.fillStyle=a,i=a);let{top:l,bottom:c}=t[o];const{rawBodyHeight:h,borderWidth:d,center:u,high:p,low:_,wickWidth:m,wickOffset:g}=t[o];this._isPriceScaleInverted&&([c,l]=[l,c]);let f=u-g;const v=f+m-1;null!==s&&(f=Math.max(s+1,f),f=Math.min(f,v));const y=v-f+1;h<=d&&(l!==p&&(l=Math.round(l-.5*d)),c=c!==_?Math.round(l-.5*d)+d-1:_-1),l!==p&&e.fillRect(f,p,y,l-p),_-c-1&&e.fillRect(f,c+1,y,_-c-1),s=v}))}_drawBorder(e,t){let i="",s=null;this._bars.forEach(((n,a)=>{if(n.borderColor!==i&&(e.fillStyle=n.borderColor?n.borderColor:(0,r.ensureDefined)(this._borderColor),i=n.borderColor),this._bodyVisible&&n.hollow)return;let{left:l}=t[a];const{rawBodyHeight:c,top:h,bottom:d,right:u,borderWidth:p}=t[a];null!==s&&(l=Math.max(s+1,l),l=Math.min(l,u));const _=u-l+1;c<=p?e.fillRect(l,Math.round(h-.5*p),_,p):_>2*p?(0,o.fillRectInnerBorder)(e,l,h,u-l+1,d-h+1,p):e.fillRect(l,h,_,d-h+1),s=u}))}_drawCandles(e,t){let i="";this._bars.forEach(((s,r)=>{let{top:n,bottom:a,left:l,right:c}=t[r];const{rawBodyHeight:h,borderWidth:d,candleWidth:u}=t[r];if(!(this._borderVisible&&u<=2*d)||s.hollow){if(s.color!==i){const t=s.color;e.fillStyle=t,i=t}if(s.hollow)e.fillStyle=s.color,
h<=d?e.fillRect(l,Math.round(n-.5*d),u,d):(0,o.fillRectInnerBorder)(e,l,n,c-l+1,a-n+1,d);else{if(!this._borderVisible&&h<=d)return void e.fillRect(l,Math.round(n-.5*d),u,d);if(this._borderVisible&&(l+=d,n+=d,c-=d,a-=d),n>a)return;e.fillRect(l,n,c-l+1,a-n+1)}}}))}}},72476:(e,t,i)=>{"use strict";i.d(t,{SeriesCandlesPaneView:()=>l});var s=i(95201),r=i(61993),n=i(11064),o=i(24997),a=i(25201);class l extends o.SeriesBarCandlesPaneView{constructor(e,t,i=1){super(e,t),this._scaleCoeff=1,this._scaleCoeff=i}renderer(){this._invalidated&&(this._updateImpl(null),this._invalidated=!1);const e=this._source.priceScale();if(!e)return null;const t=this._source.properties().childs(),i=1===t.style.value()?t.candleStyle.childs():19===t.style.value()?t.volCandlesStyle.childs():t.volFootprintStyle.childs(),o=this._model.timeScale().barSpacing(),l={bars:this._bars,barSpacing:o,bodyVisible:i.drawBody.value(),borderVisible:i.drawBorder.value(),borderColor:i.borderColor.value(),wickColor:i.wickColor.value(),barWidth:(0,r.optimalBarWidth)(o),wickVisible:i.drawWick.value(),isPriceScaleInverted:e.isInverted(),scaleCoeff:this._scaleCoeff},c=new s.CompositeRenderer;return c.append(new a.PaneRendererCandles(l)),this._model.selection().isSelected(this._source)&&this._isMarkersEnabled&&this._selectionData&&c.append(new n.SelectionRenderer(this._selectionData)),c}_createItem(e,t,i){const s={center:NaN,open:NaN,high:NaN,low:NaN,close:NaN,left:NaN,right:NaN,timePointIndex:e,color:i.barColor,borderColor:i.barBorderColor,wickColor:i.barWickColor,hollow:i.isBarHollow};return(0,o.baseBarCandlesUpdater)(t,s)?s:null}}},53766:(e,t,i)=>{"use strict";i.d(t,{SeriesColumnsPaneView:()=>p});var s=i(50151),r=i(86441),n=i(56570),o=i(3308),a=i(56468),l=i(95201),c=i(8025),h=i(66540),d=i(11064),u=i(81368);class p{constructor(e,t){this._items=[],this._invalidated=!0,this._isMarkersEnabled=(0,n.enabled)("source_selection_markers"),this._selectionData=null,this._histogramBase=0,this._source=e,this._model=t,this._selectionIndexer=new h.SelectionIndexes(t.timeScale())}update(){this._invalidated=!0}renderer(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);const e={barSpacing:this._model.timeScale().barSpacing(),items:this._items,lineColor:"",histogramBase:this._histogramBase},t=new l.CompositeRenderer;return t.append(new u.PaneRendererColumns(e)),this._model.selection().isSelected(this._source)&&this._isMarkersEnabled&&this._selectionData&&t.append(new d.SelectionRenderer(this._selectionData)),t}_updateImpl(){this._items=[];const e=this._model.timeScale(),t=this._source.priceScale();if(e.isEmpty()||!t||t.isEmpty())return;const i=e.visibleBarsStrictRange();if(null===i)return;if(0===this._source.bars().size())return;const n=this._source.nearestIndex(i.firstBar(),c.PlotRowSearchMode.NearestRight),l=this._source.nearestIndex(i.lastBar(),c.PlotRowSearchMode.NearestLeft);if(void 0===n||void 0===l)return;const h=this._source.bars().range(n,l),d=this._source.barColorer(),u={},p=this._source.barFunction(),_=h.reduce(((e,t,s)=>{const r=p(s);if(!(0,o.default)(r))return e
;u.value=s;let n=this._source.precomputedBarStyle(s);return void 0===n&&(n=d.barStyle(t,!1,u),this._source.setPrecomputedBarStyle(s,n)),this._items.push({timePointIndex:t,left:NaN,center:NaN,right:NaN,y:r,style:n}),u.previousValue=s,i.contains(t)&&null!=e?e:r}),null);if(null!==_)if(t.pointsArrayToCoordinates(this._items,_),e.fillBarBorders(this._items),this._histogramBase=t.isInverted()?0:t.height(),this._model.selection().isSelected(this._source)){const i=this._selectionIndexer.indexes();this._selectionData={points:[],bgColors:[],visible:!0,barSpacing:e.barSpacing(),hittestResult:a.HitTarget.Regular};const n=(0,s.ensureNotNull)(this._model.paneForSource(this._source)).height();this._selectionData.hittestResult=a.HitTarget.Regular;for(let s=0;s<i.length;s++){const o=i[s],a=this._source.bars().valueAt(o);if(null===a)continue;const l=p(a),c=e.indexToCoordinate(o),h=t.priceToCoordinate(l,_);this._selectionData.points.push(new r.Point(c,h)),this._selectionData.bgColors.push(this._model.backgroundColorAtYPercentFromTop(h/n))}}else this._selectionIndexer.clear()}}},83379:(e,t,i)=>{"use strict";i.d(t,{SeriesHiLoPaneView:()=>f});var s=i(48874),r=i(68979),n=i(29981),o=i(61993),a=i(56468),l=i(75919);class c extends l.MediaCoordinatesPaneRenderer{constructor(){super(...arguments),this._data=null,this._barWidth=null}setData(e){this._data=e,this._barWidth=Math.max(1,Math.round((0,o.optimalHiLoWidth)(e.barSpacing)))}hitTest(e){if(null===this._data||null===this._barWidth)return null;const t=this._data.bars,i=.5*this._data.barSpacing;if(0===t.length)return null;if(e.x<t[0].center-i)return null;if(e.x>t[t.length-1].center+i)return null;const s=t[(0,n.lowerbound)(t,e.x-i,((e,t)=>e.center<t))];if(e.x<s.center-i||e.x>s.center+i)return null;const r=(0,o.interactionTolerance)().series+this._barWidth/2,l=Math.min(s.high,s.low),c=Math.max(s.high,s.low),h=this._data.fontSize;return l-r-h<=e.y&&e.y<=l+r||c-r<=e.y&&e.y<=c+r+h?new a.HitTestResult(a.HitTarget.Regular):null}_drawImpl(e){if(null===this._data||null===this._barWidth)return;const{font:t,fontSize:i,labelColor:s,bars:n,inverted:o,labelsPadding:a}=this._data,l=e.context;l.textAlign="center",l.fillStyle=s,l.font=(0,r.makeFont)(i,t);for(let e=0;e<n.length;++e){const t=n[e],i=Math.round(Math.min(t.high,t.low)),s=Math.round(Math.max(t.high,t.low)),r=Math.round(t.center);l.textBaseline="alphabetic",l.fillText(o?t.lowLabel:t.highLabel,r,i-a),l.textBaseline="top",l.fillText(o?t.highLabel:t.lowLabel,r,s+a)}}}var h,d=i(95201),u=i(11064),p=i(15938),_=i(7114),m=i(25201),g=i(24997);!function(e){e[e.MaxFontSize=36]="MaxFontSize",e[e.MinFontSize=8]="MinFontSize"}(h||(h={}));class f extends g.SeriesBarCandlesPaneView{constructor(e,t){super(e,t),this._labelsRenderer=new c,this._candlesRenderer=new m.PaneRendererCandles,this._maxLengthLabel="",this._calculateFontSize=(0,s.default)(((e,t)=>Math.max(1,(0,n.lowerboundExt)((e=>e+1),null,(i=>{const s=(0,r.makeFont)(i,p.CHART_FONT_FAMILY);return(0,_.measureText)(e,s).width<=t}),7,36))),((e,t)=>`${e}/${t}`))}renderer(){const e=this._source.priceScale()
;if(!e||e.isEmpty())return null;const t=new d.CompositeRenderer,i=this._needLabels(),s=this._source.properties().childs().hiloStyle.childs(),r=this._model.timeScale().barSpacing();if(this._invalidated){const e=this._source.formatter();this._maxLengthLabel="",this._updateImpl({generateLabels:i,formatter:e}),this._invalidated=!1}if(this._candlesRenderer.setData({bars:this._bars,wickVisible:!1,bodyVisible:s.drawBody.value(),barSpacing:r,borderVisible:s.showBorders.value(),barWidth:(0,o.optimalHiLoWidth)(r),isPriceScaleInverted:e.isInverted()}),t.append(this._candlesRenderer),i){const i=this._calculateLabelFontSize();i&&i>=8&&(this._labelsRenderer.setData({bars:this._bars,barSpacing:r,font:p.CHART_FONT_FAMILY,fontSize:i,labelColor:s.labelColor.value(),inverted:e.isInverted(),labelsPadding:.4*i}),t.append(this._labelsRenderer))}return this._model.selection().isSelected(this._source)&&this._isMarkersEnabled&&this._selectionData&&t.append(new u.SelectionRenderer(this._selectionData)),t}topPixelMargin(){return this._margin()}bottomPixelMargin(){return this._margin()}_createItem(e,t,i,s){const r={center:NaN,left:NaN,right:NaN,open:NaN,high:NaN,low:NaN,close:NaN,color:i.barColor,borderColor:i.barBorderColor,hollow:!1,highLabel:"",lowLabel:"",timePointIndex:e};if(!(0,g.baseBarCandlesUpdater)(t,r))return null;if(r.open=r.high,r.close=r.low,s.generateLabels){const e=s.formatter.format(r.high),t=s.formatter.format(r.low);r.highLabel=e,r.lowLabel=t;const i=(e.length>t.length?e:t).replace(/\d/g,"0");i.length>this._maxLengthLabel.length&&(this._maxLengthLabel=i)}return r}_margin(){if(this._needLabels()){const e=this._calculateLabelFontSize();if(e&&e>=8)return 1.4*e}return 0}_calculateLabelFontSize(){return""===this._maxLengthLabel?null:this._calculateFontSize(this._maxLengthLabel,Math.floor(this._model.timeScale().barSpacing())-2)}_needLabels(){const e=this._source.properties().childs().hiloStyle.childs().showLabels.value(),t=this._model.timeScale().barSpacing();return e&&t>5}}},70527:(e,t,i)=>{"use strict";i.d(t,{SeriesHLCAreaPaneView:()=>g});var s=i(86441),r=i(50151),n=i(56570),o=i(67716),a=i(66540),l=i(11064),c=i(8025),h=i(61993),d=i(95201),u=i(56468),p=i(74010),_=i(59152);class m extends _.ObjectValuesCache{_newObject(){return{high:void 0,close:void 0,low:void 0}}_clearObject(e){e.high=void 0,e.close=void 0,e.low=void 0}}class g{constructor(e,t){this._isMarkersEnabled=(0,n.enabled)("source_selection_markers"),this._hlcAreaCache=new m,this._highPoints=new _.CachedContainer,this._closePoints=new _.CachedContainer,this._lowPoints=new _.CachedContainer,this._barsBorders=new _.CachedContainer,this._filledAreas=new o.CachedMap,this._renderer=new d.CompositeRenderer,this._invalidated=!0,this._source=e,this._model=t,this._selectionIndexer=new a.SelectionIndexes(t.timeScale())}update(){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer}_updateImpl(){var e,t,i,n,a,d,_,m,g;this._renderer.clear();const f=this._model.timeScale(),v=this._source.priceScale()
;if(f.isEmpty()||!v||v.isEmpty())return;const y=f.visibleBarsStrictRange();if(null===y)return;if(0===this._source.bars().size())return;const S=this._source.firstValue();if(null===S)return;const b=null!==(e=this._source.nearestIndex(y.firstBar()-1,c.PlotRowSearchMode.NearestLeft))&&void 0!==e?e:y.firstBar()-1,w=null!==(t=this._source.nearestIndex(y.lastBar()+1,c.PlotRowSearchMode.NearestRight))&&void 0!==t?t:y.lastBar()+1;this._hlcAreaCache.invalidateCache(),this._hlcAreaCache.setStartIndex(b),this._barsBorders.invalidateCache(),this._highPoints.invalidateCache(),this._lowPoints.invalidateCache(),this._closePoints.invalidateCache(),this._filledAreas.invalidateCache();let C,P,x;this._source.bars().range(b,w).each(((e,t)=>{if(this._hlcAreaCache.isValidIndex(e)){const i=this._hlcAreaCache.at(e);i.close=t[4],i.high=t[2],i.low=t[3]}return!1}));const T=new Map,I=b+this._hlcAreaCache.length();for(let e=b;e<I;e++){const t=this._hlcAreaCache.at(e),s=null!==(i=t.close)&&void 0!==i?i:null,r=null!==(n=t.high)&&void 0!==n?n:null,o=null!==(a=t.low)&&void 0!==a?a:null;(null!==s||null!==r||null!==o||Number.isFinite(C)||Number.isFinite(P)||Number.isFinite(x))&&(C=s,P=r,x=o,this._highPoints.push(r),this._closePoints.push(s),this._lowPoints.push(o),this._barsBorders.push({timePointIndex:e,left:NaN,center:NaN,right:NaN}),T.set(e,this._barsBorders.length()-1))}v.pricesArrayToCoordinates(this._highPoints.data(),S,this._highPoints.length()),v.pricesArrayToCoordinates(this._closePoints.data(),S,this._closePoints.length()),v.pricesArrayToCoordinates(this._lowPoints.data(),S,this._lowPoints.length()),f.fillBarBorders(this._barsBorders.data(),{startItemIndex:0,endItemIndex:this._barsBorders.length()});const M=this._source.properties().childs().hlcAreaStyle.childs(),A=M.highCloseFillColor.value(),L=M.closeLowFillColor.value(),k=null!==(d=this._filledAreas.get(A))&&void 0!==d?d:new o.AreaBackgroundItemsGroup({type:0,color:A}),D=null!==(_=k.newItem())&&void 0!==_?_:new o.AreaBackgroundItem;k.push(D),this._filledAreas.set(A,k);const E=null!==(m=this._filledAreas.get(L))&&void 0!==m?m:new o.AreaBackgroundItemsGroup({type:0,color:L}),V=null!==(g=E.newItem())&&void 0!==g?g:new o.AreaBackgroundItem;E.push(V),this._filledAreas.set(L,E);const B=[],R=[],N=[],O=this._barsBorders.length();for(let e=0;e<O;e++){const t=this._closePoints.at(e),i=this._highPoints.at(e),s=this._lowPoints.at(e),r=this._barsBorders.at(e),n=r.center,o=(0,h.coordinateIsValid)(t),a=(0,h.coordinateIsValid)(i),l=(0,h.coordinateIsValid)(s);o&&a&&l&&(D.addPoints1Point(n,i),D.addPoints2Point(n,t),V.addPoints1Point(n,t),V.addPoints2Point(n,s),B.push({y:i,...r}),R.push({y:t,...r}),N.push({y:s,...r}))}const F=f.barSpacing();if(this._renderer.append(new o.AreaBackgroundRenderer({barSpacing:F,colorAreas:this._filledAreas})),this._renderer.append(new p.PaneRendererLine({barSpacing:F,items:N,simpleMode:!0,withMarkers:!1,lineColor:M.lowLineColor.value(),lineStyle:M.lowLineStyle.value(),lineWidth:M.lowLineWidth.value(),skipHoles:!0})),this._renderer.append(new p.PaneRendererLine({barSpacing:F,
items:B,simpleMode:!0,withMarkers:!1,lineColor:M.highLineColor.value(),lineStyle:M.highLineStyle.value(),lineWidth:M.highLineWidth.value(),skipHoles:!0})),this._renderer.append(new p.PaneRendererLine({barSpacing:F,items:R,simpleMode:!0,withMarkers:!1,lineColor:M.closeLineColor.value(),lineStyle:M.closeLineStyle.value(),lineWidth:M.closeLineWidth.value(),skipHoles:!0})),this._model.selection().isSelected(this._source)&&this._isMarkersEnabled){const e=this._selectionIndexer.indexes(),t=[],i=[],n=(0,r.ensureNotNull)(this._model.paneForSource(this._source)).height();for(let r=0;r<e.length;r++){const o=e[r],a=T.get(o);if(void 0===a)continue;const l=this._closePoints.at(a),c=this._barsBorders.at(a).center;t.push(new s.Point(c,l)),i.push(this._model.backgroundColorAtYPercentFromTop(l/n))}this._renderer.append(new l.SelectionRenderer({bgColors:i,points:t,visible:!0,barSpacing:f.barSpacing(),hittestResult:u.HitTarget.Regular}))}else this._selectionIndexer.clear()}}},15599:(e,t,i)=>{"use strict";i.d(t,{SeriesHollowCandlesPaneView:()=>l});var s=i(95201),r=i(61993),n=i(11064),o=i(25201),a=i(72476);class l extends a.SeriesCandlesPaneView{renderer(){this._invalidated&&(this._updateImpl(null),this._invalidated=!1);const e=this._source.priceScale();if(!e)return null;const t=this._source.properties().childs().hollowCandleStyle.childs(),i=this._model.timeScale().barSpacing(),a={bars:this._bars,barSpacing:i,bodyVisible:t.drawBody.value(),borderVisible:t.drawBorder.value(),borderColor:t.borderColor.value(),wickColor:t.wickColor.value(),barWidth:(0,r.optimalBarWidth)(i),wickVisible:t.drawWick.value(),isPriceScaleInverted:e.isInverted()},l=new s.CompositeRenderer;return l.append(new o.PaneRendererCandles(a)),this._model.selection().isSelected(this._source)&&this._isMarkersEnabled&&this._selectionData&&l.append(new n.SelectionRenderer(this._selectionData)),l}}},80941:(e,t,i)=>{"use strict";i.d(t,{SeriesLinePaneView:()=>c});var s=i(56468),r=i(95201),n=i(74010),o=i(3385),a=i(11064),l=i(36897);class c extends l.SeriesSingleLinePaneView{renderer(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);const e=this._source.properties().childs(),t=e.style.value();let i,l=!1;2===t?i=e.lineStyle.childs():14===t?(i=e.lineWithMarkersStyle.childs(),l=!0):15===t?i=e.steplineStyle.childs():18===t&&(i=e.tpoStyle.childs());const c={barSpacing:this._model.timeScale().barSpacing(),items:this._items,lineColor:i.color.value(),lineStyle:i.linestyle.value(),withMarkers:l,lineWidth:i.linewidth.value(),simpleMode:!0,hitTestResult:s.HitTarget.Regular,skipHoles:!0};let h,d;if(h=15===t?new o.PaneRendererStepLine(c):new n.PaneRendererLine(c),this._model.selection().isSelected(this._source)&&this._isMarkersEnabled&&this._selectionData){const e=new r.CompositeRenderer;e.append(h),e.append(new a.SelectionRenderer(this._selectionData)),d=e}else d=h;return d}}},24997:(e,t,i)=>{"use strict";i.d(t,{SeriesBarCandlesPaneView:()=>h,baseBarCandlesUpdater:()=>c});var s=i(86441),r=i(56570),n=i(66540),o=i(8025),a=i(56468);function l(e){return null!=e}function c(e,t){
const i=e[1],s=e[2],r=e[3],n=e[4];return!!(l(i)&&l(s)&&l(r)&&l(n))&&(t.open=i,t.high=s,t.low=r,t.close=n,!0)}class h{constructor(e,t){this._bars=[],this._invalidated=!0,this._isMarkersEnabled=(0,r.enabled)("source_selection_markers"),this._selectionData=null,this._source=e,this._model=t,this._selectionIndexer=new n.SelectionIndexes(t.timeScale())}items(){return this._bars}update(){this._invalidated=!0}_updateImpl(e){const t=this._model.timeScale(),i=this._source.priceScale();if(this._bars=[],t.isEmpty()||!i||i.isEmpty())return;const r=t.visibleBarsStrictRange();if(null===r)return;if(0===this._source.bars().size())return;let n=this._source.nearestIndex(r.firstBar(),o.PlotRowSearchMode.NearestRight);const l=this._source.nearestIndex(r.lastBar(),o.PlotRowSearchMode.NearestLeft);if(void 0===n||void 0===l)return;for(;n<=l;n++){if(null!==this._source.bars().valueAt(n))break}if(n>l)return;const c=this._source.bars().range(n,l),h=this._source.barColorer(),d={};if(c.each(((t,i)=>{d.value=i;let s=this._source.precomputedBarStyle(i);void 0===s&&(s=h.barStyle(t,!1,d),this._source.setPrecomputedBarStyle(i,s));const r=this._createItem(t,i,s,e);return!!r&&(d.previousValue=i,this._bars.push(r),!1)})),0===this._bars.length)return;const u=this._source.firstValue();if(null!==u)if(i.barPricesToCoordinates(this._bars,u),t.fillBarBorders(this._bars),this._model.selection().isSelected(this._source)){const e=this._selectionIndexer.indexes();this._selectionData={points:[],bgColors:[],visible:!0,hittestResult:a.HitTarget.Regular,barSpacing:t.barSpacing()};const r=this._model.paneForSource(this._source);if(!r)return;const n=r.height();for(let r=0;r<e.length;r++){const o=e[r],a=this._source.bars().valueAt(o);if(null===a)continue;const l=a[1],c=a[4];if(null==l||null==c)continue;const h=.5*(l+c),d=t.indexToCoordinate(o),p=i.priceToCoordinate(h,u);this._selectionData.points.push(new s.Point(d,p)),this._selectionData.bgColors.push(this._model.backgroundColorAtYPercentFromTop(p/n))}}else this._selectionIndexer.clear()}}},36897:(e,t,i)=>{"use strict";i.d(t,{SeriesSingleLinePaneView:()=>d});var s=i(3308),r=i(86441),n=i(50151),o=i(56570),a=i(66540),l=i(8025),c=i(56468),h=i(29981);class d{constructor(e,t){this._items=[],this._invalidated=!0,this._isMarkersEnabled=(0,o.enabled)("source_selection_markers"),this._selectionData=null,this._source=e,this._model=t,this._selectionIndexer=new a.SelectionIndexes(t.timeScale())}update(){this._invalidated=!0}_updateImpl(){var e,t;this._items=[];const i=this._model.timeScale(),o=this._source.priceScale();if(i.isEmpty()||!o||o.isEmpty())return;const a=i.visibleBarsStrictRange();if(null===a)return;if(0===this._source.bars().size())return;const d=null!==(e=this._source.nearestIndex(a.firstBar()-1,l.PlotRowSearchMode.NearestLeft))&&void 0!==e?e:a.firstBar()-1,u=null!==(t=this._source.nearestIndex(a.lastBar()+1,l.PlotRowSearchMode.NearestRight))&&void 0!==t?t:a.lastBar()+1,p=this._source.barFunction();let _=null;const m=this._model.timeScale().barSpacing();if(m<.1&&this._source.supportsPressedChunks()){
_=this._source.firstValue();const e=this._source.pressedChunks(m,(0,n.ensureNotNull)(this._source.priceSource())),t=(0,h.lowerbound)(e,d,((e,t)=>e.startTime<t)),i=Math.min(e.length-1,(0,h.lowerbound)(e,u,((e,t)=>e.endTime<t)));for(let s=t;s<=i;s++){const t=e[s];[t.open,t.high,t.low,t.close].forEach((e=>{this._items.push({timePointIndex:t.startTime,y:e,left:NaN,center:NaN,right:NaN})}))}}else{_=this._source.bars().range(d,u).reduce(((e,t,i)=>{const r=p(i);return(0,s.default)(r)?(this._items.push({timePointIndex:t,y:r,left:NaN,center:NaN,right:NaN}),a.contains(t)?null!=e?e:r:e):e}),null)}if(null!==_)if(o.pointsArrayToCoordinates(this._items,_),i.fillBarBorders(this._items),this._model.selection().isSelected(this._source)){const e=this._selectionIndexer.indexes();this._selectionData={points:[],bgColors:[],visible:!0,barSpacing:i.barSpacing(),hittestResult:c.HitTarget.Regular};const t=(0,n.ensureNotNull)(this._model.paneForSource(this._source)).height();this._selectionData.hittestResult=c.HitTarget.Regular;for(let s=0;s<e.length;s++){const n=e[s],a=this._source.bars().valueAt(n);if(null===a)continue;const l=p(a),c=i.indexToCoordinate(n),h=o.priceToCoordinate(l,_);this._selectionData.points.push(new r.Point(c,h)),this._selectionData.bgColors.push(this._model.backgroundColorAtYPercentFromTop(h/t))}}else this._selectionIndexer.clear();else this._items=[]}}},20596:(e,t,i)=>{"use strict";i.d(t,{RangeBarStyle:()=>g,areaStylePreferencesDefault:()=>a,barStylePreferencesDefault:()=>n,baselineStylePreferencesDefault:()=>c,candleStylePreferencesDefault:()=>s,columnStylePreferencesDefault:()=>v,haStylePreferencesDefault:()=>d,hiloStylePreferencesDefault:()=>h,hlcAreaStylePreferencesDefault:()=>l,hollowCandlePreferencesStyleDefault:()=>r,kagiStylePreferencesDefault:()=>_,lineStyleDefault:()=>o,pbStylePreferencesDefault:()=>p,pnfStylePreferencesDefault:()=>m,rangeStylePreferencesDefault:()=>f,renkoStylePreferencesDefault:()=>u});const s={upColor:"",downColor:"",drawWick:!1,drawBorder:!1,drawBody:!0,borderColor:"",borderUpColor:"",borderDownColor:"",wickColor:"",wickUpColor:"",wickDownColor:"",barColorsOnPrevClose:!1},r={upColor:"",downColor:"",drawWick:!1,drawBorder:!1,drawBody:!0,borderColor:"",borderUpColor:"",borderDownColor:"",wickColor:"",wickUpColor:"",wickDownColor:""},n={upColor:"",downColor:"",barColorsOnPrevClose:!1,dontDrawOpen:!1,thinBars:!0},o={color:"",linestyle:0,linewidth:0},a={color1:"",color2:"",linecolor:"",linestyle:0,linewidth:0,transparency:0},l={highLineColor:"",highLineStyle:0,highLineWidth:0,lowLineColor:"",lowLineStyle:0,lowLineWidth:0,closeLineColor:"",closeLineStyle:0,closeLineWidth:0,highCloseFillColor:"",closeLowFillColor:""},c={topFillColor1:"",topFillColor2:"",bottomFillColor1:"",bottomFillColor2:"",topLineColor:"",bottomLineColor:"",baselineColor:"",topLineWidth:0,bottomLineWidth:0,transparency:0,baseLevelPercentage:0},h={color:"",showBorders:!1,borderColor:"",showLabels:!1,labelColor:"",drawBody:!0},d={upColor:"",downColor:"",drawWick:!1,drawBorder:!1,drawBody:!0,borderColor:"",borderUpColor:"",
borderDownColor:"",wickColor:"",wickUpColor:"",wickDownColor:"",showRealLastPrice:!1,barColorsOnPrevClose:!1,inputs:{}},u={upColor:"",downColor:"",borderUpColor:"",borderDownColor:"",upColorProjection:"",downColorProjection:"",borderUpColorProjection:"",borderDownColorProjection:"",wickUpColor:"",wickDownColor:"",inputs:{boxSize:0,style:"",atrLength:0,percentageLTP:0,wicks:!1,sources:"",source:""}},p={upColor:"",downColor:"",borderUpColor:"",borderDownColor:"",upColorProjection:"",downColorProjection:"",borderUpColorProjection:"",borderDownColorProjection:"",inputs:{source:"",lb:0}},_={upColor:"",downColor:"",upColorProjection:"",downColorProjection:"",inputs:{style:"",atrLength:0,percentageLTP:0,reversalAmount:0}},m={upColor:"",downColor:"",upColorProjection:"",downColorProjection:"",inputs:{reversalAmount:0,boxSize:0,style:"",atrLength:0,percentageLTP:0,oneStepBackBuilding:!1,sources:"Close"}};var g;!function(e){e[e.Bars=0]="Bars",e[e.Candles=1]="Candles"}(g||(g={}));const f={barStyle:0,upColor:"",downColor:"",upColorProjection:"",downColorProjection:"",thinBars:!1,candlesUpColor:"",candlesDownColor:"",candlesBorderUpColor:"",candlesBorderDownColor:"",candlesWickUpColor:"",candlesWickDownColor:"",inputs:{range:0,phantomBars:!1}},v={upColor:"",downColor:"",barColorsOnPrevClose:!1}},62825:(e,t,i)=>{"use strict";i.d(t,{getErrorFromUnsupportedResolutionState:()=>c,getResolutionUnsupportedReason:()=>h});var s=i(11542),r=i(85049),n=i(10074);const o=s.t(null,void 0,i(64818)),a=s.t(null,void 0,i(80254)),l=s.t(null,void 0,i(80185));function c(e,t=!1){const i=t?`<b>${e.ticker}</b>`:e.ticker;switch(e.reason){case"unsupported_intraday":{const e=t?"<b>D, W, M</b>":"D, W, M";return o.format({ticker:i,availableResolutions:e})}case"unsupported_ticks":return a.format({ticker:i});case"less_than_frequency":{const s=t?`<b>${e.applicableResolution}</b>`:e.applicableResolution;return l.format({ticker:i,resolution:s})}}}function h(e,t){if(null===e)return null;const i=e.data_frequency;if(void 0!==i){if((0,n.getApplicableIntervalForFrequency)(i,t)!==t)return"less_than_frequency"}return r.Interval.isIntraday(t)&&!e.has_intraday?"unsupported_intraday":r.Interval.isTicks(t)&&!e["is-tickbars-available"]?"unsupported_ticks":null}},76748:(e,t,i)=>{"use strict";i.d(t,{SeriesValuesProvider:()=>I,calculateColor:()=>x,changesData:()=>T});var s=i(50151),r=i(50335),n=i(24377),o=i(11542),a=i(49483),l=i(19063),c=i(63273),h=i(8025),d=i(928),u=i(43290),p=i(90799);function _(e,t){return 100*(t-e)/Math.abs(e||1)}var m=i(41991),g=i(15764),f=i(82587),v=i(23486);const y=v.lastDayChangeAvailable||v.alwaysShowLastPriceAndLastDayChange,S=a.CheckMobile.any(),b=(0,u.getPercentageFormatter)(),w=(0,u.getVolumeFormatter)(2),C=`${f.notAvailable} (${f.notAvailable}%)`;var P;function x(e,t){const i=(0,n.parseRgb)(t),s=(0,n.parseRgb)(e);return(0,n.distanceRgb)(i,s)<70?(0,n.rgbToHexString)((0,n.invertRgb)(i)):t}function T(e,t,i,s,r){var n;let o,a;if(null!==t){const e=r[4],i=t.change||0;a={change:i,currentPrice:e,prevPrice:e-i,percentChange:t.change_percent||0}}
const l=i[4],c=e.search(s-1,h.PlotRowSearchMode.NearestLeft,1),d=null!==(n=null==c?void 0:c.value[4])&&void 0!==n?n:null;return null!==d&&null!=l&&(o={change:l-d,currentPrice:l,prevPrice:d,percentChange:_(d,l)}),{barChange:o,lastDayChange:a}}!function(e){e[e.Open=0]="Open",e[e.High=1]="High",e[e.Low=2]="Low",e[e.Close=3]="Close",e[e.Source=4]="Source",e[e.LastPrice=5]="LastPrice",e[e.Change=6]="Change",e[e.Volume=7]="Volume",e[e.LastDayChange=8]="LastDayChange"}(P||(P={}));class I{constructor(e,t){this._series=e,this._model=t,this._emptyValues=[{title:o.t(null,void 0,i(16610)),visible:!1,value:"",index:0,id:""},{title:o.t(null,void 0,i(78254)),visible:!1,value:"",index:1,id:""},{title:o.t(null,void 0,i(65318)),visible:!1,value:"",index:2,id:""},{title:o.t(null,void 0,i(62578)),visible:!1,value:"",index:3,id:""},{title:"",visible:!1,value:"",index:4,id:""},{title:"",visible:!1,value:"",index:5,id:""},{title:o.t(null,void 0,i(37276)),visible:!1,value:"",index:6,id:""},{title:o.t(null,{context:"study"},i(24261)),visible:!1,value:"",index:7,id:""},{title:o.t(null,void 0,i(63815)),visible:!1,value:"",index:8,id:""}]}getItems(){return this._emptyValues}getValues(e){var t,i,n,o,a,d;const u=this._showLastPriceAndChangeOnly(),p=this._emptyValues.map(((e,t)=>({...e,value:6===t||8===t?C:f.notAvailable,visible:5!==t&&4!==t&&!u})));if(this._model.timeScale().isEmpty()||0===this._series.bars().size()||this._series.priceScale().isEmpty())return p;const _=(0,s.ensureNotNull)(this._series.data().bars().last());(0,r.isNumber)(e)||(e=_.index);const g=this._series.nearestIndex(e,h.PlotRowSearchMode.NearestLeft);if(void 0===g)return p;const v=this._series.data().valueAt(g),S=this._model.backgroundTopColor().value();if(null===v)return p;const P=v[1],I=v[2],M=v[3],A=v[4],{barChange:L,lastDayChange:k}=T(this._series.data(),this._series.quotes(),v,g,_.value),D=(0,m.getPriceValueFormatterForSource)(this._series);if((0,m.shouldBeFormattedAsPercent)(this._series)||(0,m.shouldBeFormattedAsIndexedTo100)(this._series))p[6].value="",p[8].value="";else{const e=this._series.formatter(),s={signPositive:!0};if(void 0!==L){const{currentPrice:r,prevPrice:n,change:o,percentChange:a}=L,l=null!==(i=null===(t=e.formatChange)||void 0===t?void 0:t.call(e,r,n,s))&&void 0!==i?i:e.format(o,s);p[6].value=(0,c.forceLTRStr)(`${l} (${b.format(a,s)})`)}if(void 0!==k){const{currentPrice:t,prevPrice:i,change:r,percentChange:a}=k,l=null!==(o=null===(n=e.formatChange)||void 0===n?void 0:n.call(e,t,i,s))&&void 0!==o?o:e.format(r,s);p[8].value=(0,c.forceLTRStr)(`${l} (${b.format(a,s)})`)}}let E=null;if(u)p[5].value=null==A?f.notAvailable:D(A),p[5].visible=!0,E=this._getChangeColor(null==L?void 0:L.change),p[6].visible=void 0!==L,p[8].visible=void 0!==k||y;else{p[0].value=null==P?f.notAvailable:D(P),p[1].value=null==I?f.notAvailable:D(I),p[2].value=null==M?f.notAvailable:D(M),p[3].value=null==A?f.notAvailable:D(A),p[4].value=D(this._series.barFunction()(v));const e=v[5];(0,r.isNumber)(e)?p[7].value=w.format(e):p[7].visible=!1;const t=this._series.intervalObj().is1Tick()
;p[0].visible=!t,p[1].visible=!t,p[2].visible=!t,p[8].visible=void 0!==k||y,p[6].visible=void 0!==L;const i=this._series.barColorer().barStyle(g,!1);E=x(S,null!==(a=i.barBorderColor)&&void 0!==a?a:i.barColor)}E=(0,l.resetTransparency)(x(S,E));for(const e of p)e.color||(e.color=E);return p[8].visible&&(p[8].color=(0,l.resetTransparency)(x(S,this._getChangeColor(null===(d=k)||void 0===d?void 0:d.change)))),p}_mobileNonTrackingMode(){return S&&(null===this._model.crossHairSource().pane||(0,g.isLineToolName)(d.tool.value())||null!==this._model.lineBeingEdited())}_showLastPriceAndChangeOnly(){return v.alwaysShowLastPriceAndLastDayChange||this._mobileNonTrackingMode()}_getChangeColor(e){var t;const i=void 0===e||e>=0?p.SeriesBarColorer.upColor(this._series.properties()):p.SeriesBarColorer.downColor(this._series.properties());return null!==(t=i.barBorderColor)&&void 0!==t?t:i.barColor}}},6290:(e,t,i)=>{"use strict";i.d(t,{sessionsPreferencesDefault:()=>r});var s=i(19625);const r={graphics:{backgrounds:{outOfSession:{color:s.colorsPalette["color-tv-blue-500"],transparency:92,visible:!1},preMarket:{color:"#FF9800",transparency:92,visible:!1},postMarket:{color:s.colorsPalette["color-tv-blue-500"],transparency:92,visible:!1}},vertlines:{sessBreaks:{color:"#4985e7",style:2,visible:!1,width:1}}}}},300:(e,t,i)=>{"use strict";i.d(t,{sourcesAffectState:()=>n});var s=i(630),r=i(85719);function n(e){return!r.lineToolsDoNotAffectChartInvalidation||e.some((e=>!(0,s.isLineTool)(e)))}},27538:(e,t,i)=>{"use strict";i.d(t,{StatusProviderBase:()=>s});class s{size(){return"13px"}bold(){return!1}}},27777:(e,t,i)=>{"use strict";i.d(t,{StatusView:()=>s});class s{constructor(e){this._text="",this._color="",this._size="13px",this._bold=!1,this._statusProvider=e}text(){return this._text}getSplitTitle(){return[this._text]}bold(){return this._bold}size(){return this._size}}},46233:(e,t,i)=>{"use strict";i.d(t,{AbstractFilledAreaPaneView:()=>g});var s=i(50151),r=i(86441),n=i(5531),o=i(29981),a=i(48874),l=i(19063),c=i(5201);var h=i(67716),d=i(62499);function u(e,t){return Array.from({length:e},((e,i)=>({timePointIndex:i+t})))}function p(e,t,i){let s,r;const n=e.length;for(let o=t;o>=0&&o<n;o+=i){const t=e[o];if(void 0===s&&void 0!==t.plot1Value&&(s=o),void 0===r&&void 0!==t.plot2Value&&(r=o),void 0!==s&&void 0!==r)return o}return null}function _(e){return 0===e.type?`${e.color}`:`${e.color1}:${e.color2}:${e.coordinate1}:${e.coordinate2}`}const m={type:0,color:""};class g{constructor(e,t,i){this._isHlineFill=!1,this._bandAKey=null,this._bandBKey=null,this._colorPlotIndex=null,this._areaRenderer=new h.AreaBackgroundRenderer,this._dataInvalidated=null,this._viewportInvalidated=!1,this._plIndex1=null,this._plIndex2=null,this._items=[],this._colorAreas=new h.CachedMap,this._generateColor=function(e=1e3){const t=a.default.Cache;a.default.Cache=c.CircularCacheBuffer.bind(c.CircularCacheBuffer,e);const i=(0,a.default)(l.generateColor,((e,t,i)=>`${e}_${t}_${i}`));return a.default.Cache=t,i}(),this._source=e,this._model=t,
this._fillGaps=!!(null==i?void 0:i.fillgaps),this._fillToIntersection=!!(null==i?void 0:i.fillToIntersection)}update(e){if("global-change"===e.type)return this._dataInvalidated=(0,d.mergeDataInvalidation)(this._dataInvalidated,{}),void(this._viewportInvalidated=!0);if("data-source-change"!==e.type)this._viewportInvalidated=!0;else{e.sourceId===this._source.id()&&(this._dataInvalidated=(0,d.mergeDataInvalidation)(this._dataInvalidated,{firstIndex:e.firstUpdatedTimePointIndex,clearData:e.clearData}))}}renderer(){return this._dataInvalidated?this._updateImplFull(this._dataInvalidated)&&(this._dataInvalidated=null,this._viewportInvalidated=!1):this._viewportInvalidated&&(this._updateImplLight(),this._viewportInvalidated=!1),this._areaRenderer}_minFirstBarIndex(){return-1/0}_priceScale(){return this._source.priceScale()}_firstValue(){return this._source.firstValue()}_plotNames(){return this._source.metaInfo().plots.map((e=>e.id))}_plotIndex1(){return null===this._plIndex1&&(this._plIndex1=this._plotNames().indexOf(this._plotAId())+1),this._plIndex1}_plotIndex2(){return null===this._plIndex2&&(this._plIndex2=this._plotNames().indexOf(this._plotBId())+1),this._plIndex2}_updateImplFull(e){var t,i,r,n;if(this._areaRenderer.setData(null),(null===(t=this._dataInvalidated)||void 0===t?void 0:t.clearData)&&(this._items=[]),!this._visible())return!1;if(null===this._priceScale())return!1;if(null===this._firstValue())return!1;const a=this._source.plots().plottableRange(),l=a.size();if(0===l)return!1;const c=this._source.offset(this._plotAId()),h=this._source.offset(this._plotBId()),d=Math.min(c,h),p=Math.max(c,h);let _=e.firstIndex;const m=l+(p-d)+1,g=this._plotIndex1(),f=this._plotIndex2();m!==this._items.length&&(void 0===_||0===this._items.length||_<this._items[0].timePointIndex+d?(_=void 0,this._items=u(m,1e10)):this._items=this._items.concat(u(m-this._items.length,1e10+this._items.length)));const v=this._colorPlotIndex,y=this._transparency(),S=void 0===_?a.fullRangeIterator():a.rangeIterator(_,(0,s.ensureNotNull)(a.lastIndex()));let b=void 0!==_?(0,o.lowerbound)(this._items,_+d,((e,t)=>e.timePointIndex<t))-d:-d;for(const e of S){const t=e.index+c,s=e.index+h,o=this._items[b+c],a=this._items[b+h];if(o.timePointIndex=t,a.timePointIndex=s,this._isHlineFill||(o.plot1Value=null!==(i=e.value[g])&&void 0!==i?i:void 0,a.plot2Value=null!==(r=e.value[f])&&void 0!==r?r:void 0),null!==v){const t=b+d-1;if(t>=0&&t<this._items.length){const i=this._items[t];let s;s=0===v.type?{type:0,colorIndexOrRgba:e.value[v.colorIndexOrRgba+1]}:{type:1,colorIndexOrRgba1:void 0===v.colorIndexOrRgba1?void 0:e.value[v.colorIndexOrRgba1+1],colorIndexOrRgba2:void 0===v.colorIndexOrRgba2?void 0:e.value[v.colorIndexOrRgba2+1],value1:void 0===v.valueIndex1?void 0:e.value[v.valueIndex1+1],value2:void 0===v.valueIndex2?void 0:e.value[v.valueIndex2+1]};const r=i.color=null!==(n=this._getColorByPlotValue(s))&&void 0!==n?n:void 0;void 0!==r&&(1===r.type?(r.color1=r.color1&&this._generateColor(r.color1,y),
r.color2=r.color2&&this._generateColor(r.color2,y)):r.color=this._generateColor(r.color,y))}}b+=1}return this._updateImplLight(),!0}_updateImplLight(){var e,t,i,a;if(!this._visible())return;const l=this._priceScale();if(null===l)return;const c=this._firstValue();if(null===c)return;if(0===this._items.length)return;let d;if(this._isHlineFill){const e=this._source.properties().bands[(0,s.ensureNotNull)(this._bandAKey)],t=this._source.properties().bands[(0,s.ensureNotNull)(this._bandBKey)];d={level1:l.priceToCoordinate(e.value.value(),c),level2:l.priceToCoordinate(t.value.value(),c)}}const u=this._model.timeScale(),g=u.visibleBarsStrictRange();if(null===g)return;const f=l.priceToCoordinateFn(c),v=this._transparency(),y=this._minFirstBarIndex(),S=Math.max(y,g.firstBar()),b=(0,o.lowerbound)(this._items,S,((e,t)=>e.timePointIndex<t));if(b>=this._items.length)return;const w=Math.min(this._items.length-1,(0,o.lowerbound)(this._items,g.lastBar(),((e,t)=>e.timePointIndex<t)));let C,P;this._isHlineFill?(C=y===S?b:Math.max(0,b-1),P=Math.min(this._items.length-1,w+1)):(C=y===S?b:null!==(e=p(this._items,b-1,-1))&&void 0!==e?e:b,P=null!==(t=p(this._items,w+1,1))&&void 0!==t?t:w);const x=this._colorAreas;x.invalidateCache();let T,I=null,M=null,A=null;const L=(e,t,i)=>{if(this._model.timeScale().barSpacing()<1||!this._fillToIntersection||void 0===T||void 0===T.xCoordinate||void 0===T.plot1Coordinate||void 0===T.plot2Coordinate||null===M||null===I||0===I.points1.length()||void 0===e||void 0===t)return;const s=new r.Point(T.xCoordinate,T.plot1Coordinate),o=new r.Point(T.xCoordinate,T.plot2Coordinate),a=new r.Point(i,e),l=new r.Point(i,t),c=(0,n.intersectLineSegments)(s,a,o,l);if(null!==c){const e=s.add(s.subtract(a).scaled(-c));M.addPoints1Point(I.points1.at(I.points1.length()-1).x,I.points1.at(I.points1.length()-1).y),M.addPoints2Point(I.points2.at(I.points1.length()-1).x,I.points2.at(I.points1.length()-1).y),M.addPoints1Point(e.x,e.y),M.addPoints1Point(e.x,e.y),I.points1.at(I.points1.length()-1).x=e.x,I.points1.at(I.points1.length()-1).y=e.y,I.points2.at(I.points2.length()-1).x=e.x,I.points2.at(I.points2.length()-1).y=e.y}},k=this._commonColor();let D;1===k.type?(k.coordinate1=f(k.value1),k.coordinate2=f(k.value2),k.color1=k.color1&&this._generateColor(k.color1,v),k.color2=k.color2&&this._generateColor(k.color2,v)):k.color=this._generateColor(k.color,v);for(let e=C;e<=P;e+=1){const t=this._items[e],s=t.timePointIndex;let r,n;!this._fillGaps&&void 0!==D&&s-D>1&&(I=null),void 0!==d?(r=d.level1,n=d.level2):(r=t.plot1Coordinate=void 0===t.plot1Value?void 0:f(t.plot1Value),n=t.plot2Coordinate=void 0===t.plot2Value?void 0:f(t.plot2Value));const o=t.xCoordinate=u.indexToCoordinate(t.timePointIndex);if(t.color&&1===t.color.type&&(t.color.coordinate1=f(t.color.value1),t.color.coordinate2=f(t.color.value2)),this._fillGaps?void 0!==r||void 0!==n:void 0!==r&&void 0!==n){const s=null!==this._colorPlotIndex?t.color||m:k;if(L(r,n,o),V=s,
!(null===(E=A)||null===V?E===V:0===E.type&&0===V.type?E.color===V.color:1===E.type&&1===V.type&&E.color1===V.color1&&E.color2===V.color2&&E.coordinate1===V.coordinate1&&E.coordinate2===V.coordinate2)||null===I){if(null!==I&&(void 0!==r&&I.addPoints1Point(o,r),void 0!==n&&I.addPoints2Point(o,n)),e===P)continue;A=s;const t=_(s),l=null!==(i=x.get(t))&&void 0!==i?i:new h.AreaBackgroundItemsGroup(s);M=I,I=null!==(a=l.newItem())&&void 0!==a?a:new h.AreaBackgroundItem,l.push(I),x.set(t,l)}void 0!==r&&I.addPoints1Point(o,r),void 0!==n&&I.addPoints2Point(o,n)}else this._fillGaps||(A=null,I=null,M=null);D=s,T=t}var E,V;x.delete(_(m));const B={barSpacing:this._model.timeScale().barSpacing(),colorAreas:x};this._areaRenderer.setData(B)}}},46463:(e,t,i)=>{"use strict";i.d(t,{AreaBackgroundPaneView:()=>n});var s=i(50151),r=i(46233);class n extends r.AbstractFilledAreaPaneView{constructor(e,t){super(e,t)}_plotAId(){return(0,s.ensureDefined)(this._source.metaInfo().area)[0].name}_plotBId(){return(0,s.ensureDefined)(this._source.metaInfo().area)[1].name}_commonColor(){return{type:0,color:this._source.properties().areaBackground.backgroundColor.value()}}_transparency(){return this._source.properties().areaBackground.transparency.value()}_visible(){return this._source.properties().areaBackground.fillBackground.value()}_getColorByPlotValue(e){return this._commonColor()}}},28490:(e,t,i)=>{"use strict";i.d(t,{containsBackgroundTimePointIndexes:()=>o,dematerializeBackground:()=>l,isBackgroundInBarsRange:()=>c,materializeBackground:()=>a});var s=i(50151),r=i(50503),n=i(65039);const o=!0;function a(e,t){if(e.start>=t.length||e.stop>=t.length)return null;const i=t[e.start],n=t[e.stop];return n===r.INVALID_TIME_POINT_INDEX?null:((0,s.assert)(i===r.INVALID_TIME_POINT_INDEX||i<=n,"start should not exceed stop"),{start:i===r.INVALID_TIME_POINT_INDEX?null:i,stop:n})}function l(e,t,i){return{id:t,start:(0,n.ensureTimePointIndexIndex)(i.indexOf(null!==e.start?e.start:r.INVALID_TIME_POINT_INDEX)),stop:(0,n.ensureTimePointIndexIndex)(i.indexOf(e.stop))}}function c(e,t){if(null===e.start)return t.firstBar()<=e.stop;const i=Math.min(e.start,e.stop),s=Math.max(e.start,e.stop);return t.contains(i)||t.contains(s)||i<t.firstBar()&&s>t.lastBar()}},14019:(e,t,i)=>{"use strict";i.d(t,{LiveStudyGraphics:()=>o.LiveStudyGraphics,createGraphicsPaneViews:()=>p,createGraphicsPriceAxisViews:()=>m,emptyStudyGraphics:()=>n.emptyStudyGraphics,isStudyGraphicsEmpty:()=>r.isStudyGraphicsEmpty,loadStudyGraphics:()=>n.loadStudyGraphics,saveStudyGraphics:()=>n.saveStudyGraphics});var s=i(31955),r=i(58137),n=i(22837),o=i(26246),a=i(98558),l=i(19063);class c extends a.PriceAxisView{constructor(e,t){super(),this._source=e,this._data=t}_updateRendererData(e,t,i){var s,r;e.visible=!1;const n=this._source.priceScale(),o=this._source.properties().childs(),a=o.visible.value();if(!n||n.isEmpty()||!a)return;const c=null===(r=null===(s=o.graphics.childs()[this._data.lineType])||void 0===s?void 0:s.childs()[this._data.styleId])||void 0===r?void 0:r.childs()
;if(!(void 0!==c&&c.visible&&c.visible.value()&&c.showPrice&&c.showPrice.value()&&this._isLabelVisibleAccordinglyToProperties()))return;const h=this._source.firstValue();if(null===h)return;const d=this._data.line.level,u=(0,l.resetTransparency)(c.color.value());i.background=u,i.textColor=this.generateTextColor(u),i.coordinate=n.priceToCoordinate(d,h),e.text=n.formatPrice(d,h,{signPositive:n.isPercentage()}),e.visible=!0}_isLabelVisibleAccordinglyToProperties(){return!!this._source.model().properties().childs().scalesProperties.childs().showStudyLastValue.value()&&this._source.properties().childs().showLabelsOnPriceScale.value()}}const h=(0,s.getLogger)("Chart.StudyGraphics"),d=new Set(["dwgtablecells","tpoBlockSets","tpoLevels","tpoVolumeRows","logs","performance"]);async function u(e,t,s,r){const n=e=>({regularPaneView:new e(t,s,r)});switch(e){case"hhists":return n((await i.e(507).then(i.bind(i,56208))).HHistPaneView);case"horizlines":return n((await i.e(507).then(i.bind(i,95258))).HorizLinePaneView);case"vertlines":return n((await i.e(507).then(i.bind(i,51914))).VertLinePaneView);case"polygons":return n((await i.e(507).then(i.bind(i,38332))).PolygonPaneView);case"backgrounds":return n((await i.e(507).then(i.bind(i,55269))).BackgroundPaneView)}return null}async function p(e,t,i){const s=[],r=[],n=Object.keys(e.graphicsInfo());n.sort(((e,t)=>_(e)-_(t)));for(const o of n){const n=await u(o,e,t,i);null!==n?(s.push(n.regularPaneView),n.forceOverlayPaneView&&r.push(n.forceOverlayPaneView)):d.has(o)||h.logWarn(`${o} is not supported by this build of graphics subsystem, skipping`)}return{regularPaneViews:s,forceOverlayPaneViews:r}}function _(e){var t;return null!==(t=r.primitivesZOrders.get(e))&&void 0!==t?t:0}function m(e){const t=Object.keys(e.graphicsInfo()),i=[];for(const s of t)switch(s){case"hlines":e.graphics().hlines().forEach(((t,r)=>{t.forEach((t=>{void 0!==t.level&&i.push(new c(e,{line:{level:t.level},styleId:r,lineType:s}))}))}));break;case"horizlines":e.graphics().horizlines().forEach(((t,r)=>{t.forEach((t=>{void 0!==t.level&&i.push(new c(e,{line:{level:t.level},styleId:r,lineType:s}))}))}))}return i}},9233:(e,t,i)=>{"use strict";i.d(t,{HHistDirection:()=>s,HHistLocation:()=>r,HHistVolumeMode:()=>n,containsHHistTimePointIndexes:()=>c,dematerializeHHist:()=>d,isHHistInBarsRange:()=>u,materializeHHist:()=>h});var s,r,n,o=i(50151),a=i(50503),l=i(65039);!function(e){e.LeftToRight="left_to_right",e.RightToLeft="right_to_left"}(s||(s={})),function(e){e.Relative="relative",e.Absolute="absolute"}(r||(r={})),function(e){e.UpDown="Up/Down",e.Total="Total",e.Delta="Delta"}(n||(n={}));const c=!0;function h(e,t){if(e.firstBarTime>=t.length||e.lastBarTime>=t.length)return null;const i=t[e.firstBarTime],s=t[e.lastBarTime];return i===a.INVALID_TIME_POINT_INDEX||s===a.INVALID_TIME_POINT_INDEX?null:((0,o.assert)(i<=s,"firstBarTime should not exceed lastBarTime"),(0,o.assert)(e.priceLow<=e.priceHigh,"priceLow should not exceed priceHigh"),{firstBarTime:i,lastBarTime:s,rate:e.rate,priceHigh:e.priceHigh,priceLow:e.priceLow})}
function d(e,t,i){const s=(0,l.ensureTimePointIndexIndex)(i.indexOf(e.firstBarTime)),r=(0,l.ensureTimePointIndexIndex)(i.indexOf(e.lastBarTime));return{id:t,...e,firstBarTime:s,lastBarTime:r}}function u(e,t){const i=Math.min(e.firstBarTime,e.lastBarTime),s=Math.max(e.firstBarTime,e.lastBarTime);return t.contains(i)||t.contains(s)||i<t.firstBar()&&s>t.lastBar()}},45721:(e,t,i)=>{"use strict";i.d(t,{containsHorizLineTimePointIndexes:()=>o,dematerializeHorizLine:()=>l,isHorizLineInBarsRange:()=>c,materializeHorizLine:()=>a});var s=i(50151),r=i(50503),n=i(65039);const o=!0;function a(e,t){if(e.startIndex>=t.length||e.endIndex>=t.length)return null;const i=t[e.startIndex],n=t[e.endIndex];return i===r.INVALID_TIME_POINT_INDEX||n===r.INVALID_TIME_POINT_INDEX?null:((0,s.assert)(i<=n,"startIndex should not exceed endIndex"),{startIndex:i,endIndex:n,level:e.level,extendLeft:e.extendLeft,extendRight:e.extendRight})}function l(e,t,i){const s=(0,n.ensureTimePointIndexIndex)(i.indexOf(e.startIndex)),r=(0,n.ensureTimePointIndexIndex)(i.indexOf(e.endIndex));return{id:t,...e,startIndex:s,endIndex:r}}function c(e,t){const i=Math.min(e.startIndex,e.endIndex),s=Math.max(e.startIndex,e.endIndex);if(t.contains(i)||t.contains(s)||i<t.firstBar()&&s>t.lastBar())return!0;const r=e.startIndex<e.endIndex?e.extendLeft:e.extendRight,n=e.startIndex<e.endIndex?e.extendRight:e.extendLeft;return s<t.firstBar()&&n||i>t.lastBar()&&r}},26246:(e,t,i)=>{"use strict";i.d(t,{LiveStudyGraphics:()=>p});var s=i(50151),r=i(29981),n=i(52033),o=i(9233),a=i(45721),l=i(28656),c=i(55257),h=i(28490),d=i(58137),u=i(22837);class p{constructor(e={}){this._indexes=[],this._hhistsByTimePointIndex=new Map,this._primitivesCollection=function(e){const t={};for(const i of d.primitiveNames){t[i]=new Map;const s=e[i];if(void 0!==s)for(const e in s)if(s.hasOwnProperty(e))switch(i){case"horizlines":t[i].set(e,y());break;case"vertlines":t[i].set(e,S());break;case"backgrounds":t[i].set(e,b());break;case"polygons":t[i].set(e,w());break;case"hhists":t[i].set(e,C())}}0;return t}(e)}horizlines(){return this._primitivesCollection.horizlines}vertlines(){return this._primitivesCollection.vertlines}lines(){return this._primitivesCollection.lines}hlines(){return this._primitivesCollection.hlines}textmarks(){return this._primitivesCollection.textmarks}shapemarks(){return this._primitivesCollection.shapemarks}backgrounds(){return this._primitivesCollection.backgrounds}polygons(){return this._primitivesCollection.polygons}trendchannels(){return this._primitivesCollection.trendchannels}hhists(){return this._primitivesCollection.hhists}dwglabels(){return this._primitivesCollection.dwglabels}dwglines(){return this._primitivesCollection.dwglines}dwgpolylines(){return this._primitivesCollection.dwgpolylines}dwgboxes(){return this._primitivesCollection.dwgboxes}dwgtables(){return this._primitivesCollection.dwgtables}dwgtablecells(){return this._primitivesCollection.dwgtablecells}dwglinefills(){return this._primitivesCollection.dwglinefills}tpos(){return this._primitivesCollection.tpos}
tpoBlockSets(){return this._primitivesCollection.tpoBlockSets}tpoLevels(){return this._primitivesCollection.tpoLevels}tpoVolumeRows(){return this._primitivesCollection.tpoVolumeRows}logs(){return this._primitivesCollection.logs}observableLogs(){return this._primitivesCollection.logs}performance(){return this._primitivesCollection.performance}observablePerformance(){return this._primitivesCollection.performance}footprints(){return this._primitivesCollection.footprints}footprintLevels(){return this._primitivesCollection.footprintLevels}hhistsByTimePointIndex(){return this._hhistsByTimePointIndex}clear(){this._indexes=[];for(const e of d.regularPrimitiveNames)this._primitivesCollection[e].forEach((e=>e.clear()));for(const e of d.groupedPrimitiveNames)this._primitivesCollection[e].forEach((e=>{e.forEach((e=>e.clear()))}));this._hhistsByTimePointIndex=new Map}extract(){const e={indexes:this._indexes,horizlines:g(this._primitivesCollection.horizlines),vertlines:g(this._primitivesCollection.vertlines),lines:g(this._primitivesCollection.lines),hlines:g(this._primitivesCollection.hlines),textmarks:g(this._primitivesCollection.textmarks),shapemarks:g(this._primitivesCollection.shapemarks),backgrounds:g(this._primitivesCollection.backgrounds),polygons:g(this._primitivesCollection.polygons),trendchannels:g(this._primitivesCollection.trendchannels),hhists:g(this._primitivesCollection.hhists),dwglabels:f(this._primitivesCollection.dwglabels),dwglines:f(this._primitivesCollection.dwglines),dwgpolylines:f(this._primitivesCollection.dwgpolylines),dwgboxes:f(this._primitivesCollection.dwgboxes),dwgtables:f(this._primitivesCollection.dwgtables),dwgtablecells:g(this._primitivesCollection.dwgtablecells),dwglinefills:g(this._primitivesCollection.dwglinefills),tpos:g(this._primitivesCollection.tpos),tpoBlockSets:f(this._primitivesCollection.tpoBlockSets),tpoLevels:f(this._primitivesCollection.tpoLevels),tpoVolumeRows:f(this._primitivesCollection.tpoVolumeRows),logs:new Map,performance:new Map,footprints:g(this._primitivesCollection.footprints),footprintLevels:g(this._primitivesCollection.footprintLevels)};return this._hhistsByTimePointIndex=new Map,new u.StaticStudyGraphics("data",e)}replaceIndexesTo(e){this._indexes=e;const t=e=>e.replaceIndexesTo(this._indexes);for(const e of d.regularPrimitiveNames)this._primitivesCollection[e].forEach(t);for(const e of d.groupedPrimitiveNames)this._primitivesCollection[e].forEach((e=>{e.forEach(t)}));this._hhistsByTimePointIndex=(0,d.splitHHistsByTimePointIndex)(this._primitivesCollection.hhists)}processCommands(e){void 0!==e.erase&&this._processEraseCommands(e.erase),void 0!==e.create&&this._processCreateCommands(e.create)}_processCreateCommands(e){for(const t in e){if(!e.hasOwnProperty(t))continue;const i=t;switch(i){case"hhists":v(this._indexes,this._primitivesCollection.hhists,e[i]);break;case"horizlines":v(this._indexes,this._primitivesCollection.horizlines,e[i]);break;case"vertlines":v(this._indexes,this._primitivesCollection.vertlines,e[i]);break;case"polygons":
v(this._indexes,this._primitivesCollection.polygons,e[i]);break;case"backgrounds":v(this._indexes,this._primitivesCollection.backgrounds,e[i])}}this._hhistsByTimePointIndex=(0,d.splitHHistsByTimePointIndex)(this._primitivesCollection.hhists)}_processEraseCommands(e){for(const t of e)if("all"===t.action){for(const e of d.regularPrimitiveNames)this._primitivesCollection[e].forEach((e=>e.clearPrimitives()));for(const e of d.groupedPrimitiveNames)this._primitivesCollection[e].forEach((e=>{e.forEach((e=>e.clearPrimitives()))}))}else{const e=e=>e.deleteById(t.id);(0,d.isRegularPrimiriveName)(t.type)?this._primitivesCollection[t.type].forEach(e):this._primitivesCollection[t.type].forEach((t=>{t.forEach(e)}))}this._hhistsByTimePointIndex=(0,d.splitHHistsByTimePointIndex)(this._primitivesCollection.hhists)}}class _{constructor(e,t){this._primitivesDataById=new Map,this._primitiveById=new Map,this._changed=new n.Delegate,this._cleared=new n.Delegate,this._materializePrimitive=e,this._isRematerializationRequiredWithNewIndexes=t}changed(){return this._changed}cleared(){return this._cleared}forEach(e,t){this._primitiveById.forEach((i=>{e.call(t,i,i,this)}))}has(e){let t=!1;return this._primitiveById.forEach((i=>{t=t||i===e})),t}get size(){return this._primitiveById.size}[Symbol.iterator](){return this._primitiveById.values()}entries(){throw new Error("Not implemented")}keys(){throw new Error("Not implemented")}values(){return this._primitiveById.values()}hasId(e){return this._primitiveById.has(e)}addData(e,t){const i=[];e.forEach((e=>{this._primitivesDataById.set(e.id,e);const s=this._tryMaterialize(t,e);null!==s&&i.push(s)})),i.length>0&&this._changed.fire({created:i,removed:[]})}deleteById(e){const t=this._primitiveById.get(e);t&&(this._primitiveById.delete(e),this._primitivesDataById.delete(e),this._changed.fire({created:[],removed:[t]}))}clear(){this.clearPrimitives()}clearPrimitives(){this._primitivesDataById.clear(),this._primitiveById.clear(),this._cleared.fire()}replaceIndexesTo(e){if(!this._isRematerializationRequiredWithNewIndexes)return;const t=Array.from(this._primitiveById.values());this._primitiveById.clear(),this._primitivesDataById.forEach(this._tryMaterialize.bind(this,e),this);const i=Array.from(this._primitiveById.values());this._changed.fire({created:i,removed:t})}extract(){const e=new Set(this._primitivesDataById.values());return this.clearPrimitives(),e}_tryMaterialize(e,t){const i=this._materializePrimitive(t,e);return null!==i&&((0,s.assert)(!this._primitiveById.has(t.id),"primitive with specified id should not exist"),this._primitiveById.set(t.id,i)),i}}function m(e){const t=new Map;for(const[n,o]of e)t.set(n,(i=o,(s=t.get(n))?(0,r.join)(s,i.extract()):i.extract()));var i,s;return t}function g(e){return m((0,r.mapEntriesGenerator)(e))}function f(e){return m((0,r.nestedMapGenerator)(e))}function v(e,t,i=[]){for(const r of i){const i=r.styleId,n=t.get(i);(0,s.assert)(void 0!==n,"Every style used by graphics primitive should be declared in study metainfo"),n.addData(r.data,e)}}
const y=()=>new _(a.materializeHorizLine,a.containsHorizLineTimePointIndexes),S=()=>new _(l.materializeVertLine,l.containsVertLineTimePointIndexes),b=()=>new _(h.materializeBackground,h.containsBackgroundTimePointIndexes),w=()=>new _(c.materializePolygon,c.containsPolygonTimePointIndexes),C=()=>new _(o.materializeHHist,o.containsHHistTimePointIndexes)},55257:(e,t,i)=>{"use strict";i.d(t,{containsPolygonTimePointIndexes:()=>n,dematerializePolygon:()=>a,isPolygonInBarsRange:()=>l,materializePolygon:()=>o});var s=i(50503),r=i(65039);const n=!0;function o(e,t){for(const i of e.points){if(i.index>=t.length)return null;if(t[i.index]===s.INVALID_TIME_POINT_INDEX)return null}return{points:e.points.map((e=>({index:t[e.index],offset:e.offset,level:e.level})))}}function a(e,t,i){return{id:t,points:e.points.map((e=>({...e,index:(0,r.ensureTimePointIndexIndex)(i.indexOf(e.index))})))}}function l(e,t){var i;if(e.points.some((e=>{var i;return t.contains(e.index+(null!==(i=e.offset)&&void 0!==i?i:0))})))return!0;let s=!1,r=!1;const n=t.firstBar();for(const t of e.points)t.index+(null!==(i=t.offset)&&void 0!==i?i:0)<n?s=!0:r=!0;return s&&r}},65039:(e,t,i)=>{"use strict";function s(e){if(e<0)throw new Error("TimePointIndexIndex should be non-negative integer");return e}i.d(t,{ensureTimePointIndexIndex:()=>s})},22837:(e,t,i)=>{"use strict";i.d(t,{StaticStudyGraphics:()=>d,emptyStudyGraphics:()=>g,loadStudyGraphics:()=>f,saveStudyGraphics:()=>v});var s=i(50503),r=i(45721),n=i(28656),o=i(9233),a=i(55257),l=i(28490),c=i(58137),h=i(37265);class d{constructor(e,t){if(this._indexes=[],this._horizlines=new Map,this._vertlines=new Map,this._lines=new Map,this._hlines=new Map,this._textmarks=new Map,this._shapemarks=new Map,this._backgrounds=new Map,this._polygons=new Map,this._trendchannels=new Map,this._hhists=new Map,this._dwglabels=new Map,this._dwglines=new Map,this._dwgpolylines=new Map,this._dwgboxes=new Map,this._dwgtables=new Map,this._dwgtablecells=new Map,this._dwglinefills=new Map,this._tpos=new Map,this._tpoBlockSets=new Map,this._tpoLevelGroups=new Map,this._tpoVolumeRows=new Map,this._logs=new Map,this._performance=new Map,this._footprints=new Map,this._footprintLevels=new Map,"data"===e){const e=t;this._indexes=e.indexes,this._vertlines=u(e.vertlines,this._indexes,n.materializeVertLine),this._horizlines=u(e.horizlines,this._indexes,r.materializeHorizLine),this._polygons=u(e.polygons,this._indexes,a.materializePolygon),this._hhists=u(e.hhists,this._indexes,o.materializeHHist),this._backgrounds=u(e.backgrounds,this._indexes,l.materializeBackground)}else if("state"===e){const e=t;this._indexes=e.indexes||[],this._vertlines=p(e.vertlines,this._indexes,n.materializeVertLine),this._horizlines=p(e.horizlines,this._indexes,r.materializeHorizLine),this._polygons=p(e.polygons,this._indexes,a.materializePolygon),this._hhists=p(e.hhists,this._indexes,o.materializeHHist),this._backgrounds=p(e.backgrounds,this._indexes,l.materializeBackground)}this._hhistsByTimePointIndex=(0,c.splitHHistsByTimePointIndex)(this._hhists)}horizlines(){
return this._horizlines}vertlines(){return this._vertlines}lines(){return this._lines}hlines(){return this._hlines}textmarks(){return this._textmarks}shapemarks(){return this._shapemarks}backgrounds(){return this._backgrounds}polygons(){return this._polygons}trendchannels(){return this._trendchannels}hhists(){return this._hhists}dwglabels(){return this._dwglabels}dwglines(){return this._dwglines}dwgpolylines(){return this._dwgpolylines}dwgboxes(){return this._dwgboxes}dwgtables(){return this._dwgtables}dwgtablecells(){return this._dwgtablecells}dwglinefills(){return this._dwglinefills}tpos(){return this._tpos}tpoBlockSets(){return this._tpoBlockSets}tpoLevels(e){return this._tpoLevelGroups}tpoVolumeRows(e){return this._tpoVolumeRows}logs(){return this._logs}performance(){return this._performance}footprints(){return this._footprints}footprintLevels(){return this._footprintLevels}hhistsByTimePointIndex(){return this._hhistsByTimePointIndex}}function u(e,t,i){return new Map(Array.from(e.entries()).map((e=>[e[0],new Set(Array.from(e[1]).map((e=>i(e,t))).filter(h.notNull))])))}function p(e,t,i){const s=new Map;if(void 0===e)return s;for(const r of e){const e=r.styleId,n=s.get(e)||new Set;r.data.forEach((e=>{const s=i(e,t);null!==s&&n.add(s)})),s.set(e,n)}return s}function _(e,t,i){let s=null;for(const i of e)i.styleId===t&&(s=i);null===s&&(s={styleId:t,data:[]},e.push(s)),s.data.push(i)}function m(e,t,i,s,r,n){const o=[];return e.forEach(((e,a)=>{e.forEach((e=>{(null===r||s(e,r))&&_(o,a,n(e,t(e),i))}))})),o.length>0?o:void 0}function g(){return new d}function f(e){return new d("state",e)}function v(e,t){const i=function(e){const t=new Set,i=e=>{null!=e&&t.add(e)};e.horizlines().forEach(((e,i)=>{e.forEach((e=>{t.add(e.startIndex),t.add(e.endIndex)}))})),e.vertlines().forEach(((e,i)=>{e.forEach((e=>{t.add(e.index)}))})),e.lines().forEach(((e,i)=>{e.forEach((e=>{t.add(e.startIndex),t.add(e.endIndex)}))})),e.textmarks().forEach(((e,i)=>{e.forEach((e=>{t.add(e.time)}))})),e.shapemarks().forEach(((e,i)=>{e.forEach((e=>{t.add(e.time)}))})),e.backgrounds().forEach(((e,i)=>{e.forEach((e=>{t.add(null!==e.start?e.start:s.INVALID_TIME_POINT_INDEX),t.add(e.stop)}))})),e.polygons().forEach(((e,i)=>{e.forEach((e=>{e.points.forEach((e=>{t.add(e.index)}))}))})),e.trendchannels().forEach(((e,i)=>{e.forEach((e=>{t.add(e.startIndex),t.add(e.endIndex)}))})),e.hhists().forEach(((e,i)=>{e.forEach((e=>{t.add(e.firstBarTime),t.add(e.lastBarTime)}))})),e.dwglabels().forEach((e=>{e.forEach((e=>{e.forEach((e=>{t.add(e.x)}))}))})),e.dwglines().forEach((e=>{e.forEach((e=>{e.forEach((e=>{var i,r;t.add(null!==(i=e.x1)&&void 0!==i?i:s.INVALID_TIME_POINT_INDEX),t.add(null!==(r=e.x2)&&void 0!==r?r:s.INVALID_TIME_POINT_INDEX)}))}))})),e.dwgpolylines().forEach((e=>{e.forEach((e=>{e.forEach((e=>{var i;for(const r of e.points)t.add(null!==(i=r.x)&&void 0!==i?i:s.INVALID_TIME_POINT_INDEX)}))}))})),e.dwgboxes().forEach((e=>{e.forEach((e=>{e.forEach((e=>{var i,r;t.add(null!==(i=e.left)&&void 0!==i?i:s.INVALID_TIME_POINT_INDEX),
t.add(null!==(r=e.right)&&void 0!==r?r:s.INVALID_TIME_POINT_INDEX)}))}))})),e.tpos().forEach((e=>{e.forEach((e=>{t.add(e.firstBarTime),t.add(e.lastBarTime)}))})),e.tpoLevels().forEach((e=>{e.forEach((e=>{e.forEach((e=>{var t;i(e.poorHighExtendTo),i(e.poorLowExtendTo),i(e.tpoPocExtendTo),(null!==(t=e.singleprints)&&void 0!==t?t:[]).map((e=>e.extendTo)).map(i)}))}))})),e.footprints().forEach((e=>{e.forEach((e=>{t.add(e.index)}))})),e.footprintLevels().forEach((e=>{e.forEach((e=>{t.add(e.startIndex),i(e.extendTo)}))}));const r=Array.from(t);return r.sort(((e,t)=>e-t)),r}(e),c={indexes:i};let h=0;const d=()=>++h;return c.vertlines=m(e.vertlines(),d,i,n.isVertLineInBarsRange,t,n.dematerializeVertLine),c.horizlines=m(e.horizlines(),d,i,r.isHorizLineInBarsRange,t,r.dematerializeHorizLine),c.polygons=m(e.polygons(),d,i,a.isPolygonInBarsRange,t,a.dematerializePolygon),c.hhists=m(e.hhists(),d,i,o.isHHistInBarsRange,t,o.dematerializeHHist),c.backgrounds=m(e.backgrounds(),d,i,l.isBackgroundInBarsRange,t,l.dematerializeBackground),c}},85904:(e,t,i)=>{"use strict";var s,r,n,o;i.r(t),i.d(t,{HAlign:()=>r,LineStyle:()=>o,MarkLocation:()=>s,VAlign:()=>n}),function(e){e.AboveBar="AboveBar",e.BelowBar="BelowBar",e.Top="Top",e.Bottom="Bottom",e.Right="Right",e.Left="Left",e.Absolute="Absolute",e.AbsoluteUp="AbsoluteUp",e.AbsoluteDown="AbsoluteDown"}(s||(s={})),function(e){e.Left="left",e.Center="center",e.Right="right"}(r||(r={})),function(e){e.Top="top",e.Middle="middle",e.Bottom="bottom"}(n||(n={})),function(e){e[e.Solid=0]="Solid",e[e.Dotted=1]="Dotted",e[e.Dashed=2]="Dashed"}(o||(o={}))},58137:(e,t,i)=>{"use strict";i.d(t,{groupedPrimitiveNames:()=>n,hasForceOverlayPrimitives:()=>d,isRegularPrimiriveName:()=>a,isStudyGraphicsEmpty:()=>c,primitiveNames:()=>o,primitivesZOrders:()=>l,regularPrimitiveNames:()=>r,splitHHistsByTimePointIndex:()=>h});const s=["dwglines","dwgboxes","dwglabels","dwgpolylines","dwgtables"];const r=["horizlines","vertlines","lines","hlines","textmarks","shapemarks","backgrounds","polygons","trendchannels","hhists","dwgtablecells","dwglinefills","tpos","logs","performance","footprints","footprintLevels"],n=s.concat(["tpoBlockSets","tpoLevels","tpoVolumeRows"]),o=r.concat(n);function a(e){return r.includes(e)}const l=new Map([["logs",-4],["performance",-4],["polygons",-4],["trendchannels",-3],["textmarks",-2],["shapemarks",-2],["backgrounds",-1],["footprints",1],["footprintLevels",1],["hlines",1],["horizlines",1],["hhists",1],["dwglinefills",2],["vertlines",3],["lines",3],["dwglines",3],["dwgpolylines",3],["dwgboxes",4],["dwglabels",5],["dwgtables",6],["dwgtablecells",6],["tpos",7],["tpoBlockSets",7],["tpoLevels",7],["tpoVolumeRows",7]]);function c(e){return!o.some((t=>{const i=e[t]();for(const[,e]of i)if(e.size>0)return!0;return!1}))}function h(e){const t=new Map;return e.forEach(((e,i)=>{e.forEach((e=>{const s={...e,styleId:i},r=e.firstBarTime;let n=t.get(r);void 0===n&&(n=new Set,t.set(r,n)),n.add(s)}))})),t}function d(e){
return!!(e.graphics.dwglines||e.graphics.dwgboxes||e.graphics.dwglabels||e.graphics.dwgpolylines||e.graphics.dwgtables)}},28656:(e,t,i)=>{"use strict";i.d(t,{containsVertLineTimePointIndexes:()=>n,dematerializeVertLine:()=>a,isVertLineInBarsRange:()=>l,materializeVertLine:()=>o});var s=i(50503),r=i(65039);const n=!0;function o(e,t){if(e.index>=t.length)return null;const i=t[e.index];return i===s.INVALID_TIME_POINT_INDEX?null:{startPrice:e.startPrice,endPrice:e.endPrice,index:i,extendTop:e.extendTop,extendBottom:e.extendBottom}}function a(e,t,i){const s=(0,r.ensureTimePointIndexIndex)(i.indexOf(e.index));return{id:t,...e,index:s}}function l(e,t){return t.contains(e.index)}},64671:(e,t,i)=>{"use strict";var s;i.d(t,{VolumeFootprintTypeValues:()=>s}),function(e){e.BuyAndSell="Buy and sell",e.Delta="Delta",e.Total="Total"}(s||(s={}))},7015:(e,t,i)=>{"use strict";i.d(t,{HHistBasedValuesProvider:()=>m});var s=i(50335),r=i(50151),n=i(49483),o=i(8025),a=i(928),l=i(43290),c=i(9233),h=i(15764),d=i(82587);function u(e,t="",i=""){return{id:t,index:e,title:i,value:"",visible:!1}}const p=n.CheckMobile.any(),_=(0,l.getVolumeFormatter)();class m{constructor(e,t,i=!1){this._emptyValues=[],this._study=e,this._model=t,this._emptyTitles=i,void 0!==this._study.metaInfo().graphics.hhists&&this._emptyValues.push(u(0),u(1),u(2))}getItems(){return this._emptyValues}getValues(e){var t,i;const n=this._emptyValues.map((e=>({...e})));n.forEach((e=>{e.visible=this._study.isVisible(),e.value=d.notAvailable}));const a=this._study.properties().childs().inputs.childs().volume.value();switch(a){case c.HHistVolumeMode.UpDown:this._emptyTitles||(n[0].title="Up",n[1].title="Down",n[2].title="Total");break;case c.HHistVolumeMode.Total:this._emptyTitles||(n[0].title="Total"),n[1].visible=!1,n[2].visible=!1;break;case c.HHistVolumeMode.Delta:this._emptyTitles||(n[0].title="Delta",n[1].title="Max(Up, Down)",n[2].title="Total")}const l=this._study.priceScale(),h=this._model.timeScale();if(null===l||l.isEmpty()||h.isEmpty()||this._hideValues())return n;if(null===e||!isFinite(e)){const t=this._study.data().last();if(null===t)return n;e=t.index}const u=this._model.crossHairSource(),p=u.price;if(!isFinite(u.y)&&(e=function(e,t){var i;const s=null===(i=e.visibleBarsStrictRange())||void 0===i?void 0:i.lastBar();if(!s)return null;const r=t.data().search(s,o.PlotRowSearchMode.NearestLeft);return r?r.index:null}(this._model.timeScale(),this._model.mainSeries()),null===e))return n;const m=function(e,t,i,s){if(0===e.size)return null;if(!i){const e=(0,r.ensureNotNull)(s.data().valueAt(t));i=s.barFunction()(e)}const n=function(e,t){let i=null;return e.forEach(((e,s)=>{s<=t&&(null===i||s>i)&&(i=s)})),i}(e,t);if(null===n)return null;const o=e.get(n);if(!o||0===o.size)return null;return function(e,t){let i=null;return e.forEach((e=>{e.priceLow<=t&&t<e.priceHigh&&(i=e)})),i}(o,i)}(this._study.graphics().hhistsByTimePointIndex(),e,p,this._model.mainSeries());if(null===m)return n.forEach((e=>{e.value="0"})),n;const g=this._study.metaInfo().graphics.hhists;if(void 0===g)return n
;if(void 0===g[m.styleId])return n;const f=null===(i=null===(t=this._study.properties().childs().graphics.childs().hhists)||void 0===t?void 0:t.childs()[m.styleId])||void 0===i?void 0:i.childs(),v=e=>(0,s.isNumber)(e)?_.format(e):"";if(a!==c.HHistVolumeMode.Delta){if(m.rate.forEach(((e,t)=>{n[t].value=v(e),n[t].color=(0,r.ensureDefined)(f).colors[t].value()})),a===c.HHistVolumeMode.UpDown){const e=m.rate[0]+m.rate[1];n[2].value=v(e),n[2].color=(0,r.ensureDefined)(f).valuesColor.value()}}else{const e=m.rate[0]>m.rate[1]?0:1,t=(0,r.ensureDefined)(f).colors[e].value(),i=m.rate[0]+m.rate[1];[2*m.rate[e]-i,m.rate[e],i].forEach(((e,i)=>{n[i].value=v(e),n[i].color=t}))}return n}_hideValues(){return p&&(null===this._model.crossHairSource().pane||(0,h.isLineToolName)(a.tool.value())||null!==this._model.lineBeingEdited())}}},16685:(e,t,i)=>{"use strict";var s;i.d(t,{StudyStatusType:()=>s}),function(e){e[e.Undefined=0]="Undefined",e[e.Loading=1]="Loading",e[e.Completed=2]="Completed",e[e.Error=3]="Error"}(s||(s={}))},66831:(e,t,i)=>{"use strict";var s;i.d(t,{InsertionErrorCode:()=>s}),function(e){e.StudyCannotBeChild="cannot_be_child",e.StubWasRemoved="stub_was_removed",e.CannotGetMetainfo="cannot_get_metainfo",e.CannotCompilePub="cannot_compile_pub",e.Cancelled="cancelled",e.Unknown="unknown"}(s||(s={}))},3462:(e,t,i)=>{"use strict";i.d(t,{makeNextStudyId:()=>o,makeNextSymbolId:()=>r});let s=0;function r(){return s++,"ss_"+s}let n=0;function o(){return n++,"st"+n}},62499:(e,t,i)=>{"use strict";function s(e,t){if(null===e)return t;const i=e.firstIndex,s=t.firstIndex,r=e.clearData||t.clearData;return{firstIndex:r||void 0===i||void 0===s?void 0:Math.min(i,s),clearData:r}}i.d(t,{mergeDataInvalidation:()=>s})},72530:(e,t,i)=>{"use strict";i.d(t,{migrateMetaInfoAndPropState:()=>_});var s=i(50151),r=i(68159),n=i(37265);const o=["Moving Average@tv-basicstudies","Moving Average Exponential@tv-basicstudies"];class a{targetMetaInfoVersion(){return 53}migrateMetaInfo(e){const t=e;e._metainfoVersion=53,o.includes(t.id)}migratePropState(e){var t,i,s;o.includes(e.id)&&(e.inputs.length=null!==(t=e.inputs.length)&&void 0!==t?t:e.inputs.in_0,e.inputs.source=null!==(i=e.inputs.source)&&void 0!==i?i:e.inputs.in_1,e.inputs.offset=null!==(s=e.inputs.offset)&&void 0!==s?s:e.inputs.in_2,delete e.inputs.in_0,delete e.inputs.in_1,delete e.inputs.in_2,e.plots[1]={id:"smoothedMA",type:"line"},e.styles.smoothedMA={display:0,linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#0496ff",histogramBase:0,joinPoints:!1,title:"Smoothed MA"})}}const l=["Volume@tv-basicstudies"];class c{targetMetaInfoVersion(){return 53}migrateMetaInfo(e){const t=e;e._metainfoVersion=53,l.includes(t.id)}migratePropState(e){var t;l.includes(e.id)&&(e.inputs.maLength=null!==(t=e.inputs.length)&&void 0!==t?t:e.inputs.maLength,delete e.inputs.length,delete e.inputs.offset,delete e.inputs.source,e.plots[1]={id:"smoothedMA",type:"line"},e.styles.smoothedMA={display:0,linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#0496ff",histogramBase:0,
joinPoints:!1,title:"Smoothed MA"})}}const h=["Relative Strength Index@tv-basicstudies","Commodity Channel Index@tv-basicstudies","On Balance Volume@tv-basicstudies"];class d{targetMetaInfoVersion(){return 53}migrateMetaInfo(e){const t=e,i=e;i._metainfoVersion=53,h.includes(t.id)&&(i.styles[t.id]={title:"Smoothed MA",histogramBase:0,joinPoints:!1})}migratePropState(e){h.includes(e.id)&&(e.plots[1]={id:"smoothedMA",type:"line"},e.styles.smoothedMA={display:0,linestyle:0,linewidth:1,plottype:0,trackPrice:!1,transparency:0,color:"#0496ff"})}}var u;!function(e){e[e.InMetaInfoVersion=52]="InMetaInfoVersion",e[e.OutMetaInfoVersion=53]="OutMetaInfoVersion"}(u||(u={}));const p=[new class{targetMetaInfoVersion(){return 47}migrateMetaInfo(e){const t=e,i=e;if(i._metainfoVersion=47,!t.defaults||void 0===t.defaults.precision)return void(i.format={type:"inherit"});const s=t.defaults&&t.defaults.precision,r=(0,n.isNumber)(s)?s:parseInt(s);0===r?i.format={type:"volume"}:isFinite(r)?i.format={type:"price",precision:r}:i.format={type:"inherit"},delete t.defaults.precision}migratePropState(e){}},new class{targetMetaInfoVersion(){return 50}migrateMetaInfo(e){const t=e,i=e;if(i._metainfoVersion=50,void 0===t.defaults||void 0===t.defaults.ohlcPlots||void 0===t.ohlcPlots)return;const r=t.ohlcPlots,n=t.defaults.ohlcPlots,o=(0,s.ensureDefined)((0,s.ensureDefined)(i.defaults).ohlcPlots);for(const e of Object.keys(n)){const t=n[e];if("ohlc_candles"===t.plottype){let i=!1;const s=r[e];void 0!==s&&(i=!!s.drawBorder,delete s.drawBorder),o[e]={borderColor:"#000000",drawBorder:i,...t}}}}migratePropState(e){}},new class{targetMetaInfoVersion(){return 53}migrateMetaInfo(e){const t=e,i=e;if(i._metainfoVersion=53,void 0!==t.defaults){if(void 0!==t.defaults.ohlcPlots&&void 0!==t.ohlcPlots){const e=Object.keys(t.ohlcPlots),r=t.defaults.ohlcPlots,n=(0,s.ensureDefined)((0,s.ensureDefined)(i.defaults).ohlcPlots);for(const t of e){const e=r[t];if(void 0===e||void 0===e.visible)continue;const i=e.visible?15:0;delete e.visible,n[t]={display:i,...e}}}if(void 0!==t.defaults.styles&&void 0!==t.plots){const e=t.plots.map((e=>e.id)),r=t.defaults.styles,n=(0,s.ensureDefined)((0,s.ensureDefined)(i.defaults).styles);for(const t of e){const e=r[t];if(void 0===e||void 0===e.visible)continue;const i=e.visible?15:0;delete e.visible,n[t]={display:i,...e}}}}}migratePropState(e){if(e.ohlcPlots)for(const t of Object.keys(e.ohlcPlots)){const i=(0,s.ensureDefined)(e.ohlcPlots[t]);void 0!==i.visible&&(i.display=i.visible?15:0,delete i.visible)}if(e.styles)for(const t of Object.keys(e.styles)){const i=(0,s.ensureDefined)(e.styles[t]);void 0!==i.visible&&(i.display=i.visible?15:0,delete i.visible)}}}];function _(e,t){const i=r.StudyMetaInfo.versionOf(e),n=e;void 0===n._serverMetaInfoVersion&&(n._serverMetaInfoVersion=i);const o=["PennantCP@tv-basicstudies","WedgeCP@tv-basicstudies"].includes(e.id);p.forEach((r=>{(i<0||i>=r.targetMetaInfoVersion())&&!o||(r.migrateMetaInfo(e),void 0!==t&&r.migratePropState(t),(0,s.assert)(e._metainfoVersion===r.targetMetaInfoVersion()))}))}
p.push(new a),p.push(new c),p.push(new d),p.sort((function(e,t){return e.targetMetaInfoVersion()-t.targetMetaInfoVersion()}))},25149:(e,t,i)=>{"use strict";i.d(t,{NonSeriesStudy:()=>o,isNonSeriesStudy:()=>n});var s=i(50151),r=i(67317);function n(e){return e instanceof o}class o extends r.Study{clearData(){this._customData=null,this._indexes=null}restoreData(e,t,i){super.restoreData(e),this._customData=t,this._indexes=i}state(e){const t=super.state(e);return e&&(t.nonSeriesData=this._customData,t.indexes=this._indexes),t}customData(){return this._customData}_setPaneViews(e){this._paneViews=e,this.model().lightUpdate()}_onDataUpdated(e,t,i){null!==t&&(t.indexes_replace?((0,s.assert)("nochange"!==i),this._indexes=i):(this._customData=t.data,"nochange"!==i&&(this._indexes=i))),super._onDataUpdated(e,t,i)}}},13380:(e,t,i)=>{"use strict";var s;function r(e){e.lineWidth=void 0,e.lineStyle=void 0;for(let t=0;t<e.colors.length;t++)e.colors[t]=void 0;return e}function n(){return{colors:[void 0,void 0,void 0,void 0,void 0,void 0,void 0],lineWidth:void 0,lineStyle:void 0}}i.d(t,{clearStyle:()=>r,createEmptyStyle:()=>n}),function(e){e[e.Main=0]="Main",e[e.Background=1]="Background",e[e.Text=2]="Text",e[e.Border=3]="Border",e[e.Wick=4]="Wick",e[e.Up=5]="Up",e[e.Down=6]="Down"}(s||(s={}))},81368:(e,t,i)=>{"use strict";i.d(t,{PaneRendererColumns:()=>n});var s=i(30125),r=i(56468);class n extends s.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=null,this._precalculatedCache=[],this.setData(e)}setData(e){this._data=e,this._precalculatedCache=[]}hitTest(e){var t,i,s,n;if(null===this._data)return null;const o=null!==(i=null===(t=this._data.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,a=(null!==(n=null===(s=this._data.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==n?n:this._data.items.length)-1;for(let t=o;t<=a;t++){const i=this._data.items[t];if(e.x>=i.left&&e.x<=i.right){const t=i.y;if(e.y>=Math.min(t,this._data.histogramBase)&&e.y<=Math.max(t,this._data.histogramBase))return new r.HitTestResult(r.HitTarget.Regular)}}return null}_drawImpl(e){var t,i,s,r;if(null===this._data||0===this._data.items.length)return;const{context:n,horizontalPixelRatio:o,verticalPixelRatio:a}=e;this._precalculatedCache.length||this._fillPrecalculatedCache(o);const l=Math.max(1,Math.floor(o)),c=Math.max(1,Math.floor(a)),h=Math.round(this._data.histogramBase*a)-Math.floor(l/2),d=h+l,u=this._data.lineColor,p=null!==(i=null===(t=this._data.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,_=(null!==(r=null===(s=this._data.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:this._data.items.length)-1;for(let e=p;e<=_;e++){const t=this._data.items[e],i=this._precalculatedCache[e-p],s=Math.round(t.y*a);let r,o;n.fillStyle=t.style?t.style.color:u,s<=h?(r=s,o=d):(r=h,o=s-Math.floor(c/2)+c),n.fillRect(i.left,r,i.right-i.left+1,o-r)}}_fillPrecalculatedCache(e){var t,i;if(null===this._data||0===this._data.items.length)return void(this._precalculatedCache=[])
;const{barSpacing:s,visibleItemsRange:r,items:n}=this._data,o=Math.ceil(s*e)<=1?0:Math.max(1,Math.floor(e)),a=null!==(t=null==r?void 0:r.startItemIndex)&&void 0!==t?t:0,l=(null!==(i=null==r?void 0:r.endItemIndex)&&void 0!==i?i:n.length)-1,c=l-a+1;if(c<=0)return void(this._precalculatedCache=[]);this._precalculatedCache=new Array(c);for(let t=a;t<=l;t++){const i=n[t],s=Math.round(i.center*e);let r,l;const c=Math.round((i.right-i.left)*e)-o;if(c%2){const e=(c-1)/2;r=s-e,l=s+e}else{const e=c/2;r=s-e,l=s+e-1}this._precalculatedCache[t-a]={left:r,right:l,roundedCenter:s,center:i.center*e,time:i.timePointIndex}}for(let e=a+1;e<=l;e++){const t=this._precalculatedCache[e-a],i=this._precalculatedCache[e-a-1];t.time===i.time+1&&(t.left-i.right!==o+1&&(i.roundedCenter>i.center?i.right=t.left-o-1:t.left=i.right+o+1))}let h=Math.ceil(s*e);for(let e=a+1;e<=l;e++){const t=this._precalculatedCache[e-a];t.right<t.left&&(t.right=t.left);const i=t.right-t.left+1;h=Math.min(i,h)}if(o>0&&h<4)for(let e=a+1;e<=l;e++){const t=this._precalculatedCache[e-a];t.right-t.left+1>h&&(t.roundedCenter>t.center?t.right-=1:t.left+=1)}}}},78198:(e,t,i)=>{"use strict";i.d(t,{StudyPlotPaneView:()=>V});var s=i(50151),r=i(24377),n=i(56570),o=i(9859),a=i(37265),l=i(19063),c=i(18832);function h(e,t){const i=new Map;return function(...s){const r=""+(t?t.apply(null,s):s[0]);if(!i.has(r)){const t=e.apply(this,s);return i.set(r,t),t}return i.get(r)}}var d=i(2271),u=i(95201),p=i(74010),_=i(3385),m=i(11064),g=i(13380),f=i(86441),v=i(61993),y=i(56468),S=i(30125),b=i(49483);class w extends S.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e}hitTest(e){var t,i,s,r;const n=this._data,o=n.lineWidth,a=n.vertOffset||0,l=(0,v.interactionTolerance)().series+o,c=null!==(i=null===(t=n.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,h=null!==(r=null===(s=n.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:n.items.length;for(let t=c;t<h;t++){const i=n.items[t];if(new f.Point(i.center,i.y+a).subtract(e).length()+o<=l)return new y.HitTestResult(y.HitTarget.Regular)}return null}_drawImpl(e){var t,i,s,r;const n=this._data,{horizontalPixelRatio:o,verticalPixelRatio:l,context:c}=e,h=Math.max(1,Math.floor(o))%2?.5:0,d=n.vertOffset||0,u=n.lineColor,p=n.lineWidth;let _="",m=!1;const g=null!==(i=null===(t=n.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,f=null!==(r=null===(s=n.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:n.items.length;for(let e=g;e<f;e++){const t=n.items[e],i=t.center,s=t.y+d;if((0,a.isNaN)(i)||(0,a.isNaN)(s))continue;let r,g;null!=t.style?(r=t.style.color,g=t.style.width):(r=u,g=p),(r!==_||b.isSafari)&&(_=r,m&&c.fill(),c.beginPath(),c.fillStyle=r);const f=Math.round(i*o)+h,v=Math.round(s*l)+h,y=Math.round(g*o)+h;c.moveTo(f+y,v),c.arc(f,v,y,0,2*Math.PI,!1),m=!0}m&&c.fill()}}var C=i(81368),P=i(4652);class x extends S.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e}hitTest(e){const t=(0,v.interactionTolerance)().series+this._data.lineWidth/2
;let i,s,r,n;for(let o=1;o<this._data.items.length;++o){i=this._data.items[o-1],s=this._data.items[o],r=i.center,n=s.center;if((0,P.distanceToSegment)(new f.Point(r,i.y),new f.Point(n,s.y),new f.Point(e.x,e.y)).distance<=t)return new y.HitTestResult(y.HitTarget.Regular)}return null}_drawImpl(e){var t,i,s,r,n,o,l,c;const{context:h,horizontalPixelRatio:d,verticalPixelRatio:u}=e;let p="",_=!1;const m=null!==(i=null===(t=this._data.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,g=(null!==(r=null===(s=this._data.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:this._data.items.length)-1;for(let e=m;e<=g;e++){const t=this._data.items[e];if((0,a.isNaN)(t.center)||(0,a.isNaN)(t.y))continue;const i=null!==(o=null===(n=t.style)||void 0===n?void 0:n.color)&&void 0!==o?o:this._data.lineColor,s=null!==(c=null===(l=t.style)||void 0===l?void 0:l.width)&&void 0!==c?c:this._data.lineWidth,r=Math.max(1,Math.floor(s*d)),m=Math.max(1,Math.floor(s*u));(i!==p||b.isSafari)&&(p=i,_&&h.fill(),h.beginPath(),h.fillStyle=i);let g=3*r;g%2!=r%2&&(g+=1);let f=3*m;f%2!=m%2&&(f+=1);const v=Math.round(Math.round(t.center*d)-g/2),y=Math.round(Math.round(t.y*u)-f/2),S=v+Math.floor(g/2-r/2),w=y+Math.floor(f/2-m/2);h.rect(v,w,g,m),h.rect(S,y,r,f),_=!0}_&&h.fill()}}class T extends S.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e}hitTest(e){const t=(0,v.interactionTolerance)().series+this._data.lineWidth/2,i=new Map;for(const r of this._data.items){const n=r.center,o=r.y;let a=t;r.style&&(i.has(r.style.width)?a=(0,s.ensureDefined)(i.get(r.style.width)):i.set(this._data.lineWidth,a));if((0,P.distanceToSegment)(new f.Point(n,o),new f.Point(n,this._data.histogramBase),new f.Point(e.x,e.y)).distance<=a)return new y.HitTestResult(y.HitTarget.Regular)}return null}_drawImpl(e){var t,i,s,r;if(0===this._data.items.length)return;const{context:n,horizontalPixelRatio:o,verticalPixelRatio:a}=e;n.fillStyle=this._data.lineColor;const l=Math.max(1,Math.floor(this._data.lineWidth*o)),c=l/2,h=Math.max(1,Math.floor(o)),d=Math.round(this._data.histogramBase*a)-Math.floor(h/2),u=d+h,p=null!==(i=null===(t=this._data.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,_=(null!==(r=null===(s=this._data.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:this._data.items.length)-1;for(let e=p;e<=_;e++){const t=this._data.items[e];let i=l,s=c;t.style?(n.fillStyle=t.style.color,i=Math.max(1,Math.floor(t.style.width*o)),s=i/2):n.fillStyle=this._data.lineColor;const r=i%2?.5:0,p=Math.round(t.center*o)+r,_=Math.round(t.y*a);let m,g;_<=d?(m=_,g=u):(m=d,g=_-Math.floor(h/2)+h),n.fillRect(Math.floor(p-s),m,i,g-m)}}}var I=i(94113),M=i(83085),A=i(29981),L=i(35864);const k=e=>{const t=(0,r.rgbToHsl)((0,r.parseRgb)(e)),i=t[0]+.05;return t[0]=i-Math.floor(i),(0,r.rgbToHexString)((0,r.hslToRgb)(t))},D=h(k),E=new Set([I.LineStudyPlotStyle.Line,I.LineStudyPlotStyle.Area,I.LineStudyPlotStyle.Circles,I.LineStudyPlotStyle.Cross,I.LineStudyPlotStyle.StepLine,I.LineStudyPlotStyle.StepLineWithDiamonds])
;class V extends L.StudyPaneViewInplaceUpdatable{constructor(e,t,i,s,r=!1){super(t,i,s),this._histogramBase=null,this._lineColor="",this._lineWidth=1,this._color1="",this._color2="",this._renderer=new u.CompositeRenderer,this._isMarkersEnabled=n.enabled("source_selection_markers"),this._study=e,this._plotIndex=e.metaInfo().plots.findIndex((e=>e.id===s)),this._colorProvider=(0,M.createStudyPlotColorProvider)(e.metaInfo(),e.properties(),s),this._extendStepLineToBarsEndings=r,this._isFundamental=!1;const o=this._study.properties().styles[this._plotName].plottype.value();this._isStepLinePlot=o===I.LineStudyPlotStyle.StepLine||o===I.LineStudyPlotStyle.StepLineWithBreaks||o===I.LineStudyPlotStyle.StepLineWithDiamonds}items(){return this._items}renderer(){return this._makeSureRendererIsValid(),this._renderer}_getTranspValue(){const e=this._study.properties(),t=e.styles[this._plotName];let i=0;const s=this._study.metaInfo();return"Volume@tv-basicstudies"===s.id&&s.version<=46&&"transparency"in e?(i=e.transparency.value(),i=(0,a.isNumber)(i)?i:0,i):(t.transparency&&(i=t.transparency.value(),i=(0,a.isNumber)(i)?i:0),i)}_updateImplFull(e){var t,i,r;if(this._renderer.clear(),(null===(t=this._dataInvalidated)||void 0===t?void 0:t.clearData)&&(this._items=[]),!this._study.isPlotVisibleAt(this._plotName,1))return!1;if(!this._study.priceScale())return!1;if(null===this._study.firstValue(void 0,this.isForceOverlay()))return!1;if(null===this._study.priceScale())return!1;this._histogramBase=null;const n=this._study.properties().styles[this._plotName],a=n.plottype.value(),c=this._isFundamental&&this._isStepLinePlot,h=this._study.plots().plottableRange(c);if(0===h.size())return!1;const d=this._study.offset(this._plotName),u=E.has(a),p=this._preallocateItems(h,((e,t)=>({y:NaN,left:NaN,center:NaN,right:NaN,origPrices:{price:null!=t?t:NaN,timePointIndex:e+d},timePointIndex:e+d})));let _=NaN,m=NaN;const f=new Map,v=(e,t)=>{let i=f.get(e);void 0===i&&(i=new Map,f.set(e,i));let s=i.get(t);if(void 0===s){const r=!this._plotName||"vol"!==this._plotName;s=(0,l.generateColor)(e,t,r),i.set(t,s)}return s},y=(0,g.createEmptyStyle)(),S=(0,o.clamp)(this._getTranspValue(),0,100),b=this._model.timeScale().visibleBarsStrictRange();if(null===b)return!1;const{startBar:w,endBar:C}=this._calculateStartEnd(b);if(null===w||null===C||0===this._items.length)return!1;const P=null!=p?p:(0,s.ensureNotNull)(h.firstIndex()),x=(0,s.ensureNotNull)(h.lastIndex())+1,T=h.rangeIterator(P,x);let I,M=(0,A.lowerbound)(this._items,P+d,((e,t)=>e.timePointIndex<t));for(const e of T){let t=e.index;const s=e.value;t+=d,t=Math.floor(t);let o=s[this._plotIndex+1];const a=null==o;if(o=a?NaN:o,u&&a){m=o,_=t,M++;continue}const c=this._items[M];c.valIsNotSameAsPrev=o!==m||t-1!==_;if(this._colorProvider.isColorDefined()&&(c.style={color:v(n.color.value(),100),width:n.linewidth.value(),style:n.linestyle.value()},null!=o)){const e=this._colorProvider.getPlotPointStyle(s,y),t=e.colors[0];void 0!==t&&(c.style.color=(0,l.isHexColor)(t)?v(t,S):t),
c.style.width=null!==(i=e.lineWidth)&&void 0!==i?i:c.style.width,c.style.style=null!==(r=e.lineStyle)&&void 0!==r?r:c.style.style}!u&&!isNaN(_)&&_!==t-1&&M>0&&(this._items[M].breakBefore=!0),m=o,_=t,M++,I=c}return this._updateImplLight(),!0}_correctVisibleItemIndexes(e,t){return super._correctVisibleItemIndexes(e,t)}_updateRenderer(e,t){var i,r;this._renderer.clear();const n=this._study.properties().styles.childs()[this._plotName].childs(),h=null===(i=this._study.metaInfo().styles)||void 0===i?void 0:i[this._plotName],u=(0,o.clamp)(this._getTranspValue(),0,100);this._lineColor=(0,l.generateColor)(n.color.value(),u),this._lineWidth=n.linewidth.value();let g=n.color.value();const f=this._colorProvider.getDefaultPlotPointStyle();f&&(g=f.colors[0]||g,this._lineWidth=null!==(r=f.lineWidth)&&void 0!==r?r:this._lineWidth,this._lineColor=g?(0,l.generateColor)(g,u):this._lineColor),this._color2=(0,l.generateColor)(g,u);const v=this._study.metaInfo().isRGB?k(g):D(g);this._color1=(0,l.generateColor)(v,u);const y=this._histogramBase?this._histogramBase:(0,s.ensureNotNull)(this._study.priceScale()).height(),S=n.plottype.value(),b={barSpacing:this._model.timeScale().barSpacing(),items:this._items,histogramBase:y,lineIndex:0,lineStyle:n.linestyle.value(),lineColor:this._lineColor,lineWidth:(0,a.isNumber)(this._lineWidth)?this._lineWidth:1,color1:this._color1,color2:this._color2,bottom:y,visibleItemsRange:{startItemIndex:e,endItemIndex:t},simpleMode:this._colorProvider.singleColor(),skipHoles:[I.LineStudyPlotStyle.Line,I.LineStudyPlotStyle.Area,I.LineStudyPlotStyle.Cross,I.LineStudyPlotStyle.Circles,I.LineStudyPlotStyle.StepLine,I.LineStudyPlotStyle.StepLineWithDiamonds].includes(S)},P=this._renderer,M=Boolean(null==h?void 0:h.joinPoints);switch(S){case I.LineStudyPlotStyle.Line:case I.LineStudyPlotStyle.LineWithBreaks:P.append(new p.PaneRendererLine(b));break;case I.LineStudyPlotStyle.Area:case I.LineStudyPlotStyle.AreaWithBreaks:P.append(new d.PaneRendererArea(b));break;case I.LineStudyPlotStyle.Histogram:P.append(new T(b));break;case I.LineStudyPlotStyle.Columns:P.append(new C.PaneRendererColumns(b));break;case I.LineStudyPlotStyle.Cross:P.append(new x(b)),M&&P.append(new p.PaneRendererLine({...(0,c.deepCopy)(b),lineWidth:1,forceLineWidth:!0}));break;case I.LineStudyPlotStyle.Circles:P.append(new w(b)),M&&P.append(new p.PaneRendererLine({...(0,c.deepCopy)(b),lineWidth:1,ignorePaletteLineWidth:!0}));break;case I.LineStudyPlotStyle.StepLine:case I.LineStudyPlotStyle.StepLineWithBreaks:case I.LineStudyPlotStyle.StepLineWithDiamonds:{const e=new _.PaneRendererStepLine;e.setData({...b,decoration:n.plottype.value()===I.LineStudyPlotStyle.StepLineWithDiamonds?_.StepLineDecoration.Diamonds:_.StepLineDecoration.None,extendToBarsEndings:this._extendStepLineToBarsEndings}),P.append(e);break}default:P.append(new p.PaneRendererLine(b))}this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&this._selectionData&&P.append(new m.SelectionRenderer(this._selectionData))}_updateAdditionalPrices(e,t){var i
;const s=null===(i=this._study.metaInfo().styles)||void 0===i?void 0:i[this._plotName];void 0!==(null==s?void 0:s.histogramBase)&&(this._histogramBase=e.priceToCoordinate(s.histogramBase,t))}}},64559:(e,t,i)=>{"use strict";i.d(t,{StudyForceOverlayPlotView:()=>s});class s{constructor(e,t,i){this._series=e,this._model=t,this._plotName=i}isForceOverlay(){return!!this._study.metaInfo().isPlotForceOverlay(this._plotName)}_priceScale(){return this.isForceOverlay()?this._model.mainSeries().priceScale():this._study.priceScale()}}},35864:(e,t,i)=>{"use strict";i.d(t,{StudyPaneViewInplaceUpdatable:()=>d});var s=i(50151),r=i(86441),n=i(62499),o=i(8025),a=i(29981),l=i(66540),c=i(56468),h=i(64559);class d extends h.StudyForceOverlayPlotView{constructor(e,t,i){super(e,t,i),this._selectionData=null,this._dataInvalidated=null,this._viewportInvalidated=!1,this._items=[],this._selectionIndexer=new l.SelectionIndexes(t.timeScale())}update(e){if("global-change"===e.type)return this._dataInvalidated=(0,n.mergeDataInvalidation)(this._dataInvalidated,{}),void(this._viewportInvalidated=!0);if("data-source-change"!==e.type)this._viewportInvalidated=!0;else{if((e.sourceId===this._study.id()||this._dependsOnSeriesData()&&e.sourceId===this._model.mainSeries().id())&&!e.nonSeriesOnly){const t=(0,n.mergeDataInvalidation)(this._dataInvalidated,{firstIndex:e.firstUpdatedTimePointIndex,clearData:e.clearData});this._dataInvalidated=t}}}_dependsOnSeriesData(){return!1}_makeSureRendererIsValid(){this._dataInvalidated?this._updateImplFull(this._viewportInvalidated)&&(this._dataInvalidated=null):this._viewportInvalidated&&this._updateImplLight(),this._viewportInvalidated=!1}_preallocateItems(e,t){var i,r;const n=e.size(),o=null===(i=this._dataInvalidated)||void 0===i?void 0:i.firstIndex;if(0===n)return o;const l=this._study.offset(this._plotName);if(n!==this._items.length){const i=void 0!==o?o+l:void 0;if(void 0===i||0===this._items.length||i<(0,s.ensureDefined)(this._items[0].timePointIndex))return this._items=[],e.each(((e,i)=>{const s=i[this._plotIndex+1];return this._items.push(t(e,s)),!1})),this._items.length?(0,s.ensureDefined)(this._items[0].timePointIndex)-l:void 0;{const i=(0,s.ensureDefined)(o),n=l>=0?0:l,c=l>=0?l:0;let h=(0,a.lowerbound)(this._items,i+n,((e,t)=>e.timePointIndex<t));const d=(0,s.ensureNotNull)(e.lastIndex()),u=e.rangeIterator(i-c,d);for(const e of u)if(void 0!==h&&(null===(r=this._items[h])||void 0===r?void 0:r.timePointIndex)===e.index+l)h=this._updateItem(e,h);else{const i=e.value[this._plotIndex+1];this._items.push(t(e.index,i))}}}else if(void 0!==o){const t=l>=0?0:l,i=l>=0?l:0;let r=(0,a.lowerbound)(this._items,o+t,((e,t)=>e.timePointIndex<t));const n=(0,s.ensureNotNull)(e.lastIndex())+1,c=e.rangeIterator(o-i,n);for(const e of c)r=this._updateItem(e,r)}return o}_updateItem(e,t){const i=this._getValueForUpdating(e);return this._items[t].origPrices.price=null!=i?i:NaN,t+1}_getValueForUpdating(e){return e.value[this._plotIndex+1]}_calculateStartEnd(e){const t=this._study.offset(this._plotName)
;let i=e.firstBar()-Math.abs(t)-1,r=e.lastBar()+Math.abs(t)+1;const n=this._study.getMinFirstBarIndexForPlot(this._plotName)+t;if(n>r+1)return{startBar:null,endBar:null};let a=this._study.plots();a=a.range(n,(0,s.ensureNotNull)(a.lastIndex())),i=Math.max(i,n),r=Math.max(r,n);const l=a.search(i,o.PlotRowSearchMode.NearestLeft,this._plotIndex+1),c=a.search(r,o.PlotRowSearchMode.NearestRight,this._plotIndex+1);return null!==l&&(i=l.index),null!==c&&(r=c.index),i=Math.max(n,i),{startBar:i,endBar:r}}_updateImplLight(){const e=this._study.firstValue(void 0,this.isForceOverlay());if(null===e)return this._selectionData=null,void this._updateRenderer(0,-1);const t=this._priceScale();if(null===t)return this._selectionData=null,void this._updateRenderer(0,-1);const i=this._model.timeScale().visibleBarsStrictRange();if(null===i)return this._selectionData=null,void this._updateRenderer(0,-1);const{startBar:s,endBar:r}=this._calculateStartEnd(i);if(null===s||null===r||0===this._items.length)return this._selectionData=null,void this._updateRenderer(0,-1);const{startItemIndex:n,endItemIndex:o}=this._correctVisibleItemIndexes(Math.max(0,(0,a.lowerbound)(this._items,s,((e,t)=>e.timePointIndex<t))),Math.min(this._items.length,(0,a.upperbound)(this._items,r,((e,t)=>e<t.timePointIndex))));if(n>=o)return this._selectionData=null,void this._updateRenderer(0,-1);this._convertItemsToCoordinates(t,e,n,o),this._createSelection(e),this._updateRenderer(n,o)}_correctVisibleItemIndexes(e,t){return{startItemIndex:e,endItemIndex:t}}_convertItemsToCoordinates(e,t,i,s){this._convertItemsToCoordinatesImpl(e,t,i,s)}_convertItemsToCoordinatesImpl(e,t,i,s){for(let e=i;e<s;e++){const t=this._items[e];t.y=t.origPrices.price}e.pointsArrayToCoordinates(this._items,t,{startItemIndex:i,endItemIndex:s}),this._model.timeScale().fillBarBorders(this._items,{startItemIndex:i,endItemIndex:s},!0),this._updateAdditionalPrices(e,t)}_updateAdditionalPrices(e,t){}_createSelection(e){const t=this._priceScale();if(null!==t)if(this._model.selection().isSelected(this._study)){const i=this._selectionIndexer.indexes(),n=(0,s.ensureNotNull)(this._model.paneForSource(this._study)).height();this._selectionData={points:[],bgColors:[],visible:!0,hittestResult:c.HitTarget.Regular,barSpacing:this._model.timeScale().barSpacing()};const o=this._study.offset(this._plotName);for(let s=0;s<i.length;s++){let a=i[s];const l=this._study.plots().valueAt(a);if(a+=o,null===l)continue;const c=l[this._plotIndex+1];if(null==c)continue;const h=this._model.timeScale().indexToCoordinate(Math.floor(a)),d=t.priceToCoordinate(c,e);this._selectionData.points.push(new r.Point(h,d)),this._selectionData.bgColors.push(this._model.backgroundColorAtYPercentFromTop(d/n))}}else this._selectionIndexer.clear()}}},83085:(e,t,i)=>{"use strict";i.d(t,{createStudyPlotColorProvider:()=>p});var s=i(94113),r=i(50151),n=i(13380);const o=new Map([[0,"color"],[2,"textColor"],[3,"borderColor"],[4,"wickColor"],[5,"colorup"],[6,"colordown"]]);class a{constructor(e){this._plotStyle=e}getPlotPointStyle(e,t){const i=t?(0,
n.clearStyle)(t):(0,n.createEmptyStyle)();return o.forEach(((e,t)=>{this._plotStyle[e]&&(i.colors[t]=this._plotStyle[e].value())})),i.lineWidth=this._plotStyle.linewidth?this._plotStyle.linewidth.value():void 0,i.lineStyle=this._plotStyle.linestyle?this._plotStyle.linestyle.value():void 0,i}isColorDefined(){return!0}singleColor(){return!0}getDefaultPlotPointStyle(){return null}}const l=[0,1,2,3,4,5,6];class c{constructor(e,t,i,s){this._palettesColors=new Map,this._defaultPlotColors=new Map,this._indexes=s;const n=t.styles[i];if(n)for(const[e,t]of o)this._defaultPlotColors.set(e,n[t]);const a=(0,r.ensureDefined)(e.palettes),l=e.plots;s.forEach(((e,i)=>{const s=l[e];if(s&&"palette"in s){const e=a[s.palette],r=t.palettes[s.palette];if(e&&r){const{valToIndex:t}=e,{colors:s}=r,n={...s};t&&Object.keys(t).forEach((e=>{const i=t[e];void 0!==i&&(n[e]=s[i])})),this._palettesColors.set(i,n)}}}))}getPlotPointStyle(e,t){const i=t?(0,n.clearStyle)(t):(0,n.createEmptyStyle)();return l.forEach((t=>{var s,n;if(this._palettesColors.has(t)){const n=e[(0,r.ensureDefined)(this._indexes.get(t))+1];if("number"==typeof n){const e=null===(s=this._palettesColors.get(t))||void 0===s?void 0:s[n];0===t&&e&&(i.lineWidth=e.width.value(),i.lineStyle=e.style.value()),i.colors[t]=null==e?void 0:e.color.value()}else i.colors[t]="transparent"}else i.colors[t]=null===(n=this._defaultPlotColors.get(t))||void 0===n?void 0:n.value()})),i}getDefaultPlotPointStyle(){var e;const t=null===(e=this._palettesColors.get(0))||void 0===e?void 0:e[0];if(void 0!==t){return{colors:[t.color.value(),void 0,void 0,void 0,void 0,void 0,void 0],lineStyle:void 0,lineWidth:t.width.value()}}return null}isColorDefined(){return!!this._palettesColors.size}singleColor(){return!1}}var h=i(31599);class d{constructor(e){this._rgbaFromInteger=(0,h.rgbaFromIntegerCached)(),this._indexes=e}getPlotPointStyle(e,t){const i=t?(0,n.clearStyle)(t):(0,n.createEmptyStyle)();return this._indexes.forEach(((t,s)=>{const r=e[t+1];if(null!=r){const e=this._rgbaFromInteger(r);i.colors[s]=e}else i.colors[s]="transparent"})),i}isColorDefined(){return!0}singleColor(){return!1}getDefaultPlotPointStyle(){return null}}const u=new Map([[0,function(e,t){const i=(0,s.isColorerPlot)(t)||(0,s.isOhlcColorerPlot)(t);return"target"in t&&t.target===e&&i}],[2,function(e,t){const i=(0,s.isTextColorerPlot)(t);return"target"in t&&t.target===e&&i}],[1,function(e,t){return(0,s.isBgColorerPlot)(t)&&t.id===e}],[3,function(e,t){const i=(0,s.isCandleBorderColorerPlot)(t);return"target"in t&&t.target===e&&i}],[4,function(e,t){const i=(0,s.isCandleWickColorerPlot)(t);return"target"in t&&t.target===e&&i}],[5,function(e,t){const i=(0,s.isUpColorerPlot)(t);return"target"in t&&t.target===e&&i}],[6,function(e,t){const i=(0,s.isDownColorerPlot)(t);return"target"in t&&t.target===e&&i}]]);function p(e,t,i){const{colorers:s}=function(e,t){const i=e.plots,s=i.findIndex((e=>e.id===t)),r=new Map;return i.forEach(((e,i)=>{u.forEach(((s,n)=>{s(t,e)&&r.set(n,i)}))})),{plotIndex:-1===s?null:s,colorers:r}}(e,i)
;if(s.size)return e.isRGB?new d(s):new c(e,t,i,s);{const e=t.ohlcPlots;if(e&&e[i])return new a(e[i]);const s=t.styles[i];return new a(s)}}},94113:(e,t,i)=>{"use strict";var s,r,n,o,a,l,c;function h(e){return"line"===e.type}function d(e){return"shapes"===e.type}function u(e){return"chars"===e.type}function p(e){return"arrows"===e.type}function _(e){return"data"===e.type}function m(e){return"dataoffset"===e.type}function g(e){return"ohlc_open"===e.type}function f(e){return"ohlc_high"===e.type}function v(e){return"ohlc_low"===e.type}function y(e){return"ohlc_close"===e.type}function S(e){return g(e)||f(e)||v(e)||y(e)}function b(e){return"colorer"===e.type&&"palette"in e}function w(e){return"colorer"===e.type&&!("palette"in e)}function C(e){return"colorer"===e.type}function P(e){return"bar_colorer"===e.type}function x(e){return"bg_colorer"===e.type}function T(e){return"text_colorer"===e.type}function I(e){return"ohlc_colorer"===e.type}function M(e){return"wick_colorer"===e.type}function A(e){return"border_colorer"===e.type}function L(e){return"up_colorer"===e.type}function k(e){return"down_colorer"===e.type}function D(e){return"alertcondition"===e.type}function E(e){return h(e)||d(e)||u(e)||p(e)}function V(e){return"Plot"!==e}function B(e){return"ohlc_bars"===e.plottype}function R(e){return"ohlc_candles"===e.plottype}function N(e){return C(e)||P(e)||x(e)||_(e)||m(e)||I(e)||D(e)||L(e)||k(e)||A(e)||M(e)||T(e)}function O(e){return C(e)||T(e)||P(e)||_(e)||m(e)||I(e)||M(e)||A(e)||L(e)||k(e)||D(e)}i.r(t),i.d(t,{InternalStudyPlotType:()=>n,LineStudyPlotStyle:()=>s,OhlcStudyPlotStyle:()=>l,PlotSymbolSize:()=>c,STUDYPLOTDISPLAYTARGET:()=>a,StudyPlotDisplayTarget:()=>o,StudyPlotType:()=>r,isAlertConditionPlot:()=>D,isArrowsPlot:()=>p,isBarColorerPlot:()=>P,isBgColorerPlot:()=>x,isCandleBorderColorerPlot:()=>A,isCandleWickColorerPlot:()=>M,isCharsPlot:()=>u,isColorerPlot:()=>C,isDataOffsetPlot:()=>m,isDataPlot:()=>_,isDownColorerPlot:()=>k,isLinePlot:()=>h,isNonVisualPlot:()=>O,isOhlcClosePlot:()=>y,isOhlcColorerPlot:()=>I,isOhlcHighPlot:()=>f,isOhlcLowPlot:()=>v,isOhlcOpenPlot:()=>g,isOhlcPlot:()=>S,isOhlcPlotStyleBars:()=>B,isOhlcPlotStyleCandles:()=>R,isPaletteColorerPlot:()=>b,isPlotSupportDisplay:()=>E,isPlotTitleDefined:()=>V,isPlotWithTechnicalValues:()=>N,isRgbaColorerPlot:()=>w,isShapesPlot:()=>d,isTextColorerPlot:()=>T,isUpColorerPlot:()=>L}),function(e){e[e.Line=0]="Line",e[e.Histogram=1]="Histogram",e[e.Cross=3]="Cross",e[e.Area=4]="Area",e[e.Columns=5]="Columns",e[e.Circles=6]="Circles",e[e.LineWithBreaks=7]="LineWithBreaks",e[e.AreaWithBreaks=8]="AreaWithBreaks",e[e.StepLine=9]="StepLine",e[e.StepLineWithDiamonds=10]="StepLineWithDiamonds",e[e.StepLineWithBreaks=11]="StepLineWithBreaks"}(s||(s={})),function(e){e.Line="line",e.Colorer="colorer",e.BarColorer="bar_colorer",e.BgColorer="bg_colorer",e.TextColorer="text_colorer",e.OhlcColorer="ohlc_colorer",e.CandleWickColorer="wick_colorer",e.CandleBorderColorer="border_colorer",e.UpColorer="up_colorer",e.DownColorer="down_colorer",e.Shapes="shapes",e.Chars="chars",
e.Arrows="arrows",e.Data="data",e.DataOffset="dataoffset",e.OhlcOpen="ohlc_open",e.OhlcHigh="ohlc_high",e.OhlcLow="ohlc_low",e.OhlcClose="ohlc_close"}(r||(r={})),function(e){e.AlertCondition="alertcondition"}(n||(n={})),function(e){e[e.None=0]="None",e[e.Pane=1]="Pane",e[e.DataWindow=2]="DataWindow",e[e.PriceScale=4]="PriceScale",e[e.StatusLine=8]="StatusLine",e[e.All=15]="All"}(o||(o={})),function(e){e[e.None=0]="None",e[e.Pane=1]="Pane",e[e.DataWindow=2]="DataWindow",e[e.PriceScale=4]="PriceScale",e[e.StatusLine=8]="StatusLine",e[e.All=15]="All"}(a||(a={})),function(e){e.OhlcBars="ohlc_bars",e.OhlcCandles="ohlc_candles"}(l||(l={})),function(e){e.Auto="auto",e.Tiny="tiny",e.Small="small",e.Normal="normal",e.Large="large",e.Huge="huge"}(c||(c={}))},49822:(e,t,i)=>{"use strict";function s(e,t="shift",i){return{studyConstructor:e,colorRotationMode:t,colorRotationComparator:i}}i.d(t,{addStudyInfoToMap:()=>n,createStudyInfo:()=>s,getStudyClassName:()=>a,getStudyInfoByName:()=>o});const r=new Map;function n(e,t){r.set(e,t)}function o(e){return r.get(e)}function a(e){for(const[t,i]of r.entries())if(i.studyConstructor===e)return t;return null}},72708:(e,t,i)=>{"use strict";i.r(t),i.d(t,{createStudy:()=>le,hasConfirmInputs:()=>ue,isCompareOrOverlayStudy:()=>ae,isESDStudy:()=>re,isFundamentalStudy:()=>se,isOverlayStudy:()=>oe,isRollDatesStudy:()=>ne,isStudy:()=>ee,isStudyStrategy:()=>te,isStudyStub:()=>ie,isSymbolicStudy:()=>_e,studyColorRotationMode:()=>ce,useSameColorRotationComparator:()=>de});var s=i(56570),r=i(68159),n=i(67317),o=i(50151),a=i(25149),l=i(27714),c=i(7114);class h{constructor(e,t,i,s){this._priceAxisFontSize=11,this._prices=[],this._labelWidth=0,this._pixelRatioParams=e,this._recreateCanvasAndContext((0,l.size)({width:0,height:0})),this.reset({font:t,fontSize:i,backColors:s})}destroy(){delete this._canvas,delete this._cache}canvas(){return this._canvas}reset(e){this._renderParams=e,this._prices=[],this._cache.font=e.fontSize+"px "+e.font,this._labelWidth=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5","/"].reduce(((e,t)=>{const i=this._cache.measureText(t).width;return Math.max(i,e)}),0)}rowHeight(){return this._priceAxisFontSize+4}labelRectByIndex(e){return{left:0,top:Math.round(this._topByIndex(e)),width:Math.round(this._labelWidth+4),height:Math.round(this._renderParams.fontSize+8)}}setPrices(e){let t=!1;const i=(e,t)=>{const i=void 0===e,s=void 0===t;return(!i&&!s||i===s)&&(0,o.ensureDefined)(e).formatted===(0,o.ensureDefined)(t).formatted};if(e.length!==this._prices.length)t=!0;else for(let s=0;s<this._prices.length;s++)if(!i(this._prices[s],e[s])){t=!0;break}if(t){const t=this._labelWidth+6,i=this._renderParams.fontSize,s=Math.max(e.length,22)*(i+8);this._recreateCanvasAndContext((0,l.size)({width:t,height:s})),this._prices=e,this._cache.save(),(0,c.drawScaled)(this._cache,this._pixelRatioParams.horizontalPixelRatio,this._pixelRatioParams.verticalPixelRatio,(()=>{this._cache.translate(.5,.5),this._cache.font=this._renderParams.fontSize+"px "+this._renderParams.font,
this._cache.textBaseline="middle";for(let e=0;e<this._prices.length;e++){if(!this._prices[e])continue;const t=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5"][e];this._cache.fillStyle=this._renderParams.backColors[e],this._cache.fillText(t,0,this._centerByIndex(e)),this._cache.fillText("/",0,this._centerByIndex(e+11))}})),this._cache.restore(),this._prices=e}}_recreateCanvasAndContext(e){this._canvas=document.createElement("canvas"),this._canvas.width=e.width*this._pixelRatioParams.horizontalPixelRatio,this._canvas.height=e.height*this._pixelRatioParams.verticalPixelRatio,this._cache=(0,o.ensureNotNull)(this._canvas.getContext("2d"))}_centerByIndex(e){return Math.round((e+.5)*(this._renderParams.fontSize+8))}_topByIndex(e){return Math.round(e*(this._renderParams.fontSize+8))}}var d=i(15938),u=i(98558),p=i(19063);const _=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5"];class m extends u.PriceAxisView{constructor(e,t){super(),this._source=e,this._data=t;const i=t.name;this._completeName="P"===i.toUpperCase()?"P":`S${i[1]}/R${i[1]}`}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const s=this._source.properties().childs();if(!s.visible.value())return;const r=this._completeName,n=s.levelsStyle.childs().visibility.childs();if(!n[r]||!n[r].value())return;const o=this._source.model().timeScale(),a=this._source.priceScale();if(o.isEmpty()||null===o.visibleBarsStrictRange()||null!==a&&a.isEmpty())return;const l=this._source.customData();if(!l||!l.pivots)return;const c=this._source.pricesView().prices()[_.indexOf(this._data.name.toUpperCase())];if(!c)return;i.background=(0,p.resetTransparency)(c.color),i.textColor=this.generateTextColor(i.background),i.coordinate=c.coordinate,i.floatCoordinate=c.coordinate;const h=this._source.model().properties().childs().scalesProperties.childs();h.showStudyLastValue.value()&&(e.text=c.formatted,e.visible=!0),h.showStudyPlotLabels.value()&&(t.text=this._source.priceLabelText(this._data.name),t.visible=!0)}}var g=i(65458),f=i(22839),v=i(49936),y=i(8025);const S=["p","s1","r1","s2","r2","s3","r3","s4","r4","s5","r5"],b={P:"P",S1:"S1/R1",S2:"S2/R2",S3:"S3/R3",S4:"S4/R4",S5:"S5/R5",R1:"S1/R1",R2:"S2/R2",R3:"S3/R3",R4:"S4/R4",R5:"S5/R5"};class w{constructor(e){this._visiblePivots=new Set,this._invidated=!0,this._prices=[],this._source=e}visiblePivots(){return this._visiblePivots}update(){this._invidated=!0}prices(){return this._invidated&&(this._updateImpl(),this._invidated=!1),this._prices}_updateImpl(){this._visiblePivots.clear();const e=this._source.model(),t=this._source.priceScale();if(null===t)return;if(e.timeScale().isEmpty()||t.isEmpty())return;const i=e.timeScale().visibleBarsStrictRange();if(null===i)return;if(!this._source.customData()||!this._source.customData().pivots)return;const s=e.mainSeries().bars().search(i.lastBar(),y.PlotRowSearchMode.NearestLeft);if(null===s)return;const r=this._source.indexes();if(!r)return;const n=s.index,o=this._source.customData().pivots,a=this._source.properties().childs(),l=this._source.firstValue();for(let e=0;e<o.length;e++){
if(!o[e])continue;const i=r[o[e].startIndex],s=r[o[e].endIndex],c=a.inputs.childs().showHistoricalPivots.value();if(i<=n&&(s>=n||c)){this._visiblePivots.add(o[e]),this._prices=[];for(let i=0;i<S.length;i++){const s=S[i],r=o[e][s];if(void 0===r||null===l)continue;const n=t.priceToCoordinate(r,l),c=s.toUpperCase(),h=b[c],d=a.levelsStyle.childs().colors.childs()[h].value();this._prices.push({formatted:t.formatPrice(r,l),price:r,coordinate:n,color:d})}}}}}var C=i(86441),P=i(51056),x=i(95201),T=i(50600),I=i(56468),M=i(30125);class A extends M.BitmapCoordinatesPaneRenderer{constructor(e,t,i){super(),this._drawRects=[],this._cacheProvider=e,this._point=t,this._label=i}hitTest(e){for(const t of this._drawRects)if(e.x>=t.left&&e.x<=t.left+t.width&&e.y>=t.top&&e.y<=t.top+t.height)return new I.HitTestResult(I.HitTarget.Regular);return null}_drawImpl(e){const t=this._cacheProvider(e),{horizontalPixelRatio:i,verticalPixelRatio:s,context:r}=e;this._drawRects=[];const n=e=>{const n=t.labelRectByIndex(e),o={left:Math.round(this._point.x-n.width+a),top:Math.round(this._point.y-n.height/2),width:n.width,height:n.height};return r.drawImage(t.canvas(),Math.round(n.left*i),Math.round(n.top*s),n.width*i,n.height*s,Math.round(o.left*i),Math.round(o.top*s),o.width*i,o.height*s),this._drawRects.push(o),n.width},o=this._label.split("/");let a=0;for(let e=0;e<o.length;e++){const t=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5"].indexOf(o[e]);e>0&&(a+=n(t+11)/2),a+=n(t)/2}}}function L(e){return"P"===e?e:"S"+e[1]+"/R"+e[1]}function k(e,t,i){const s=t;void 0===e[s]?e[s]={text:i,ids:[L(i)]}:(e[s].text+="/"+i,e[s].ids.push(L(i)))}class D{constructor(e,t){this._pivots=[],this._invalidated=!0,this._renderer=new x.CompositeRenderer,this._model=e,this._source=t,this._cacheProvider=this._source.getCache.bind(this._source)}update(e){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer}_updateImpl(){this._renderer.clear();const e=this._source.ownerSource();if(null===e)return;this._source.pricesView().prices(),this._pivots=[];const t=this._source.customData();if(!t||!t.pivots)return;const i=this._source.properties().childs();if(!i.visible.value())return;const s=t.pivots,r=this._source.indexes(),n=this._model.timeScale(),a=this._source.priceScale(),l=e.firstValue();if(!a||a.isEmpty()||n.isEmpty()||!s||!r||null===l)return;const c=(0,o.ensureNotNull)(n.visibleBarsStrictRange()),h=c.firstBar(),d=c.lastBar();for(let e=0;e<s.length;e++){if(!s[e])continue;const t=r[s[e].startIndex],o=r[s[e].endIndex];if(o<h||t>d)continue;const c={},u=i.levelsStyle.childs().visibility.childs();u.P.value()&&k(c,s[e].p,"P"),u["S1/R1"].value()&&(k(c,s[e].s1,"S1"),k(c,s[e].r1,"R1")),u["S2/R2"].value()&&(k(c,s[e].s2,"S2"),k(c,s[e].r2,"R2")),u["S3/R3"].value()&&(k(c,s[e].s3,"S3"),k(c,s[e].r3,"R3")),u["S4/R4"].value()&&(k(c,s[e].s4,"S4"),k(c,s[e].r4,"R4")),u["S5/R5"].value()&&(k(c,s[e].s5,"S5"),k(c,s[e].r5,"R5"));const p=n.indexToCoordinate(t),_=n.indexToCoordinate(o);for(const t of Object.keys(c)){
const i=parseFloat(t),r=a.priceToCoordinate(i,l);this._pivots.push({x1:p,x2:_,y:r,label:c[t].text,labelIds:c[t].ids,src:s[e]})}}const u=i.levelsStyle.childs().colors,p=i.levelsStyle.childs().widths,_=this._source.visiblePivots();for(let e=0;e<this._pivots.length;e++){const t=this._pivots[e];if(!_.has(t.src))continue;const s={color:u.childs()[t.labelIds[0]].value(),linewidth:p.childs()[t.labelIds[0]].value(),linestyle:P.LINESTYLE_SOLID,y:t.y,left:t.x1,right:t.x2},r=new T.HorizontalLineRenderer;r.setData(s),r.setHitTest(new I.HitTestResult(I.HitTarget.Regular)),this._renderer.append(r),i.levelsStyle.childs().showLabels.value()&&this._renderer.append(new A(this._cacheProvider,new C.Point(t.x1,t.y),t.label))}}}var E=i(93280);class V extends a.NonSeriesStudy{constructor(e,t,i,s){super(e,t,i,s),this._cache=null,this._cachedPixelRatioParams=null;const r=["P","S1/R1","S2/R2","S3/R3","S4/R4","S5/R5"],n=this.properties().childs().levelsStyle.childs().visibility;for(let e=0;e<r.length;e++)n.childs()[r[e]].listeners().subscribe(this,(()=>this.processHibernate()))}pricesView(){return this._pricesView}indexes(){return this._indexes}properties(){return this._properties}getCache(e){if(null===this._cache||null==this._cachedPixelRatioParams||(t=e,i=this._cachedPixelRatioParams,t.horizontalPixelRatio!==i.horizontalPixelRatio||t.verticalPixelRatio!==i.verticalPixelRatio)){this._cache&&this._cache.destroy();const t=this._getActualCacheParams(),i={horizontalPixelRatio:e.horizontalPixelRatio,verticalPixelRatio:e.verticalPixelRatio};this._cache=new h(i,t.font,t.fontSize,t.backColors),this._cache.setPrices((0,o.ensureNotNull)(this._pricesView).prices()),this._cachedPixelRatioParams=i,this._cache.reset(t)}var t,i;return this._cache}priceLabelText(e){return this._metaInfo.shortDescription+":"+e.toUpperCase()}updateAllViews(e){super.updateAllViews(e),this._pricesView.update()}visiblePivots(){return this._pricesView.visiblePivots()}isVisible(){if(!this.properties().childs().visible.value()||!this.isActualInterval())return!1;const e=["P","S1/R1","S2/R2","S3/R3","S4/R4","S5/R5"],t=this.properties().childs().levelsStyle.childs().visibility;for(let i=0;i<e.length;i++)if(t.childs()[e[i]].value())return!0;return!1}stop(){super.stop(),this._cache&&(this._cache.destroy(),this._cache=null)}priceRange(e,t,i){var s;if(i.targetPriceScale!==this.priceScale())return null;const r=null===(s=this.customData())||void 0===s?void 0:s.pivots;if(!r||!this._indexes)return null;if(!this.priceScale())return null;const n=r,o=this._indexes;let a=null;for(let i=0;i<n.length;i++){if(!n[i])continue;const s=o[n[i].startIndex];if(o[n[i].endIndex]<e||s>t)continue;const r=[],l=this.properties().childs().levelsStyle.childs().visibility.childs();l.P.value()&&r.push(n[i].p),l["S1/R1"].value()&&r.push(n[i].s1,n[i].r1),l["S2/R2"].value()&&r.push(n[i].s2,n[i].r2),l["S3/R3"].value()&&r.push(n[i].s3,n[i].r3),l["S4/R4"].value()&&r.push(n[i].s4,n[i].r4),l["S5/R5"].value()&&r.push(n[i].s5,n[i].r5);for(let e=0;e<r.length;e++)r[e]&&(null===a?a=new E.PriceRange(r[e],r[e]):a.apply(r[e],r[e]))}
const l=this.priceScale();return l&&l.isLog()&&a?new E.PriceRange(l.priceToLogical(a.minValue()),l.priceToLogical(a.maxValue())):a}_createViews(){this._cache&&(this._cache.destroy(),this._cache=null),this._priceAxisViews=[];const e=["P","S1","R1","S2","R2","S3","R3","S4","R4","S5","R5"];this._paneViews.length=0,this._labelPaneViews=[];const t=new D(this._model,this);this._paneViews.push(t);for(let t=0;t<e.length;t++){const i=new m(this,{name:e[t]});this._priceAxisViews.push(i),this._labelPaneViews.push(new g.PanePriceAxisView(i,this,this._model))}this._dataWindowView||(this._dataWindowView=new f.StudyDataWindowView(this,this._model)),this._statusView||(this._statusView=new v.StudyStatusView(this)),this._legendView=null,this._pricesView=new w(this)}_postProcessGraphics(){}_getActualCacheParams(){const e=this.properties().childs(),t=e.levelsStyle.childs().colors.childs();return{font:d.CHART_FONT_FAMILY,fontSize:e.fontsize.value(),backColors:[t.P.value(),t["S1/R1"].value(),t["S1/R1"].value(),t["S2/R2"].value(),t["S2/R2"].value(),t["S3/R3"].value(),t["S3/R3"].value(),t["S4/R4"].value(),t["S4/R4"].value(),t["S5/R5"].value(),t["S5/R5"].value()]}}}var B=i(72077),R=i(85604),N=i(87989),O=i(21239),F=i(11542);class W extends n.Study{constructor(e,t,i,s){super(e,t,i,s)}base(){return 1}destroy(){super.destroy()}showOnTopOnHovering(){return!1}_titleInParts(e,t,i,s,r,n){const o=super._titleInParts(e,t,i,s,r),a=this._getVolumeUnit();return a&&!n&&(o[0]+=` · ${a}`),o}_skippedTitleInputs(){return super._skippedTitleInputs()}_getVolumeUnit(){const e=this.symbolSource().symbolInfo();return e?function(e){switch(e.volume_type){case"base":return e.base_currency||void 0;case"quote":return e.currency||void 0;case"tick":return F.t(null,void 0,i(24821))}}({...e,currency:e.original_currency_code||e.currency_code}):void 0}}var H=i(64147),z=i(12988),U=i(68805),j=i(76350),G=i(52270);class q extends n.Study{constructor(e,t,i,s){super(e,function(e){return e.hasChild("currencyId")||e.addChild("currencyId",new z.Property(null)),e.hasChild("unitId")||e.addChild("unitId",new z.Property(null)),e.addExcludedKey("currencyId",1),e.addExcludedKey("unitId",1),e}(t),i,s),this._isActingAsSymbolSource=new H.WatchedValue(!1),this._symbolHibernated=new H.WatchedValue(!1),this._symbolResolvingActive=new H.WatchedValue(!1),this._realignToolsLastParams=null,this._lastResolvedSymbolSource="",this._onIsActingAsSymbolSourceChanged=()=>{this._recreatePriceFormattingDependencies(),this._realignLineToolsIfParamsChanged()},this._recalculateIsActingAsSymbolSource(),this._isActingAsSymbolSource.subscribe(this._onIsActingAsSymbolSourceChanged);const r=this.properties().childs().inputs.childs().symbol;this._previousSymbolInputValue=r.value()}isActingAsSymbolSource(){return this._isActingAsSymbolSource.readonly()}properties(){return this._properties}symbol(){return this._isActingAsSymbolSource.value()?this.properties().childs().inputs.childs().symbol.value():this.symbolSource().symbol()}symbolChanged(){
return this._isActingAsSymbolSource.value()?this.properties().childs().inputs.childs().symbol.listeners():this.symbolSource().symbolChanged()}interval(){return this.model().mainSeries().interval()}style(){return this._firstSourceOrSeries().symbolSource().style()}currency(){return this._isActingAsSymbolSource.value()?this.properties().childs().currencyId.value()||null:this.symbolSource().currency()}unit(){return this._isActingAsSymbolSource.value()?this.properties().childs().unitId.value()||null:this.symbolSource().unit()}symbolParams(){return(0,j.symbolParams)(this)}compareSymbolParams(e){return(0,j.compareSymbolParams)(this,e,this._model.unitConversionEnabled())}setSymbolParams(e){this._setSymbolParamsInternal(e)}setSymbol(e){this.setSymbolParams({symbol:e})}symbolInfo(){var e;if(!this._isActingAsSymbolSource.value())return super.symbolSource().symbolInfo();const t=this._getSymbolForResolve(this.symbol());return null!==(e=this._resolvedSymbols[t])&&void 0!==e?e:null}symbolSource(){return this._isActingAsSymbolSource.value()?this:super.symbolSource()}symbolResolved(){return this.symbolsResolved()}symbolResolvingActive(){return this._symbolResolvingActive}symbolHibernated(){return this._symbolHibernated}isVisible(){const e=super.isVisible();return this._symbolHibernated.setValue(!e),e}symbolSameAsCurrent(e){return(0,j.symbolSameAsCurrent)(e,this.symbolInfo())}symbolSameAsResolved(e){return(0,G.symbolSameAsResolved)(e,this._lastResolvedSymbolSource,this.symbol())}setCurrency(e){this.setSymbolParams({currency:e})}isConvertedToOtherCurrency(){return(0,U.isConvertedToOtherCurrency)(this.symbolInfo())}setUnit(e){this.setSymbolParams({unit:e})}isConvertedToOtherUnit(){return(0,U.isConvertedToOtherUnit)(this.symbolInfo(),this._model.unitConversionEnabled())}setInterval(e){}setStyle(e){}symbolTitle(e,t,i){return this.title(e,!0,{},!1,t)}measureUnitId(){return(0,U.measureUnitId)(this.symbolInfo())}bars(){return super.data()}dataUpdated(){return this._dataUpdated}_onPropertiesChanged(){this._recalculateIsActingAsSymbolSource(),super._onPropertiesChanged(),this._realignLineToolsIfParamsChanged()}async _tryChangeInputs(){var e;const t=this._resolvedSymbolsByInput[this.symbol()]||null;(0,j.symbolSameAsCurrent)(this._previousSymbolInputValue,t)||this._setSymbolParamsInternal({currency:null,unit:null}),await super._tryChangeInputs(),this._formatter=null,this._defaultFormatter=null,null===(e=this.priceScale())||void 0===e||e.updateFormatter(),this._previousSymbolInputValue=this.properties().childs().inputs.childs().symbol.value()}_getSymbolObject(e){const t={symbol:e},i=this.currency();null!==i&&(t["currency-id"]=i);const s=this.unit();return this._model.unitConversionEnabled()&&null!==s&&(t["unit-id"]=s),t}_onSymbolResolved(e,t,i){super._onSymbolResolved(e,t,i),this._recreatePriceFormattingDependencies();const s=t===this.symbol()?(0,U.extractSymbolNameFromSymbolInfo)(i,this.symbol()):null;null!==s&&(this._previousSymbolInputValue=s);const r=(0,U.symbolCurrency)(i),n=(0,U.symbolUnit)(i,this._model.unitConversionEnabled())
;this._setSymbolParamsInternal({symbol:null!=s?s:void 0,currency:r,unit:n},i),this._symbolResolvingActive.setValue(!1)}_onSymbolResolvingStart(e,t){this._lastResolvedSymbolSource=t,super._onSymbolResolvingStart(e,t),this._symbolResolvingActive.setValue(!0)}_onSymbolError(){super._onSymbolError(),this._symbolResolvingActive.setValue(!1)}_onCurrencyMayChange(){this.isActingAsSymbolSource()?super._onCurrencyMayChange():this._onCurrencyChanged()}_recalculateIsActingAsSymbolSource(){var e,t;const i=null!==(t=""!==(null===(e=this._currencySourceSymbolInputProperty)||void 0===e?void 0:e.value()))&&void 0!==t&&t;this._isActingAsSymbolSource.setValue(i)}_setSymbolParamsInternal(e,t){const{symbol:i,currency:s,unit:r}=e,n=this.properties().childs(),o=n.inputs.childs().symbol.value(),a=n.currencyId.value(),l=n.unitId.value();if(void 0!==i&&n.inputs.childs().symbol.setValueSilently(i),void 0!==s&&n.currencyId.setValueSilently(s),void 0!==r&&n.unitId.setValueSilently(r),t)this._resolvedSymbolsByInput[this.symbol()]=t,this._resolvedSymbols[this._getSymbolForResolve(this.symbol())]=t,this._realignToolsLastParams=null;else{const e=this.symbolInfo();null!==e&&(n.currencyId.setValueSilently((0,U.symbolCurrency)(e)),n.unitId.setValueSilently((0,U.symbolUnit)(e,this._model.unitConversionEnabled())))}n.inputs.childs().symbol.value()!==o&&n.inputs.childs().symbol.listeners().fire(n.inputs.childs().symbol,""),n.currencyId.value()!==a&&n.currencyId.listeners().fire(n.currencyId,""),n.unitId.value()!==l&&n.unitId.listeners().fire(n.unitId,""),this._realignLineToolsIfParamsChanged()}_realignLineToolsIfParamsChanged(){let e=null===this._realignToolsLastParams;if(null!==this._realignToolsLastParams){const t=this.compareSymbolParams(this._realignToolsLastParams);e=t.symbolChanged||t.intervalChanged||t.currencyChanged||t.unitChanged}e&&(this._model.realignLineTools(this),this._realignToolsLastParams=this.symbolParams())}}class $ extends u.PriceAxisView{constructor(e,t){super(),this._source=e,this._styleId=t}_updateRendererData(e,t,i){var s;e.visible=!1;const r=this._source.priceScale(),n=this._source.properties().childs();if(!r||r.isEmpty()||!n.visible.value())return;const o=null===(s=this._source.properties().childs().graphics.childs().horizlines)||void 0===s?void 0:s.childs()[this._styleId].childs();if(!(o&&o.visible&&o.visible.value()&&this._isLabelVisibleAccordinglyToProperties()))return;const a=this._source.model().timeScale().logicalRange(),l=this._source.firstValue();if(null===l||null===a)return;const c={price:NaN,time:-1/0},h=this._source.graphics().horizlines().get(this._styleId);if(void 0===h)return;for(const e of h){if(void 0===e.level)continue;const t=a.contains(e.startIndex,!0);t===a.contains(e.endIndex,!0)&&0!==t||c.time<e.endIndex&&(c.time=e.endIndex,c.price=e.level)}if(isNaN(c.price))return;const d=(0,p.resetTransparency)(o.color.value());i.background=d,i.textColor=this.generateTextColor(d),i.coordinate=r.priceToCoordinate(c.price,l),e.text=r.formatPrice(c.price,l,{signPositive:r.isPercentage()}),e.visible=!0}
_isLabelVisibleAccordinglyToProperties(){return!!this._source.model().properties().childs().scalesProperties.childs().showStudyLastValue.value()&&this._source.properties().childs().showLabelsOnPriceScale.value()}}var K=i(78198);class Y extends n.Study{preferredZOrder(){return 0}async _createGraphicsPaneViews(){var e;const t=this.metaInfo().graphics,s=this.model(),r={regularPaneViews:[],forceOverlayPaneViews:[]},n=this._needExtendToBarsEnding();if(t.hhists){const{HHistPaneView:t}=await i.e(507).then(i.bind(i,56208)),o=null===(e=this.properties().childs().graphics.childs().polygons)||void 0===e?void 0:e.childs();r.regularPaneViews.push(new t(this,s,void 0,null==o?void 0:o.histBoxBg,n))}if(t.horizlines){const{HorizLinePaneView:e}=await i.e(507).then(i.bind(i,95258));r.regularPaneViews.push(new e(this,s,void 0,n))}return r}_createGraphicsPriceAxisViews(){var e;return Object.keys(null!==(e=this.metaInfo().graphics.horizlines)&&void 0!==e?e:{}).map((e=>new $(this,e)))}_createStudyPlotPaneView(e){return new K.StudyPlotPaneView(this,this._series,this._model,e,this._needExtendToBarsEnding())}_apiInputs(){return{...super._apiInputs(),mapRightBoundaryToBarStartTime:!!this._needExtendToBarsEnding()||void 0}}_needExtendToBarsEnding(){var e;return void 0!==(null===(e=this.metaInfo().defaults.inputs)||void 0===e?void 0:e.mapRightBoundaryToBarStartTime)}}class Z extends Y{priceRange(e,t,i){if(i.targetPriceScale!==this.priceScale())return null;let s=!1;this.graphics().hhists().forEach(((e,t)=>{var i;s=s||(0,o.ensureDefined)(null===(i=this.properties().childs().graphics.childs().hhists)||void 0===i?void 0:i.childs()[t]).value()}));const r=function(e,t,i,s){let r=null;return e.forEach(((e,s)=>{e.forEach((e=>{e.firstBarTime<=i&&e.lastBarTime>=t&&(null===r?r={low:{l:e.priceLow,h:e.priceHigh},high:{h:e.priceHigh}}:(e.priceLow<r.low.l&&(r.low.l=e.priceLow,r.low.h=e.priceHigh),r.high.h=Math.max(r.high.h,e.priceHigh)))}))})),null===r?null:s?new E.PriceRange(r.low.l-.8*(r.low.h-r.low.l),r.high.h):new E.PriceRange(r.low.l,r.high.h)}(this.graphics().hhists(),e,t,s);if(null===r)return null;const n=(0,o.ensureNotNull)(this.priceScale());return n.isLog()?new E.PriceRange(n.priceToLogical(r.minValue()),n.priceToLogical(r.maxValue())):r}}const X="study_Internal$STD;Fund_";function J(e){const t="study_"+(e.classId||e.shortId);return t.startsWith(X)?X:t}var Q=i(49822);function ee(e){return e instanceof n.Study}function te(e){return!1}function ie(e){return e instanceof O.StudyStub}function se(e){return!1}function re(e){return!1}function ne(e){return!1}function oe(e){return e instanceof B.study_Overlay}function ae(e){return oe(e)||e instanceof R.StudyCompare}function le(e,t,i,s,r,o){var a;const l=J(s),c=new((null===(a=(0,Q.getStudyInfoByName)(l))||void 0===a?void 0:a.studyConstructor)||n.Study)(e,t,i,s);return void 0!==r&&c.setId(r),c}function ce(e){const t=J(e),i=(0,Q.getStudyInfoByName)(t);return i?i.colorRotationMode:void 0===e.pine||r.StudyMetaInfo.isStandardPine(e.id)?1!==e.plots.length?"shift":"loop":null}function he(e,t){return e.id===t.id&&(s=t,
((i=e).pine?i.pine.version:void 0)===(s.pine?s.pine.version:void 0));var i,s}function de(e){const t=J(e),i=(0,Q.getStudyInfoByName)(t);if(i){const e=i.colorRotationComparator;if(void 0!==e)return e}return he}function ue(e){return(null!=e?e:[]).some((e=>e.confirm))}(0,Q.addStudyInfoToMap)("study_PivotPointsStandard",(0,Q.createStudyInfo)(V)),(0,Q.addStudyInfoToMap)("study_Overlay",(0,Q.createStudyInfo)(B.study_Overlay,"loop")),(0,Q.addStudyInfoToMap)("study_Compare",(0,Q.createStudyInfo)(R.StudyCompare,"loop")),(0,Q.addStudyInfoToMap)("study_Volume",(0,Q.createStudyInfo)(W)),(0,Q.addStudyInfoToMap)("study_VbPVisible",(0,Q.createStudyInfo)(class extends Z{alertCreationAvailable(){return new H.WatchedValue(!1).readonly()}_needExtendToBarsEnding(){return!1}})),(0,Q.addStudyInfoToMap)("study_ScriptWithDataOffset",(0,Q.createStudyInfo)(N.study_ScriptWithDataOffset)),s.enabled("moving_average_study_changable_currency_unit")&&(0,Q.addStudyInfoToMap)("study_Moving Average",(0,Q.createStudyInfo)(q));const pe=["Overlay@tv-basicstudies","CorrelationCoefficient@tv-basicstudies","Correlation Coeff@tv-basicstudies","Spread@tv-basicstudies","Ratio@tv-basicstudies"];function _e(e){return pe.includes(e.id)}},14878:(e,t,i)=>{"use strict";i.d(t,{StudyBaseWindowView:()=>n});var s=i(7576),r=i(19466);class n extends s.DataWindowView{constructor(e,t){super(),this._invalidated=!0,this._study=e,this._model=t,this._valueProvider=this._createValuesProvider(e,t),this._items=this._valueProvider.getItems().map((e=>new s.DataWindowItem(e.id,e.title,""))),this.update()}update(){this._invalidated=!0}items(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items}study(){return this._study}_updateImpl(){this._header=this._study.title(r.TitleDisplayTarget.DataWindow,!0),this._title=this._study.title(r.TitleDisplayTarget.DataWindow);const e=this._valueProvider.getValues(this._currentIndex());for(let t=0;t<e.length;++t){const i=e[t],s=this._items[t];s.setValue(i.value),s.setVisible(i.visible),s.setColor(i.color),s.setTitle(i.title)}}_currentIndex(){const e=this._model.crossHairSource().appliedIndex();return isNaN(e)?null:e}}},93567:(e,t,i)=>{"use strict";i.d(t,{StudyColorRotatorFactory:()=>h});var s=i(19625),r=i(24377),n=i(19063),o=i(72708)
;const a=["color-sky-blue-400","color-banana-yellow-700","color-deep-blue-500","color-grapes-purple-a700","color-iguana-green-500","color-minty-green-a600","color-ripe-red-a200","color-berry-pink-200","color-tv-blue-a100","color-tan-orange-a200","color-sky-blue-a400","color-deep-blue-a100","color-grapes-purple-400","color-iguana-green-a700","color-minty-green-200","color-ripe-red-200","color-berry-pink-a200","color-ripe-red-500","color-grapes-purple-500","color-deep-blue-400","color-tv-blue-a200","color-sky-blue-500","color-iguana-green-400","color-minty-green-400","color-banana-yellow-600","color-tan-orange-500","color-berry-pink-400","color-ripe-red-300","color-grapes-purple-300","color-deep-blue-300","color-tv-blue-300","color-sky-blue-300","color-iguana-green-300","color-minty-green-300","color-banana-yellow-400","color-tan-orange-300","color-berry-pink-300","color-tan-orange-a700"];class l{constructor(e){this._offset=0,this._offset=e}getColor(e){if(0===this._offset)return e;const t=a[(this._offset-1)%a.length],i=s.colorsPalette[t],o=(0,n.isHexColor)(e)?1:(0,r.parseRgba)(e)[3];return(0,n.generateColor)(i,(0,n.alphaToTransparency)(o))}}class c{constructor(e,t){this._offset=e,this._modelStartOffset=t}getColor(e){if((0,n.isHexColor)(e)){const t=(0,r.parseRgb)(e);return(0,r.rgbToHexString)((0,r.shiftRgb)(t,this._offset,this._modelStartOffset))}{const t=(0,r.parseRgba)(e);return(0,r.rgbaToString)((0,r.shiftRgba)(t,this._offset,this._modelStartOffset))}}}class h{constructor(e){this._chartModel=e}getColorRotator(e){const t=(0,o.studyColorRotationMode)(e);if(null===t)return null;const i=this._calcDefaultColorsOffset(e);switch(t){case"loop":return new l(i);case"shift":{const e=this._chartModel.getStudyShiftColorStartOffset();return new c(i,e)}}}_calcDefaultColorsOffset(e){let t=0;const i=(0,o.useSameColorRotationComparator)(e);return this._chartModel.dataSources().filter(o.isStudy).forEach((s=>{i(e,s.metaInfo())&&t++})),t}}},71838:(e,t,i)=>{"use strict";i.d(t,{StudyDataSource:()=>p});var s=i(50151),r=i(52033),n=i(64755),o=i(18172),a=i(3462),l=i(60107),c=i(26246),h=i(16685);const d=(0,i(31955).getLogger)("Chart.StudyDataSource");var u;!function(e){e[e.Idle=0]="Idle",e[e.AwaitingConnection=1]="AwaitingConnection",e[e.AwaitingParent=2]="AwaitingParent",e[e.AwaitingFirstDataUpdate=3]="AwaitingFirstDataUpdate",e[e.Active=4]="Active"}(u||(u={}));class p{constructor(e,t,i,s){this._inputs=null,this._status=u.Idle,this._studyId=null,this._turnaroundCounter=1,this._studyStatus={type:h.StudyStatusType.Undefined},this._studyStatusChanged=new r.Delegate,this._dataCleared=new r.Delegate,this._dataUpdated=new r.Delegate,this._boundOnGatewayIsConnectedChanged=this._onGatewayIsConnectedChanged.bind(this),this._ongoingDataUpdate=Promise.resolve(),this._gateway=e,this._metaInfo=s,this._seriesSource=t,this._turnaroundPrefix=i,this._plots=new n.PlotList((0,l.studyPlotFunctionMap)(s),l.studyEmptyPlotValuePredicate),this._gateway.isConnected().subscribe(this._boundOnGatewayIsConnectedChanged),this._graphics=new c.LiveStudyGraphics(s.graphics)}
destroy(){this.stop(),this._gateway.isConnected().unsubscribe(this._boundOnGatewayIsConnectedChanged),this._seriesSource.dataEvents().created().unsubscribeAll(this)}metaInfo(){return this._metaInfo}inputs(){return this._inputs}setInputs(e){this._inputs=e,null!==this._studyId&&(this._turnaroundCounter++,this._onStudyStatusChangedTo({type:h.StudyStatusType.Undefined}),this._gateway.modifyStudy(this._studyId,this._turnaround(),e,this._onMessage.bind(this)),this._status===u.Active&&this._changeStatusTo(u.AwaitingFirstDataUpdate))}isStarted(){return this._status!==u.Idle}isActive(){return this._status===u.Active}start(){this.isStarted()?d.logNormal("start: data source is already started, nothing to do"):((0,s.assert)(null!==this._inputs,"Inputs should be defined when starting a study data source"),this._gateway.isConnected().value()?this._createStudy():this._changeStatusTo(u.AwaitingConnection))}stop(){this.isStarted()?(null!==this._studyId&&(this._gateway.removeStudy(this._studyId),this._studyId=null,this._onStudyStatusChangedTo({type:h.StudyStatusType.Undefined})),this._changeStatusTo(u.Idle)):d.logNormal("stop: data source is already stopped, nothing to do")}studyId(){return this._studyId}studyStatus(){return this._studyStatus}studyStatusChanged(){return this._studyStatusChanged}plots(){return this._plots}graphics(){return this._graphics}clearData(){this._plots.clear(),this._graphics.clear(),this._dataCleared.fire()}stopAndStealData(){(0,s.assert)(this._status===u.Active,"Couldn't steal data from non-active data source"),this.stop();const e=this._plots,t=this._graphics.extract();return this._plots=new n.PlotList((0,l.studyPlotFunctionMap)(this._metaInfo),l.studyEmptyPlotValuePredicate),{plots:e,graphics:t}}dataCleared(){return this._dataCleared}dataUpdated(){return this._dataUpdated}moveData(e){this._ongoingDataUpdate=this._ongoingDataUpdate.then((()=>{this._plots.move(e)}))}pendingUpdatesReady(){return this._ongoingDataUpdate}_createStudyError(e){return{type:h.StudyStatusType.Error,errorDescription:this._getStudyErrorDescription(e)}}_getStudyErrorDescription(e){return"string"==typeof e?{error:e.split(":",2)[0]}:e}_changeStatusTo(e){(0,s.assert)(this._status!==e,"Source and destination status should be distinct"),d.logNormal(`Status changed from ${u[this._status]} to ${u[e]}`),this._status=e}_createStudy(){const e=this._seriesSource.instanceId();null!==e?this._createStudyUsingParentId(e):(this._changeStatusTo(u.AwaitingParent),this._seriesSource.dataEvents().created().subscribe(this,this._onSeriesCreated,!0))}_createStudyUsingParentId(e){(0,s.assert)(this._status!==u.Active,'Status should not be "Active" when creating a study'),(0,s.assert)(this._studyStatus.type===h.StudyStatusType.Undefined,'Study status should be "Undefined" when creating a study'),(0,s.assert)(null===this._studyId,"Study id should be empty when creating a study"),this._studyId=(0,a.makeNextStudyId)(),this._gateway.createStudy(this._studyId,this._turnaround(),e,this._metaInfo.fullId+("tv-basicstudies"===this._metaInfo.packageId?"":"!"),(0,
s.ensureNotNull)(this._inputs),this._onMessage.bind(this),{id:this._metaInfo.id}),this._changeStatusTo(u.AwaitingFirstDataUpdate)}_onGatewayIsConnectedChanged(e){e?this._onGatewayConnected():this._onGatewayDisconnected()}_onGatewayConnected(){this._status===u.AwaitingConnection&&this._createStudy()}_onGatewayDisconnected(){this._status!==u.Idle&&this._status!==u.AwaitingConnection&&(this._studyId=null,this._changeStatusTo(u.AwaitingConnection),this._studyStatus.type!==h.StudyStatusType.Undefined&&this._onStudyStatusChangedTo({type:h.StudyStatusType.Undefined})),this._turnaroundCounter=1}_onSeriesCreated(){this._status===u.AwaitingParent&&this._createStudyUsingParentId((0,s.ensure)(this._seriesSource.instanceId()))}_onStudyStatusChangedTo(e){const t=this._studyStatus;this._studyStatus=e,d.logNormal(`Study status type changed from ${h.StudyStatusType[t.type]} to ${h.StudyStatusType[e.type]}`),this._studyStatusChanged.fire(t,e)}_onMessage(e){if("data_update"===e.method){const{customId:t,turnaround:i,plots:r,nonseries:n}=e.params;t===this._studyId&&this._checkTurnaround(i)&&this._onDataUpdate(r,(0,s.ensureDefined)(n))}else if("study_loading"===e.method){const[t,i,s]=e.params;t===this._studyId&&this._checkTurnaround(i)&&this._onStudyLoading(s)}else if("study_completed"===e.method){const[t,i,s]=e.params;t===this._studyId&&this._checkTurnaround(i)&&this._onStudyCompleted(s)}else if("study_error"===e.method){const[t,i,s,r,n]=e.params;t===this._studyId&&this._checkTurnaround(i)&&this._onStudyError(s,r,n)}else"clear_data"===e.method&&this._checkTurnaround(e.params.turnaround)&&this.clearData()}_onDataUpdate(e,t){const i=(0,o.unpackNonSeriesData)(t.d);return this._ongoingDataUpdate=this._ongoingDataUpdate.then((()=>i),(()=>i)).then(this._onDataUnpacked.bind(this,e,t.indexes)),this._ongoingDataUpdate}_onDataUnpacked(e,t,i){this._status!==u.Idle&&(this._status===u.AwaitingFirstDataUpdate&&(this._changeStatusTo(u.Active),this.clearData()),this._mergePlots(e),null!==i&&(i.indexes_replace?((0,s.assert)("nochange"!==t),this._graphics.replaceIndexesTo(t)):("nochange"!==t&&this._graphics.replaceIndexesTo(t),void 0!==i.graphicsCmds&&this._graphics.processCommands(i.graphicsCmds))),this._dataUpdated.fire(e,i,t))}_onStudyLoading(e){this._onStudyStatusChangedTo({type:h.StudyStatusType.Loading,startTime:Date.now()})}_onStudyError(e,t,i){this.clearData(),this._onStudyStatusChangedTo(this._createStudyError(e))}_onStudyCompleted(e){this._onStudyStatusChangedTo({type:h.StudyStatusType.Completed})}_mergePlots(e){this._plots.merge(e)}_turnaround(){return`${this._turnaroundPrefix}${this._turnaroundCounter}`}_checkTurnaround(e){const t=this._turnaround();return e===t||e===this._seriesSource.turnaround()||e===`${this._seriesSource.turnaround()}_${t}`}}},22839:(e,t,i)=>{"use strict";i.d(t,{StudyDataWindowView:()=>a});var s=i(14878),r=i(22739),n=i(7015);class o{constructor(e,t){this._study=e,this._model=t,this._hhistBasedStudy=void 0!==e.metaInfo().graphics.hhists,this._valuesProvider=this._createValuesProvider(e,t)}getItems(){
return this._valuesProvider.getItems()}getValues(e){const t=this._valuesProvider.getValues(e),i=e=>!!this._hhistBasedStudy||this._study.isPlotVisibleAt(e,2);for(const e of t)e.visible=e.visible&&i(e.id);return t}_createValuesProvider(e,t){return this._hhistBasedStudy?new n.HHistBasedValuesProvider(e,t):new r.StudyValuesProvider(e,t)}}class a extends s.StudyBaseWindowView{_createValuesProvider(e,t){return new o(e,t)}}},60107:(e,t,i)=>{"use strict";function s(e){const t=new Map;return e.plots.forEach(((e,i)=>{t.set(e.id,(e=>e[i+1]))})),t}function r(e,t){return null==e[t]}i.d(t,{studyEmptyPlotValuePredicate:()=>r,studyPlotFunctionMap:()=>s})},65383:(e,t,i)=>{"use strict";i.d(t,{ChartColorDependentStudyInputNames:()=>_,InputDisplayFlags:()=>r,RangeDependentStudyInputNames:()=>p,areStudyInputsEqual:()=>m,editableStudyInputs:()=>f,getInputValue:()=>l,isExtendedInput:()=>o,isExtendedInputSource:()=>a,isStudyInputDependsOnChartColors:()=>v,isStudyInputOptionsInfo:()=>c,isTimeOrPriceNotHiddenInput:()=>g});var s,r,n=i(98279);function o(e){return(0,n.default)(e)}function a(e){return"source"===e.t}function l(e){return o(e)?e.v:e}!function(e){e.Integer="integer",e.Float="float",e.Price="price",e.Bool="bool",e.Text="text",e.Symbol="symbol",e.Session="session",e.Source="source",e.Resolution="resolution",e.Time="time",e.BarTime="bar_time",e.Color="color",e.Textarea="text_area"}(s||(s={})),function(e){e[e.None=0]="None",e[e.DataWindow=2]="DataWindow",e[e.StatusLine=8]="StatusLine",e[e.All=15]="All"}(r||(r={}));function c(e){return["text","integer","float","price","session","resolution"].includes(e.type)&&e.hasOwnProperty("options")}var h,d,u,p,_;function m(e,t,i){for(const s of e)if(t[s.id]!==i[s.id])return!1;return!0}function g(e){return("time"===e.type||"price"===e.type)&&!0!==e.isHidden}function f(e){return[]}function v(e){return Object.values(_).map((e=>e)).includes(e.id)}!function(e){e.InitialCapital="initial_capital",e.Currency="currency",e.DefaultQTYValue="default_qty_value",e.DefaultQTYType="default_qty_type",e.Pyramiding="pyramiding",e.ComissionValue="commission_value",e.ComissionType="commission_type",e.BacktestFillLimitsAssumtion="backtest_fill_limits_assumption",e.Slippage="slippage",e.CalcOnOrderFills="calc_on_order_fills",e.CalcOnEveryTick="calc_on_every_tick",e.MarginLong="margin_long",e.MarginShort="margin_short",e.UseBarMagnifier="use_bar_magnifier",e.ProcessOrdersOnClose="process_orders_on_close",e.FillOrdersOnStandardOHLC="fill_orders_on_standard_ohlc"}(h||(h={})),function(e){e.Fixed="fixed",e.CashPerOrder="cash_per_order",e.PercentOfEquity="percent_of_equity"}(d||(d={})),function(e){e.Percent="percent",e.CashPerContract="cash_per_contract",e.CashPerOrder="cash_per_order"}(u||(u={})),function(e){e.FirstBar="first_visible_bar_time",e.LastBar="last_visible_bar_time",e.Realtime="subscribeRealtime"}(p||(p={})),function(e){e.FgColor="__chart_fgcolor",e.BgColor="__chart_bgcolor"}(_||(_={}))},72396:(e,t,i)=>{"use strict";i.d(t,{StudyInserter:()=>p})
;var s=i(27147),r=i(68159),n=i(37265),o=i(16638),a=i(35039),l=i(66831),c=i(31955),h=i(678);const d=(0,c.getLogger)("Chart.Studies.StudyInserter"),u=/^PUB;.*/;class p{constructor(e,t){this._parentSources=[],this._propsState=void 0,this._preferredPriceScale=void 0,this._allowChangeCurrency=!1,this._allowChangeUnit=!1,this._paneSize=void 0,this._forceOverlay=!1,this._inserterImpl=t,this._studyDescriptor=e}setParentSources(e){this._parentSources=e}setPaneSize(e){this._paneSize=e}setPreferredPriceScale(e){this._preferredPriceScale=e}setAllowChangeCurrency(e){this._allowChangeCurrency=e}setAllowChangeUnit(e){this._allowChangeUnit=e}setForceOverlay(e){this._forceOverlay=e}setPropertiesState(e){this._propsState=e}setTargetPriceScaleMode(e){this._targetPriceScaleMode=e}async insert(e,t,i){var c,p;let _=null;var m;i||(_=void 0!==(m=this._inserterImpl).createStub&&void 0!==m.removeStub?this._inserterImpl.createStub():null);const g=e=>{if(i){const t=(0,s.default)(e)?{error:e}:{error:e.message,editorError:e};i.setStatus({type:h.StudyStatusType.Error,errorDescription:t}),this._inserterImpl.storeFailedStub(i)}};let f,v=!0;try{f=await(0,o.studyMetaInfoRepository)().findById(this._studyDescriptor)}catch(e){d.logWarn(`Cannot get study ${JSON.stringify(this._studyDescriptor)}`);const t=this._studyDescriptor.pineId,i=u.test(t),s=!!(null===(c=null==e?void 0:e.errors)||void 0===c?void 0:c.length);return g(s?{id:t,...e.errors[0]}:"Error: cannot compile script"),i&&s?Promise.reject(l.InsertionErrorCode.CannotCompilePub):Promise.reject(l.InsertionErrorCode.CannotGetMetainfo)}finally{null!==_&&(v=this._inserterImpl.removeStub(_))}if(!v)return Promise.reject(l.InsertionErrorCode.StubWasRemoved);if(void 0!==t&&t.cancelled)return Promise.reject(l.InsertionErrorCode.Cancelled);if(!this._canApplyStudyToParent(f))return g("Error: cannot be child"),Promise.reject(l.InsertionErrorCode.StudyCannotBeChild);const y={...f.defaults.inputs};let S={};if(void 0!==e){const t=r.StudyMetaInfo.getStudyPropertyRootName(f),i=(0,n.clone)((0,a.defaults)(t));(0,n.merge)(y,i.inputs);const s=await e(y,f.inputs,f);S=s.inputs,this._parentSources=null!==(p=s.parentSources)&&void 0!==p?p:[]}if(void 0!==t&&t.cancelled)return Promise.reject(l.InsertionErrorCode.Cancelled);const b=this._insertStudy(f,S,i);return null===b?(g("Error: unknown error"),Promise.reject(l.InsertionErrorCode.Unknown)):(await b.startPromise,b.study)}_insertStudy(e,t,i){return this._inserterImpl.createStudy(e,t,null,i,this._propsState,this._forceOverlay,this._parentSources,this._preferredPriceScale,this._allowChangeCurrency,this._allowChangeUnit,this._paneSize,this._targetPriceScaleMode)}_canApplyStudyToParent(e){return 0===this._parentSources.length||r.StudyMetaInfo.canBeChild(e)}}},16638:(e,t,i)=>{"use strict";i.d(t,{isStudyDescriptor:()=>u,studyMetaInfoRepository:()=>g});var s=i(95171),r=i(11542),n=i(50151),o=i(68159),a=i(72530),l=i(1640),c=i(79303),h=i(31955),d=i(14426);(0,h.getLogger)("Chart.Studies.StudyMetaInfoRepository",{color:"#606"});function u(e){
return"object"==typeof e&&null!==e&&"type"in e&&("java"===e.type&&"studyId"in e||"pine"===e.type&&"pineId"in e)}class p{constructor(e){this._isReady=!1,this._studyVersioning=null,this._rawStudiesMetaInfo=[],this._rawStudiesMetaInfoDeferredPromise=null,this._javaStudiesMetaInfo=[],this._pineMetaInfoCache=[],this._studiesMigrations=[],this._chartApi=e}async requestMetaInfo(){if(null===this._rawStudiesMetaInfoDeferredPromise){this._rawStudiesMetaInfoDeferredPromise=(0,d.createDeferredPromise)();const e=(await this._chartApi.requestMetadata()).params[1].metainfo.slice();this._processLibraryMetaInfo(e),this._studyVersioning=new c.StudyVersioning(this._javaStudiesMetaInfo,this._studiesMigrations),this._requestFinished(),this._rawStudiesMetaInfoDeferredPromise.resolve(this._rawStudiesMetaInfo)}return this._rawStudiesMetaInfoDeferredPromise.promise}async findById(e){this._isReady||await this.requestMetaInfo();const t=this._findStudyMetaInfo(e);return null!==t?Promise.resolve(t):"pine"===e.type?this._compilePine(e):Promise.reject(`unexpected study id=${e.studyId} with type=${e.type}`)}findByIdSync(e){return this._findStudyMetaInfo(e)}isReady(){return this._isReady}async findAllJavaStudies(){return this._isReady||await this.requestMetaInfo(),this._javaStudiesMetaInfo}studyVersioning(){return(0,n.ensureNotNull)(this._studyVersioning)}getInternalMetaInfoArray(){return this._javaStudiesMetaInfo}addPineMetaInfo(e){return m(this._pineMetaInfoCache,e)}async getLatestMetaInfoForPineStudy(e,t){return null}_processMigrations(e){throw new Error("not implemented")}_processSiteMetaInfo(e,t){throw new Error("not implemented")}_processLibraryMetaInfo(e){for(const t of e)_(t),m(this._javaStudiesMetaInfo,t);this._javaStudiesMetaInfo=this._javaStudiesMetaInfo.sort(((e,t)=>{const i=e.description_localized||e.description,s=t.description_localized||t.description;return i>s?1:i<s?-1:0})),o.StudyMetaInfo.overrideDefaults(this._javaStudiesMetaInfo)}_requestFinished(){this._isReady=!0}_findStudyMetaInfo(e){return"java"===e.type?((0,n.assert)(0!==this._javaStudiesMetaInfo.length,"Java studies metainfo should be define here"),this._javaStudiesMetaInfo.find((t=>t.id===e.studyId))||null):this._pineMetaInfoCache.find((t=>t.scriptIdPart===e.pineId&&(void 0===e.pineVersion||(0,n.ensureDefined)(t.pine).version===e.pineVersion)))||null}_compilePine(e){throw new Error("unsupported")}}function _(e){e.description_localized=r.t(e.description,{context:"study"},i(83477))}function m(e,t){const i=new o.StudyMetaInfo(t).state();(0,a.migrateMetaInfoAndPropState)(i);const s=new o.StudyMetaInfo(i);let r=!0;const n=e.findIndex((e=>e.id===s.id));if(-1===n)e.push(s);else{const t=e[n],i=void 0!==t.pine?l.Version.parse(t.pine.version):null,o=void 0!==s.pine?l.Version.parse(s.pine.version):null;null===o||null===i||o.isGreaterOrEqual(i)?(t.removeDefaults(),e[n]=s):r=!1}return r&&s.createDefaults(),s}const g=(0,s.default)((()=>new p(window.ChartApiInstance)))},70294:(e,t,i)=>{"use strict";i.d(t,{StudyStatusProviderBase:()=>l});var s=i(27538),r=i(678),n=i(19466);const o={
NONE:"Default"},a=!1;class l extends s.StatusProviderBase{constructor(e){super(),this._source=e}getSplitTitle(){return this._source.titleInParts(n.TitleDisplayTarget.StatusLine,!0,o,void 0,a)}text(){return this._source.isActualInterval()?this._source.isFailed()?`${this._source.title(n.TitleDisplayTarget.StatusLine,!0,o,void 0,a)}: ${this.sourceStatusText()}`:`${this._source.title(n.TitleDisplayTarget.StatusLine,!0,o,void 0,a)} ${this.sourceStatusText()}`:this._source.title(n.TitleDisplayTarget.StatusLine,!0,o,void 0,a)}sourceStatusText(){return(0,r.convertStudyStatusToString)(this._source.status(),!0)}errorStatus(){if(!this._source.isActualInterval()||this._source.isSymbolInvalid())return null;const e=this._source.status();return e.type===r.StudyStatusType.Error?{error:this.sourceStatusText(),solutionId:(0,r.studyStatusSolutionId)(e),title:(0,r.studyStatusTitle)(e),studyFeature:(0,r.studyStatusFeature)(e),stackTrace:(0,r.studyErrorStatusStackTrace)(e.errorDescription.stack_trace),editorError:e.errorDescription.editorError}:null}}},44158:(e,t,i)=>{"use strict";i.d(t,{StudyStatusProvider:()=>n});var s=i(11542),r=(i(678),i(70294));s.t(null,void 0,i(24077));class n extends r.StudyStatusProviderBase{sourceStatusText(){this._source.status();return super.sourceStatusText()}}},49936:(e,t,i)=>{"use strict";i.d(t,{StudyStatusView:()=>r});var s=i(27777);class r extends s.StatusView{constructor(e){super(e.statusProvider())}getSplitTitle(){return this._statusProvider.getSplitTitle()}update(){this._text=this._statusProvider.text()}}},678:(e,t,i)=>{"use strict";i.d(t,{StudyStatusType:()=>c,convertStudyStatusToString:()=>h,studyErrorStatusStackTrace:()=>_,studyStatusFeature:()=>p,studyStatusSolutionId:()=>d,studyStatusTitle:()=>u});var s=i(11542),r=i(82236);const n=s.t(null,void 0,i(50910));const o=new Map,a=new Map,l=s.t(null,void 0,i(62011));var c;function h(e,t){if(e.type===c.Loading)return t?l:"loading...";if(e.type===c.Error){const i=e.errorDescription,s=t?(0,r.triesTranslateError)(i.error):i.error;if(i.ctx){const e={};return Object.entries(i.ctx).forEach((([t,i])=>{e[t]=i.toString()})),s.format(e)}return s}return""}function d(e){if(e.type===c.Error)return e.errorDescription.solution_id?e.errorDescription.solution_id:function(e){for(const t of Array.from(o.keys()))if(e.includes(t))return o.get(t)}(e.errorDescription.error)}function u(e){var t;if(e.type===c.Error)return function(e){const t=e.toLowerCase();return t.includes("the data vendor doesn't provide volume data for this symbol.")||t.includes("no volume is provided by the data vendor")}(e.errorDescription.error)?n:(0,r.triesTranslateError)(null!==(t=e.errorDescription.title)&&void 0!==t?t:"Runtime error")}function p(e){const{errorDescription:{error:t}}=e;for(const[e,i]of a)if(t.startsWith(e))return i}function _(e){if(void 0===e)return;const t=[];for(const i of e){const e={functionOrScopeName:i.n,lineNumber:i.p};"id"in i&&(e.id=i.id),"v"in i&&(e.versionScript=i.v),t.push(e)}return t}!function(e){e[e.Undefined=0]="Undefined",e[e.Loading=1]="Loading",
e[e.Completed=2]="Completed",e[e.Error=3]="Error"}(c||(c={}))},21239:(e,t,i)=>{"use strict";i.d(t,{StudyStub:()=>S});var s=i(16230),r=i(50151),n=i(64147),o=(i(88960),i(62288)),a=i(49936),l=i(45579),c=i(725),h=i(52033),d=i(12988),u=i(70294),p=i(19466);class _ extends u.StudyStatusProviderBase{text(){return this._source.isActualInterval()?`${this._source.title(p.TitleDisplayTarget.StatusLine)} ${this.sourceStatusText()}`:this._source.title(p.TitleDisplayTarget.StatusLine)}}var m=i(678),g=i(36915),f=i(16638);class v{getItems(){return[]}getValues(e){return[]}}const y=new h.Delegate;class S extends l.PriceDataSource{constructor(e,t,i,s,r=null){super(e),this._priceStep=.01,this._origState=null,this._descriptor=null,this._status={type:m.StudyStatusType.Undefined},this._statusChanged=new h.Delegate,this._descriptorChanged=new h.Delegate,this._formatter=new c.PriceFormatter({priceScale:100}),this._showPineVersionInStatusLine=new n.WatchedValue(!1).spawn(),this._pineSourceCodeModel=null,(0,f.isStudyDescriptor)(t)?this._descriptor=t:this._origState=t,this._title=i,this._alwaysShowInLegend=s,this._studyMetaInfo=r;this._properties=new d.Property({visible:!0}),this._statusView=new a.StudyStatusView(this)}destroy(){var e,t,i;null===(t=null===(e=this._pineSourceCodeModel)||void 0===e?void 0:e.get())||void 0===t||t.destroy(),null===(i=this._pineSourceCodeModel)||void 0===i||i.destroy(),this._showPineVersionInStatusLine.destroy(),super.destroy()}barColorer(){return null}properties(){return this._properties}statusView(){return this._statusView}legendView(){return null}state(e){return this._origState}getDescriptor(){return null===this._descriptor?null:{descriptor:this._descriptor,title:this._title,isOverlay:Boolean(this._alwaysShowInLegend),id:this.id(),status:this._status}}updateDescriptor(e){(0,s.default)(this._descriptor,e)||(this._descriptor=e,this._descriptorChanged.fire())}onDescriptorChanged(){return this._descriptorChanged}metaInfo(){return this._studyMetaInfo}setStatus(e){const t=this.isDisplayedInLegend();if(this._status=e,this._statusChanged.fire(),this.isDisplayedInLegend()!==t){const e=this._model.paneForSource(this);if(e){const t=this._model.panes().indexOf(e),i=o.InvalidationMask.invalidateLegendWidgetLayout(t);this.model().invalidate(i)}}}formatter(){return this._formatter}name(){return this._title}title(){return this.titleInParts().join(" ")}titleInParts(){var e;const t=[this._title];return this._showPineVersionInStatusLine.value()&&t.push((0,r.ensureDefined)(null===(e=this._studyMetaInfo)||void 0===e?void 0:e.pine).version),t}isFailed(){return this._status.type===m.StudyStatusType.Error}isLoading(){return this._status.type===m.StudyStatusType.Loading}isDisplayedInLegend(){return this._alwaysShowInLegend||this.isFailed()}setFailed(e){this.setStatus({type:m.StudyStatusType.Error,errorDescription:{error:e}}),this._model.updateSource(this)}isSymbolInvalid(){return!1}isActualInterval(){return!0}onIsActualIntervalChange(){return y}start(){}status(){return this._status}onStatusChanged(){return this._statusChanged}
firstValue(){return null}currency(){return null}sessionId(){return this._model.mainSeries().sessionId()}sessionIdChanged(){return this._model.mainSeries().sessionIdChanged()}unit(){return null}symbolSource(){return this._model.mainSeries()}barsProvider(){return this._model.mainSeries()}legendValuesProvider(){return new v}statusProvider(e){return new _(this)}isRemovedByStudyTemplates(){return null!==this._origState&&(0,g.isStudyState)(this._origState)}pineSourceCodeModel(){return Promise.resolve(null)}}},22739:(e,t,i)=>{"use strict";i.d(t,{StudyValuesProvider:()=>y});var s=i(50335),r=i(49483),n=i(19063),o=i(56570),a=i(8025),l=i(15764),c=i(928),h=i(94113),d=i(83085),u=i(41991),p=i(50151),_=i(82587),m=i(19466);const g=r.CheckMobile.any(),f=o.enabled("hide_last_na_study_output"),v=o.enabled("always_show_legend_values_on_mobile");class y{constructor(e,t,i){this._emptyValues=[],this._colorProviders=new Map,this._study=e,this._model=t,this._studyMetaInfo=this._study.metaInfo(),this._studyProperties=this._study.properties().childs(),this._isFundamental=!1;const s=this._studyMetaInfo.plots;s&&s.forEach(((e,t)=>{if((0,h.isPlotWithTechnicalValues)(e))return;const s=e.id;this._emptyValues.push(function(e,t="",i=""){return{id:t,index:e,title:i,value:"",visible:!1}}(t,s,i?"":this._study.guiPlotName(m.TitleDisplayTarget.StatusLine,s)));const r=(0,h.isOhlcPlot)(e)?e.target:s;this._colorProviders.set(r,(0,d.createStudyPlotColorProvider)(this._studyMetaInfo,this._study.properties(),r))}))}getItems(){return this._emptyValues}getPlotColor(e,t){var i;const r=t[e+1];if(!(0,s.isNumber)(r))return"";const n=r>0;let o;const a=this._studyMetaInfo.plots[e];let l=a.id;const c=this._studyProperties;if((0,h.isOhlcPlot)(a))l=a.target||l,o=(0,p.ensureDefined)(c.ohlcPlots.childs()[l].childs().color).value();else if((0,h.isArrowsPlot)(a)){const e=(0,p.ensureDefined)(c.styles.childs()[l]);o=n?e.childs().colorup.value():e.childs().colordown.value()}else o=(0,p.ensureDefined)(null===(i=c.styles.childs()[l])||void 0===i?void 0:i.child("color")).value();let d=o;const u=this._colorProviders.get(l),_=u&&u.getPlotPointStyle(t);return _&&((0,h.isArrowsPlot)(a)?(n&&void 0!==_.colors[5]&&(d=_.colors[5]),n||void 0===_.colors[6]||(d=_.colors[6])):void 0!==_.colors[0]&&(d=_.colors[0])),"transparent"===d&&(d=o),d}getValues(e){var t,i;const r=this._emptyValues.map((e=>({...e})));let o=null;const l=this._study.data().lastIndex(),c=this._studyProperties;if(null!==l)for(const e of r){if(0===(null===(t=c.styles.childs()[e.id])||void 0===t?void 0:t.childs().display.value()))continue;const i=this._study.nearestIndex(l,a.PlotRowSearchMode.NearestLeft,e.index+1);if(void 0===i)continue;const s=i+this._study.offset(e.id);o=null!==o?Math.max(s,o):s}(null===e||null!==o&&e>o)&&(e=o);const d=this._hideValues(),m=this._study.isVisible()&&!d?_.notAvailable:"";for(const e of r)e.value=m;if(d)return r;f&&r.length&&(r[r.length-1].value="");const g=this._study.priceScale();if(!this._study.isVisible()||null===e||null===g||g.isEmpty()||this._model.timeScale().isEmpty())return r;const v={}
;for(const t of r){const r=t.id,o=(0,u.getPriceValueFormatterForStudy)(this._study,r),d=(0,p.ensureDefined)(c.styles.childs()[r]),_=d.childs().display.value();if(t.visible=0!==_,!t.visible)continue;const m=d.hasChild("plottype")?null===(i=d.child("plottype"))||void 0===i?void 0:i.value():null,g=this._isFundamental&&(m===h.LineStudyPlotStyle.StepLine||m===h.LineStudyPlotStyle.StepLineWithDiamonds),f=t.index,y=e-this._study.offset(r),S=g||null!==l&&y>l?a.PlotRowSearchMode.NearestLeft:a.PlotRowSearchMode.Exact,b=this._study.nearestIndex(y,S);if(void 0===b)continue;let w=v[r];if(void 0===w&&(w=this._study.getMinFirstBarIndexForPlot(r),Number.isFinite(w)&&(v[r]=w)),w>b)continue;const C=this._study.data().last(),P=this._study.data().valueAt(b)||(null!==C?C.value:null);if(null===P)continue;const x=P[f+1];(0,s.isNumber)(x)&&(t.value=o(x),t.color=(0,n.resetTransparency)(this.getPlotColor(f,P)))}return r}_hideValues(){return v?(0,l.isLineToolName)(c.tool.value())||null!==this._model.lineBeingEdited():g&&(null===this._model.crossHairSource().pane||(0,l.isLineToolName)(c.tool.value())||null!==this._model.lineBeingEdited())}}},85604:(e,t,i)=>{"use strict";i.d(t,{StudyCompare:()=>W});var s=i(50151),r=i(50788),n=i(67317),o=i(68805),a=i(12988),l=i(73698),c=i(56570),h=i(94164),d=i(98558),u=i(49256),p=i(19063);const _=c.enabled("force_exchange_as_title");class m extends d.PriceAxisView{constructor(e,t){super(),this._studyCompare=e,this._data=t}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const r=this._studyCompare.priceScale(),n=this._studyCompare.lastValueData(this._data.plotIndex,!1);if(n.noData||null===r||r.isEmpty())return;const o=this._studyCompare.model(),a=o.timeScale().visibleBarsStrictRange(),l=o.mainSeries().bars().lastIndex();if(null===a||null===l)return;if(l<=a.lastBar())i.background=(0,p.resetTransparency)(n.color),i.textColor=this.generateTextColor(i.background),i.borderColor=void 0,e.borderVisible=!1,t.borderVisible=!1;else{const r=o.backgroundColorAtYPercentFromTop(n.coordinate/(0,s.ensureNotNull)(o.paneForSource(this._studyCompare)).height());i.background=r,i.textColor=(0,p.resetTransparency)(n.color),i.borderColor=i.textColor,e.borderVisible=!0,t.borderVisible=!0}i.coordinate=n.coordinate,i.floatCoordinate=n.floatCoordinate;const c=o.properties().childs().scalesProperties.childs();c.showSeriesLastValue.value()&&(e.text=(0,u.getCurrentModePriceText)(r,n),c.seriesLastValueMode.value()!==h.PriceAxisLastValueMode.LastPriceAndPercentageValue?e.secondLine="":e.secondLine=(0,u.getOppositeModePriceText)(r,n),e.visible=!0),t.text="",c.showSymbolLabels.value()&&(t.text=this._paneText(),t.visible=t.text.length>0)}_paneText(){let e="";const t=this._studyCompare.symbolInfo();return _?e=(0,o.displayedSymbolExchange)(t):this._studyCompare.model().properties().childs().scalesProperties.childs().showSymbolLabels.value()&&(e=(0,o.displayedSymbolName)(t)),e}}i(11542);var g=i(22839),f=i(22739),v=i(928),y=i(49483),S=i(15764),b=i(37265),w=i(19466);const C=y.CheckMobile.any();class P extends f.StudyValuesProvider{constructor(e,t){
super(e,t),this._emptyValues[0].title=e.guiPlotName(w.TitleDisplayTarget.StatusLine,"")}getValues(e){return(0,b.isNumber)(e)||(this._showLastPriceAndChangeOnly()?e=this._study.data().lastIndex():(e=this._model.crossHairSource().appliedIndex(),(0,b.isNumber)(e)||(e=this._study.data().lastIndex()))),super.getValues(e)}_hideValues(){return!1}_showLastPriceAndChangeOnly(){return C&&(null===this._model.crossHairSource().pane||(0,S.isLineToolName)(v.tool.value())||null!==this._model.lineBeingEdited())}}class x extends g.StudyDataWindowView{constructor(e,t){super(e,t),this._studyCompare=e}_hideValues(){return!1}_createValuesProvider(e,t){return new P(e,t)}}class T extends x{constructor(e,t){super(e,t),this._additional=null,this._showSeriesOHLC=t.properties().childs().paneProperties.childs().legendProperties.childs().showSeriesOHLC,this._showSeriesOHLC.subscribe(this,this.update)}areValuesVisible(){return this._showSeriesOHLC.value()}destroy(){this._showSeriesOHLC.unsubscribeAll(this)}additional(){return this._additional}_updateImpl(){super._updateImpl()}}var I=i(49936),M=i(24526),A=i(44158);class L extends A.StudyStatusProvider{getSplitTitle(){return this._source.titleInParts(w.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)}text(){return this._source.isActualInterval()?this._source.isFailed()?`${this._source.title(w.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)}: ${this.sourceStatusText()}`:`${this._source.title(w.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)} ${this.sourceStatusText()}`:this._source.title(w.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)}}var k=i(76350),D=i(52270),E=i(64147);const V=c.enabled("study_overlay_compare_legend_option"),B=c.enabled("force_exchange_as_title"),R=!c.enabled("hide_study_compare_legend_item"),N=c.enabled("hide_unresolved_symbols_in_legend"),O=c.enabled("symbol_info_price_source");var F;!function(e){e.SnapShotSymbolInfoKey="___snapshot"}(F||(F={}));class W extends n.Study{constructor(e,t,i,s){super(e,function(e){return e.hasChild("currencyId")||e.addChild("currencyId",new a.Property(null)),e.hasChild("unitId")||e.addChild("unitId",new a.Property(null)),e.addExcludedKey("currencyId",1),e.addExcludedKey("unitId",1),e}(t),i,s),this._isActingAsSymbolSource=new E.WatchedValue(!0),this._realignToolsLastParams=null,this._lastResolvedSymbolSource="",this.properties().childs().minTick.subscribe(null,(()=>this._recreatePriceFormattingDependencies())),this.properties().childs().minTick.subscribe(null,(()=>this._model.fullUpdate())),this.properties().childs().currencyId.subscribe(this,this._onCurrencyChanged),this.properties().childs().unitId.subscribe(this,this._onUnitChanged),this._symbolResolvingActive=new E.WatchedValue(!1),this._symbolHibernated=new E.WatchedValue(!1),e.mainSeries().onIntervalChanged().subscribe(this,(()=>e.realignLineTools(this)))}destroy(){this._model.mainSeries().onIntervalChanged().unsubscribeAll(this),super.destroy()}properties(){return this._properties}isActingAsSymbolSource(){return this._isActingAsSymbolSource.readonly()}symbolParams(){return(0,k.symbolParams)(this)
}compareSymbolParams(e){return(0,k.compareSymbolParams)(this,e,this._model.unitConversionEnabled())}setSymbolParams(e){this._setSymbolCurrencyUnitInternal(e)}symbol(){return this.properties().childs().inputs.childs().symbol.value()}symbolChanged(){return this.properties().childs().inputs.childs().symbol.listeners()}setSymbol(e){this.setSymbolParams({symbol:e})}symbolInfo(){if(!this._resolvedSymbols)return null;const e=this.symbol();if(!e)return null;let t;return t=this._resolvedSymbols[this._getSymbolForResolve(e)]||null,t}symbolResolved(){return this.symbolsResolved()}symbolResolvingActive(){return this._symbolResolvingActive}symbolHibernated(){return this._symbolHibernated}isVisible(){const e=super.isVisible();return this._symbolHibernated.setValue(!e),e}symbolSameAsCurrent(e){return(0,k.symbolSameAsCurrent)(e,this.symbolInfo())}symbolSameAsResolved(e){return(0,D.symbolSameAsResolved)(e,this._lastResolvedSymbolSource,this.symbol())}currency(){return this.properties().childs().currencyId.value()||null}setCurrency(e){this.setSymbolParams({currency:e})}isConvertedToOtherCurrency(){return(0,o.isConvertedToOtherCurrency)(this.symbolInfo())}unit(){return this.properties().childs().unitId.value()||null}setUnit(e){this.setSymbolParams({unit:e})}isConvertedToOtherUnit(){return(0,o.isConvertedToOtherUnit)(this.symbolInfo(),this._model.unitConversionEnabled())}style(){return 2}setStyle(e){}interval(){return this._model.mainSeries().interval()}setInterval(e){}symbolSource(){return this}valueAt(e,t){var i,s;return null!==(s=null===(i=this.data().search(e))||void 0===i?void 0:i.value[1])&&void 0!==s?s:null}state(e,t){var i;const r=super.state(e,t);this._model.unitConversionEnabled()||delete r.state.unitId;const n=this.symbol();return r.state.inputs.symbol=(0,o.symbolToSaveInState)(null!==(i=this.symbolInfo())&&void 0!==i?i:this._model.chartApi().lastSymbolResolveInfo(n),n),e&&((0,s.ensureDefined)(r.data).symbols={___snapshot:this.symbolInfo()||void 0}),r}symbolTitle(e,t,i){return this.title(e,!0,{},!1,t)}titleInParts(e,t,i,s,r){var n;const o=this._titleInParts(e,t,i,s,r);return[[o[0],...null!==(n=o[1])&&void 0!==n?n:[]].join(", ")]}tags(){const e=this.symbol();return e?[e]:[]}statusView(){return R?super.statusView():null}guiPlotName(e,t){return this.properties().childs().inputs.childs().symbol.value()}canOverrideMinTick(){return!0}canBeHiddenByGlobalFlag(){return!1}legendValuesProvider(){return new P(this,this.model())}statusProvider(e){return new L(this)}measureUnitId(){return(0,o.measureUnitId)(this.symbolInfo())}getSymbolString(e){return void 0===e&&(e=this._getSymbolForApi(this.symbol())),(0,l.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getSymbolObject(e))}_createPriceAxisView(e){return new m(this,{plotIndex:"compare"})}_createViews(){this._legendView||(this._legendView=new T(this,this._model)),this._dataWindowView||(this._dataWindowView=new x(this,this._model)),this._statusView||(this._statusView=new I.StudyStatusView(this)),super._createViews()}_onUnitChanged(){"alwaysOff"!==(0,
r.currencyUnitVisibilityProperty)().value()&&this._model.fullUpdate(),this._model.unitConversionEnabled()&&this.isStarted()&&this._tryChangeInputs(),this._unitChanged.fire()}_getSymbolObject(e){const t=super._getSymbolObject(e),i=this.currency();null!==i&&(t["currency-id"]=i);const s=this.unit();return this._model.unitConversionEnabled()&&null!==s&&(t["unit-id"]=s),t}_onSymbolResolvingStart(e,t){this._lastResolvedSymbolSource=t,super._onSymbolResolvingStart(e,t),this._symbolResolvingActive.setValue(!0)}_onSymbolError(){super._onSymbolError(),this._symbolResolvingActive.setValue(!1)}_onSymbolResolved(e,t,i){super._onSymbolResolved(e,t,i),this._recreatePriceFormattingDependencies();const s=t===this.symbol()?(0,o.extractSymbolNameFromSymbolInfo)(i,this.symbol()):null,r=(0,o.symbolCurrency)(i),n=(0,o.symbolUnit)(i,this._model.unitConversionEnabled());this._setSymbolCurrencyUnitInternal({symbol:null!=s?s:void 0,currency:r,unit:n},i),this._symbolResolvingActive.setValue(!1)}async _changeInputsImpl(e,t){await super._changeInputsImpl(e,t),this._realignLineToolsIfParamsChanged()}_createStudyOnServer(){const e=super._createStudyOnServer();return this._realignLineToolsIfParamsChanged(),e}_tryCreateFormatter(){var e,t;const i=null!==(t=null===(e=null===M.customFormatters||void 0===M.customFormatters?void 0:M.customFormatters.priceFormatterFactory)||void 0===e?void 0:e.call(M.customFormatters,this.symbolInfo(),this.properties().childs().minTick.value()))&&void 0!==t?t:null;return null!==i?i:(0,o.createSeriesFormatter)(this.symbolInfo(),this.properties().childs().minTick.value())}_tryCreateDefaultFormatter(){return(0,o.createSeriesFormatter)(this.symbolInfo(),"default")}_titleInParts(e,t,i,s,r){const n=this.symbolInfo();return[this._getSymbolTitlePart(n),[this._getExchangeTitlePart(n,r),this._getPriceSourceTitlePart(n)].filter((e=>null!==e))]}_skipHistogramBaseOnAutoScale(){return!0}_getSymbolTitlePart(e){var t;if(null===e)return N?"":this.properties().childs().inputs.childs().symbol.value();const i=(0,o.getSymbolExchange)(e);if(B&&void 0!==i)return i;if(V)switch(this._model.mainSeries().symbolTextSourceProxyProperty().value()){case"description":return e.description;case"ticker-and-description":return`${e.name}, ${e.description}`;case"long-description":return null!==(t=e.long_description)&&void 0!==t?t:e.description}return e.name}_getExchangeTitlePart(e,t){return null===e||t?null:(0,o.getSymbolExchange)(e)}_getPriceSourceTitlePart(e){var t;return O&&!1!==this._model.properties().childs().paneProperties.childs().legendProperties.childs().showPriceSource.value()&&void 0!==(null==e?void 0:e.price_source_id)&&null!==(t=this._model.availablePriceSources(this.getSymbolString(this._getSymbolForApi(this.symbol()))).name(e.price_source_id))&&void 0!==t?t:null}_setSymbolCurrencyUnitInternal(e,t){const{symbol:i,currency:s,unit:r}=e,n=this.properties().childs(),a=n.inputs.childs().symbol.value(),l=n.currencyId.value(),c=n.unitId.value();if(void 0!==i&&n.inputs.childs().symbol.setValueSilently(i),void 0!==s&&n.currencyId.setValueSilently(s),
void 0!==r&&n.unitId.setValueSilently(r),t)this._resolvedSymbolsByInput[this.symbol()]=t,this._resolvedSymbols[this._getSymbolForResolve(this.symbol())]=t,this._realignToolsLastParams=null;else{const e=this.symbolInfo();null!==e&&(n.currencyId.setValueSilently((0,o.symbolCurrency)(e)),n.unitId.setValueSilently((0,o.symbolUnit)(e,this._model.unitConversionEnabled())))}n.inputs.childs().symbol.value()!==a&&n.inputs.childs().symbol.listeners().fire(n.inputs.childs().symbol,""),n.currencyId.value()!==l&&n.currencyId.listeners().fire(n.currencyId,""),n.unitId.value()!==c&&n.unitId.listeners().fire(n.unitId,""),this._realignLineToolsIfParamsChanged()}_realignLineToolsIfParamsChanged(){let e=null===this._realignToolsLastParams;if(null!==this._realignToolsLastParams){const t=this.compareSymbolParams(this._realignToolsLastParams);e=t.symbolChanged||t.intervalChanged||t.currencyChanged||t.unitChanged}e&&(this._model.realignLineTools(this),this._realignToolsLastParams=this.symbolParams())}}},28427:(e,t,i)=>{"use strict";i.d(t,{StudyOverlayBase:()=>ke});var s=i(50151),r=i(49483),n=i(31955),o=i(67317),a=i(15716),l=i(50788),c=i(3070),h=i(68805),d=i(12988),u=i(73698),p=i(56570),_=i(76742),m=i(76350),g=i(52270),f=i(10074),v=i(64755),y=i(8025),S=i(37265),b=i(93280),w=i(64147),C=i(24526),P=i(49936),x=i(12374),T=i(98558),I=i(94164),M=i(49256),A=i(19063);const L=p.enabled("force_exchange_as_title");class k extends T.PriceAxisView{constructor(e){super(),this._source=e}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const r=this._source.lastValueData("close",!1);if(r.noData)return;const n=this._source.model(),o=this._source.priceScale();if(null===o)return;if(!n.isPriceScaleVisible(o))return;const a=n.timeScale().visibleBarsStrictRange(),l=n.mainSeries().bars().lastIndex();if(null===a||null===l)return;if(l<=a.lastBar())i.background=(0,A.resetTransparency)(r.color),i.textColor=this.generateTextColor(r.color),e.borderVisible=!1,t.borderVisible=!1;else{const o=n.backgroundColorAtYPercentFromTop(r.coordinate/(0,s.ensureNotNull)(n.paneForSource(this._source)).height());i.background=o,i.textColor=(0,A.resetTransparency)(r.color),i.borderColor=i.textColor,e.borderVisible=!0,t.borderVisible=!0}i.coordinate=r.coordinate,i.floatCoordinate=r.floatCoordinate;const c=this._source.model().properties().childs().scalesProperties.childs();c.showSeriesLastValue.value()&&(e.text=(0,M.getCurrentModePriceText)(o,r),c.seriesLastValueMode.value()!==I.PriceAxisLastValueMode.LastPriceAndPercentageValue?e.secondLine="":e.secondLine=(0,M.getOppositeModePriceText)(o,r),e.visible=!0),t.text="",c.showSymbolLabels.value()&&(t.text=this._paneText(),t.visible=t.text.length>0)}_paneText(){let e="";const t=this._source.symbolInfo();return L?e=(0,h.displayedSymbolExchange)(t):this._source.model().properties().childs().scalesProperties.childs().showSymbolLabels.value()&&(e=(0,h.displayedSymbolName)(t)),e}}var D=i(37626);class E extends D.PriceLineAxisView{constructor(e){super(),this._study=e}_value(){return this._study.lastValueData("",!0)}_priceLineColor(e){return e}
_lineWidth(){return 1}_isVisible(){const e=this._study.model().properties().childs().scalesProperties.childs().showSeriesLastValue.value();return this._study.properties().childs().showPriceLine.value()&&e}}var V=i(51056),B=i(50600);class R{constructor(e){this._lineRenderer=new B.HorizontalLineRenderer,this._visible=!1,this._source=e}update(){if(this._visible=!1,!this._source.properties().childs().showPriceLine.value())return;const e=this._source.lastValueData("",!0);e.noData||(this._visible=!0,this._lineRenderer.setData({y:e.coordinate,color:e.color,linewidth:1,linestyle:V.LINESTYLE_DOTTED,visible:this._visible}))}renderer(){return this._visible?this._lineRenderer:null}}var N=i(7576),O=i(15764),F=i(928),W=i(19466),H=i(50335),z=i(11542),U=i(63273),j=i(43290),G=i(76748),q=i(23486),$=i(90799),K=i(41991),Y=i(82587);const Z=q.lastDayChangeAvailable||q.alwaysShowLastPriceAndLastDayChange,X=r.CheckMobile.any(),J=(0,j.getPercentageFormatter)();var Q;!function(e){e[e.Open=0]="Open",e[e.High=1]="High",e[e.Low=2]="Low",e[e.Close=3]="Close",e[e.Source=4]="Source",e[e.LastPrice=5]="LastPrice",e[e.Change=6]="Change",e[e.LastDayChange=7]="LastDayChange"}(Q||(Q={}));const ee=Y.notAvailable,te=`${ee} (${ee}%)`;class ie{constructor(e,t){this._study=e,this._model=t,this._emptyValues=[{title:z.t(null,void 0,i(16610)),visible:!1,value:"",index:0,id:""},{title:z.t(null,void 0,i(78254)),visible:!1,value:"",index:1,id:""},{title:z.t(null,void 0,i(65318)),visible:!1,value:"",index:2,id:""},{title:z.t(null,void 0,i(62578)),visible:!1,value:"",index:3,id:""},{title:"",visible:!1,value:"",index:4,id:""},{title:"",visible:!1,value:"",index:5,id:""},{title:z.t(null,void 0,i(37276)),visible:!1,value:"",index:6,id:""},{title:z.t(null,void 0,i(63815)),visible:!1,value:"",index:7,id:""}]}getItems(){return this._emptyValues}getValues(e){var t,i,s,r,n,o;const a=this._emptyValues.map((e=>({...e})));if(this._model.timeScale().isEmpty())return a;const l=this._study.data(),c=l.lastIndex();if(0===l.size()||null===c)return a;const h=l.search(c,y.PlotRowSearchMode.NearestLeft,1);if(null===h)return a;const d=this._showLastPriceAndChangeOnly();if((0,H.isNumber)(e)||(d?e=c:(e=this._model.crossHairSource().appliedIndex(),(0,H.isNumber)(e)||(e=c))),null===e||!(0,H.isNumber)(e))return a;const u=l.search(e,y.PlotRowSearchMode.NearestLeft,1),p=this._model.backgroundTopColor().value();if(null===u)return a;const _=u.index,m=u.value,g=m[1],f=m[2],v=m[3],S=m[4];a[0].value=ee,a[1].value=ee,a[2].value=ee,a[3].value=ee,a[7].value=te,a[6].value=te;for(const e of a)e.visible=!d;const b=a[4];b.visible=!1;const{barChange:w,lastDayChange:C}=(0,G.changesData)(l,this._study.quotes(),u.value,u.index,h.value),P=(0,K.getPriceValueFormatterForSource)(this._study);if((0,K.shouldBeFormattedAsPercent)(this._study)||(0,K.shouldBeFormattedAsIndexedTo100)(this._study))a[7].value="",a[6].value="";else{const e=this._study.formatter(),n={signPositive:!0};if(void 0!==w){
const{currentPrice:s,prevPrice:r,change:o}=w,l=null!==(i=null===(t=e.formatChange)||void 0===t?void 0:t.call(e,s,r,n))&&void 0!==i?i:e.format(o,n);a[6].value=(0,U.forceLTRStr)(`${l} (${J.format(w.percentChange,n)})`)}if(void 0!==C){const{currentPrice:t,prevPrice:i,change:o,percentChange:l}=C,c=null!==(r=null===(s=e.formatChange)||void 0===s?void 0:s.call(e,t,i,n))&&void 0!==r?r:e.format(o,n);a[7].value=(0,U.forceLTRStr)(`${c} (${J.format(l,n)})`)}}let x=null;if(d)a[5].value=null==S?ee:P(S),a[5].visible=!0,x=this._getChangeColor(null==w?void 0:w.change),a[6].visible=void 0!==w,a[7].visible=void 0!==C||Z;else{a[0].value=null==g?ee:P(g),a[1].value=null==f?ee:P(f),a[2].value=null==v?ee:P(v),a[3].value=null==S?ee:P(S),b.value=P(this._study.barFunction()(m)),a[5].visible=!1;const e=this._model.mainSeries().intervalObj().is1Tick();a[0].visible=!e,a[1].visible=!e,a[2].visible=!e,a[7].visible=void 0!==C||Z,a[6].visible=void 0!==w;const t=this._study.barColorer().barStyle(_,!1),i=null!==(n=t.barBorderColor)&&void 0!==n?n:t.barColor;x=(0,G.calculateColor)(p,i)}x=(0,A.resetTransparency)((0,G.calculateColor)(p,x));for(const e of a)e.color||(e.color=x);return a[7].visible&&(a[7].color=(0,A.resetTransparency)((0,G.calculateColor)(p,this._getChangeColor(null===(o=C)||void 0===o?void 0:o.change)))),a}_mobileNonTrackingMode(){return X&&(null===this._model.crossHairSource().pane||(0,O.isLineToolName)(F.tool.value())||null!==this._model.lineBeingEdited())}_showLastPriceAndChangeOnly(){return q.alwaysShowLastPriceAndLastDayChange||this._mobileNonTrackingMode()}_getChangeColor(e){var t;const i=void 0===e||e>=0?$.SeriesBarColorer.upColor(this._study.properties()):$.SeriesBarColorer.downColor(this._study.properties());return null!==(t=i.barBorderColor)&&void 0!==t?t:i.barColor}}const se=r.CheckMobile.any();class re extends N.DataWindowView{constructor(e,t){super(),this._invalidated=!0,this._study=e,this._model=t,this._valueProvider=this._createValuesProvider(e,t),this._items=this._valueProvider.getItems().map((e=>new N.DataWindowItem(e.id,e.title,""))),this.update()}items(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._items}update(){this._invalidated=!0}study(){return this._study}_updateImpl(){var e,t;this._header=this._study.title(W.TitleDisplayTarget.DataWindow);let i;this._showLastPriceAndChangeOnly()?i=this._study.data().lastIndex():(i=this._model.crossHairSource().appliedIndex(),isNaN(i)&&(i=this._study.data().lastIndex(),p.enabled("use_last_visible_bar_value_in_legend")&&(i=null!==(t=null===(e=this._model.timeScale().visibleBarsStrictRange())||void 0===e?void 0:e.lastBar())&&void 0!==t?t:NaN)));const s=this._valueProvider.getValues(i);for(let e=0;e<s.length;++e){const t=s[e],i=this._items[e];i.setValue(t.value),i.setVisible(t.visible),i.setColor(t.color)}}_showLastPriceAndChangeOnly(){return se&&(null===this._model.crossHairSource().pane||(0,O.isLineToolName)(F.tool.value())||null!==this._model.lineBeingEdited())}_createValuesProvider(e,t){return new ie(e,t)}}class ne extends ie{constructor(e,t){super(e,t)
;const i=t.properties().childs().paneProperties.childs().legendProperties.childs();this._showBarChange=i.showBarChange,this._showLastDayChange=i.showLastDayChange,this._showSeriesOHLC=i.showSeriesOHLC}getValues(e){var t,i,s;const r=super.getValues(e),n=this._study.properties().childs(),o=n.style.value(),a=12!==o,l=this._showSeriesOHLC.value(),c=a&&this._showBarChange.value(),d=a&&this._showLastDayChange.value();if(this._showLastPriceAndChangeOnly())return(t=r[6]).visible&&(t.visible=c),r[7].visible=!1,r;const u=(0,h.isPriceSourceStyle)(o),p=12!==o&&16!==o,_=12!==o,m=this._model.mainSeries().intervalObj().is1Tick(),g=l&&!u,f=l&&u;if(r[0].visible=g&&p&&!m,r[1].visible=g&&!m,r[2].visible=g&&!m,r[3].visible=g&&_,(i=r[7]).visible&&(i.visible=d),(s=r[6]).visible&&(s.visible=c),r[4].visible=f,16===o){const e=n.hlcAreaStyle.childs();r[1].color=e.highLineColor.value(),r[2].color=e.lowLineColor.value(),r[3].color=e.closeLineColor.value()}return r}}var oe=i(99531);class ae extends re{constructor(e,t){super(e,t),this._additional=null,this._studyOverlay=e,this._backgroundColorSpawn=t.backgroundTopColor().spawn(),this._backgroundColorSpawn.subscribe(this.update.bind(this));const i=t.properties().childs().paneProperties.childs().legendProperties.childs();this._visibilityProperty=(0,oe.combineProperty)(((e,t)=>e||t),i.showBarChange.weakReference(),i.showSeriesOHLC.weakReference()),this._visibilityProperty.subscribe(this,this.update)}areValuesVisible(){return this._visibilityProperty.value()}additional(){return this._additional}destroy(){this._backgroundColorSpawn.destroy(),this._visibilityProperty.destroy()}_updateImpl(){super._updateImpl()}_createValuesProvider(e,t){return new ne(e,t)}}var le=i(65458),ce=i(99800),he=i(72476),de=i(80941),ue=i(84626),pe=i(70527),_e=i(93250),me=i(15599),ge=i(53766),fe=i(83379),ve=i(42989),ye=i(44158);class Se extends ye.StudyStatusProvider{getSplitTitle(){return this._source.titleInParts(W.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)}text(){return this._source.isActualInterval()?this._source.isFailed()?`${this._source.title(W.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)}: ${this.sourceStatusText()}`:`${this._source.title(W.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)} ${this.sourceStatusText()}`:this._source.title(W.TitleDisplayTarget.StatusLine,!0,void 0,!1,!1)}}const be=p.enabled("show_symbol_logos")&&p.enabled("show_symbol_logo_in_legend")&&p.enabled("show_symbol_logo_for_compare_studies"),we=(r.CheckMobile.any()||be)&&!1,Ce=p.enabled("study_overlay_compare_legend_option"),Pe=p.enabled("secondary_series_extend_time_scale"),xe=p.enabled("hide_unresolved_symbols_in_legend"),Te=!p.enabled("hide_study_overlay_legend_item"),Ie=p.enabled("symbol_info_price_source"),Me=(0,n.getLogger)("Chart.StudyOverlay");var Ae;function Le(e,t){return null==e[t]}!function(e){e.SnapShotSymbolInfoKey="___snapshot"}(Ae||(Ae={}));class ke extends o.Study{constructor(e,t,i,s){super(e,function(e){e.hasChild("currencyId")||e.addChild("currencyId",new d.Property(null)),
e.hasChild("unitId")||e.addChild("unitId",new d.Property(null)),(0,ve.allChartStyles)().includes(e.childs().style.value())||e.childs().style.setValueSilently(2);const t=e.childs();if(t.lineStyle.hasChild("styleType")){const e=t.lineStyle.childs(),i=e.styleType.value();let s,r;0===i&&(r=14,s=t.lineWithMarkersStyle.childs()),1===i&&(r=15,s=t.steplineStyle.childs()),s&&(s.color.setValueSilently(e.color.value()),s.linestyle.setValueSilently(e.linestyle.value()),s.linewidth.setValueSilently(e.linewidth.value()),s.priceSource.setValueSilently(e.priceSource.value())),void 0!==r&&2===t.style.value()&&t.style.setValueSilently(r),t.lineStyle.removeProperty("styleType")}return e.addExcludedKey("currencyId",1),e.addExcludedKey("unitId",1),e}(t),i,s),this._seriesSource=null,this._symbolResolvingActive=new w.WatchedValue(!1),this._symbolHibernated=new w.WatchedValue(!1),this._styleToRecover=null,this._isActingAsSymbolSource=new w.WatchedValue(!0),this._realignToolsLastParams=null,this._precomputedBarStyles=new WeakMap,this._lastResolvedSymbolSource="",this._data=new v.PlotList((0,c.seriesPlotFunctionMap)(),Le),this._quotesProvider=new _.QuotesProvider(void 0,e.collapsed().spawnOwnership()),we&&this._quotesProvider.quotesUpdate().subscribe(this,this._onQuotesUpdate);const r=this.properties().childs();r.currencyId.subscribe(this,this._onCurrencyChanged),r.unitId.subscribe(this,this._onUnitChanged),r.allowExtendTimeScale.subscribe(this,this._onAllowExtendTimeScaleChanged),this._onAllowExtendTimeScaleChanged(),r.style.subscribe(this,this._onChartStyleChanged),r.lineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.lineWithMarkersStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.steplineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.areaStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.baselineStyle.childs().priceSource.subscribe(this,this._updateBarFunction),r.columnStyle.childs().priceSource.subscribe(this,this._updateBarFunction),this._updateBarFunction(),r.minTick.subscribe(this,this._onMinTickChanged),this._formatter=null,this._defaultFormatter=null,e.mainSeries().onIntervalChanged().subscribe(this,(()=>e.realignLineTools(this)))}destroy(){this._model.mainSeries().onIntervalChanged().unsubscribeAll(this),this._quotesProvider.destroy(),super.destroy()}isActingAsSymbolSource(){return this._isActingAsSymbolSource.readonly()}precomputedBarStyle(e){return this._precomputedBarStyles.get(e)}setPrecomputedBarStyle(e,t){this._precomputedBarStyles.set(e,t)}properties(){return this._properties}barColorer(){return new $.SeriesBarColorer({data:()=>this.data(),bars:()=>this.data(),nsBars:()=>new v.PlotList,priceScale:()=>(0,s.ensureNotNull)(this.priceScale()),properties:()=>this.properties(),firstValue:()=>this.firstValue()})}symbolParams(){return(0,m.symbolParams)(this)}compareSymbolParams(e){return(0,m.compareSymbolParams)(this,e,this._model.unitConversionEnabled())}setSymbolParams(e){this._setSymbolParamsInternal(e)}symbol(){
return this.properties().childs().inputs.childs().symbol.value()}symbolChanged(){return this.properties().childs().inputs.childs().symbol.listeners()}setSymbol(e){this.setSymbolParams({symbol:e})}symbolInfo(){if(!this._resolvedSymbols)return null;const e=this._properties.childs().inputs.childs().symbol.value();if(!e)return null;let t;return t=this._resolvedSymbols[this._getSymbolForResolve(e)]||null,t}supportsPressedChunks(){return!1}pressedChunks(e,t){throw new Error("Pressed chunks are not supported")}data(){return null===this._seriesSource?super.data():this._seriesSource.data().bars()}symbolResolved(){return this.symbolsResolved()}symbolResolvingActive(){return this._symbolResolvingActive}symbolHibernated(){return this._symbolHibernated}isVisible(){const e=super.isVisible();return this._symbolHibernated.setValue(!e),e}symbolSameAsCurrent(e){return(0,m.symbolSameAsCurrent)(e,this.symbolInfo())}symbolSameAsResolved(e){return(0,g.symbolSameAsResolved)(e,this._lastResolvedSymbolSource,this.symbol())}priceSource(){const e=this.properties().childs();switch(e.style.value()){case 2:return e.lineStyle.childs().priceSource.value();case 14:return e.lineWithMarkersStyle.childs().priceSource.value();case 15:return e.steplineStyle.childs().priceSource.value();case 3:return e.areaStyle.childs().priceSource.value();case 10:return e.baselineStyle.childs().priceSource.value();case 13:return e.columnStyle.childs().priceSource.value()}return null}barFunction(){return this._barFunction}quotesProvider(){return this._quotesProvider}quotes(){return this._quotesProvider.quotes()}currency(){return this.properties().childs().currencyId.value()||null}setCurrency(e){this.setSymbolParams({currency:e})}isConvertedToOtherCurrency(){return(0,h.isConvertedToOtherCurrency)(this.symbolInfo())}unit(){return this.properties().childs().unitId.value()||null}setUnit(e){this.setSymbolParams({unit:e})}isConvertedToOtherUnit(){return(0,h.isConvertedToOtherUnit)(this.symbolInfo(),this._model.unitConversionEnabled())}style(){return this.properties().childs().style.value()}setStyle(e){this.setSymbolParams({style:e})}interval(){return this._model.mainSeries().interval()}setInterval(e){}valueAt(e,t){var i,s;return null!==(s=null===(i=this.data().search(e))||void 0===i?void 0:i.value[t])&&void 0!==s?s:null}symbolSource(){return this}barsProvider(){return this}state(e,t){var i;const r=super.state(e,t);this._model.unitConversionEnabled()||delete r.state.unitId;const n=this.symbol();return r.state.inputs.symbol=(0,h.symbolToSaveInState)(null!==(i=this.symbolInfo())&&void 0!==i?i:this._model.chartApi().lastSymbolResolveInfo(n),n),e&&((0,s.ensureDefined)(r.data).symbols={___snapshot:this.symbolInfo()||void 0}),r}symbolTitle(e,t,i){return this.title(e,!0,{},!1,t)}title(e,t,i,s,r){var n;const o=this._titleInParts(e,t,i,s,r);return[o[0],...null!==(n=o[1])&&void 0!==n?n:[]].join(` ${h.symbolTitleSeparator} `)}titleInParts(e,t,i,s,r){return[this.title(e,t,i,s,r)]}isStarted(){return null===this._seriesSource?super.isStarted():this._seriesSource.isStarted()}sourceId(){
return null===this._seriesSource?super.sourceId():(0,s.ensureNotNull)(this._seriesSource.instanceId())}moveData(e){null===this._seriesSource?super.moveData(e):this._seriesSource.moveData(e)}firstValue(){const e=this._model.timeScale().visibleBarsStrictRange();if(null===e)return null;const t=e.firstBar();if(0===this.data().size())return this._ownFirstValue;const i=this.data().search(t,y.PlotRowSearchMode.NearestRight,1);return this._ownFirstValue=null!==i?this._barFunction(i.value,0):null,this._ownFirstValue}lastValueData(e,t,i){const s={noData:!0},r=this.priceScale();if(this._model.timeScale().isEmpty()||null===r||r.isEmpty()||this.data().isEmpty())return s;const n=this._model.timeScale().visibleBarsStrictRange();if(null===n)return s;const o=this.properties().childs();if(!o.visible.value())return s;const a=this.nearestIndex(n.lastBar(),y.PlotRowSearchMode.NearestLeft,1);if(void 0===a)return s;const l=this.firstValue();if(null===l)return s;const c=this._lastNonEmptyPlotRow(4),h=null!==c&&n.contains(c.index),d=null!==c?c.value:null,u=t||h?d:this.data().valueAt(a);if(null===u)return s;const p=this._barFunction(u,2);if(!(0,S.isNumber)(p))return s;const _=r.priceToCoordinate(p,l);let m;switch(o.style.value()){case 0:m=u[1]<=u[4]?o.barStyle.childs().upColor.value():o.barStyle.childs().downColor.value();break;case 1:m=u[1]<=u[4]?o.candleStyle.childs().upColor.value():o.candleStyle.childs().downColor.value();break;case 9:m=u[1]<=u[4]?o.hollowCandleStyle.childs().upColor.value():o.hollowCandleStyle.childs().downColor.value();break;case 13:m=u[1]<=u[4]?o.columnStyle.childs().upColor.value():o.columnStyle.childs().downColor.value();break;case 2:m=o.lineStyle.childs().color.value();break;case 14:m=o.lineWithMarkersStyle.childs().color.value();break;case 15:m=o.steplineStyle.childs().color.value();break;case 3:m=o.areaStyle.childs().linecolor.value();break;case 16:m=o.hlcAreaStyle.childs().closeLineColor.value();break;case 10:{const e=o.baselineStyle.childs();m=_<Math.round(r.height()*(Math.abs(100-e.baseLevelPercentage.value())/100))?e.topLineColor.value():e.bottomLineColor.value();break}case 12:m=o.hiloStyle.childs().color.value();break;default:throw new Error("Not supported overlay style")}const g={...r.getFormattedValues(p,l,!0),noData:!1,floatCoordinate:_,coordinate:_,color:m};return i&&(g.price=p),g}priceRange(e,t,i){if(i.forceOverlayOnly)return null;if(!(0,S.isInteger)(e))return Me.logDebug("priceRange: incorrect startBar"),null;if(!(0,S.isInteger)(t))return Me.logDebug("priceRange: incorrect endBar"),null;if(0===this.data().size())return null;const s=this.priceSource();let r;r=null!==s?this.data().minMaxOnRangeCached(e,t,[{name:s,offset:0}]):this.data().minMaxOnRangeCached(e,t,[{name:"low",offset:0},{name:"high",offset:0}]);const n=null!==r?new b.PriceRange(r.min,r.max):null;return this._postProcessPriceRange(n,i)}bars(){return this.data()}open(e){return(0,s.ensureNotNull)(this.bars().valueAt(e))[1]}high(e){return(0,s.ensureNotNull)(this.bars().valueAt(e))[2]}low(e){return(0,s.ensureNotNull)(this.bars().valueAt(e))[3]}
close(e){return(0,s.ensureNotNull)(this.bars().valueAt(e))[4]}hl2(e){return(this.high(e)+this.low(e))/2}hlc3(e){return(this.high(e)+this.low(e)+this.close(e))/3}ohlc4(e){return(this.open(e)+this.high(e)+this.low(e)+this.close(e))/4}canBeHiddenByGlobalFlag(){return!1}async start(e,t){var i;this._formatter=null,this._defaultFormatter=null;const s=super.start(e,t);return null===(i=this.priceScale())||void 0===i||i.updateFormatter(),we&&this._setQuotesSymbol((0,u.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getSymbolObject(this.symbol()))),s}stop(e){super.stop(e),this._quotesProvider.setQuotesSessionSymbol(null)}formatter(){return this._formatter||this._recreateFormatter(),(0,s.ensureNotNull)(this._formatter)}statusView(){return Te?super.statusView():null}moveItem(e,t,i){if(10===this.style()&&0===t){const t=(0,s.ensureNotNull)(this.priceScale()),i=this.properties().childs().baselineStyle,r=t.height(),n=100-e.y/r*100,o=n<0?0:Math.round(10*n)/10;i.childs().baseLevelPercentage.setValue(Math.max(Math.min(o,100),0))}}measureUnitId(){return(0,h.measureUnitId)(this.symbolInfo())}dataUpdated(){return this._dataUpdated}alertCreationAvailable(){var e;return new w.WatchedValue(!(null===(e=this.priceScale())||void 0===e?void 0:e.isPercentage())&&super.alertCreationAvailable().value()).readonly()}legendValuesProvider(){return new ne(this,this.model())}defaultPlotIdForAlert(){return""}tags(){const e=[],t=this.symbolInfo();if(t)e.push(t.name);else{const t=this.symbol();t&&e.push(t)}return e}statusProvider(e){return new Se(this)}_onPropertiesChanged(){super._onPropertiesChanged(),this._precomputedBarStyles=new WeakMap}async _tryChangeInputs(){var e;await super._tryChangeInputs(),this._formatter=null,this._defaultFormatter=null,null===(e=this.priceScale())||void 0===e||e.updateFormatter()}_tryCreateFormatter(){var e,t;const i=null!==(t=null===(e=null===C.customFormatters||void 0===C.customFormatters?void 0:C.customFormatters.priceFormatterFactory)||void 0===e?void 0:e.call(C.customFormatters,this.symbolInfo(),this.properties().childs().minTick.value()))&&void 0!==t?t:null;return null!==i?i:(0,h.createSeriesFormatter)(this.symbolInfo(),this.properties().childs().minTick.value())}_tryCreateDefaultFormatter(){return(0,h.createSeriesFormatter)(this.symbolInfo(),"default")}_onUnitChanged(){"alwaysOff"!==(0,l.currencyUnitVisibilityProperty)().value()&&this._model.fullUpdate(),this._model.unitConversionEnabled()&&this.isStarted()&&this._tryChangeInputs(),this._unitChanged.fire()}_getSymbolObject(e){const t=super._getSymbolObject(e),i=this.currency();null!==i&&(t["currency-id"]=i);const s=this.unit();return this._model.unitConversionEnabled()&&null!==s&&(t["unit-id"]=s),t}_onSymbolResolvingStart(e,t){this._lastResolvedSymbolSource=t,super._onSymbolResolvingStart(e,t),this._symbolResolvingActive.setValue(!0)}_onSymbolError(){super._onSymbolError(),this._symbolResolvingActive.setValue(!1)}_onSymbolResolved(e,t,i){super._onSymbolResolved(e,t,i),this._recreatePriceFormattingDependencies();const s=t===this.symbol()?(0,
h.extractSymbolNameFromSymbolInfo)(i,this.symbol()):null,r=(0,h.symbolCurrency)(i),n=(0,h.symbolUnit)(i,this._model.unitConversionEnabled());this._setSymbolParamsInternal({symbol:null!=s?s:void 0,currency:r,unit:n},i),we&&this._setQuotesSymbol((0,u.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getSymbolObject(this.symbol()))),this._checkStyle(),this._symbolResolvingActive.setValue(!1)}async _changeInputsImpl(e,t){await super._changeInputsImpl(e,t),this._realignLineToolsIfParamsChanged()}_setQuotesSymbol(e){const t=this.symbolInfo(),i=(0,h.extractSymbolNameFromSymbolInfo)(t,e);this._quotesProvider.setQuotesSessionSymbol(i)}_onQuotesUpdate(e,t){!this._legendView||void 0===t.values.change&&void 0===t.values.change_percent||(this._legendView.update(),this._model.updateSource(this))}_createViews(){this._priceAxisViews=[];const e=new k(this);this._priceAxisViewsBase=[e];const t=new E(this);this._priceLinesAxisViews=[t],this._paneViews=[],this._labelPaneViews=[];let i=null,r=null;switch(this.properties().childs().style.value()){case 0:r=new ce.SeriesBarsPaneView(this,this._model);break;case 1:r=new he.SeriesCandlesPaneView(this,this._model);break;case 9:r=new me.SeriesHollowCandlesPaneView(this,this._model);break;case 13:r=new ge.SeriesColumnsPaneView(this,this._model);break;case 2:case 14:case 15:r=new de.SeriesLinePaneView(this,this._model);break;case 3:r=new ue.SeriesAreaPaneView(this,this._model);break;case 16:r=new pe.SeriesHLCAreaPaneView(this,this._model);break;case 10:{r=new _e.SeriesBaselinePaneView(this,this._model);const e=this.properties().childs().baselineStyle.childs();i=new x.SeriesWaterlinePaneView({paneHeight:()=>(0,s.ensureNotNull)(this.priceScale()).height(),color:()=>e.baselineColor.value(),baseLevelPercentage:()=>e.baseLevelPercentage.value()});break}case 12:r=new fe.SeriesHiLoPaneView(this,this._model)}r&&this._paneViews.push(r),null!==i&&this._paneViews.push(i),this._paneViews.push(new R(this)),this._dataWindowView||(this._dataWindowView=new re(this,this._model)),this._legendView||(this._legendView=new ae(this,this._model)),this._statusView||(this._statusView=new P.StudyStatusView(this)),this._priceAxisViews=[...this._priceAxisViewsBase],this._labelPaneViews.push(new le.PanePriceAxisView(e,this,this._model))}_createStudyOnServer(){let e;return null===this._seriesSource?e=super._createStudyOnServer():(this._modifyStudyOnServer((0,s.ensureDefined)(this._inputs)),e=!0),this._realignLineToolsIfParamsChanged(),e}_modifyStudyOnServer(e){null===this._seriesSource?super._modifyStudyOnServer(e,0):(this._seriesSource.modifySeries((0,u.decodeExtendedSymbol)(e.symbol),(0,f.getServerInterval)(this._series.properties().childs().interval.value())),this._seriesSource.isStarted()||this._seriesSource.start())}_stopStudyOnServer(){null===this._seriesSource?super._stopStudyOnServer():this._seriesSource.stop()}_titleInParts(e,t,i,s,r){const n=this.symbolInfo();return[this._getSymbolTitlePart(n),[this._getExchangeTitlePart(n,r),this._getPriceSourceTitlePart(n)].filter((e=>null!==e))]}_getSymbolTitlePart(e){var t
;if(null===e)return xe?"":this.properties().childs().inputs.childs().symbol.value();if(Ce)switch(this._model.mainSeries().symbolTextSourceProxyProperty().value()){case"description":return e.description;case"ticker-and-description":return`${e.name}, ${e.description}`;case"long-description":return null!==(t=e.long_description)&&void 0!==t?t:e.description}return e.name}_getExchangeTitlePart(e,t){return null===e||t?null:(0,h.getSymbolExchange)(e)}_getPriceSourceTitlePart(e){var t;return Ie&&!1!==this._model.properties().childs().paneProperties.childs().legendProperties.childs().showPriceSource.value()&&void 0!==(null==e?void 0:e.price_source_id)&&null!==(t=this._model.availablePriceSources(this.getSymbolString(this._getSymbolForApi(this.symbol()))).name(e.price_source_id))&&void 0!==t?t:null}_onAllowExtendTimeScaleChanged(){if(!Pe)return;const e=this.isStarted();e&&this.stop(!0);const t=this.properties().childs().allowExtendTimeScale.value();this.properties().childs().inputs.childs().extendTimeScale.setValue(t),e&&this.start(!0)}_setSymbolParamsInternal(e,t){const{symbol:i,currency:s,unit:r,style:n}=e,o=this.properties().childs(),a=o.inputs.childs().symbol.value(),l=o.currencyId.value(),c=o.unitId.value(),d=o.style.value();if(void 0!==i&&o.inputs.childs().symbol.setValueSilently(i),void 0!==s&&o.currencyId.setValueSilently(s),void 0!==r&&o.unitId.setValueSilently(r),void 0!==n&&o.style.setValueSilently(n),t)this._resolvedSymbolsByInput[this.symbol()]=t,this._resolvedSymbols[this._getSymbolForResolve(this.symbol())]=t,this._realignToolsLastParams=null;else{const e=this.symbolInfo();null!==e&&(o.currencyId.setValueSilently((0,h.symbolCurrency)(e)),o.unitId.setValueSilently((0,h.symbolUnit)(e,this._model.unitConversionEnabled())))}o.inputs.childs().symbol.value()!==a&&o.inputs.childs().symbol.listeners().fire(o.inputs.childs().symbol,""),o.currencyId.value()!==l&&o.currencyId.listeners().fire(o.currencyId,""),o.unitId.value()!==c&&o.unitId.listeners().fire(o.unitId,""),o.style.value()!==d&&o.style.listeners().fire(o.style,""),this._checkStyle(),this._realignLineToolsIfParamsChanged()}_updateBarFunction(){this._barFunction=(0,a.barFunctionByStyle)(this.style(),this.priceSource())}_onMinTickChanged(){this._recreatePriceFormattingDependencies(),this.updateAllViews({type:"global-change"}),this._model.fullUpdate()}_onChartStyleChanged(){var e;this._updateBarFunction(),(null===(e=this._styleToRecover)||void 0===e?void 0:e.originalStyle)!==this.style()&&(this._styleToRecover=null)}_checkStyle(){const e=this.style();(0,h.isCloseBasedSymbol)(this.symbolInfo())?(0,h.isSingleValueBasedStyle)(e)||(this.setStyle(2),this._styleToRecover={correctedStyle:this.style(),originalStyle:e}):null!==this._styleToRecover&&(this.setStyle(this._styleToRecover.originalStyle),this._styleToRecover=null)}_realignLineToolsIfParamsChanged(){let e=null===this._realignToolsLastParams;if(null!==this._realignToolsLastParams){const t=this.compareSymbolParams(this._realignToolsLastParams);e=t.symbolChanged||t.intervalChanged||t.currencyChanged||t.unitChanged}
e&&(this._model.realignLineTools(this),this._realignToolsLastParams=this.symbolParams())}}},16227:(e,t,i)=>{"use strict";i.d(t,{StudyPriceAxisView:()=>o});var s=i(50151),r=i(98558),n=i(19063);class o extends r.PriceAxisView{constructor(e,t){super(),this._model=e.model(),this._source=e,this._data=t,this._isForceOverlay=!!this._source.metaInfo().isPlotForceOverlay(this._data.plotIndex)}_updateRendererData(e,t,i){e.visible=!1,t.visible=!1;const r=this._source.model(),o=this._isForceOverlay?r.mainSeries().priceScale():this._source.priceScale();if(null===o)return;if(!r.isPriceScaleVisible(o))return;const a=this._source.lastValueData(this._data.plotIndex,!1);if(a.noData)return;const l=r.timeScale().visibleBarsStrictRange(),c=r.mainSeries().bars().lastIndex();if(null!==l&&null!==c){if(c<=l.lastBar()){i.background=(0,n.resetTransparency)(a.color);let s=a.color;"transparent"===s&&(s=this._model.properties().childs().scalesProperties.childs().backgroundColor.value()),i.textColor=this.generateTextColor(s),i.borderColor=void 0,e.borderVisible=!1,t.borderVisible=!1}else{const o=r.backgroundColorAtYPercentFromTop(a.coordinate/(0,s.ensureNotNull)(r.paneForSource(this._source)).height());i.background=o,i.textColor=(0,n.resetTransparency)(a.color),i.borderColor=(0,n.resetTransparency)(i.textColor),e.borderVisible=!0,t.borderVisible=!0}i.coordinate=a.coordinate,i.floatCoordinate=a.floatCoordinate,this._showAxisLabel()&&(e.text=a.text,e.visible=!0),this._updatePaneRendererData(t)}}_showPaneLabel(){return!!this._model.properties().childs().scalesProperties.childs().showStudyPlotLabels.value()&&this._source.properties().childs().showLabelsOnPriceScale.value()&&this._source.isPlotVisibleAt(this._data.plotIndex,4)}_showAxisLabel(){return!!this._model.properties().childs().scalesProperties.childs().showStudyLastValue.value()&&this._source.properties().childs().showLabelsOnPriceScale.value()&&this._source.isPlotVisibleAt(this._data.plotIndex,4)}_updatePaneRendererData(e){e.text="",this._showPaneLabel()&&(e.text=this._source.priceLabelText(this._data.plotIndex),e.visible=!0)}}},78749:(e,t,i)=>{"use strict";i.d(t,{applyOverridesToStudy:()=>d,applyOverridesToStudyDefaults:()=>u});var s=i(50151),r=i(94113),n=i(31955);const o={line:r.LineStudyPlotStyle.Line,histogram:r.LineStudyPlotStyle.Histogram,cross:r.LineStudyPlotStyle.Cross,area:r.LineStudyPlotStyle.Area,columns:r.LineStudyPlotStyle.Columns,circles:r.LineStudyPlotStyle.Circles,line_with_breaks:r.LineStudyPlotStyle.LineWithBreaks,area_with_breaks:r.LineStudyPlotStyle.AreaWithBreaks,step_line:r.LineStudyPlotStyle.StepLine,step_line_with_breaks:r.LineStudyPlotStyle.StepLineWithBreaks,step_line_with_diamonds:r.LineStudyPlotStyle.StepLineWithDiamonds},a=(0,n.getLogger)("Chart.Model.StudyPropertiesOverrider");var l,c;function h(e,t,i,s){const r=i.split(".");if(0===r.length||0===r[0].length)return;const n=function(e){const t=e.split(":");return{name:t[0],type:2===t.length?t[1]:null}
}(r[0]),o=n.name,h=n.type,d=null!==h,u=!d||"band"===h,p=!d||"area"===h,_=!d||"input"===h,m=!d||"plot"===h?c.getPlotIdByTitle(e,o):null,g=u?c.getBandIndexByName(e,o):null,f=p?c.getFilledAreaIdByTitle(e,o):null,v=_?c.getInputByName(e,o):null,y=t.hasOwnProperty(o);if((null!==m?1:0)+(null!==g?1:0)+(null!==f?1:0)+(null!==v?1:0)+(y?1:0)>1)return void a.logWarn(`Study '${e.description}' has ambiguous identifier '${o}'`);const S=r[1];if(null!==m){if(1===r.length)return void a.logWarn(`Path of sub-property of '${o}' plot for study '${e.description}' must be not empty`);const i=r.slice(1);l.applyPlotProperty(e,t,m,i,s)}else if(null!==v)l.applyInputValue(t,v,s);else if(null!==g){if(void 0===S)return void a.logWarn(`Property name of '${o}' band for study '${e.description}' must be set`);l.applyBandProperty(t,g,S,s)}else if(null!==f){if(void 0===S)return void a.logWarn(`Property name of '${o}' area for study '${e.description}' must be set`);l.applyFilledAreaProperty(t,f,S,s)}else y?l.setRootProperty(t,r,s):a.logWarn(`Study '${e.description}' has no plot or input '${o}'`)}function d(e,t){const i=e.properties(),s=i.state();for(const i in t)t.hasOwnProperty(i)&&h(e.metaInfo(),s,i,t[i]);i.mergeAndFire(s)}function u(e,t,i){for(const s in e){if(!e.hasOwnProperty(s))continue;const r=s.indexOf(".");if(-1===r)continue;const n=s.substring(0,r),o=c.getMetaInfoByDescription(t,n);if(null===o){a.logWarn(`There is no such study ${n}`);continue}const l=i(o);null!==l?h(o,l,s.substring(r+1),e[s]):a.logWarn(`Cannot apply overrides for study ${n}`)}}!function(e){e.applyPlotProperty=function(e,t,i,n,l){if(void 0===t.styles)return void a.logWarn("Study does not have styles");const c=n[0];if("color"===c){const o=function(e,t,i){if(void 0===e.plots)return null;for(const s of e.plots){if(!(0,r.isPaletteColorerPlot)(s)||void 0===t.palettes)continue;const e=t.palettes[s.palette];if(s.target===i&&void 0!==e)return e}return null}(e,t,i);return void function(e,t,i,r,n){var o;void 0!==e.styles?null===t&&!isNaN(r)&&r>0?a.logWarn(`Study plot does not have color #${r}`):((0===r||isNaN(r))&&((0,s.ensureDefined)(e.styles[i]).color=String(n),r=0),null!==t&&((0,s.ensureDefined)(null===(o=t.colors)||void 0===o?void 0:o[r]).color=String(n))):a.logWarn("Study does not have styles")}(t,o,i,n.length>1?parseInt(n[1]):NaN,l)}const h=t.styles[i];if(void 0!==h&&h.hasOwnProperty(c)){if("plottype"===c){const e=o[String(l)];if(void 0===e)return void a.logWarn(`Unsupported plot type for plot: ${l}`);l=e}h[c]=l}else a.logWarn(`Study plot does not have property '${c}'`)},e.applyBandProperty=function(e,t,i,s){if(void 0===e.bands)return void a.logWarn("Study does not have bands");const r=e.bands[t];if(void 0!==r&&r.hasOwnProperty(i)){if("plottype"===i){const e=o[String(s)];if(void 0===e)return void a.logWarn(`Unsupported plot type for band: ${s}`);s=e}r[i]=s}else a.logWarn(`Study band does not have property '${i}'`)},e.applyFilledAreaProperty=function(e,t,i,s){if(void 0===e.filledAreasStyle)return void a.logWarn("Study does not have areas");const r=e.filledAreasStyle[t]
;void 0!==r&&r.hasOwnProperty(i)?r[i]=s:a.logWarn(`Study area does not have property '${i}'`)},e.applyInputValue=function(e,t,i){void 0!==e.inputs&&e.inputs.hasOwnProperty(t)?e.inputs[t]=i:a.logWarn(`Study does not have input '${t}'`)},e.setRootProperty=function(e,t,i){if(0===t.length)return;let s=e;for(const e of t.slice(0,-1)){if(null==s||!s.hasOwnProperty(e))break;s=s[e]}const r=t[t.length-1];null!=s&&s.hasOwnProperty(r)?s[r]=i:a.logWarn(`Study does not have property ${t.join(".")}`)}}(l||(l={})),function(e){e.getInputByName=function(e,t){if(void 0===e.inputs)return null;t=t.toLowerCase();for(const i of e.inputs)if(i.name.toLowerCase()===t)return i.id;return null},e.getPlotIdByTitle=function(e,t){if(void 0===e.styles)return null;t=t.toLowerCase();for(const i in e.styles){const s=e.styles[i];if((void 0!==s&&void 0!==s.title?s.title:i).toLowerCase()===t)return i}return null},e.getFilledAreaIdByTitle=function(e,t){if(void 0===e.filledAreas)return null;t=t.toLowerCase();for(const i of e.filledAreas)if(i.title.toLowerCase()===t)return i.id;return null},e.getBandIndexByName=function(e,t){if(void 0===e.bands)return null;t=t.toLowerCase();for(let i=0;i<e.bands.length;++i)if(e.bands[i].name.toLowerCase()===t)return i;return null},e.getMetaInfoByDescription=function(e,t){t=t.toLowerCase();for(const i of e)if(i.description.toLowerCase()===t||i.shortDescription.toLowerCase()===t)return i;return null}}(c||(c={}))},67317:(e,t,i)=>{"use strict";i.d(t,{Study:()=>ci,createStudyError:()=>ni,prepareStudyProperties:()=>Qt,prepareStudyPropertiesForLoadChart:()=>si});var s=i(16230),r=i(27788),n=i(14314),o=i(50151),a=i(30551),l=i(11542),c=i(31955),h=i(49822),d=i(71885),u=i(52033),p=i(19063),_=i(58137),m=i(18172),g=i(45579),f=i(93280),v=i(64755),y=i(68159),S=i(14019),b=i(8025),w=i(85904),C=i(14878),P=i(22739),x=i(7015);class T{constructor(e,t,i,s){this._study=e,this._model=t,this._showStudyValues=null!=s?s:t.properties().childs().paneProperties.childs().legendProperties.childs().showStudyValues,this._hhistBasedStudy=void 0!==e.metaInfo().graphics.hhists,this._valuesProvider=this._createValuesProvider(e,t,i)}getItems(){return this._valuesProvider.getItems()}getValues(e){const t=this._valuesProvider.getValues(e),i=this._study.properties(),s=this._showStudyValues.value()&&i.childs().showLegendValues.value(),r=e=>!!this._hhistBasedStudy||this._study.isPlotVisibleAt(e,8);for(const e of t)e.visible=e.visible&&s&&r(e.id);return t}_createValuesProvider(e,t,i){return this._hhistBasedStudy?new x.HHistBasedValuesProvider(e,t,i):new P.StudyValuesProvider(e,t,i)}}var I=i(94113);class M extends C.StudyBaseWindowView{constructor(e,t){super(e,t),this._showStudyValues=t.properties().childs().paneProperties.childs().legendProperties.childs().showStudyValues,this._showStudyValues.subscribe(this,this.update);const i=this._study.properties();i.childs().showLegendValues.subscribe(this,this.update);const s=this._study.metaInfo().plots,r=new Set;s.forEach((e=>{var t;if((0,I.isOhlcPlot)(e)){const t=e.target;if(r.has(t))return;r.add(t),
i.childs().ohlcPlots.childs()[t].childs().display.subscribe(this,this.update)}else(0,I.isPlotSupportDisplay)(e)&&(null===(t=i.childs().styles.childs()[e.id])||void 0===t||t.childs().display.subscribe(this,this.update))}))}areValuesVisible(){return this._showStudyValues.value()}additional(){return null}destroy(){this._showStudyValues.unsubscribeAll(this);const e=this._study.properties();e.childs().showLegendValues.unsubscribeAll(this);const t=this._study.metaInfo().plots,i=new Set;t.forEach((t=>{var s;if((0,I.isOhlcPlot)(t)){const s=t.target;if(i.has(s))return;i.add(s),e.childs().ohlcPlots.childs()[s].childs().display.unsubscribe(this,this.update)}else(0,I.isPlotSupportDisplay)(t)&&(null===(s=e.childs().styles.childs()[t.id])||void 0===s||s.childs().display.unsubscribe(this,this.update))}))}_createValuesProvider(e,t){return new T(e,t)}}var A=i(928),L=i(49936),k=i(73698),D=i(3462),E=i(4340),V=i(44158),B=i(37265);i(19466),i(99531);function R(e,t){return e.studyId.localeCompare(t.studyId)}function N(e){const t=new Set,i=[];return e.forEach((e=>{t.has(e.studyId)||(t.add(e.studyId),i.push(e))})),i}function O(e){const t=e.model().mainSeries();return{studyId:(0,o.ensureNotNull)(e.sourceId()),turnaround:e.turnaround(),sourceStudies:e.parentSources().filter((e=>e!==t)).map((e=>O(e)))}}var F=i(65383),W=i(56570),H=i(95201),z=i(30125);class U extends z.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e}hitTest(e){return null}_drawImpl(e){}_drawBackgroundImpl(e){const{context:t,horizontalPixelRatio:i,bitmapSize:s}=e,r=this._data;for(let e=0;e<r.items.length;++e){const n=r.items[e];if(null==n.color)continue;t.fillStyle=n.color;const o=Math.round(n.left*i)+1,a=Math.round(n.right*i);t.fillRect(o,0,a-o+1,s.height)}}}var j=i(83085),G=i(64559);class q extends G.StudyForceOverlayPlotView{constructor(e,t,i,s){super(t,i,s),this._items=[],this._invalidated=!0,this._isMarkersEnabled=W.enabled("source_selection_markers"),this._study=e;const r=this._study.metaInfo().plots;for(let e=0;e<r.length;e++){const t=r[e];t.id===this._plotName&&(this._plotIndex=e,(0,o.assert)((0,I.isBgColorerPlot)(t),"Plot '"+this._plotName+"' is not a background colorer!"))}this._colorProvider=(0,j.createStudyPlotColorProvider)(e.metaInfo(),e.properties(),s)}items(){return this._items}update(){this._invalidated=!0}renderer(){if(1!=(1&(0,o.ensureDefined)(this._study.properties().childs().styles.childs()[this._plotName]).childs().display.value()))return null;if(!this._scalesReady())return null;this._invalidated&&(this._updateImpl(),this._invalidated=!1);const e={items:this._items},t=new H.CompositeRenderer;return t.append(new U(e)),t}_scalesReady(){const e=this._model.timeScale(),t=this._priceScale();return e&&!e.isEmpty()&&null!==t&&!t.isEmpty()}_getTranspValue(){const e=(0,o.ensureDefined)(this._study.properties().childs().styles.childs()[this._plotName]).childs();let t=0;return e.transparency&&(t=e.transparency.value(),t=(0,B.isNumber)(t)?t:40),t}_updateImpl(){this._items=[],(0,o.assert)(this._scalesReady(),"Scales must be ready!")
;const e=this._model.timeScale().visibleBarsStrictRange();if(null===e)return;const t=this._getTranspValue();let i=(0,o.ensureDefined)(this._series.nearestIndex(e.firstBar(),b.PlotRowSearchMode.NearestRight)),s=(0,o.ensureDefined)(this._series.nearestIndex(e.lastBar(),b.PlotRowSearchMode.NearestLeft));const r=this._study.offset(this._plotName);r>0?(i-=r,s+=r):(i+=r,s-=r);const n=this._study.getMinFirstBarIndexForPlot(this._plotName);if(n>s)return;i=Math.max(n,i);const a=this._study.data();for(const e of a.rangeIterator(i,s)){let i=e.index;const s=e.value;i+=r;const n={timePointIndex:Math.floor(i),left:NaN,center:NaN,right:NaN};let a=(0,B.isNumber)(t)?t:50;a=Math.min(a,100),a=Math.max(a,0);const l=this._colorProvider.getPlotPointStyle(s);void 0!==l.colors[1]&&(n.color=(0,p.generateColor)((0,o.ensureDefined)(l.colors[1]),a)),this._items.push(n)}this._model.timeScale().fillBarBorders(this._items)}}var $,K,Y,Z=i(86129),X=i(11064),J=i(31785),Q=i(9859),ee=i(66540),te=i(3070),ie=i(13380),se=i(86441),re=i(34026),ne=i(50335),oe=i(56468),ae=i(63812),le=i(68979),ce=i(27714),he=i(7114);!function(e){e.Left="left",e.Right="right",e.Center="center"}($||($={})),function(e){e.Top="top",e.Bottom="bottom",e.Middle="middle"}(K||(K={})),function(e){e.Left="left",e.Center="center",e.Right="right"}(Y||(Y={}));const de=(0,he.createDisconnectedCanvas)(document,(0,ce.size)({width:0,height:0}),1);class ue{constructor(e,t,i,s,r,n="center",a=0){this._lines=e.split(/[^\S\r\n]*(?:\r\n|\r|\n)/),this._font=function(e,t,i,s){return(0,le.makeFont)(s,i,`${e?"bold ":""}${t?"italic ":""}`)}(t,i,s,r),this._fontSize=r,this._verticalPadding=~~(r/6),this._textAlign=n,this._lineSpacing=a;const l=(0,o.ensureNotNull)(de.getContext("2d"));l.font=this._font,l.textBaseline="top";let c=0;for(let e=0;e<this._lines.length;++e){const t=this._lines[e],i=l.measureText(t).width;c=Math.max(c,i)}this.textImageWidth=c+1,this.textImageHeight=this._lines.length*r+(this._lines.length-1)*this._lineSpacing+this._verticalPadding}paintTo(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r}=e;i.save();const n=t.location;i.translate(Math.round(function(e,t,i){let s=e;switch(t){case"left":break;case"right":s-=i;break;case"center":s-=i/2}return Math.round(s)}(n.x,n.horzAlign,this.textImageWidth)*s),Math.round(function(e,t,i){let s=e;switch(t){case"top":break;case"bottom":s-=i;break;case"middle":s-=i/2}return Math.round(s)}(n.y,n.vertAlign,this.textImageHeight)*r));const o=t.style;let a;switch(i.textBaseline="top",i.font=this._font,i.lineJoin="round",i.fillStyle=o.fillStyle,o.strokeStyle&&(i.strokeStyle=o.strokeStyle),o.lineWidth&&(i.lineWidth=o.lineWidth),this._textAlign){case"left":a=0,i.textAlign="left";break;case"right":a=this.textImageWidth-1,i.textAlign="right";break;default:a=this.textImageWidth/2,i.textAlign="center"}let l=this._verticalPadding;(0,he.drawScaled)(i,s,r,(()=>{for(const e of this._lines)o.strokeStyle&&i.strokeText(e,a,l),i.fillText(e,a,l),l+=this._fontSize,l+=this._lineSpacing})),i.restore()}}class pe extends ae.AbstractMapContainer{constructor(e){
super(),this._maxSize=e,this._keysQueue=[]}get(e){const{fontSize:t,text:i,align:s,font:r,lineSpacing:n=0}=e;if(!i||!t||!s)return null;const o=(0,le.makeFont)(t,r),a=(0,ae.getDefault3)(this._map,n,s,o,new Map);let l=a.get(i);return void 0!==l||(this._size>=this._maxSize?this._deleteFirstKey():++this._size,this._keysQueue.push([o,s,n,i]),l=new ue(i,e.bold,e.italic,r,t,s,n),a.set(i,l)),l}_deleteFirstKey(){const e=this._keysQueue.shift(),[t,i,s,r]=e,n=(0,o.ensureDefined)(this._map.get(s)),a=(0,o.ensureDefined)(n.get(i)),l=(0,o.ensureDefined)(a.get(t));l.delete(r),0===l.size&&a.delete(t),0===a.size&&n.delete(i),0===n.size&&this._map.delete(s)}}var _e,me=i(15938),ge=i(49483);!function(e){e.Transparent="rgba(0, 0, 0, 0)"}(_e||(_e={}));class fe extends z.BitmapCoordinatesPaneRenderer{constructor(e,t={skipRenderingOptimizations:!1}){super(),this._items=[],this._barSpacing=0,this._vertOffset=0,this._textCache=t.textCache||new pe(5e3),this._drawOperation=t.skipRenderingOptimizations?this._drawWithoutOptimizations.bind(this):this._drawWithOptimizations.bind(this),null!==e&&this.setData(e)}hitTest(e){const t=oe.HitTarget.Regular;let i=null;for(const s of this._items){if(!s)continue;const r=this._calcBoundingBox(s);if(r&&(0,re.pointInBox)(e,r)){const e={tooltip:this._getTooltip(s,r)};i=new oe.HitTestResult(t,e)}}return i}setData(e){var t,i,s,r;if(this._height=void 0!==e.height?e.height:e.width,this._width=void 0!==e.width?e.width:e.height,this._color=e.color,this._borderColor=e.borderColor,this._vertOffset=e.vertOffset||0,e.text&&(this._text=e.text,this._fontSize=e.fontSize,this._lineSpacing=e.lineSpacing,this._textColor=e.textColor,this._textAlign=e.textAlign||"center"),void 0!==e.items&&void 0!==e.barSpacing){const n=null!==(i=null===(t=e.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,o=null!==(r=null===(s=e.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:e.items.length;this.setItems(o>n?e.items.slice(n,o):[],e.barSpacing)}}setItems(e,t){this._setBaseData(e,t)}_drawImpl(e){this._preDrawInit(),this._drawOperation(e)}_calcBoundingBox(e){const t=e.vertOffset,i=this._getTextCache(e);if(!i)return;const s=i.textImageWidth,r=i.textImageHeight,n=s/2,o=e.y+t+e.textVertOffset,a=t>0?0:-r,l=t>0?r:0,c=new se.Point(e.center-n,o+a),h=new se.Point(e.center+n,o+l);return(0,se.box)(c,h)}_unionBox(e,t){const i=Math.min(e.min.x,t.min.x),s=Math.max(e.max.x,t.max.x),r=Math.min(e.min.y,t.min.y),n=Math.max(e.max.y,t.max.y),o=new se.Point(i,r),a=new se.Point(s,n);return(0,se.box)(o,a)}_getTooltip(e,t){if(e.tooltip)return{content:{type:"text",data:e.tooltip},tooltipDelay:200,extendMargin:!0,rect:{x:t.min.x,y:t.min.y,w:Math.abs(t.max.x-t.min.x),h:Math.abs(t.max.y-t.min.y)}}}_setBaseData(e,t){this._items.length=0,this._barSpacing=t;for(const t of e){if((0,ne.isNaN)(t.y))continue;const e=void 0===t.width?(0,o.ensureDefined)(this._width):t.width,i=void 0===t.height?(0,o.ensureDefined)(this._height):t.height,s=void 0===t.vertOffset?this._vertOffset:t.vertOffset,r=s>0?i:-i;this._items.push({width:e,height:i,
vertOffset:s,textVertOffset:r,shapeWidth:0,shapeHeight:0,stepX:0,stepY:0,...t})}}_drawItemText(e,t){const i=this._getTextCache(t);if(null===i)return;const s=t.center,r=t.vertOffset,n=t.y+r+t.textVertOffset;let o;o=t.style&&void 0!==t.style.textColor?t.style.textColor:this._textColor;const a={style:{fillStyle:o},location:{x:s,y:n,horzAlign:$.Center,vertAlign:r>0?K.Top:K.Bottom}};i.paintTo(e,a)}_drawWithOptimizations(e){let t,i,s=null,r=!1;for(const n of this._items)(0,ne.isNaN)(n.y)||(n.style&&void 0!==n.style.color?(t=n.style.color||"rgba(0, 0, 0, 0)",i=n.style.borderColor||"rgba(0, 0, 0, 0)"):(t=this._color,i=this._borderColor),(s!==t||ge.isSafari)&&(s=t,r&&this._endPath(e),this._startPath(e,t,i)),this._drawItemShape(e,n),r=!0);r&&this._endPath(e);for(const t of this._items)(0,ne.isNaN)(t.y)||this._drawItemText(e,t)}_drawWithoutOptimizations(e){let t,i;for(const s of this._items){if((0,ne.isNaN)(s.y))continue;const r=(0,o.ensureDefined)(s.style);t=r.color||"rgba(0, 0, 0, 0)",i=r.borderColor||"rgba(0, 0, 0, 0)",this._startPath(e,t,i),this._drawItemShape(e,s),this._endPath(e),this._drawItemText(e,s)}}_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r}=e;(0,he.drawScaled)(i,s,r,(()=>this._drawItemShapeUsingCSSPixels(i,t)))}_drawItemShapeUsingCSSPixels(e,t){}_preDrawInit(){}_startPath(e,t,i){}_endPath(e){}_getTextCache(e){var t,i;const s=e.text||this._text,r=e.fontSize||this._fontSize,n=null!==(t=e.lineSpacing)&&void 0!==t?t:this._lineSpacing,o=e.textAlign||this._textAlign,a=null!==(i=e.font)&&void 0!==i?i:me.CHART_FONT_FAMILY;return this._textCache.get({text:s,bold:!1,italic:!1,font:a,fontSize:r,lineSpacing:n,align:o})}}class ve extends fe{_startPath(e,t,i){const s=e.context;s.beginPath(),s.lineWidth=this._lineWidth(e),s.lineCap="butt",s.strokeStyle=t}_endPath(e){e.context.stroke()}_lineWidth(e){return Math.max(1,Math.floor(2*e.horizontalPixelRatio))}}class ye extends fe{_startPath(e,t,i){const s=e.context;s.beginPath(),s.lineWidth=this._lineWidth(e),s.lineCap="butt",s.fillStyle=t,s.strokeStyle=i}_endPath(e){const t=e.context;t.fill(),t.stroke()}_lineWidth(e){return Math.max(1,Math.floor(e.horizontalPixelRatio))}}class Se extends ye{constructor(){super(...arguments),this._sign=0,this._thinArrow=!1,this._thinArrowLineWidth=0,this._headHeight=0,this._arrowWidth=0}setItems(e,t){this._setBaseData(e,t)}_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r}=e,n=this._lineWidth(e)%2?.5:0,o=this._sign,a=this._arrowWidth,l=this._headHeight,c=Math.abs(t.height),h=Math.round(t.center*s)+n,d=t.vertOffset,u=Math.round((t.y+d+o*c/2)*r)+n,p=(0,Q.ceiledEven)(a*s),_=p/2,m=Math.round(c*r),g=Math.round(l*r);i.translate(h,u),this._thinArrow?(i.moveTo(0,0),i.lineTo(-_,-_*o),i.moveTo(0,0),i.lineTo(_,-_*o),i.moveTo(0,0),i.lineTo(0,-m*o),i.moveTo(-_,-m*o),i.lineTo(_,-m*o)):(i.moveTo(0,0),m<g?(i.lineTo(p,-m*o),i.lineTo(-p,-m*o)):(i.lineTo(p,-g*o),i.lineTo(_,-g*o),i.lineTo(_,-m*o),i.lineTo(-_,-m*o),i.lineTo(-_,-g*o),i.lineTo(-p,-g*o)),i.lineTo(0,0)),i.translate(-h,-u)}_preDrawInit(){
const e=this._calculateWidth();this._arrowWidth=e,this._sign=this._isUp()?-1:1,this._thinArrow=e<4,this._thinArrowLineWidth=Math.max(e/2,1),this._headHeight=Math.round(e)}_startPath(e,t,i){const s=e.context;s.beginPath(),s.fillStyle=t,s.strokeStyle=i,s.lineWidth=this._lineWidth(e)}_lineWidth(e){return this._thinArrow?this._thinArrowLineWidth:super._lineWidth(e)}_calcBoundingBox(e){const t=e.vertOffset,i=this._sign,s=this._arrowWidth,r=this._headHeight,n=Math.abs(e.height),o=e.center-s,a=o+2*s,l=e.y+t+i*Math.round(n/2),c=l+(-n-r)*i,h=new se.Point(o,l),d=new se.Point(a,c);let u=(0,se.box)(h,d);const p=super._calcBoundingBox(e);return p&&(u=this._unionBox(u,p)),u}_calculateWidth(){return Math.round(this._barSpacing/4)}}const be=2*Math.PI;class we extends ye{setItems(e,t){this._setBaseData(e,t);for(const e of this._items){if(e.fontSize){const t=e.fontSize;e.stepX=Math.round(t/1.5),e.stepY=Math.round(t/2)-1}else{const t=e.height;e.stepX=Math.round(t/2*.65)+.5,e.stepY=e.stepX}e.vertOffset=this._calcVertOffset(e);const t=this._getTextCache(e);if(null===t){e.shapeWidth=2*e.stepX,e.shapeHeight=2.5*e.stepY;continue}const i=t.textImageWidth,s=t.textImageHeight;e.shapeWidth=i+2*e.stepX,e.shapeHeight=s+2*e.stepY,e.vertOffset=this._calcVertOffset(e),e.textHorizOffset=this._getHorizontalTextOffset(e),e.textVertOffset=this._getVerticalTextOffset(e)}}_calcVertOffset(e){return e.vertOffset}_drawCorner(e,t,i,s){const{context:r,horizontalPixelRatio:n}=e,o=Math.max(1,Math.floor(2*n));r.lineTo(t-o*s.prevPointSignX,i-o*s.prevPointSignY),r.arcTo(t,i,t+o*s.nextPointSignX,i+o*s.nextPointSignY,o)}_getArrowSize(e){return e.stepX}_getHorizontalTextOffset(e){return 0}_getVerticalTextOffset(e){return 0}_hasText(e){return Boolean(e.text)||Boolean(this._text)}_drawItemText(e,t){var i;const s=this._getTextCache(t);if(null===s)return;const r=t.textHorizOffset||0,n=t.center+r,a=t.vertOffset,l=t.y+a+t.textVertOffset,c=(null===(i=t.style)||void 0===i?void 0:i.textColor)||this._textColor,h={style:{fillStyle:(0,o.ensureDefined)(c)},location:{x:n,y:Math.floor(l),horzAlign:$.Center,vertAlign:K.Middle}};s.paintTo(e,h)}}class Ce{constructor(e,t,i,s){this.prevPointSignX=e,this.prevPointSignY=t,this.nextPointSignX=i,this.nextPointSignY=s}}var Pe;!function(e){e.rightUp=new Ce(1,0,0,1),e.rightDown=new Ce(0,1,-1,0),e.leftDown=new Ce(-1,0,0,-1),e.leftUp=new Ce(0,-1,1,0)}(Pe||(Pe={}));class xe extends ye{_calcBoundingBox(e){const t=e.width,i=e.height,s=t/2,r=Math.round(i/3),n=e.center,o=e.vertOffset-2*r,a=e.y+o,l=n-s,c=n+s,h=a,d=a+i,u=new se.Point(l,h),p=new se.Point(c,d);let _=(0,se.box)(u,p);const m=super._calcBoundingBox(e);return m&&(_=this._unionBox(_,m)),_}}var Te=i(29981),Ie=i(35864);const Me=new Map;Me.set("PaneRendererArrowUp",class extends Se{_isUp(){return!0}}),Me.set("PaneRendererArrowDown",class extends Se{_isUp(){return!1}}),Me.set("PaneRendererCircleShape",class extends ye{_drawItemShapeUsingCSSPixels(e,t){const i=Math.max(t.width,t.height)/2,s=t.center,r=t.vertOffset,n=t.y+r;e.moveTo(s+i,n),e.arc(s,n,i,0,be,!1)}_calcBoundingBox(e){
const t=Math.max(e.width,e.height)/2,i=e.center,s=e.vertOffset,r=e.y+s,n=i-t,o=i+t,a=r-t,l=r+t,c=new se.Point(n,a),h=new se.Point(o,l);let d=(0,se.box)(c,h);const u=super._calcBoundingBox(e);return u&&(d=this._unionBox(d,u)),d}}),Me.set("PaneRendererCrossShape",class extends ve{_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r}=e,n=t.width,o=t.height,a=t.center-n/2,l=t.vertOffset,c=t.y-o/2+l,h=this._lineWidth(e),d=h%2?.5:0,u=Math.round(a*s);let p=Math.round((a+n)*s);(p-u)%2!=h%2&&(p+=1);const _=Math.floor((u+p)/2)+d,m=Math.round(c*r);let g=Math.round((c+o)*r);(g-m)%2!=h%2&&(g+=1);const f=Math.floor((m+g)/2)+d;i.moveTo(_,m),i.lineTo(_,g),i.moveTo(u,f),i.lineTo(p,f)}_calcBoundingBox(e){const t=e.width,i=e.height,s=e.center-t/2,r=e.vertOffset,n=e.y-i/2+r,o=s,a=s+t,l=n,c=n+i,h=new se.Point(o,l),d=new se.Point(a,c);let u=(0,se.box)(h,d);const p=super._calcBoundingBox(e);return p&&(u=this._unionBox(u,p)),u}}),Me.set("PaneRendererDiamond",class extends ye{_drawItemShapeUsingCSSPixels(e,t){const i=Math.round(t.height/2),s=t.center,r=t.vertOffset,n=t.y+r;e.moveTo(s,n-i),e.lineTo(s+i,n),e.lineTo(s,n+i),e.lineTo(s-i,n),e.lineTo(s,n-i)}_calcBoundingBox(e){const t=Math.round(e.height/2),i=e.center,s=e.vertOffset,r=e.y+s,n=i-t,o=i+t,a=r-t,l=r+t,c=new se.Point(n,a),h=new se.Point(o,l);let d=(0,se.box)(c,h);const u=super._calcBoundingBox(e);return u&&(d=this._unionBox(d,u)),d}}),Me.set("PaneRendererFlagShape",class extends ye{_drawItemShapeUsingCSSPixels(e,t){const i=t.width,s=t.height,r=s/2,n=(i-3)/3,o=t.center-i/2,a=t.vertOffset,l=t.y-r+a;e.moveTo(o,l),e.lineTo(o+3,l),e.bezierCurveTo(o+n,l-n,o+2*n,l+n,o+i,l),e.lineTo(o+i,l+r),e.bezierCurveTo(o+i-n,l+r+n,o+i-2*n,l+r-n,o+3,l+r),e.lineTo(o+3,l+s),e.lineTo(o,l+s),e.lineTo(o,l)}_calcBoundingBox(e){const t=e.width,i=e.height,s=i/2,r=e.center-t/2,n=e.vertOffset,o=e.y-s+n,a=r,l=r+t,c=o,h=o+i,d=new se.Point(a,c),u=new se.Point(l,h);let p=(0,se.box)(d,u);const _=super._calcBoundingBox(e);return _&&(p=this._unionBox(p,_)),p}}),Me.set("PaneRendererLabelUp",class extends we{_calcBoundingBox(e){const t=e.center-e.shapeWidth/2,i=e.center+e.shapeWidth/2,s=e.y+e.vertOffset,r=e.y+e.shapeHeight+e.vertOffset,n=new se.Point(t,s),o=new se.Point(i,r);return(0,se.box)(n,o)}_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r}=e,n=this._lineWidth(e)%2?.5:0,o=Math.max(1,Math.floor(s))%2?.5:0,a=this._getArrowSize(t);let l=Math.round(a*s);(o+l)%1!=n%1&&(l+=.5);let c=Math.round(t.shapeWidth/2*s);(o+c)%1!=n%1&&(c+=.5);const h=Math.round(t.center*s)+o,d=Math.round((t.y+t.vertOffset)*r)+n,u=h-l,p=Math.round((t.y+t.vertOffset+a)*r)+n,_=h+l,m=h+c,g=Math.round((t.y+t.vertOffset+a+t.shapeHeight)*r)+n,f=h-c;i.moveTo(u,p),i.lineTo(h,d),i.lineTo(_,p),t.shapeWidth<=2*a?(i.lineTo(m,p),this._drawCorner(e,m,g,Pe.rightDown),this._drawCorner(e,f,g,Pe.leftDown),i.lineTo(f,p)):(this._drawCorner(e,m,p,Pe.rightUp),this._drawCorner(e,m,g,Pe.rightDown),this._drawCorner(e,f,g,Pe.leftDown),this._drawCorner(e,f,p,Pe.leftUp)),i.lineTo(u,p)}_getVerticalTextOffset(e){
return e.shapeHeight/2+this._getArrowSize(e)}_calcVertOffset(e){return Math.sign(e.vertOffset)>=0?e.vertOffset:e.vertOffset-e.shapeHeight}}),Me.set("PaneRendererLabelDown",class extends we{_calcBoundingBox(e){const t=e.center-e.shapeWidth/2,i=e.center+e.shapeWidth/2,s=e.y-e.shapeHeight+e.vertOffset,r=e.y+e.vertOffset,n=new se.Point(t,s),o=new se.Point(i,r);return(0,se.box)(n,o)}_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r}=e,n=this._lineWidth(e)%2?.5:0,o=Math.max(1,Math.floor(s))%2?.5:0,a=this._getArrowSize(t);let l=Math.round(a*s);(o+l)%1!=n%1&&(l+=.5);let c=Math.round(t.shapeWidth/2*s);(o+c)%1!=n%1&&(c+=.5);const h=Math.round(t.center*s)+o,d=Math.round((t.y+t.vertOffset)*r)+n,u=h+l,p=Math.round((t.y+t.vertOffset-a)*r)+n,_=h-l,m=h+c,g=Math.round((t.y+t.vertOffset-t.shapeHeight-a)*r)+n,f=h-c;i.moveTo(u,p),i.lineTo(h,d),i.lineTo(_,p),t.shapeWidth<=2*a?(i.lineTo(f,p),this._drawCorner(e,f,g,Pe.leftUp),this._drawCorner(e,m,g,Pe.rightUp),i.lineTo(m,p)):(this._drawCorner(e,f,p,Pe.leftDown),this._drawCorner(e,f,g,Pe.leftUp),this._drawCorner(e,m,g,Pe.rightUp),this._drawCorner(e,m,p,Pe.rightDown)),i.lineTo(u,p)}_getVerticalTextOffset(e){return-e.shapeHeight/2-this._getArrowSize(e)}_calcVertOffset(e){return Math.sign(e.vertOffset)<=0?e.vertOffset:e.vertOffset+e.shapeHeight}}),Me.set("PaneRendererSquare",class extends ye{_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r}=e,n=Math.max(1,Math.floor(s))%2?.5:0,o=this._lineWidth(e)%2?.5:0;let a=Math.round(t.height/2*r);(n+a)%1!=o%1&&(a+=.5);const l=Math.round(t.center*s)+n,c=Math.round((t.y+t.vertOffset)*r)+n,h=l-a,d=c-a,u=l+a,p=c+a;i.rect(h,d,u-h,p-d)}_calcBoundingBox(e){const t=e.height,i=Math.round(t/2),s=e.center-i,r=e.vertOffset,n=e.y+r-i,o=s,a=s+t,l=n,c=n+t,h=new se.Point(o,l),d=new se.Point(a,c);let u=(0,se.box)(h,d);const p=super._calcBoundingBox(e);return p&&(u=this._unionBox(u,p)),u}}),Me.set("PaneRendererTriangleApexUp",class extends xe{_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r}=e,n=t.width,o=t.height,a=Math.round(o/3),l=t.vertOffset-2*a,c=this._lineWidth(e)%2?.5:0,h=Math.max(1,Math.floor(s)),d=h%2?.5:0;let u=Math.round(n*s);u%2!=h%2&&(u+=1);const p=Math.round(t.center*s)+d,_=Math.round((t.y+l)*r),m=p+u/2,g=Math.round((t.y+l+o)*r)+c,f=p-u/2;i.moveTo(p,_),i.lineTo(m,g),i.lineTo(f,g),i.lineTo(p,_)}}),Me.set("PaneRendererTriangleApexDown",class extends xe{_drawItemShape(e,t){const{context:i,horizontalPixelRatio:s,verticalPixelRatio:r}=e,n=t.width,o=t.height,a=Math.round(o/3),l=t.vertOffset-a,c=this._lineWidth(e)%2?.5:0,h=Math.max(1,Math.floor(s)),d=h%2?.5:0;let u=Math.round(n*s);u%2!=h%2&&(u+=1);const p=Math.round(t.center*s)+d,_=Math.round((t.y+l)*r)+c,m=p+u/2,g=Math.round((t.y+l+o)*r),f=p-u/2;i.moveTo(f,_),i.lineTo(m,_),i.lineTo(p,g),i.lineTo(f,_)}}),Me.set("PaneRendererXCross",class extends ve{_drawItemShapeUsingCSSPixels(e,t){const i=t.width,s=t.height,r=t.center-i/2,n=t.vertOffset,o=t.y-s/2+n;e.moveTo(r,o),e.lineTo(r+i,o+s),e.moveTo(r,o+s),e.lineTo(r+i,o)}
_calcBoundingBox(e){const t=e.width,i=e.height,s=e.center-t/2,r=e.vertOffset,n=e.y-i/2+r,o=s,a=s+t,l=n,c=n+i,h=new se.Point(o,l),d=new se.Point(a,c);let u=(0,se.box)(h,d);const p=super._calcBoundingBox(e);return p&&(u=this._unionBox(u,p)),u}});class Ae extends Ie.StudyPaneViewInplaceUpdatable{constructor(e,t,i,s){var r;super(t,i,s),this._renderer=null,this._shapesRenderer=null,this._selectionRenderer=null,this._isMarkersEnabled=W.enabled("source_selection_markers"),this._study=e;const n=e.metaInfo().plots;for(let e=0;e<n.length;e++)if(n[e].id===this._plotName){this._plotIndex=e;break}this._plotStyleInfo=(0,o.ensureDefined)(null===(r=e.metaInfo().styles)||void 0===r?void 0:r[this._plotName]),this._colorProvider=(0,j.createStudyPlotColorProvider)(e.metaInfo(),e.properties(),s),this._selectionIndexer=new ee.SelectionIndexes(i.timeScale())}items(){return this._items}renderer(){return this._isPlotVisible()&&this._scalesReady()?(this._makeSureRendererIsValid(),this._renderer):null}_isPlotVisible(){return this._study.isPlotVisibleAt(this._plotName,1)}_scalesReady(){const e=this._model.timeScale(),t=this._priceScale();return e&&null!==t&&!e.isEmpty()&&!t.isEmpty()}_updateImplFull(e){var t;if((null===(t=this._dataInvalidated)||void 0===t?void 0:t.clearData)&&(this._items=[],this._renderer=null),!this._scalesReady())return!1;const i=this._model.timeScale(),s=this._priceScale(),r=i.visibleBarsStrictRange();if(null===r||null===s)return!1;const n=this._study.plots().plottableRange(!1);if(0===n.size())return!1;const a=this._study.offset(this._plotName),l=this._study.firstValue();if(null===l)return!1;this._updateAdditionalPrices(s,l);const{hiPlot:c,loPlot:h}=this._hiLoPlots(),d=this._preallocateItems(n,((e,t)=>this._createItem(e,null!=t?t:null,c,h,a)));let u=this._series.nearestIndex(r.firstBar(),b.PlotRowSearchMode.NearestRight),p=this._series.nearestIndex(r.lastBar(),b.PlotRowSearchMode.NearestLeft);if(void 0===u||void 0===p)return!1;a>0?(u-=a,p+=a):(u+=a,p-=a);const _=this._study.getMinFirstBarIndexForPlot(this._plotName);if(_>p)return!0;u=Math.max(_,u);const m=this._getTranspValue(),g=this._study.properties().childs().styles.childs()[this._plotName].childs(),f=g.color.value(),v=g.textColor?g.textColor.value():void 0,y=f,S=f,w=void 0===v?void 0:v,C=(0,o.ensureNotNull)(this._plotIndex),P=(0,ie.createEmptyStyle)(),x=null!=d?d:(0,o.ensureNotNull)(n.firstIndex()),T=n.rangeIterator(x,(0,o.ensureNotNull)(n.lastIndex())+1);let I=(0,Te.lowerbound)(this._items,x+a,((e,t)=>e.timePointIndex<t));for(const e of T){const t=e.value,i=t[C+1];if(null==i){I++;continue}const s=this._items[I];if(!isNaN(s.origPrices.price)){if(this._colorProvider.isColorDefined()){s.style={color:y,borderColor:S,textColor:w};const e=this._colorProvider.getPlotPointStyle(t,P);this._fillItemWithPointStyle(s,e,m)}}I++}return this._updateImplLight(),!0}_fillItemWithPointStyle(e,t,i){const s=(0,o.ensureDefined)(e.style);if(void 0!==t.colors[0]){s.color=(0,p.generateColor)((0,o.ensureDefined)(t.colors[0]),i);const e=i>9?i-10:0;s.borderColor=(0,p.generateColor)(s.color,e)}
void 0!==t.colors[2]&&(s.textColor=(0,p.generateColor)((0,o.ensureDefined)(t.colors[2]),i))}_updateRenderer(e,t){this._makeSureRendererIsValid();const i=this._model.timeScale(),s={},r=this._getTranspValue(),n=i.barSpacing(),o=this._calculateShapeHeight(n),a=this._study.properties().childs().styles.childs()[this._plotName].childs(),l=a.location.value(),c=this._calculateVerticalOffset(l,o+o/2);s.barSpacing=n,s.items=this._items,s.color=(0,p.generateColor)(a.color.value(),r),s.height=o,s.vertOffset=c,s.visibleItemsRange={startItemIndex:e,endItemIndex:t};const h=a.plottype.value(),d=J.plotShapesData[h],u=new H.CompositeRenderer;d&&(this._shapesRenderer?this._shapesRenderer.setData(s):(this._shapesRenderer=this._createRenderer(d.paneRendererClass,s),u.append(this._shapesRenderer))),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&null!==this._selectionData&&(this._selectionData.vertOffset=c,u.append(new X.SelectionRenderer(this._selectionData))),this._renderer=u}_createRenderer(e,t){const i=Me.get(e);return new((0,o.ensureDefined)(i))(t)}_getSeriesVal(e,t){const i=(0,te.barFunction)(e),s=this._series.data().valueAt(t);return null===s?null:i(s)}_getTranspValue(){let e=0;const t=this._study.properties().childs();t.transparency&&(e=t.transparency.value(),e=(0,B.isNumber)(e)?e:50);const i=t.styles.childs()[this._plotName].childs();return i.transparency&&(e=i.transparency.value(),e=(0,B.isNumber)(e)?e:50),(0,Q.clamp)(e,0,100)}_createItem(e,t,i,s,r){const n=this._study.properties().childs().styles.childs()[this._plotName].childs().location.value(),a={origPrices:{price:NaN},timePointIndex:e+r};if((null===t||0===t)&&n!==w.MarkLocation.Absolute)return a;if(null==t)return a;let l=NaN;switch(n){case w.MarkLocation.AboveBar:{const t=this._getLocationPrice(e,i,r);if(null===t)return a;l=t;break}case w.MarkLocation.BelowBar:{const t=this._getLocationPrice(e,s,r);if(null===t)return a;l=t;break}case w.MarkLocation.Absolute:l=(0,o.ensureNotNull)(t);break;case w.MarkLocation.Top:case w.MarkLocation.Bottom:l=0;break;default:throw new Error("Bad value: "+n)}return{y:NaN,origPrices:{price:l},timePointIndex:e+r}}_dependsOnSeriesData(){const e=this._study.properties().childs().styles.childs()[this._plotName].childs().location.value();return e===w.MarkLocation.AboveBar||e===w.MarkLocation.BelowBar}_getValueForUpdating(e){const t=e.value[this._plotIndex+1];if(null==t)return null;const i=this._study.properties().childs().styles.childs()[this._plotName].childs().location.value();if(0===t&&i!==w.MarkLocation.Absolute)return null;const s=this._study.offset(this._plotName),{hiPlot:r,loPlot:n}=this._hiLoPlots();switch(i){case w.MarkLocation.AboveBar:return this._getLocationPrice(e.index,r,s);case w.MarkLocation.BelowBar:return this._getLocationPrice(e.index,n,s)}return super._getValueForUpdating(e)}_convertItemsToCoordinates(e,t,i,s){for(let e=i;e<s;e++){const t=this._items[e];t.y=t.origPrices.price}this._model.timeScale().fillBarBorders(this._items)
;const r=this._study.properties().childs().styles.childs()[this._plotName].childs().location.value(),n=e.height()*e.topMargin(),o=e.height()*(1-e.bottomMargin()),a=e.isInverted(),l=a?o:n,c=a?n:o,h=e=>{for(let t=i;t<s;t++)isNaN(this._items[t].y)||(this._items[t].y=e)};switch(r){case w.MarkLocation.Top:h(l);break;case w.MarkLocation.Bottom:h(c);break;default:e.pointsArrayToCoordinates(this._items,t,{startItemIndex:i,endItemIndex:s})}}_calculateVerticalOffset(e,t){let i=0;switch(e){case w.MarkLocation.AboveBar:case w.MarkLocation.Bottom:i=-t;break;case w.MarkLocation.BelowBar:case w.MarkLocation.Top:i=t}return(0,o.ensureNotNull)(this._priceScale()).isInverted()&&(i*=-1),i}_calculateShapeHeight(e,t){let i=e;switch(t){case I.PlotSymbolSize.Tiny:i=.3*e;break;case I.PlotSymbolSize.Small:i=.6*e;break;case I.PlotSymbolSize.Normal:i=e;break;case I.PlotSymbolSize.Large:i=1.5*e;break;case I.PlotSymbolSize.Huge:i=2*e}return i}_hiLoPlots(){let e,t;let i=null;switch(this._series.properties().childs().style.value()){case 2:i="lineStyle";break;case 14:i="lineWithMarkersStyle";break;case 15:i="steplineStyle";break;case 3:i="areaStyle"}return i?(e=this._series.properties().childs()[i].childs().priceSource.value(),t=e):(e="high",t="low"),{hiPlot:e,loPlot:t}}_getLocationPrice(e,t,i){const s=Math.min(e+i,(0,o.ensureNotNull)(this._series.data().last()).index);return this._getSeriesVal(t,s)}}class Le extends Ae{_updateRenderer(e,t){var i;const s=this._study.properties().childs().styles.childs()[this._plotName].childs(),r=this._model.timeScale(),n={},o=this._getTranspValue(),a=r.barSpacing();let l;l=this._plotStyleInfo.size?this._calculateShapeHeight(25,this._plotStyleInfo.size):Math.round(a/2),l=Math.max(l,1);const c=s.location.value(),h=(0,p.generateColor)(s.color.value(),o),d=o>19?o-10:0,u=this._calculateVerticalOffset(c,Math.round(1.5*l));n.barSpacing=a,n.items=this.items(),n.color=h,n.borderColor=(0,p.generateColor)(s.color.value(),d),n.height=l,n.vertOffset=u,n.visibleItemsRange={startItemIndex:e,endItemIndex:t};const _=s.plottype.value(),m=J.plotShapesData[_],g=this._plotStyleInfo.text;if(void 0!==g&&""!==g.trim()){let e=g.trim().replace(/\\n/gm,"\n");e=(0,Z.cleanButAmpersand)(e,!0),n.text=e,n.fontSize=12;const t=s.textColor?s.textColor.value():void 0;n.textColor=t?(0,p.generateColor)(t,o):h}if(this._renderer&&this._shapesRenderer&&this._selectionRenderer)this._shapesRenderer.setData(n),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&null!==this._selectionData?(this._selectionData.vertOffset=u,this._selectionRenderer.setData(this._selectionData)):this._selectionRenderer.setData(null);else{const e=new H.CompositeRenderer;this._shapesRenderer=super._createRenderer(m.paneRendererClass,n),e.append(this._shapesRenderer),this._selectionRenderer=new X.SelectionRenderer(null!==(i=this._selectionData)&&void 0!==i?i:void 0),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&null!==this._selectionData?this._selectionData.vertOffset=u:this._selectionRenderer.setData(null),
e.append(this._selectionRenderer),this._renderer=e}}}var ke,De=i(87795),Ee=i.n(De),Ve=i(61993);!function(e){e[e.SimplifiedPaintingMaxFontSize=4]="SimplifiedPaintingMaxFontSize"}(ke||(ke={}));class Be extends fe{constructor(e,t){super(null,t),this._fontSizeEnsured=0,this._ch="",this._fontFamily=me.CHART_FONT_FAMILY,this._charCache=null,null!==e&&this.setData(e)}setData(e){super.setData(e),this._fontSizeEnsured=(0,o.ensureDefined)(this._height);const t=e.char.slice(0,40);this._ch=Ee()(t)[0]||" ",this._fontFamily=e.fontFamily||me.CHART_FONT_FAMILY}hitTest(e){const t=(0,Ve.interactionTolerance)().series+this._fontSizeEnsured/2;for(const i of this._items){if(new se.Point(i.center,i.y+i.vertOffset).subtract(e).length()<=t)return new oe.HitTestResult(oe.HitTarget.Regular)}return null}_drawItemShape(e,t){const i=t.center,s=t.vertOffset>0?1:-1,r=t.y+t.vertOffset-s*Math.round(this._fontSizeEnsured/2);let n;n=t.style&&void 0!==t.style.color?t.style.color:this._color;const o=this._textImageCache(),{context:a,horizontalPixelRatio:l,verticalPixelRatio:c}=e;if(this._fontSizeEnsured<=4/l){a.save();const e=Math.max(1,Math.floor(l));let s=Math.max(1,Math.floor(o.textImageWidth*l));s%2!=e%2&&(s+=s>1?-1:1);const h=Math.round(r*c)+(t.vertOffset>=0?0:-s);return a.fillStyle=n,a.fillRect(Math.round(i*l)+(l%2?.5:0)-s/2,h,s,s),void a.restore()}const h={style:{fillStyle:n},location:{x:i,y:r,horzAlign:$.Center,vertAlign:t.vertOffset>0?K.Top:K.Bottom}};o.paintTo(e,h)}_startPath(e,t,i){}_endPath(e){}_textImageCache(){return null!==this._charCache&&this._charCache.fontFamily===this._fontFamily&&this._charCache.fontSize===this._fontSizeEnsured||(this._charCache={fontSize:this._fontSizeEnsured,fontFamily:this._fontFamily,cache:new ue(this._ch,!1,!1,this._fontFamily,this._fontSizeEnsured,"center",0)}),this._charCache.cache}}class Re extends Ae{constructor(){super(...arguments),this._charRenderer=new Be(null)}_updateRenderer(e,t){var i,s;const r=this._getTranspValue(),n=this._model.timeScale().barSpacing();let a;const l=this._study.properties().childs().styles.childs()[this._plotName].childs();a=this._plotStyleInfo.size?this._calculateShapeHeight(50,this._plotStyleInfo.size):Math.round(n);const c=l.location.value(),h=(0,p.generateColor)(l.color.value(),r),d=this._calculateVerticalOffset(c,a),u={items:this.items(),barSpacing:n,char:(0,o.ensureDefined)(null!==(s=null===(i=l.char)||void 0===i?void 0:i.value())&&void 0!==s?s:this._plotStyleInfo.char),height:a,vertOffset:d,color:h,visibleItemsRange:{startItemIndex:e,endItemIndex:t}},_=this._plotStyleInfo.text;if(void 0!==_&&""!==_.trim()){let e=_.trim().replace(/\\n/gm,"\n");e=(0,Z.cleanButAmpersand)(e,!0),u.text=e,u.fontSize=12;const t=l.textColor?l.textColor.value():void 0;u.textColor=t?(0,p.generateColor)(t,r):h}this._charRenderer.setData(u);const m=new H.CompositeRenderer;m.append(this._charRenderer),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&null!==this._selectionData&&(this._selectionData.vertOffset=d,m.append(new X.SelectionRenderer(this._selectionData))),
this._renderer=m}}var Ne=i(24377);class Oe{constructor(e,t,i,s,r){this.left=NaN,this.right=NaN,this.height=NaN,this.center=e,this.y=t,this.origHeight=i,this.isUp=s,this.origPrices=r,this.timePointIndex=e,this.style={}}}function Fe(e){return Math.round(e/4)}function We(e){return Math.round(e/2)}class He extends z.BitmapCoordinatesPaneRenderer{constructor(e){super(),this._data=e}hitTest(e){var t,i,s,r;const n=this._data,o=We(n.barSpacing),a=Math.round(o/2),l=Math.round(o),c=Fe(n.barSpacing),h=null!==(i=null===(t=n.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,d=null!==(r=null===(s=n.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:n.items.length;if(h>=d)return null;for(const t of n.items.slice(h,d)){if(!t)continue;if(!Number.isFinite(t.center)||!Number.isFinite(t.y))continue;const i=Math.abs(t.height),s=t.isUp?-1:1,r=i+l,n=t.y-s*c,o=n-s*r,h=t.center-a,d=t.center+a;if(h<e.x&&e.x<d&&(t.isUp?n<e.y&&e.y<o:o<e.y&&e.y<n))return new oe.HitTestResult(oe.HitTarget.Regular)}return null}_drawImpl(e){var t,i,s,r,n;const{horizontalPixelRatio:o,verticalPixelRatio:a,context:l}=e,c=this._data,h=We(c.barSpacing),d=Fe(c.barSpacing),u=h<4,p=Math.max(h/2,1),_=(0,Q.ceiledEven)(h*o),m=_/2,g=Math.round(h*a);l.lineCap="butt",l.lineWidth=Math.max(1,Math.floor(o));const f=l.lineWidth%2?.5:0,v=null!==(i=null===(t=c.visibleItemsRange)||void 0===t?void 0:t.startItemIndex)&&void 0!==i?i:0,y=null!==(r=null===(s=c.visibleItemsRange)||void 0===s?void 0:s.endItemIndex)&&void 0!==r?r:c.items.length;if(!(v>=y))for(const e of c.items.slice(v,y)){if(!Number.isFinite(e.center)||!Number.isFinite(e.y))continue;const t=e.isUp?-1:1,i=Math.round(Math.abs(e.height)*a),s=Math.round(e.center*o)+f,r=Math.round((e.y-t*d)*a)+f;l.beginPath(),l.translate(s,r);const h=null!==(n=e.style&&e.style.color)&&void 0!==n?n:e.isUp?c.colorup:c.colordown;u?(l.moveTo(0,0),l.lineTo(-m,-m*t),l.moveTo(0,0),l.lineTo(m,-m*t),l.moveTo(0,0),l.lineTo(0,-i*t),l.moveTo(-m,-i*t),l.lineTo(m,-i*t),l.lineWidth=p,l.strokeStyle=h,l.stroke()):(l.moveTo(0,0),i<g?(l.lineTo(_,-i*t),l.lineTo(-_,-i*t)):(l.lineTo(_,-g*t),l.lineTo(m,-g*t),l.lineTo(m,-i*t),l.lineTo(-m,-i*t),l.lineTo(-m,-g*t),l.lineTo(-_,-g*t)),l.lineTo(0,0),l.strokeStyle=e.isUp?c.colorBorderUp:c.colorBorderDown,l.stroke(),l.fillStyle=h,l.fill()),l.translate(-s,-r)}}}class ze extends X.SelectionRenderer{_drawMarker(e,t,i,s){const{context:r,horizontalPixelRatio:n,verticalPixelRatio:a}=e,l=(0,o.ensureNotNull)(this._data),c=t.isUp?1:-1;const h=i+c*Fe(l.barSpacing)+c*We(l.barSpacing);let d=Math.round(3.5*n*2);d%2!=s%2&&(d+=1);const u=s%2/2,p=Math.round(t.center*n)+u,_=Math.round((t.y+h)*a)+u;r.beginPath(),r.arc(p,_,d/2,0,2*Math.PI,!0),r.closePath(),r.fill(),r.stroke()}}class Ue extends Ae{_updateRenderer(e,t){const i=this._study.properties().childs().styles.childs()[this._plotName].childs(),s=(0,Q.clamp)(this._getTranspValue(),0,100),r=this._model.timeScale().barSpacing(),n=(0,p.generateColor)(i.colorup.value(),s),o=(0,p.generateColor)(i.colordown.value(),s),a=(0,
Ne.parseRgba)(n),l=a?100*(1-a[3]):0,c=(0,Ne.parseRgba)(o),h=c?100*(1-c[3]):0,d={items:this._items,barSpacing:r,colorup:n,colordown:o,colorBorderUp:(0,p.generateColor)("#000000",l),colorBorderDown:(0,p.generateColor)("#000000",h),minHeight:this._plotStyleInfo.minHeight,visibleItemsRange:{startItemIndex:e,endItemIndex:t}};this._updateItemsHeights(d);const u=new H.CompositeRenderer;if(u.append(new He(d)),this._model.selection().isSelected(this._study)&&null!==this._selectionData){const e=this._selectionData;e.barSpacing=r,u.append(new ze(e))}this._renderer=u}_fillItemWithPointStyle(e,t,i){const s=(0,o.ensureDefined)(e.style);e.isUp?void 0!==t.colors[5]?s.color=(0,p.generateColor)((0,o.ensureDefined)(t.colors[5]),i):s.color=(0,p.generateColor)(this._study.properties().childs().styles.childs()[this._plotName].childs().colorup.value(),i):void 0!==t.colors[6]?s.color=(0,p.generateColor)((0,o.ensureDefined)(t.colors[6]),i):s.color=(0,p.generateColor)(this._study.properties().childs().styles.childs()[this._plotName].childs().colordown.value(),i)}_getValueForUpdating(e){const t=e.value[this._plotIndex+1];if(!t)return null;const i=e.index,s=t>0,{hiPlot:r,loPlot:n}=this._hiLoPlots(),a=this._study.offset(this._plotName),l=Math.min(i+a,(0,o.ensureNotNull)(this._series.data().last()).index);if(s){const e=this._getSeriesVal(n,l);if(null!==e)return e}else{const e=this._getSeriesVal(r,l);if(null!==e)return e}return null}_updateItem(e,t){const i=this._getValueForUpdating(e),s=e.value[this._plotIndex+1]>0;return this._items[t].origPrices.price=null!=i?i:NaN,this._items[t].isUp=s,t+1}_createItem(e,t,i,s,r){const n={center:NaN,y:NaN,origPrices:{price:NaN,timePointIndex:NaN},origHeight:NaN};if(n.timePointIndex=e+r,!t)return n;const a=Math.min(e+r,(0,o.ensureNotNull)(this._series.data().last()).index),l=t>0;let c;if(l){const e=this._getSeriesVal(s,a);if(null===e)return n;c=e}else{const e=this._getSeriesVal(i,a);if(null===e)return n;c=e}return new Oe(e+r,c,t,l,{price:c,timePointIndex:e+r})}_dependsOnSeriesData(){return!0}_convertItemsToCoordinates(e,t,i,s){this._convertItemsToCoordinatesImpl(e,t,i,s)}_updateItemsHeights(e){var t,i,s,r,n,a,l,c;const h=this._study.properties().childs().styles.childs();let d=Math.abs((0,o.ensureDefined)(null!==(i=null===(t=h[this._plotName].childs().minHeight)||void 0===t?void 0:t.value())&&void 0!==i?i:this._plotStyleInfo.minHeight)),u=Math.abs((0,o.ensureDefined)(null!==(r=null===(s=h[this._plotName].childs().maxHeight)||void 0===s?void 0:s.value())&&void 0!==r?r:this._plotStyleInfo.maxHeight));if(d>u){const e=d;d=u,u=e}const p=this._items,_=null!==(a=null===(n=e.visibleItemsRange)||void 0===n?void 0:n.startItemIndex)&&void 0!==a?a:0,m=(null!==(c=null===(l=e.visibleItemsRange)||void 0===l?void 0:l.endItemIndex)&&void 0!==c?c:p.length)-1;let g=0;for(let e=_;e<=m;e++){const t=p[e],i=Math.abs(t.origHeight);i>g&&(g=i)}const f=(u-d)/g;for(let e=_;e<=m;e++){const t=p[e],i=Math.abs(t.origHeight);t.height=i*f+d}}}var je=i(59432);class Ge extends G.StudyForceOverlayPlotView{constructor(e,t,i,s){super(t,i,s),
this._bars=[],this._invalidated=!1,this._isMarkersEnabled=W.enabled("source_selection_markers"),this._selectionData=null,this._ohlcPlotIndexes=new Map,this._study=e,this._isMarkersEnabled=W.enabled("source_selection_markers"),this._colorProvider=(0,j.createStudyPlotColorProvider)(e.metaInfo(),e.properties(),s),this._selectionIndexer=new ee.SelectionIndexes(i.timeScale());const r=this._study.metaInfo().plots;for(let e=0;e<r.length;e++){const t=r[e];"target"in t&&(t.target===this._plotName&&((0,I.isOhlcOpenPlot)(t)&&this._ohlcPlotIndexes.set(1,e),(0,I.isOhlcHighPlot)(t)&&this._ohlcPlotIndexes.set(2,e),(0,I.isOhlcLowPlot)(t)&&this._ohlcPlotIndexes.set(3,e),(0,I.isOhlcClosePlot)(t)&&this._ohlcPlotIndexes.set(4,e)))}}update(){this._invalidated=!0}items(){return this._bars}_updateImpl(){this._bars.length=0;const e=this._priceScale();if(this._model.timeScale().isEmpty()||null===e||e.isEmpty())return;const t=this._model.timeScale().visibleBarsStrictRange();if(null===t)return;let i=this._series.nearestIndex(t.firstBar(),b.PlotRowSearchMode.NearestRight);const s=this._series.nearestIndex(t.lastBar(),b.PlotRowSearchMode.NearestLeft);if(void 0===i||void 0===s)return;const r=this._study.getMinFirstBarIndexForPlot(this._plotName);if(r>s)return;i=Math.max(r,i);const n=this._study.data(),a=this._study.firstValue(void 0,this.isForceOverlay());if(null===a)return;const l=n.rangeIterator(i,s),c=(0,o.ensureDefined)(this._study.properties().childs().ohlcPlots).childs()[this._plotName].childs(),h=new Map,d=(e,t)=>{const i=e+"@"+t;if(!h.has(i)){const s=(0,p.generateColor)(e,t);return h.set(i,s),s}return h.get(i)},u=(0,ie.createEmptyStyle)();for(const e of l){let t=e.index;const i=e.value;t=Math.floor(t);let s=!0;const r=new Map;for(let e=1;e<=4;++e){const t=this._ohlcPlotIndexes.get(e);if(void 0===t){s=!1;break}const n=i[t+1];if(null==n){s=!1;break}r.set(e,n)}if(!s)continue;const n=(0,o.ensureDefined)(r.get(1)),a=(0,o.ensureDefined)(r.get(4)),l=(0,o.ensureDefined)(r.get(2)),h=(0,o.ensureDefined)(r.get(3)),p=Math.max(n,l,h,a),_=Math.min(n,l,h,a);let m=(0,o.ensureDefined)(d(c.color.value(),0));const g=this._colorProvider.getPlotPointStyle(i,u);void 0!==g.colors[0]&&(m=(0,o.ensureDefined)(g.colors[0]));const f={open:n,high:p,low:_,close:a,color:m,wickColor:g.colors[4],borderColor:g.colors[3],hollow:null,center:NaN,left:NaN,right:NaN,timePointIndex:Math.round(t)};this._bars.push(f)}if(e.barPricesToCoordinates(this._bars,a),this._model.timeScale().fillBarBorders(this._bars),this._model.selection().isSelected(this._study)){const t=this._selectionIndexer.indexes();this._selectionData={points:[],hittestResult:oe.HitTarget.Regular,bgColors:[],visible:!0,barSpacing:this._model.timeScale().barSpacing()};const i=(0,o.ensureNotNull)(this._model.paneForSource(this._study)).height(),s=(0,o.ensureDefined)(this._ohlcPlotIndexes.get(4));for(let r=0;r<t.length;r++){const n=t[r],o=this._study.data().valueAt(n);if(null===o)continue;const l=o[s+1];if(null==l)continue;const c=this._model.timeScale().indexToCoordinate(Math.floor(n)),h=e.priceToCoordinate(l,a)
;this._selectionData.points.push(new se.Point(c,h)),this._selectionData.bgColors.push(this._model.backgroundColorAtYPercentFromTop(h/i))}}else this._selectionIndexer.clear()}_isOHLCPlotVisible(){return this._study.isPlotVisibleAt(this._plotName,1)}}class qe extends Ge{renderer(){if(!this._isOHLCPlotVisible())return null;this._invalidated&&(this._updateImpl(),this._invalidated=!1);const e={bars:this._bars,dontDrawOpen:this._series.properties().childs().barStyle.childs().dontDrawOpen.value(),thinBars:this._series.properties().childs().barStyle.childs().thinBars.value()},t=new H.CompositeRenderer;return t.append(new je.PaneRendererBars(e)),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&this._selectionData&&t.append(new X.SelectionRenderer(this._selectionData)),t}}var $e=i(25201);class Ke extends Ge{renderer(){if(!this._isOHLCPlotVisible())return null;const e=this._priceScale();if(!e||e.isEmpty())return null;this._invalidated&&(this._updateImpl(),this._invalidated=!1);const t=(0,o.ensureDefined)(this._study.properties().childs().ohlcPlots).childs()[this._plotName].childs(),i=this._model.timeScale().barSpacing(),s={bars:this._bars,barSpacing:i,wickVisible:t.drawWick.value(),bodyVisible:!0,borderVisible:t.drawBorder.value(),barWidth:(0,Ve.optimalBarWidth)(i),borderColor:t.borderColor.value(),wickColor:t.wickColor.value(),isPriceScaleInverted:e.isInverted()},r=new H.CompositeRenderer;return r.append(new $e.PaneRendererCandles(s)),this._model.selection().isSelected(this._study)&&this._isMarkersEnabled&&this._selectionData&&r.append(new X.SelectionRenderer(this._selectionData)),r}}var Ye=i(65458),Ze=i(78198),Xe=i(52397),Je=i(51056);class Qe extends Xe.HorizontalLinePaneView{constructor(e,t){super(),this._lineRendererData.linestyle=Je.LINESTYLE_DOTTED,this._study=e,this._plotName=t}_updateImpl(){this._lineRendererData.visible=!1;const e=this._study.properties().childs().styles.childs()[this._plotName].childs();if(!e.trackPrice.value()||!this._study.isPlotVisibleAt(this._plotName,1))return;const t=this._study.lastValueData(this._plotName,!0);t.noData||(this._lineRendererData.visible=!0,this._lineRendererData.y=t.coordinate,this._lineRendererData.color=t.color,this._lineRendererData.linewidth=e.linewidth.value())}}var et=i(46463),tt=i(31599),it=i(46233);const st={type:0,color:"transparent"};class rt extends it.AbstractFilledAreaPaneView{constructor(e,t,i,s){var r,n,a;super(e,t,i),this._palettesInfo={},this._gradientPropsStateCache=null,this._rgbaFromInteger=(0,tt.rgbaFromIntegerCached)();const l=this._source.metaInfo();this._isRGB=Boolean(l.isRGB),this._isHlineFill="hline_hline"===i.type,(0,o.assert)(this._isHlineFill||"plot_plot"===i.type,"Wrong filledArea type: "+i.type),this._isHlineFill&&this._initBandIndexes(i.objAId,i.objBId),this._fillMetaInfo=i,this._fillStyleProps=s,this._gradientFillType=s.hasChild("fillType")&&"gradient"===(null===(r=s.childs().fillType)||void 0===r?void 0:r.value()),this._gradientStaticState={color1:i.topColor,color2:i.bottomColor,value1:i.topValue,value2:i.bottomValue},
this._hasAllGradientRequiredProps=this._gradientFillType&&(void 0!==this._gradientStaticState.color1||s.hasChild("topColor")||void 0!==this._gradientStaticState.color2||s.hasChild("bottomColor"))&&(void 0!==this._gradientStaticState.value1||s.hasChild("topValue"))&&(void 0!==this._gradientStaticState.value2||s.hasChild("bottomValue"));const c=()=>{var e;return this._colorPlotIndex=null!==(e=this._colorPlotIndex)&&void 0!==e?e:{type:1}};for(let t=0;t<l.plots.length;++t){const s=l.plots[t];if(((0,I.isColorerPlot)(s)||(0,I.isDataPlot)(s))&&s.target===i.id){if((0,I.isColorerPlot)(s)){let i;void 0!==s.targetField?"topColor"===s.targetField?(c().colorIndexOrRgba1=t,i="color1"):"bottomColor"===s.targetField&&(c().colorIndexOrRgba2=t,i="color2"):this._colorPlotIndex={type:0,colorIndexOrRgba:t},(0,I.isPaletteColorerPlot)(s)&&(this._palettesInfo[null!=i?i:"color"]={map:(0,o.ensureDefined)(null===(n=(0,o.ensureDefined)(l.palettes)[s.palette])||void 0===n?void 0:n.valToIndex),values:e.properties().palettes[s.palette].colors})}else(0,I.isDataPlot)(s)&&("topValue"===s.targetField?c().valueIndex1=t:"bottomValue"===s.targetField&&(c().valueIndex2=t));if(0===(null===(a=this._colorPlotIndex)||void 0===a?void 0:a.type))break}}}update(e){super.update(e),this._gradientPropsStateCache=null}isForceOverlay(){return!!this._source.metaInfo().isPlotForceOverlay(this._plotAId())}_firstValue(){const e=this.isForceOverlay();return this._source.firstValue(void 0,e)}_minFirstBarIndex(){return this._source.getMinFirstBarIndexForPlot(this._fillMetaInfo.id)}_getColorByPlotValue(e){var t,i,s;if(0===e.type){let i;if(null==e.colorIndexOrRgba)return null;if(this._isRGB)i=this._rgbaFromInteger(e.colorIndexOrRgba);else{const s=(0,o.ensureDefined)(this._palettesInfo.color),r=(0,o.ensureDefined)(s.map[e.colorIndexOrRgba]);i=null===(t=s.values[r])||void 0===t?void 0:t.childs().color.value()}return{type:0,color:i}}const r=this._gradientColorPropsState();let n,a;if(this._isRGB)null!=e.colorIndexOrRgba1&&(n=this._rgbaFromInteger(e.colorIndexOrRgba1)),null!=e.colorIndexOrRgba2&&(a=this._rgbaFromInteger(e.colorIndexOrRgba2));else{if(null!=e.colorIndexOrRgba1){const t=(0,o.ensureDefined)(this._palettesInfo.color1);n=t.values[(0,o.ensureDefined)(t.map[e.colorIndexOrRgba1])].childs().color.value()}if(null!=e.colorIndexOrRgba2){const t=(0,o.ensureDefined)(this._palettesInfo.color2);a=t.values[(0,o.ensureDefined)(t.map[e.colorIndexOrRgba2])].childs().color.value()}}const l=null!==(i=e.value1)&&void 0!==i?i:r.value1,c=null!==(s=e.value2)&&void 0!==s?s:r.value2;return n=null!=n?n:r.color1,a=null!=a?a:r.color2,void 0===l||void 0===c||void 0===n&&void 0===a?null:{type:1,color1:n,color2:a,value1:l,value2:c,coordinate1:NaN,coordinate2:NaN}}_plotAId(){return this._fillMetaInfo.objAId}_plotBId(){return this._fillMetaInfo.objBId}_commonColor(){const e=this._fillStyleProps.childs();if(this._gradientFillType){if(!this._hasAllGradientRequiredProps)return st;const e=this._gradientColorPropsState();return{type:1,color1:e.color1,color2:e.color2,value1:e.value1,value2:e.value2,
coordinate1:NaN,coordinate2:NaN}}return{type:0,color:e.color.value()}}_transparency(){return this._fillStyleProps.childs().transparency.value()}_visible(){return this._fillStyleProps.childs().visible.value()}_priceScale(){return this.isForceOverlay()?this._model.mainSeries().priceScale():this._source.priceScale()}_initBandIndexes(e,t){this._bandAKey=null,this._bandBKey=null;const i=this._source.metaInfo().bands;if(void 0!==i)for(let s=0;s<i.length;++s){const r=i[s];null!==this._bandAKey||r.id!==e?null===this._bandBKey&&r.id===t&&(this._bandBKey=s):this._bandAKey=s}}_gradientColorPropsState(){var e,t,i,s;if(null===this._gradientPropsStateCache){const r=this._fillStyleProps.state();this._gradientPropsStateCache={color1:null!==(e=this._gradientStaticState.color1)&&void 0!==e?e:r.topColor,color2:null!==(t=this._gradientStaticState.color2)&&void 0!==t?t:r.bottomColor,value1:null!==(i=this._gradientStaticState.value1)&&void 0!==i?i:r.topValue,value2:null!==(s=this._gradientStaticState.value2)&&void 0!==s?s:r.bottomValue}}return this._gradientPropsStateCache}}var nt=i(22839),ot=i(50600);class at{constructor(e,t){this._invalidated=!0,this._lineRenderer=new ot.HorizontalLineRenderer,this._source=t,this._points=[new se.Point(-1,-1)],this._invalidated=!0,this._properties=e}update(){this._invalidated=!0}renderer(){this._invalidated&&(this._updateImpl(),this._invalidated=!1);const e={y:this._points[0].y,color:this._properties.childs().color.value(),linewidth:this._properties.childs().linewidth.value(),linestyle:this._properties.childs().linestyle.value()};return this._lineRenderer.setData(e),this._lineRenderer}_updateImpl(){const e=this._source.priceScale();if(!e||e.isEmpty())return void(this._points[0]=new se.Point(-1,-1));const t=this._properties.childs().value.value(),i=this._source.firstValue(),s=(0,B.isNumber)(t)&&null!==i?e.priceToCoordinate(t,i):NaN;this._points[0]=new se.Point(-1,s)}}var lt=i(75919);class ct extends lt.MediaCoordinatesPaneRenderer{constructor(){super(),this._data=null,this._data=null}setData(e=null){this._data=e}hitTest(){return null}_drawImpl(e){var t,i;if(null===this._data||0===this._data.points.length)return;const s=e.context,r=e.mediaSize.width;if(this._data.gradient){const e=s.createLinearGradient(0,this._data.coordinate1,0,this._data.coordinate2);e.addColorStop(0,null!==(t=this._data.backColor1)&&void 0!==t?t:"transparent"),e.addColorStop(1,null!==(i=this._data.backColor2)&&void 0!==i?i:"transparent"),s.fillStyle=e}else s.fillStyle=this._data.backcolor;const n=Math.min(this._data.points[0],this._data.points[1]),o=Math.max(this._data.points[0],this._data.points[1]);s.fillRect(0,n,r,o-n)}}class ht{constructor(e){this._bandBgRenderer=new ct,this._invalidated=!0,this._source=e}update(){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._bandBgRenderer}_updateImpl(){this._bandBgRenderer.setData(null);const e=this._source.properties().childs(),t=e.bands;if(t.childCount()<2)return;const i=e.bandsBackground
;if(!(null==i?void 0:i.childs().fillBackground.value()))return;const s=t[0].childs(),r=t[1].childs(),n=this._source.priceScale(),a=this._source.firstValue();if(!n||n.isEmpty()||null===a)return;const l=[n.priceToCoordinate(s.value.value(),a),n.priceToCoordinate(r.value.value(),a)],c=(0,o.ensureDefined)(e.bandsBackground).childs(),h=(0,Q.clamp)(c.transparency.value(),0,100);this._bandBgRenderer.setData({gradient:!1,points:l,backcolor:(0,p.generateColor)(c.backgroundColor.value(),h)})}}class dt{constructor(e,t,i){var s;this._bandBgRenderer=new ct,this._bandAKey=null,this._bandBKey=null,this._invalidated=!0,this._source=e,(0,o.assert)("hline_hline"===t.type,"Wrong filledArea type: "+t.type),this._initBandIndexes(t.objAId,t.objBId),this._fillStyleProps=i,this._bandBgRenderer=new ct,this._gradientFillType=i.hasChild("fillType")&&"gradient"===(null===(s=i.childs().fillType)||void 0===s?void 0:s.value()),this._gradientStaticState={color1:t.topColor,color2:t.bottomColor,value1:t.topValue,value2:t.bottomValue}}update(){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._bandBgRenderer}_updateImpl(){var e,t,i,s,r,n,a,l;if(this._bandBgRenderer.setData(null),!this._fillStyleProps.childs().visible.value())return;if(null===this._bandAKey||null===this._bandBKey)return;const c=(0,o.ensureDefined)(this._source.properties().childs().bands),h=c.childs()[this._bandAKey].childs(),d=c.childs()[this._bandBKey].childs(),u=this._source.priceScale(),_=this._source.firstValue();if(!u||u.isEmpty()||null===_)return;const m=[u.priceToCoordinate(h.value.value(),_),u.priceToCoordinate(d.value.value(),_)],g=(0,Q.clamp)(this._fillStyleProps.childs().transparency.value(),0,100);let f;const v=this._fillStyleProps.childs();if(this._gradientFillType){const o=this._gradientStaticState,c=v,h=null!==(e=o.value1)&&void 0!==e?e:null===(t=c.topValue)||void 0===t?void 0:t.value(),d=null!==(i=o.value2)&&void 0!==i?i:null===(s=c.bottomValue)||void 0===s?void 0:s.value();if(void 0===h||void 0===d)return;const y=null!==(r=o.color1)&&void 0!==r?r:null===(n=c.topColor)||void 0===n?void 0:n.value(),S=null!==(a=o.color2)&&void 0!==a?a:null===(l=c.bottomColor)||void 0===l?void 0:l.value();if(void 0===y&&void 0===S)return;f={gradient:!0,points:m,backColor1:y&&(0,p.generateColor)(y,g),backColor2:S&&(0,p.generateColor)(S,g),coordinate1:u.priceToCoordinate(h,_),coordinate2:u.priceToCoordinate(d,_)}}else f={gradient:!1,points:m,backcolor:(0,p.generateColor)(v.color.value(),g)};this._bandBgRenderer.setData(f)}_initBandIndexes(e,t){this._bandAKey=null,this._bandBKey=null;(0,o.ensureDefined)(this._source.metaInfo().bands).forEach(((i,s)=>{null===this._bandAKey&&i.id===e&&(this._bandAKey=s),null===this._bandBKey&&i.id===t&&(this._bandBKey=s)}))}}var ut=i(678),pt=i(10892),_t=i(62288),mt=i(44672),gt=i(64147),ft=(i(88960),i(68805)),vt=i(50788),yt=i(16227),St=i(37626),bt=i(96e3);class wt extends bt.AbstractBarColorer{constructor(e,t){super(),this._rgbaFromInteger=(0,tt.rgbaFromIntegerCached)(),this._study=e,this._plotIndex=t}
applyBarStyle(e,t,i,s){var r;if(t)return i;const n=this._study.properties().childs();if(!n.visible.value())return i;const a=this._study.metaInfo(),l=this._study.data();if(!l||0===l.size())return i;const c=a.plots[this._plotIndex],h=this._getOffset();if(this._study.getMinFirstBarIndexForPlot(c.id)>e+h)return i;if(0===n.styles.childs()[c.id].childs().display.value())return i;const d=l.valueAt(e-h);if(null===d)return i;let u=d[this._plotIndex+1];if(null==u)return i;if(u=Math.round(u),a.isRGB)i.barColor=this._rgbaFromInteger(u),i.upColor=i.barColor,i.downColor=i.barColor;else{const e=a.plots[this._plotIndex];if("palette"in e){const t=e.palette,s=n.palettes.childs()[t],l=(0,o.ensureDefined)(null===(r=a.palettes)||void 0===r?void 0:r[t]),c=l.valToIndex?(0,o.ensureDefined)(l.valToIndex[u]):u,h=s.childs().colors.childs()[c].childs().color.value();i.barColor=h,i.upColor=h,i.downColor=h}}return i}firstColoredBar(e){var t;let i=e;for(const s of this._backColorers)i=Math.min(i,null!==(t=s.firstColoredBar(e))&&void 0!==t?t:1/0);const s=this._getOffset();i=Math.min(i,e+s);const r=this._getBars().firstIndex();return Math.max(i,null!=r?r:-1/0)}_getBars(){return this._study.series().bars()}_getOffset(){const e=this._study.metaInfo().plots[this._plotIndex];return this._study.offset(e.id)}}var Ct=i(76422),Pt=i(35039),xt=i(31229),Tt=i(55917),It=i(94260),Mt=i(79303),At=i(725),Lt=i(60107);class kt extends Ye.PanePriceAxisView{constructor(e,t,i,s){super(e,t,i),this._dataSource=t,this._isForceOverlay=t.metaInfo().isPlotForceOverlay(s)}_position(){const e=this._isForceOverlay?this._chartModel.mainPane():this._chartModel.paneForSource(this._dataSource);if(null===e)return null;const t=this._isForceOverlay?this._chartModel.mainSeries().priceScale():this._dataSource.priceScale();if(null===t)return null;let i=e.priceScalePosition(t);return"overlay"===i&&(i=e.priceScalePosition(e.defaultPriceScale())),"overlay"===i?null:i}}var Dt=i(43290),Et=i(24526);const Vt=(0,c.getLogger)("Chart.Study"),Bt=l.t(null,void 0,i(14285)),Rt=!1;var Nt,Ot;!function(e){e.PaneViews="study-pane-views"}(Nt||(Nt={})),function(e){e[e.DefaultPriceScale=100]="DefaultPriceScale"}(Ot||(Ot={}));const Ft={symbolsForDisplay:!1,symbolsForChartApi:!0,skipHiddenInputs:!1,skipFakeInputs:!1,skipBooleanInputs:W.enabled("dont_show_boolean_study_arguments"),asObject:!0,skippedGroups:[],skippedInputs:[],noExchanges:!1,noResolution:!1,keepOptionalSymbolsEmpty:!1,skipColorInputs:!1,skipTimeInputs:!1,skipOptionalEmptySymbolInputs:!1,skipTextareaInputs:!1,priceInputsForDisplay:!1},Wt=W.enabled("study_symbol_ticker_description"),Ht=W.enabled("hide_main_series_symbol_from_indicator_legend"),zt=W.enabled("datasource_copypaste"),Ut=W.enabled("hide_unresolved_symbols_in_legend");function jt(e,t){const i=e.plots[t];if(!i||!(0,I.isOhlcPlot)(i))return!1;const s=i.target,r=e.defaults.styles&&e.defaults.styles[s],n=e.defaults.ohlcPlots&&e.defaults.ohlcPlots[s],o=e.ohlcPlots&&e.ohlcPlots[s];return r&&(0,I.isOhlcPlotStyleBars)(r)||n&&(0,I.isOhlcPlotStyleBars)(n)||!!o&&(0,I.isOhlcPlotStyleBars)(o)}
function Gt(e,t){const i=e.plots[t];if(!i||!(0,I.isOhlcPlot)(i))return!1;const s=i.target,r=e.defaults.styles&&e.defaults.styles[s],n=e.defaults.ohlcPlots&&e.defaults.ohlcPlots[s],o=e.ohlcPlots&&e.ohlcPlots[s];return r&&(0,I.isOhlcPlotStyleCandles)(r)||n&&(0,I.isOhlcPlotStyleCandles)(n)||!!o&&(0,I.isOhlcPlotStyleCandles)(o)}function qt(e,t){(0,o.assert)(void 0!==e,"zOrder must be defined"),(0,o.assert)(!t.has(e),"zOrder must be unique")}function $t(e,t){return e.plots.some((e=>((0,I.isColorerPlot)(e)||(0,I.isDataPlot)(e))&&e.target===t))}function Kt(e){const t={};if(e.plots)for(let i=0;i<e.plots.length;i++){const s=e.plots[i],r=s.id;if((0,I.isColorerPlot)(s))continue;const n={display:15,color:"#0496FF",linestyle:Je.LINESTYLE_SOLID,linewidth:2,plottype:I.LineStudyPlotStyle.Line,transparency:50,trackPrice:!1};(0,I.isBarColorerPlot)(s)&&(n.transparency=0),n.plottype=s.type,n.title=r,t[r]=n}return{styles:t}}function Yt(){const e=(0,B.clone)((0,Pt.defaults)("study"));return e.intervalsVisibilities=(0,B.clone)(xt.intervalsVisibilitiesDefaults),e}function Zt(e,t,i){let s=(0,B.clone)((0,Pt.defaults)(i,t));return"Overlay"!==e.shortId&&"Compare"!==e.shortId||(s.currencyId=null,s.unitId=null),e.isTVScript&&e.TVScriptSourceCode!==s.TVScriptSourceCode&&(s=(0,B.clone)((0,Pt.factoryDefaults)(i))),s}function Xt(e,t){var i;const s={};return Mt.StudyVersioning.mergeInputsObjPart(s,null!==(i=e.inputs)&&void 0!==i?i:{}),Mt.StudyVersioning.mergeInputsObjPart(s,t.inputs),{inputs:s}}function Jt(e,t,i,s){var r;if(y.StudyMetaInfo.versionOf(e)<1)throw new Error("This function cannot work with metainfo of the old format version. Required format version >= 1");const o=y.StudyMetaInfo.getStudyPropertyRootName(e),l=(0,B.clone)(e.defaults),c=Yt();if((0,n.default)(c,Kt(e)),(0,n.default)(c,l),(0,n.default)(c,(0,Pt.factoryDefaults)(o)),(0,n.default)(c,Zt(e,s,o)),(0,n.default)(c,t),(0,n.default)(c,Xt(l,c)),null!==i){const t=i.model().studiesColorRotatorFactory().getColorRotator(e);null!==t&&("Overlay@tv-basicstudies"===e.id?c.lineStyle.color=t.getColor(c.lineStyle.color):(0,n.default)(c,function(e,t){for(const i of Object.keys(e.styles)){const s=e.styles[i];if((0,a.isObject)(s)&&"color"in s){const e=s.color;s.color=t.getColor(e)}}return e}(c,t)))}return s.updateStudyInputsIfNeeded(c,null!==(r=c.version)&&void 0!==r?r:e.version,e),c}function Qt(e,t,i,s,r){return function(e,t,i,s,r,n){const o=Jt(e,t,i,s);return y.StudyMetaInfo.getSourceInputIds(e).forEach(((e,t)=>{const i=o.inputs[e];t<n.length?o.inputs[e]=`${n[t].id()}$0`:(0,B.isString)(i)&&i.includes("$")&&(o.inputs[e]="close")})),ti(e,r,o)}(e,t,i,s,y.StudyMetaInfo.getStudyPropertyRootName(e),r)}
const ei=["id","description","description_localized","shortDescription","_metainfoVersion","is_price_study","is_hidden_study","priceScale","fullId","shortId","scriptIdPart","packageId","productId","isTVScriptStub","defaults","symbolSource","historyCalculationMayChange","format","linkedToSeries","isTVLibrary","docs","exports","exportTypes","extra","usesPrivateLib","financialPeriod","groupingKey","pine","isRGB","isTVScript","TVScriptMetaInfoExprs","usePlotsZOrder","isTVScriptStrategy","TVScriptSourceCode","lookaheadFutureData","hasAlertFunction","defaultStrategyAlertMessage","tags","canBeChild","canNotBeChild","_serverMetaInfoVersion","warnings"];function ti(e,t,i){var s;for(const e of ei)delete i[e];const r=["visible","precision","minTick","intervalsVisibilities","inputs.first_visible_bar_time","inputs.last_visible_bar_time","inputs.subscribeRealtime"];for(let t=0;t<e.inputs.length;++t){const i=e.inputs[t];i.isHidden&&(r.push(`inputs.${t}`),r.push(`inputs.${i.id}`))}const n=new Tt.DefaultProperty({defaultName:t,state:i,excludedDefaultsKeys:r,excludedStateKeys:["version"]});n.removeProperty("intervalsVisibilities"),n.addChild("intervalsVisibilities",new It.IntervalsVisibilitiesProperty(i&&i.intervalsVisibilities)),"PivotPointsStandard@tv-basicstudies"!==e.id&&"PivotPointsHighLow@tv-basicstudies"!==e.id||!n.hasChild("font")||n.removeProperty("font");const o=y.StudyMetaInfo.versionOf(e);return n.hasChild("version")?null===(s=n.childs().version)||void 0===s||s.setValue(o):n.addProperty("version",o),n}function ii(e,t,i,s,r,o){const a=function(e,t,i,s,r){var o;e.version&&i.version&&e.version!==i.version&&Vt.logWarn("Serialized metaInfo version "+e.version+" is not equal to the saved state version "+i.version);const a=t||e,l=null!==(o=(0,B.clone)(a.defaults))&&void 0!==o?o:{},c=y.StudyMetaInfo.getStudyPropertyRootName(a),h=y.StudyMetaInfo.getStudyPropertyRootName(e);let d=Yt();return(0,n.default)(d,Kt(e)),(0,n.default)(d,(0,B.clone)(e.defaults)),(0,n.default)(d,l),(0,n.default)(d,(0,Pt.factoryDefaults)(c)),(0,n.default)(d,(0,Pt.factoryDefaults)(h)),(0,n.default)(d,Zt(a,s,c)),(0,n.default)(d,Zt(e,s,h)),(0,n.default)(d,i),d=s.updateStudyState(d,e,t),void 0!==r&&t&&(d=r(i,d,e,t)),y.StudyMetaInfo.versionOf(a)>=1&&(0,n.default)(d,Xt(l,d)),d}(e,t,i,s,o);return ti(t||e,r,a)}function si(e,t,i,s,r){return ii(e,t,i,s,y.StudyMetaInfo.getStudyPropertyRootName(e),r)}function ri(e,t,i){let s=0,r=0;return Math.sign(r)-Math.sign(s)}function ni(e,t){return{type:ut.StudyStatusType.Error,errorDescription:e}}function oi(e){return"inherit"===e.type&&(e.type="price"),e}function ai(e,t,i,s){var r,n;{const t=(0,B.isNumber)(s)?s:void 0,o=null!==(n=null===(r=null===Et.customFormatters||void 0===Et.customFormatters?void 0:Et.customFormatters.studyFormatterFactory)||void 0===r?void 0:r.call(Et.customFormatters,e,i,t))&&void 0!==n?n:null;if(null!==o)return o}if(null!==t)switch(e.type){case"inherit":case"price":return new At.PriceFormatter({priceScale:t});case"volume":return(0,Dt.getVolumeFormatter)(Math.log10(t));case"percent":return(0,
Dt.getPercentageFormatter)(Math.log10(t))}if("inherit"===e.type)return null;const o=(0,B.isNumber)(e.precision)?Math.pow(10,e.precision):void 0;switch(e.type){case"price":return new At.PriceFormatter({priceScale:o});case"volume":{let t=e.precision;return void 0===t&&(t=i&&(0,B.isNumber)(i.volume_precision)?i.volume_precision:0),(0,Dt.getVolumeFormatter)(t)}case"percent":return(0,Dt.getPercentageFormatter)(void 0===o?void 0:Math.log10(o));default:return Vt.logWarn(`Unsupported format type: ${e.type}`),null}}const li=new Set(["first_visible_bar_time","last_visible_bar_time","subscribeRealtime"]);class ci extends g.PriceDataSource{constructor(e,t,i,s){var r,n,a;super(e),this._onStart=new u.Delegate,this._restarting=!1,this._paneViews=[],this._forceOverlaysPaneViews=[],this._legendView=null,this._priceAxisViews=[],this._forceOverlayPriceAxisViews=[],this._priceAxisViewsBase=[],this._resolvedSymbols={},this._resolvedSymbolsByInput={},this._priceLinesAxisViews=[],this._labelPaneViews=[],this._forceOverlayLabelPaneViews=[],this._ownFirstValue=null,this._formatter=null,this._defaultFormatter=null,this._dataUpdated=new u.Delegate,this._currencySourceSymbolInputProperty=null,this._onHibernationStateChange=new u.Delegate,this._symbolsResolved=new u.Delegate,this._statusChanged=new u.Delegate,this._inputsAnchorsPaneView=null,this._inputsLinesPaneView=null,this._inputsTimeAxisPaneViews=[],this._inputsPriceAxisPaneViews=[],this._sources=[],this._status={type:ut.StudyStatusType.Undefined},this._recompilationStatus=null,this._wasCompletedBefore=!1,this._studyId=null,this._isSubscribedToSessionId=!1,this._titleStrCache={},this._titleInPartsCache={},this._children=[],this._graphicsPriceAxisViews=[],this._plotOffsets={},this._ongoingDataUpdate=Promise.resolve(),this._studyModified=!1,this._tagsChanged=new u.Delegate,this._studyName="",this._turnaround="st0",this._pendingResolveSymbols=new Map,this._onIsActualIntervalChange=new u.Delegate,this._childStudyByRebind=new u.Delegate,this._lastNonEmptyPlotRowCache={},this._startMovingPoint=null,this._processHibernateBound=this.processHibernate.bind(this,1),this._maxOffset=new gt.WatchedValue(0),this._currencySourceSymbolInfo=null,this._graphicsPriceRangeGroups=null,this._graphicsViewsReady=!1,this._visibleTimeRangeInputs=null,this._turnaroundCounter=0,this._deferredPinePatchProps=!1,this._propertiesPatched=Promise.resolve(),this._aboutToBeDestroyed=new u.Delegate,this._definitionsViewModel=null,this._plotFormatters=new Map,this._showPineVersionInStatusLine=new gt.WatchedValue(!1).spawn(),this._pineSourceCodeModel=null,this._onParentSourcesChanges=new u.Delegate,this._statusChangesSubscriber={},this._chartApi=e.chartApi(),this._properties=t,this._metaInfo=s,this._hideMatches=s.inputs.filter((e=>e.hideWhenPlotsHidden)).map((e=>({id:e.id,plotIds:e.hideWhenPlotsHidden||[]}))),this._series=this._model.mainSeries(),this._series.onIntervalChanged().subscribe(this,this._calcIsActualInterval),this._series.alertCreationAvailable().subscribe(this._updateAlertCreationAvailable.bind(this)),
this._showStudyArgumentsProperty=e.properties().childs().paneProperties.childs().legendProperties.childs().showStudyArguments,e.collapsed().subscribe(this._processHibernateBound),this._sources=i,y.StudyMetaInfo.setChildStudyMetaInfoPropertiesSourceId(s,null===(r=this._sources[0])||void 0===r?void 0:r.id(),t),i.forEach((e=>{e.setChild(this)})),[this._series,...i].forEach((e=>{e.currencyChanged().subscribe(this,this._onSourceCurrencyChanged),e.unitChanged().subscribe(this,this._onSourceUnitChanged),e.priceRangeReadyChanged().subscribe(this,this._onSourcePriceRangeReadyChanged),e.formatterChanged().subscribe(this,this._onSourceFormatterChanged),e.priceStepChanged().subscribe(this,this._onSourcePriceStepChanged)})),Wt&&this._model.mainSeries().properties().childs().statusViewStyle.childs().symbolTextSource.listeners().subscribe(this,(()=>{this.invalidateTitleCache(!0)}));const l=this._properties.childs();for(const e of y.StudyMetaInfo.getSourceInputIds(s))null===(n=l.inputs.childs()[e])||void 0===n||n.subscribe(this,this._onSourceInputChanged);this._properties.subscribe(this,this._onPropertiesChanged),l.visible.subscribe(this,this._visibleChanged),l.visible.subscribe(this,(()=>this.processHibernate())),l.intervalsVisibilities.subscribe(this,this._calcIsActualInterval),l.inputs.listeners().subscribe(this,this._updateMaxOffsetValue),void 0!==l.offsets&&l.offsets.listeners().subscribe(this,this._updateMaxOffsetValue),void 0!==l.offset&&l.offset.listeners().subscribe(this,this._updateMaxOffsetValue),this._initializeCurrencySource(),A.hideAllIndicators().subscribe(this,this._visibleChanged);for(let e=0;e<this._metaInfo.plots.length;e++){const t=this._metaInfo.plots[e].id,i=l.styles.childs()[t];null==i||i.childs().display.subscribe(this,(()=>{this.processHibernate(),this.invalidateTitleCache()}))}for(const e of Object.keys(this._metaInfo.graphics))for(const t of Object.keys(this._metaInfo.graphics[e])){const i=null===(a=l.graphics.childs()[e])||void 0===a?void 0:a.childs()[t];i&&i.childs().visible&&(0,o.ensureDefined)(i.childs().visible).subscribe(this,(()=>this.processHibernate()))}this._isActualInterval=(0,pt.isActualInterval)(this._series.intervalObj(),l.intervalsVisibilities),this._initializeStudyInputsPaneViews(),this._handler=e=>this._onData(e),this._valuesProvider=new P.StudyValuesProvider(this,e),this._graphics=new S.LiveStudyGraphics(s.graphics),this._chartApi=e.chartApi(),this._invalidateLastNonEmptyPlotRowCache(),this._data=new v.PlotList((0,Lt.studyPlotFunctionMap)(this._metaInfo),Lt.studyEmptyPlotValuePredicate),this._createViews(),this._recreatePriceFormattingDependencies(this._series.symbolInfo()),l.precision.subscribe(this,this._onFormatterPropsChanged),this._showStudyArgumentsProperty.subscribe(this,(()=>this.invalidateTitleCache(!0))),l.inputs.listeners().subscribe(this,(()=>this.invalidateTitleCache(!0))),W.enabled("update_study_formatter_on_symbol_resolve")&&e.mainSeries().dataEvents().symbolResolved().subscribe(this,this._recreatePriceFormattingDependencies),
e.mainSeries().dataEvents().symbolResolved().subscribe(this,(()=>this.invalidateTitleCache(!0)));const c=new Set;if(this._simplePlotsCount=s.plots.filter(((e,t)=>{if((0,I.isLinePlot)(e))return!0;if((0,I.isOhlcPlot)(e)){const t=e.target;return!c.has(t)&&(c.add(t),!0)}return!1})).length,this.hasBarColorer()&&l.visible.listeners().subscribe(this,(()=>e.mainSeries().invalidateBarStylesCache)),this._definitionsViewModel=null,this._updateMaxOffsetValue(),s.inputs.some((e=>li.has(e.id)))){this._visibleTimeRangeInputs=e.visibleRangeStudiesInputs().spawn();const t=this._visibleTimeRangeInputs.value();let i=null!==t;this._visibleTimeRangeInputs.subscribe((e=>{const t=()=>{this._onVisibleTimeRangeInputsChanged(e),i!==(null!==e)&&(i=null!==e,!i||this._restarting||this.isStarted()||this.start(!0))};this._statusChanged.unsubscribeAll(this._statusChangesSubscriber),this._status.type===ut.StudyStatusType.Loading?this._statusChanged.subscribe(this._statusChangesSubscriber,t,!0):t()})),t&&this._updateVisibleTimeRangeInputs(t,!1)}}destroy(){var e,t,i,s,r,n;null===(e=this._signlePerformanceValue)||void 0===e||e.destroy(),this._aboutToBeDestroyed.fire(),null!==this._definitionsViewModel&&(this._definitionsViewModel.destroy(),this._definitionsViewModel=null),this._showStudyArgumentsProperty.unsubscribeAll(this),this._model.mainSeries().dataEvents().symbolResolved().unsubscribeAll(this);this.parentSources().forEach((e=>{e.currencyChanged().unsubscribeAll(this),e.unitChanged().unsubscribeAll(this),e.priceRangeReadyChanged().unsubscribeAll(this),e.formatterChanged().unsubscribeAll(this),e.priceStepChanged().unsubscribeAll(this)})),this._series.properties().childs().statusViewStyle.childs().symbolTextSource.unsubscribeAll(this),this._series.onIntervalChanged().unsubscribeAll(this),this._series.alertCreationAvailable().unsubscribe(this._updateAlertCreationAvailable),this.formatterChanged().unsubscribe(this,this.invalidateTitleCache),A.hideAllIndicators().unsubscribe(this,this._visibleChanged),this._model.collapsed().unsubscribe(this._processHibernateBound),null!==this._currencySourceSymbolInputProperty&&this._currencySourceSymbolInputProperty.unsubscribeAll(this),null===(t=this._legendView)||void 0===t||t.destroy(),null===(s=null===(i=this._pineSourceCodeModel)||void 0===i?void 0:i.get())||void 0===s||s.destroy(),null===(r=this._pineSourceCodeModel)||void 0===r||r.destroy(),null===(n=this._visibleTimeRangeInputs)||void 0===n||n.destroy(),this._showPineVersionInStatusLine.destroy(),super.destroy()}properties(){return this._properties}propertiesPatched(){return this._propertiesPatched}isDraggable(){return!this._metaInfo.linkedToSeries}logs(){return null}logLevelMask(){const e=this._properties.childs().inputs.childs().__log_level.value();if(!(0,B.isNumber)(e)||e<0||e>7)throw new Error(`Value of log level is unexpected, current value is ${e}, but expected values from 0 to 7`);return{error:Boolean(1&e),warning:Boolean(2&e),info:Boolean(4&e)}}setLogLevelMask(e){const t=(Number(e.error)&&1)|(Number(e.warning)&&2)|(Number(e.info)&&4)
;this._properties.childs().inputs.childs().__log_level.setValue(t)}performance(){return new gt.WatchedValue(null)}profilingEnabled(){var e;return!!(null===(e=this._properties.childs().inputs.childs().__profile)||void 0===e?void 0:e.value())}enableProfiling(e){var t;null===(t=this._properties.childs().inputs.childs().__profile)||void 0===t||t.setValue(e)}onAboutToBeDestroyed(){return this._aboutToBeDestroyed}priceScale(e){return e?this._model.mainSeries().priceScale():super.priceScale()}lastValueData(e,t,i){const s={noData:!0},r=this.metaInfo().isPlotForceOverlay(e),n=r?this._model.mainSeries().priceScale():this.priceScale();if(this._model.timeScale().isEmpty()||null===n||n.isEmpty()||this.data().isEmpty())return s;const o=this._model.timeScale().visibleBarsStrictRange(),a=this.firstValue(!0,r);if(null===o||null===a)return s;if(!this._properties.childs().visible.value())return s;const l=this._properties.childs().styles,c=this._properties.childs().ohlcPlots;let h,d;if(l&&l.childs()[e]&&(h=l.childs()[e]),c&&c.childs()[e]&&(h=c.childs()[e]),!h||0===h.childs().display.value())return s;const u=this.metaInfo().plots;for(d=0;d<u.length;d++){const t=u[d];if(t.id===e||(0,I.isOhlcClosePlot)(t)&&t.target===e)break}const p=d+1,_=this.offset(e),m=this.nearestIndex(o.lastBar()-_,b.PlotRowSearchMode.NearestLeft,p);if(void 0===m)return s;const g=this._lastNonEmptyPlotRow(p),f=null!==g&&o.contains(g.index),v=null!==g?g.value:null,y=t||f?v:this.data().valueAt(m);if(!y||!(0,B.isNumber)(y[p]))return s;const S=y[p],w=this._valuesProvider.getPlotColor(d,y),C=n.priceToCoordinate(S,a),P=this.plotFormatter(e).format(S),x={...n.getFormattedValues(S,a,void 0,P),noData:!1,color:w,floatCoordinate:C,coordinate:C};return i&&(x.price=S),x}isFailed(){return this.status().type===ut.StudyStatusType.Error}isLoading(){return this.status().type===ut.StudyStatusType.Loading}isCompleted(){return this.status().type===ut.StudyStatusType.Completed}isSymbolInvalid(){return this._status.type===ut.StudyStatusType.Error&&this._status.errorDescription.error===Bt}series(){return this._series}model(){return this._model}state(e,t){var i,s;const r=(0,o.ensureNotNull)((0,h.getStudyClassName)(this.constructor)),n=this.metaInfo(),a={type:r,id:this.id(),state:this.properties().state(),zorder:this.zorder(),ownFirstValue:this.isVisible()?null:this._ownFirstValue,metaInfo:n.state()},l=this._sources.map((e=>e.id()));if(l.length&&(a.parentSources=l),e){let e=this.data();const t=this._model.timeScale(),i=this._seriesDataRangeToSave(e);null!==i&&(e=e.range(i.firstBar(),i.lastBar())),a.data=e.state(),a.data.symbols=this._resolvedSymbols,a.data.graphics=(0,S.saveStudyGraphics)(this.graphics(),t.visibleBarsStrictRange()),a.data.plotOffsets=this._plotOffsets}this.ownerSource()&&(a.ownerSource=null===(i=this.ownerSource())||void 0===i?void 0:i.id());for(let e=0;e<n.inputs.length;e++)if("bar_time"===n.inputs[e].type){const t=n.inputs[e].id,i=a.state.inputs[t];if(i<0){const e=this._rightOffsetToUnixTime(-i);a.state.inputs[t]=e&&e>=0?e:0}}
if(null===(s=a.state)||void 0===s?void 0:s.inputs){const e=a.metaInfo.inputs.find((e=>"ILScript"===e.name));e&&delete a.state.inputs[e.id],delete a.state.inputs.__log_level,delete a.state.inputs.__profile}const c=this.stateCustomFields();return c&&(a.customFields=c),a}stateCustomFields(){}restoreStateCustomFields(e){}restoreData(e){var t,i;this._invalidateLastNonEmptyPlotRowCache(),this.data().restoreState(e),this._resolvedSymbols=null!==(t=e.symbols)&&void 0!==t?t:{},this._graphics=e.graphics?(0,S.loadStudyGraphics)(e.graphics):(0,S.emptyStudyGraphics)(),this._postProcessGraphics(),this._plotOffsets=null!==(i=e.plotOffsets)&&void 0!==i?i:{},this._setStatus({type:ut.StudyStatusType.Completed},!0)}hasStateForAlert(){return!1}stateForAlert(){throw new Error("Not implemented")}idForAlert(){return super.idForAlert()}hasBarColorer(){return(0,o.ensureNotNull)(this._metaInfo).plots.some(I.isBarColorerPlot)}barColorer(){const e=this._metaInfo.plots;let t=null;for(let i=0;i<e.length;++i)if((0,I.isBarColorerPlot)(e[i])){const e=new wt(this,i);null===t?t=e:t.pushBackBarColorer(e)}return t}isSavedInStudyTemplates(){return this._metaInfo.inputs.every((e=>"bar_time"!==e.type))}restart(e){this._restarting=!0,this.clearData(),(e||W.enabled("stop_study_on_restart"))&&this.stop(),setTimeout(this.start.bind(this),0)}stop(e,t){if(!0===e&&this._children)for(const e of this._children)e.stop(!0);this._stopStudyOnServer(),this.clearData(),this._unsubscribeToSessionId(),this.recalculate()}disconnect(){this._studyId=null,this._model.isSnapshot()||(this._resolvedSymbols={},this._resolvedSymbolsByInput={})}sourceId(){return this._studyId}parentSources(){return this._sources}symbolSource(){return this._firstSourceOrSeries().symbolSource()}valueAt(e,t){return this.symbolSource().valueAt(e,t)}barsProvider(){return this._firstSourceOrSeries().barsProvider()}ownerSource(){return this.isChildStudy()?this._sources[0]:super.ownerSource()}isChildStudy(){return this._sources.length>0}hasChildren(){return this._children.length>0}isStarted(){return Boolean(this._studyId)}isRestarting(){return this._restarting}isActualInterval(){return this._isActualInterval}onIsActualIntervalChange(){return this._onIsActualIntervalChange}isVisible(){var e,t,i;const s=this._properties.childs();if(this._model.collapsed().value()||!s.visible.value()||!this.isActualInterval())return!1;const r=this.metaInfo();if(r.plots.length>0)for(let e=0;e<r.plots.length;e++){const t=r.plots[e].id,i=s.styles.childs()[t];if(void 0===i)continue;if(0!==i.childs().display.value())return!0}if(r.bands)for(let e=0;e<r.bands.length;e++)if(s.bands.childs()[e].childs().visible.value())return!0;for(const n of Object.keys(r.graphics))for(const o of Object.keys(r.graphics[n])){const r=null===(e=s.graphics.childs()[n])||void 0===e?void 0:e.childs()[o];if(void 0!==r&&(null===(i=null===(t=r.child("visible"))||void 0===t?void 0:t.value())||void 0===i||i))return!0}if(r.filledAreas)for(let e=0;e<r.filledAreas.length;e++)if(s.filledAreasStyle.childs()[r.filledAreas[e].id].childs().visible.value())return!0
;return!1}async start(e,t,i){const s=this._model.mainSeries();await s.seriesCreated(),await Promise.all(this._sources.filter((e=>e.isHibernated())).map((e=>e.start())));const r=!(this.isHibernationAllowed()&&!this.isVisible())||!0===t;if(this._chartApi&&this._chartApi.isConnected().value()&&r)try{await this._allSymbolsAreResolved(),await this._startAfterSymbolsResolved(e,t)}catch(e){const t=`ERROR: ${this._debugId()} start failed, ${e}`;Vt.logError(t),this._restarting=!1,"TooManyStudies"===(null==e?void 0:e.cause)&&(0,d.showTooManyStudiesNotice)(this._chartApi.getStudyCounter())}}replaceData(e,t,i){this._invalidateLastNonEmptyPlotRowCache(),this.data().remove(e+1),this.data().addTail(i,t)}inputs(e){const t=(0,n.default)((0,B.clone)(Ft),e||{});t.skipOptionalEmptySymbolInputs&&(t.keepOptionalSymbolsEmpty=!0);const i=(0,r.default)(this._buildInputs(t));return t.patchSosInputs&&y.StudyMetaInfo.patchSoSInputs(i,(e=>{var t,i;return null!==(i=null===(t=this._sources.find((t=>t.id()===e)))||void 0===t?void 0:t.sourceId())&&void 0!==i?i:null})),i}data(){return this._data}moveData(e){this._ongoingDataUpdate=this._ongoingDataUpdate.then((()=>{this._invalidateLastNonEmptyPlotRowCache(),this.data().move(e)}))}plots(){return this.data()}metaInfo(){return this._metaInfo}status(){var e;return null!==(e=this._recompilationStatus)&&void 0!==e?e:this._status}name(e){return e?this.metaInfo().shortDescription||"Study":this.metaInfo().description||"Study"}title(e,t,i,s,r,n){s=void 0===s?!this._showStudyArgumentsProperty.value():s;const o=JSON.stringify([e,t,i,s,r,n]);if(this._titleStrCache[o])return this._titleStrCache[o];if(this._titleInPartsCache[o])return this._joinTitlesParts(this._titleInPartsCache[o]);const a=this._title(e,t,i,s,r,n);return this._titleStrCache[o]=a,a}titleInParts(e,t,i,s,r){s=void 0===s?!this._showStudyArgumentsProperty.value():s;const n=JSON.stringify([e,t,i,s,r]);if(this._titleInPartsCache[n])return this._titleInPartsCache[n];const o=this._titleInParts(e,t,i,s,r);return this._titleInPartsCache[n]=o,o}invalidateTitleCache(e){if(this._titleStrCache={},this._titleInPartsCache={},!0===e&&this._children)for(let t=0;t<this._children.length;++t)this._children[t].invalidateTitleCache(e)}graphics(){return this._graphics}graphicsInfo(){return this._metaInfo.graphics}priceLabelText(e){const t=this._metaInfo.styles,i=this._metaInfo.ohlcPlots;let s;t&&t[e]&&(s=t[e]),i&&i[e]&&(s=i[e]);const r=(0,o.ensureDefined)(s).title;return 1!==this._simplePlotsCount||(0,I.isPlotTitleDefined)(r)?this._metaInfo.is_price_study&&r!==this._metaInfo.shortDescription?""===r?this._metaInfo.shortDescription:this._metaInfo.shortDescription+":"+r:r:this._metaInfo.shortDescription}setOwnFirstValue(e){this._ownFirstValue=e}firstValue(e,t){if(t)return this._series.firstValue();if(!this.isChildStudy()&&"Compare@tv-basicstudies"===this._metaInfo.id||!this._metaInfo.is_price_study){const t=this._model.timeScale().visibleBarsStrictRange();if(null===t)return null;const i=this.properties().childs()
;if(!i.visible.value()||!this.isActualInterval()||null!==this._startMovingPoint)return this._ownFirstValue;const s=t.firstBar(),r=t.lastBar();let n=null;const a=(this._metaInfo.plots||[]).filter((e=>!this._metaInfo.isPlotForceOverlay(e.id)));if(null===n){const t=new Set,l=this._metaInfo.filledAreas||[];for(let e=0;e<l.length;e++){const s=l[e];i.filledAreasStyle.childs()[s.id].childs().visible.value()&&(t.add(s.objAId),t.add(s.objBId))}for(const l of this.data().rangeIterator(s,r)){const s=l.value;for(let r=0;r<a.length;++r){if((0,I.isColorerPlot)(a[r]))continue;const l=s[r+1];if(null==l)continue;const c=a[r].id;if((0!==(0,o.ensureDefined)(i.styles.childs()[c]).childs().display.value()||t.has(c))&&!(e&&Math.abs(l)<1e-10)){n=l;break}}if(null!==n)break}}return this._ownFirstValue=n,null!==n?n:this._bandsFirstValue(e)}if(this.isChildStudy()){const e=this._getNonPriceParent();if(e&&this.priceScale()===e.priceScale())return null!==e._ownFirstValue?e._ownFirstValue:e.firstValue()}return this._series.firstValue()}desiredPriceScalePosition(){if(this.metaInfo().isTVScriptStub)return"overlay";if(this.metaInfo().linkedToSeries)return"as-series";switch(this.metaInfo().priceScale){case 1:return"left";case 0:return"right";case 2:return"overlay";default:return null}}offset(e){var t;let i=0;this._plotOffsets&&void 0!==this._plotOffsets[e]&&(i+=this._plotOffsets[e]);const s=this.properties().childs(),r=null===(t=s.offsets)||void 0===t?void 0:t.childs()[e];return r&&(i+=r.childs().val.value()),s.offset&&(i+=s.offset.childs().val.value()),i}tags(){return!this._metaInfo||!this._metaInfo.description||this._metaInfo.isTVScriptStub||this._metaInfo.is_hidden_study||this._metaInfo.isTVScript&&"tv-scripting"===this._metaInfo.productId?[]:[this._metaInfo.description]}copiable(){return zt&&!this.isChildStudy()}setPriceScale(e){super.setPriceScale(e),(0,Ct.emit)("study_event",this.id(),"price_scale_changed")}priceRange(e,t,i){let s=null;const r=this._metaInfo,n=this._fillPrecalculatedAutoscaleInfo(e,t,i);let a=this.data().minMaxOnRangeCached(e,t,n.fields);if(a=(0,v.mergeMinMax)(n.baseValueMinMax,a),n.useMainSeriesRange){const i=[{name:"low",offset:0},{name:"high",offset:0}],s=this.series().data().bars().minMaxOnRangeCached(e,t,i);a=(0,v.mergeMinMax)(a,s)}if(null!==a&&(s=new f.PriceRange(a.min,a.max)),r.bands&&i.targetPriceScale===this.priceScale())for(let e=0;e<r.bands.length;e++){const t=(0,o.ensureDefined)(this._properties.childs().bands.childs()[e]).childs();if(t.visible.value()){const e=t.value.value();if(!(0,B.isNumber)(e))continue;s?s.apply(e,e):s=new f.PriceRange(e,e)}}return this._postProcessPriceRange(s,i)}autoScaleInfo(e,t,i){const s=this.priceRange(e,t,i),r=(this.priceScale()===this._series.priceScale()||(this.priceScale(),i.targetPriceScale),{topPixelMargin:0,bottomPixelMargin:0});return{range:s,topPixelMargin:r.topPixelMargin,bottomPixelMargin:r.bottomPixelMargin}}formatter(e){var t;return null!==(t=this._formatter)&&void 0!==t?t:this._firstSourceOrSeries().formatter(!1)}defaultFormatter(){var e,t,i
;const s=this._firstSourceOrSeries();return null!==(i=null!==(e=this._defaultFormatter)&&void 0!==e?e:null===(t=s.defaultFormatter)||void 0===t?void 0:t.call(s))&&void 0!==i?i:s.formatter()}plotFormatter(e){var t;return null!==(t=this._plotFormatters.get(e))&&void 0!==t?t:this.formatter()}isMultiPaneAvailable(){return this._metaInfo.hasForceOverlayPlots()||(0,_.hasForceOverlayPrimitives)(this._metaInfo)}isMultiPaneEnabled(){return this._metaInfo.hasForceOverlayPlots()}updateAllViews(e){var t,i,s,r,n;const o=this._model.paneForSource(this),a=this._model.mainPane(),l="viewport-change"===e.type&&e.pane&&e.pane!==a;"viewport-change"===e.type&&e.pane&&e.pane!==o||(this._paneViews.forEach((t=>t.update(e))),this._labelPaneViews.forEach((t=>t.update(e))),null===(t=this._dataWindowView)||void 0===t||t.update(),null===(i=this._legendView)||void 0===i||i.update(),null===(s=this._statusView)||void 0===s||s.update(),this._priceAxisViews.forEach((t=>t.update(e))),this._priceLinesAxisViews.forEach((t=>t.update(e))),null===(r=this._inputsLinesPaneView)||void 0===r||r.update(e),null===(n=this._inputsAnchorsPaneView)||void 0===n||n.update(e),this._inputsTimeAxisPaneViews.forEach((t=>t.update(e))),this._inputsPriceAxisPaneViews.forEach((t=>t.update(e)))),l||(this._forceOverlaysPaneViews.forEach((t=>t.update(e))),this._forceOverlayLabelPaneViews.forEach((t=>t.update(e))),this._forceOverlayPriceAxisViews.forEach((t=>t.update(e)))),"data-source-change"===e.type&&e.sourceId===this.id()&&e.clearData&&this._children.forEach((e=>e.updateAllViews({type:"data-source-change",sourceId:e.id(),clearData:!0})))}removeByRemoveAllStudies(){return!0}getStudyName(){return this._studyName}nearestIndex(e,t,i){var s;return null===(s=this.data().search(e,t,i))||void 0===s?void 0:s.index}getMinFirstBarIndexForPlot(e){var t,i,s,r,n,o,a,l,c,h,d,u,p,_,m;const g=this._properties.childs(),f=this._metaInfo,v=null!==(m=null!==(u=null!==(c=null!==(o=null!==(s=null===(i=null===(t=g.styles.childs()[e])||void 0===t?void 0:t.child("showLast"))||void 0===i?void 0:i.value())&&void 0!==s?s:null===(n=null===(r=g.filledAreasStyle.childs()[e])||void 0===r?void 0:r.child("showLast"))||void 0===n?void 0:n.value())&&void 0!==o?o:null===(l=null===(a=f.styles)||void 0===a?void 0:a[e])||void 0===l?void 0:l.showLast)&&void 0!==c?c:null===(d=null===(h=g.ohlcPlots.childs()[e])||void 0===h?void 0:h.child("showLast"))||void 0===d?void 0:d.value())&&void 0!==u?u:null===(_=null===(p=f.ohlcPlots)||void 0===p?void 0:p[e])||void 0===_?void 0:_.showLast)&&void 0!==m?m:null;if(null===v)return-1/0;const y=this.data().lastIndex();return null===y?-1/0:y-v+1}guiPlotName(e,t){var i,s,r;return null!==(r=null===(s=null===(i=this._metaInfo.styles)||void 0===i?void 0:i[t])||void 0===s?void 0:s.title)&&void 0!==r?r:this.title(e)}childStudyByRebind(){return this._childStudyByRebind}isPine(){return void 0!==this._metaInfo.pine}isStandardPine(){return this.isPine()&&y.StudyMetaInfo.isStandardPine(this._metaInfo.id)}isLinkedToSeries(){return!0===this._metaInfo.linkedToSeries}defaultPlotIdForAlert(){
return this._metaInfo.plots.length?this._metaInfo.plots[0].id:null}resolvedSymbolInfoBySymbol(e){return this._resolvedSymbols&&e&&this._resolvedSymbols[this._getSymbolForResolve(e)]||null}hasPendingUnresolvedSymbols(){return this._pendingResolveSymbols.size>0}hasSymbolInputs(){return this._metaInfo.inputs.some((e=>"symbol"===e.type))}currency(){if(null!==this._currencySourceSymbolInfo)return(0,ft.symbolCurrency)(this._currencySourceSymbolInfo);const e=this.metaInfo();return Boolean(e)&&e.is_price_study?this._firstSourceOrSeries().currency():null}currencySourceSymbolInfo(){var e,t,i;return null!==(e=this._currencySourceSymbolInfo)&&void 0!==e?e:null!==(i=null===(t=this.symbolSource())||void 0===t?void 0:t.symbolInfo())&&void 0!==i?i:null}unit(){const e=this.metaInfo();return Boolean(e)&&e.is_price_study?this._firstSourceOrSeries().unit():null}canOverrideMinTick(){return!1}dataWindowView(){return this._dataWindowView}statusView(){return this._statusView}legendView(){return this._legendView}pineSourceCodeModel(){return Promise.resolve(null)}inputsForAlertState(){return this.inputs()}sessionId(){return this._firstSourceOrSeries().sessionId()}sessionIdChanged(){return this._firstSourceOrSeries().sessionIdChanged()}getSymbolString(e){return""===e?"":(0,k.encodeExtendedSymbolOrGetSimpleSymbolString)(this._getSymbolObject(e))}onStatusChanged(){return this._statusChanged}symbolsResolved(){return this._symbolsResolved}onHibernationStateChange(){return this._onHibernationStateChange}legendValuesProvider(){return new T(this,this.model())}statusProvider(e){return new V.StudyStatusProvider(this)}correctScaleMargins(e){if("Volume"===this.metaInfo().shortId){const t=this.model().paneForSource(this);return null!==t&&t.isOverlay(this)&&t.containsMainSeries()?{top:.75,bottom:0}:{top:e.top,bottom:0}}return e}canBeHiddenByGlobalFlag(){return!0}isSourceHidden(){return!this.isVisible()||this.canBeHiddenByGlobalFlag()&&A.hideAllIndicators().value()}wasCompletedBefore(){return this._wasCompletedBefore}paneViews(e){const t=this._model.mainPane();if(this.isSourceHidden())return null;if(!e.hasPriceDataSource(this))return e!==t?null:this._forceOverlaysPaneViews;const i=[];return!this._startMovingPoint&&this._wasCompletedBefore&&i.push(...this._paneViews.filter((e=>{var t;return!(null===(t=e.isForceOverlay)||void 0===t?void 0:t.call(e))}))),this._inputsLinesPaneView&&(this._startMovingPoint||this._model.selection().isSelected(this))&&i.push(this._inputsLinesPaneView),this._inputsAnchorsPaneView&&i.push(this._inputsAnchorsPaneView),e===t&&i.push(...this._forceOverlaysPaneViews),i}labelPaneViews(e){const t=this._model.mainPane();if(this.isSourceHidden()||!e.hasPriceDataSource(this))return this._metaInfo.hasForceOverlayPlots()?e!==t?null:this._forceOverlayLabelPaneViews:null;const i=[...this._labelPaneViews];return e===t&&i.push(...this._forceOverlayLabelPaneViews),i}timeAxisViews(){return this._model.selection().isSelected(this)?this._inputsTimeAxisPaneViews:null}priceAxisViews(e,t){
if(t!==this.priceScale()&&t===this._model.mainSeries().priceScale()&&!e.hasDataSource(this))return this._forceOverlayPriceAxisViews;const i=this._properties.childs().oldShowLastValue;if(i&&!i.value())return null;let s=this._priceAxisViews.slice();return this._model.selection().isSelected(this)&&(s=s.concat(this._inputsPriceAxisPaneViews)),t===this._model.mainSeries().priceScale()&&(s=s.concat(this._forceOverlayPriceAxisViews)),e.findTargetPriceAxisViews(this,t,s,this._priceLinesAxisViews)}movable(){return null!==this._inputsAnchorsPaneView}startMoving(e,t,i,s){this._startMovingPoint=e}move(e,t,i,s){if(void 0!==e.logical&&null!==this._startMovingPoint){if(Array.isArray(t)){const i=t;this._updateInputValue(e.logical,i[0]),this._updateInputValue(e.logical,i[1])}else this._updateInputValue(e.logical,t);this.updateAllViews((0,mt.sourceChangeEvent)(this.id()))}}endMoving(e,t){return this._startMovingPoint=null,{indexesChanged:!1,pricesChanged:!1}}clearData(){var e;this._invalidateLastNonEmptyPlotRowCache(),this.data().clear(),this._graphics instanceof S.LiveStudyGraphics&&(null===(e=this._graphics)||void 0===e||e.clear()),this._plotOffsets={},this.hasBarColorer()&&this._model.mainSeries().invalidateBarStylesCache(),this.updateAllViews((0,mt.sourceChangeEvent)({sourceId:this.id(),clearData:!0}))}convertYCoordinateToPriceForMoving(e,t){const i=this.priceScale();if(!t||!i||i.isEmpty())return null;const s=t.firstValue();return null===s?null:i.coordinateToPrice(e,s)}processHibernate(e){const t=this.isVisible();if(!this.isStarted()&&t&&(this._sources.forEach((e=>{e.processHibernate()})),this.start(void 0,void 0,e),this._onHibernationStateChange.fire(!1)),this.isHibernationAllowed()&&this.isStarted()&&!t){for(const e of this._children)e.processHibernate();this.stop(void 0,e),this._onHibernationStateChange.fire(!0)}}isHibernationAllowed(){return!this.metaInfo().historyCalculationMayChange&&(!this.hasChildren()||!!this._model.collapsed().value()&&this._children.every((e=>e.isHibernationAllowed())))}isPlotVisibleAt(e,t){let i;const s=this.metaInfo().plots.find((t=>t.id===e));if(i=void 0!==s?(0,I.isOhlcPlot)(s)?this._properties.childs().ohlcPlots.childs()[s.target]:this._properties.childs().styles.childs()[e]:this._properties.childs().ohlcPlots.childs()[e],void 0===i)throw new Error(`Study does not contain ${e} plot`);const r=i.childs().display.value();return null!==r&&(r&t)===t}recalculate(){const e=this._model.paneForSource(this);this._model.recalculatePane(e,(0,mt.sourceChangeEvent)(this.id())),this._model.updateSource(this)}maxOffset(){return this._maxOffset}onStart(){return this._onStart}onParentSourcesChanges(){return this._onParentSourcesChanges}isHibernated(){return!this.isVisible()&&!this.isStarted()}graphicsViewsReady(){return this._graphicsViewsReady}setRecompilationActive(e){var t;e!==Boolean(this._recompilationStatus)&&(this._recompilationStatus=e?{type:ut.StudyStatusType.Loading,startTime:Date.now()}:null,null===(t=this._statusView)||void 0===t||t.update(),this._model.updateSource(this),
this._statusChanged.fire(this.status()))}turnaround(e){if(!e)return this._turnaround;return function(e,t){let i=t.turnaround,s=[t];for(;s.length>0;){let e=[];const t=[];s.forEach((i=>{const s=N(i.sourceStudies).sort(R);if(s.length>0){e=e.concat(s);const i=s.map((e=>e.turnaround)).join("_");t.push(i)}})),t.length&&(i=t.join("_")+"_"+i),s=e}return e+"_"+i}(this._series.seriesSource().turnaround(),O(this))}canHaveChildren(){var e;return this._canHaveChildren=null!==(e=this._canHaveChildren)&&void 0!==e?e:y.StudyMetaInfo.canHaveChildren(this._metaInfo),this._canHaveChildren}setChild(e){-1===this._children.indexOf(e)&&this._children.push(e)}unsetChild(e){const t=this._children.indexOf(e);~t&&this._children.splice(t,1)}getAllChildren(){const e=this._children.slice();for(let t=0;t<e.length;++t){const i=e[t].getAllChildren();for(let t=0;t<i.length;++t)~e.indexOf(i[t])||e.push(i[t])}return e}parentSourceForInput(e){var t;if(e.includes("$")){const i=e.split("$")[0];return null!==(t=this._sources.find((e=>e.id()===i)))&&void 0!==t?t:null}return this._series}priceStep(){return this._priceStep||this._firstSourceOrSeries().priceStep(!1)}recreatePriceFormatter(){this._recreatePriceFormattingDependencies()}setOwnerSource(e){super.setOwnerSource(e),this._recreatePriceFormattingDependencies()}onTagsChanged(){return this._tagsChanged}getPropertyDefinitionsViewModel(){return null===this._definitionsViewModel?this._getPropertyDefinitionsViewModelClass().then((e=>null===e||this._isDestroyed?null:(null===this._definitionsViewModel&&(this._definitionsViewModel=new e(this._model.undoModel(),this)),this._definitionsViewModel))):Promise.resolve(this._definitionsViewModel)}_getPropertyDefinitionsViewModelClass(){return Promise.resolve(null)}_alertMetaInfo(){return this.metaInfo()}_createStudyOnServer(){if(this._isDestroyed)return!1;const e=this._getStudyIdWithLatestVersion();this._studyId=(0,D.makeNextStudyId)(),this._incrementTurnaround(),this._studyName=e;const t=(0,B.clone)((0,o.ensureDefined)(this._inputs));let i;return y.StudyMetaInfo.patchSoSInputs(t,(e=>{var t,i;return null!==(i=null===(t=this._sources.find((t=>t.id()===e)))||void 0===t?void 0:t.sourceId())&&void 0!==i?i:null})),i=this._chartApi.createStudy(this._studyId,this._turnaround,this.isChildStudy()?(0,o.ensureNotNull)(this._sources[0].sourceId()):(0,o.ensureNotNull)(this._series.seriesSource().instanceId()),this._studyName,t,this._handler,this._studySpec()),!!i||(this._studyId=null,i)}_stopStudyOnServer(){this._chartApi&&this._chartApi.isConnected().value()&&this.isStarted()&&(this._chartApi.removeStudy((0,o.ensureNotNull)(this._studyId)),this._setStatus({type:ut.StudyStatusType.Undefined})),this._studyId=null}_modifyStudyOnServer(e,t){const i=(0,B.clone)((0,o.ensureDefined)(e));y.StudyMetaInfo.patchSoSInputs(i,(e=>{var t,i;return null!==(i=null===(t=this._sources.find((t=>t.id()===e)))||void 0===t?void 0:t.sourceId())&&void 0!==i?i:null})),this._chartApi.modifyStudy((0,o.ensureNotNull)(this._studyId),this._turnaround,i,this._handler,t)}_sendNotifyCommand(e,t){
this._chartApi.notifyStudy((0,o.ensureNotNull)(this._studyId),e,t)}_transformData(e){}_invalidateLastNonEmptyPlotRowCache(){this._lastNonEmptyPlotRowCache={}}_collectDepsForAlert(){throw new Error("Not implemented")}_allInputsAreValid(){var e;if(null===(null===(e=this._visibleTimeRangeInputs)||void 0===e?void 0:e.value()))return!1;for(const e of this._metaInfo.inputs)if("bar_time"===e.type){const t=e.id;if(null==this._properties.childs().inputs.childs()[t].value())return!1}return!0}async _startAfterSymbolsResolved(e,t){await Promise.all(this._sources.map((e=>!e.isStarted()||e.isRestarting()?new Promise((t=>{e.onStart().subscribe(this,t,!0)})):Promise.resolve()))),this.isStarted()&&!this._restarting||(this._restarting=!1,this._allInputsAreValid()&&!this.metaInfo().isTVScriptStub&&(this._inputs=this._apiInputs(),this._createStudyOnServer()&&(this._subscribeToSessionId(),this._onStart.fire(),!0===e&&this._children&&await this._children.map((e=>e.start(!0,t))))))}async _changeInputsImpl(e,t){const s=this._calcSources(),r=ri(this._metaInfo),n=()=>{for(const i of this._metaInfo.inputs){if("source"!==i.type)continue;const s=e[i.id].v,r=t[i.id].v;if(s!==r){(0,o.ensureDefined)(this._properties.childs().inputs.child(i.id)).setValue(r)}}};if(this.isStarted()&&this._chartApi.isConnected().value()&&r>0&&!this._chartApi.canCreateStudy(this._studySpec(!0),!0).success){const e=window.user.pro_plan;return createGoProDialog({feature:"studyOnStudy",actions:e&&"pro_premium_expert"===e?[{text:l.t(null,void 0,i(15462)),action:PredefinedAction.Close}]:void 0}),void n()}this._inputs=e;let a=!1;const c=Object.values(F.RangeDependentStudyInputNames);for(const i of Object.keys(e))if(JSON.stringify(e[i])!==JSON.stringify(t[i])&&!c.includes(i)){a=!0;break}this._incrementTurnaround(),a&&this.disablePriceRangeReady();try{await this._updateParentSources(s,r,!0),this._modifyStudyOnServer(e,r),this._studyModified=!0}catch(e){Vt.logError(`Error applying parent sources: ${e}`),n()}this.invalidateTitleCache()}_createPriceAxisView(e){return new yt.StudyPriceAxisView(this,{plotIndex:e})}_createPriceLineAxisView(e){return new St.StudyPriceLineAxisView(this,e)}_createStudyPlotPaneView(e){return new Ze.StudyPlotPaneView(this,this._series,this._model,e)}_createViews(){var e,t,i,s;this._priceAxisViewsBase=[],this._forceOverlayPriceAxisViews=[],this._priceLinesAxisViews=[],this._paneViews=[],this._forceOverlaysPaneViews=[],this._labelPaneViews=[],this._forceOverlayLabelPaneViews=[];const r=new Set,n=this.metaInfo(),a=Boolean(n.usePlotsZOrder),l=new Map,c=this._properties.childs();if(c.filledAreasStyle&&n.filledAreas)for(let e=0;e<n.filledAreas.length;++e){const t=n.filledAreas[e],i=(0,o.ensureDefined)(c.filledAreasStyle.childs()[t.id]),s=$t(n,t.id);let r;if("plot_plot"===t.type||s?r=new rt(this,this.model(),t,i):"hline_hline"===t.type?r=new dt(this,t,i):Vt.logWarn("Unsupported filledArea type: "+t.type),void 0!==r){let e=!1;if("plot_plot"===t.type&&(e=n.isPlotForceOverlay(t.objAId)),e)this._forceOverlaysPaneViews.push(r);else{const e=a?(0,
o.ensureDefined)(t.zorder):l.size;qt(e,l),l.set(e,{paneViews:[r]})}}}{let s=-1e5;for(let c=0;c<n.plots.length;c++){const h=n.plots[c];let d,u,p,_,m,g=n.isPlotForceOverlay(h.id);if((0,I.isNonVisualPlot)(h))continue;let f=h.id,v=n.styles;const y=(0,I.isBgColorerPlot)(h);if(y)d=new q(this,this._series,this._model,f);else if((0,I.isShapesPlot)(h))d=new Le(this,this._series,this._model,f);else if((0,I.isCharsPlot)(h))d=new Re(this,this._series,this._model,f);else if((0,I.isArrowsPlot)(h))d=new Ue(this,this._series,this._model,f);else if((0,I.isOhlcPlot)(h)){const e=h.target;if(r.has(e))continue;if(g=n.isPlotForceOverlay(e),r.add(e),jt(n,c))d=new qe(this,this._series,this._model,e);else{if(!Gt(n,c)){Vt.logError(`plot ${h.id} looks to be invalid`);continue}d=new Ke(this,this._series,this._model,e)}_=this._createPriceAxisView(e),p=new Ye.PanePriceAxisView(_,this,this._model),f=e,v=n.ohlcPlots}else(0,I.isDataPlot)(h)||(_=this._createPriceAxisView(f),m=this._createPriceLineAxisView(f),d=this._createStudyPlotPaneView(f),(null===(t=null===(e=this._properties.childs().styles.childs()[f])||void 0===e?void 0:e.child("trackPrice"))||void 0===t?void 0:t.value())&&(u=new Qe(this,f)),p=new kt(_,this,this._model,f));const S=a?y?s++:(0,o.ensureDefined)(null===(i=null==v?void 0:v[f])||void 0===i?void 0:i.zorder):l.size;if(qt(S,l),g)_&&this._forceOverlayPriceAxisViews.push(_),d&&this._forceOverlaysPaneViews.push(d),p&&this._forceOverlayLabelPaneViews.push(p);else{const e={paneViews:void 0!==d?[d]:[],labelView:p,priceAxisView:_,priceLineAxisView:m};void 0!==u&&e.paneViews.push(u),l.set(S,e)}}}(null!==(s=this._metaInfo.bands)&&void 0!==s?s:[]).forEach(((e,t)=>{const i=c.bands.childs()[t];if(i&&i.childs().visible.value()){const t=new at(i,this),s=a?(0,o.ensureDefined)(e.zorder):l.size;qt(s,l),l.set(s,{paneViews:[t]})}})),c.bandsBackground&&((0,o.assert)(!a,"'usePlotsZOrder' flag does not supported"),l.set(l.size,{paneViews:[new ht(this)]}));const h=this._paneViews,d=this._forceOverlaysPaneViews;this._createGraphicsPaneViews().then((e=>{for(let t=0;t<e.regularPaneViews.length;t++)h.push(e.regularPaneViews[t]);for(let t=0;t<e.forceOverlayPaneViews.length;t++)d.push(e.forceOverlayPaneViews[t]);this._model.lightUpdate(),this._graphicsViewsReady=!0})),c.areaBackground&&((0,o.assert)(!a,"'usePlotsZOrder' flag does not supported"),l.set(l.size,{paneViews:[new et.AreaBackgroundPaneView(this,this.model())]}));const u=Array.from(l.keys()).sort(((e,t)=>e-t));for(let e=0;e<u.length;e++){const t=(0,o.ensureDefined)(l.get(u[e]));this._paneViews.push(...t.paneViews),t.labelView&&this._labelPaneViews.push(t.labelView),t.priceAxisView&&this._priceAxisViewsBase.push(t.priceAxisView),t.priceLineAxisView&&this._priceLinesAxisViews.push(t.priceLineAxisView)}this._dataWindowView||(this._dataWindowView=new nt.StudyDataWindowView(this,this._model)),this._legendView||(this._legendView=new M(this,this._model)),this._statusView||(this._statusView=new L.StudyStatusView(this)),this._concatPriceAxisViews()}_onData(e){switch(e.method){case"study_loading":
this._onStudyLoading();break;case"study_error":this._onStudyError(e.params[2]);break;case"study_completed":if(!this._checkTurnaround(e.params[1]))return;this._onStudyCompleted(e.params[e.params.length-1]);break;case"data_update":if(e.params.customId!==this.sourceId()||!this._checkTurnaround(e.params.turnaround))return;(0,o.assert)(!!e.params.nonseries,"data.params.nonseries is missing"),this._onDataUpdate(e.params.plots,(0,o.ensureDefined)(e.params.nonseries),e.params.lastBar);break;case"clear_data":this._checkTurnaround(e.params.turnaround)&&this.clearData()}}_getTelemetryObjectName(){return"study"}_onDataUpdated(e,t,i,s){if(this.hasBarColorer()&&e.length>0){const t=(0,o.ensureNotNull)(this.barColorer()).firstColoredBar(e[0].index);null!==t&&this._model.mainSeries().invalidateBarStylesCache(t)}null!==t&&this._postProcessGraphics();const r=this._model.paneForSource(this);this._model.recalculatePane(r,(0,mt.sourceChangeEvent)({sourceId:this.id(),firstUpdatedTimePointIndex:null!=s?s:void 0,nonSeriesOnly:0===e.length})),this._updateSources()}_titleInputs(e,t,i){return this.inputs(this._titleInputsOptions(e,t,i))}_titleInputsOptions(e,t,i){return{symbolsForDisplay:!0,skipHiddenInputs:!0,skipFakeInputs:!1,fakeInputsForDisplay:!0,asObject:!0,skippedGroups:[],skippedInputs:this._skippedTitleInputs(),noExchanges:t,noResolution:i,priceInputsForDisplay:!0,skipOptionalEmptySymbolInputs:Ht,displayMask:e}}_postProcessGraphics(){this._graphicsPriceAxisViews=this._createGraphicsPriceAxisViews(),this._concatPriceAxisViews()}async _createGraphicsPaneViews(){return(0,S.createGraphicsPaneViews)(this,this.model())}_createGraphicsPriceAxisViews(){return(0,S.createGraphicsPriceAxisViews)(this)}_subscribeToSessionId(){!this._isSubscribedToSessionId&&this.hasSymbolInputs()&&(this.sessionIdChanged().subscribe(this,this._onSessionIdChanged),this._isSubscribedToSessionId=!0)}_recreateFormatter(e){this._recreatePlotsFormatters(e),this._formatter=this._tryCreateFormatter(e),this._defaultFormatter=this._tryCreateDefaultFormatter(e),this._formatterChanged.fire();const t=this.priceScale();null!==t&&t.updateFormatter(),this.getAllChildren().forEach((e=>{e.recreatePriceFormatter()})),this._model.fullUpdate()}_recreatePriceFormattingDependencies(e){this._recreateFormatter(e),this._recreatePriceStep()}_title(e,t,i,s,r,n){const o=this._titleInParts(e,t,i,s,r,n);return this._joinTitlesParts(o)}_postProcessPriceRange(e,t){if(e&&e.minValue()===e.maxValue()&&!this.metaInfo().is_price_study){const t=.005*e.minValue();e=new f.PriceRange(e.minValue()-t,e.maxValue()+t)}const i=t.targetPriceScale;return i&&i.isLog()&&e?new f.PriceRange(i.priceToLogical(e.minValue()),i.priceToLogical(e.maxValue())):e}_titleInParts(e,t,s,r,n,a){var c;const h=this.name(t);s=s||{};const d=[l.t(h,{context:"study"},i(83477))];let u=[];if(!r){const i=this._getMTFResolutionInputTitle();null!==i&&i.length>0&&d.push(i);const r=this.metaInfo(),l=this._titleInputs(e,n,!0),h=r.inputs.filter((e=>l.hasOwnProperty(e.id))).map((e=>({meta:e,value:l[e.id]})));if(h.length>0){const i={}
;if(this.isChildStudy())for(let s=0;s<r.inputs.length;++s){const l=r.inputs[s];if(!y.StudyMetaInfo.isSourceInput(l))continue;const h=l.id,d=(0,o.ensureDefined)(this._properties.childs().inputs.child(h)).value();if(d.indexOf("$")>=0){const s=this.parentSourceForInput(d);if(s instanceof ci){const r=s.metaInfo(),o=s.title(e,t,{},!0,n,a);if(1===r.plots.length)i[d]=o;else{const e=d.split("$")[1],t=null===(c=r.plots[parseInt(e)])||void 0===c?void 0:c.id,s=r.styles&&r.styles[t],n=s&&s.title||t;i[d]=o+": "+n}}}}u=h.map((({meta:e,value:t})=>{if("time"===e.type)return new Date(t).toISOString();let r=(0,B.isNumber)(t)?(0,Dt.getNumericFormatter)().format(t):i&&i[t.toString()]||t.toString();return s&&s[r.toString()]&&(r=s[r.toString()]),r}))}}return[d.join(" · "),u]}_seriesDataRangeToSave(e){return this._model.timeScale().visibleExtendedDataRange(e,0)}_getSymbolForResolve(e){return this.getSymbolString(this._getSymbolForApi(e))}_getSymbolForApi(e){return e}_getSymbolObject(e){const t={symbol:e},i=this.currency();return null!==this._currencySourceSymbolInputProperty&&null!==this._currencySourceSymbolInfo&&this._getSymbolForApi(this._currencySourceSymbolInputProperty.value())===e&&(t["currency-id"]=i),t.session=this.sessionId(),t}_onSymbolResolved(e,t,i){this._onCurrencyMayChange()}_onSymbolResolvingStart(e,t){}_onSymbolError(){}_setStatus(e,t){var i;const s=this.isFailed();this._status=e,e.type===ut.StudyStatusType.Completed?this._wasCompletedBefore=!0:e.type!==ut.StudyStatusType.Error&&e.type!==ut.StudyStatusType.Undefined||(this._wasCompletedBefore=!1),t||(null===(i=this._statusView)||void 0===i||i.update(),this._model.updateSource(this),this._statusChanged.fire(this.status())),s!==this.isFailed()&&this._updateAlertCreationAvailable()}_onPropertiesChanged(){this._restarting||(this._inputs?this._tryChangeInputs():this._chartApi&&this._chartApi.isConnected().value()&&this.restart()),this._recreatePaneViews(),(0,Ct.emit)("study_properties_changed",this._id)}_lastNonEmptyPlotRow(e){var t;if(!(0,B.isInteger)(e))return Vt.logDebug("_lastNonEmptyPlotRow: incorrect plotIndex"),null;let i=null!==(t=this._lastNonEmptyPlotRowCache[e])&&void 0!==t?t:null;if(null!==i)return i;return i=this.data().findLast(((t,i)=>void 0!==i[e]),1e3),null===i?null:(this._lastNonEmptyPlotRowCache[e]=i,i)}_onCurrencyChanged(){"alwaysOff"!==(0,vt.currencyUnitVisibilityProperty)().value()&&this._model.fullUpdate(),this.isStarted()&&this._tryChangeInputs(),this._currencyChanged.fire()}_apiInputs(){return this.inputs({keepOptionalSymbolsEmpty:!0})}async _tryChangeInputs(){const e=this.isStarted()&&this._chartApi.isConnected().value(),t=this._allInputsAreValid(),i=((0,o.ensureDefined)((0,B.clone)(this._inputs)),this._apiInputs()),s=JSON.stringify(i),r=s!==JSON.stringify(this._inputs);if(e&&t)try{if(await this._allSymbolsAreResolved(),s!==JSON.stringify(this._apiInputs()))return this._tryChangeInputs();if(this._isStopped())return void(r&&this.disablePriceRangeReady());r&&await this._changeInputsImpl(i,(0,o.ensureDefined)((0,B.clone)(this._inputs)))}catch(e){
Vt.logError(`ERROR: ${this._debugId()} _tryChangeInputs: cannot modify study, ${e}`)}else if(e&&!t&&this.stop(!0),!e&&t&&this.start(!0),r){const e=this._calcSources(),t=ri(this._metaInfo);this._updateParentSources(e,t,!0),this._inputs=i}this._tagsChanged.fire()}_onCurrencyMayChange(){if(null!==this._currencySourceSymbolInputProperty){const e=this.currency();this._updateCurrencySourceSymbolInfo(),e!==this.currency()&&this._onCurrencyChanged()}}_fillPrecalculatedAutoscaleInfo(e,t,i){const s=this._metaInfo,r=this.properties().childs(),n=new Set,o=this._metaInfo.filledAreas||[];for(let e=0;e<o.length;e++){const t=o[e];r.filledAreasStyle.childs()[t.id].childs().visible.value()&&(n.add(t.objAId),n.add(t.objBId))}return s.plots.filter((e=>!(0,I.isPlotWithTechnicalValues)(e))).filter((e=>this._metaInfo.isPlotForceOverlay(e.id)?i.targetPriceScale===this._model.mainSeries().priceScale():i.targetPriceScale===this.priceScale()&&!i.forceOverlayOnly)).filter((e=>n.has(e.id)||this.isPlotVisibleAt(e.id,1))).reduce(((i,s)=>this._applyPlotToPrecalculatedAutoscaleInfo(e,t,i,s)),{fields:[],useMainSeriesRange:!1,baseValueMinMax:null})}_firstSourceOrSeries(){var e;return null!==(e=this._sources[0])&&void 0!==e?e:this._series}_skipHistogramBaseOnAutoScale(){return!1}_tryCreateFormatter(e){const t=void 0===e?this.symbolSource().symbolInfo():e;return ai(this._metaInfo.format,this._priceScaleByProperties(),t,this.properties().childs().precision.value())}_tryCreateDefaultFormatter(e){return this._tryCreateFormatter(e)}_mergeData(e){return this._invalidateLastNonEmptyPlotRowCache(),this.data().merge(e)}_skippedTitleInputs(){return this._hideMatches.filter((e=>e.plotIds.every((e=>0===this._getPlotDisplayValue(e))))).map((e=>e.id))}_getPlotDisplayValue(e){var t,i,s,r,n,o,a;return null===(a=null===(o=null===(n=null===(r=null===(s=null===(i=null===(t=this.properties())||void 0===t?void 0:t.childs())||void 0===i?void 0:i.styles)||void 0===s?void 0:s.childs())||void 0===r?void 0:r[e])||void 0===n?void 0:n.childs())||void 0===o?void 0:o.display)||void 0===a?void 0:a.value()}_onStudyError(e){this._handleStudyError(this._createStudyError(e)),this._enablePriceRangeReady()}_onStudyCompleted(e){var t;this._studyModified&&(this.clearData(),this._studyModified=!1),this._setStatus({type:ut.StudyStatusType.Completed}),null===(t=this._statusView)||void 0===t||t.update();const i=this._model.paneForSource(this);this._model.recalculatePane(i,(0,mt.sourceChangeEvent)(this.id())),this._updateSources();const s=_t.InvalidationMask.full();null!==this._model.appliedTimeFrame().value()&&s.lockVisibleTimeRangeOnResize(),this._model.invalidate(s)}_incrementTurnaround(){this._turnaround="st"+ ++this._turnaroundCounter}_checkTurnaround(e){return e===this._turnaround||e===this._model.mainSeries().seriesSource().turnaround()||e===this.turnaround(!0)}_updateMaxOffsetValue(){let e=-1/0;for(const t of this._metaInfo.plots)e=Math.max(this.offset(t.id),e);this._maxOffset.setValue(e)}_rightOffsetToUnixTime(e){if(this._series.bars().size()>=e){const t=(0,
o.ensureNotNull)(this._series.bars().lastIndex())-e;return(0,o.ensureNotNull)(this._series.bars().valueAt(t))[0]}return null}_concatPriceAxisViews(){this._priceAxisViews=[...this._priceAxisViewsBase,...this._graphicsPriceAxisViews]}_onStudyLoading(){var e;this._setStatus({type:ut.StudyStatusType.Loading,startTime:Date.now()}),null===(e=this._statusView)||void 0===e||e.update(),this._model.updateSource(this)}_handleStudyError(e){var t;this.clearData(),this._setStatus(e),null===(t=this._statusView)||void 0===t||t.update(),this._model.updateSource(this)}_createStudyError(e){var t,i;let s;return s=(0,B.isString)(e)?{error:this._getStudyErrorText(e),title:e.includes("study_not_auth")?"Access error":"Runtime error"}:{...e,title:null!==(t=e.title)&&void 0!==t?t:"Runtime error"},ni(s,null===(i=this.symbolSource().symbolInfo())||void 0===i||i.exchange)}_updateSources(){this._model.updateSource(this),this.hasBarColorer()&&this._model.updateSource(this._model.mainSeries())}_unsubscribeToSessionId(){this._isSubscribedToSessionId&&(this.sessionIdChanged().unsubscribe(this,this._onSessionIdChanged),this._isSubscribedToSessionId=!1)}_onSessionIdChanged(){this.restart(!0)}_recreatePriceStep(){var e;let t=null;const i=null!==(e=this._priceScaleByProperties())&&void 0!==e?e:this._priceScaleByMetaInfo();null!==i&&(t=1/i),this._priceStep!==t&&(this._priceStep=t,this._priceStepChanged.fire())}_recreatePlotsFormatters(e){var t,i;this._plotFormatters.clear();const s=this._metaInfo.format,r=this._priceScaleByProperties(),n=void 0===e?this.symbolSource().symbolInfo():e;for(const[e,i]of Object.entries(null!==(t=this._metaInfo.ohlcPlots)&&void 0!==t?t:{}))if(null==i?void 0:i.format){const t=ai(oi({...s,...null==i?void 0:i.format}),r,n,this.properties().childs().precision.value());t&&this._plotFormatters.set(e,t)}for(const[e,t]of Object.entries(null!==(i=this._metaInfo.styles)&&void 0!==i?i:{}))if(null==t?void 0:t.format){const i=ai(oi({...s,...null==t?void 0:t.format}),r,n,this.properties().childs().precision.value());i&&this._plotFormatters.set(e,i)}for(const e of this._metaInfo.plots)if((0,I.isOhlcPlot)(e)){const t=this._plotFormatters.get(e.target);t&&this._plotFormatters.set(e.id,t)}}_joinTitlesParts(e){const t=e[1]?e[1].join(", "):"";return e[0]+(t.length>0?" ("+t+")":"")}_getMTFResolutionInputTitle(){const e=this.metaInfo();for(let t=0;t<e.inputs.length;t++){const i=e.inputs[t];if("resolution"===i.type&&i.isMTFResolution)return(0,o.ensureDefined)(this._properties.childs().inputs.child(i.id)).value()}return null}_onDataUpdate(e,t,i){this._studyModified&&(this.clearData(),this._studyModified=!1);const s=(0,m.unpackNonSeriesData)(t.d);return this._ongoingDataUpdate=this._ongoingDataUpdate.then((()=>s),(()=>s)).then(this._onDataUnpacked.bind(this,e,t.indexes,i)),this._ongoingDataUpdate}_allSymbolsAreResolved(){const e=this._inputSymbols(),t=[];let i=!1;for(const s of e){const e=this._getSymbolForResolve(s);if(""!==e)if(this._resolvedSymbols[e])i=!0;else{const i=this._resolveSymbol(e,s);t.push(i)}}if(0===t.length){const e=Promise.resolve()
;return i?e.then((()=>this._symbolsResolved.fire())):e}return Promise.all(t).catch((e=>(this._inputSymbols().includes(e)&&this.stop(!0),this._setStatus({type:ut.StudyStatusType.Error,errorDescription:{error:Bt}}),this._model.updateSource(this),Promise.reject("Invalid symbol, "+e)))).then((()=>{this._symbolsResolved.fire(),this._recheckLineToolsActuality()}))}_resolveSymbol(e,t){if(""===e)return Promise.resolve();let i=this._pendingResolveSymbols.get(e);return void 0!==i||(i=new Promise(((i,s)=>{this._onSymbolResolvingStart(e,t),this._chartApi.resolveSymbol((0,D.makeNextSymbolId)(),e,(r=>{switch(this._pendingResolveSymbols.delete(e),r.method){case"symbol_resolved":{this._setStatus({type:ut.StudyStatusType.Undefined});const s=r.params[1];this._resolvedSymbols[e]=s,this._resolvedSymbolsByInput[t]=s,this._onSymbolResolved(e,t,s),this.invalidateTitleCache(!0),i();break}case"symbol_error":if(this._setStatus({type:ut.StudyStatusType.Error,errorDescription:{error:r.params[1]}}),this._onSymbolError(),r.params[1]===E.permissionDenied&&r.params[2]){if(r.params[2]!==E.SymbolErrorPermissionDeniedReason.Symbol)return void this._resolveSymbol(r.params[2],t).then(i);if(r.params[3])return void this._resolveSymbol(r.params[3],t).then(i)}0,s(t)}}))})),this._pendingResolveSymbols.set(e,i)),i}_recheckLineToolsActuality(){const e=this._model.paneForSource(this);null!==e&&e.sourcesByGroup().lineSourcesForAllSymbols().forEach((e=>{e.ownerSource()===this&&e.calcIsActualSymbol()}))}_sendTelemetryCounter(e,t){void 0===t&&(t=this._getTelemetryAdditionalData());const i={count:1,additional:t};telemetry.sendChartReport(e,i)}_getTelemetryAdditionalData(){let e="";return this._metaInfo.pine&&this._metaInfo.pine.version&&this._metaInfo.shortId.indexOf("USER")>=0&&(e="_v"+this._metaInfo.pine.version),{symbol:this.series().actualSymbol(),resolution:this.series().interval(),study:this._metaInfo.shortId+e}}_onSourceFormatterChanged(){null===this._formatter&&(null!==this._priceScale&&this._priceScale.updateFormatter(),this._formatterChanged.fire())}_onSourcePriceStepChanged(){null===this._priceStep&&this._priceStepChanged.fire()}_bandsFirstValue(e){const t=this._metaInfo;if(!t.bands)return null;for(let i=0;i<t.bands.length;i++){const t=(0,o.ensureDefined)(this._properties.childs().bands).childs()[i];if(t.childs().visible.value()){const i=t.childs().value.value();if(e&&0===i)continue;return i}}return null}_prepareInputs(e){(0,o.assert)(!!e,"options not set");const t=this.metaInfo(),i={},s=e.allowedInputTypes?new Set(e.allowedInputTypes):null;for(let r=0;r<t.inputs.length;r++){const n=t.inputs[r];if(null!==s&&!s.has(n.type))continue;if(n.isFake&&e.skipFakeInputs)continue;if(n.isMTFResolution&&e.noResolution)continue;if(void 0!==e.displayMask&&!((0,o.ensureDefined)(n.display)&e.displayMask))continue;if(e.skipHiddenInputs&&(!e.doNotSkipHiddenWithMigrate||!n.migrate)){let t=!1;switch(n.type){case"bool":t=e.skipBooleanInputs;break;case"color":t=e.skipColorInputs;break;case"time":t=e.skipTimeInputs;break;case"text_area":t=e.skipTextareaInputs;break;default:
t=Boolean(n.isHidden)}if(t)continue}if(void 0!==n.groupId&&-1!==e.skippedGroups.indexOf(n.groupId))continue;if(-1!==e.skippedInputs.indexOf(n.id))continue;const a=this._prepareInput(n,e);"symbol"===n.type&&e.skipOptionalEmptySymbolInputs&&""===a||(i[n.id]=(0,B.clone)(a))}return i}_prepareInputValue(e,t){var i,s,r,n;const o=e.id,a=this._properties.childs();if(t.valuesAsIsFromProperties)return a.inputs.childs()[o].value();if("symbol"===e.type){const r=t&&t.symbolsForDisplay,n=a.inputs.childs()[o].value();let l=r?n:this._getSymbolForApi(n),c=null!==(s=null===(i=this._resolvedSymbols)||void 0===i?void 0:i[this._getSymbolForResolve(l)])&&void 0!==s?s:null;if(""===l&&e.optional){if(t&&t.keepOptionalSymbolsEmpty)return l;l=this._model.mainSeries().symbol(),c=this._model.mainSeries().symbolInfo()}if(r)if(c)if(Wt){switch(this._model.mainSeries().symbolTextSourceProxyProperty().value()){case"description":l=c.description;break;case"ticker-and-description":l=`${c.name}, ${c.description}`;break;case"ticker":l=c.name}}else l=(0,ft.symbolTitle)(c,t.noExchanges);else Ut&&(l="");else c&&(l=c.ticker||c.full_name),!this.isPine()&&t&&t.symbolsForChartApi&&(l=this.getSymbolString(l));return l}if("bar_time"===e.type){let e=a.inputs.childs()[o].value();if(e<0){const t=this._rightOffsetToUnixTime(-e);e=t&&t>=0?t:e}return e}if(this._metaInfo.isTVScript||this._metaInfo.pine){if("text"===o)return null!==(n=null===(r=this._metaInfo.defaults.inputs)||void 0===r?void 0:r.text)&&void 0!==n?n:"";if("pineId"===o)return this._metaInfo.scriptIdPart;if("pineVersion"===o)return this._metaInfo.pine?this._metaInfo.pine.version:"-1";if("color"===e.type&&this._metaInfo.isRGB){const e=a.inputs.childs()[o].value();return(0,p.colorToInteger)(e)}if("price"===e.type){const e=a.inputs.childs()[o].value();return t.priceInputsForDisplay?this.formatter().format(e):e}}return a.inputs.childs()[o].value()}_getAllOwnerSources(){const e=[];let t=this.ownerSource();for(;null!==t;)e.push(t),t=t.ownerSource();return e}_getStudyIdWithLatestVersion(){return y.StudyMetaInfo.getStudyIdWithLatestVersion(this.metaInfo())}_debugId(){const e=[];return this._studyId&&e.push(this._studyId),e.push(this._metaInfo.fullId),e.push(this._metaInfo.description),JSON.stringify({study:e})}_hasAvailableAlertPlots(){return!1}_hasAlertConditions(){return!1}_hasAlertFunction(){return!1}async _updateParentSources(e,t,i){if(this._sources.forEach((e=>e.unsetChild(this))),i&&await Promise.all(e.map((e=>e.isStarted()?Promise.resolve():e.start(!1,!0)))),e.forEach((e=>e.setChild(this))),this._setSources(e),this._recreatePriceFormattingDependencies(),0!==t&&this._sources.length<=1){const e=this._firstSourceOrSeries(),t=this._priceScale,i=(0,o.ensureNotNull)(e.priceScale());if(t!==i){const t=this._model.paneForSource(this),s=(0,o.ensureNotNull)(this._model.paneForSource(e));t===s&&s.move(this,i,!0)}}}_calcSources(){const e=this._properties.childs().inputs.state();return y.StudyMetaInfo.getSourceIdsByInputs(this._metaInfo.inputs,e).map((e=>{
if("high"===e||"open"===e||"low"===e||"close"===e||"hl2"===e||"ohl3"===e||"ohlc4"===e)return null;{const t=this._model.allStudies().find((t=>t.canHaveChildren()&&t.id()===e));return null!=t?t:null}})).filter(B.notNull)}_isStopped(){return!this.isStarted()}_onDataUnpacked(e,t,i,s){if(this._isDestroyed)return;"nochange"!==t&&this._processPlotOffsets(s),this._transformData(e);const r=this._mergeData(e);null!==s&&(s.indexes_replace?((0,o.assert)("nochange"!==t),this._graphics.replaceIndexesTo(t)):("nochange"!==t&&this._graphics.replaceIndexesTo(t),void 0!==s.graphicsCmds&&this._graphics.processCommands(s.graphicsCmds))),this._onDataUpdated(e,s,t,r&&r.index),this.priceRangeReady()||this._enablePriceRangeReady(),this._dataUpdated.fire(i,!1,r)}_processPlotOffsets(e){if(e&&e.indexes_replace)return;const t=this._plotOffsets;this._plotOffsets=e&&e.offsets||{},(0,s.default)(t,this._plotOffsets)||this.updateAllViews((0,mt.sourceChangeEvent)({sourceId:this.id(),clearData:!0})),this._updateMaxOffsetValue()}_applyPlotToPrecalculatedAutoscaleInfo(e,t,i,s){var r,n,a;const l=s.id,c=this._properties.childs().styles.childs()[l],h=(0,I.isShapesPlot)(s)||(0,I.isCharsPlot)(s);i.useMainSeriesRange=i.useMainSeriesRange||(0,I.isArrowsPlot)(s);let d=(0,I.isLinePlot)(s)||(0,I.isOhlcPlot)(s);if(h){const e=(0,o.ensureDefined)(c).childs().location.value(),t=[w.MarkLocation.Absolute,w.MarkLocation.Top,w.MarkLocation.Bottom].indexOf(e)<0;i.useMainSeriesRange=i.useMainSeriesRange||h&&t,d=d||e===w.MarkLocation.Absolute}if(!d)return i;const u={name:l,offset:this.offset(l)},p=c.childs().plottype.value();if(!this._skipHistogramBaseOnAutoScale()&&[I.LineStudyPlotStyle.Histogram,I.LineStudyPlotStyle.Columns,I.LineStudyPlotStyle.Area].indexOf(p)>=0){const s=null===(a=null===(n=null!==(r=this._metaInfo.styles)&&void 0!==r?r:{})||void 0===n?void 0:n[l])||void 0===a?void 0:a.histogramBase;if(void 0===s)return i;const o=this.data().minMaxOnRangeCached(e,t,[u]);return(0,B.isNumber)(s)&&null!==o&&(i.baseValueMinMax=(0,v.mergeMinMax)(i.baseValueMinMax,{min:s,max:s}),i.baseValueMinMax=(0,v.mergeMinMax)(i.baseValueMinMax,o)),i}return i.fields.push(u),i}async _onSourceInputChanged(){if(!this.isStarted()){this._calcSources();Rt}}_buildInputs(e){(0,o.assert)(!!e,"options not set");let t={};try{t=this._prepareInputs(e)}catch(e){Vt.logWarn("Failed to prepare study inputs: "+e)}if(e.asObject){const e={};return Object.keys(t).forEach((i=>{null!=t[i]&&(e[i]=t[i])})),e}{const e=[];return Object.keys(t).forEach((i=>{null!=t[i]&&e.push(t[i])})),e}}_prepareInput(e,t){const i=this._prepareInputValue(e,t);return!e.isFake||t.fakeInputsForDisplay||t.onlyAtomValues?i:{v:i,f:!0,t:e.type}}_plotsForAlert(){return[]}_calcIsActualInterval(){const e=this._isActualInterval;this._isActualInterval=(0,pt.isActualInterval)(this._series.intervalObj(),this._properties.childs().intervalsVisibilities),e!==this._isActualInterval&&(this._onIsActualIntervalChange.fire(),this._visibleChanged(),this.processHibernate())}_visibleChanged(){this._series.invalidateBarColorerCache()}_getNonPriceParent(){
const e=this._sources;for(const t of e)if(t instanceof ci){const e=t.metaInfo();return e.is_price_study&&"Compare@tv-basicstudies"!==e.id?t._getNonPriceParent():t}return null}_updateInputValue(e,t){const i=this._properties.childs().inputs.childs();if(i[t.id])if("price"===t.type)i[t.id].setValue(e.price);else if("time"===t.type){const s=this._model.timeScale().indexToTimePoint(e.index);null!==s&&i[t.id].setValue(1e3*s)}}_initializeStudyInputsPaneViews(){}_updateCurrencySourceSymbolInfo(){var e;null!==this._currencySourceSymbolInputProperty&&(this._currencySourceSymbolInfo=null!==(e=this._resolvedSymbolsByInput[this._currencySourceSymbolInputProperty.value()])&&void 0!==e?e:null)}_initializeCurrencySource(){var e,t;const i=this.metaInfo(),s="symbolInputSymbolSource"===(null===(e=i.symbolSource)||void 0===e?void 0:e.type)&&(null===(t=i.symbolSource)||void 0===t?void 0:t.inputId),r=i.inputs.find((e=>e.id===s)),n="symbol"===(null==r?void 0:r.type);if("string"==typeof s&&n&&i.is_price_study){const e=this._properties.childs().inputs.childs()[s];void 0!==e&&(e.subscribe(this,this._onCurrencyMayChange),this._currencySourceSymbolInputProperty=e)}}_recreatePaneViews(){this.hasBarColorer()&&this._model.mainSeries().invalidateBarStylesCache(),this._createViews(),this.recalculate(),this.updateAllViews((0,mt.sourceChangeEvent)(this.id()))}_pinePatchProps(){throw new Error("Not implemented")}_areStudyInputsModified(e){if(0===Object.keys(e).length)return!1;if(void 0===this._oldStudyInputs)return!0;const t=Object.keys(this._oldStudyInputs);(0,o.assert)(t.length===Object.keys(e).length,"keys quantity should be equal");for(const i of t)if((0,o.assert)(e.hasOwnProperty(i),`key '${i}' should exist in study inputs`),(0,o.ensureDefined)(this._oldStudyInputs)[i]!==e[i])return!0;return!1}_onVisibleTimeRangeInputsChanged(e){null!==e?this._updateVisibleTimeRangeInputs(e):this.isStarted()&&this._chartApi.isConnected().value()&&this.stop(!0)}_updateVisibleTimeRangeInputs(e,t=!0){const i={first_visible_bar_time:e.firstVisibleBarTime,last_visible_bar_time:e.lastVisibleBarTime,subscribeRealtime:e.subscribeRealtime},s=this.metaInfo().inputs,r=[];for(const e of s)i.hasOwnProperty(e.id)&&r.push(e.id);const n=this.properties().childs().inputs;for(const e of r)n.childs()[e].setValueSilently(i[e]);t&&r.length>0&&n.listeners().fire(n,"")}_getStudyErrorText(e){return e.split(":",2)[0]}_priceScaleByProperties(){if("default"===this.properties().childs().precision.value())return null;const e=parseInt(this.properties().childs().precision.value());return isFinite(e)?Math.pow(10,e):null}_priceScaleByMetaInfo(){const e=this.metaInfo().format,t="inherit"!==e.type?e.precision:void 0,i=(0,B.isNumber)(t)?Math.pow(10,t):void 0;if("price"===e.type||"percent"===e.type)return i||100;if("volume"===e.type){if(void 0===e.precision){const e=this.series().symbolInfo();if(null!==e&&(0,B.isNumber)(e.volume_precision))return Math.pow(10,e.volume_precision)}return 1}return"inherit"===e.type||Vt.logWarn("Unsupported format type: "+e.type),null}_inputSymbols(){
return this.metaInfo().inputs.filter((e=>"symbol"===e.type)).map((e=>(0,o.ensureDefined)(this._properties.childs().inputs.child(e.id)).value()))}_studySpec(e){return{id:this._metaInfo.id,child:null!=e?e:this.isChildStudy(),fundamental:!1}}_onFormatterPropsChanged(){this._recreatePriceFormattingDependencies()}_setSources(e){this.invalidateTitleCache(),this._sources=e,this._onParentSourcesChanges.fire()}}(0,h.addStudyInfoToMap)("Study",(0,h.createStudyInfo)(ci))},31785:(e,t,i)=>{"use strict";i.d(t,{plotShapesData:()=>r});var s=i(11542);const r={shape_arrow_down:{guiName:s.t(null,void 0,i(34247)),id:"shape_arrow_down",paneRendererClass:"PaneRendererArrowDown",pineName:"shape.arrowdown",icon:"arrow_down"},shape_arrow_up:{guiName:s.t(null,void 0,i(77231)),id:"shape_arrow_up",paneRendererClass:"PaneRendererArrowUp",pineName:"shape.arrowup",icon:"arrow_up"},shape_circle:{guiName:s.t(null,void 0,i(91944)),id:"shape_circle",paneRendererClass:"PaneRendererCircleShape",pineName:"shape.circle",icon:"circle"},shape_cross:{guiName:s.t(null,void 0,i(6969)),id:"shape_cross",paneRendererClass:"PaneRendererCrossShape",pineName:"shape.cross",icon:"cross"},shape_diamond:{guiName:s.t(null,void 0,i(15179)),id:"shape_diamond",paneRendererClass:"PaneRendererDiamond",pineName:"shape.diamond",icon:"diamond"},shape_flag:{guiName:s.t(null,void 0,i(33885)),id:"shape_flag",paneRendererClass:"PaneRendererFlagShape",pineName:"shape.flag",icon:"flag"},shape_label_down:{guiName:s.t(null,void 0,i(85924)),id:"shape_label_down",paneRendererClass:"PaneRendererLabelDown",pineName:"shape.labeldown",icon:"label_down"},shape_label_up:{guiName:s.t(null,void 0,i(52402)),id:"shape_label_up",paneRendererClass:"PaneRendererLabelUp",pineName:"shape.labelup",icon:"label_up"},shape_square:{guiName:s.t(null,void 0,i(66205)),id:"shape_square",paneRendererClass:"PaneRendererSquare",pineName:"shape.square",icon:"square"},shape_triangle_down:{guiName:s.t(null,void 0,i(76152)),id:"shape_triangle_down",paneRendererClass:"PaneRendererTriangleApexDown",pineName:"shape.triangledown",icon:"triangle_down"},shape_triangle_up:{guiName:s.t(null,void 0,i(21236)),id:"shape_triangle_up",paneRendererClass:"PaneRendererTriangleApexUp",pineName:"shape.triangleup",icon:"triangle_up"},shape_xcross:{guiName:s.t(null,void 0,i(11316)),id:"shape_xcross",paneRendererClass:"PaneRendererXCross",pineName:"shape.xcross",icon:"x_cross"}}},9482:(e,t,i)=>{"use strict";var s=i(1640).Version,r=i(31955).getLogger("Chart.StudyMigration");function n(e){this._studyId=e,this._maxToVers=s.ZERO,this._maxFromVers=s.ZERO,this._migrs=[]}n.prototype.addMigration=function(e,t,i){var r=s.parse(e),n=s.parse(t);r.isGreater(this._maxFromVers)&&(this._maxFromVers=r),n.isGreater(this._maxToVers)&&(this._maxToVers=n),this._migrs.push({fromVers:r,toVers:n,rules:i})},n.prototype.updateInputs=function(e,t,i){if(!i)return i;for(var s=TradingView.clone(i),n=e;n.isLess(t);){var o=this._findMigration(n);if(null==o)break
;if(r.logNormal("Migrating study inputs from "+o.fromVers+" to "+o.toVers+" version, studyId: "+this._studyId+", migration: "+JSON.stringify(o)+", inputs: "+JSON.stringify(i)),s=this._applyMigration(s,o),!n.isLess(o.toVers))throw new Error("Problems in study migration process... Possible infinite cycle has been detected and stopped.");n=o.toVers}return n>e&&r.logNormal("Study inputs migration is done, studyId: "+this._studyId+", inputs: "+JSON.stringify(s)),s},n.prototype._findMigration=function(e){for(var t=-1,i=this._maxFromVers,s=0;s<this._migrs.length;s++){var r=this._migrs[s];r.fromVers.isLess(e)||r.fromVers.isLessOrEqual(i)&&(i=r.fromVers,t=s)}return t<0?null:this._migrs[t]},n.prototype._applyMigration=function(e,t){for(var i=e,s=0;s<t.rules.length;s++){var r=t.rules[s];i=this._getApplyRuleFun(r.type)(i,r)}return i},n.prototype._getApplyRuleFun=function(e){if("inputRemoved"===e)return n._applyInputRemovedRule;if("inputChangedType"===e)return n._applyInputChangedTypeRule;if("inputChangedMinMax"===e)return n._applyInputChangedMinMaxRule;if("inputChangedOptions"===e)return n._applyInputChangedOptionsRule;throw new Error("Unknown migration rule type: "+e)},n._applyInputRemovedRule=function(e,t){if(!(t.inputId in e))return e;if("removeVal"!==t.action)throw new Error("Unexpected rule.action="+t.action+" in rule.type="+t.type);var i=e[t.inputId];return delete e[t.inputId],r.logNormal("Input "+t.inputId+"="+i+" removed"),e},n._applyInputChangedTypeRule=function(e,t){var i=e[t.inputId];if("resetToDefVal"===t.action)return e[t.inputId]=t.defVal,r.logNormal("Input "+t.inputId+"="+i+" reset to default value "+t.defVal),e;if("convertVal"===t.action){if(null==i)return e;if("float"===t.inputTypeFrom&&"integer"===t.inputType)return e[t.inputId]=Math.round(e[t.inputId]),r.logNormal("Input "+t.inputId+"="+i+" converted to value "+e[t.inputId]),e;if("integer"===t.inputTypeFrom&&"float"===t.inputType)return e;if("text"===t.inputTypeFrom&&"source"===t.inputType)return n._isValidSource(i,t.options)||(e[t.inputId]=t.defVal),e;throw new Error("Cannot convertVal from "+t.inputTypeFrom+" to "+t.inputType)}throw new Error("Unknown action "+t.action+" for rule with type "+t.type)},n._isValidSource=function(e,t){return e.indexOf("$")>=0||t.indexOf(e)>=0},n._applyInputChangedMinMaxRule=function(e,t){if("adjustValIfNeeded"!==t.action)throw new Error("Unknown action "+t.action+" for rule with type "+t.type);var i=e[t.inputId];return i<t.minVal?e[t.inputId]=t.minVal:i>t.maxVal&&(e[t.inputId]=t.maxVal),r.logNormal("Input "+t.inputId+"="+i+" adjusted to value "+e[t.inputId]),e},n._applyInputChangedOptionsRule=function(e,t){if(!(["text"].indexOf(t.inputType)>=0&&"resetToDefValIfNeeded"===t.action))throw new Error("Unexpected rule.inputType="+t.inputType+" in rule.action="+t.action);var i=e[t.inputId];return t.options.indexOf(i)<0&&(e[t.inputId]=t.defVal,r.logNormal("Input "+t.inputId+"="+i+" reset to default value "+t.defVal)),e},e.exports=n},72077:(e,t,i)=>{"use strict";var s=i(28427).StudyOverlayBase;t.study_Overlay=class extends s{
async _getPropertyDefinitionsViewModelClass(){return(await Promise.all([i.e(9321),i.e(8278),i.e(4482),i.e(5450),i.e(607)]).then(i.bind(i,15306))).StudyOverlayDefinitionsViewModel}}},87989:(e,t,i)=>{"use strict";var s=i(50151).assert,r=i(37265).clone,n=i(67317).Study,o=i(64755).PlotList,a=i(60107).studyPlotFunctionMap,l=i(60107).studyEmptyPlotValuePredicate;class c{constructor(e,t,i){this._strategyPlotIndex=e,this._targetPlotIndex=t,this._startIndex=i}rebuildData(e){var t=this._targetPlotIndex+1,i=this._strategyPlotIndex+1,s=null,r=null;e.range(this._startIndex||e.firstIndex(),e.lastIndex()).each((function(n,o){var a=o[t],l=o[i]?Math.round(o[i]):null;if(o[t]=null,o[i]=null,!l||l>0)return!1;var c=n+l,h={pointIndex:c,value:a};if(r){if(r.pointIndex!==h.pointIndex){c>=0&&(e.valueAt(c)[t]=a);var d=!1;s&&(d=s.value<=r.value&&r.value<=a||s.value>=r.value&&r.value>=a),d?r.pointIndex>=0&&(e.valueAt(r.pointIndex)[t]=null):s=r,r=h}}else r=h;return!1}))}}t.study_ScriptWithDataOffset=class extends n{constructor(e,t,i,s){super(e,t,i,s),this._underlyingData=new o(a(s),l)}clearData(){super.clearData(),this._underlyingData.clear()}_mergeData(e){this._invalidateLastNonEmptyPlotRowCache();var t=this._underlyingData.firstIndex();this._underlyingData.merge(e),t!==this._underlyingData.firstIndex()&&(this._data=new o(a(this._metaInfo),l));var i=this._data.lastIndex();this._underlyingData.range(i,this._underlyingData.lastIndex()).each(function(e,t){return this._data.add(e,r(t)),!1}.bind(this)),this._plotsForStrategyProcessing().forEach((function(e){new c(e.strategyIndex,e.targetIndex,i).rebuildData(this._data)}),this)}_plotsForStrategyProcessing(){var e=[];return this._metaInfo.plots.forEach((function(t,i){if("dataoffset"===t.type){var r=this._metaInfo.plots.findIndex((function(e){return e.id===t.target}));s(r>=0,"target plot not found for strategy plot "+t.id);var n={strategyIndex:i,targetIndex:r};e.push(n)}}),this),e}}},79303:(e,t,i)=>{"use strict";i.d(t,{StudyVersioning:()=>m});var s=i(14314),r=i(50151),n=i(68159),o=i(9482),a=i.n(o),l=i(31955),c=i(1640),h=i(72530),d=i(37265);const u=(0,l.getLogger)("Chart.Study.Versioning"),p=1e12;var _;!function(e){e[e.VersionStudyArgSource=41]="VersionStudyArgSource",e[e.MetaInfoFormatVersionSosV2=42]="MetaInfoFormatVersionSosV2",e[e.VersionPineProtectTv4164=43]="VersionPineProtectTv4164",e[e.VersionNewStudyPrecisionFormat=46]="VersionNewStudyPrecisionFormat",e[e.CurrentMetaInfoFormatVersion=52]="CurrentMetaInfoFormatVersion"}(_||(_={}));class m{constructor(e,t){if(this._migrations={},!e)throw new Error("No studies metainfo");if(this._studiesMetainfo=e,!t)throw new Error("No studies migrations");this._studiesMigrations=t;for(let e=0;e<this._studiesMigrations.length;e++){const t=this._studiesMigrations[e],i=t.versFrom,s=t.versTo;for(let e=0;e<t.studyMigrations.length;e++){const r=t.studyMigrations[e],n=r.studyId;if(0===r.rules.length){u.logError("Study Migration should have at least one convertion rule");continue}const o=n in this._migrations?this._migrations[n]:new(a())(n);o.addMigration(i,s,r.rules),
this._migrations[n]=o}}this._clientMigrations=[(e,t)=>{if(0===this._studiesMetainfo.length||!e.isTVScript||e.version>=22)return t;const i={};let s=0,r=0,n=t[r];for(;void 0!==n;){const e=t[n.id];n.isFake&&(n.id="in_"+s++),i[r]=n,i[n.id]=e,r++,n=t[r]}return i}]}updateMetaInfoAsync(e){n.StudyMetaInfo.versionOf(e);{let t=null;const i=this._studiesMetainfo;for(let s=0;s<i.length;s++)if(i[s].id===e.id){t=i[s];break}return{sync:!0,result:t?new n.StudyMetaInfo(t.state()):null}}}updateStudyState(e,t,i){if(null==e||null==t||null==i)return e;e=(0,d.clone)(e),this.updateStudyInputsIfNeeded(e,t.version,i);for(const i of this._clientMigrations){const s=i.call(this,t,e.inputs);Object.keys(s).length===Object.keys(e.inputs).length?e.inputs=s:u.logWarn("StudyVersioning._clientMigrations application returned bad result. Skipping it...")}const s=n.StudyMetaInfo.versionOf(t);if(t.isTVScript&&t.TVScriptSourceCode&&s>=12&&s<=26){const s={};for(let e=0;e<t.plots.length;++e){const r=t.plots[e],n=i.plots[e];s[r.id]=n.id}const r=Object.keys(e.styles);for(let t=0;t<r.length;++t){const i=r[t],n=e.styles[i];delete e.styles[i];const o=s[i];e.styles[o]=n}const n=Object.keys(e.plots);for(let t=0;t<n.length;++t){const i=n[t],r=e.plots[i].id;e.plots[i].id=s[r]}}return e}updateStudyInputsIfNeeded(e,t,i){if(!(i.isTVScript||!!i.pine)&&t!==i.version){const s=i&&i.defaults.inputs;e.inputs=this.updateStudyInputs(i.id,t,i.version,e.inputs,s)}}updateStudyInputs(e,t,i,s,r){let n=(0,d.clone)(s);if(e in this._migrations){const s=c.Version.parse(t);let r;if("last"===i){const t=this.lastVersionOfStudy(e);r=c.Version.parse(t)}else r=c.Version.parse(i);n=this._migrations[e].updateInputs(s,r,n)}if(null==r)return n;for(const e in r)e in n||(n[e]=r[e]);for(const i in n)if(!(i in r)){const s=n[i];u.logWarn(`Extra input detected, studyId='${e}', versionFrom='${t}', inputId='${i}', inputValue='${s}', removing it and continue...`),delete n[i]}return n}lastVersionOfStudy(e){return(0,r.ensureDefined)(this._studiesMetainfo.find((t=>t.id===e))).version}updateMetaInfo(e){if(!e)return e;(0,r.assert)(e instanceof n.StudyMetaInfo),(0,r.assert)(!e.isTVScript,"This method should update only built-in java indicators metaInfo. For Pine indicators use updateMetaInfoAsync");const t=this._studiesMetainfo.find((t=>e.id===t.id));return t?new n.StudyMetaInfo(t.state()):null}static patchPointsBasedStudyState(e){return this._fixInputsMaxValue(e.state,e.metaInfo),e}static patchStudyData(e,t,i,s){return{data:t,nsData:i,indexes:null!=s?s:void 0}}static patchPointsBasedStudyData(e,t){return t}static patchPropsStateAndMetaInfo(e,t,i){var r,o;let a=t.state();"Script$BOOKER"!==t.productId||a.alerts||delete e.alerts,this._fixInputsOrder(e,a),this._fixInputsMaxValue(e,a);const l=this.splitInputs(e.inputs);e.inputs=l.obj;const c=n.StudyMetaInfo.versionOf(t);c<42&&a.isChildStudy&&(e.isChildStudy=a.isChildStudy);if(t.isTVScript&&t.version<60&&("Script$TV_EARNINGS@tv-scripting"!==t.id&&"Script$TV_DIVIDENDS@tv-scripting"!==t.id&&"Script$TV_SPLITS@tv-scripting"!==t.id||delete a.TVScriptSourceCode),
"Volume"!==t.id&&"Volume@tv-basicstudies"!==t.id||0!==t.inputs.length||(a.inputs=[{id:"length",type:"integer",defval:20,min:1,max:1e3}],a.plots.push({id:"vol_ma",type:"line"})),"Volume@tv-basicstudies"===t.id&&t.version&&t.version<=46&&void 0===e.styles.vol.transparency&&(e.styles.vol.transparency=e.transparency||87),"PivotPointsStandard@tv-basicstudies"===t.id&&(0===a.inputs.length?(e.inputs={kind:"Traditional",showHistoricalPivots:!0},a.inputs=[{defval:"Traditional",id:"kind",type:"text",options:["Traditional","Fibonacci","Woodie","Classic","DeMark","Camarilla"]},{id:"showHistoricalPivots",type:"bool",defval:!0}]):1===a.inputs.length&&(e.inputs={kind:"Traditional"},a.inputs=[{defval:"Traditional",id:"kind",type:"text",options:["Traditional","Fibonacci","Woodie","Classic","DeMark","Camarilla"]},{id:"showHistoricalPivots",type:"bool",defval:!0}]),void 0===e._hardCodedDefaultsVersion)){e._hardCodedDefaultsVersion=1;const t=e.color;delete e.color,e.levelsStyle={colors:{P:t,"S1/R1":t,"S2/R2":t,"S3/R3":t,"S4/R4":t,"S5/R5":t}}}"CMF"===t.shortId&&2===a.inputs.length&&(e.inputs={length:e.inputs["length fast"]},a.inputs=a.inputs.splice(0,1),a.inputs[0].id="length"),a.defaults&&void 0===a.defaults.precision&&c<46&&(-1!==["Volume@tv-basicstudies","VbPVisible@tv-volumebyprice","VbPSessions@tv-volumebyprice"].indexOf(t.id)?a.defaults.precision=0:a.defaults.precision=4);let d=t.id;if(t.version<60){const e=["TV_DIVIDENDS","TV_SPLITS","TV_EARNINGS"],i="Script".length;for(let s=0;s<e.length;s++)t.id.startsWith("Script$"+e[s]+"@tv-scripting")&&(a.fullId="ESD"+a.fullId.substring(i),a.id="ESD"+a.id.substring(i),a.name&&(a.name="ESD"+a.name.substring(i)),a.shortId="ESD"+a.shortId.substring(i),a.productId="ESD"+a.productId.substring(i),d="ESD"+t.id.substring(i))}const u={"ESD$TV_EARNINGS@tv-scripting":{fullId:"Earnings@tv-basicstudies-129!",id:"Earnings@tv-basicstudies",name:"Earnings@tv-basicstudies",shortId:"Earnings",productId:"tv-basicstudies"},"ESD$TV_SPLITS@tv-scripting":{fullId:"Splits@tv-basicstudies-129!",id:"Splits@tv-basicstudies",name:"Splits@tv-basicstudies",shortId:"Splits",productId:"tv-basicstudies"},"ESD$TV_DIVIDENDS@tv-scripting":{fullId:"Dividends@tv-basicstudies-129!",id:"Dividends@tv-basicstudies",name:"Dividends@tv-basicstudies",shortId:"Dividends",productId:"tv-basicstudies"}};if(d in u&&Object.assign(a,u[d]),c<43){const i={"StrategyScript$STD;Consecutive%1Ups/Downs%1Strategy":{pineId:"STD;Consecutive%1Ups%1Downs%1Strategy",className:"StrategyScript"},Script$EDGR_NET_INCOME_FROM_CONTINUING_OPERATIONS_APPLICABLE_TO_COMMON_V2:{pineId:"Script$EDGR_NET_INCOME_FROM_CONTINUING_OPS_APPLICABLE_TO_COMMON_V2",className:"Script"}};if(t.shortId in i){const n=i[t.shortId].className+"$"+i[t.shortId].pineId,o={scriptIdPart:i[t.shortId].pineId,fullId:a.fullId.replace(a.shortId,n),id:a.id.replace(a.shortId,n),name:null===(r=a.name)||void 0===r?void 0:r.replace(a.shortId,n),shortId:n};(0,s.default)(a,o),(0,s.default)(e,o)}const n=!1,l=n&&n.match(/^(USER)(_\d+)(;)(.*)$/);if(l){const t=l[0],i=l[1]+l[3]+l[2]+l[4],r={scriptIdPart:i,
fullId:a.fullId.replace(t,i),id:a.id.replace(t,i),name:null===(o=a.name)||void 0===o?void 0:o.replace(t,i),shortId:a.shortId.replace(t,i)};(0,s.default)(a,r),(0,s.default)(e,r)}}if("MA"===t.id){const t={id:"MAExp",properties:[{id:"is_price_study",type:"bool",value:"true"}],inputs:[{id:"length",type:"integer",defval:20,min:1,max:500},{id:"source",type:"text",defval:"close",options:["open","high","low","close"]}],plots:[{id:"MovAvgExp",type:"line"}],palettes:{}},i={id:"MASimple",properties:[{id:"is_price_study",type:"bool",value:"true"}],inputs:[{id:"length",type:"integer",defval:20,min:1,max:500},{id:"source",type:"text",defval:"close",options:["open","high","low","close"]}],plots:[{id:"MovAvgSimple",type:"line"}],palettes:{}},s={id:"MAVolumeWeighted",properties:[{id:"is_price_study",type:"bool",value:"true"}],inputs:[{id:"length",type:"integer",defval:20,min:1,max:500},{id:"source",type:"text",defval:"close",options:["open","high","low","close"]}],plots:[{id:"MovAvgVolumeWeighted",type:"line"}],palettes:{}},r={id:"MAWeighted",properties:[{id:"is_price_study",type:"bool",value:"true"}],inputs:[{id:"length",type:"integer",defval:20,min:1,max:500},{id:"source",type:"text",defval:"close",options:["open","high","low","close"]}],plots:[{id:"MovAvgWeighted",type:"line"}],palettes:{}};switch(e.inputs.type){case"exp":a=t;break;case"simple":a=i;break;case"weighted":a=r;break;case"volume weighted":a=s}e.styles[a.plots[0].id]=e.styles.MovAvg,delete e.styles.MovAvg,delete e.inputs.type}return i.oldShowStudyLastValueProperty&&(e.oldShowLastValue=e.showLastValue),delete e.showLastValue,delete e.showStudyArguments,(0,h.migrateMetaInfoAndPropState)(a,e),{propsState:e,metaInfo:a}}static splitInputs(e){const t={},i={};for(const[s,r]of Object.entries(e))(0,d.isNumber)(parseInt(s,10))?t[s]=r:i[s]=r;return{arr:t,obj:i}}static verifyInputsMaxValue(e){if(e.inputs)for(const t of e.inputs)"integer"===t.type&&t.max&&t.max>p&&u.logWarn("Bad integer input max value in metaInfo id="+e.id+" title="+e.description)}static mergeInputsObjPart(e,t){const i=this.splitInputs(t);(0,s.default)(e,i.obj)}static _fixInputsOrder(e,t){const i=this._getOrderedInputIds(t),r=this.splitInputs(e.inputs),n=r.arr,o=r.obj,a=(0,s.default)({},o);for(let e=0;e<i.length;++e){const t=i[e],s=this._findInputKeyById(n,t);null!==s&&(a[e]=n[s])}e.inputs=a}static _fixInputsMaxValue(e,t){if((0,d.isAbsent)(t))return;const i=p;if(t.inputs)for(const e of t.inputs)"integer"===e.type&&e.max&&e.max>i&&(e.max=i);if(!e||!e.inputs)return;const r=this.splitInputs(e.inputs),n=r.arr;for(const[,e]of Object.entries(n))"integer"===e.type&&e.max&&e.max>i&&(e.max=i);e.inputs=(0,s.default)(r.obj,r.arr)}static _findInputKeyById(e,t){let i=null;for(const s in e)if((0,d.isNumber)(parseInt(s,10))&&e[s].id===t){i=s;break}return i}static _getOrderedInputIds(e){const t=[];for(const i of e.inputs)t.push(i.id);return t}static _patchOldVolumeProfiles(e,t){if(!(null==t?void 0:t.hhists))return;const i=t.hhists[e].data,s=[];for(const[,e]of Object.entries(i))s.push(e);t.hhists[0].data=s}}},52270:(e,t,i)=>{
"use strict";function s(e,t,i){return e===t||e===i}i.d(t,{symbolSameAsResolved:()=>s})},95700:(e,t,i)=>{"use strict";i.d(t,{translateSessionDescription:()=>o,translateSessionShortDescription:()=>l});var s,r=i(11542);!function(e){e.RegularTradingHours="Regular Trading Hours",e.ExtendedTradingHours="Extended Trading Hours",e.ElectronicTradingHours="Electronic Trading Hours",e.Premarket="Premarket",e.Postmarket="Postmarket"}(s||(s={}));const n=new Map([["Premarket",r.t(null,{context:"sessions"},i(59330))],["Postmarket",r.t(null,{context:"sessions"},i(50434))],["Regular Trading Hours",r.t(null,{context:"sessions"},i(84246))],["Extended Trading Hours",r.t(null,{context:"sessions"},i(36862))],["Electronic Trading Hours",r.t(null,{context:"sessions"},i(34647))]]);function o(e){var t;return null!==(t=n.get(e))&&void 0!==t?t:e}const a=new Map([["Premarket",r.t(null,{context:"sessions"},i(46273))],["Postmarket",r.t(null,{context:"sessions"},i(7807))],["Regular Trading Hours",r.t(null,{context:"sessions"},i(35342))],["Extended Trading Hours",r.t(null,{context:"sessions"},i(8029))],["Electronic Trading Hours",r.t(null,{context:"sessions"},i(8029))]]);function l(e){var t;return null!==(t=a.get(e))&&void 0!==t?t:e}},76350:(e,t,i)=>{"use strict";i.d(t,{areEqualSymbols:()=>a,compareSymbolParams:()=>d,symbolParams:()=>h,symbolSameAsCurrent:()=>c});var s=i(56570),r=i(68805),n=i(85049);const o=s.enabled("uppercase_instrument_names");function a(e,t){return void 0===e?void 0===t:void 0!==t&&(o?e.toUpperCase()===t.toUpperCase():e===t)}function l(e,t){return e.some((e=>a(t,e)))}function c(e,t){if(null===t)return!1;if(t){if(a(t.full_name,e)||a(t.pro_name,e))return!0;if(a(t.ticker,e))return!0;if(t.aliases&&l(t.aliases,e))return!0;if(t.alternatives&&l(t.alternatives,e))return!0;if(0===e.indexOf("FRA:")&&a(t.pro_name,e.replace("FRA:","FWB:")))return!0}return!1}function h(e){return{symbol:e.symbol(),currency:e.currency(),unit:e.unit(),interval:e.interval(),style:e.style()}}function d(e,t,i){const{symbol:s,currency:o,unit:a,style:l,interval:c}=t,h=void 0!==s&&!e.symbolSameAsResolved(s);let d,u;const p=e.symbolInfo();null!==p?(d=void 0!==o&&!function(e,t){return null===e&&!(0,r.isConvertedToOtherCurrency)(t)||e===(0,r.symbolCurrency)(t)}(o,p),u=void 0!==a&&!function(e,t,i){return null===e&&!(0,r.isConvertedToOtherUnit)(t,i)||e===(0,r.symbolUnit)(t,i)}(a,p,i)):(d=void 0!==o&&o!==e.currency(),u=void 0!==a&&a!==e.unit());return{symbolChanged:h,intervalChanged:void 0!==c&&!n.Interval.isEqual(e.interval(),c),currencyChanged:d,unitChanged:u,styleChanged:void 0!==l&&l!==e.style(),styleChangeRequiresRestart:void 0!==l&&(0,r.styleChangeRequiresRestart)(l,e.style())}}},2844:(e,t,i)=>{"use strict";function s(e){return{width:e.width,actualBoundingBoxAscent:e.actualBoundingBoxAscent,actualBoundingBoxDescent:e.actualBoundingBoxDescent,fontBoundingBoxAscent:e.fontBoundingBoxAscent,fontBoundingBoxDescent:e.fontBoundingBoxDescent}}i.d(t,{TextWidthCache:()=>r,getMinTextMetrics:()=>s});class r{constructor(e=150){this._actualSize=0,this._usageTick=1,
this._oldestTick=1,this._tick2Labels=new Map,this._cache=new Map,this._fontStyle="",this._maxSize=e}reset(){this._actualSize=0,this._cache.clear(),this._usageTick=1,this._oldestTick=1,this._tick2Labels.clear()}measureText(e,t){return this.getMetrics(e,t).width}yMidCorrection(e,t){const i=this.getMetrics(e,t);return void 0!==i.actualBoundingBoxAscent&&void 0!==i.actualBoundingBoxDescent?(i.actualBoundingBoxAscent-i.actualBoundingBoxDescent)/2:0}getMetrics(e,t){e.font!==this._fontStyle&&(this.reset(),this._fontStyle=e.font);const i=this._cache.get(t);if(void 0!==i)return i.metrics;if(this._actualSize===this._maxSize){const e=this._tick2Labels.get(this._oldestTick);this._tick2Labels.delete(this._oldestTick),this._cache.delete(e),this._oldestTick++,this._actualSize--}const r=e.textBaseline;e.textBaseline="middle";const n=s(e.measureText(t));return e.textBaseline=r,0===n.width&&t.length||(this._cache.set(t,{metrics:n,tick:this._usageTick}),this._tick2Labels.set(this._usageTick,t),this._actualSize++,this._usageTick++),n}}},22677:(e,t,i)=>{"use strict";var s=i(52033).Delegate;function r(){this._marksByIndex=new Map,this._marksBySpan=[],this.changed=new s,this.minIndex=void 0,this.maxIndex=void 0}r.prototype.reset=function(){this._resetImpl(),this.changed.fire()},r.prototype._resetImpl=function(){this._marksByIndex=new Map,this._marksBySpan=[],this.minIndex=void 0,this.maxIndex=void 0,this._cache=void 0},r.prototype.merge=function(e){if(0!==e.length){var t=e[0].index,i=e[e.length-1].index;t<=this.minIndex&&i>=this.maxIndex&&this._resetImpl();for(var s=this._marksBySpan,r=new Set,n=0;n<e.length;n++){var o=(c=e[n]).index,a=c.span,l=this._marksByIndex.get(c.index);if(l){if(l.index===c.index&&l.span===c.span){l.time=c.time;continue}this._removeTickmark(l)}}for(n=0;n<e.length;n++){var c;o=(c=e[n]).index,a=c.span;if(!this._marksByIndex.has(c.index)){this._marksByIndex.set(o,c);var h=s[a];void 0===h&&(h=[],s[a]=h);var d=0===h.length||h[h.length-1].index<c.index;s[a].push(c),d||r.add(a)}}this.minIndex=void 0===this.minIndex?t:Math.min(this.minIndex,t),this.maxIndex=void 0===this.maxIndex?i:Math.max(this.maxIndex,i);for(a=s.length;a--;)s[a]&&(s[a].length||delete s[a],r.has(a)&&s[a].sort(this._sortByIndexAsc));this._cache=void 0,this.changed.fire()}},r.prototype._removeTickmark=function(e){var t=e.index;if(this._marksByIndex.get(t)===e){this._marksByIndex.delete(t),t<=this.minIndex&&this.minIndex++,t>=this.maxIndex&&this.maxIndex--,this.maxIndex<this.minIndex&&(this.minIndex=void 0,this.maxIndex=void 0);var i=this._marksBySpan[e.span],s=i.indexOf(e);-1!==s&&i.splice(s,1)}},r.prototype._sortByIndexAsc=function(e,t){return e.index-t.index},r.prototype.removeTail=function(e){var t=new Map;this.maxIndex=this.minIndex,this._marksByIndex.forEach(function(i,s){i.time<e&&(t.set(s,i),this.maxIndex=Math.max(this.maxIndex,s))}.bind(this)),this._marksByIndex=t},r.prototype.addTail=function(e){for(var t=0;t<e.length;t++)e[t].index=this.maxIndex+t+1;this.merge(e)},r.prototype.indexToTime=function(e){var t=this._marksByIndex.get(e)
;return t?new Date(1e3*t.time):null},r.prototype.density=function(){var e=this.maxIndex-this.minIndex;if(0!==e)return 1e3*(this._marksByIndex.get(this.maxIndex).time-this._marksByIndex.get(this.minIndex).time)/e},r.prototype.estimateLeft=function(e){var t=this.density();if(t)return(1e3*this._marksByIndex.get(this.minIndex).time-e)/t},r.prototype.nearestIndex=function(e){for(var t=this.minIndex,i=this.maxIndex;i-t>2;){if(1e3*this._marksByIndex.get(t).time===e)return t;if(1e3*this._marksByIndex.get(i).time===e)return i;var s=Math.round((t+i)/2);1e3*this._marksByIndex.get(s).time>e?i=s:t=s}return t},r.prototype.build=function(e,t){var i=Math.ceil(t/e);if(this._maxbar===i&&this._cache)return this._cache;this._maxbar=i;for(var s=[],r=this._marksBySpan.length;r--;)if(this._marksBySpan[r]){var n=s;s=[];for(var o=n.length,a=0,l=this._marksBySpan[r],c=l.length,h=1/0,d=-1/0,u=0;u<c;u++){for(var p=l[u],_=p.index;a<o;){var m=n[a],g=m.index;if(!(g<_)){h=g;break}a++,s.push(m),d=g,h=1/0}h-_>=i&&_-d>=i&&(s.push(p),d=_)}for(;a<o;a++)s.push(n[a])}return this._cache=s,this._cache},r.prototype.state=function(e){for(var t=[],i=this._marksBySpan.length;i--;)this._marksBySpan[i]&&(t=t.concat(this._marksBySpan[i]));if(null!==e){const i=e.firstBar(),s=e.lastBar();t=t.filter((e=>e.index>=i&&e.index<=s))}return{marks:t=t.map((function(e){return[e.span,e.time,e.index]})),version:2}},r.prototype.restoreState=function(e){if(this._marksByIndex=new Map,this._marksBySpan=[],this.maxIndex=void 0,this.minIndex=void 0,e&&e.marks&&e.marks.length)if(2===e.version){var t=e.marks.map((function(e){return{span:e[0],time:e[1],index:e[2]}}));this.merge(t)}else this.merge(e.marks)},e.exports.Tickmarks=r},66156:(e,t,i)=>{"use strict";i.d(t,{TimeAxisView:()=>o});var s=i(19063),r=i(7114);class n{constructor(){this._data=null}setData(e){this._data=e}draw(e,t,i){if(null===this._data||!this._data.visible||0===this._data.text.length)return;const s=this._data;e.font=i.font;const n=Math.round(i.widthCache.measureText(e,s.text));if(n<=0)return;e.save();const o=i.paddingHorizontal,a=n+2*o,l=a/2;let c=s.coordinate,h=Math.floor(c-l)+.5;if(s.alwaysInViewPort){const e=s.width;h<0?(c+=Math.abs(0-h),h=Math.floor(c-l)+.5):h+a>e&&(c-=Math.abs(e-(h+a)),h=Math.floor(c-l)+.5)}const d=h+a,u=Math.ceil(0+i.borderSize+i.offsetSize+i.paddingTop+i.fontSize+i.paddingBottom),{horizontalPixelRatio:p,verticalPixelRatio:_}=t;e.fillStyle=s.background;const m=Math.round(h*p),g=Math.round(0*_),f=Math.round(d*p),v=Math.round(u*_),y=Math.round(2*p);e.beginPath(),e.moveTo(m,g),e.lineTo(m,v-y),e.arcTo(m,v,m+y,v,y),e.lineTo(f-y,v),e.arcTo(f,v,f,v-y,y),e.lineTo(f,g),e.fill();const S=0+i.borderSize+i.offsetSize+i.paddingTop+i.fontSize/2;e.textAlign="left",e.textBaseline="middle",e.fillStyle=s.color;const b=i.widthCache.yMidCorrection(e,"Apr0");e.translate((h+o)*p,(S+b)*_),(0,r.drawScaled)(e,p,_,(()=>e.fillText(s.text,0,0))),e.restore()}}class o{constructor(e){this._renderer=new n,this._rendererData={background:"",color:"",coordinate:0,text:"",visible:!1,width:0,alwaysInViewPort:!0},this._invalidated=!0,
this._model=e,this._renderer.setData(this._rendererData)}update(){this._invalidated=!0}renderer(){return this._invalidated&&(this._updateImpl(),this._invalidated=!1),this._renderer}coordinate(){return this._rendererData.coordinate}_getAlwaysInViewPort(){return!0}_getText(e){const t=this._model.timeScale().indexToUserTime(e);return null!==t?this._model.dateTimeFormatter().format(t):""}_updateImpl(){const e=this._rendererData;if(e.visible=!1,this._model.timeScale().isEmpty()||!this._isVisible())return;const t=this._getIndex();null!==t&&Number.isFinite(t)&&(e.visible=!0,e.width=this._model.timeScale().width(),e.background=this._getBgColor(),e.color=(0,s.colorFromBackground)(e.background),e.coordinate=this._model.timeScale().indexToCoordinate(t),e.alwaysInViewPort=this._getAlwaysInViewPort(),e.text=this._getText(t),this._invalidated=!1)}}},50503:(e,t,i)=>{"use strict";i.d(t,{INVALID_TIME_POINT_INDEX:()=>s,UNPLOTTABLE_TIME_POINT_INDEX:()=>r});const s=-2e6,r=-1e6},11497:(e,t,i)=>{"use strict";i.d(t,{restoreTimeHoursFormatSettingsValue:()=>l,timeHoursFormatProperty:()=>a});var s=i(56840),r=i(17625);const n="time_hours_format";function o(){return s.getValue(n,"24-hours")}const a=(0,r.createPrimitiveProperty)(o());function l(){a.setValue("24-hours"),s.remove(n)}s.onSync.subscribe(null,(()=>a.setValue(o()))),a.subscribe(null,(()=>s.setValue(n,a.value())))},55158:(e,t,i)=>{"use strict";i.r(t),i.d(t,{DAY_SPAN:()=>a,DEFAULT_BAR_SPACING:()=>d,HOUR_SPAN:()=>o,MILLISECOND_SPAN:()=>s,MINUTE_SPAN:()=>n,MONTH_SPAN:()=>c,SECOND_SPAN:()=>r,WEEK_SPAN:()=>l,YEAR_SPAN:()=>h});const s=5,r=10,n=20,o=30,a=40,l=50,c=60,h=70,d=6},63146:(e,t,i)=>{"use strict";i.d(t,{getHourMinuteFormat:()=>r,getHourMinuteSecondFormat:()=>n,getTimeFormatForInterval:()=>o});var s=i(15344);function r(e){return"12-hours"===e?s.twelveHourMinuteFormat:s.hourMinuteFormat}function n(e){return"12-hours"===e?s.twelveHourMinuteSecondFormat:s.hourMinuteSecondFormat}function o(e,t){if(e.isRange())return function(e){return"12-hours"===e?s.twelveHourMinuteNonZeroSecondFormat:s.hourMinuteNonZeroSecondFormat}(t);if(e.isTicks())return s.hourMinuteSecondMillisecFormat;return e.isSeconds()||e.isTicks()?n(t):r(t)}},24708:(e,t,i)=>{"use strict";i.d(t,{translatedIntervalString:()=>r});var s=i(10074);function r(e){const t=(0,s.getTranslatedResolutionModel)(e,!0);return null===t?e:t.multiplier+(t.mayOmitShortKind?"":t.shortKind)}},70618:(e,t,i)=>{"use strict";i.d(t,{ExcludeLineToolsFromGroupUndoCommand:()=>h});var s=i(50151),r=(i(21251),i(11542)),n=i(45126),o=i(37265),a=i(60265),l=i(85719);const c=new n.TranslatedString("exclude line tools from group {group}",r.t(null,void 0,i(99395)));class h extends a.UndoCommand{constructor(e,t,i){super(c.format({group:t.name().value()}),void 0,!l.lineToolsDoNotAffectChartInvalidation),this._model=e,this._groupId=t.id,this._groupName=t.name().value(),this._lineToolsIds=i.map((e=>e.id()))}redo(){const e=(0,
s.ensureNotNull)(this._model.lineToolsGroupModel().groupForId(this._groupId)),t=this._lineToolsIds.map((e=>this._model.dataSourceForId(e))).filter(o.notNull);e.excludeLineTools(t),0===e.lineTools().length&&this._model.lineToolsGroupModel().removeGroup(e)}undo(){const e=this._lineToolsIds.map((e=>this._model.dataSourceForId(e))),t=this._model.lineToolsGroupModel().groupForId(this._groupId);null!==t?t.addLineTools(e):this._model.lineToolsGroupModel().createGroup(e,this._groupName,this._groupId)}}},69661:(e,t,i)=>{"use strict";i.d(t,{LineToolSynchronizeUndoCommand:()=>r});var s=i(60265);class r extends s.UndoCommand{constructor(e,t,i,s=!0){super(t,i,s),this._invalidateViaSync=!1,this._chartModel=e}redo(){this._invalidateViaSync?this._chartModel.lineToolsSynchronizer().executeSyncedAction((()=>this._redo())):this._redo()}undo(){this._invalidateViaSync?this._chartModel.lineToolsSynchronizer().executeSyncedAction((()=>this._undo())):this._undo()}}},52967:(e,t,i)=>{"use strict";i.d(t,{MergeDownUndoCommand:()=>a,MergeToTargetPane:()=>l,MergeUpUndoCommand:()=>o});var s=i(50151),r=i(9982);class n extends r.MoveSourceUndoCommand{constructor(e,t,i,s){super(e,t,i),this._restorePane=!1,this._keepZOrder=null!=s&&s,this._initialZOrder=t.zorder()}redo(){const e=this._chartModel.panes().length,t=this._chartModel.panes()[this._targetPaneIndex()],i=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),r=(0,s.ensureNotNull)(this._chartModel.paneForSource(i)),n=this._chartModel.children(i,!0);r.bulkActionMacro((()=>{n.forEach((e=>this._chartModel.detachSource(e))),this._restorePane=this._chartModel.detachSource(i)}));const o="overlay"===this._initialPriceScalePosition?this._initialPriceScalePosition:void 0,a=t.findSuitableScale(i,void 0,o),l=0===a.dataSources().length;if(t.bulkActionMacro((()=>{t.addDataSource(i,a,this._keepZOrder),n.forEach((e=>t.addDataSource(e,a,this._keepZOrder)))})),i===this._chartModel.mainSeries()){const e=t.priceScalePosition(a);t.movePriceScale(a,e,0)}if(l){const e=(0,s.ensureNotNull)(i.priceScale());e.restoreState(this._newPriceScaleState(t.isOverlay(i))),e.setHeight(t.height())}this._chartModel.fullUpdate(),e!==this._chartModel.panes().length&&this._chartModel.setShouldBeSavedEvenIfHidden(!0)}undo(){let e;e=this._restorePane?this._chartModel.createPane(this._initialPaneIndex):this._chartModel.panes()[this._initialPaneIndex];const t=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),i=(0,s.ensureNotNull)(this._chartModel.paneForSource(t)),r=this._chartModel.children(t,!0);i.bulkActionMacro((()=>{r.forEach((e=>this._chartModel.detachSource(e))),this._chartModel.detachSource(t)}));let n=e.getPriceScaleById(this._initialPriceScaleId);null===n&&(n=e.createPriceScaleAtPosition(this._initialPriceScalePosition,this._initialPriceScaleIndex)),e.bulkActionMacro((()=>{t.setZorder(this._initialZOrder),e.addDataSource(t,n,!0),r.forEach((t=>e.addDataSource(t,n,!1)))}));const o=(0,s.ensureNotNull)(t.priceScale());o.restoreState(this._originalPriceScaleState()),o.setHeight(e.height()),
this._chartModel.fullUpdate()}}class o extends n{constructor(e,t,i){super(e,t,i)}_targetPaneIndex(){return this._initialPaneIndex-1}}class a extends n{constructor(e,t,i){super(e,t,i)}_targetPaneIndex(){return this._initialPaneIndex+1}}class l extends n{constructor(e,t,i,s,r){super(e,t,s,r),this._targetPane=i}_targetPaneIndex(){return this._targetPane}}},9982:(e,t,i)=>{"use strict";i.d(t,{MoveSourceUndoCommand:()=>n});var s=i(50151),r=i(60265);class n extends r.UndoCommand{constructor(e,t,i){super(i),this._chartModel=e,this._sourceId=t.id();const r=(0,s.ensureNotNull)(t.priceScale());this._initialPriceScaleId=r.id(),this._initialPriceScaleState=(0,s.ensureNotNull)(t.priceScale()).state();const n=(0,s.ensureNotNull)(e.paneForSource(t));this._initialPriceScalePosition=n.priceScalePosition(r),this._initialPriceScaleIndex=n.priceScaleIndex(r,this._initialPriceScalePosition),this._initialPaneIndex=e.panes().indexOf(n)}_newPriceScaleState(e){const t={...this._initialPriceScaleState};return delete t.m_isLockScale,delete t.id,delete t.m_topMargin,delete t.m_bottomMargin,delete t.hasCalculatedPriceRange,t}_originalPriceScaleState(){return this._initialPriceScaleState}}},58783:(e,t,i)=>{"use strict";i.d(t,{MoveToExistingPriceScaleUndoCommand:()=>a,MoveToNewPriceScaleUndoCommand:()=>o});var s=i(50151),r=i(9982);class n extends r.MoveSourceUndoCommand{constructor(e,t,i,s){super(e,t,s),this._sourcePaneRemoved=!1,this._targetPaneIndex=e.panes().indexOf(i)}redo(){const e=this._chartModel.panes()[this._initialPaneIndex],t=this._chartModel.panes()[this._targetPaneIndex],i=e!==t,r=this._targetPriceScale(t),n=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),o=this._chartModel.children(n,!0);for(const e of o)i?(this._chartModel.detachSource(e),t.addDataSource(e,r,!1)):t.move(e,r);i?(this._sourcePaneRemoved=this._chartModel.detachSource(n),t.addDataSource(n,r,!1)):t.move(n,r);const a=t.priceScalePosition(r);t.movePriceScale(r,a,this._targetPriceScaleIndex(n)),this._chartModel.fullUpdate()}undo(){this._sourcePaneRemoved&&this._chartModel.createPane(this._initialPaneIndex);const e=this._chartModel.panes()[this._initialPaneIndex],t=e!==this._chartModel.panes()[this._targetPaneIndex],i=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId));let r=e.getPriceScaleById(this._initialPriceScaleId);null===r&&(r=e.createPriceScaleAtPosition(this._initialPriceScalePosition,this._initialPriceScaleIndex));const n=this._chartModel.children(i,!0);for(const i of n)t?(this._chartModel.detachSource(i),e.addDataSource(i,r,!1)):e.move(i,r);t?(this._chartModel.detachSource(i),e.addDataSource(i,r,!1)):e.move(i,r);const o=(0,s.ensureNotNull)(i.priceScale());o.restoreState(this._originalPriceScaleState()),o.setHeight(e.height()),this._chartModel.fullUpdate()}}class o extends n{constructor(e,t,i,s,r){super(e,t,i,r),this._targetPriceScalePosition=s}_targetPriceScale(e){const t=e.createPriceScaleAtPosition(this._targetPriceScalePosition);return t.restoreState(this._newPriceScaleState("overlay"===this._targetPriceScalePosition)),
t.setHeight(e.height()),t}_targetPriceScaleIndex(e){return e===this._chartModel.mainSeries()?0:void 0}}class a extends n{constructor(e,t,i,s,r){super(e,t,i,r),this._targetPriceScaleId=s.id()}_targetPriceScale(e){return(0,s.ensureNotNull)(e.getPriceScaleById(this._targetPriceScaleId))}_targetPriceScaleIndex(e){}}},74174:(e,t,i)=>{"use strict";i.d(t,{RemoveSourcesUndoCommand:()=>v});var s=i(50151),r=i(11542),n=i(45126),o=i(69661),a=i(630),l=i(31955),c=i(96286),h=i(72708),d=i(85719),u=i(70618);class p extends o.LineToolSynchronizeUndoCommand{constructor({chartModel:e,title:t,lineDataSourceIds:i}){super(e,t,void 0,!d.lineToolsDoNotAffectChartInvalidation),this._excludeLineToolsFromGroupUndoCommands=[],this._undoState=[],this._lineDataSourceIds=i}_redo(){const e=this._lineDataSourceIds.map((e=>(0,s.ensureNotNull)(this._chartModel.dataSourceForId(e))));this._groupLineToolsByGroups(e).forEach(((e,t)=>{const i=new u.ExcludeLineToolsFromGroupUndoCommand(this._chartModel,t,e);i.redo(),this._excludeLineToolsFromGroupUndoCommands.push(i)})),e.forEach((e=>{this._undoState.push({state:e.state(!1),paneIndex:this._chartModel.panes().indexOf((0,s.ensureNotNull)(this._chartModel.paneForSource(e))),sharingMode:e.sharingMode().value()}),this._chartModel.removeSource(e)}))}_undo(){var e;for(let t=this._undoState.shift();t;t=this._undoState.shift())null===(e=this._chartModel.restoreSource(!1,t.paneIndex,null,t.state,null))||void 0===e||e.share(t.sharingMode);this._excludeLineToolsFromGroupUndoCommands.forEach((e=>e.undo()))}_groupLineToolsByGroups(e){const t=this._chartModel.lineToolsGroupModel();return e.reduce(((e,i)=>{const s=t.groupForLineTool(i);if(null!==s){const t=e.get(s)||[];t.push(i),e.set(s,t)}return e}),new Map)}}var _=i(16638),m=i(300);const g=(0,l.getLogger)("Chart.RemoveSourcesUndoCommand"),f=new n.TranslatedString("remove line data sources",r.t(null,void 0,i(38199)));class v extends o.LineToolSynchronizeUndoCommand{constructor(e,t,i){super(e,i,void 0,(0,m.sourcesAffectState)(t)),this._removeLineDataSourcesUndoCommand=null,this._initialPriceScaleMode=null;const[r,n]=(0,c.closeSourcesSet)(e,t).reduce(((e,t)=>((0,a.isLineTool)(t)?e[1].push(t.id()):e[0].push(t.id()),e)),[[],[]]);this._sourceIds=r,this._lineDataSourceIds=n,this._sourceStates=[],this._paneIndexes=[],this._priceScalePositionIds=[],this._paneStates=[],this._restorePanes=[];const o=t[0];1===t.length&&(0,h.isStudy)(o)&&(this._initialPriceScaleMode=(0,s.ensureNotNull)(o.priceScale()).mode())}removedIds(){return[...this._sourceIds,...this._lineDataSourceIds]}_redo(){this._chartModel.panes().length;const e=this._sourceIds.map((e=>(0,s.ensureNotNull)(this._chartModel.dataSourceForId(e))));this._sourceStates=e.map((e=>{const t=e.state(!1);return null===t&&(0,h.isStudyStub)(e)?e.getDescriptor():t}));const t=e.map((e=>(0,s.ensureNotNull)(this._chartModel.paneForSource(e))));this._paneIndexes=t.map((e=>this._chartModel.panes().indexOf(e))),this._lineDataSourceIds.length>0&&(this._removeLineDataSourcesUndoCommand=new p({title:f,chartModel:this._chartModel,
lineDataSourceIds:this._lineDataSourceIds}),this._removeLineDataSourcesUndoCommand.redo()),this._priceScalePositionIds=e.map(((e,i)=>{const s=e.priceScale();if(null===s)return null;const r=t[i].priceScalePosition(s);return{id:s.id(),position:r,priceScaleIndex:t[i].priceScaleIndex(s,r)}}));const i=new Set;e.forEach(((e,t)=>{i.add(this._paneIndexes[t])})),this._paneStates=e.map(((e,s)=>{const r=this._paneIndexes[s];return i.has(r)?t[s].state(!1,!0):null})),this._restorePanes=e.map((e=>this._chartModel.removeSource(e)))}_undo(){const e=[];for(let t=this._sourceStates.length-1;t>=0;t--){const i=this._sourceStates[t];if(null!==i){let s=null;s="descriptor"in i&&(0,_.isStudyDescriptor)(i.descriptor)?this._chartModel.restoreStudyStub(i):this._chartModel.restoreSource(this._restorePanes[t],this._paneIndexes[t],this._paneStates[t],i,this._priceScalePositionIds[t]),s&&e.push(s)}}e.some(((t,i)=>t.id()!==this._sourceIds[e.length-i-1]))&&g.logError("Source was restored improperly - source ids does not match"),null!==this._initialPriceScaleMode&&(0,s.ensureNotNull)(e[0].priceScale()).setMode(this._initialPriceScaleMode),this._removeLineDataSourcesUndoCommand&&this._removeLineDataSourcesUndoCommand.undo()}}},77470:(e,t,i)=>{"use strict";i.d(t,{SetPriceScaleCurrencyUndoCommand:()=>o});var s=i(50151),r=i(60265),n=i(68805);class o extends r.UndoCommand{constructor(e,t,i,r){super(r),this._newSourcesCurrencies=new Map,this._oldSourcesCurrencies=new Map,this._showFade=!1,this._chartModel=e;const o=e.mainSeries();for(const e of t.seriesLikeSources()){if(!e.isVisible()||!e.isActingAsSymbolSource().value())continue;const t=i||(0,n.symbolOriginalCurrency)((0,s.ensureNotNull)(e.symbolInfo()));this._newSourcesCurrencies.set(e.id(),t),this._oldSourcesCurrencies.set(e.id(),e.currency()),this._showFade=this._showFade||e===o&&e.currency()!==t}}redo(){this._applyCurrencies(this._newSourcesCurrencies)}undo(){this._applyCurrencies(this._oldSourcesCurrencies)}_applyCurrencies(e){e.forEach(((e,t)=>{(0,s.ensureNotNull)(this._chartModel.dataSourceForId(t)).setCurrency(e)})),this._chartModel.selectionMacro((e=>{e.clearSelection()})),this._showFade&&this._chartModel.undoModel().loadingScreen().show(!0)}}},48984:(e,t,i)=>{"use strict";i.d(t,{SetPriceScaleModeCommand:()=>o});var s=i(55917),r=i(60265),n=i(44672);class o extends r.UndoCommand{constructor(e,t,i,s){super(i),this._newMode=e,this._priceScaleId=t.id(),this._model=s,this._oldMode=t.mode()}redo(){this._applyMode(this._newMode)}undo(){this._applyMode(this._oldMode)}_applyMode(e){const t=this._findPriceScaleById();null!==t&&((0,s.allowSavingDefaults)(!0),t.setMode(e),(0,s.allowSavingDefaults)(!1),this._model&&(this._model.recalculateAllPanes((0,n.viewportChangeEvent)()),this._model.lightUpdate()))}_findPriceScaleById(){const e=this._model.panes();for(let t=0;t<e.length;t++){const i=e[t].getPriceScaleById(this._priceScaleId);if(null!==i)return i}return null}}},25512:(e,t,i)=>{"use strict";i.d(t,{SetPriceScaleUnitUndoCommand:()=>o});var s=i(50151),r=i(60265),n=i(68805);class o extends r.UndoCommand{
constructor(e,t,i,r){super(r),this._newSourcesUnits=new Map,this._oldSourcesUnits=new Map,this._showFade=!1,this._chartModel=e;const o=e.mainSeries();for(const e of t.seriesLikeSources()){if(!e.isVisible()||!e.isActingAsSymbolSource().value())continue;const t=i||(0,n.symbolOriginalUnit)((0,s.ensureNotNull)(e.symbolInfo()),this._chartModel.unitConversionEnabled());this._newSourcesUnits.set(e.id(),t),this._oldSourcesUnits.set(e.id(),e.unit()),this._showFade=this._showFade||e===o&&e.unit()!==t}}redo(){this._applyUnits(this._newSourcesUnits)}undo(){this._applyUnits(this._oldSourcesUnits)}_applyUnits(e){e.forEach(((e,t)=>{(0,s.ensureNotNull)(this._chartModel.dataSourceForId(t)).setUnit(e)})),this._chartModel.selectionMacro((e=>{e.clearSelection()})),this._showFade&&this._chartModel.undoModel().loadingScreen().show(!0)}}},70131:(e,t,i)=>{"use strict";i.d(t,{SetScaleRatioPropertiesCommand:()=>o});var s=i(60265),r=i(55917),n=i(44672);class o extends s.UndoCommand{constructor(e,t,i,s){super(i),this._property=e,this._newValue=t,this._model=s,this._priceScale=this._model.mainSeries().priceScale(),this._oldValue=this._property.value(),this._oldMode=this._priceScale.mode()}redo(){this._oldValue=this._property.value(),this._oldMode=this._priceScale.mode(),(0,r.allowSavingDefaults)(!0),this._priceScale.setMode({autoScale:!1,percentage:!1,log:!1}),this._property.setValue(this._newValue),(0,r.allowSavingDefaults)(!1),this._model.recalculateAllPanes((0,n.viewportChangeEvent)()),this._model.lightUpdate()}undo(){(0,r.allowSavingDefaults)(!0),this._property.setValue(this._oldValue),this._priceScale.setMode(this._oldMode),(0,r.allowSavingDefaults)(!1),this._model.recalculateAllPanes((0,n.viewportChangeEvent)()),this._model.lightUpdate()}}},11008:(e,t,i)=>{"use strict";i.d(t,{SetWatchedValueCommand:()=>r});var s=i(60265);class r extends s.UndoCommand{constructor(e,t,i,s=!0){super(i,void 0,s),this._wv=e,this._newValue=t,this._oldValue=e.value()}redo(){this._wv.setValue(this._newValue)}undo(){this._wv.setValue(this._oldValue)}}},96286:(e,t,i)=>{"use strict";function s(e,t){let i=[];const r=e.children(t,!1);for(let t=0;t<r.length;t++)i=i.concat(s(e,r[t]));return i.push(t),i}function r(e,t){const i=new Set,r=t=>{e.children(t,!1).forEach((e=>{i.has(e)||(i.add(e),r(e))}))};return t.forEach(r),t.filter((e=>!i.has(e))).map((t=>s(e,t))).reduce(((e,t)=>e.concat(t)),[])}i.d(t,{closeSourcesSet:()=>r})},60265:(e,t,i)=>{"use strict";i.d(t,{UndoCommand:()=>r});var s=i(45126);class r{constructor(e,t=!0,i=!0){this._text=e||new s.TranslatedString("",""),this._executeOnPush=t,this._affectsState=i}text(){return this._text}executeOnPush(){return this._executeOnPush}affectsState(){return this._affectsState}canMerge(e){return!1}merge(e){throw new Error("Should be re-implemented in child classes")}}},55902:(e,t,i)=>{"use strict";i.d(t,{createUndoHistory:()=>h});var s=i(50151),r=i(7611),n=i(81479),o=i(11008),a=i(31955),l=i(52033);const c=(0,a.getLogger)("Common.UndoHistory");function h(){const e=[],t=new r.UndoStack,i=new r.UndoStack,a=new l.Delegate
;function h(s){if(e.length>0)e[e.length-1].addCommand(s);else{i.clear();const e=t.head(),r=e&&e.text().originalText();e&&e.canMerge(s)?e.merge(s):t.push(s);const n=s.text().originalText();""!==n&&n!==r&&c.logNormal("DO: "+n)}s.executeOnPush()&&s.redo(),e.length||a.fire(d())}function d(){const e=t.head(),s=i.head(),r=void 0===e?void 0:e.text(),n=void 0===s?void 0:s.text();return{enableUndo:!t.isEmpty(),undoCommandCount:t.size(),undoText:void 0!==r?r.translatedText():r,enableRedo:!i.isEmpty(),redoCommandCount:i.size(),redoText:void 0!==n?n.translatedText():n,originalUndoText:void 0!==r?r.originalText():void 0,originalRedoText:void 0!==n?n.originalText():void 0}}return{beginUndoMacro:function(t){const i=new n.UndoMacroCommand(t);return e.push(i),i},clearStack:function(){t.clear(),i.clear(),a.fire(d())},createUndoCheckpoint:function(){return{lastActualCommand:t.isEmpty()?null:t.head()}},endUndoMacro:function(){const t=(0,s.ensureDefined)(e.pop());t.isEmpty()||h(t)},pushUndoCommand:h,redo:function(){if(i.isEmpty())return!1;const e=i.pop();return!!e&&(e.redo(),t.push(e),c.logNormal("REDO: "+e.text().originalText()),a.fire(d()),!0)},redoStack:function(){return i},setWatchedValue:function(e,t,i,s){if(e.value()!==t){const r=new o.SetWatchedValueCommand(e,t,i,!s);h(r),r.redo()}},undo:function(){if(t.isEmpty())return!1;const e=t.pop();return!!e&&(e.undo(),i.push(e),c.logNormal("UNDO: "+e.text().originalText()),a.fire(d()),!0)},undoStack:function(){return t},undoToCheckpoint:function(e){for(;!t.isEmpty()&&e.lastActualCommand!==t.head();)t.pop().undo();i.clear(),a.fire(d())},state:d,onChange:function(){return a}}}},81479:(e,t,i)=>{"use strict";i.d(t,{UndoMacroCommand:()=>r});var s=i(60265);class r extends s.UndoCommand{constructor(e){super(e,!1),this._subcommands=[]}addCommand(e){this._subcommands.push(e)}isEmpty(){return 0===this._subcommands.length}redo(){for(let e=0;e<this._subcommands.length;e++)this._subcommands[e].redo()}undo(){for(let e=this._subcommands.length-1;e>=0;e--)this._subcommands[e].undo()}commands(){return this._subcommands}affectsState(){return this._subcommands.some((e=>e.affectsState()))}}},7611:(e,t,i)=>{"use strict";i.d(t,{UndoStack:()=>o});var s=i(60265),r=i(52033);const n=(0,i(31955).getLogger)("Common.UndoStack");class o{constructor(){this._commands=[],this._onChange=new r.Delegate}onChange(){return this._onChange}isEmpty(){return 0===this._commands.length}size(){return this._commands.length}clear(){this.isEmpty()||(this._commands.length=0,this._onChange.fire())}push(e){if(!(e instanceof s.UndoCommand))throw new TypeError("argument must be an instance of UndoCommand");this._commands.push(e),this._onChange.fire(e)}pop(){if(this.isEmpty())return void n.logDebug("pop: undo stack is empty");const e=this._commands.pop();return this._onChange.fire(e),e}head(){if(!this.isEmpty())return this._commands[this._commands.length-1]}}},83520:(e,t,i)=>{"use strict";i.d(t,{UnmergeDownUndoCommand:()=>o,UnmergeToNewBottomPane:()=>l,UnmergeUpUndoCommand:()=>a});var s=i(50151),r=i(9982)
;class n extends r.MoveSourceUndoCommand{constructor(e,t,i){super(e,t,i)}redo(){const e=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),t=(0,s.ensureNotNull)(this._chartModel.paneForSource(e)),i=this._chartModel.children(e,!0);t.bulkActionMacro((()=>{i.forEach((e=>this._chartModel.detachSource(e))),this._chartModel.detachSource(e)}));const r=this._chartModel.createPane(this.targetPaneIndex()),n=r.findSuitableScale(e);r.bulkActionMacro((()=>{r.addDataSource(e,n,!1),i.forEach((e=>r.addDataSource(e,n,!1)))}));const o=(0,s.ensureNotNull)(e.priceScale());o.restoreState(this._newPriceScaleState(r.isOverlay(e))),o.setHeight(r.height()),this._chartModel.fullUpdate(),this._chartModel.setShouldBeSavedEvenIfHidden(!0)}undo(){const e=(0,s.ensureNotNull)(this._chartModel.dataSourceForId(this._sourceId)),t=(0,s.ensureNotNull)(this._chartModel.paneForSource(e)),i=this._chartModel.children(e,!0);t.bulkActionMacro((()=>{i.forEach((e=>this._chartModel.detachSource(e)));const t=this._chartModel.detachSource(e);(0,s.assert)(t,"Undo of detaching must remove pane")}));const r=this._chartModel.panes()[this._initialPaneIndex];let n=r.getPriceScaleById(this._initialPriceScaleId);null===n&&(n=r.createPriceScaleAtPosition(this._initialPriceScalePosition,this._initialPriceScaleIndex)),r.bulkActionMacro((()=>{r.addDataSource(e,n,!0),i.forEach((e=>r.addDataSource(e,n,!1)))}));const o=(0,s.ensureNotNull)(e.priceScale());o.restoreState(this._originalPriceScaleState()),o.setHeight(r.height()),this._chartModel.fullUpdate()}}class o extends n{constructor(e,t,i){super(e,t,i)}targetPaneIndex(){return this._initialPaneIndex+1}}class a extends n{constructor(e,t,i){super(e,t,i)}targetPaneIndex(){return this._initialPaneIndex}}class l extends n{constructor(e,t,i){super(e,t,i)}targetPaneIndex(){return this._chartModel.panes().length}}},33515:(e,t,i)=>{"use strict";i.d(t,{sourceNewUnitOnPinningToPriceScale:()=>o,unitConvertibleGroups:()=>n});var s=i(60074),r=i(68805);function n(e,t,i){const s=(0,r.symbolUnitConvertibleGroupsIfExist)(e,!0);if(null!==s)return s;const n=i.unitGroupById(t);return null===n?[]:[n]}function o(e,t,i,r){let o=null;if(i.unitConversionEnabled()&&(0,s.isSymbolSource)(e)){const s=i.availableUnits(),a=t.unit(s),l=e.unit(),c=null===l?[]:n(e.symbolInfo(),l,s);null!==a&&null!==a.selectedUnit&&!a.allUnitsAreOriginal&&a.selectedUnit!==l&&(r&&null===l||null!==l&&s.convertible(l,c))&&(o=a.selectedUnit)}return o}},17656:(e,t,i)=>{"use strict";i.d(t,{createVisibilityController:()=>h});var s,r=i(11542),n=i(32563),o=i(17625),a=i(56840);!function(e){e.AlwaysOn="alwaysOn",e.VisibleOnMouseOver="visibleOnMouseOver",e.AlwaysOff="alwaysOff"}(s||(s={}));const l="visibleOnMouseOver";function c(e){return"alwaysOn"===e||"alwaysOff"===e?e:l}function h(e,t){let s,h;function d(){if(!s){s=(0,o.createPrimitiveProperty)();let i=a.getValue(e);void 0===i&&void 0!==t&&(i=a.getValue(t)),s.setValue(c(i)),s.subscribe(s,(t=>{a.setValue(e,c(t.value()))}))}return s}return{property:d,availableValues:function(){return[{id:"visibleOnMouseOver",
value:"visibleOnMouseOver",title:r.t(null,void 0,i(10309))},{id:"alwaysOn",value:"alwaysOn",title:r.t(null,void 0,i(36299))},{id:"alwaysOff",value:"alwaysOff",title:r.t(null,void 0,i(40452))}]},actualBehavior:function(){if(!h){h=(0,o.createPrimitiveProperty)();const e=d(),t=()=>{let t=e.value();"alwaysOn"!==t&&"alwaysOff"!==t&&(t=n.mobiletouch?"alwaysOn":"visibleOnMouseOver"),h&&h.setValue(t)};e.subscribe(h,t),t()}return h},restoreDefaultValue:function(){d().setValue(l),a.remove(e)}}}},96001:(e,t,i)=>{"use strict";i.d(t,{restoreWatermarkPropertyDefaults:()=>h,watermarkProperty:()=>c});var s=i(95171),r=i(56840),n=i(12988);const o="symbolWatermark",a={visibility:!1,color:"rgba(80, 83, 94, 0.25)"};function l(){const e=r.getJSON(o);return Object.assign({},a,e)}const c=(0,s.default)((()=>{const e=new n.Property(l());return r.onSync.subscribe(null,(()=>e.mergeAndFire(l()))),e.subscribe(null,(()=>r.setJSON(o,e.state()))),e}));function h(){c().mergeAndFire(a)}},9155:(e,t,i)=>{"use strict";i.d(t,{moveAfterSource:()=>D,moveBeforeSource:()=>E,newLineToolZOrder:()=>C,newStudyZOrder:()=>P,reorderDataSourcesStateZOrder:()=>S});var s,r=i(630),n=i(72708),o=i(32549),a=i(36915),l=i(29981);function c(e){return(0,r.isLineTool)(e)&&!e.isSpeciallyZOrderedSource()}function h(e){return(0,n.isStudy)(e)&&!e.isSpeciallyZOrderedSource()||(0,n.isStudyStub)(e)}function d(e,t){return e.zorder-t.zorder}function u(e,t){(0,a.isMainSeriesState)(e)?e.zorder=0:e.zorder=t}function p(e,t){e.setZorder(t)}function _(e){return e.zorder()}function m(e){return Math.round(1e3*e)/1e3}function g(e,t){const i=Math.max(e,t),s=Math.min(e,t);return Math.max(0,Math.ceil(i)-Math.floor(s)-1)}function f(e,t,i){let s=0;const r=function(e,t){const i=1e3;return Math.abs(t*i-e*i)/i}(t,e);var n;return r>i?(e=Math.trunc(e),s=Math.floor(r/(i+1))):(n=r/(i+1),s=Math.floor(1e3*n)/1e3),{startZOrder:e,zOrderStep:s}}function v(e,t,i,s){let r=e.length,n=t;for(let t=e.length-1;t>=-1;t--)if(-1===t||s(e[t])){const s=t;let o=T(n);if(r-1===s)s>=0&&i(e[s],o);else{const t=g(r,s);let a=0;for(;0===a;){const e=f(n,o,t);n=e.startZOrder,a=e.zOrderStep,0===a&&(o-=1e4,0===o&&(o-=1e4))}let l=r-1;for(;l>s;){const t=m(n-a);i(e[l],t),n=t,l--}s>=0&&i(e[s],o)}n=o,r=s}}function y(e,t,i,s){let r=-1,n=t;for(let t=0;t<=e.length;t++)if(t===e.length||s(e[t])){const s=t;let o=x(n);if(r+1===s)s<=e.length-1&&i(e[s],o);else{const t=g(r,s);let a=0;for(;0===a;){const e=f(n,o,t);n=e.startZOrder,a=e.zOrderStep,0===a&&(o+=1e4,0===o&&(o+=1e4))}let l=r+1;for(;l<=s-1;){const t=m(n+a);i(e[l],t),n=t,l++}s<=e.length-1&&i(e[s],o)}n=o,r=s}}function S(e){!function(e,t,i,s,r,n){let o=null;const a=[];for(const r of e)t(r)?(a.push(r),o=r):(i(r)||s(r))&&a.push(r);a.sort(n),null!==o&&r(o,0);const l=null===o?-1:a.indexOf(o);-1!==l?(v(a.slice(0,l),0,r,i),y(a.slice(l+1),0,r,i)):y(a,0,r,i)}(e,a.isMainSeriesState,a.isStudyState,a.isLineToolState,u,d)}function b(e,t){const i=Math.floor(e/1e4);let s=t.get(i);return void 0===s&&(s=[],t.set(i,s)),s}function w(e,t,i,s,r,n){let o=-1/0,a=1/0,l=-1/0,c=0;const h=new Map
;for(let s=0;s<e.length;++s){const n=e[s],d=r(n);t(n)?(o=Math.max(o,d),b(d,h).push(n)):i(n)&&(d<0&&(a=Math.min(a,d),l=Math.max(l,d)),c=Math.max(c,d))}if(n){const e=Math.max(c,o),t=f(e,x(e),1);return m(t.startZOrder+t.zOrderStep)}if(o===-1/0){const e=a===1/0?0:a,t=f(T(e),e,1);return m(t.startZOrder+t.zOrderStep)}const d=f(o,x(o),1);if(0!==d.zOrderStep)return m(d.startZOrder+d.zOrderStep);const u=b(o,h).sort(((e,t)=>r(e)-r(t)));let p=T(r(u[0]));const _=x(p),g=f(p,_,u.length+1).zOrderStep;return 0!==g?(u.forEach((e=>{const t=m(p+g);s(e,t),p=t})),m(p+g)):m(_+5e3)}function C(e,t){return w(e,c,h,p,_,t)}function P(e){let t=-1e4;for(const i of e)h(i)&&(t=Math.min(t,i.zorder()-1e4));return 0===t?-1e4:t}function x(e){const t=1e4*Math.ceil(e/1e4);return t===e?t+1e4:t}function T(e){const t=1e4*Math.floor(e/1e4);return t===e?t-1e4:t}function I(e,t,i,s,r,n,o){const a=t.length,{newItems:c,movedItemsStartIndex:h}=i>0?(0,l.moveAfter)(e,t,i-1):(0,l.moveBefore)(e,t,0);let d=!1;for(let t=h;t<h+a;t++)if(c[t]!==e[t]){d=!0;break}if(!d)return;if(s(t[0]))return void(i<e.length&&o(e[i])<0?y(c.slice(h+1),0,n,r):v(c.slice(0,h),0,n,r));t.some((e=>r(e)))?function(e,t,i,s,r,n){let o,a,l=-1,c=-1;0===i?(c=M(e,i+t,s),a=n(e[c])):i+t===e.length?(l=A(e,i-1,s),o=n(e[l])):(l=A(e,i-1,s),o=n(e[l]),c=M(e,i+t,s),a=n(e[c]));if((void 0===o||o<0)&&void 0!==a&&a<=0)v(e.slice(0,c),a,r,s);else if((void 0===a||a>0)&&void 0!==o&&o>=0)y(e.slice(l+1),o,r,s);else{i+t<e.length-i?v(e.slice(0,i+t),n(e[i+t]),r,s):y(e.slice(i),n(e[i-1]),r,s)}}(c,a,h,r,n,o):function(e,t,i,s,r,n,o){let a,l;0===i?l=o(e[i+t]):i+t===e.length?a=o(e[i-1]):(a=o(e[i-1]),l=o(e[i+t]));let c=0,h=0,d=0,u=0,p=0;if((void 0===a||a<0)&&void 0!==l&&l<=0){c=l;const e=f(c,void 0!==a?a:T(l),t);c=e.startZOrder,p=e.zOrderStep,d=i+t-1,u=d-t,h=-1}else if((void 0===l||l>0)&&void 0!==a&&a>=0){c=a;const e=f(c,void 0!==l?l:x(a),t);c=e.startZOrder,p=e.zOrderStep,d=i,u=d+t,h=1}if(0!==p)for(;d!==u;){const t=m(c+h*p);n(e[d],t),c=t,d+=h}else{const t=e.findIndex((e=>r(e)));-1!==t?(v(e.slice(0,t),0,n,s),y(e.slice(t+1),0,n,s)):y(e,0,n,s)}}(c,a,h,r,s,n,o)}function M(e,t,i){for(;t<e.length&&i(e[t]);)t++;return Math.min(t,e.length-1)}function A(e,t,i){for(;t>=0&&i(e[t]);)t--;return Math.max(0,t)}function L(e,t,i,s,r,n,o){const a=e.indexOf(i)+1;I(e,t,a,s,r,n,o)}function k(e,t,i,s,r,n,o){const a=e.indexOf(i);I(e,t,a,s,r,n,o)}function D(e,t,i){L(e,t,i,o.isSeries,h,p,_)}function E(e,t,i){k(e,t,i,o.isSeries,h,p,_)}!function(e){e[e.MainSeriesZOrder=0]="MainSeriesZOrder",e[e.StudyBaseZOrder=1e4]="StudyBaseZOrder",e[e.MaxFractionLength=3]="MaxFractionLength"}(s||(s={}))},94664:(e,t,i)=>{"use strict";i.d(t,{getSymbolSearchCompleteOverrideFunction:()=>n,setSymbolSearchCompleteOverrideFunction:()=>r});let s=(e,t)=>{var i;return Promise.resolve({symbol:e,name:null!==(i=null==t?void 0:t.symbol)&&void 0!==i?i:e})};function r(e){s=e}function n(){return s}},95062:(e,t,i)=>{"use strict";i.d(t,{StudyMetaInfoBase:()=>m});var s=i(27147),r=i(50151),n=i(94113),o=i(65383),a=i(37265),l=i(35039)
;const c=new Set(["CorrelationCoefficient@tv-basicstudies","Correlation - Log@tv-basicstudies-1"]),h=new Set([]),d=new Set(["line"]),u=new Map([["AnchoredVWAP@tv-basicstudies","linetoolanchoredvwap"],["RegressionTrend@tv-basicstudies","linetoolregressiontrend"],["VbPAnchored@tv-basicstudies","linetoolanchoredvp"]]),p=/^([^\$]+)\$\d+$/,_=["bool","color","time","text_area"];class m{constructor(e){(0,a.merge)(this,{palettes:{},inputs:[],plots:[],graphics:{},defaults:{}}),(0,a.merge)(this,e);const t=e.fullId||e.id;(0,a.merge)(this,m.parseIdString(t)),this._updateInputDisplayDefaults()}state(){const e={};for(const[t,i]of Object.entries(this))this.hasOwnProperty(t)&&(e[t]=i,"id"===t&&(e[t]+="-"+this.version));return e}createDefaults(){if(this.defaults){const e=(0,a.clone)(this.defaults);e.precision="default";const t=m.getStudyPropertyRootName(this);(0,l.createDefaults)(t,e)}}removeDefaults(){(0,l.removeDefaults)(m.getStudyPropertyRootName(this))}isPlotForceOverlay(e){var t,i,s,r,o;const a=null===(t=this.styles)||void 0===t?void 0:t[e],l=this.plots.find((t=>t.id===e));return!!(null==a?void 0:a.forceOverlay)||l&&(0,n.isOhlcPlot)(l)&&(null===(s=null===(i=this.ohlcPlots)||void 0===i?void 0:i[l.target])||void 0===s?void 0:s.forceOverlay)||!!(null===(o=null===(r=this.ohlcPlots)||void 0===r?void 0:r[e])||void 0===o?void 0:o.forceOverlay)}hasForceOverlayPlots(){var e;return this.plots.some((e=>this.isPlotForceOverlay(e.id)))||Object.values(null!==(e=this.ohlcPlots)&&void 0!==e?e:{}).some((e=>!!(null==e?void 0:e.forceOverlay)))}static getSourceIdsByInputs(e,t){if(!Array.isArray(e)||!t)return[];const i=[];for(const r of e)if(m.isSourceInput(r)&&(0,s.default)(t[r.id])){const e=t[r.id];e.includes("$")&&i.push(e.split("$")[0])}return i}static isSourceInput(e){return Boolean(e.id&&(("source"===e.id||"src"===e.id)&&("text"===e.type||"source"===e.type)||"source"===e.type))}static getSourceInputIds(e){const t=[];for(const i of e.inputs)m.isSourceInput(i)&&t.push(i.id);return t}static setChildStudyMetaInfoPropertiesSourceId(e,t,i){for(const s of e.inputs){if(!m.isSourceInput(s))continue;const e=i.childs().inputs&&i.childs().inputs.childs()[s.id];if(e){const i=e.value(),s=p.exec(i);if(2===(null==s?void 0:s.length)){if("{pid}"===s[1]){const s=i.replace(/^[^\$]+/,t);e.setValue(s)}}}}}static patchSoSInputs(e,t){const i=e=>{const i=p.exec(e);if(2===(null==i?void 0:i.length)){const s=i[1],n=`${(0,r.ensureNotNull)(t(s))}`;return e.replace(/^[^\$]+/,n)}return e};for(const t in e)if(/in_[\d+]/.test(t)||"source"===t){const r=e[t];(0,s.default)(r)?e[t]=i(r):(0,o.isExtendedInput)(r)&&(0,o.isExtendedInputSource)(r)&&(r.v=i(r.v))}}static canBeChild(e){if((0,s.default)(e))return!0;if(!e)return!1;if(e.extra&&!m.isAllowedSourceInputsCount(e.extra.sourceInputsCount)||!0===e.canNotBeChild||!1===e.canBeChild||c.has(e.id))return!1;let t=0;for(const i of e.inputs)m.isSourceInput(i)&&(t+=1);return m.isAllowedSourceInputsCount(t)}static isAllowedSourceInputsCount(e){return 1===e}static canHaveChildren(e){if(e){
if(e.isTVScriptStrategy||e.TVScriptSourceCode&&isStrategy(e.TVScriptSourceCode))return!1;if(e.id&&!h.has(e.id)&&Array.isArray(e.plots))for(const t of e.plots)if(d.has(t.type))return!0}return!1}static getChildSourceInputTitles(e,t,i){var s;const r={};if(t.plots&&t.plots.length&&e.options&&e.options.length)for(const n of e.options){const e=n?+n.split("$")[1]:NaN,o=isFinite(e)&&t.plots[e];o&&d.has(o.type)&&(r[n]=t.styles&&t.styles[o.id]&&(null===(s=t.styles[o.id])||void 0===s?void 0:s.title)||o.id,i&&(r[n]=i+": "+r[n]))}return r}static canPlotBeSourceOfChildStudy(e){return d.has(e)}static getStudyPropertyRootName(e){const t=u.get(e.id);if(void 0!==t)return t;let i="study_"+e.id;return e.pine&&e.pine.version&&(i+="_"+e.pine.version.replace(".","_")),i}static getStudyPropertyRootNameById(e){const t=u.get(e);return void 0!==t?t:"study_"+e}static isScriptStrategy(e){return!1}static isReplayStrategy(e){return"ReplayStrategy@tv-scripting"===e.id}static parseIdString(e){const t={};if(-1===e.indexOf("@"))t.shortId=e,t.packageId="tv-basicstudies",t.id=e+"@"+t.packageId,t.version=1;else{const i=e.split("@");t.shortId=i[0];const s=i[1].split("-");if(3===s.length)t.packageId=s.slice(0,2).join("-"),t.id=t.shortId+"@"+t.packageId,t.version=parseInt(s[2]);else if(1===s.length&&"decisionbar"===s[0])t.packageId="les-"+s[0],t.id=t.shortId+"@"+t.packageId,t.version=1;else{if(1!==s.length)throw new Error("unexpected study id:"+e);t.packageId="tv-"+s[0],t.id=t.shortId+"@"+t.packageId,t.version=1}}if(t.fullId=t.id+"-"+t.version,"tv-scripting"===t.packageId){const e=t.shortId;if(0===e.indexOf("Script$")||0===e.indexOf("StrategyScript$")){const i=e.indexOf("_");t.productId=i>=0?e.substring(0,i):t.packageId}else t.productId=t.packageId}else t.productId=t.packageId;return t}_updateInputDisplayDefaults(){this.inputs.filter((e=>void 0===e.display)).forEach((e=>{_.includes(e.type)?e.display=o.InputDisplayFlags.None:e.display=o.InputDisplayFlags.All}))}}},68159:(e,t,i)=>{"use strict";i.d(t,{StudyMetaInfo:()=>a});var s=i(31955).getLogger("Chart.Study.MetaInfo"),r=i(78749).applyOverridesToStudyDefaults,n=i(95062).StudyMetaInfoBase,o={};class a extends n{static versionOf(e){var t="_metainfoVersion"in e&&isNumber(e._metainfoVersion)?e._metainfoVersion:0;return t<0&&s.logError("Metainfo format version cannot be negative: "+t),t}static getPackageName(e){return(/^[^@]+@([^-]+-[^-]+)/.exec(e||"")||[0,"tv-basicstudies"])[1]}static cutDollarHash(e){var t=e.indexOf("$"),i=e.indexOf("@");return-1===t?e:e.substring(0,t)+(i>=0?e.substring(i):"")}static hasUserIdSuffix(e){return/^USER;[\d\w]+;\d+$/.test(e)}static hasPubSuffix(e){return/^PUB;.+$/.test(e)}static hasStdSuffix(e){return/^STD;.+$/.test(e)}static isStandardPine(e){return/^(Strategy)?Script\$STD;.*@tv-scripting$/.test(e)}static getStudyIdWithLatestVersion(e){const t=a.cutDollarHash(e.id);let i=t
;return"ReplayStrategy@tv-scripting"===i?i+="-567!":t.indexOf("@tv-scripting")>=0?i+="-101!":t.endsWith("CP@tv-basicstudies")?i+="-"+Math.min(e.version,207):t.endsWith("CP@tv-chartpatterns")?i+="-"+Math.min(e.version,9):t.endsWith("@tv-volumebyprice")?i+="-"+e.version+"!":i+="-"+e.version,i}defaultInputs(){for(var e=[],t=0;t<this.inputs.length;t++)e.push(this.inputs[t].defval);return e}symbolInputId(){var e=this.inputs.filter((function(e){return"symbol"===e.type}));return e.length>0?e[0].id:null}static findStudyMetaInfoByDescription(e,t){if(e){for(var i=0;i<e.length;++i)if(e[i].description.toLowerCase()===t.toLowerCase())return e[i];throw new Error("unexpected study id:"+t)}throw new Error("There is no studies metainfo")}static isParentSourceId(e){return"string"==typeof e&&/^[^\$]+\$\d+$/.test(e)}static overrideDefaults(e){0!==e.length&&r(o,e,(function(e){return TradingView.defaultProperties[a.getStudyPropertyRootName(e)]||null}))}static mergeDefaultsOverrides(e){TradingView.merge(o,e)}}TradingView.StudyMetaInfo=a},81503:(e,t,i)=>{"use strict";window.TradingView=window.TradingView||{},i(32563).setClasses(),i(44286),i(56186).install(),i(49483),i(37265),i(21251),i(11417),i(86129),i(31311),i(56840)},60588:(e,t,i)=>{"use strict";var s=i(95171),r=i(43370),n=i(50151),o=i(36986),a=i(11542),l=(i(93344),i(56570));const c=(0,o.getChartingLibraryGlobalContext)();JSON.parse(c.urlParams.disabledFeatures).forEach((e=>{l.setEnabled(e,!1)})),JSON.parse(c.urlParams.enabledFeatures).forEach((e=>{l.setEnabled(e,!0)}));i(81503);var h=i(35039),d=(i(80437),i(56840));const u=(0,o.getChartingLibraryGlobalContext)(),p=(0,o.getChartingLibraryOwner)();u.__settingsOverrides=p.settingsOverrides||{};const _=p.settingsAdapter;null!=_?(d.setSettingsAdapter(_),d.sync()):l.enabled("use_localstorage_for_settings")&&d.sync();var m=i(15938);const g=(0,o.getChartingLibraryGlobalContext)();g.urlParams.customFontFamily&&(0,m.setChartFontFamily)(g.urlParams.customFontFamily);var f=i(38881);class v extends f.ChunkLoader{_startLoading(){return Promise.all([i.e(8066),i.e(3060),i.e(2603),i.e(5514),i.e(7399),i.e(2248),i.e(7769),i.e(7125),i.e(5546),i.e(4632),i.e(8432),i.e(8073),i.e(6107),i.e(3762),i.e(1227),i.e(61),i.e(5458),i.e(8467),i.e(2208),i.e(8596),i.e(1298),i.e(2227),i.e(361),i.e(5075),i.e(5516)]).then(i.bind(i,34009)).then((e=>e.getRestrictedToolSet()))}}var y,S,b=i(72894),w=i(33633);function C(e=[],t=[]){const i=document.createElement("div"),s=document.createElement("div");return i.appendChild(s),i.classList.add(w.container),s.classList.add(w.inner),e.forEach((e=>{i.classList.add(w[e])})),t.forEach((e=>{i.classList.add(w[e])})),i}!function(e){e.Top="border-top",e.Right="border-right",e.Bottom="border-bottom",e.Left="border-left"}(y||(y={})),function(e){e.TopLeft="top-left-radius",e.TopRight="top-right-radius",e.BottomLeft="bottom-left-radius",e.BottomRight="bottom-right-radius"}(S||(S={}));class P extends f.ChunkLoader{constructor(e,t){super(),this._toolsBootloader=e,this._headerProps=t,
this._headerProps.resizerBridge.negotiateHeight(b.HEADER_TOOLBAR_HEIGHT_EXPANDED),this._headerProps.resizerBridge.container.value().appendChild(C())}_startLoading(){return Promise.all([this._toolsBootloader.load(),this._loadHeaderToolbar()]).then((([e,t])=>new t(this._headerProps.resizerBridge.container.value(),{...this._headerProps,tools:e})))}_loadHeaderToolbar(){return Promise.all([i.e(8370),i.e(5446),i.e(2227),i.e(3005)]).then(i.bind(i,39214)).then((e=>e.HeaderToolbarRenderer))}}var x=i(6307),T=i(27235);class I extends f.ChunkLoader{constructor(e){super(),this._opts=e,x.isDrawingToolbarVisible.value()&&(this._opts.resizerBridge.negotiateWidth(T.TOOLBAR_WIDTH_EXPANDED),this._opts.resizerBridge.container.value().appendChild(C()))}_startLoading(){return Promise.all([i.e(1962),i.e(3060),i.e(2603),i.e(5514),i.e(7399),i.e(7769),i.e(5546),i.e(4632),i.e(6107),i.e(3762),i.e(2417),i.e(5877),i.e(8467),i.e(9796),i.e(2227),i.e(3443),i.e(361),i.e(1890),i.e(6408),i.e(3504),i.e(2878)]).then(i.bind(i,37159)).then((e=>new e.DrawingToolbarRenderer(this._opts.resizerBridge.container.value(),{...this._opts})))}}var M=i(97990),A=i(32563),L=i(85662),k=i(45345);var D=i(64289),E=i(4741),V=i(3343);function B(e){if("number"==typeof e)return e;switch(e.toLowerCase()){case"ctrl":return V.Modifiers.Control;case"shift":return V.Modifiers.Shift;case"alt":return V.Modifiers.Alt;default:return e.toUpperCase().charCodeAt(0)}}function R(e){let t=0;for(let i=0;i<e.length;i++)t|=B(e[i]);return t}var N=i(97488),O=i(64147),F=i(76422),W=i(22980);function H(e,t){l.enabled("saveload_requires_authentication")?(0,W.runOrSigninWithFeature)(e,{...t,feature:"savedCharts"}):e()}i(21251);l.enabled("atsv2s");var z;!function(e){e[e.OneSecond=1e3]="OneSecond",e[e.OneMinute=6e4]="OneMinute",e[e.TwoMinutes=12e4]="TwoMinutes",e[e.ThreeMinutes=18e4]="ThreeMinutes",e[e.FiveMinutes=3e5]="FiveMinutes",e[e.SevenMinutes=42e4]="SevenMinutes",e[e.TenMinutes=6e5]="TenMinutes",e[e.TwentyMinutes=12e5]="TwentyMinutes",e[e.ThirtyMinutes=18e5]="ThirtyMinutes",e[e.Year=31536e6]="Year"}(z||(z={}));var U=i(39076);async function j(){return!0}var G=i(3615);const q=l.enabled("confirm_overwrite_if_chart_layout_with_name_exists");class ${constructor(e,t,i){this._visibility=new O.WatchedValue(!1),this._chartWidgetCollection=e,this._doSave=t,this._doLoad=i}hide(){var e;null===(e=this._hide)||void 0===e||e.call(this),this._visibility.setValue(!1)}visible(){return this._visibility.readonly()}_showDialog(e,t,s,r){return(0,G.showRename)({title:this._dialogTitle(),text:this._dialogText(),maxLength:64,initValue:e,onRename:async e=>{if(!q)return void this._actionHandler(e,t,s,r);const{newValue:n,dialogClose:o}=e,l=(await this._doLoad()).find((e=>e.name===n));o(),void 0!==l?this._hide=await(0,G.showConfirm)({title:a.t(null,void 0,i(7219)),text:a.t(null,void 0,i(67635)),onConfirm:({dialogClose:e})=>{e(),this._doOverwriteExistingLayout(l.id,n,t,s,r)},onCancel:({dialogClose:e})=>{e(),this._showDialog(n,t,s,r)}}):this._actionHandler({newValue:n,dialogClose:o},t,s,r)},
onClose:()=>this._visibility.setValue(!1)})}_doSaveCurrentLayout(e,t,i,s){const r=this._chartWidgetCollection.metaInfo.name.value();this._chartWidgetCollection.metaInfo.name.setValue(e),this._doSave(t,i,(()=>{this._chartWidgetCollection.metaInfo.name.setValue(r),null==s||s()}))}_doOverwriteExistingLayout(e,t,i,s,r){const n=this._chartWidgetCollection.metaInfo.name.value();this._chartWidgetCollection.metaInfo.id.setValue(e),this._chartWidgetCollection.metaInfo.name.setValue(t),this._doSave(i,s,(()=>{this._chartWidgetCollection.metaInfo.name.setValue(n),null==r||r()}))}}class K extends ${cloneChart(){this._cloneChart().then((()=>this._visibility.setValue(!0)))}show(){H((()=>this.cloneChart()),{source:"Clone chart"})}_dialogTitle(){return a.t(null,void 0,i(66134))}_dialogText(){return a.t(null,void 0,i(9541))+":"}_actionHandler({newValue:e,dialogClose:t}){l.enabled("saveload_storage_customization")&&this._doCloneCurrentLayout(e),t()}async _cloneChart(){let e;try{e=await j()}catch(e){return void showErrorDialog({content:a.t(null,void 0,i(73013))})}e&&(this._hide=await this._showDialog(this._getInitialRenameDialogInput()))}_doCloneCurrentLayout(e){const t=this._chartWidgetCollection.metaInfo.name.value();this._chartWidgetCollection.metaInfo.uid.deleteValue(),this._chartWidgetCollection.metaInfo.id.deleteValue(),this._chartWidgetCollection.metaInfo.name.setValue(e),this._doSave(void 0,void 0,(()=>{this._chartWidgetCollection.metaInfo.name.setValue(t)}))}_getInitialRenameDialogInput(){return a.t(null,{context:"ex: AAPL chart copy"},i(97559)).format({title:this._chartWidgetCollection.metaInfo.name.value()})}}class Y extends ${show(e,t,i){const s="function"==typeof e?e:void 0;this._saveNewChart(s,t,i).then((()=>this._visibility.setValue(!0)))}_dialogTitle(){return a.t(null,void 0,i(43047))}_dialogText(){return a.t(null,void 0,i(9541))+":"}_actionHandler({newValue:e,dialogClose:t},i,s,r){this._doSaveCurrentLayout(e,i,s,r),t()}async _saveNewChart(e,t,s){let r;try{r=await j()}catch(e){return void showErrorDialog({content:a.t(null,void 0,i(73013))})}const n=this._chartWidgetCollection.metaInfo.name.value();this._hide=await this._showDialog(n,e,t,s)}}class Z extends ${show(){H((()=>this._show()),{source:"Rename chart"})}_dialogTitle(){return a.t(null,void 0,i(22584))}_dialogText(){return a.t(null,void 0,i(9541))+":"}_actionHandler({newValue:e,dialogClose:t}){this._doSaveCurrentLayout(e),t()}async _show(){await this._renameChart(),this._visibility.setValue(!0)}async _renameChart(){const e=this._chartWidgetCollection.metaInfo.name.value();this._hide=await this._showDialog(e)}}class X{constructor(e,t){var i;if(this._autosaveTimer=null,this._watchedAutoSaveEnabled=new O.WatchedValue,this._toggleAutoSaveEnabledHandler=this._toggleAutoSaveEnabled.bind(this),this._doSave=(e,t,i,s)=>{const r=this._chartWidgetCollection;void 0!==e&&e();const n=this._chartChangesWatcher.changes();this._chartSaver.saveChartSilently((e=>{var i;i=r.metaInfo.uid.value(),"/chart/"===location.pathname&&(location.href="/chart/"+i),void 0!==t&&t(e)}),(()=>{
void 0!==i&&i()}),{autoSave:Boolean(s),changes:n})},this._doLoad=()=>U.backend.getCharts(),this._chartWidgetCollection=e,this._chartSaver=t,this._createController=new Y(e,this._doSave,this._doLoad),this._renameController=new Z(e,this._doSave,this._doLoad),this._saveAsController=new K(e,this._doSave,this._doLoad),this._chartChangesWatcher=new M.ChartChangesWatcher(e,t,F),e.saveKeysPressed().subscribe(this,this.saveChartOrShowTitleDialog),this._chartChangesWatcher.getOnChange().subscribe(this,this._onStateChanged),l.enabled("saveload_separate_drawings_storage")){const e=!0;e&&this._enableAutoSave(),this._watchedAutoSaveEnabled.setValue(e),this._watchedAutoSaveEnabled.subscribe(this._toggleAutoSaveEnabledHandler),null===(i=this._autoSaveEnabledSetting)||void 0===i||i.getOnChange().subscribe(this,this._autoSaveEnabledSettingHandler)}}autoSaveEnabled(){return this._watchedAutoSaveEnabled}destroy(){var e;l.enabled("saveload_separate_drawings_storage")&&(this._watchedAutoSaveEnabled.unsubscribe(),delete this._watchedAutoSaveEnabled,null===(e=this._autoSaveEnabledSetting)||void 0===e||e.destroy(),delete this._autoSaveEnabledSetting)}getCreateController(){return this._createController}getRenameController(){return this._renameController}getSaveAsController(){return this._saveAsController}cloneChart(){this._saveAsController.cloneChart()}createEmptyChart(){var e;null===(e=this._createEmptyController)||void 0===e||e.show()}saveChartAs(){this._saveAsController.show()}renameChart(){this._renameController.show()}saveNewChart(e,t,i){this._createController.show(e,t,i)}saveExistentChart(e,t,i){this._doSave(e,t,i)}changes(){return this._chartChangesWatcher.changes()}hasChanges(){return 0!==this._chartChangesWatcher.changes()}saveChartOrShowTitleDialog(e,t,i){const s=window.saver.isSaveInProcess(),r=this._chartChangesWatcher.hasChanges(),n=!!this._chartWidgetCollection.metaInfo.id.value();window.is_authenticated&&(s||!r&&n)||H((()=>{null!=this._chartWidgetCollection.metaInfo.id.value()?this.saveExistentChart(e,t,i):this.saveNewChart(e,t,i)}),{source:"Save chart",sourceMeta:"Chart"})}saveToJSON(e){return this._chartSaver.saveToJSON(e)}saveChartSilently(e,t,i){this._chartSaver.saveChartSilently(e,t,i)}setAutoSaveEnabled(e){window.is_authenticated&&window.saver.isSaveInProcess()||H((()=>{this._watchedAutoSaveEnabled.setValue(e)}),{source:"AutoSave chart"})}saveChartLineTools(e,t,i,s){return this._chartSaver.saveChartLineTools(e,t,i,s)}layoutId(){return this._chartWidgetCollection.metaInfo.uid.value()}_autoSaveEnabledSettingHandler(e){0}_toggleAutoSaveEnabled(e){}_enableAutoSave(){0}_disableAutoSave(){0}_onStateChanged(e){e?this._startAutosave():this._stopAutosave()}_startAutosave(){l.enabled("charts_auto_save")&&null===this._autosaveTimer&&(this._autosaveTimer=setTimeout((()=>{this._autosaveTimer=null,this._chartWidgetCollection.metaInfo.id.value()&&this._doSave(void 0,void 0,void 0,!0)}),6e4))}_stopAutosave(){null!==this._autosaveTimer&&(clearInterval(this._autosaveTimer),this._autosaveTimer=null)}}var J=i(29280),Q=(i(14051),
i(21097)),ee=i(59063);class te extends ee.CommonJsonStoreService{constructor(e,t){super(e,t,"FAVORITE_CHARTS_CHANGED","loadChartDialog.favorites",{})}}function ie(){return!(l.enabled("saveload_requires_authentication")&&!window.is_authenticated)}class se extends J.DialogRenderer{constructor(e=null){var t,i;super(),this._chartWidgetCollection=null,this._promise=null,this._dialog=null,this._onLoginStateChange=()=>{ie()||this._setState({chartList:[],favorites:{},recents:[]})},this._onActiveChartNameChange=()=>{const{chartList:e}=this._state.value(),t=this._chartWidgetCollection;if(!t)return;const i=[];let s;e.forEach((e=>{if(e.id===t.metaInfo.id.value())return s=e,void i.push({...e,name:t.metaInfo.name.value()});i.push(e)})),s&&this._setState({chartList:i})},this._subscribe=e=>{this._setVisibility(e)},this._getChartEntry=e=>({id:e.id,url:e.url,name:e.name,symbol:e.short_symbol,interval:e.interval,toolsCount:0,modified:e.modified_iso,favorite:void 0,active:()=>this._isActiveChart(e.id),openAction:()=>U.backend.loadChart(e),deleteAction:()=>this._deleteChart(e),favoriteAction:()=>this._handleFavorite(e)}),this._isActiveChart=e=>null!==this._chartWidgetCollection&&e===this._chartWidgetCollection.metaInfo.id.value(),this._deleteChart=e=>U.backend.removeChart(e.image_url).then((()=>{const{chartList:t,favorites:i}=this._state.value(),s=t.filter((t=>t.id!==e.id));if(this._favoriteChartsService){const t={...i};t[e.id]&&delete t[e.id],this._favoriteChartsService.set(t)}ie()&&this._setState({chartList:s}),this._isActiveChart(e.id)&&(l.enabled("saveload_storage_customization")?null!==this._chartWidgetCollection&&this._chartWidgetCollection.clearChartMetaInfo():location.href="/chart/"+location.search)})),this._chartWidgetCollection=e,this._favoriteChartsService=new te(Q.TVXWindowEvents,d);const s=(null===(t=this._favoriteChartsService)||void 0===t?void 0:t.get())||{};this._state=new O.WatchedValue({chartList:[],recents:[],favorites:s}),null===(i=this._chartWidgetCollection)||void 0===i||i.metaInfo.name.subscribe(this._onActiveChartNameChange),window.loginStateChange.subscribe(null,this._onLoginStateChange)}showLoadDialog(){H(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)}state(){return this._state.readonly()}refreshChartList(e){(ie()?U.backend.getCharts():Promise.resolve([])).then((t=>{if(!ie())return;const i=t.map(this._getChartEntry);this._setState({chartList:i,favorites:this._initFavorites(i)}),void 0!==e&&e()}))}getRecentCharts(e){}async deleteAllFavorites(){return Promise.resolve()}async _handleFavorite(e){var t;const{favorites:i}=this._state.value(),s={...i};s[e.id]?delete s[e.id]:s[e.id]=!0,null===(t=this._favoriteChartsService)||void 0===t||t.set(s),ie()&&this._setState({favorites:s})}_showLoadDialog(){this.refreshChartList((()=>{
const e=this._promise=Promise.all([i.e(2646),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(7399),i.e(6625),i.e(3114),i.e(4632),i.e(8432),i.e(6107),i.e(8065),i.e(8316),i.e(7530),i.e(6085),i.e(2227),i.e(3443),i.e(6014),i.e(361),i.e(5009)]).then(i.bind(i,75693)).then((t=>{this._promise===e&&(this._dialog&&(this._dialog.hide(),this._dialog.visible().unsubscribe(this._subscribe)),this._dialog=new t.LoadChartDialogRenderer({chartWidgetCollection:this._chartWidgetCollection,serviceState:this.state()}),this._dialog.visible().subscribe(this._subscribe),this._dialog.show())}))}))}_setState(e){this._state.setValue({...this._state.value(),...e})}async _changeFavoriteState(e,t,i){return Promise.resolve()}_initFavorites(e){if(this._favoriteChartsService)return this._favoriteChartsService.get();const t={};return e.filter((e=>e.favorite)).forEach((e=>{t[e.id]=!0})),t}}var re=i(51768),ne=i(52033);const oe=(0,i(31955).getLogger)("Platform.StudyTemplates"),ae=a.t(null,void 0,i(34914));class le{constructor(e){this._chartWidgetCollection=e.chartWidgetCollection,window.loginStateChange.subscribe(null,U.backend.invalidateStudyTemplatesList),this._list=new O.WatchedValue([]),this._onChange=new ne.Delegate,this._list.subscribe((()=>this._onChange.fire()))}findRecordByName(e){return this._list.value().find((t=>t.name===e))||null}showSaveAsDialog(){const e=this._chartWidgetCollection.activeChartWidget.value().model();Promise.all([i.e(2238),i.e(3060),i.e(7528),i.e(6246),i.e(7811),i.e(412),i.e(2248),i.e(6625),i.e(55),i.e(4392),i.e(5666),i.e(8073),i.e(6665),i.e(7902),i.e(8722),i.e(5922),i.e(2227),i.e(6014),i.e(4804),i.e(6631)]).then(i.bind(i,3606)).then((t=>{new t.StudyTemplateSaver({controller:e,onSave:e=>{this._list.setValue(e)}}).show()}))}applyTemplate(e){const t=this.findRecordByName(e);null!==t?window.runOrSignIn((()=>{const e=this._chartWidgetCollection.activeChartWidget.value(),i=i=>{(0,re.trackEvent)("GUI","Load Study Template"),e.model().applyStudyTemplate(JSON.parse(i.content),t.name)};t.is_default&&"number"==typeof t.id?U.backend.getStandardStudyTemplateById(t.id,i):U.backend.getStudyTemplateById(t.id).then(i)}),{source:"Study templates apply"}):oe.logNormal(`Template ${e} not found in cache`)}deleteStudyTemplate(e,t){const i=this.findRecordByName(e);null!==i?this._removeTemplate(i,t):oe.logNormal(`Template ${e} not found in cache`)}list(){return this._list.value()}getOnChange(){return this._onChange}refreshStudyTemplateList(e){U.backend.getStudyTemplatesList().then((t=>{this._list.setValue(t),void 0!==e&&e()}))}invalidate(){U.backend.invalidateStudyTemplatesList()}_removeTemplate(e,t){window.runOrSignIn((()=>{(0,G.showConfirm)({text:ae.format({name:e.name}),onConfirm:({dialogClose:i})=>new Promise((s=>{U.backend.invalidateStudyTemplatesList(),U.backend.removeStudyTemplate(e.id).then((()=>{this.refreshStudyTemplateList((()=>{const r=this.list();this._list.setValue(r.filter((t=>t!==e))),s(),i(),null==t||t()}))}))}))})}),{source:"Study templates delete"})}}var ce=i(82992),he=i(11345),de=i(24526);class ue{
constructor(e,t){this._visibility=new O.WatchedValue(!1),this._dialogPromise=null,this._dialog=null,this._chartWidgetCollection=e,this._options=t}visible(){return this._visibility.readonly()}show(e,t,i){var s,r,n;const o=Array.isArray(e)?e:[],a=Array.isArray(e)?void 0:e;null===this._dialog&&this._requestDialog(null!=o?o:[],t,i,a),null===(s=this._dialog)||void 0===s||s.open(null!=o?o:[],null===(n=null===(r=this._options)||void 0===r?void 0:r.indicatorsPreloader)||void 0===n?void 0:n.getIndicatorPromises(),t,i,a)}hide(){var e;null===(e=this._dialog)||void 0===e||e.hide()}getDialog(){return this._dialog}resetAllPages(){var e;null===(e=this._dialog)||void 0===e||e.resetAllStudies()}_requestDialog(e,t,s,r){if(null===this._dialogPromise){let n;n=Promise.all([i.e(2530),i.e(3060),i.e(7528),i.e(6246),i.e(7811),i.e(412),i.e(55),i.e(3114),i.e(4632),i.e(1398),i.e(9978),i.e(2227),i.e(6014),i.e(6456)]).then(i.bind(i,75585)).then((e=>new e.IndicatorsLibraryContainer(this._chartWidgetCollection,this._options))),this._dialogPromise=n.then((i=>{var n,o;this._dialog=i,this._dialog.visible().subscribe((e=>{this._visibility.setValue(e)})),this._dialog.open(e,null===(o=null===(n=this._options)||void 0===n?void 0:n.indicatorsPreloader)||void 0===o?void 0:o.getIndicatorPromises(),t,s,r)}))}return this._dialogPromise}}var pe=i(14426),_e=i(31054),me=i(92184),ge=i(42752),fe=i(60859),ve=i(51613),ye=i(63829),Se=i(11497),be=i(2740),we=i(63950),Ce=i(23998);const Pe=/^Etc\/GMT([+-])(\d{1,2}):?(\d\d)?$/,xe=new Map;function Te(e){if(xe.has(e))return xe.get(e);const t=Pe.test(e);return xe.set(e,t),t}const Ie=new Map;function Me(e){if(Ie.has(e))return Ie.get(e);const t=function(e){const t=e.match(Pe);if(!t)return 0;const i="+"===t[1]?-1:1;return 60*(60*parseInt(t[2],10)+parseInt(t[3]||"0",10))*i}(e),i={time:[1924992e3+t],offset:[t]};return Ie.set(e,i),i}let Ae=null;const Le=new Map;class ke{constructor(){this._customTimezones=new Map}addTimezones(e){e.forEach((e=>{const{id:t,...i}=e;this._addTimezone(t,i)})),this.updateChartTimezones()}listTimezoneIds(){return[...this._customTimezones.keys()]}listTimezones(){return[...this._customTimezones.entries()].map((([e,t])=>({id:e,...t})))}getTimezoneInfo(e){if(!this.timezoneIsAvailable(e))throw new Error("Provided timezone alias is not within the list of supported timezones.");return(0,n.ensure)(this._customTimezones.get(e))}getAllTimezoneInfo(){return this.listTimezones()}getAliasTimezone(e){return this.getTimezoneInfo(e).alias}timezoneIsAvailable(e){return this._customTimezones.has(e)}updateChartTimezones(){(0,we.updateAvailableTimezones)(this.getAllTimezoneInfo())}getTimezoneData(e){if(Le.has(e))return Le.get(e);let t=null;if(Te(e))t=Me(e);else if(this.timezoneIsAvailable(e)){const i=this.getAliasTimezone(e);Ce.tzData[i]&&(t=Ce.tzData[i]),!t&&Te(i)&&(t=Me(i))}return t&&Le.set(e,t),t}static instance(){return null===Ae&&(Ae=new ke),Ae}_addTimezone(e,t){try{if((0,n.ensure)(e,"Custom timezone ID"),(0,n.ensure)(t.alias,"Custom timezone alias"),(0,n.ensure)(t.title,"Custom timezone title"),(0,
we.timezoneIsAvailable)(e)&&!this.timezoneIsAvailable(e))throw new Error("Custom timezone id already exists.");if(!(0,we.timezoneIsSupported)(t.alias)&&!Te(t.alias))throw new Error("Custom timezone alias is not a supported timezone.");if(e.length<1)throw new Error("Custom timezone id is empty");if(t.title.length<1)throw new Error("Custom timezone title is empty");this._customTimezones.set(e,t)}catch(e){console.warn(`Unable to add custom timezone. ${e}`)}}}(0,be.setCustomTimezones)(ke);var De=i(50788);let Ee=null;var Ve=i(85049),Be=i(31940);class Re{constructor(e){this._document=e,this.isFullscreen=new O.WatchedValue;const t=()=>{const e=["fullscreenElement","webkitFullscreenElement","mozFullscreenElement","mozFullScreenElement","msFullscreenElement"];for(let t=0;t<e.length;t++){const i=e[t];if(i in this._document){this.isFullscreen.setValue(!!this._document[i]);break}}};t();for(const i of["fullscreenchange","webkitfullscreenchange","mozfullscreenchange","MSFullscreenChange"])e.addEventListener(i,t,!1)}enter(){const e=this._document.documentElement;for(const t of["requestFullscreen","mozRequestFullScreen","webkitRequestFullscreen","msRequestFullscreen"])if("function"==typeof e[t]){e[t]();break}this.isFullscreen.setValue(!0)}exit(){const e=this._document;for(const t of["exitFullscreen","mozCancelFullScreen","mozExitFullscreen","webkitExitFullscreen","msExitFullscreen"])if("function"==typeof e[t]){e[t]();break}this.isFullscreen.setValue(!1)}}class Ne{constructor(e){let t;this.isVisible=new O.WatchedValue(!0);let i=null;for(const s of["","moz","ms","webkit"]){const r=s?`${s}Hidden`:"hidden";if(r in e){t=`${s}visibilitychange`,i=()=>{this.isVisible.setValue(!e[r])},i(),e.addEventListener(t,i,!1);break}}this.destroy=()=>{i&&(e.removeEventListener(t,i,!1),i=null)}}}var Oe,Fe=i(84015),We=i(49483);!function(e){e.Quirks="quirks",e.Visual="visual"}(Oe||(Oe={}));function He(e,t){let i=0;for(const{min:s,max:r}of t){if(e<s||r<s)continue;const t=Math.min(e,r);if(i=Math.max(i,t),e===i)break}return i}function ze(e){const t=[];if(void 0===e)return[];Array.isArray(e)||(e=[e]);for(const i of e){let e,s;isFinite(i)?e=s=Number(i):(e=+i.min,s=+i.max),(e<0||isNaN(e))&&(e=0),isNaN(s)&&(s=1/0),e<=s&&s>0&&t.push({min:e,max:s})}return t.sort(((e,t)=>e.min-t.min||e.max-t.max)),t}function Ue(e,t){if(e.length!==t.length)return!1;for(let i=e.length;i--;){if(e[i].min!==t[i].min)return!1;if(e[i].max!==t[i].max)return!1}return!0}const je=l.enabled("no_min_chart_width");var Ge;!function(e){e[e.MinChartHeight=300]="MinChartHeight",e[e.MinChartWidth=300]="MinChartWidth",e[e.DefaultOffset=4]="DefaultOffset",e[e.ThinOffset=1]="ThinOffset",e[e.TopToolbarMargin=0]="TopToolbarMargin"}(Ge||(Ge={}));const qe=l.enabled("bypass_chart_height_check");function $e(e){const t=l.enabled("side_toolbar_in_fullscreen_mode"),i=l.enabled("header_in_fullscreen_mode");return"center"===e||"left"===e&&t||"top"===e&&i}var Ke=i(90277),Ye=i(77788),Ze=i(16216),Xe=(i(9001),i(68122)),Je=i.n(Xe),Qe=i(9726),et=i(928),tt=i(15764),it=i(68335)
;const st=["LineToolTrendLine","LineToolRay","LineToolInfoLine","LineToolExtended","LineToolRegressionTrend","LineToolRotatedRectangle","LineToolParallelChannel","LineToolFlatBottom","LineToolDisjointAngle","LineToolPitchfork","LineToolSchiffPitchfork","LineToolSchiffPitchfork2","LineToolInsidePitchfork","LineToolVertLine","LineToolCrossLine","LineToolHorzLine","LineToolHorzRay","LineToolTrendAngle"];function rt(e,t=!1,s=!1){if(!l.enabled("popup_hints"))return;const r=e.getContainer();let o=null,c=null;function h(e,t){if(o)o.show(e,p.bind(null,t));else{const s=et.tool.value();Promise.all([i.e(7727),i.e(2227),i.e(6166)]).then(i.bind(i,5015)).then((i=>{o=new i.ChartEventHintRenderer(r),s===et.tool.value()&&o.show(e,p.bind(null,t))}))}}function u(e){return!Boolean(d.getBool(e))}function p(e){d.setValue(e,!0,{forceFlush:!0}),(0,n.ensureNotNull)(o).destroy(),null!==c&&c(),o=null}et.tool.subscribe((function(){const e=et.tool.value(),t=We.CheckMobile.any();if(s&&t&&function(e){return st.includes(e)}(e))return void async function(e){0}();if(!u("hint.touchPainting"))return;const r=(0,tt.isLineToolDrawWithoutPoints)(e);!(0,tt.isStudyLineToolName)(e)||"LineToolRegressionTrend"===e||r||t?(0,tt.isLineToolName)(e)&&!(0,tt.isLineDrawnWithPressedButton)(e)&&!r&&t?h(a.t(null,void 0,i(60663)),"hint.touchPainting"):o&&o.hide():h(a.t(null,void 0,i(14985)),"hint.touchPainting")})),et.createdLineTool.subscribe(null,(function(){const e=et.tool.value();"LineToolPath"===e&&u("hint.finishBuildPathByDblClick")?h(a.t(null,void 0,i(75296)),"hint.finishBuildPathByDblClick"):"LineToolPolyline"===e&&u("hint.finishBuildPolylineByDblClick")&&h(a.t(null,void 0,i(17409)),"hint.finishBuildPolylineByDblClick")})),et.finishedLineTool.subscribe(null,(function(){if(o){const e=et.tool.value();"LineToolPath"===e?p("hint.finishBuildPathByDblClick"):"LineToolPolyline"===e&&p("hint.finishBuildPolylineByDblClick")}})),e.layoutSizesChanged().subscribe((function(){if(!u("hint.startResizingChartInLayout"))return;h(a.t(null,void 0,i(9430)),"hint.startResizingChartInLayout")})),t||We.CheckMobile.any()||!u("hint.startFocusedZoom")||(c=function(e,t){let i=!1;const s=r=>{r?(i&&t(r),e.onZoom().unsubscribe(null,s)):i||(t(r),i=!0)};return e.onZoom().subscribe(null,s),()=>e.onZoom().unsubscribe(null,s)}(e,(function(e){if(!u("hint.startFocusedZoom"))return;if(e)o&&(c=null,p("hint.startFocusedZoom"));else{const e=it.isMacKeyboard?"⌘":"Ctrl";h(a.t(null,void 0,i(81712)).format({key:e}),"hint.startFocusedZoom")}})))}var nt=i(51243),ot=i.n(nt),at=i(68159),lt=i(25605),ct=i.n(lt),ht=(i(42924),i(23863),i(78136)),dt=i(5171),ut=i(73772),pt=i(88960),_t=i(91140),mt=i(27714),gt=i(12481),ft=i(86441),vt=i(34026),yt=i(19625),St=i(28120),bt=i(56468),wt=i(78871),Ct=i(19063),Pt=i(61119),xt=i(7114),Tt=i(12027);var It=i(37743),Mt=i(2844),At=i(64034),Lt=i(72791),kt=i(70893),Dt=i(50946);i(32160);const Et={customBrandingTradingViewText:yt.colorsPalette["color-brand"],customBrandingText:yt.colorsPalette["color-cold-gray-850"],background:yt.colorsPalette["color-cold-gray-900"],
shadow:yt.colorsPalette["color-cold-gray-700"],text:yt.colorsPalette["color-white"],staticTextBackground:(0,Ct.generateColor)(yt.colorsPalette["color-cold-gray-800"],20),logo:yt.colorsPalette["color-white"],platformBgColor:yt.colorsPalette["color-cold-gray-900"],platformFgColor:yt.colorsPalette["color-cold-gray-200"]},Vt={customBrandingTradingViewText:yt.colorsPalette["color-brand"],customBrandingText:yt.colorsPalette["color-cold-gray-850"],background:yt.colorsPalette["color-white"],shadow:yt.colorsPalette["color-cold-gray-150"],text:yt.colorsPalette["color-cold-gray-900"],staticTextBackground:(0,Ct.generateColor)(yt.colorsPalette["color-white"],20),logo:yt.colorsPalette["color-cold-gray-900"],platformBgColor:yt.colorsPalette["color-white"],platformFgColor:yt.colorsPalette["color-cold-gray-900"]};const Bt=new Map([["logo-old-style",Dt],["tradingview-old-style",kt]]),Rt=l.enabled("adaptive_logo"),Nt=l.enabled("small_no_display"),Ot=l.enabled("38914"),Ft="site_branding",Wt="widget_branding",Ht="widget_referral_branding",zt="widget_custom_branding",Ut="widget_custom_no_powered_branding",jt="fundamental_branding",Gt="fundamental_custom_branding",qt="fundamental_custom_no_powered_branding",$t="library_branding",Kt="library_custom_branding",Yt="library_custom_no_powered_branding",Zt=navigator.userAgent.toLowerCase().indexOf("chrome")>-1&&-1===navigator.userAgent.toLowerCase().indexOf("edge"),Xt=window.urlParams||{},Jt=window.initData||{};Xt.no_referral_id&&enable(Xt.referral_id||"","aggressive");const Qt=a.t(null,void 0,i(98856)),ei=Ot?a.t(null,void 0,i(44676)):a.t(null,void 0,i(92800));a.t(null,void 0,i(46768)),a.t(null,void 0,i(83470)),a.t(null,void 0,i(3140));var ti;!function(e){e[e.OldFontAdditionalVerticalOffset=0]="OldFontAdditionalVerticalOffset",e[e.NewFontAdditionalVerticalOffset=.1]="NewFontAdditionalVerticalOffset",e[e.StrokeWidth=4]="StrokeWidth",e[e.StaticLogoHorizontalTextOffset=5]="StaticLogoHorizontalTextOffset",e[e.TextWidthCompensation=2]="TextWidthCompensation",e[e.AdaptiveWidthToHideText=500]="AdaptiveWidthToHideText",e[e.WidthToHideLogoIfSmallNoDisplayEnabled=480]="WidthToHideLogoIfSmallNoDisplayEnabled",e[e.TextAdditionalCropWidth=11]="TextAdditionalCropWidth",e[e.BadgeLogoMargin=-11]="BadgeLogoMargin",e[e.BadgeTextMargin=-8]="BadgeTextMargin",e[e.TextAnimatedAlphaStart=.3]="TextAnimatedAlphaStart",e[e.TextAnimatedAlphaEnd=1]="TextAnimatedAlphaEnd",e[e.AnimationDuration=200]="AnimationDuration"}(ti||(ti={}));(0,We.onWidget)();class ii extends St.CustomSourceBase{constructor(e,t,i){super(e,t),this._canvasWidth=0,this._paneHeight=0,this._left=13,this._bottom=36,this._layout=Ft,this._needToShow=!0,this._showBranding=!1,this._customLogoSrc="",this._customLogoLink="",this._cubicBezier=new wt.CubicBezier(.4,.01,.22,1),this._openAnimation=null,this._closeAnimation=null,this._powBy=null,this._custom=null,this._destroyed=!1,this._mainSeries=this._model.mainSeries(),this._visible=i,this._showForPro=!t.onWidget();const s=()=>this._model.updateSource(this);this._visible.subscribe(s),this._dark=t.dark().spawn(),
this._dark.subscribe(s),this._checkLayout(),this._layout!==zt&&this._layout!==Gt||(this._left=8,this._bottom=5);const r=()=>{this._needToShow?this._showBranding=!0:this._showBranding=!1};this._resizeHandlerDelayed=(0,gt.default)(r,200),r(),window.addEventListener("resize",this._resizeHandlerDelayed),this._model.isSnapshot()?this._init():(this._mainSeries.dataEvents().symbolResolved().subscribe(this,this._init),null!==this._mainSeries.symbolInfo()&&this._init()),this._renderer={draw:this.draw.bind(this),hitTest:this.hitTest.bind(this)},t.onWidget()||window.loginStateChange.subscribe(this,this._init)}destroy(){window.removeEventListener("resize",this._resizeHandlerDelayed),this._mainSeries.dataEvents().symbolResolved().unsubscribeAll(this),this._powBy&&this._powBy.destroy(),this._model.onWidget()||window.loginStateChange.unsubscribeAll(this),this._visible.release(),this._dark.destroy(),this._destroyed=!0}paneViews(e){if(window.TradingView.printing&&this._layout!==Ut&&this._layout!==qt)return[];if(!this._visible.value())return[];if(this._layout===Ft&&!this._showForPro&&window.user&&window.user.is_pro)return[];const t=this._model.mainPane();if(!t)return[];const i=l.enabled("move_logo_to_main_pane");let s=!1;if(e.maximized().value())s=!0;else if(i)s=t.collapsed().value()?e===this._model.panes().find((e=>!e.collapsed().value())):e.isMainPane();else if(this._model.lastPane().collapsed().value()){const t=this._model.panes();for(let i=t.length-1;i>=0;--i){const r=t[i];if(!r.collapsed().value()){s=r===e;break}}}else s=e.isLast();return s?[{renderer:this.renderer.bind(this)}]:[]}labelPaneViews(e){return[]}priceAxisViews(e,t){return[]}updateAllViews(){}updateViewsForPane(e){}priceScale(){return null}renderer(e){return this._paneHeight=e.mediaSize.height,this._canvasWidth=e.mediaSize.width,this._renderer}hasContextMenu(){return!1}onClickOutside(){this._hasAnimation()&&this._startCloseAnimation()}hitTest(e){if(!this._showBranding||l.enabled("logo_without_link"))return null;if(this._powBy&&this._layout!==Ut&&this._layout!==qt&&(this._powBy.hitTest(e)||this._custom&&this._custom.hitTest(e))){const e=!0;return new bt.HitTestResult(bt.HitTarget.Custom,{hideCrosshairLinesOnHover:!0,cursorType:e?Lt.PaneCursorType.Pointer:Lt.PaneCursorType.Default,clickHandler:()=>{this._openLink()},tapHandler:()=>{this._hasAnimation()?this._toggleOpenAnimatedOrOpenLink():this._openLink()},mouseEnterHandler:()=>{this._hasAnimation()&&this._startOpenAnimation()},mouseLeaveHandler:()=>{this._hasAnimation()&&this._startCloseAnimation()},mouseDownHandler:()=>{0},mouseUpHandler:()=>{0}})}return null}tvUrl(){var e,t,i;const s="https://"+function(e){return({ar_AE:"ar",de_DE:"de",en:"www",es:"es",ca_ES:"es",fa_IR:"www",fr:"fr",he_IL:"il",id:"id",in:"in",it:"it",ja:"jp",kr:"kr",ms_MY:"my",pl:"pl",br:"br",ru:"ru",sv_SE:"se",th_TH:"th",tr:"tr",uk:"uk",vi_VN:"vn",zh_CN:"cn",zh_TW:"tw"}[e]||"www")+".tradingview.com"}((null!==(t=null===(e=Jt.querySettings)||void 0===e?void 0:e.locale)&&void 0!==t?t:null===(i=Jt.currentLocaleInfo)||void 0===i?void 0:i.language)||"en")
;let r=new URL(s);if(this._customLogoLink)return this._customLogoLink;if(this._layout===$t||this._layout===Kt){let e;switch(!0){case l.enabled("charting_library"):e="library";break;case l.enabled("trading_terminal"):e="trading-terminal"}r.searchParams.append("utm_source",window.location.origin),r.searchParams.append("utm_medium","library"),e&&r.searchParams.append("utm_campaign",e)}return r.toString()}draw(e,t){if(!this._showBranding)return;let i=0;Xt.utm=!0,(0,xt.drawScaled)(e,t.horizontalPixelRatio,t.verticalPixelRatio,(()=>{if(this._powBy&&this._powBy.show){i=this._powBy.height,e.save();const s=new ft.Point(this._left,this._paneHeight-this._bottom-i);this._powBy.draw(s,e,t,this._canvasWidth),e.restore()}if(this._custom&&this._custom.show){e.save();const s=new ft.Point(this._left,this._paneHeight-this._bottom-i-this._custom.height);this._custom.draw(s,e,t),e.restore()}}))}_init(){this._checkLayout();const e=this._mainSeries.symbolInfo();this._powBy&&this._powBy.destroy(),this._powBy=new li(this._layout,(null==e?void 0:e.name)||"",this._model,(()=>this._model.fullUpdate())),this._custom=new ci(this._layout,this._customLogoSrc,(()=>this._model.fullUpdate())),this._openAnimation=null,this._closeAnimation=null,this._model.lightUpdate()}_checkLayout(){if(l.enabled("widget"))0;else{{const e=JSON.parse(Xt.logo)||{};e.image?(this._customLogoSrc=e.image,this._customLogoLink=e.link,this._needToShow=l.enabled("widget_logo"),l.enabled("link_to_tradingview")?this._layout=Kt:this._layout=Yt):(this._layout=$t,this._needToShow=l.enabled("widget_logo"))}}}_startOpenAnimation(){if(null!==this._openAnimation)return;null!==this._closeAnimation&&(this._closeAnimation.stop(),this._closeAnimation=null);const e=(0,n.ensureNotNull)(this._powBy).animationStep();this._openAnimation=(0,Pt.doAnimate)({from:e,to:1,duration:200*(1-e),easing:this._cubicBezier.easingFunc,onStep:this._animatedDrawStep.bind(this)})}_startCloseAnimation(){if(null!==this._closeAnimation)return;null!==this._openAnimation&&(this._openAnimation.stop(),this._openAnimation=null);const e=(0,n.ensureNotNull)(this._powBy).animationStep();this._closeAnimation=(0,Pt.doAnimate)({from:e,to:0,duration:200*e,easing:this._cubicBezier.easingFunc,onStep:this._animatedDrawStep.bind(this)})}_animatedDrawStep(e,t){(0,n.ensureNotNull)(this._powBy).animatedDrawStep(t),this._model.lightUpdate()}_hasAnimation(){return null!==this._powBy&&this._powBy.hasAnimation()}_openGoPro(){0}_openLink(){if(this._layout===Ft)return this._model.isSnapshot()||this._openGoPro(),!1;l.enabled("widget");return(0,n.ensureNotNull)(window.open(this.tvUrl(),"_blank")).opener=null,!0}_toggleOpenAnimatedOrOpenLink(){null!==this._openAnimation&&this._openAnimation.completed()?this._openLink()||this._startCloseAnimation():this._startOpenAnimation()}}function si(e){return!Nt||e>480}function ri(e){return!Rt||e>500}let ni={},oi={};class ai{constructor(){this._topLeftPoint=null,this._hitTestHeight=null}hitTest(e){const t=this._getHitTestBox();if(t)return(0,vt.pointInBox)(e,t)}_getHitTestBox(){var e
;const t=this._topLeftPoint;if(t){const{x:i,y:s}=t;return(0,ft.box)(t,new ft.Point(i+this.width,s+(null!==(e=this._hitTestHeight)&&void 0!==e?e:this.height)))}}}class li extends ai{constructor(e,t,i,s){super(),this.show=!0,this.hovered=!1,this.active=!1,this._needDisplayImage=!1,this._textAnimatedAlpha=1,this._textAnimatedAlphaStart=1,this._textAdditionalCropWidth=0,this._textAnimatedAlphaEnd=1,this._badgeData={logoMargin:0,textMargin:0,width:0},this._invertTextCropDirection=!1,this._font=`px ${m.CHART_FONT_FAMILY}`,this._txt="TradingView",this._maximizedAnimationTextWidth=0,this._logoWidth=0,this._textWidthCache=new Mt.TextWidthCache,this._pixelRatio={horizontalPixelRatio:NaN,verticalPixelRatio:NaN},this._model=i,this._layout=e,this._symbol=t,this._showTradeWithLogo=!1,this._showAnimatedBranding=l.enabled("show_animated_logo")||e===Wt,this._alwaysMaximized=l.enabled("logo_always_maximized")||this._model.isSnapshot()&&!We.CheckMobile.any()||!1,this._fontSize=this._showAnimatedBranding||this._layout===Ht?11:14,this._showAnimatedBranding||this._layout!==zt&&this._layout!==Gt||(this._fontSize=12),this._sizeConstants=(this._model.isSnapshot(),{brandCircleSize:32,textAsImageWidthCompensation:0,leftOffset:0,bottomOffset:-23,logoLeftOffset:1,logoTextOffset:6}),this.width=this._minimizedAnimationWidth(),this._animatedWidth=this.width,this.height=this._fontSize+2,this._requestRepaint=s,this._init(),this._checkFontLoaded(),this._recalculateMetrics()}destroy(){this._model.properties().childs().paneProperties.childs().background.unsubscribeAll(this),this._model.onChartThemeLoaded().unsubscribeAll(this)}hasAnimation(){return this._showAnimatedBranding&&!this._alwaysMaximized}animationStep(){const e=this._minimizedAnimationWidth(),t=this._maximizedAnimationWidth();return(this._animatedWidth-e)/(t-e)}animatedDrawStep(e){const t=this._minimizedAnimationWidth(),i=this._maximizedAnimationWidth();this._animatedWidth=t+e*(i-t),this._textAnimatedAlpha=this._textAnimatedAlphaStart+e*(this._textAnimatedAlphaEnd-this._textAnimatedAlphaStart)}draw(e,t,i,s){const{brandCircleSize:r,logoLeftOffset:n,leftOffset:o,bottomOffset:a}=this._sizeConstants;this._needDisplayImage&&si(s)&&(e=new ft.Point(e.x+o,e.y-a)),this._topLeftPoint=e,t.translate(e.x,e.y);const{horizontalPixelRatio:l,verticalPixelRatio:c}=i;(0,At.equalPixelRatios)(i,this._pixelRatio)||(this._textWidthCache.reset(),this._pixelRatio={horizontalPixelRatio:l,verticalPixelRatio:c});const h=this._colors;if(this._showAnimatedBranding){if(this._needDisplayImage){const e=this._getLogoImage(h.logo);this.width=this._animatedWidth,this._drawLogo(t,e,this._animatedWidth,this._animatedWidth,this._animatedWidth>this._sizeConstants.brandCircleSize)}}else if(this._layout===zt||this._layout===Gt){t.font=this._fontSize+this._font;const e=t.measureText(this._txt).width+2;this.width=e+t.measureText("TradingView").width+2,t.save(),t.globalAlpha=.7,t.fillStyle=this._colors.customBrandingText,t.fillText(this._txt,0,12),t.fillStyle=this._colors.customBrandingTradingViewText,t.fillText("TradingView",e,12),
t.restore()}else if(si(s))if(this._needDisplayImage){const e=this._getLogoImage(h.logo);t.save(),this._drawBgCircle(t,r/2);const{width:i,height:o}=e.logoImage.viewBox(),a=new ft.Point(Math.round((r-i)/2)-1+n,Math.floor((r-o)/2)+1);this._drawLogoImage(t,a,e.logoImage);const l=ri(s);l&&(t.translate(r+5,Math.round(this._fontSize*("px EuclidCircular"===this._font?.1:0))),this._drawTextStroke(t),this._drawTextFill(t)),t.restore(),this.width=r,l&&(this.width+=this._maximizedAnimationTextWidth)}else{const e=ri(s);e&&(t.save(),t.translate(Zt?-.5:0,-.5),this._drawTextStroke(t),this._drawTextFill(t),t.restore()),e&&(this.width=this._maximizedAnimationTextWidth)}else this.width=0}showTradeWithLogo(e){this._showTradeWithLogo=e}_minimizedAnimationWidth(){return this._sizeConstants.brandCircleSize+this._badgeData.logoMargin+this._badgeData.width}_maximizedAnimationWidth(){return this._sizeConstants.brandCircleSize+this._sizeConstants.logoTextOffset+this._maximizedAnimationTextWidth+this._badgeData.width+this._badgeData.textMargin}_drawTradeWithLogo(e,t,i){0}_drawLogo(e,t,i,s,r){const{brandCircleSize:n,logoLeftOffset:o,logoTextOffset:a}=this._sizeConstants;e.save(),this._drawFillRectWithRoundedCorner(e,-.5,0,i,n,n/2);const{logoImage:l,textImage:c,proBadgeImage:h}=t,{width:d,height:u}=l.viewBox(),p=new ft.Point(Math.round((n-d)/2)-1+o,Math.floor((n-u)/2)+1);if(r){const t=new ft.Point(p.x+d+a,p.y),i=e.globalAlpha;e.globalAlpha*=this._textAnimatedAlpha;const r=s-this._sizeConstants.brandCircleSize-a-this._badgeData.logoMargin-this._badgeData.width;this._drawImageCropWidth(e,t,c,r),e.globalAlpha=i}if(h){const{width:t,height:i}=h.viewBox();h.render(e,{targetViewBox:{x:p.x+this.width-t,y:Math.floor((n-i)/2)+1,width:t,height:i}})}this._drawLogoImage(e,p,l),e.restore()}_init(){oi={},ni={},this._checkLayout(),this.show&&(this._updateColors(),this._updateHeight(),this._model.properties().childs().paneProperties.childs().background.subscribe(this,this._updateColors),this._model.onChartThemeLoaded().subscribe(this,this._updateColors))}_updateHeight(){this._needDisplayImage?this.height=this._sizeConstants.brandCircleSize:this.height=this._fontSize+2}_checkFontLoaded(){if(!this._showAnimatedBranding&&document.fonts&&document.fonts.check&&document.fonts.load){document.fonts.check(`${this._fontSize}px EuclidCircular`)?this._font="px EuclidCircular":document.fonts.load(`${this._fontSize}px EuclidCircular`,this._txt).then((()=>{this._font="px EuclidCircular",this._recalculateMetrics(),this._requestRepaint()}))}}_recalculateMetrics(){var e;const t=(0,xt.createDisconnectedCanvas)(document,(0,mt.size)({width:0,height:0})),i=(0,xt.getPrescaledContext2D)(t);i.font=this._fontSize+this._font;const s=this._needDisplayImage?this._getLogoImage(this._colors.logo):null;let r=s?s.textImage.viewBox().width+this._sizeConstants.textAsImageWidthCompensation:Math.ceil(i.measureText(this._txt).width)+2+8;r%2==0&&(r+=1),this._maximizedAnimationTextWidth=r,this._textWidthCache.reset(),this._logoWidth=null!==(e=null==s?void 0:s.logoImage.viewBox().width)&&void 0!==e?e:0,
this._animatedWidth=this._alwaysMaximized?this._maximizedAnimationWidth():this._minimizedAnimationWidth()}_updateColors(){this._colors=this._model.dark().value()?Et:Vt}_getLogoImage(e){return function(e,t,i,s,r){const o=oi,a=[t,i,r&&"tradeWith"].filter(Boolean).join("-"),l=o[a];if(void 0!==l)return l;const[c,h,d]=function(e,t,i){return i?["logo-trade-with","tradingview-trade-with"]:["logo-old-style","tradingview-old-style",void 0]}(0,0,r),u=e=>e.replace(/fill="#[\da-f]{6}"/gi,`fill="${i}"`),p={logoImage:e(u((0,n.ensureDefined)(Bt.get(c)))),textImage:e(u((0,n.ensureDefined)(Bt.get(h)))),proBadgeImage:d?e(u((0,n.ensureDefined)(Bt.get(d)))):void 0};return o[a]=p,p}(Tt.svgRenderer,this._model.dark().value()?"dark":"light",e,0,this._showTradeWithLogo)}_checkLayout(){switch(this._layout){case Wt:case Ht:case zt:case jt:case Gt:case Kt:case $t:case Ft:this.show=!0;break;case Ut:case qt:case Yt:this.show=!1}switch(this._layout){case $t:this._needDisplayImage=!0,this._txt=Qt;break;case Kt:this._txt=ei}}_drawTextStroke(e){e.save(),e.textBaseline="middle",e.textAlign="start",e.font=this._fontSize+this._font,e.strokeStyle=this._colors.staticTextBackground,e.lineWidth=4,e.lineJoin="round",e.strokeText(this._txt,0,this._sizeConstants.brandCircleSize/2+this._textWidthCache.yMidCorrection(e,this._txt)),e.restore()}_drawTextFill(e){e.save(),e.textBaseline="middle",e.textAlign="start",e.font=this._fontSize+this._font,e.fillStyle=this._colors.text,e.fillText(this._txt,0,this._sizeConstants.brandCircleSize/2+this._textWidthCache.yMidCorrection(e,this._txt)),e.restore()}_drawImageCropWidth(e,t,i,s){e.save();const{logoMargin:r,textMargin:n}=this._badgeData;e.beginPath();const{width:o,height:a}=i.viewBox();e.rect(t.x-this._textAdditionalCropWidth,t.y,s+this._textAdditionalCropWidth,a),e.clip(),i.render(e,{targetViewBox:{x:t.x-(this._invertTextCropDirection?o-s-r+n:0),y:t.y,width:o,height:a}}),e.restore()}_drawBgCircle(e,t){const i=2*Math.PI;e.save(),e.beginPath(),e.fillStyle=this._colors.shadow,e.arc(t,t,t+1,0,i),e.fill(),e.closePath(),e.restore(),e.save(),e.beginPath(),e.fillStyle=this._colors.background,e.arc(t,t,t,0,i,!1),e.fill(),e.closePath(),e.restore()}_drawFillRectWithRoundedCorner(e,t,i,s,r,n,o){e.save(),(0,It.drawRoundRect)(e,t-1,i-1,s+2,r+2,n),e.fillStyle=this._backgroundShadowFillStyle(),e.fill(),e.closePath(),e.restore(),e.save(),(0,It.drawRoundRect)(e,t,i,s,r,null!=o?o:n),e.fillStyle=this._backgroundFillStyle(),e.fill(),e.closePath(),e.restore()}_tradeWithLogoBackgroundColor(){return""}_backgroundShadowFillStyle(){return this._colors.shadow}_backgroundFillStyle(){return this._colors.background}_drawLogoImage(e,t,i){const{width:s,height:r}=i.viewBox();i.render(e,{targetViewBox:{x:t.x,y:t.y,width:s,height:r}})}}class ci extends ai{constructor(e,t,i){super(),this.show=!1,this.width=0,this.height=0,this._ready=!1,this._layout=e,this._src=t,this._onReadyCallback=i,this._checkLayout();const s=new Image;this._img=s,this.show&&(s.addEventListener("load",(()=>{this.width=Math.round(s.width),this.height=Math.round(s.height),
this._ready=!0,this._onReadyCallback&&this._onReadyCallback()})),s.crossOrigin="anonymous",s.src=this._src)}draw(e,t,i){this._topLeftPoint=e,this._ready&&(t.translate(e.x,e.y),t.drawImage(this._img,-.5,-.5,this.width,this.height))}_checkLayout(){switch(this._layout){case zt:case Ut:case Gt:case qt:case Kt:case Yt:this.show=!0;break;case Ft:case Wt:case Ht:case jt:case $t:this.show=!1}}}var hi=i(4454),di=i(94664);class ui{constructor(e,t){this._headerToolbar=e,this._dropdownId=t}applyOptions(e){this._headerToolbar.updateDropdown(this._dropdownId,e)}remove(){this._headerToolbar.removeDropdown(this._dropdownId)}}var pi=i(26843),_i=i(74047),mi=i(38119);class gi{constructor(e){this._symbolModel=e}getVisible(){return this._symbolModel.visible().value()}setVisible(e){return this._symbolModel.visible().setValue(e),this}getIcon(){return this._symbolModel.icon().value()}setIcon(e){return this._symbolModel.icon().setValue(e),this}getColor(){return this._symbolModel.color().value()}setColor(e){return this._symbolModel.color().setValue(e),this}getTooltip(){return this._symbolModel.tooltip().value()}setTooltip(e){return this._symbolModel.tooltip().setValue(e),this}getDropDownContent(){return this._symbolModel.tooltipContent().value()}setDropDownContent(e){return this._symbolModel.tooltipContent().setValue(e),this}}class fi{symbol(e){return new gi(this._model().getSymbolCustomStatus(e))}hideAll(){this._model().hideAll()}static getInstance(){return null===this._instance&&(this._instance=new fi),this._instance}_model(){return mi.CustomStatusModel.getInstance()}}fi._instance=null;var vi=i(97702),yi=i(19291);var Si,bi,wi,Ci=i(27514),Pi=i(35474),xi=i(79612),Ti=i(7507);(0,A.setClasses)();const Ii=(0,o.getChartingLibraryGlobalContext)(),Mi=(0,o.getChartingLibraryOwner)(),Ai=new class{constructor(e,t){this._updateDocumentHeight=e=>{"visual"===this._viewportType&&this._window.document.documentElement.style.setProperty("height",`${e}px`,"important")},this._window=e,this._fullscreenApi=new Re(e.document),this._viewportType=We.CheckMobile.iOS()&&!(0,Fe.isOnMobileAppPage)("any")&&this._window.visualViewport?"visual":"quirks","visual"===this._viewportType?this._viewport=(0,n.ensure)(this._window.visualViewport):this._viewport=this._window;const i=this._layoutSizeSensor=this._window.document.createElement("div");i.id="layout-size-sensor",i.style.position="fixed",i.style.top="0",i.style.left="0",i.style.right="0",i.style.bottom="0",i.style.pointerEvents="none",i.style.visibility="hidden",this._initFullscreen()}allocate(){this.free();const e=this._window.document,t=e.createElement("div");t.classList.add("js-rootresizer__contents"),t.style.position="relative",t.style.width="100%",t.style.height="100%",e.body.insertAdjacentElement("afterbegin",t),e.body.insertAdjacentElement("afterbegin",this._layoutSizeSensor),this._visibilityApi=new Ne(this._window.document);const i={alive:new O.WatchedValue(!0),fullscreenable:new O.WatchedValue(!0),container:new O.WatchedValue(t),width:new O.WatchedValue,height:new O.WatchedValue,availWidth:new O.WatchedValue,
availHeight:new O.WatchedValue,visible:this._visibilityApi.isVisible,fullscreen:this._fullscreenApi.isFullscreen,remove:()=>{i.alive.setValue(!1)},attach:()=>{i.alive.setValue(!1),this._window.close()},requestFullscreen:()=>{this._requestFullscreen()},exitFullscreen:()=>{this._exitFullscreen()}};return i.alive.subscribe((e=>{e||i!==this._area||this.free()})),this._area=i,this._resizeHandler=()=>{const e=this._width(i)||800,t=this._height(i)||600;i.availHeight.setValue(t),i.availWidth.setValue(e),i.height.setValue(t),i.width.setValue(e)},this._area.height.subscribe(this._updateDocumentHeight,{callWithLast:!0}),this._resizeHandler(),this._viewport.addEventListener("resize",this._resizeHandler),new Be.ResizerDetacherState(i).bridge()}free(){if(this._resizeHandler&&(this._viewport.removeEventListener("resize",this._resizeHandler),this._resizeHandler=void 0),this._visibilityApi&&(this._visibilityApi.destroy(),this._visibilityApi=void 0),this._area){const e=this._area;this._area=void 0,e.height.unsubscribe(this._updateDocumentHeight),e.alive.setValue(!1);const t=e.container.value(),i=null==t?void 0:t.parentElement;i&&(i.removeChild(t),i.removeChild(this._layoutSizeSensor))}}_height(e){if("visual"===this._viewportType)return this._layoutSizeSensor.clientHeight;return e.container.value().clientHeight}_width(e){return e.container.value().clientWidth}_requestFullscreen(){this._fullscreenApi.enter()}_exitFullscreen(){this._fullscreenApi.exit()}_initFullscreen(){this._fullscreenApi.isFullscreen.subscribe((e=>{this._resizeHandler&&this._resizeHandler()}))}}(window),Li=new class{constructor(e){this._processVisibility=e=>{const t=e.container.value();return this.affectsLayout(e.name)?(t&&t.classList.toggle("js-hidden",!1),!0):(t&&t.classList.toggle("js-hidden",!0),!1)},this._setWidth=(e,t,i)=>{let s=i;this._fullscreenArea!==e.name&&(e.availWidth.setValue(i),e.canNegotiate.width&&(s=He(i,e.negotiations.width))),t||(s=0);const r=e.container.value();return r&&t&&(r.style.width=s+"px"),e.width.setValue(s),s},this._setHeight=(e,t,i)=>{let s=i;this._fullscreenArea!==e.name&&(e.availHeight.setValue(i),e.canNegotiate.height&&(s=He(i,e.negotiations.height))),t||(s=0);const r=e.container.value();return r&&t&&(r.style.height=s+"px"),e.height.setValue(s),s};const t=e.container.value();if(!t)throw new Error("bridge.container.value() must be an element");this._container=t,this._availableAreas=["left","tradingpanel","right","top","bottom","center","topleft","extratop"],this._areas={},this._bridge=e,this._width=e.width,this._height=e.height,this._width.subscribe((()=>this.recalculate())),this._height.subscribe((()=>this.recalculate())),this._bridge.visible.subscribe((()=>this._updateVisibility())),this._bridge.fullscreen.subscribe((()=>this._onParentFullscreenChange())),this.recalculate()}allocate(e){const t=e&&e.areaName;if(-1===this._availableAreas.indexOf(t))throw new Error("unknown options.areaName");this.free(t);const i=this._createDOM(t),s={name:t,canNegotiate:{width:"left"===t||"right"===t||"tradingpanel"===t||"topleft"===t,
height:"top"===t||"bottom"===t||"topleft"===t||"extratop"===t},negotiations:{width:[],height:[]},remove:()=>{for(const e in this._areas)this._areas[e]===s&&this.free(e)},negotiateWidth:e=>{if(!s.canNegotiate.width)return;const t=ze(e);Ue(s.negotiations.width,t)||(s.negotiations.width=t,this.recalculate())},negotiateHeight:e=>{if(!s.canNegotiate.height)return;const t=ze(e);Ue(s.negotiations.height,t)||(s.negotiations.height=t,this.recalculate())},requestFullscreen:()=>{this._fullscreenArea||("right"!==t&&"center"!==t||(this._fullscreenArea=t),"center"===t&&this._bridge.requestFullscreen(),this._updateFullscreen())},exitFullscreen:()=>{t===this._fullscreenArea&&(this._fullscreenArea=void 0,"center"===t&&this._bridge.exitFullscreen(),this._updateFullscreen())},width:new O.WatchedValue,height:new O.WatchedValue,availWidth:new O.WatchedValue,availHeight:new O.WatchedValue,alive:new O.WatchedValue(!0),container:new O.WatchedValue(i),visible:new O.WatchedValue(!0),fullscreen:new O.WatchedValue(!1),fullscreenable:new O.WatchedValue("right"===t||"center"===t),rdState:new Be.ResizerDetacherState};return s.rdState.pushOwner(s),this._areas[t]=s,s.rdState.owner.subscribe((e=>{const i=s.container.value();if(e!==s)i&&(i.innerHTML="",i.parentElement&&i.parentElement.removeChild(i));else{let e=null;for(let i=this._availableAreas.indexOf(t);i--;){const t=this._availableAreas[i];if(this.affectsLayout(t)){e=this._areas[t].container.value();break}}i&&(e&&i.parentElement?i.insertAdjacentElement("afterend",e):this._container.appendChild(i))}this.recalculate()}),{callWithLast:!0}),s.rdState.bridge()}free(e){const t=this._areas[e];if(!t)return;this._areas[e]=void 0;const i=t.container.value();i&&i.parentElement&&i.parentElement.removeChild(i),t.alive.setValue(!1)}recalculate(){const e={};this._recalcSingleRunToken=e;const t=this._areas.topleft,i=this._areas.left,s=this._areas.tradingpanel,r=this._areas.right,n=this._areas.top,o=this._areas.bottom,a=this._areas.center,l=this._areas.extratop,c=this._width.value(),h=this._height.value();let d=0,u=0,p=0,_=0,m=0,g=0,f=0,v=0;if(e===this._recalcSingleRunToken&&l){const e=this._processVisibility(l);v=this._setHeight(l,e,h),this._setWidth(l,e,c)}if(e===this._recalcSingleRunToken&&t){const e=this._processVisibility(t);f=this._setHeight(t,e,h),g=this._setWidth(t,e,c);const i=t.container.value();e&&i&&(i.style.top=v+"px")}let y=0;if(e===this._recalcSingleRunToken&&n){const e=this._processVisibility(n),t=n.container.value();e&&t&&(t.style.left=g+"px",t.style.top=v+"px");const i=c-g;this._setWidth(n,e,i),d=this._setHeight(n,e,h),d&&(y=1)}if(e===this._recalcSingleRunToken&&i){const e=this._processVisibility(i),t=Math.max(f,d);p=this._setWidth(i,e,c),p&&(p+=4),p&&1===y&&(y=4);const s=i.container.value();e&&s&&(s.style.top=t+v+y+"px"),this._setHeight(i,e,h-t-v)}if(e===this._recalcSingleRunToken&&s){const e=this._processVisibility(s);let t=c-p;je||(t-=300),m=this._setWidth(s,e,t),m&&1===y&&(y=4),this._setHeight(s,e,h-v-d-y)}if(e===this._recalcSingleRunToken&&r){const e=this._processVisibility(r);let t=c-p-m
;je||(t-=300),_=this._setWidth(r,e,t),_&&1===y&&(y=4),this._setHeight(r,e,h-v-d-y);const i=r.container.value();e&&i&&(i.style.top=d+v+y+"px")}const S=m+_;let b=0,w=c-p-m-_-(S?4:0);const C=Boolean(m||!S);if(!_&&m&&(w+=4),e===this._recalcSingleRunToken&&o){const e=this._processVisibility(o),t=o.container.value();e&&t&&(t.style.left=p+"px",t.classList.toggle("no-border-top-left-radius",!p),t.classList.toggle("no-border-top-right-radius",C)),this._setWidth(o,e,w);const i=h-v;b=Math.min(300,i-0),u=this._setHeight(o,e,i)+4}const P=Boolean(d&&(p||S));if(this._container.classList.toggle("layout-with-border-radius",P),e===this._recalcSingleRunToken&&a){const e=this._processVisibility(a),t=a.container.value();e&&t&&(t.style.left=p+"px",t.style.top=d+v+y+"px",t.classList.toggle("no-border-bottom-left-radius",!u||!p),t.classList.toggle("no-border-bottom-right-radius",C||!u),t.classList.toggle("no-border-top-left-radius",Boolean(!p&&S)),t.classList.toggle("no-border-top-right-radius",C)),this._setWidth(a,e,w);const i=h-d-u-v-y;this._setHeight(a,e,Math.max(i,b))}if(e===this._recalcSingleRunToken&&s&&this.affectsLayout("tradingpanel")){const e=s.container.value();e&&(e.style.right=m&&_?`${_+4}px`:`${_}px`,e.style.top=v+d+y+"px",e.style.borderTopRightRadius=P&&_?"4px":"0px")}e===this._recalcSingleRunToken&&this._updateVisibility()}affectsLayout(e){const t=this._areas[e];if(!t)return!1;if(t.rdState.owner.value()!==t)return!1;if(this._fullscreenArea&&this._fullscreenArea!==e)return $e(e);if(this._width.value()<=567||this._height.value()<=445&&!qe){if(!["center","top","left","topleft","extratop"].includes(e))return!1}return!0}_updateVisibility(){const e=this._bridge.visible.value();for(let t=0;t<this._availableAreas.length;t++){const i=this._availableAreas[t],s=this._areas[i];s&&(e&&this.affectsLayout(i)?s.visible.setValue(!0):s.visible.setValue(!1))}}_onParentFullscreenChange(){this._bridge.fullscreen.value()||(this._fullscreenArea=void 0,this._updateFullscreen())}_updateFullscreen(){const e=void 0!==this._fullscreenArea;for(let t=0;t<this._availableAreas.length;t++){const i=this._availableAreas[t],s=this._areas[i];if(!s)continue;if(i===this._fullscreenArea){s.fullscreen.setValue(!0);continue}s.fullscreen.setValue(!1);const r=s.container.value();r&&r.classList.toggle("js-hidden",e&&!$e(i))}this._updateVisibility(),this.recalculate()}_createDOM(e){const t=document.createElement("div");return t.classList.add("layout__area--"+e),t.style.position="absolute","tradingpanel"===e&&(t.style.borderTopRightRadius="4px"),"bottom"===e?t.style.bottom="0":t.style.top="0","right"===e||"tradingpanel"===e?t.style.right="0":t.style.left="0",t}}(Ai.allocate()),ki=(Mi.brokerFactory,Boolean(!1)),Di=Ii.urlParams;Ii.DEFAULT_SYMBOL=null!==(Si=Di.symbol)&&void 0!==Si?Si:"";const Ei=new AbortController,Vi=Mi.getCustomIndicators,Bi=(0,pe.createDeferredPromise)(),Ri=(0,pe.createDeferredPromise)(),Ni=(0,
pe.createDeferredPromise)(),Oi=l.enabled("left_toolbar"),Fi=l.enabled("library_custom_color_themes"),Wi=JSON.parse(Di.widgetbar),Hi=l.enabled("right_toolbar")&&(Wi.watchlist||Wi.details||Wi.news||Wi.datawindow||l.enabled("dom_widget")||l.enabled("order_panel")||l.enabled("show_object_tree")||l.enabled("bugreport_button")),zi=l.enabled("header_widget")?Li.allocate({areaName:"top"}):null,Ui=Oi?Li.allocate({areaName:"left"}):null,ji=Li.allocate({areaName:"center"});Hi&&Li.allocate({areaName:"right"});if(void 0!==Mi.contextMenu&&ct().setContextMenuOptions(Mi.contextMenu),Promise.all([Bi.promise,Ri.promise,Ni.promise]).then((()=>{Ii.ChartApiInstance.start()})),"function"==typeof Vi){const e=Vi({Std:ut.Std});e&&e.then?e.then((e=>{if(!Array.isArray(e))return console.warn("custom_indicators_getter should be a function that returns a Promise object which result is an array of custom indicators"),void Bi.resolve();const t=Ii.JSServer;t.studyLibrary.push.apply(t.studyLibrary,e),Bi.resolve(),console.log("{0} custom indicators loaded.".format(e.length))})).catch((e=>{console.warn("Error loading custom indicators "+e),Bi.resolve()})):(console.warn("custom_indicators_getter should be a function that returns a Promise object"),Bi.resolve())}else Bi.resolve();Ii.widgetReady=e=>{F.subscribe("onChartReady",e,null)};const Gi=null!==(wi=null===(bi=Di.theme)||void 0===bi?void 0:bi.toLowerCase())&&void 0!==wi?wi:pi.StdTheme.Light;var qi;function $i(e){Ii.__defaultsOverrides=Ii.__defaultsOverrides||{},(0,_e.deepExtend)(Ii.__defaultsOverrides,e),void 0!==TradingView.defaultProperties&&void 0!==TradingView.defaultProperties.chartproperties&&((0,h.applyDefaultsOverrides)(TradingView.defaultProperties.chartproperties),(0,h.applyDefaultOverridesToLinetools)())}qi=Gi,L.themes[qi]&&(0,k.setTheme)(qi),async function(e){if(!Fi||void 0===e)return;try{const{overrideStandardThemes:t}=await i.e(2413).then(i.bind(i,57626));t(e)}catch(e){console.error("Error applying custom themes",e)}}(Mi.customThemes).then(Ni.resolve).catch(Ni.resolve),Ii.applyStudiesOverrides=e=>{var t,i;e&&(Ii.chartWidgetCollection?null===(i=(t=Ii.chartWidgetCollection).applyStudiesOverrides)||void 0===i||i.call(t,e):at.StudyMetaInfo.mergeDefaultsOverrides(e))},Ii.applyOverrides=e=>{$i(e),Ii.chartWidgetCollection&&Ii.chartWidgetCollection.applyOverrides(e)},Ii.doWhenApiIsReady=e=>{Ii.tradingViewApi?e():Ri.promise.then(e)},Ii.applyTradingCustomization=e=>{for(const t in e.order)TradingView.defaultProperties.linetoolorder[t]=e.order[t];for(const t in e.position)TradingView.defaultProperties.linetoolposition[t]=e.position[t]},Ii.changeTheme=(e,t)=>{const i=L.themes[e.toLowerCase()];return i?Ii.tradingViewApi.themes().setStdTheme(i.name,!0,t&&t.disableUndo):Promise.resolve()},Ii.getTheme=()=>Ii.tradingViewApi.themes().getCurrentThemeName(),Ii.customThemes=async()=>{if(!Fi)return Promise.reject(new Error("The library_custom_color_themes feature must be enabled to use the custom themes API"));return new((await i.e(2413).then(i.bind(i,20688))).CustomThemesApi)},Ii.is_authenticated=!1
;JSON.parse(Ii.urlParams.brokerConfig);a.t(null,void 0,i(94566)),a.t(null,void 0,i(92800)),a.t(null,void 0,i(44676));let Ki=null;const Yi=(0,pe.createDeferredPromise)();let Zi;const Xi=()=>{var e;if(l.setEnabled("charting_library_export_chart_data",!Ii.configurationData.is_tradingview_data),l.setEnabled("charting_library_debug_mode","true"===Di.debug),l.setEnabled("chart_property_page_trading",!1),l.enabled("remove_library_container_border")){const e=document.querySelector("#library-container");null!==e&&(e.style.border="0px",e.style.padding="1px")}l.enabled("no_min_chart_width")&&(document.body.style.minWidth="0px"),null!=Di.studiesOverrides&&at.StudyMetaInfo.mergeDefaultsOverrides(JSON.parse(Di.studiesOverrides)),(0,n.assert)(void 0===TradingView.defaultProperties,"Default properties are inited before applying overrides"),$i(JSON.parse(Di.overrides));const t=Di.numeric_formatting?JSON.parse(Di.numeric_formatting):void 0;t&&("string"==typeof t.decimal_sign&&(he.formatterOptionsLibraryOverrides.decimalSign=t.decimal_sign[0]),"string"==typeof t.grouping_separator&&(he.formatterOptionsLibraryOverrides.groupingSeparator=t.grouping_separator[0])),Ii.ChartApiInstance=new(ot())(Mi.datafeed);const s=Mi.customFormatters;s&&(s.timeFormatter&&(de.customFormatters.timeFormatter=s.timeFormatter),s.dateFormatter&&(de.customFormatters.dateFormatter=s.dateFormatter),s.tickMarkFormatter&&(de.customFormatters.tickMarkFormatter=s.tickMarkFormatter),s.priceFormatterFactory&&(de.customFormatters.priceFormatterFactory=s.priceFormatterFactory),s.studyFormatterFactory&&(de.customFormatters.studyFormatterFactory=s.studyFormatterFactory)),Mi.customTimezones&&ke.instance().addTimezones(Mi.customTimezones),Ii.ChartApiInstance.setStudiesAccessController(Ii.ChartApiInstance.createStudiesAccessController(Di.studiesAccess));const o=Di.chartContent?JSON.parse(Di.chartContent).json:void 0,c=Di.chartContentExtendedData?JSON.parse(Di.chartContentExtendedData):o?o.extendedData:void 0,h=Di.interval||"D",d=function(e){const t=/(\d+)(\w+)/;return e.map((e=>{const s=(0,n.ensureNotNull)(t.exec(e.text)),r=s[2].toLowerCase(),o=parseInt(s[1]),l="y"===r?12*o+"M":o+r,c=Ve.Interval.parse(e.resolution);return{text:e.title||{y:a.t(null,{plural:"{count}y",count:o,context:"short_N_year"},i(46766)),m:a.t(null,{plural:"{count}m",count:o,context:"short_N_month"},i(58590)),d:a.t(null,{plural:"{count}d",count:o,context:"short_N_day"},i(47801))}[r]||`${o}${r}`,description:e.description||"",value:{value:l.toUpperCase(),type:"period-back"},targetResolution:c.value(),requiresIntraday:c.isIntraday()}}))}(JSON.parse(Di.timeFrames)),u={resizerBridge:ji,padding:l.enabled("border_around_the_chart")?2:0,content:o,widgetOptions:{addToWatchlistEnabled:!1,hideIdeas:!0,addVolume:(0,n.ensureDefined)(Ii.ChartApiInstance.studiesAccessController).isToolEnabled("Volume"),muteSessionErrors:!0,timezone:Di.timezone,defSymbol:null!==(e=Di.symbol)&&void 0!==e?e:"",defInterval:o?"":h,compareSymbols:Di.compareSymbols&&JSON.parse(Di.compareSymbols),defTimeframe:(p=Mi.timeframe,
p?"string"==typeof p?p:{...p,type:"time-range"}:p),paneContextMenuEnabled:l.enabled("pane_context_menu"),paneContextMenu:{mainSeriesTrade:ki},priceScaleContextMenuEnabled:l.enabled("scales_context_menu"),currencyConversionEnabled:l.enabled("pricescale_currency"),unitConversionEnabled:l.enabled("pricescale_unit"),legendWidgetEnabled:l.enabled("legend_widget"),legendWidget:{contextMenu:{settings:l.enabled("show_chart_property_page"),showOpenMarketStatus:l.enabled("display_market_status")}},sourceStatusesWidget:{errorSolution:!1},marketStatusWidgetEnabled:l.enabled("display_market_status"),chartWarningWidget:{subscriptionFullInfo:!1},timeScaleWidget:{contextMenuEnabled:l.enabled("scales_context_menu"),timezoneMenuEnabled:l.enabled("timezone_menu"),priceAxisLabelsOptions:{showLabels:l.enabled("main_series_scale_menu")}},timeScale:{preserveBarSpacing:!1,lockVisibleTimeRangeOnResize:l.enabled("lock_visible_time_range_on_resize"),rightBarStaysOnScroll:l.enabled("right_bar_stays_on_scroll"),minBarSpacing:Di.time_scale&&JSON.parse(Di.time_scale).min_bar_spacing},goToDateEnabled:l.enabled("go_to_date"),crossHair:{menuEnabled:l.enabled("chart_crosshair_menu")},handleScale:{mouseWheel:l.enabled("mouse_wheel_scale"),pinch:l.enabled("pinch_scale"),axisPressedMouseMove:{time:l.enabled("axis_pressed_mouse_move_scale"),price:l.enabled("axis_pressed_mouse_move_scale")}},handleScroll:{mouseWheel:l.enabled("mouse_wheel_scroll"),pressedMouseMove:l.enabled("pressed_mouse_move_scroll"),horzTouchDrag:l.enabled("horz_touch_drag_scroll"),vertTouchDrag:l.enabled("vert_touch_drag_scroll")},shiftVisibleRangeOnNewBar:l.enabled("shift_visible_range_on_new_bar"),croppedTickMarks:l.enabled("cropped_tick_marks"),countdownEnabled:l.enabled("countdown"),indicatorsDialogShortcutEnabled:l.enabled("insert_indicator_dialog_shortcut")},seriesControlBarEnabled:l.enabled("timeframes_toolbar"),seriesControlBar:{timeFramesWidgetEnabled:!0,timeFramesWidget:{goToDateEnabled:l.enabled("go_to_date"),availableTimeFrames:(e,t)=>{if(!e)return[];if(t!==dt.STATUS_DELAYED&&t!==dt.STATUS_DELAYED_STREAMING&&t!==dt.STATUS_EOD&&t!==dt.STATUS_READY)return[];return d.filter((t=>!(t.requiresIntraday&&!e.has_intraday)&&!(e.supported_resolutions&&!e.supported_resolutions.includes(t.targetResolution))))}},timeWidgetEnabled:!0,timeWidget:{timezoneMenuEnabled:l.enabled("timezone_menu")},adjustForDividendsButtonEnabled:!1,sessionIdButtonEnabled:l.enabled("pre_post_market_sessions"),backAdjustmentButtonEnabled:!1,settlementAsCloseButtonEnabled:!1,percentageScaleButtonEnabled:!0,logScaleButtonEnabled:!0,autoScaleButtonEnabled:!0,fullscreenButtonEnabled:!0,mobileChangeLayoutEnabled:!1},globalEvents:!0,snapshotUrl:Di.snapshotUrl,mobileForceChartMaximizeEnabled:!1,saveChartEnabled:l.enabled("save_shortcut")};var p;Oi&&((0,Qe.createFavoriteDrawingToolbar)(),u.widgetOptions.isDrawingToolbarVisible=x.isDrawingToolbarVisible),c&&(u.metaInfo={id:c.uid,name:c.name,description:c.description,uid:c.uid,username:""}),Mi.additionalSymbolInfoFields&&(0,
hi.setAdditionalSymbolInfoFields)(Mi.additionalSymbolInfoFields);const _=Mi.symbolSearchComplete;_&&(0,di.setSymbolSearchCompleteOverrideFunction)(_);const m=Ii.chartWidgetCollection=new(Je())(u);let g=!1;m.onAboutToBeDestroyed.subscribe(null,(()=>{g=!0}),!0),function(e){e.addCustomSource("branding",((t,i)=>{const s=(0,pt.combine)(((e,t)=>{const s=null!=e?e:t;return null!==s&&s.hasModel()&&s.model().model()===i}),e.maximizedChartWidget().weakReference(),e.leftBottomChartWidget().weakReference());return new ii(t,i,s.ownership())}),_t.CustomSourceLayer.Topmost)}(m),Ii.studyMarket=new ue(m),Ze.registerService(Ye.CHART_WIDGET_COLLECTION_SERVICE,m),m.activeChartWidget.subscribe((e=>{F.emit("activeChartChanged",m.getAll().indexOf(e))})),Ii.saver=new N.ChartSaver(m);const f=new X(m,Ii.saver);m.setSaveChartService(f);const y=new se(m);Ii.chartWidget=m.activeChartWidget.value(),Ii.pro=new TradingView.Pro;const S=function(e){if(!zi)return null;const t=new M.ChartChangesWatcher(e.chartWidgetCollection,Ii.saver,F),s=JSON.parse(Di.favorites);s.intervals=s.intervals.map((e=>{let t=""+e;return t.match(/1[DWMYdwmy]/)&&(t=t.slice(1)),t})),l.enabled("study_templates")&&(Zi=new le({chartWidgetCollection:e.chartWidgetCollection}));let r;const n=Di.header_widget_buttons_mode;"fullsize"===n&&(r=["full"]);"compact"===n&&(r=["small"]);const o=(0,Ci.shouldShowQuickSearchOnLib)()?function(e){const t=t=>Promise.all([i.e(711),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(7399),i.e(2248),i.e(7769),i.e(7125),i.e(8077),i.e(5546),i.e(3114),i.e(5666),i.e(4632),i.e(8432),i.e(3204),i.e(1729),i.e(8073),i.e(9486),i.e(4959),i.e(8732),i.e(1335),i.e(1782),i.e(2227),i.e(3443),i.e(6014),i.e(2079),i.e(3098),i.e(2751),i.e(1890),i.e(2157),i.e(9754)]).then(i.bind(i,71043)).then((i=>{const s=new(0,i.GlobalSearchDialogRenderer)(e);return null!==Ee&&Ee.hide(),s.show(t),Ee=s,s}));return(0,E.createGroup)({desc:"GlobalSearch"}).add({desc:"Open",hotkey:E.Modifiers.Mod+75,handler:()=>t()}),t}(e.loadChartService):void 0;return new P(new v,{chartSaver:Ii.saver,chartApiInstance:Ii.ChartApiInstance,chartWidgetCollection:e.chartWidgetCollection,defaultFavoriteStyles:s.chartTypes,defaultFavoriteIntervals:s.intervals,resizerBridge:zi,studyMarket:Ii.studyMarket,studyTemplates:Zi,allowedModes:r,saveChartService:e.saveChartService,loadChartService:e.loadChartService,chartChangesWatcher:t,onClick:is,snapshotUrl:e.snapshotUrl,openGlobalSearch:o})}({chartWidgetCollection:m,saveChartService:f,loadChartService:y,snapshotUrl:Di.snapshotUrl});null!==S?S.load().then((e=>{Ki=e.getComponent(),Yi.resolve()})):(Yi.promise.catch((()=>{})),Yi.reject("header widget is not loaded"));const b=function(e){if(Ui){const t=Di.toolbarbg&&/^[0-9a-f]+$/i.test(Di.toolbarbg)?String(Di.toolbarbg):void 0;if(t){const e=document.createElement("style");e.textContent="body,.chart-controls-bar,#footer-chart-panel{background-color:#"+t+" !important}",document.head.appendChild(e)}return new I({bgColor:t,chartWidgetCollection:e,
drawingsAccess:Di.drawingsAccess?JSON.parse(Di.drawingsAccess):void 0,resizerBridge:Ui,onClick:is})}return null}(m),w=null;Ii.tradingViewApi=new(ct())({chartWidgetCollection:m,chartApiInstance:Ii.ChartApiInstance,saveChartService:f,loadChartService:y,studyMarket:null});if(ce.linking.bindToChartWidgetCollection(m),isNaN(Di.studyCountLimit)||(TradingView.STUDY_COUNT_LIMIT=Math.max(2,+(0,n.ensureDefined)(Di.studyCountLimit))),!isNaN(Di.ssreqdelay)){const e=Math.max(0,+(0,n.ensureDefined)(Di.ssreqdelay));(0,ht.setSearchRequestDelay)(e)}Ii.ChartApiInstance.connect(),(async()=>{const{default:e}=await Promise.all([i.e(1595),i.e(3060),i.e(2603),i.e(5514),i.e(7399),i.e(2248),i.e(7769),i.e(7125),i.e(55),i.e(5666),i.e(4632),i.e(8432),i.e(8073),i.e(6107),i.e(3645),i.e(8732),i.e(1227),i.e(1335),i.e(5877),i.e(1538),i.e(2227),i.e(361),i.e(1890),i.e(2157),i.e(3504),i.e(2306)]).then(i.t.bind(i,36074,23));g||(Ii.lineToolPropertiesToolbar=new e(m))})();const C=document.querySelector(".tv-content");null!==C&&C.addEventListener("contextmenu",(e=>{e.target instanceof Element&&"input"!==e.target.tagName.toLowerCase()&&"textarea"!==e.target.tagName.toLowerCase()&&e.preventDefault()})),Ri.resolve(),m.undoHistory.undoStack().onChange().subscribe(null,(0,r.default)((e=>{(null==e?void 0:e.affectsState())&&F.emit("onAutoSaveNeeded")}),1e3*(Number(Di.autoSaveDelay)||5),{leading:!1,trailing:!0}));let T=!1;function A(){b&&b.load(Ei.signal),w&&w.load(Ei.signal).then((e=>{Ii.footerWidget=e.getComponent()}))}Ii.chartWidget.withModel(null,(()=>{Ii.ChartApiInstance.on("realtime_tick",(e=>{F.emit("onTick",e)}));if(!L.savedThemeName()&&Gi){const e=L.getStdTheme(Gi);e&&e.content&&void 0===o&&m.applyTheme({theme:e.content,onlyActiveChart:!1,restoreNonThemeDefaults:!1,themeName:Gi,standardTheme:!0,syncState:!0,noUndo:!0}).then((()=>Ii.applyOverrides(Ii.__defaultsOverrides)))}if(l.enabled("charting_library_debug_mode")&&F.subscribeToAll(((...e)=>{console.log(`${(new Date).toISOString()} Event "${e[0]}", arguments: ${JSON.stringify(e.slice(1))}`)})),T)return;T=!0,rt(m),function(e,t){const s=a.t(null,void 0,i(37367)).format({emoji:"👍"}),r=a.t(null,void 0,i(69804)).format({emoji:"👍"}),o=a.t(null,void 0,i(6655)).format({emoji:"👍"});F.on("onServerScreenshotCopiedToClipboard",(()=>h(s)),null),F.on("onClientScreenshotCopiedToClipboard",(()=>h(r)),null),F.on("onServerScreenshotEmbedCodeCopiedToClipboard",(()=>h(o)),null);let l=null;const c=e.getContainer();function h(e){l?l.show(e):Promise.all([i.e(7528),i.e(7353),i.e(2227),i.e(92)]).then(i.bind(i,1524)).then((i=>{l||(l=new i.ChartScreenshotHintRenderer((0,n.ensureNotNull)(c),{bottomPadding:t.seriesControlBarEnabled}),l.show(e))}))}}(m,{seriesControlBarEnabled:l.enabled("timeframes_toolbar")});_i.WatermarkApi.getInstance().setWidgetCollection(Ii.chartWidgetCollection)})),m.getAll().some((e=>e.isInitialized()))?A():function(e,t){const i=e.getAll(),s=()=>{t(),i.forEach((e=>{e.chartWidgetInitialized().unsubscribe(null,s)}))};i.forEach((e=>{e.chartWidgetInitialized().subscribe(null,s,!0)}))}(m,A),
F.subscribe("chart_load_requested",(e=>{Ii.tradingViewApi.loadChart({json:JSON.parse(e.content),extendedData:e})}),null)};window.addEventListener("unload",(()=>{Ei.abort(),Ii.widgetbar&&(Ii.widgetbar.destroy(),Ii.widgetbar=null),Ii.chartWidgetCollection&&(Ii.chartWidgetCollection.destroy(),Ii.chartWidgetCollection=null),Ii.ChartApiInstance&&Ii.ChartApiInstance.disconnect(),(0,Ke.destroyQuoteSessions)(),Ii.ChartApiInstance&&(Ii.ChartApiInstance.destroy(),Ii.ChartApiInstance=null)})),l.enabled("saveload_storage_customization")&&(Mi.saveLoadAdapter?D.setCustomAdapter(Mi.saveLoadAdapter):Ii.urlParams.chartsStorageUrl&&Ii.urlParams.clientId?D.initialize(Ii.urlParams.clientId,Ii.urlParams.userId,Ii.urlParams.chartsStorageUrl,Ii.urlParams.chartsStorageVer||"1.0"):(l.setEnabled("saveload_storage_customization",!1),l.setEnabled("header_saveload",!1)));const Ji=(0,pe.createDeferredPromise)();function Qi(){Ji.resolve()}Mi.loadLastChart&&l.enabled("saveload_storage_customization")?D.getCharts().then((e=>{if(0===e.length)return void Qi();const t=e.sort(((e,t)=>t.modified_iso-e.modified_iso))[0];D.getChartContent(t).then((e=>{const t=e,i=JSON.parse(t.content);i.extendedData=e,Di.chartContent=JSON.stringify({json:i}),Qi()})).catch(Qi)})).catch(Qi):Qi();const es=(0,Ti.loadLineToolsSynchronizer)(),ts=(0,pe.createDeferredPromise)();function is(){const e=TradingView.bottomWidgetBar;e&&e.turnOffMaximize()}Promise.all([ts.promise,Ji.promise,Ii.loadedCustomCss,es,Ni.promise]).then((()=>{const e=document.querySelector(".loading-indicator");if(e&&(e.style.display="none"),setTimeout(Xi,0),l.enabled("14851")&&Math.random()<=.02){t=window,i=document,s="script",r="ga",t.GoogleAnalyticsObject=r,t.ga=t.ga||function(){(t.ga.q=t.ga.q||[]).push(arguments)},t.ga.l=Number(new Date),o=i.createElement(s),a=i.getElementsByTagName(s)[0],o.async=1,o.src="//www.google-analytics.com/analytics.js",a.parentNode.insertBefore(o,a);const e=(0,n.ensureNotNull)(document.URL.match(new RegExp("(:?.*://)([^/]+)/.*")))[2];Ii.ga("create","UA-112911840-1","auto"),Ii.ga("set","anonymizeIp",!0),Ii.ga("set",{hostname:e,page:e,referrer:e}),Ii.ga("send","pageview")}var t,i,s,r,o,a})),(()=>{let e=!0;Mi.datafeed.onReady((t=>{e&&console.warn("`onReady` should return result asynchronously. Use `setTimeout` with 0 interval to execute the callback function."),Ii.configurationData=t,ts.resolve()})),e=!1})(),Ii.createShortcutAction=(()=>{const e=E.createGroup({desc:"API"});return(t,i)=>{var s;e.add({hotkey:(s=t,"number"==typeof s?s:"string"==typeof s?R(s.split("+")):Array.isArray(s)?R(s):0),handler:i})}})(),Ii.initializationFinished=()=>{Ii.chartWidgetCollection.undoHistory.clearStack()},Ii.headerReady=()=>Yi.promise,Ii.createButton=e=>{if(null===Ki)throw new Error("Cannot create button: header widget is not ready or is not loaded - use `headerReady` to wait until header is ready");return(e=e||{}).align=e.align||"left",e.useTradingViewStyle=e.useTradingViewStyle||!1,Ki.addButton((0,me.randomHash)(),e)},Ii.createDropdown=e=>{
if(void 0===e)throw new Error("Cannot create dropdown without any parameters. Please refer to the documentation");void 0===e.align&&(e.align="left");const t=(0,me.randomHash)();return Ki?(Ki.addDropdown(t,e),Promise.resolve(new ui(Ki,t))):Yi.promise.then((()=>((0,n.ensureNotNull)(Ki).addDropdown(t,e),new ui((0,n.ensureNotNull)(Ki),t))))},Ii.getAllFeatures=()=>{const e=l.getAllFeatures();return Object.keys(e).forEach((t=>{isNaN(parseFloat(t))||delete e[t]})),e},Ii.getNavigationButtonsVisibility=(0,s.default)((()=>(0,ge.convertPropertyToWatchedValue)((0,fe.property)()))),Ii.getPaneButtonsVisibility=(0,s.default)((()=>(0,ge.convertPropertyToWatchedValue)((0,ve.property)()))),Ii.getDateFormat=(0,s.default)((()=>(0,ge.convertPropertyToWatchedValue)(ye.dateFormatProperty))),Ii.getTimeHoursFormat=(0,s.default)((()=>(0,ge.convertPropertyToWatchedValue)(Se.timeHoursFormatProperty))),Ii.getCurrencyAndUnitVisibility=(0,s.default)((()=>(0,ge.convertPropertyToWatchedValue)((0,De.currencyUnitVisibilityProperty)()))),Ii.customSymbolStatus=()=>fi.getInstance();Ii.urlParams.debugBroker,new Set(["connectionStatus"]);const ss=Di.locale||"en",rs=Pi.AriaChartDescription.getInstance();rs.createElement(document),rs.setLocale(ss),Ii.customChartDescriptionFunction&&rs.setCustomProvider(Ii.customChartDescriptionFunction);const ns=xi.AriaCrosshairPriceDescription.getInstance();ns.createElement(document),ns.setLocale(ss),function(){const e=l.enabled("accessible_keyboard_shortcuts")?(0,V.humanReadableHash)(9):`${(0,V.humanReadableModifiers)(V.Modifiers.Alt,!1)} + ${(0,V.humanReadableHash)(90)}`,t=`${(0,V.humanReadableModifiers)(V.Modifiers.Mod,!1)} + ${(0,V.humanReadableHash)(75)}`,s=a.t(null,void 0,i(7697)),r=[a.t(null,{replace:{shortcut:e}},i(85166)),a.t(null,{replace:{shortcut:t}},i(57959)),a.t(null,void 0,i(36332)),a.t(null,void 0,i(9687)),a.t(null,void 0,i(40490)),a.t(null,void 0,i(55382))],n=document.createElement("p");n.innerText=s;const o=document.createElement("ul");r.forEach((e=>{const t=document.createElement("li");t.innerText=e,o.appendChild(t)}));const c=document.createElement("div");c.setAttribute("role","contentinfo"),c.setAttribute("aria-hidden","false"),c.style.fontSize="0",c.appendChild(n),c.appendChild(o),document.body.insertBefore(c,document.body.firstChild)}(),new vi.Action({actionId:"UnknownAction",options:{label:"",onExecute:()=>{window.dispatchEvent(new CustomEvent("keyboard-navigation-activation",{bubbles:!0}));const[e]=Array.from(document.querySelectorAll('button:not([disabled]):not([aria-disabled]):not([tabindex="-1"]), input:not([disabled]):not([aria-disabled]):not([tabindex="-1"]), [tabindex]:not([disabled]):not([aria-disabled]):not([tabindex="-1"])')).filter((0,yi.createScopedVisibleElementFilter)(document.documentElement)).sort(yi.navigationOrderComparator);void 0!==e&&e.focus()},hotkeyHash:l.enabled("accessible_keyboard_shortcuts")?9:E.Modifiers.Alt+90,hotkeyGroup:(0,E.createGroup)({desc:"Global shortcuts"})}})},36986:(e,t,i)=>{"use strict";function s(){return window}function r(){const e=s()
;return e.parent[e.urlParams.uid]}i.d(t,{getChartingLibraryGlobalContext:()=>s,getChartingLibraryOwner:()=>r})},86129:(e,t,i)=>{e=i.nmd(e),TradingView.cleanButAmpersand=function(e,t){var i=t?["&amp;"]:["&"];return TradingView.clean(e,t,i)},TradingView.strip_tags=function(e){return e&&e.replace?e.replace(/(<([^>]+)>)/gi,""):e},TradingView.encodeSpread=function(e){return encodeURIComponent(e)},TradingView.clean=function(e,t,i){var s=[["&","&amp;"],["<","&lt;"],[">","&gt;"],['"',"&quot;"],["'","&#039;"],["'","&#39;"]],r=e;if(!e||!e.replace)return r;for(var n=0;n<s.length;n++){var o=s[n][0],a=s[n][1];i&&i.indexOf&&-1!==i.indexOf(t?a:o)||(r=t?r.replace(new RegExp(a,"g"),o):r.replace(new RegExp(o,"g"),a))}return r},e&&e.exports&&(e.exports={clean:TradingView.clean,cleanButAmpersand:TradingView.cleanButAmpersand,stripTags:TradingView.strip_tags})},31311:(e,t,i)=>{"use strict";i.r(t);var s=i(21097),r=i(51768),n=i(76422),o=i(38780);function a(e,t=!1){"loading"!==document.readyState?t?setTimeout((()=>e()),1):e():document.addEventListener("DOMContentLoaded",(()=>e()))}new Promise((e=>{a(e)}));function l(e,t="x"){let i=!1;return"x"!==t&&"both"!==t||(i=i||e.offsetWidth<e.scrollWidth),"y"!==t&&"both"!==t||(i=i||e.offsetHeight<e.scrollHeight),i}function c(e,t="x"){for(const i of Array.from(e.children))if(i instanceof HTMLElement&&(l(i,t)||c(i,t)))return!0;return!1}function h(e){let t="x";return e.matches(".apply-overflow-tooltip--direction_both")?t="both":e.matches(".apply-overflow-tooltip--direction_y")&&(t="y"),t}function d(e){const t=e.getAttribute("data-overflow-tooltip-text");let i="";return i=t||(e.matches&&e.matches(".apply-overflow-tooltip--allow-text")?e.textContent||"":Array.from(e.childNodes).reduce(((e,t)=>(t.nodeType===Node.TEXT_NODE&&e.push(t.textContent||""),e)),[]).join("").trim()),i}function u(e,t){let i=!1;const s=e.children;for(let e=0;e<s.length;e++){const r=s[e];if(r instanceof HTMLElement&&l(r,t)){i=!0;break}}return i}a((()=>{document.addEventListener("mouseenter",(e=>{const t=e.target;if(t instanceof HTMLElement&&t.matches(".apply-overflow-tooltip")){const e=h(t);if(t.matches(".apply-overflow-tooltip--check-children-recursively")){if(!c(t,e))return}else if(t.matches(".apply-overflow-tooltip--check-children")){if(!u(t,e))return}else if(!l(t,e))return;(0,o.showOnElement)(t,{text:d(t)});const i=()=>{(0,o.hide)(),["mouseleave","mousedown"].forEach((e=>t.removeEventListener(e,i)))};["mouseleave","mousedown"].forEach((e=>t.addEventListener(e,i)))}}),!0),document.addEventListener("focus",(e=>{const t=e.target;if(t instanceof HTMLElement&&(t.matches(".apply-overflow-tooltip-focus")||t.querySelector(".apply-overflow-tooltip-focus"))){const e=t.matches(".apply-overflow-tooltip")?t:t.querySelector(".apply-overflow-tooltip"),i=h(e);if(e.matches(".apply-overflow-tooltip--check-children-recursively")){if(!c(e,i))return}else if(e.matches(".apply-overflow-tooltip--check-children")){if(!u(e,i))return}else if(!l(e,i))return;(0,o.showOnElement)(t,{text:d(e)});const s=()=>{(0,o.hide)(),t.removeEventListener("blur",s)}
;t.addEventListener("blur",s)}}),!0)}));var p=i(52033),_=i(11417);var m=i(31054),g=i(95171),f=i(3343),v=i(19291);class y{constructor(){this._handleMouseDown=()=>{this._forwardTab=void 0},this._handleKeyDown=e=>{this._forwardTab=void 0,[9,f.Modifiers.Shift+9].includes((0,f.hashFromEvent)(e))&&(this._forwardTab=!e.shiftKey)},this._handleFocus=e=>{const t=e.target;if(void 0===this._forwardTab||!(t instanceof HTMLElement))return;const i=this._findDeepestFocusTrapElement(document.documentElement);if(!(i instanceof HTMLElement)||!i||i.contains(t))return;e.preventDefault(),e.stopPropagation(),t.blur();const s=i.compareDocumentPosition(t);if(s&Node.DOCUMENT_POSITION_PRECEDING||s&Node.DOCUMENT_POSITION_FOLLOWING){const e=this._forwardTab?b(i):b(i,!0);e instanceof HTMLElement&&e.focus()}},document.documentElement.addEventListener("focus",this._handleFocus,{capture:!0}),document.documentElement.addEventListener("keydown",this._handleKeyDown,{capture:!0}),document.documentElement.addEventListener("mousedown",this._handleMouseDown,{capture:!0})}destroy(){document.documentElement.removeEventListener("focus",this._handleFocus,{capture:!0}),document.documentElement.removeEventListener("keydown",this._handleKeyDown,{capture:!0}),document.documentElement.removeEventListener("mousedown",this._handleMouseDown,{capture:!0})}_findDeepestFocusTrapElement(e){const t=e.querySelectorAll('[data-focus-trap="true"]');let i=null,s=-1;return t.forEach((t=>{const r=this._calculateParentCount(t,e);r>s&&(s=r,i=t)})),i}_calculateParentCount(e,t){let i=0,s=e.parentElement;for(;s&&s!==t;)"true"===s.getAttribute("data-focus-trap")&&i++,s=s.parentElement;return i}}const S=(0,g.default)((()=>new y));function b(e,t){var i;const s=(0,v.getActiveElementSelectors)(),r=Array.from(e.querySelectorAll(s)).filter((0,v.createScopedVisibleElementFilter)(e));return null!==(i=t?r[r.length-1]:r[0])&&void 0!==i?i:null}var w=i(7047);let C;function P(e){const t=window.user.available_offers||{};window.TVSettings&&window.TVSettings.sync(window.user.settings),window.is_authenticated?(e||(initOfferLoginStateChangeButton(),onGoPro()&&window.location.reload()),!1===window.user.profile_data_filled&&((0,r.trackEvent)("Conversion","First login"),delete window.user.profile_data_filled)):(Object.keys(t).forEach((e=>{const i=e;t[i].available_for_anons||delete t[i]})),window.user={username:"Guest",following:"0",followers:"0",ignore_list:[],available_offers:t},_.TVLocalStorage.removeItem("trial_availiable"))}C=window.loginStateChange?window.loginStateChange:window.loginStateChange=new p.Delegate,C.subscribe(null,P),s.TVXWindowEvents.on("loginStateChange",(e=>{const t=JSON.parse(e);window.user=t.user,window.is_authenticated=!!t.is_authenticated,C.fire()})),s.TVXWindowEvents.on("signOut",(()=>{!function(){if(window.initData.lfs){const e=document.getElementsByClassName("js-admin-warning")[0];document.body.removeChild(e)}let e=!0;[/^\/chart\//,/^\/share-your-love\//,/^\/pine\//].forEach((t=>{t.test(window.location.pathname)&&(e=!1)})),e&&window.location.reload()}()})),(()=>{
const e="user-obj-changed",t={};window.crossTabSyncUserAttr=t=>{const i={};t instanceof Array?t.forEach((e=>{i[e]=window.user[e]})):i[t]=window.user[t],s.TVXWindowEvents.emit(e,JSON.stringify(i))},s.TVXWindowEvents.on(e,(e=>{const i=JSON.parse(e);let s;for(s in i)if(i.hasOwnProperty(s)){window.user[s]=i[s];(t[s]||[]).forEach((e=>{e.fire(i[s])}))}}))})(),window.TradingView.changeLoginState=e=>{window.is_authenticated=!!e,s.TVXWindowEvents.emit("loginStateChange",JSON.stringify({is_authenticated:window.is_authenticated,user:window.user})),window.is_authenticated&&n.emit("GLOBAL_EVENT_SIGN_IN_SUCCESS"),C.fire()},window.loginUser=function(e){window.user=(0,m.deepExtend)({},e),window.TradingView.changeLoginState(!0)},window.loginRequiredDelegate=new p.Delegate,window.runOrSignIn=(e,t)=>{t||(t={}),e()},window.onLoginStateChange=P,window.TradingView.setTrialAvailiable=e=>{_.TVLocalStorage.setItem("trial_availiable",e?"1":"0")},window.TradingView.notificationsChanged=new p.Delegate,S(),(0,w.initMouseClickAutoBlurHandler)()},19063:(e,t,i)=>{"use strict";i.r(t),i.d(t,{alphaToTransparency:()=>a,applyAlpha:()=>o,applyTransparency:()=>c,colorFromBackground:()=>p,colorToInteger:()=>v,generateColor:()=>n,getLuminance:()=>d,gradientColorAtPercent:()=>_,isColorDark:()=>m,isHexColor:()=>u,resetTransparency:()=>h,rgbaFromInteger:()=>g,rgbaToInteger:()=>f,transparencyToAlpha:()=>l});var s,r=i(24377);function n(e,t,i){if(t=t||0,!u(e))return i?(0,r.rgbaToString)((0,r.rgba)((0,r.parseRgb)(e),(0,r.normalizeAlphaComponent)(l(t)))):e;const[s,n,o]=(0,r.parseRgb)(e),a=(0,r.normalizeAlphaComponent)(l(t));return(0,r.rgbaToString)([s,n,o,a])}function o(e,t,i){const s=(0,r.tryParseRgba)(e);if(null===s)throw new Error(`Invalid color: ${e}`);const[n,o,a,l]=s,c=(0,r.normalizeAlphaComponent)(t*(i?l:1));return(0,r.rgbaToString)((0,r.rgba)([n,o,a],c))}function a(e){return 100*(1-e)}function l(e){if(e<0||e>100)throw new Error("invalid transparency");return 1-e/100}function c(e,t){if("transparent"===e)return e;const i=(0,r.parseRgba)(e),s=i[3];return(0,r.rgbaToString)((0,r.rgba)(i[0],i[1],i[2],l(t)*s))}function h(e){return"transparent"===e?e:u(e)?e.slice(0,7):(0,r.rgbaToString)((0,r.rgba)((0,r.parseRgb)(e),(0,r.normalizeAlphaComponent)(1)))}function d(e){const t=(0,r.parseRgb)(e).map((e=>(e/=255)<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4)));return Number((.2126*t[0]+.7152*t[1]+.0722*t[2]).toFixed(3))}function u(e){return 0===e.indexOf("#")}function p(e){return"black"===(0,r.rgbToBlackWhiteString)((0,r.parseRgb)(e),150)?"#ffffff":"#000000"}function _(e,t,i){const[s,n,o,a]=(0,r.parseRgba)(e),[l,c,h,d]=(0,r.parseRgba)(t),u=(0,r.rgba)(Math.round(s+i*(l-s)),Math.round(n+i*(c-n)),Math.round(o+i*(h-o)),a+i*(d-a));return(0,r.rgbaToString)(u)}function m(e){return d(h(e))<.5}function g(e){const t=(e=Math.round(e))%256;e-=t;const i=(e/=256)%256;e-=i;const s=(e/=256)%256;e-=s;return`rgba(${t},${i},${s},${(e/=256)/255})`}function f(e){const t=Math.round(255*e[3]);return e[0]+256*e[1]+65536*e[2]+16777216*t}function v(e){const t=(0,r.tryParseRgba)(e)
;return null===t?0:f(t)}!function(e){e[e.BgLuminanceThreshold=.5]="BgLuminanceThreshold"}(s||(s={}))},61119:(e,t,i)=>{"use strict";function s(e,t,i){return e*(1-i)+t*i}i.d(t,{doAnimate:()=>o,lerp:()=>s});const r={from:0,duration:250,easing:i(78871).easingFunc.easeOutCubic};class n{constructor(e){this._doing=!0,this._completed=!1,this._options={...r,...e};const t=performance.now();window.requestAnimationFrame((e=>{this._animation(t,this._options.from,e)}))}stop(){this._doing=!1}completed(){return this._completed}_animation(e,t,i){if(!this._doing)return void this._finishAnimation();const r=(i=!i||i<1e12?performance.now():i)-e,n=r>=this._options.duration||t===this._options.to,o=s(this._options.from,this._options.to,this._options.easing(r/this._options.duration)),a=n?this._options.to:o,l=a-t;this._options.onStep(l,a),n?this._finishAnimation():window.requestAnimationFrame((t=>{this._animation(e,a,t)}))}_finishAnimation(){this._options.onComplete&&this._options.onComplete(),this._completed=!0}}function o(e){return new n(e)}},67580:(e,t,i)=>{"use strict";i.d(t,{fetch:()=>s});(0,i(31955).getLogger)("Fetch");function s(e,t,i={}){return window.fetch(e,t)}},31955:(e,t,i)=>{"use strict";i.r(t),i.d(t,{LOGLEVEL:()=>s.LOGLEVEL,getLogHistory:()=>s.getLogHistory,getLogLevel:()=>s.getLogLevel,getLogger:()=>s.getLogger,getRawLogHistory:()=>s.getRawLogHistory,isHighRateEnabled:()=>s.isHighRateEnabled,loggingOff:()=>s.loggingOff,loggingOn:()=>s.loggingOn,serializeLogHistoryEntry:()=>s.serializeLogHistoryEntry,setLogLevel:()=>s.setLogLevel});var s=i(12168)},68979:(e,t,i)=>{"use strict";function s(e,t,i,s){return`${s?s+" ":""}${i?i+" ":""}${e}px ${t}`}i.d(t,{makeFont:()=>s,parseFont:()=>n});const r=/(bold )?(italic )?(\d+)(px|pt) (.*)$/;function n(e){const t=r.exec(e);return null===t?null:{family:t[5],size:parseInt(t[3])*("pt"===t[4]?.75:1),bold:Boolean(t[1]),italic:Boolean(t[2])}}},44843:(e,t,i)=>{"use strict";i.d(t,{visitObject:()=>n});var s=i(37265);function r(e,t,i){return(0,s.isArray)(e)?function(e,t,i){return e.map((e=>{const s=r(e,t,i),n=t(s);return void 0!==n?n:s}))}(e,t,i):(0,s.isObject)(e)&&((0,s.isHashObject)(e)||i&&i.visitInstances)?function(e,t,i){const s={};return Object.keys(e).forEach((n=>{const o=r(e[n],t,i),a=t(o);s[n]=void 0!==a?a:o})),s}(e,t,i):e}function n(e,t,i){const s=r(e,t,i),n=t(s);return void 0!==n?n:s}},18112:(e,t,i)=>{"use strict";i.d(t,{getPersistentLogger:()=>r});let s=null;function r(){return s}},66800:(e,t,i)=>{"use strict";function s(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}i.d(t,{regExpEscape:()=>s})},31599:(e,t,i)=>{"use strict";i.d(t,{rgbaFromIntegerCached:()=>o});var s=i(48874),r=i(19063),n=i(5201);function o(e=1e3){const t=s.default.Cache;s.default.Cache=n.CircularCacheBuffer.bind(n.CircularCacheBuffer,e);const i=(0,s.default)(r.rgbaFromInteger);return s.default.Cache=t,i}},63273:(e,t,i)=>{"use strict";i.r(t),i.d(t,{detectAutoDirection:()=>y,forceLTRStr:()=>h,forceLTRStrSsr:()=>d,forceRTLStr:()=>p,getLTRScrollLeft:()=>_,getLTRScrollLeftOffset:()=>m,isRtl:()=>r,startWithLTR:()=>c,
stripLTRMarks:()=>l,stripLTRStrSsr:()=>u});var s=i(64531);const r=()=>"rtl"===window.document.dir,n="‪",o="‬",a=new RegExp("‎|‪|‫|‬","g");function l(e){return""!==e&&r()&&null!=e?e.replace(a,""):e}function c(e){return""!==e&&r()&&null!=e?"‎"+e:e}function h(e){return""!==e&&r()&&null!=e?n+e+o:e}function d(e){return n+e+o}function u(e){return e.startsWith(n)&&e.endsWith(o)?e.slice(1,-1):e}function p(e){return""!==e&&r()&&null!=e?"‫"+e+o:e}function _(e){return(0,s.getNormalizedScrollLeft)(e,"rtl")}function m(e,t){const i=(0,s.detectScrollType)();if("indeterminate"===i)return 0;switch(i){case"negative":t=e.clientWidth-e.scrollWidth+t;break;case"reverse":t=e.scrollWidth-e.clientWidth-t}return t}var g;!function(e){e.LTR="ltr",e.RTL="rtl",e.UNKNOWN=""}(g||(g={}));const f=/[^\u0000-\u0040\u005B-\u0060\u007B-\u00BF\u00D7\u00F7\u02B9-\u02FF\u2000-\u200E\u2010-\u2029\u202C\u202F-\u2BFF]/,v=/[\u0590-\u07FF\u200F\u202B\u202E\uFB1D-\uFDFD\uFE70-\uFEFC]/;function y(e){const t=f.exec(e);return t?v.test(t[0])?"rtl":"ltr":""}},78871:(e,t,i)=>{"use strict";i.d(t,{CubicBezier:()=>s.CubicBezier,dur:()=>s.dur,easingFunc:()=>s.easingFunc});var s=i(74991)},86001:(e,t,i)=>{"use strict";function s(){return Promise.all([i.e(6342),i.e(3060),i.e(6246),i.e(6625),i.e(4392),i.e(7241),i.e(2227),i.e(6014),i.e(2077)]).then(i.bind(i,71090))}i.d(t,{loadChangeIntervalDialog:()=>s})},86235:(e,t,i)=>{"use strict";i.d(t,{showChangeIntervalDialogAsync:()=>n});var s=i(86001);let r=null;function n(e){const t=r=(0,s.loadChangeIntervalDialog)().then((i=>{t===r&&i.showChangeIntervalDialog(e)}));return t}},62400:(e,t,i)=>{"use strict";function s(e){return Promise.all([i.e(5683),i.e(3060),i.e(2603),i.e(7528),i.e(6246),i.e(5514),i.e(7811),i.e(412),i.e(7399),i.e(8077),i.e(6625),i.e(55),i.e(4392),i.e(6665),i.e(4447),i.e(1259),i.e(889),i.e(5883),i.e(2227),i.e(6014),i.e(361),i.e(2079),i.e(2264),i.e(7223),i.e(1859)]).then(i.bind(i,84828)).then((t=>t.showGoToDateDialog(e)))}i.d(t,{showGoToDateDialog:()=>s})},22980:(e,t,i)=>{"use strict";i.d(t,{runOrSigninWithFeature:()=>s});const s=(e,t)=>{e()};window.TradingView.runOrSigninWithFeature=s},71885:(e,t,i)=>{"use strict";i.d(t,{showTooManyStudiesNotice:()=>n});var s=i(11542),r=i(3615);function n(e){(0,r.showWarning)({title:s.t(null,void 0,i(66719)),text:s.t(null,{replace:{number:`${e}`}},i(86146))})}},4454:(e,t,i)=>{"use strict";i.d(t,{getAdditionalSymbolInfoFields:()=>n,setAdditionalSymbolInfoFields:()=>r});let s=[];function r(e){s=e}function n(){return s}},80387:(e,t,i)=>{"use strict";function s(e){Promise.all([i.e(8622),i.e(3060),i.e(7528),i.e(6246),i.e(7811),i.e(412),i.e(7125),i.e(9486),i.e(3547),i.e(2950),i.e(2227),i.e(6014),i.e(5715),i.e(9374)]).then(i.bind(i,11095)).then((({SymbolInfoDialogImpl:t})=>{t.getInstance().show(e)}))}i.d(t,{showSymbolInfoDialog:()=>s})},28153:(e,t,i)=>{"use strict";i.d(t,{ChartSaverBase:()=>u});var s=i(16230),r=i(50151),n=(i(11542),i(97990)),o=i(23024),a=i(37265),l=i(52033),c=i(56570),h=i(39076);function d(e,t){e.content=JSON.stringify(t)}new WeakMap;new TextEncoder;class u{constructor(e){
this._prevChartState=null,this._chartSavedDelegate=new l.Delegate,this._chartAboutToBeSavedDelegate=new l.Delegate,this._chartSizeLimitExceededDelegate=new l.Delegate,this._isSaveInProcess=!1,this._savingToken=null,this._chartWidgetCollection=e}async saveChartLineTools(e,t,s,r){if(c.enabled("saveload_separate_drawings_storage")){const n=await(0,o.getChartStorage)(),a=this._chartWidgetCollection.metaInfo.uid.value(),l=i=>n.saveLineToolsAndGroups(i,e,t,s,r);if(!a){this._chartSavedDelegate.subscribe(null,(e=>{if(e){const e=this._chartWidgetCollection.metaInfo.uid.value();l(e)}}),!0);const{SavingLineToolsLibraryError:e}=await i.e(5565).then(i.bind(i,98653));throw new e("Layout ID not yet created.",!0)}return l(a)}return Promise.reject("Line tools storage is not supported")}layoutId(){return this._chartWidgetCollection.metaInfo.uid.value()}saveChartSilently(e,t,i){const s=i||{};this._isSaveInProcess=!0,this._chartAboutToBeSavedDelegate.fire(),this._saveChart((e=>{const t=e&&c.enabled("saveload_separate_drawings_storage"),i=this._getChartWidgetCollectionState(!1,void 0,void 0,void 0,t),r=this._getCommonSavingInfo(!1);return d(r,i),s.chartName&&(r.name=s.chartName),r.name&&0!==r.name.length||!s.defaultChartName||(r.name=s.defaultChartName),s.autoSave&&(r.autoSave=!0),r}),((t,i)=>{var s;(0,r.assert)(!this._chartWidgetCollection.readOnly(),"Trying to save layout in read-only mode"),i&&this._chartWidgetCollection.metaInfo.name.setValue(null!==(s=i.name)&&void 0!==s?s:""),this._prevChartState=i,this._chartSavedDelegate.fire(!0),this._isSaveInProcess=!1,e&&e({uid:t.uid.value(),data:i}),this._prevChartState&&delete this._prevChartState.savingToken}),(e=>{this._chartSavedDelegate.fire(!1),this._isSaveInProcess=!1,t&&t(e)}),s)}saveToJSON(e){const t=e&&!1===e.includeDrawings||void 0,i=this._getCommonSavingInfo(!1);return d(i,this._getChartWidgetCollectionState(!1,!0,t,void 0,t)),i}isSaveInProcess(){return this._isSaveInProcess}_getChartWidgetCollectionState(e,t,i,s,r){return e||(t=!0,s=!1),this._chartWidgetCollection.state(!!e,!!i,!!s,r,!t)}_getCommonSavingInfo(e){const t=this._chartWidgetCollection,i=this._chartWidgetCollection.chartsSymbols(),s=i[t.activeChartWidget.value().id()],r={...(n=s,{...n,legs:JSON.stringify(null!==(o=n.legs)&&void 0!==o?o:[])})};var n,o;const a=t.metaInfo,l=a.id.value();return null!==l&&(r.id=l),r.name=a.name.value()||"",r.description=a.description.value()||"",r.charts_symbols=function(e){const t={};for(const i of Object.keys(e))t[i]={symbol:e[i].symbol};return JSON.stringify(t)}(i),r.is_realtime=r.is_realtime=e?"0":"1",r}async _saveLineToolsToStorage(){if(!c.enabled("saveload_separate_drawings_storage"))return Promise.resolve();{this.layoutId();0;const e=this._chartWidgetCollection.getAll().map((e=>{var t,i;return null!==(i=null===(t=e.lineToolsSynchronizer())||void 0===t?void 0:t.flushPendingSavings())&&void 0!==i?i:null})).filter(a.notNull);e.length&&await Promise.all(e)}}_invalidateAllLineTools(){this._chartWidgetCollection.getAll().forEach((e=>{var t
;return null===(t=e.lineToolsSynchronizer())||void 0===t?void 0:t.invalidateAll()}))}_saveChartImpl(e,t,i,s,r,n){let o;o=s=>{t.id.value()||(t.id.setValue(s.result),t.uid.setValue(`${s.result}`)),i(t,e)},e.name?h.backend.saveChart(e.name,e.short_name,e.resolution,e,t).then(o).catch((async e=>{var t,i;const r=e instanceof Response?e:void 0,n=e instanceof Error?e:void 0;this._savingToken=null;const o=s.bind(null,{status:null==r?void 0:r.status,message:null!==(i=null!==(t=null==r?void 0:r.statusText)&&void 0!==t?t:null==n?void 0:n.message)&&void 0!==i?i:"Unknown error"});o()})):s({status:-1,message:"Saving chart with empty name is not allowed"})}async _saveChart(e,t,r,o){var a;const l=this._chartWidgetCollection.metaInfo;let h=null!==(a=o.changes)&&void 0!==a?a:n.changedAll;c.enabled("saveload_separate_drawings_storage")&&this._invalidateAllLineTools();let d=!0;if(2&h||c.enabled("saveload_separate_drawings_storage"))try{await this._saveLineToolsToStorage()}catch(e){h|=1;const{SavingLineToolsLibraryError:t}=await i.e(5565).then(i.bind(i,98653));e instanceof t&&e.safe||(d=!1)}if(1&h){const i=e(d);if((0,s.default)(this._prevChartState,i)&&null!==l.id.value())return this._chartSavedDelegate.fire(!0),void t(l,i);0;const n=(e,i)=>(d||this._chartWidgetCollection.getAll().forEach((e=>{var t;return null===(t=e.lineToolsSynchronizer())||void 0===t?void 0:t.markAsValidatedBecauseOfSavingToContent(!0)})),t(e,i));return this._saveChartImpl(i,l,n,r,o,e)}this._chartSavedDelegate.fire(!0),t(l,e(d))}}},97488:(e,t,i)=>{"use strict";var s=i(28153).ChartSaverBase;i.i18next(null,void 0,i(49947));t.ChartSaver=class extends s{constructor(e){super(e)}chartSizeLimitExceeded(){return this._chartSizeLimitExceededDelegate}chartAboutToBeSaved(){return this._chartAboutToBeSavedDelegate}chartSaved(){return this._chartSavedDelegate}publishChart(e){}publishScript(e,t,i){}isScriptNameValid(e){return""!==e.trim()&&e.length<=64}isScriptDescriptionValid(e){return""!==e.trim()&&e.length<=7e4}isScriptDescribersValid(e,t){return this.isScriptNameValid(e)&&this.isScriptDescriptionValid(t)}openInNewTab(e,t,i){e.publishInProgress=!0,i||this.isScriptDescribersValid(t.name,t.description)&&undefined(new Promise((function(t){e.setPopupUrl=t})))}onPublish(e,t){}}},22365:(e,t,i)=>{"use strict";i.d(t,{getTranslatedSymbolDescription:()=>s});i(11542);function s(e){return e.description||""}},34585:(e,t,i)=>{"use strict";function s(e){return e+"…"}i.d(t,{appendEllipsis:()=>s})},14051:(e,t,i)=>{"use strict";function s(e){if(!o(e))throw e}function r(e){return(null==e?void 0:e.aborted)?Promise.reject(n()):new Promise(((t,i)=>{null==e||e.addEventListener("abort",(()=>i(n())),{once:!0})}))}function n(){return new DOMException("Aborted","AbortError")}function o(e){return e instanceof Error&&"AbortError"===e.name}function a(e,t){return Promise.race([r(e),t])}async function l(e,t){let i;try{await a(e,new Promise((e=>{i=setTimeout(e,t)})))}finally{clearTimeout(i)}}i.d(t,{delay:()=>l,isAbortError:()=>o,respectAbort:()=>a,skipAbortError:()=>s})},18832:(e,t,i)=>{"use strict"
;function s(e){let t;if("object"!=typeof e||null==e||"number"==typeof e.nodeType)t=e;else if(e instanceof Date)t=new Date(e.valueOf());else if(Array.isArray(e)){t=[];let i=0;const r=e.length;for(;i<r;i++)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=s(e[i]))}else{t={};for(const i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=s(e[i]))}return t}i.d(t,{deepCopy:()=>s})},31054:(e,t,i)=>{"use strict";function s(e,...t){return e&&"object"==typeof e?(0===t.length||t.forEach((t=>{null!=t&&"object"==typeof t&&Object.keys(t).forEach((i=>{const n=e[i],o=t[i];if(o===e)return;const a=Array.isArray(o);if(o&&(r(o)||a)){let t;t=a?n&&Array.isArray(n)?n:[]:n&&r(n)?n:{},e[i]=s(t,o)}else void 0!==o&&(e[i]=o)}))})),e):e}function r(e){if(!e||"[object Object]"!==Object.prototype.toString.call(e))return!1;const t=Object.getPrototypeOf(e);if(!t)return!0;const i=Object.hasOwnProperty.toString,s=t.hasOwnProperty("constructor")&&t.constructor;return"function"==typeof s&&i.call(s)===i.call(Object)}i.d(t,{deepExtend:()=>s})},14426:(e,t,i)=>{"use strict";function s(){let e,t;return{promise:new Promise(((i,s)=>{e=i,t=s})),reject:t,resolve:e}}i.d(t,{createDeferredPromise:()=>s})},14712:(e,t,i)=>{"use strict";function s(e){if(void 0===e)return"";if(e instanceof Error){let t=e.message;return e.stack&&(t+=" "+e.stack),t}return"string"==typeof e?e.toString():JSON.stringify(e)}i.d(t,{errorToString:()=>s})},19365:(e,t,i)=>{"use strict";i.d(t,{getTwemojiUrl:()=>r});var s=i(18438);function r(e,t){let i="";return s.default.parse(e,(e=>(i=s.default.base+("svg"===t?`svg/${e}.svg`:`72x72/${e}.png`),!1))),i}s.default.base="https://cdnjs.cloudflare.com/ajax/libs/twemoji/13.0.1/"},92184:(e,t,i)=>{"use strict";i.r(t),i.d(t,{guid:()=>r,randomHash:()=>n,randomHashN:()=>o});const s="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function r(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{const t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))}function n(){return o(12)}function o(e){let t="";for(let i=0;i<e;++i){const e=Math.floor(Math.random()*s.length);t+=s[e]}return t}},49481:(e,t,i)=>{"use strict";i.d(t,{parseHtml:()=>n,parseHtmlElement:()=>o});const s=new WeakMap;var r;function n(e,t){let i,r;return i=null==t?document.documentElement:9===t.nodeType?t.documentElement:t,s&&(r=s.get(i)),r||(r=i.ownerDocument.createRange(),r.selectNodeContents(i),s&&s.set(i,r)),r.createContextualFragment(e)}function o(e,t){const i=n(e,t),s=i.firstElementChild;return null!==s&&i.removeChild(s),s}!function(e){e[e.Element=1]="Element",e[e.Document=9]="Document"}(r||(r={}))},14729:(e,t,i)=>{"use strict";function s(e){e.preventDefault()}i.d(t,{preventDefault:()=>s,preventDefaultForContextMenu:()=>n});const r=["input:not([type])",'input[type="text"]','input[type="email"]','input[type="password"]','input[type="search"]','input[type="number"]','input[type="url"]',"textarea","a[href]",'*[contenteditable="true"]',"[data-allow-context-menu]"];function n(e){const t=e.target;t&&!t.closest(r.join(", "))&&e.preventDefault()}},49406:(e,t,i)=>{
"use strict";i.d(t,{capitalizeFirstLetterInWord:()=>u,decodeHTMLEntities:()=>l,getFirstSegmentOrCodePointString:()=>p,htmlEscape:()=>c,removeSpaces:()=>d,removeTags:()=>h});const s=/[<"'&>]/g,r=e=>`&#${e.charCodeAt(0)};`,n={"&lt;":"<","&gt;":">","&quot;":'"',"&apos;":"'","&amp;":"&","&#60;":"<","&#62;":">","&#34;":'"',"&#39;":"'","&#039;":"'","&#38;":"&"},o=Object.assign({},...Object.entries(n).map((([e,t])=>({[t]:e})))),a=new RegExp(Object.keys(n).join("|"),"g");new RegExp(Object.keys(o).join("|"),"g");function l(e){return e.replace(a,(e=>n[e]||e))}function c(e){return e.replace(s,r)}function h(e=""){return e.replace(/(<([^>]+)>)/gi,"")}function d(e=""){return e.replace(/\s+/g,"")}function u(e=""){return e.replace(/\b\w/g,(e=>e.toUpperCase()))}function p(e){var t;const i=Intl.Segmenter;if(i){const s=new i(void 0,{granularity:"grapheme"}),[{segment:r}={segment:null}]=s.segment(e);return null!==(t=null==r?void 0:r.toUpperCase())&&void 0!==t?t:null}{const t=e.codePointAt(0);return t?String.fromCodePoint(t).toUpperCase():null}}},97144:(e,t,i)=>{"use strict";function s(e){return e.reduce((function(e,t,i){return~e.indexOf(t)||e.push(t),e}),[])}i.r(t),i.d(t,{uniq:()=>s})},34369:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28" fill="currentColor"><path fill-rule="evenodd" d="M18 14a4 4 0 1 1-8 0 4 4 0 0 1 8 0Zm-1 0a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"/><path fill-rule="evenodd" d="M8.5 5h11l5 9-5 9h-11l-5-9 5-9Zm-3.86 9L9.1 6h9.82l4.45 8-4.45 8H9.1l-4.45-8Z"/></svg>'},93544:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path fill="currentColor" d="M18 7h5v1h-2.01l-1.33 14.64a1.5 1.5 0 0 1-1.5 1.36H9.84a1.5 1.5 0 0 1-1.49-1.36L7.01 8H5V7h5V6c0-1.1.9-2 2-2h4a2 2 0 0 1 2 2v1Zm-6-2a1 1 0 0 0-1 1v1h6V6a1 1 0 0 0-1-1h-4ZM8.02 8l1.32 14.54a.5.5 0 0 0 .5.46h8.33a.5.5 0 0 0 .5-.46L19.99 8H8.02Z"/></svg>'},50946:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22 19" width="22" height="19"><path fill="#ffffff" d="M9 4H0v4h5v7h4V4Zm8 11h-5l4.5-11h5L17 15Zm-5-7a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z"/></svg>'},70893:e=>{
e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="28 0 136 19" width="136" height="19"><path fill="#ffffff" d="M28.52 9.03c0 2.84 2.3 5.14 5.14 5.14a5.12 5.12 0 0 0 4.59-2.65l-1.77-.98a3.14 3.14 0 0 1-5.92-1.51 3.14 3.14 0 0 1 5.92-1.51l1.77-.98a5.12 5.12 0 0 0-4.6-2.65 5.13 5.13 0 0 0-5.13 5.14ZM39.05 14h1.91v-3.42c0-1.34.68-1.98 1.56-1.98.8 0 1.23.61 1.23 1.62V14h1.92V9.9c0-1.82-1.01-3.05-2.7-3.05-.91 0-1.64.39-2 .95V3.5h-1.92V14Zm7.51-3.5c0 1.99 1.43 3.65 3.29 3.65.96 0 1.7-.49 2.01-.93V14h1.92V7h-1.92v.78a2.5 2.5 0 0 0-2.01-.93c-1.86 0-3.3 1.66-3.3 3.65Zm5.46 0c0 1.1-.72 1.9-1.77 1.9s-1.76-.8-1.76-1.9c0-1.1.71-1.9 1.76-1.9s1.77.8 1.77 1.9Zm3.21 3.5h1.91v-3.35c0-1.14.6-1.86 1.52-1.86.3 0 .57.06.86.16V7a2.2 2.2 0 0 0-.64-.08c-.78 0-1.5.51-1.74 1.2V7h-1.91v7Zm9.71-.07v-1.7a2.2 2.2 0 0 1-.79.13c-.82 0-1.19-.33-1.19-1.19V8.68h1.98V7h-1.98V5.05h-1.92V7h-1.41v1.68h1.41v2.87c0 1.7 1.2 2.53 2.68 2.53a4 4 0 0 0 1.22-.15Zm5.63-.71c.32.44 1.06.93 2.03.93 1.86 0 3.29-1.66 3.29-3.65s-1.43-3.65-3.3-3.65c-.96 0-1.7.49-2.02.93V3.5h-1.92V14h1.92v-.78Zm3.37-2.72c0 1.1-.71 1.9-1.76 1.9s-1.77-.8-1.77-1.9c0-1.1.72-1.9 1.77-1.9s1.76.8 1.76 1.9Zm5.39 6.43L83.73 7H81.6l-1.86 4.54L77.87 7h-2.1l2.94 6.6-1.47 3.33h2.09ZM88.27 14h2.05V6h2.67V4.05h-7.36v1.93h2.64V14Zm4.44 0h1.92v-3.35c0-1.14.6-1.86 1.51-1.86.31 0 .58.06.87.16V7a2.2 2.2 0 0 0-.64-.08c-.79 0-1.5.51-1.74 1.2V7h-1.92v7Zm4.41-3.5c0 1.99 1.43 3.65 3.3 3.65.96 0 1.7-.49 2.01-.93V14h1.92V7h-1.92v.78a2.5 2.5 0 0 0-2.02-.93c-1.86 0-3.29 1.66-3.29 3.65Zm5.46 0c0 1.1-.71 1.9-1.76 1.9s-1.76-.8-1.76-1.9c0-1.1.71-1.9 1.76-1.9s1.76.8 1.76 1.9Zm2.76 0c0 1.99 1.43 3.65 3.3 3.65.96 0 1.7-.49 2.01-.93V14h1.92V3.5h-1.92v4.28a2.5 2.5 0 0 0-2.02-.93c-1.86 0-3.29 1.66-3.29 3.65Zm5.46 0c0 1.1-.71 1.9-1.76 1.9s-1.76-.8-1.76-1.9c0-1.1.71-1.9 1.76-1.9s1.76.8 1.76 1.9Zm5.4-5.87c0-.67-.55-1.21-1.23-1.21-.66 0-1.22.54-1.22 1.21a1.23 1.23 0 0 0 2.45 0ZM114 14h1.92V7H114v7Zm3.35 0h1.92v-3.42c0-1.34.67-1.98 1.56-1.98.8 0 1.23.61 1.23 1.62V14h1.91V9.9c0-1.82-1-3.05-2.7-3.05-.9 0-1.63.39-2 .95V7h-1.92v7Zm14.77-.55V7h-1.92v.78a2.48 2.48 0 0 0-2.03-.93c-1.82 0-3.3 1.56-3.3 3.54 0 1.96 1.48 3.53 3.3 3.53.9 0 1.67-.41 2.03-.93v.48c0 1.12-.74 1.92-1.88 1.92-.77 0-1.56-.28-2.18-.87l-1.05 1.43c.8.75 2.06 1.12 3.26 1.12 2.14 0 3.77-1.08 3.77-3.62Zm-5.32-3.06c0-1.08.81-1.8 1.78-1.8.96 0 1.77.72 1.77 1.8 0 1.06-.8 1.79-1.77 1.79s-1.78-.73-1.78-1.8Zm9.1 3.61h1.8l4.12-9.94h-2.25l-2.77 6.9-2.81-6.9h-2.2l4.1 9.94Zm8.63-9.37c0-.67-.55-1.21-1.24-1.21-.65 0-1.21.54-1.21 1.21a1.23 1.23 0 0 0 2.45 0ZM142.34 14h1.92V7h-1.92v7Zm2.89-3.5c0 2.21 1.63 3.65 3.71 3.65 1.47 0 2.6-.63 3.25-1.56l-1.43-1.07c-.3.48-.93.88-1.8.88-.93 0-1.75-.51-1.86-1.45h5.23c.03-.3.03-.5.03-.66 0-2.27-1.61-3.44-3.44-3.44a3.58 3.58 0 0 0-3.69 3.65Zm3.63-2.07c.71 0 1.41.39 1.58 1.22h-3.27c.18-.86.98-1.22 1.69-1.22ZM159.27 14h1.9l2.31-7h-2.06l-1.31 4.48L158.68 7h-1.47l-1.42 4.48L154.46 7h-2.04l2.32 7h1.9l1.31-3.99 1.32 3.99Z"/></svg>'},1457:e=>{
e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28"><g fill="none" fill-rule="evenodd" stroke="currentColor"><path d="M13.111 18.5H10.5a1 1 0 0 1-1-1v-11a1 1 0 0 1 1-1h11a1 1 0 0 1 1 1v11a1 1 0 0 1-1 1h-8.389z"/><path d="M18.5 20v1.5a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1v-11a1 1 0 0 1 1-1H8"/></g></svg>'},55824:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 7 5" width="7" height="5" fill="none"><path stroke="currentColor" stroke-width="1.2" d="M1 1.5l2.5 2 2.5-2"/></svg>'},37924:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28"><g fill="none" fill-rule="evenodd" transform="translate(4 5)"><circle stroke="currentColor" cx="9.5" cy="9.5" r="9"/><path stroke="currentColor" d="M7 14.5h2.5v-5H7"/><path stroke="currentColor" stroke-linecap="square" d="M9.5 14.5h2"/><path fill="currentColor" d="M9.5 7a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3z"/></g></svg>'},99875:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 18 18" width="18" height="18"><path fill="backgroundColor" d="M5 7V6a4 4 0 1 1 8 0v1a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9c0-1.1.9-2 2-2Z"/><path fill="lineColor" fill-rule="evenodd" d="M9 3a3 3 0 0 0-3 3v1h6V6a3 3 0 0 0-3-3ZM5 6v1a2 2 0 0 0-2 2v5c0 1.1.9 2 2 2h8a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2V6a4 4 0 0 0-8 0Zm0 2a1 1 0 0 0-1 1v5a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V9a1 1 0 0 0-1-1H5Zm4 2a1 1 0 0 0-1 1v1a1 1 0 1 0 2 0v-1a1 1 0 0 0-1-1Z"/></svg>'},2872:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28"><g fill="none" fill-rule="evenodd" stroke="currentColor" transform="translate(6 3)"><rect width="15" height="12" rx="2" x=".5" y="8.5"/><path stroke-linecap="round" stroke-width="2" d="M8 15v2"/><path d="M11.5 4a3.5 3.5 0 0 0-7 0v4.5"/></g></svg>'},7983:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 15 13" width="15" height="13"><path fill="currentColor" fill-rule="evenodd" d="M4.1 1 1.14 6.5 4.1 12h6.8l2.96-5.5L10.9 1H4.1ZM15 6.5 11.5 0h-8L0 6.5 3.5 13h8L15 6.5ZM7.5 8a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3Zm0 1a2.5 2.5 0 1 0 0-5 2.5 2.5 0 0 0 0 5Z"/></svg>'},39267:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28"><g fill="none" fill-rule="evenodd" stroke="currentColor"><path d="M6.5 15A8.5 8.5 0 1 0 15 6.5H8.5"/><path d="M12 10L8.5 6.5 12 3"/></g></svg>'},16911:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28"><g fill="none" fill-rule="evenodd" stroke="currentColor" transform="translate(3 6)"><path d="M.964 8C3 4 6.679.5 11 .5 15.32.5 19 4 21.036 8 19 12 15.32 15.5 11 15.5 6.679 15.5 3 12 .964 8z"/><circle cx="11" cy="8" r="3.5"/></g></svg>'},6862:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28"><g fill="none" fill-rule="evenodd" stroke="currentColor"><path stroke-linecap="square" d="M11.5 21.5v-7m3 7v-5m3 5v-3m-9 3v-5"/><path d="M5.5 22v-3"/><path stroke-linecap="square" d="M5.5 13.5l4.297-4.297a2.406 2.406 0 0 1 3.406 0l2.594 2.594c.94.94 2.463.943 3.406 0L23.5 7.5M22.5 12.5v6m-3-3h6"/></g></svg>'},54190:e=>{
e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28"><path fill="none" fill-rule="evenodd" stroke="currentColor" stroke-linecap="square" d="M6.145 11.968L14 5.5l7.855 6.468a.3.3 0 0 1-.191.532H6.336a.3.3 0 0 1-.19-.532zm0 4.064L14 22.5l7.855-6.468a.3.3 0 0 0-.191-.532H6.336a.3.3 0 0 0-.19.532z"/></svg>'},25191:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28"><g fill="none" fill-rule="evenodd" transform="translate(4 5)"><path fill="currentColor" d="M3 1h1v13.5H3z"/><circle stroke="currentColor" cx="3.5" cy="16.5" r="2"/><path fill="currentColor" d="M5.5 16H18v1H5.5z"/><path stroke="currentColor" d="M0 4L3.5.5 7 4m8 9l3.5 3.5L15 20"/></g></svg>'},93379:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><g fill="currentColor" fill-rule="nonzero"><path d="M4 15h8.5v-1h-8.5zM16.5 15h8.5v-1h-8.5z"/><path d="M14.5 16c.828 0 1.5-.672 1.5-1.5s-.672-1.5-1.5-1.5-1.5.672-1.5 1.5.672 1.5 1.5 1.5zm0 1c-1.381 0-2.5-1.119-2.5-2.5s1.119-2.5 2.5-2.5 2.5 1.119 2.5 2.5-1.119 2.5-2.5 2.5z"/></g></svg>'},84959:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28"><path fill="currentColor" d="M18.15 7.02A9.05 9.05 0 0014 6c-3.45 0-6.08 2-7.8 3.92a18.18 18.18 0 00-2.64 3.84v.02h-.01L4 14l-.45-.21-.1.21.1.21L4 14l-.45.21.01.03a5.85 5.85 0 00.16.32c.11.2.28.51.5.87a18.18 18.18 0 002.4 3.12l.71-.71A17.18 17.18 0 014.56 14a10.05 10.05 0 01.52-.91c.41-.69 1.04-1.6 1.85-2.5C8.58 8.75 10.95 7 14 7a8 8 0 013.4.77l.75-.75zm-3.11 3.12a4 4 0 00-4.9 4.9l.86-.87V14a3 3 0 013.17-3l.87-.86zm1.96 3.7l.86-.88a4 4 0 01-4.9 4.9l.87-.86A3 3 0 0017 13.83zm-6.4 6.4A8 8 0 0014 21c3.05 0 5.42-1.76 7.07-3.58A17.18 17.18 0 0023.44 14a9.47 9.47 0 00-.52-.91 17.18 17.18 0 00-2.25-2.93l.7-.7a18.18 18.18 0 013.06 4.3l.02.02L24 14l.45.21-.01.03a7.03 7.03 0 01-.16.32c-.11.2-.28.51-.5.87-.44.72-1.1 1.69-1.97 2.65C20.08 20.01 17.45 22 14 22c-1.55 0-2.94-.4-4.15-1.02l.75-.75zM24 14l.45-.21.1.21-.1.21L24 14zM22.2 6.5L6.5 22.2l-.7-.7L21.5 5.8l.7.7z"/></svg>'},97874:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" width="28" height="28"><g fill="none" fill-rule="evenodd" stroke="currentColor" transform="translate(6 4)"><rect width="15" height="12" rx="2" x=".5" y="7.5"/><path stroke-linecap="round" stroke-width="2" d="M8 14v2"/><path d="M11.5 7.5V4a3.5 3.5 0 0 0-7 0v3.5"/></g></svg>'},77067:e=>{e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" width="28" height="28"><path fill="currentColor" d="M13.39 3.84a1 1 0 0 1 1.22 0l8.19 6.37a1 1 0 0 1 0 1.58l-8.19 6.37a1 1 0 0 1-1.22 0L5.2 11.79a1 1 0 0 1 0-1.58l8.19-6.37zm.61.8L5.81 11 14 17.37 22.19 11 14 4.63zM5.3 13.6l8.7 6.76 8.7-6.76.6.78-8.69 6.77a1 1 0 0 1-1.22 0l-8.7-6.77.62-.78zm8.09 10.55l-8.7-6.77.62-.78L14 23.37l8.7-6.76.6.78-8.69 6.77a1 1 0 0 1-1.22 0z"/></svg>'},76351:e=>{
e.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 36 28" width="36" height="28"><path fill="currentColor" d="M14 22H7V11H0V4h14v18zM28 22h-8l7.5-18h8L28 22z"/><circle fill="currentColor" cx="20" cy="8" r="4"/></svg>'},87489:e=>{"use strict";e.exports=JSON.parse('{"4":["v",["h",0,2],["h",1,3]],"6":["v",["h",0,2,4],["h",1,3,5]],"8":["v",["h",0,2,4,6],["h",1,3,5,7]],"2h":["h",0,1],"2v":["v",0,1],"2-1":["v",["h",0,2],1],"3s":["h",0,["v",1,2]],"3h":["h",0,1,2],"3v":["v",0,1,2],"1-2":["v",0,["h",1,2]],"3r":["h",["v",0,1],2],"4h":["h",0,1,2,3],"4v":["v",0,1,2,3],"4s":["h",0,["v",1,2,3]],"4s-l":["h",["v",1,2,3],0],"5h":["h",0,1,2,3,4],"5v":["v",0,1,2,3,4],"6h":["h",0,1,2,3,4,5],"6v":["v",0,1,2,3,4,5],"7h":["h",0,1,2,3,4,5,6],"8h":["h",0,1,2,3,4,5,6,7],"8v":["v",0,1,2,3,4,5,6,7],"9h":["h",0,1,2,3,4,5,6,7,8],"9v":["v",0,1,2,3,4,5,6,7,8],"10h":["h",0,1,2,3,4,5,6,7,8,9],"10v":["v",0,1,2,3,4,5,6,7,8,9],"1-3":["v",0,["h",1,2,3]],"2-2":["v",["h",0,1],["v",2,3]],"2-2-l":["h",0,1,["v",2,3]],"2-3":["v",["h",0,1],["h",2,3,4]],"3-2":["v",["h",0,1,2],["h",3,4]],"1-4":["v",0,["h",1,2,3,4]],"2-4":["v",["h",0,1],["h",2,3,4,5]],"5s":["h",0,["v",1,2,3,4]],"6c":["v",["h",0,1],["h",2,3],["h",4,5]],"8c":["v",["h",0,1],["h",2,3],["h",4,5],["h",6,7]],"9s":["v",["h",0,1,2],["h",3,4,5],["h",6,7,8]],"10c5":["v",["h",0,2,4,6,8],["h",1,3,5,7,9]],"12c6":["v",["h",0,2,4,6,8,10],["h",1,3,5,7,9,11]],"12c4":["v",["h",0,4,8],["h",1,5,9],["h",2,6,10],["h",3,7,11]],"14c7":["v",["h",0,2,4,6,8,10,12],["h",1,3,5,7,9,11,13]],"16c8":["v",["h",0,2,4,6,8,10,12,14],["h",1,3,5,7,9,11,13,15]],"16c4":["v",["h",0,4,8,12],["h",1,5,9,13],["h",2,6,10,14],["h",3,7,11,15]],"s":0}')},23420:e=>{"use strict"
;e.exports=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-50":"#E0F7FA","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"}')
},20913:e=>{"use strict"
;e.exports=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-delisted-symbol":"color-ripe-red-600","color-delisted-symbol-hover":"color-ripe-red-800","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"}')
},579:e=>{"use strict"
;e.exports=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-delisted-symbol":"color-ripe-red-600","color-delisted-symbol-hover":"color-ripe-red-800","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"}')
}},e=>{e.O(0,[4026,9662,7346],(()=>{return t=60588,e(e.s=t);var t}));e.O()}]);