1import{H as e,K as t,M as n,W as r,_ as i,c as a,ct as o,dt as s,h as c,l,ot as u,rt as d,s as f}from"./runtime-core.esm-bundler-BwUoGYLm.js";import{t as p}from"./createLucideIcon-B5EzIyVn.js";import{t as m}from"./_plugin-vue_export-helper-MKWkbUHw.js";import{t as h}from"./Button-B71PyYoR.js";import{a as ee,u as te}from"./Card-ThUQg7aB.js";import{t as ne}from"./Modal-BDeXjb8o.js";import{n as re}from"./UseTheme-BLdlevKC.js";import{t as ie}from"./Object-BhRCpeD5.js";var ae=p(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),g=p(`maximize`,[[`path`,{d:`M8 3H5a2 2 0 0 0-2 2v3`,key:`1dcmit`}],[`path`,{d:`M21 8V5a2 2 0 0 0-2-2h-3`,key:`1e4gt3`}],[`path`,{d:`M3 16v3a2 2 0 0 0 2 2h3`,key:`wsl5sc`}],[`path`,{d:`M16 21h3a2 2 0 0 0 2-2v-3`,key:`18trek`}]]),oe=p(`minimize`,[[`path`,{d:`M8 3v3a2 2 0 0 1-2 2H3`,key:`hohbtr`}],[`path`,{d:`M21 8h-3a2 2 0 0 1-2-2V3`,key:`5jw1f3`}],[`path`,{d:`M3 16h3a2 2 0 0 1 2 2v3`,key:`198tvr`}],[`path`,{d:`M16 21v-3a2 2 0 0 1 2-2h3`,key:`ph8mxp`}]]),se={ref:`modal`,class:`fullscreen-content`},ce=m(i({__name:`ModalFullscreen`,props:{target:{}},emits:[`enterBefore`,`enter`,`exitBefore`,`exit`],setup(i,{emit:o}){let s=o,c=e(`modal`),u=null,d=null;r(c,(e,t)=>{i.target&&(e?f(i.target,e):t&&u&&p(i.target,u,t))});function f(e,t){u=e.parentNode,d=e.nextSibling,u&&(s(`enterBefore`,t),u.removeChild(e),t.appendChild(e),s(`enter`,t))}function p(e,t,n){s(`exitBefore`,n),n.removeChild(e),d?t.insertBefore(e,d):t.appendChild(e),s(`exit`,n)}return(e,r)=>{let i=ne;return n(),l(i,null,{default:t(()=>[a(`div`,se,null,512)]),_:1})}}}),[[`__scopeId`,`data-v-78aed11f`]]),le=i({__name:`BtnChartLWFullscreen`,props:{chart:{},target:{default:null}},setup(e){let r=d(!1),i=0,a=0;function o(){let t=e.chart.chartElement().parentElement;i=t?.clientHeight??0,a=t?.clientWidth??0}function u(){e.chart.applyOptions({height:i,width:a})}return(i,a)=>{let d=g,f=oe,p=ce,m=h;return n(),l(m,{disabled:!e.chart,onClick:a[1]||=e=>r.value=!s(r)},{default:t(()=>[s(r)?(n(),l(f,{key:1})):(n(),l(d,{key:0})),c(p,{target:e.target?.$el,show:s(r),onClose:a[0]||=e=>r.value=!1,onEnterBefore:o,onExit:u},null,8,[`target`,`show`])]),_:1},8,[`disabled`])}}}),ue=i({__name:`BtnChartLWExport`,props:{filename:{},series:{}},setup(e){function r(e){if(typeof e==`number`)return e;if(typeof e==`string`)return Math.floor(new Date(e).getTime()/1e3);if(typeof e==`object`&&`year`in e){let{year:t,month:n,day:r}=e;return Math.floor(new Date(t,n-1,r).getTime()/1e3)}throw Error(`Invalid time format`)}function i(e){return Object.entries(e).map(([e,t])=>({column:e,data:(t?.data()??[]).map(e=>({time:r(e.time),value:`value`in e?e.value:0}))}))}function a(){let t=i(e.series),n=t.flatMap(e=>e.data.map(t=>({column:e.column,data:t}))).groupBy(e=>e.data.time).entries().orderBy(([e])=>Number(e)).map(([e,t])=>`${e};${t.orderBy(e=>e.column).map(e=>e.data.value).join(`;`)}`),r=[`time;`+t.map(e=>e.column).orderBy(e=>e).join(`;`),...n].join(` 2`),a=new Blob([r],{type:`text/csv;charset=utf-8`}),o=URL.createObjectURL(a),s=document.createElement(`a`);s.href=o,s.download=`${e.filename}.csv`,s.style.display=`none`,document.body.appendChild(s),s.click(),document.body.removeChild(s),URL.revokeObjectURL(o)}return(e,r)=>{let i=ae,o=h;return n(),l(o,{onClick:a},{default:t(()=>[c(i)]),_:1})}}});function _(e){var t=e.width,n=e.height;if(t<0)throw Error(`Negative width is not allowed for Size`);if(n<0)throw Error(`Negative height is not allowed for Size`);return{width:t,height:n}}function v(e,t){return e.width===t.width&&e.height===t.height}var y=function(){function e(e){var t=this;this._resolutionListener=function(){return t._onResolutionChanged()},this._resolutionMediaQueryList=null,this._observers=[],this._window=e,this._installResolutionListener()}return e.prototype.dispose=function(){this._uninstallResolutionListener(),this._window=null},Object.defineProperty(e.prototype,`value`,{get:function(){return this._window.devicePixelRatio},enumerable:!1,configurable:!0}),e.prototype.subscribe=function(e){var t=this,n={next:e};return this._observers.push(n),{unsubscribe:function(){t._observers=t._observers.filter(function(e){return e!==n})}}},e.prototype._installResolutionListener=function(){if(this._resolutionMediaQueryList!==null)throw Error(`Resolution listener is already installed`);var e=this._window.devicePixelRatio;this._resolutionMediaQueryList=this._window.matchMedia(`all and (resolution: ${e}dppx)`),this._resolutionMediaQueryList.addListener(this._resolutionListener)},e.prototype._uninstallResolutionListener=function(){this._resolutionMediaQueryList!==null&&(this._resolutionMediaQueryList.removeListener(this._resolutionListener),this._resolutionMediaQueryList=null)},e.prototype._reinstallResolutionListener=function(){this._uninstallResolutionListener(),this._installResolutionListener()},e.prototype._onResolutionChanged=function(){var e=this;
2this._observers.forEach(function(t){return t.next(e._window.devicePixelRatio)}),this._reinstallResolutionListener()},e}();function de(e){return new y(e)}var b=function(){function e(e,t,n){this._canvasElement=null,this._bitmapSizeChangedListeners=[],this._suggestedBitmapSize=null,this._suggestedBitmapSizeChangedListeners=[],this._devicePixelRatioObservable=null,this._canvasElementResizeObserver=null,this._canvasElement=e,this._canvasElementClientSize=_({width:this._canvasElement.clientWidth,height:this._canvasElement.clientHeight}),this._transformBitmapSize=t??(function(e){return e}),this._allowResizeObserver=n?.allowResizeObserver??!0,this._chooseAndInitObserver()}return e.prototype.dispose=function(){var e,t;if(this._canvasElement===null)throw Error(`Object is disposed`);(e=this._canvasElementResizeObserver)==null||e.disconnect(),this._canvasElementResizeObserver=null,(t=this._devicePixelRatioObservable)==null||t.dispose(),this._devicePixelRatioObservable=null,this._suggestedBitmapSizeChangedListeners.length=0,this._bitmapSizeChangedListeners.length=0,this._canvasElement=null},Object.defineProperty(e.prototype,`canvasElement`,{get:function(){if(this._canvasElement===null)throw Error(`Object is disposed`);return this._canvasElement},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`canvasElementClientSize`,{get:function(){return this._canvasElementClientSize},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`bitmapSize`,{get:function(){return _({width:this.canvasElement.width,height:this.canvasElement.height})},enumerable:!1,configurable:!0}),e.prototype.resizeCanvasElement=function(e){this._canvasElementClientSize=_(e),this.canvasElement.style.width=`${this._canvasElementClientSize.width}px`,this.canvasElement.style.height=`${this._canvasElementClientSize.height}px`,this._invalidateBitmapSize()},e.prototype.subscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners.push(e)},e.prototype.unsubscribeBitmapSizeChanged=function(e){this._bitmapSizeChangedListeners=this._bitmapSizeChangedListeners.filter(function(t){return t!==e})},Object.defineProperty(e.prototype,`suggestedBitmapSize`,{get:function(){return this._suggestedBitmapSize},enumerable:!1,configurable:!0}),e.prototype.subscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners.push(e)},e.prototype.unsubscribeSuggestedBitmapSizeChanged=function(e){this._suggestedBitmapSizeChangedListeners=this._suggestedBitmapSizeChangedListeners.filter(function(t){return t!==e})},e.prototype.applySuggestedBitmapSize=function(){if(this._suggestedBitmapSize!==null){var e=this._suggestedBitmapSize;this._suggestedBitmapSize=null,this._resizeBitmap(e),this._emitSuggestedBitmapSizeChanged(e,this._suggestedBitmapSize)}},e.prototype._resizeBitmap=function(e){var t=this.bitmapSize;v(t,e)||(this.canvasElement.width=e.width,this.canvasElement.height=e.height,this._emitBitmapSizeChanged(t,e))},e.prototype._emitBitmapSizeChanged=function(e,t){var n=this;this._bitmapSizeChangedListeners.forEach(function(r){return r.call(n,e,t)})},e.prototype._suggestNewBitmapSize=function(e){var t=this._suggestedBitmapSize,n=_(this._transformBitmapSize(e,this._canvasElementClientSize)),r=v(this.bitmapSize,n)?null:n;t===null&&r===null||t!==null&&r!==null&&v(t,r)||(this._suggestedBitmapSize=r,this._emitSuggestedBitmapSizeChanged(t,r))},e.prototype._emitSuggestedBitmapSizeChanged=function(e,t){var n=this;this._suggestedBitmapSizeChangedListeners.forEach(function(r){return r.call(n,e,t)})},e.prototype._chooseAndInitObserver=function(){var e=this;if(!this._allowResizeObserver){this._initDevicePixelRatioObservable();return}me().then(function(t){return t?e._initResizeObserver():e._initDevicePixelRatioObservable()})},e.prototype._initDevicePixelRatioObservable=function(){var e=this;if(this._canvasElement!==null){var t=pe(this._canvasElement);if(t===null)throw Error(`No window is associated with the canvas`);this._devicePixelRatioObservable=de(t),this._devicePixelRatioObservable.subscribe(function(){return e._invalidateBitmapSize()}),this._invalidateBitmapSize()}},e.prototype._invalidateBitmapSize=function(){if(this._canvasElement!==null){var e=pe(this._canvasElement);if(e!==null){var t=this._devicePixelRatioObservable?.value??e.devicePixelRatio,n=this._canvasElement.getClientRects(),r=n[0]===void 0?_({width:this._canvasElementClientSize.width*t,height:this._canvasElementClientSize.height*t}):he(n[0],t);this._suggestNewBitmapSize(r)}}},e.prototype._initResizeObserver=function(){var e=this;this._canvasElement!==null&&(this._canvasElementResizeObserver=new ResizeObserver(function(t){var n=t.find(function(t){return t.target===e._canvasElement});if(!(!n||!n.devicePixelContentBoxSize||!n.devicePixelContentBoxSize[0])){var r=n.devicePixelContentBoxSize[0],i=_({width:r.inlineSize,height:r.blockSize});e._suggestNewBitmapSize(i)}}),this._canvasElementResizeObserver.observe(this._canvasElement,{box:`device-pixel-content-box`}))},e}();function fe(e,t){if(t.type===`device-pixel-content-box`)return new b(e,t.transform,t.options);throw Error(`Unsupported binding target`)}function pe(e){return e.ownerDocument.defaultView}function me(){return new Promise(function(e){var t=new ResizeObserver(function(n){e(n.every(function(e){return`devicePixelContentBoxSize`in e})),t.disconnect()});t.observe(document.body,{box:`device-pixel-content-box`})}).catch(function(){return!1})}function he(e,t){return _({width:Math.round(e.left*t+e.width*t)-Math.round(e.left*t),height:Math.round(e.top*t+e.height*t)-Math.round(e.top*t)})}var ge=function(){function e(e,t,n){if(t.width===0||t.height===0)throw TypeError(`Rendering target could only be created on a media with positive width and height`);if(this._mediaSize=t,n.width===0||n.height===0)throw TypeError(`Rendering target could only be created using a bitmap with positive integer width and height`);this._bitmapSize=n,this._context=e}return e.prototype.useMediaCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),this._context.scale(this._horizontalPixelRatio,this._verticalPixelRatio),e({context:this._context,mediaSize:this._mediaSize})}
2finally{this._context.restore()}},e.prototype.useBitmapCoordinateSpace=function(e){try{return this._context.save(),this._context.setTransform(1,0,0,1,0,0),e({context:this._context,mediaSize:this._mediaSize,bitmapSize:this._bitmapSize,horizontalPixelRatio:this._horizontalPixelRatio,verticalPixelRatio:this._verticalPixelRatio})}finally{this._context.restore()}},Object.defineProperty(e.prototype,`_horizontalPixelRatio`,{get:function(){return this._bitmapSize.width/this._mediaSize.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,`_verticalPixelRatio`,{get:function(){return this._bitmapSize.height/this._mediaSize.height},enumerable:!1,configurable:!0}),e}();function x(e,t){var n=e.canvasElementClientSize;if(n.width===0||n.height===0)return null;var r=e.bitmapSize;if(r.width===0||r.height===0)return null;var i=e.canvasElement.getContext(`2d`,t);return i===null?null:new ge(i,n,r)}var _e={title:``,visible:!0,lastValueVisible:!0,priceLineVisible:!0,priceLineSource:0,priceLineWidth:1,priceLineColor:``,priceLineStyle:2,baseLineVisible:!0,baseLineWidth:1,baseLineColor:`#B2B5BE`,baseLineStyle:0,priceFormat:{type:`price`,precision:2,minMove:.01}},ve,ye;function S(e,t){let n={0:[],1:[e.lineWidth,e.lineWidth],2:[2*e.lineWidth,2*e.lineWidth],3:[6*e.lineWidth,6*e.lineWidth],4:[e.lineWidth,4*e.lineWidth]}[t];e.setLineDash(n)}function be(e,t,n,r){e.beginPath();let i=e.lineWidth%2?.5:0;e.moveTo(n,t+i),e.lineTo(r,t+i),e.stroke()}function C(e,t){if(!e)throw Error(`Assertion failed`+(t?`: `+t:``))}function w(e){if(e===void 0)throw Error(`Value is undefined`);return e}function T(e){if(e===null)throw Error(`Value is null`);return e}function E(e){return T(w(e))}(function(e){e[e.Simple=0]=`Simple`,e[e.WithSteps=1]=`WithSteps`,e[e.Curved=2]=`Curved`})(ve||={}),function(e){e[e.Solid=0]=`Solid`,e[e.Dotted=1]=`Dotted`,e[e.Dashed=2]=`Dashed`,e[e.LargeDashed=3]=`LargeDashed`,e[e.SparseDotted=4]=`SparseDotted`}(ye||={});var D=class{constructor(){this.t=[]}i(e,t,n){let r={h:e,l:t,o:!0===n};this.t.push(r)}_(e){let t=this.t.findIndex((t=>e===t.h));t>-1&&this.t.splice(t,1)}u(e){this.t=this.t.filter((t=>t.l!==e))}p(e,t,n){let r=[...this.t];this.t=this.t.filter((e=>!e.o)),r.forEach((r=>r.h(e,t,n)))}v(){return this.t.length>0}m(){this.t=[]}};function O(e,...t){for(let n of t)for(let t in n)n[t]!==void 0&&Object.prototype.hasOwnProperty.call(n,t)&&![`__proto__`,`constructor`,`prototype`].includes(t)&&(typeof n[t]!=`object`||e[t]===void 0||Array.isArray(n[t])?e[t]=n[t]:O(e[t],n[t]));return e}function k(e){return typeof e==`number`&&isFinite(e)}function xe(e){return typeof e==`number`&&e%1==0}function Se(e){return typeof e==`string`}function Ce(e){return typeof e==`boolean`}function A(e){let t=e;if(!t||typeof t!=`object`)return t;let n,r,i;for(r in n=Array.isArray(t)?[]:{},t)t.hasOwnProperty(r)&&(i=t[r],n[r]=i&&typeof i==`object`?A(i):i);return n}function we(e){return e!==null}function Te(e){return e===null?void 0:e}var Ee=`-apple-system, BlinkMacSystemFont, 'Trebuchet MS', Roboto, Ubuntu, sans-serif`;function De(e,t,n){return t===void 0&&(t=Ee),`${n=n===void 0?``:`${n} `}${e}px ${t}`}var Oe=class{constructor(e){this.M={S:1,C:5,P:NaN,k:``,T:``,R:``,D:``,V:0,B:0,I:0,A:0,L:0},this.O=e}N(){let e=this.M,t=this.F(),n=this.W();return e.P===t&&e.T===n||(e.P=t,e.T=n,e.k=De(t,n),e.A=2.5/12*t,e.V=e.A,e.B=t/12*e.C,e.I=t/12*e.C,e.L=0),e.R=this.H(),e.D=this.U(),this.M}H(){return this.O.N().layout.textColor}U(){return this.O.$()}F(){return this.O.N().layout.fontSize}W(){return this.O.N().layout.fontFamily}};function ke(e){return e<0?0:e>255?255:Math.round(e)||0}function Ae(e){return .199*e[0]+.687*e[1]+.114*e[2]}var je=class{constructor(e,t){this.q=new Map,this.Y=e,t&&(this.q=t)}j(e,t){if(e===`transparent`)return e;let n=this.K(e),r=n[3];return`rgba(${n[0]}, ${n[1]}, ${n[2]}, ${t*r})`}X(e){let t=this.K(e);return{Z:`rgb(${t[0]}, ${t[1]}, ${t[2]})`,G:Ae(t)>160?`black`:`white`}}J(e){return Ae(this.K(e))}tt(e,t,n){let[r,i,a,o]=this.K(e),[s,c,l,u]=this.K(t),d=[ke(r+n*(s-r)),ke(i+n*(c-i)),ke(a+n*(l-a)),(f=o+n*(u-o),f<=0||f>1?Math.min(Math.max(f,0),1):Math.round(1e4*f)/1e4)];var f;return`rgba(${d[0]}, ${d[1]}, ${d[2]}, ${d[3]})`}K(e){let t=this.q.get(e);if(t)return t;let n=function(e){let t=document.createElement(`div`);t.style.display=`none`,document.body.appendChild(t),t.style.color=e;let n=window.getComputedStyle(t).color;return document.body.removeChild(t),n}(e).match(/^rgba?\s*\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d*\.?\d+))?\)$/);
2if(!n){if(this.Y.length)for(let t of this.Y){let n=t(e);if(n)return this.q.set(e,n),n}throw Error(`Failed to parse color: ${e}`)}let r=[parseInt(n[1],10),parseInt(n[2],10),parseInt(n[3],10),n[4]?parseFloat(n[4]):1];return this.q.set(e,r),r}},Me=class{constructor(){this.it=[]}st(e){this.it=e}nt(e,t,n){this.it.forEach((r=>{r.nt(e,t,n)}))}},j=class{nt(e,t,n){e.useBitmapCoordinateSpace((e=>this.et(e,t,n)))}},Ne=class extends j{constructor(){super(...arguments),this.rt=null}ht(e){this.rt=e}et({context:e,horizontalPixelRatio:t,verticalPixelRatio:n}){if(this.rt===null||this.rt.lt===null)return;let r=this.rt.lt,i=this.rt,a=Math.max(1,Math.floor(t))%2/2,o=o=>{e.beginPath();for(let s=r.to-1;s>=r.from;--s){let r=i.ot[s],c=Math.round(r._t*t)+a,l=r.ut*n,u=o*n+a;e.moveTo(c,l),e.arc(c,l,u,0,2*Math.PI)}e.fill()};i.ct>0&&(e.fillStyle=i.dt,o(i.ft+i.ct)),e.fillStyle=i.vt,o(i.ft)}};function Pe(){return{ot:[{_t:0,ut:0,wt:0,gt:0}],vt:``,dt:``,ft:0,ct:0,lt:null}}var Fe={from:0,to:1},Ie=class{constructor(e,t,n){this.Mt=new Me,this.bt=[],this.St=[],this.xt=!0,this.O=e,this.Ct=t,this.Pt=n,this.Mt.st(this.bt)}yt(e){this.kt(),this.xt=!0}Tt(){return this.xt&&=(this.Rt(),!1),this.Mt}kt(){let e=this.Pt.Dt();e.length!==this.bt.length&&(this.St=e.map(Pe),this.bt=this.St.map((e=>{let t=new Ne;return t.ht(e),t})),this.Mt.st(this.bt))}Rt(){let e=this.Ct.N().mode===2||!this.Ct.Vt(),t=this.Pt.Bt(),n=this.Ct.It(),r=this.O.Et();this.kt(),t.forEach(((t,i)=>{let a=this.St[i],o=t.At(n),s=t.zt();!e&&o!==null&&t.Vt()&&s!==null?(a.vt=o.Lt,a.ft=o.ft,a.ct=o.Ot,a.ot[0].gt=o.gt,a.ot[0].ut=t.Ft().Nt(o.gt,s.Wt),a.dt=o.Ht??this.O.Ut(a.ot[0].ut/t.Ft().$t()),a.ot[0].wt=n,a.ot[0]._t=r.qt(n),a.lt=Fe):a.lt=null}))}},Le=class extends j{constructor(e){super(),this.Yt=e}et({context:e,bitmapSize:t,horizontalPixelRatio:n,verticalPixelRatio:r}){if(this.Yt===null)return;let i=this.Yt.jt.Vt,a=this.Yt.Kt.Vt;if(!i&&!a)return;let o=Math.round(this.Yt._t*n),s=Math.round(this.Yt.ut*r);e.lineCap=`butt`,i&&o>=0&&(e.lineWidth=Math.floor(this.Yt.jt.ct*n),e.strokeStyle=this.Yt.jt.R,e.fillStyle=this.Yt.jt.R,S(e,this.Yt.jt.Xt),function(e,t,n,r){e.beginPath();let i=e.lineWidth%2?.5:0;e.moveTo(t+i,n),e.lineTo(t+i,r),e.stroke()}(e,o,0,t.height)),a&&s>=0&&(e.lineWidth=Math.floor(this.Yt.Kt.ct*r),e.strokeStyle=this.Yt.Kt.R,e.fillStyle=this.Yt.Kt.R,S(e,this.Yt.Kt.Xt),be(e,s,0,t.width))}},Re=class{constructor(e,t){this.xt=!0,this.Zt={jt:{ct:1,Xt:0,R:``,Vt:!1},Kt:{ct:1,Xt:0,R:``,Vt:!1},_t:0,ut:0},this.Gt=new Le(this.Zt),this.Jt=e,this.Pt=t}yt(){this.xt=!0}Tt(e){return this.xt&&=(this.Rt(),!1),this.Gt}Rt(){let e=this.Jt.Vt(),t=this.Pt.Qt().N().crosshair,n=this.Zt;if(t.mode===2)return n.Kt.Vt=!1,void(n.jt.Vt=!1);n.Kt.Vt=e&&this.Jt.ti(this.Pt),n.jt.Vt=e&&this.Jt.ii(),n.Kt.ct=t.horzLine.width,n.Kt.Xt=t.horzLine.style,n.Kt.R=t.horzLine.color,n.jt.ct=t.vertLine.width,n.jt.Xt=t.vertLine.style,n.jt.R=t.vertLine.color,n._t=this.Jt.si(),n.ut=this.Jt.ni()}};function ze(e,t,n,r,i,a){e.fillRect(t+a,n,r-2*a,a),e.fillRect(t+a,n+i-a,r-2*a,a),e.fillRect(t,n,a,i),e.fillRect(t+r-a,n,a,i)}function Be(e,t,n,r,i,a){e.save(),e.globalCompositeOperation=`copy`,e.fillStyle=a,e.fillRect(t,n,r,i),e.restore()}function Ve(e,t,n,r,i,a){e.beginPath(),e.roundRect?e.roundRect(t,n,r,i,a):(e.lineTo(t+r-a[1],n),a[1]!==0&&e.arcTo(t+r,n,t+r,n+a[1],a[1]),e.lineTo(t+r,n+i-a[2]),a[2]!==0&&e.arcTo(t+r,n+i,t+r-a[2],n+i,a[2]),e.lineTo(t+a[3],n+i),a[3]!==0&&e.arcTo(t,n+i,t,n+i-a[3],a[3]),e.lineTo(t,n+a[0]),a[0]!==0&&e.arcTo(t,n,t+a[0],n,a[0]))}function He(e,t,n,r,i,a,o=0,s=[0,0,0,0],c=``){if(e.save(),!o||!c||c===a)return Ve(e,t,n,r,i,s),e.fillStyle=a,e.fill(),void e.restore();let l=o/2;var u;Ve(e,t+l,n+l,r-o,i-o,(u=-l,s.map((e=>e===0?e:e+u)))),a!==`transparent`&&(e.fillStyle=a,e.fill()),c!==`transparent`&&(e.lineWidth=o,e.strokeStyle=c,e.closePath(),e.stroke()),e.restore()}function Ue(e,t,n,r,i,a,o){e.save(),e.globalCompositeOperation=`copy`;let s=e.createLinearGradient(0,0,0,i);s.addColorStop(0,a),s.addColorStop(1,o),e.fillStyle=s,e.fillRect(t,n,r,i),e.restore()}var We=class{constructor(e,t){this.ht(e,t)}ht(e,t){this.Yt=e,this.ei=t}$t(e,t){return this.Yt.Vt?e.P+e.A+e.V:0}nt(e,t,n,r){if(!this.Yt.Vt||this.Yt.ri.length===0)return;let i=this.Yt.R,a=this.ei.Z,o=e.useBitmapCoordinateSpace((e=>{let o=e.context;o.font=t.k;let s=this.hi(e,t,n,r),c=s.ai;return s.li?He(o,c.oi,c._i,c.ui,c.ci,a,c.di,[c.ft,0,0,c.ft],a):He(o,c.fi,c._i,c.ui,c.ci,a,c.di,[0,c.ft,c.ft,0],a),this.Yt.pi&&(o.fillStyle=i,o.fillRect(c.fi,c.mi,c.wi-c.fi,c.gi)),this.Yt.Mi&&(o.fillStyle=t.D,o.fillRect(s.li?c.bi-c.di:0,c._i,c.di,c.Si-c._i)
2),s}));e.useMediaCoordinateSpace((({context:e})=>{let n=o.xi;e.font=t.k,e.textAlign=o.li?`right`:`left`,e.textBaseline=`middle`,e.fillStyle=i,e.fillText(this.Yt.ri,n.Ci,(n._i+n.Si)/2+n.Pi)}))}hi(e,t,n,r){let{context:i,bitmapSize:a,mediaSize:o,horizontalPixelRatio:s,verticalPixelRatio:c}=e,l=this.Yt.pi||!this.Yt.yi?t.C:0,u=this.Yt.ki?t.S:0,d=t.A+this.ei.Ti,f=t.V+this.ei.Ri,p=t.B,m=t.I,h=this.Yt.ri,ee=t.P,te=n.Di(i,h),ne=Math.ceil(n.Vi(i,h)),re=ee+d+f,ie=t.S+p+m+ne+l,ae=Math.max(1,Math.floor(c)),g=Math.round(re*c);g%2!=ae%2&&(g+=1);let oe=u>0?Math.max(1,Math.floor(u*s)):0,se=Math.round(ie*s),ce=Math.round(l*s),le=this.ei.Bi??this.ei.Ii,ue=Math.round(le*c)-Math.floor(.5*c),_=Math.floor(ue+ae/2-g/2),v=_+g,y=r===`right`,de=y?o.width-u:u,b=y?a.width-oe:oe,fe,pe,me;return y?(fe=b-se,pe=b-ce,me=de-l-p-u):(fe=b+se,pe=b+ce,me=de+l+p),{li:y,ai:{_i:_,mi:ue,Si:v,ui:se,ci:g,ft:2*s,di:oe,oi:fe,fi:b,wi:pe,gi:ae,bi:a.width},xi:{_i:_/c,Si:v/c,Ci:me,Pi:te}}}},Ge=class{constructor(e){this.Ei={Ii:0,Z:`#000`,Ri:0,Ti:0},this.Ai={ri:``,Vt:!1,pi:!0,yi:!1,Ht:``,R:`#FFF`,Mi:!1,ki:!1},this.zi={ri:``,Vt:!1,pi:!1,yi:!0,Ht:``,R:`#FFF`,Mi:!0,ki:!0},this.xt=!0,this.Li=new(e||We)(this.Ai,this.Ei),this.Oi=new(e||We)(this.zi,this.Ei)}ri(){return this.Ni(),this.Ai.ri}Ii(){return this.Ni(),this.Ei.Ii}yt(){this.xt=!0}$t(e,t=!1){return Math.max(this.Li.$t(e,t),this.Oi.$t(e,t))}Fi(){return this.Ei.Bi||0}Wi(e){this.Ei.Bi=e}Hi(){return this.Ni(),this.Ai.Vt||this.zi.Vt}Ui(){return this.Ni(),this.Ai.Vt}Tt(e){return this.Ni(),this.Ai.pi=this.Ai.pi&&e.N().ticksVisible,this.zi.pi=this.zi.pi&&e.N().ticksVisible,this.Li.ht(this.Ai,this.Ei),this.Oi.ht(this.zi,this.Ei),this.Li}$i(){return this.Ni(),this.Li.ht(this.Ai,this.Ei),this.Oi.ht(this.zi,this.Ei),this.Oi}Ni(){this.xt&&(this.Ai.pi=!0,this.zi.pi=!1,this.qi(this.Ai,this.zi,this.Ei))}},Ke=class extends Ge{constructor(e,t,n){super(),this.Jt=e,this.Yi=t,this.ji=n}qi(e,t,n){if(e.Vt=!1,this.Jt.N().mode===2)return;let r=this.Jt.N().horzLine;if(!r.labelVisible)return;let i=this.Yi.zt();if(!this.Jt.Vt()||this.Yi.Ki()||i===null)return;let a=this.Yi.Xi().X(r.labelBackgroundColor);n.Z=a.Z,e.R=a.G;let o=2/12*this.Yi.P();n.Ti=o,n.Ri=o;let s=this.ji(this.Yi);n.Ii=s.Ii,e.ri=this.Yi.Zi(s.gt,i),e.Vt=!0}},qe=/[1-9]/g,Je=class{constructor(){this.Yt=null}ht(e){this.Yt=e}nt(e,t){if(this.Yt===null||!1===this.Yt.Vt||this.Yt.ri.length===0)return;let n=e.useMediaCoordinateSpace((({context:e})=>(e.font=t.k,Math.round(t.Gi.Vi(e,T(this.Yt).ri,qe)))));if(n<=0)return;let r=t.Ji,i=n+2*r,a=i/2,o=this.Yt.Qi,s=this.Yt.Ii,c=Math.floor(s-a)+.5;c<0?(s+=Math.abs(0-c),c=Math.floor(s-a)+.5):c+i>o&&(s-=Math.abs(o-(c+i)),c=Math.floor(s-a)+.5);let l=c+i,u=Math.ceil(0+t.S+t.C+t.A+t.P+t.V);e.useBitmapCoordinateSpace((({context:e,horizontalPixelRatio:n,verticalPixelRatio:r})=>{let i=T(this.Yt);e.fillStyle=i.Z;let a=Math.round(c*n),o=Math.round(0*r),s=Math.round(l*n),d=Math.round(u*r),f=Math.round(2*n);if(e.beginPath(),e.moveTo(a,o),e.lineTo(a,d-f),e.arcTo(a,d,a+f,d,f),e.lineTo(s-f,d),e.arcTo(s,d,s,d-f,f),e.lineTo(s,o),e.fill(),i.pi){let a=Math.round(i.Ii*n),s=o,c=Math.round((s+t.C)*r);e.fillStyle=i.R;let l=Math.max(1,Math.floor(n)),u=Math.floor(.5*n);e.fillRect(a-u,s,l,c-s)}})),e.useMediaCoordinateSpace((({context:e})=>{let n=T(this.Yt),i=0+t.S+t.C+t.A+t.P/2;e.font=t.k,e.textAlign=`left`,e.textBaseline=`middle`,e.fillStyle=n.R;let a=t.Gi.Di(e,`Apr0`);e.translate(c+r,i+a),e.fillText(n.ri,0,0)}))}},Ye=class{constructor(e,t,n){this.xt=!0,this.Gt=new Je,this.Zt={Vt:!1,Z:`#4c525e`,R:`white`,ri:``,Qi:0,Ii:NaN,pi:!0},this.Ct=e,this.ts=t,this.ji=n}yt(){this.xt=!0}Tt(){return this.xt&&=(this.Rt(),!1),this.Gt.ht(this.Zt),this.Gt}Rt(){let e=this.Zt;if(e.Vt=!1,this.Ct.N().mode===2)return;let t=this.Ct.N().vertLine;if(!t.labelVisible)return;let n=this.ts.Et();if(n.Ki())return;e.Qi=n.Qi();let r=this.ji();if(r===null)return;e.Ii=r.Ii;let i=n.ss(this.Ct.It());e.ri=n.ns(T(i)),e.Vt=!0;let a=this.ts.Xi().X(t.labelBackgroundColor);e.Z=a.Z,e.R=a.G,e.pi=n.N().ticksVisible}},Xe=class{constructor(){this.es=null,this.rs=0}hs(){return this.rs}ls(e){this.rs=e}Ft(){return this.es}_s(e){this.es=e}us(e){return[]}cs(){return[]}Vt(){return!0}},Ze;(function(e){e[e.Normal=0]=`Normal`,e[e.Magnet=1]=`Magnet`,e[e.Hidden=2]=`Hidden`,e[e.MagnetOHLC=3]=`MagnetOHLC`})(Ze||={});var Qe=class extends Xe{constructor(e,t){super(),this.Pt=null,this.ds=NaN,this.fs=0,this.ps=!1,this.vs=new Map,this.ws=!1,this.gs=new WeakMap,this.Ms=new WeakMap,this.bs=NaN,this.Ss=NaN,this.xs=NaN,this.Cs=NaN,this.ts=e,this.Ps=t,this.ys=((e,t)=>n=>{let r=t(),i=e();if(n===T(this.Pt).ks())return{gt:i,Ii:r};{let e=T(n.zt());return{gt:n.Ts(r,e),Ii:r}}})((()=>this.ds),(()=>this.Ss));let n=((e,t)=>()=>{let n=this.ts.Et().Rs(e()),r=t();return n&&Number.isFinite(r)?{wt:n,Ii:r}:null})((()=>this.fs),(()=>this.si()));this.Ds=new Ye(this,e,n)}N(){return this.Ps}Vs(e,t){this.xs=e,this.Cs=t}Bs(){this.xs=NaN,this.Cs=NaN}Is(){return this.xs}Es(){return this.Cs}As(e,t,n){this.ws||=!0,this.ps=!0,this.zs(e,t,n)}It(){return this.fs}si(){return this.bs}ni(){return this.Ss}Vt(){return this.ps}Ls(){this.ps=!1,this.Os(),this.ds=NaN,this.bs=NaN,this.Ss=NaN,this.Pt=null,this.Bs(),this.Ns()}Fs(e){let t=this.gs.get(e);t||(t=new Re(this,e),this.gs.set(e,t));let n=this.Ms.get(e);return n||(n=new Ie(this.ts,this,e),this.Ms.set(e,n)),[t,n]}ti(e){return e===this.Pt&&this.Ps.horzLine.visible}ii(){return this.Ps.vertLine.visible}Ws(e,t){this.ps&&this.Pt===e||this.vs.clear();let n=[];return this.Pt===e&&n.push(this.Hs(this.vs,t,this.ys)),n}cs(){return this.ps?[this.Ds]:[]}Us(){return this.Pt}
2Ns(){this.ts.$s().forEach((e=>{this.gs.get(e)?.yt(),this.Ms.get(e)?.yt()})),this.vs.forEach((e=>e.yt())),this.Ds.yt()}qs(e){return e&&!e.ks().Ki()?e.ks():null}zs(e,t,n){this.Ys(e,t,n)&&this.Ns()}Ys(e,t,n){let r=this.bs,i=this.Ss,a=this.ds,o=this.fs,s=this.Pt,c=this.qs(n);this.fs=e,this.bs=isNaN(e)?NaN:this.ts.Et().qt(e),this.Pt=n;let l=c===null?null:c.zt();return c!==null&&l!==null?(this.ds=t,this.Ss=c.Nt(t,l)):(this.ds=NaN,this.Ss=NaN),r!==this.bs||i!==this.Ss||o!==this.fs||a!==this.ds||s!==this.Pt}Os(){let e=this.ts.js().map((e=>e.Xs().Ks())).filter(we),t=e.length===0?null:Math.max(...e);this.fs=t===null?NaN:t}Hs(e,t,n){let r=e.get(t);return r===void 0&&(r=new Ke(this,t,n),e.set(t,r)),r}};function $e(e){return e===`left`||e===`right`}var M=class e{constructor(e){this.Zs=new Map,this.Gs=[],this.Js=e}Qs(e,t){let n=function(e,t){return e===void 0?t:{tn:Math.max(e.tn,t.tn),sn:e.sn||t.sn}}(this.Zs.get(e),t);this.Zs.set(e,n)}nn(){return this.Js}en(e){let t=this.Zs.get(e);return t===void 0?{tn:this.Js}:{tn:Math.max(this.Js,t.tn),sn:t.sn}}rn(){this.hn(),this.Gs=[{an:0}]}ln(e){this.hn(),this.Gs=[{an:1,Wt:e}]}_n(e){this.un(),this.Gs.push({an:5,Wt:e})}hn(){this.un(),this.Gs.push({an:6})}cn(){this.hn(),this.Gs=[{an:4}]}dn(e){this.hn(),this.Gs.push({an:2,Wt:e})}fn(e){this.hn(),this.Gs.push({an:3,Wt:e})}pn(){return this.Gs}vn(e){for(let t of e.Gs)this.mn(t);this.Js=Math.max(this.Js,e.Js),e.Zs.forEach(((e,t)=>{this.Qs(t,e)}))}static wn(){return new e(2)}static gn(){return new e(3)}mn(e){switch(e.an){case 0:this.rn();break;case 1:this.ln(e.Wt);break;case 2:this.dn(e.Wt);break;case 3:this.fn(e.Wt);break;case 4:this.cn();break;case 5:this._n(e.Wt);break;case 6:this.un()}}un(){let e=this.Gs.findIndex((e=>e.an===5));e!==-1&&this.Gs.splice(e,1)}},et=class{formatTickmarks(e){return e.map((e=>this.format(e)))}},tt=`.`;function N(e,t){if(!k(e))return`n/a`;if(!xe(t)||t<0||t>16)throw TypeError(`invalid length`);return t===0?e.toString():(`0000000000000000`+e.toString()).slice(-t)}var nt=class extends et{constructor(e,t){if(super(),t||=1,k(e)&&xe(e)||(e=100),e<0)throw TypeError(`invalid base`);this.Yi=e,this.Mn=t,this.bn()}format(e){let t=e<0?`â`:``;return e=Math.abs(e),t+this.Sn(e)}bn(){if(this.xn=0,this.Yi>0&&this.Mn>0){let e=this.Yi;for(;e>1;)e/=10,this.xn++}}Sn(e){let t=this.Yi/this.Mn,n=Math.floor(e),r=``,i=this.xn===void 0?NaN:this.xn;if(t>1){let a=+(Math.round(e*t)-n*t).toFixed(this.xn);a>=t&&(a-=t,n+=1),r=tt+N(+a.toFixed(this.xn)*this.Mn,i)}else n=Math.round(n*t)/t,i>0&&(r=tt+N(0,i));return n.toFixed(0)+r}},rt=class extends nt{constructor(e=100){super(e)}format(e){return`${super.format(e)}%`}},it=class extends et{constructor(e){super(),this.Cn=e}format(e){let t=``;return e<0&&(t=`-`,e=-e),e<995?t+this.Pn(e):e<999995?t+this.Pn(e/1e3)+`K`:e<999999995?(e=1e3*Math.round(e/1e3),t+this.Pn(e/1e6)+`M`):(e=1e6*Math.round(e/1e6),t+this.Pn(e/1e9)+`B`)}Pn(e){let t,n=10**this.Cn;return t=(e=Math.round(e*n)/n)>=1e-15&&e<1?e.toFixed(this.Cn).replace(/\.?0+$/,``):String(e),t.replace(/(\.[1-9]*)0+$/,((e,t)=>t))}},at=/[2-9]/g,P=class{constructor(e=50){this.yn=0,this.kn=1,this.Tn=1,this.Rn={},this.Dn=new Map,this.Vn=e}Bn(){this.yn=0,this.Dn.clear(),this.kn=1,this.Tn=1,this.Rn={}}Vi(e,t,n){return this.In(e,t,n).width}Di(e,t,n){let r=this.In(e,t,n);return((r.actualBoundingBoxAscent||0)-(r.actualBoundingBoxDescent||0))/2}In(e,t,n){let r=n||at,i=String(t).replace(r,`0`);if(this.Dn.has(i))return w(this.Dn.get(i)).En;if(this.yn===this.Vn){let e=this.Rn[this.Tn];delete this.Rn[this.Tn],this.Dn.delete(e),this.Tn++,this.yn--}e.save(),e.textBaseline=`middle`;let a=e.measureText(i);return e.restore(),a.width===0&&t.length||(this.Dn.set(i,{En:a,An:this.kn}),this.Rn[this.kn]=i,this.yn++,this.kn++),a}},ot=class{constructor(e){this.zn=null,this.M=null,this.Ln=`right`,this.On=e}Nn(e,t,n){this.zn=e,this.M=t,this.Ln=n}nt(e){this.M!==null&&this.zn!==null&&this.zn.nt(e,this.M,this.On,this.Ln)}},st=class{constructor(e,t,n){this.Fn=e,this.On=new P(50),this.Wn=t,this.O=n,this.F=-1,this.Gt=new ot(this.On)}Tt(){let e=this.O.Hn(this.Wn);if(e===null)return null;
2let t=e.Un(this.Wn)?e.$n():this.Wn.Ft();if(t===null)return null;let n=e.qn(t);if(n===`overlay`)return null;let r=this.O.Yn();return r.P!==this.F&&(this.F=r.P,this.On.Bn()),this.Gt.Nn(this.Fn.$i(),r,n),this.Gt}},ct=class extends j{constructor(){super(...arguments),this.Yt=null}ht(e){this.Yt=e}jn(e,t){if(!this.Yt?.Vt)return null;let{ut:n,ct:r,Kn:i}=this.Yt;return t>=n-r-7&&t<=n+r+7?{Xn:this.Yt,Kn:i}:null}et({context:e,bitmapSize:t,horizontalPixelRatio:n,verticalPixelRatio:r}){if(this.Yt===null||!1===this.Yt.Vt)return;let i=Math.round(this.Yt.ut*r);i<0||i>t.height||(e.lineCap=`butt`,e.strokeStyle=this.Yt.R,e.lineWidth=Math.floor(this.Yt.ct*n),S(e,this.Yt.Xt),be(e,i,0,t.width))}},lt=class{constructor(e){this.Zn={ut:0,R:`rgba(0, 0, 0, 0)`,ct:1,Xt:0,Vt:!1},this.Gn=new ct,this.xt=!0,this.Jn=e,this.Qn=e.Qt(),this.Gn.ht(this.Zn)}yt(){this.xt=!0}Tt(){return this.Jn.Vt()?(this.xt&&=(this.te(),!1),this.Gn):null}},ut=class extends lt{constructor(e){super(e)}te(){this.Zn.Vt=!1;let e=this.Jn.Ft(),t=e.ie().ie;if(t!==2&&t!==3)return;let n=this.Jn.N();if(!n.baseLineVisible||!this.Jn.Vt())return;let r=this.Jn.zt();r!==null&&(this.Zn.Vt=!0,this.Zn.ut=e.Nt(r.Wt,r.Wt),this.Zn.R=n.baseLineColor,this.Zn.ct=n.baseLineWidth,this.Zn.Xt=n.baseLineStyle)}},dt=class extends j{constructor(){super(...arguments),this.Yt=null}ht(e){this.Yt=e}se(){return this.Yt}et({context:e,horizontalPixelRatio:t,verticalPixelRatio:n}){let r=this.Yt;if(r===null)return;let i=Math.max(1,Math.floor(t)),a=i%2/2,o=Math.round(r.ne.x*t)+a,s=r.ne.y*n;e.fillStyle=r.ee,e.beginPath();let c=Math.max(2,1.5*r.re)*t;e.arc(o,s,c,0,2*Math.PI,!1),e.fill(),e.fillStyle=r.he,e.beginPath(),e.arc(o,s,r.ft*t,0,2*Math.PI,!1),e.fill(),e.lineWidth=i,e.strokeStyle=r.ae,e.beginPath(),e.arc(o,s,r.ft*t+i/2,0,2*Math.PI,!1),e.stroke()}},ft=[{le:0,oe:.25,_e:4,ue:10,ce:.25,de:0,fe:.4,pe:.8},{le:.25,oe:.525,_e:10,ue:14,ce:0,de:0,fe:.8,pe:0},{le:.525,oe:1,_e:14,ue:14,ce:0,de:0,fe:0,pe:0}],pt=class{constructor(e){this.Gt=new dt,this.xt=!0,this.ve=!0,this.me=performance.now(),this.we=this.me-1,this.ge=e}Me(){this.we=this.me-1,this.yt()}be(){if(this.yt(),this.ge.N().lastPriceAnimation===2){let e=performance.now(),t=this.we-e;if(t>0)return void(t<650&&(this.we+=2600));this.me=e,this.we=e+2600}}yt(){this.xt=!0}Se(){this.ve=!0}Vt(){return this.ge.N().lastPriceAnimation!==0}xe(){switch(this.ge.N().lastPriceAnimation){case 0:return!1;case 1:return!0;case 2:return performance.now()<=this.we}}Tt(){return this.xt?(this.Rt(),this.xt=!1,this.ve=!1):this.ve&&=(this.Ce(),!1),this.Gt}Rt(){this.Gt.ht(null);let e=this.ge.Qt().Et(),t=e.Pe(),n=this.ge.zt();if(t===null||n===null)return;let r=this.ge.ye(!0);if(r.ke||!t.Te(r.Re))return;let i={x:e.qt(r.Re),y:this.ge.Ft().Nt(r.gt,n.Wt)},a=r.R,o=this.ge.N().lineWidth,s=this.De(this.Ve(),a);this.Gt.ht({ee:a,re:o,he:s.he,ae:s.ae,ft:s.ft,ne:i})}Ce(){let e=this.Gt.se();if(e!==null){let t=this.De(this.Ve(),e.ee);e.he=t.he,e.ae=t.ae,e.ft=t.ft}}Ve(){return this.xe()?performance.now()-this.me:2599}Be(e,t,n,r){let i=n+(r-n)*t;return this.ge.Qt().Xi().j(e,i)}De(e,t){let n=e%2600/2600,r;for(let e of ft)if(n>=e.le&&n<=e.oe){r=e;break}C(r!==void 0,`Last price animation internal logic error`);let i=(n-r.le)/(r.oe-r.le);return{he:this.Be(t,i,r.ce,r.de),ae:this.Be(t,i,r.fe,r.pe),ft:(a=i,o=r._e,s=r.ue,o+(s-o)*a)};var a,o,s}},mt=class extends lt{constructor(e){super(e)}te(){let e=this.Zn;e.Vt=!1;let t=this.Jn.N();if(!t.priceLineVisible||!this.Jn.Vt())return;let n=this.Jn.ye(t.priceLineSource===0);n.ke||(e.Vt=!0,e.ut=n.Ii,e.R=this.Jn.Ie(n.R),e.ct=t.priceLineWidth,e.Xt=t.priceLineStyle)}},ht=class extends Ge{constructor(e){super(),this.Jt=e}qi(e,t,n){e.Vt=!1,t.Vt=!1;let r=this.Jt;if(!r.Vt())return;let i=r.N(),a=i.lastValueVisible,o=r.Ee()!==``,s=i.seriesLastValueMode===0,c=r.ye(!1);if(c.ke)return;a&&(e.ri=this.Ae(c,a,s),e.Vt=e.ri.length!==0),(o||s)&&(t.ri=this.ze(c,a,o,s),t.Vt=t.ri.length>0);let l=r.Ie(c.R),u=this.Jt.Qt().Xi().X(l);n.Z=u.Z,n.Ii=c.Ii,t.Ht=r.Qt().Ut(c.Ii/r.Ft().$t()),e.Ht=l,e.R=u.G,t.R=u.G}ze(e,t,n,r){let i=``,a=this.Jt.Ee();return n&&a.length!==0&&(i+=`${a} `),t&&r&&(i+=this.Jt.Ft().Le()?e.Oe:e.Ne),i.trim()}Ae(e,t,n){return t?n?this.Jt.Ft().Le()?e.Ne:e.Oe:e.ri:``}};function gt(e,t,n,r){let i=Number.isFinite(t),a=Number.isFinite(n);return i&&a?e(t,n):i||a?i?t:n:r}var F=class e{constructor(e,t){this.Fe=e,this.We=t}He(e){return e!==null&&this.Fe===e.Fe&&this.We===e.We}Ue(){return new e(this.Fe,this.We)}$e(){return this.Fe}qe(){return this.We}Ye(){return this.We-this.Fe}Ki(){return this.We===this.Fe||Number.isNaN(this.We)||Number.isNaN(this.Fe)}vn(t){return t===null?this:new e(gt(Math.min,this.$e(),t.$e(),-1/0),gt(Math.max,this.qe(),t.qe(),1/0))}je(e){if(!k(e)||this.We-this.Fe===0)return;let t=.5*(this.We+this.Fe),n=this.We-t,r=this.Fe-t;n*=e,r*=e,this.We=t+n,this.Fe=t+r}Ke(e){k(e)&&(this.We+=e,this.Fe+=e)}Xe(){return{minValue:this.Fe,maxValue:this.We}}static Ze(t){return t===null?null:new e(t.minValue,t.maxValue)}},_t=class e{constructor(e,t){this.Ge=e,this.Je=t||null}Qe(){return this.Ge}tr(){return this.Je}Xe(){return{priceRange:this.Ge===null?null:this.Ge.Xe(),margins:this.Je||void 0}}static Ze(t){return t===null?null:new e(F.Ze(t.priceRange),t.margins)}},vt=class extends lt{constructor(e,t){super(e),this.ir=t}te(){let e=this.Zn;e.Vt=!1;let t=this.ir.N();if(!this.Jn.Vt()||!t.lineVisible)return;let n=this.ir.sr();n!==null&&(e.Vt=!0,e.ut=n,e.R=t.color,e.ct=t.lineWidth,e.Xt=t.lineStyle,e.Kn=this.ir.N().id)}},yt=class extends Ge{constructor(e,t){super(),this.ge=e,this.ir=t}qi(e,t,n){e.Vt=!1,t.Vt=!1;let r=this.ir.N(),i=r.axisLabelVisible,a=r.title!==``,o=this.ge;if(!i||!o.Vt())return;let s=this.ir.sr();if(s===null)return;a&&(t.ri=r.title,t.Vt=!0),t.Ht=o.Qt().Ut(s/o.Ft().$t()),e.ri=this.nr(r.price),e.Vt=!0;let c=this.ge.Qt().Xi().X(r.axisLabelColor||r.color);n.Z=c.Z;let l=r.axisLabelTextColor||c.G;e.R=l,t.R=l,n.Ii=s}nr(e){let t=this.ge.zt();return t===null?``:this.ge.Ft().Zi(e,t.Wt)}},bt=class{constructor(e,t){this.ge=e,this.Ps=t,this.er=new vt(e,this),this.Fn=new yt(e,this),this.rr=new st(this.Fn,e,e.Qt())}hr(e){O(this.Ps,e),this.yt(),this.ge.Qt().ar()}N(){return this.Ps}lr(){return this.er}_r(){return this.rr}ur(){return this.Fn}yt(){this.er.yt(),this.Fn.yt()}sr(){let e=this.ge,t=e.Ft();if(e.Qt().Et().Ki()||t.Ki())return null;let n=e.zt();return n===null?null:t.Nt(this.Ps.price,n.Wt)}},xt=class extends Xe{constructor(e){super(),this.ts=e}Qt(){return this.ts}},St={Bar:(e,t,n,r)=>{let i=t.upColor,a=t.downColor,o=T(e(n,r)),s=E(o.Wt[0])<=E(o.Wt[3]);return{cr:o.R??(s?i:a)}},Candlestick:(e,t,n,r)=>{let i=t.upColor,a=t.downColor,o=t.borderUpColor,s=t.borderDownColor,c=t.wickUpColor,l=t.wickDownColor,u=T(e(n,r)),d=E(u.Wt[0])<=E(u.Wt[3]);return{cr:u.R??(d?i:a),dr:u.Ht??(d?o:s),pr:u.vr??(d?c:l)}},Custom:(e,t,n,r)=>({cr:T(e(n,r)).R??t.color}),Area:(e,t,n,r)=>{let i=T(e(n,r));return{cr:i.vt??t.lineColor,vt:i.vt??t.lineColor,mr:i.mr??t.topColor,wr:i.wr??t.bottomColor}},Baseline:(e,t,n,r)=>{let i=T(e(n,r));return{cr:i.Wt[3]>=t.baseValue.price?t.topLineColor:t.bottomLineColor,gr:i.gr??t.topLineColor,Mr:i.Mr??t.bottomLineColor,br:i.br??t.topFillColor1,Sr:i.Sr??t.topFillColor2,Cr:i.Cr??t.bottomFillColor1,Pr:i.Pr??t.bottomFillColor2}},Line:(e,t,n,r)=>{let i=T(e(n,r));return{cr:i.R??t.color,vt:i.R??t.color}},Histogram:(e,t,n,r)=>({cr:T(e(n,r)).R??t.color})},Ct=class{constructor(e){this.yr=(e,t)=>
2t===void 0?this.ge.Xs().kr(e):t.Wt,this.ge=e,this.Tr=St[e.Rr()]}Dr(e,t){return this.Tr(this.yr,this.ge.N(),e,t)}};function wt(e,t,n,r,i=0,a=t.length){let o=a-i;for(;0<o;){let a=o>>1,s=i+a;r(t[s],n)===e?(i=s+1,o-=a+1):o=a}return i}var I=wt.bind(null,!0),Tt=wt.bind(null,!1),Et;(function(e){e[e.NearestLeft=-1]=`NearestLeft`,e[e.None=0]=`None`,e[e.NearestRight=1]=`NearestRight`})(Et||={});var L=30,Dt=class{constructor(){this.Vr=[],this.Br=new Map,this.Ir=new Map,this.Er=[]}Ar(){return this.zr()>0?this.Vr[this.Vr.length-1]:null}Lr(){return this.zr()>0?this.Or(0):null}Ks(){return this.zr()>0?this.Or(this.Vr.length-1):null}zr(){return this.Vr.length}Ki(){return this.zr()===0}Te(e){return this.Nr(e,0)!==null}kr(e){return this.Fr(e)}Fr(e,t=0){let n=this.Nr(e,t);return n===null?null:{...this.Wr(n),Re:this.Or(n)}}Hr(){return this.Vr}Ur(e,t,n){if(this.Ki())return null;let r=null;for(let i of n)r=Ot(r,this.$r(e,t,i));return r}ht(e){this.Ir.clear(),this.Br.clear(),this.Vr=e,this.Er=e.map((e=>e.Re))}qr(){return this.Er}Or(e){return this.Vr[e].Re}Wr(e){return this.Vr[e]}Nr(e,t){let n=this.Yr(e);if(n===null&&t!==0)switch(t){case-1:return this.jr(e);case 1:return this.Kr(e);default:throw TypeError(`Unknown search mode`)}return n}jr(e){let t=this.Xr(e);return t>0&&--t,t!==this.Vr.length&&this.Or(t)<e?t:null}Kr(e){let t=this.Zr(e);return t!==this.Vr.length&&e<this.Or(t)?t:null}Yr(e){let t=this.Xr(e);return t===this.Vr.length||e<this.Vr[t].Re?null:t}Xr(e){return I(this.Vr,e,((e,t)=>e.Re<t))}Zr(e){return Tt(this.Vr,e,((e,t)=>e.Re>t))}Gr(e,t,n){let r=null;for(let i=e;i<t;i++){let e=this.Vr[i].Wt[n];Number.isNaN(e)||(r===null?r={Jr:e,Qr:e}:(e<r.Jr&&(r.Jr=e),e>r.Qr&&(r.Qr=e)))}return r}$r(e,t,n){if(this.Ki())return null;let r=null,i=T(this.Lr()),a=T(this.Ks()),o=Math.max(e,i),s=Math.min(t,a),c=Math.ceil(o/L)*L,l=Math.max(c,Math.floor(s/L)*L);{let e=this.Xr(o),i=this.Zr(Math.min(s,c,t));r=Ot(r,this.Gr(e,i,n))}let u=this.Br.get(n);u===void 0&&(u=new Map,this.Br.set(n,u));for(let e=Math.max(c+1,o);e<l;e+=L){let t=Math.floor(e/L),i=u.get(t);if(i===void 0){let e=this.Xr(t*L),r=this.Zr((t+1)*L-1);i=this.Gr(e,r,n),u.set(t,i)}r=Ot(r,i)}{let e=this.Xr(l),t=this.Zr(s);r=Ot(r,this.Gr(e,t,n))}return r}};function Ot(e,t){return e===null?t:t===null?e:{Jr:Math.min(e.Jr,t.Jr),Qr:Math.max(e.Qr,t.Qr)}}var kt={setLineStyle:S},At=class{constructor(e){this.th=e}nt(e,t,n){this.th.draw(e,kt)}ih(e,t,n){this.th.drawBackground?.(e,kt)}},jt=class{constructor(e){this.Dn=null,this.sh=e}Tt(){let e=this.sh.renderer();if(e===null)return null;if(this.Dn?.nh===e)return this.Dn.eh;let t=new At(e);return this.Dn={nh:e,eh:t},t}rh(){return this.sh.zOrder?.()??`normal`}},Mt=class{constructor(e){this.hh=null,this.ah=e}oh(){return this.ah}Ns(){this.ah.updateAllViews?.()}Fs(){let e=this.ah.paneViews?.()??[];if(this.hh?.nh===e)return this.hh.eh;let t=e.map((e=>new jt(e)));return this.hh={nh:e,eh:t},t}jn(e,t){return this.ah.hitTest?.(e,t)??null}},Nt=class extends Mt{us(){return[]}},Pt=class{constructor(e){this.th=e}nt(e,t,n){this.th.draw(e,kt)}ih(e,t,n){this.th.drawBackground?.(e,kt)}},Ft=class{constructor(e){this.Dn=null,this.sh=e}Tt(){let e=this.sh.renderer();if(e===null)return null;if(this.Dn?.nh===e)return this.Dn.eh;let t=new Pt(e);return this.Dn={nh:e,eh:t},t}rh(){return this.sh.zOrder?.()??`normal`}};function It(e){return{ri:e.text(),Ii:e.coordinate(),Bi:e.fixedCoordinate?.(),R:e.textColor(),Z:e.backColor(),Vt:e.visible?.()??!0,pi:e.tickVisible?.()??!0}}var Lt=class{constructor(e,t){this.Gt=new Je,this._h=e,this.uh=t}Tt(){return this.Gt.ht({Qi:this.uh.Qi(),...It(this._h)}),this.Gt}},Rt=class extends Ge{constructor(e,t){super(),this._h=e,this.Yi=t}qi(e,t,n){let r=It(this._h);n.Z=r.Z,e.R=r.R;let i=2/12*this.Yi.P();n.Ti=i,n.Ri=i,n.Ii=r.Ii,n.Bi=r.Bi,e.ri=r.ri,e.Vt=r.Vt,e.pi=r.pi}},zt=class extends Mt{constructor(e,t){super(e),this.dh=null,this.fh=null,this.ph=null,this.mh=null,this.ge=t}cs(){let e=this.ah.timeAxisViews?.()??[];if(this.dh?.nh===e)return this.dh.eh;let t=this.ge.Qt().Et(),n=e.map((e=>new Lt(e,t)));return this.dh={nh:e,eh:n},n}Ws(){let e=this.ah.priceAxisViews?.()??[];if(this.fh?.nh===e)return this.fh.eh;let t=this.ge.Ft(),n=e.map((e=>new Rt(e,t)));return this.fh={nh:e,eh:n},n}wh(){let e=this.ah.priceAxisPaneViews?.()??[];if(this.ph?.nh===e)return this.ph.eh;let t=e.map((e=>new Ft(e)));return this.ph={nh:e,eh:t},t}gh(){let e=this.ah.timeAxisPaneViews?.()??[];if(this.mh?.nh===e)return this.mh.eh;let t=e.map((e=>new Ft(e)));return this.mh={nh:e,eh:t},t}Mh(e,t){return this.ah.autoscaleInfo?.(e,t)??null}};function Bt(e,t,n,r){e.forEach((e=>{t(e).forEach((e=>{e.rh()===n&&r.push(e)}))}))}function Vt(e){return e.Fs()}function Ht(e){return e.wh()}function Ut(e){return e.gh()}var Wt=[`Area`,`Line`,`Baseline`],Gt=class extends xt{constructor(e,t,n,r,i){super(e),this.Yt=new Dt,this.er=new mt(this),this.bh=[],this.Sh=new ut(this),this.xh=null,this.Ch=null,this.Ph=null,this.yh=[],this.Ps=n,this.kh=t;let a=new ht(this);this.vs=[a],this.rr=new st(a,this,e),Wt.includes(this.kh)&&(this.xh=new pt(this)),this.Th(),this.sh=r(this,this.Qt(),i)}m(){this.Ph!==null&&clearTimeout(this.Ph)}Ie(e){return this.Ps.priceLineColor||e}ye(e){let t={ke:!0},n=this.Ft();if(this.Qt().Et().Ki()||n.Ki()||this.Yt.Ki())return t;let r=this.Qt().Et().Pe(),i=this.zt();if(r===null||i===null)return t;let a,o;if(e){let e=this.Yt.Ar();if(e===null)return t;a=e,o=e.Re}else{let e=this.Yt.Fr(r.bi(),-1);if(e===null||(a=this.Yt.kr(e.Re),a===null))return t;o=e.Re}let s=a.Wt[3],c=this.Rh().Dr(o,{Wt:a}),l=n.Nt(s,i.Wt);return{ke:!1,gt:s,ri:n.Zi(s,i.Wt),Oe:n.Dh(s),Ne:n.Vh(s,i.Wt),R:c.cr,Ii:l,Re:o}}Rh(){return this.Ch!==null||(this.Ch=new Ct(this)),this.Ch}N(){return this.Ps}hr(e){let t=e.priceScaleId;t!==void 0&&t!==this.Ps.priceScaleId&&this.Qt().Bh(this,t),O(this.Ps,e),e.priceFormat!==void 0&&(this.Th(),this.Qt().Ih()),this.Qt().Eh(this),this.Qt().Ah(),this.sh.yt(`options`)}ht(e,t){this.Yt.ht(e),this.sh.yt(`data`),this.xh!==null&&(t&&t.zh?this.xh.be():e.length===0&&this.xh.Me());let n=this.Qt().Hn(this);this.Qt().Lh(n),this.Qt().Eh(this),this.Qt().Ah(),this.Qt().ar()}Oh(e){let t=new bt(this,e);return this.bh.push(t),this.Qt().Eh(this),t}
2Nh(e){let t=this.bh.indexOf(e);t!==-1&&this.bh.splice(t,1),this.Qt().Eh(this)}Fh(){return this.bh}Rr(){return this.kh}zt(){let e=this.Wh();return e===null?null:{Wt:e.Wt[3],Hh:e.wt}}Wh(){let e=this.Qt().Et().Pe();if(e===null)return null;let t=e.Uh();return this.Yt.Fr(t,1)}Xs(){return this.Yt}$h(e){let t=this.Yt.kr(e);return t===null?null:this.kh===`Bar`||this.kh===`Candlestick`||this.kh===`Custom`?{qh:t.Wt[0],Yh:t.Wt[1],jh:t.Wt[2],Kh:t.Wt[3]}:t.Wt[3]}Xh(e){let t=[];Bt(this.yh,Vt,`top`,t);let n=this.xh;return n!==null&&n.Vt()?(this.Ph===null&&n.xe()&&(this.Ph=setTimeout((()=>{this.Ph=null,this.Qt().Zh()}),0)),n.Se(),t.unshift(n),t):t}Fs(){let e=[];this.Gh()||e.push(this.Sh),e.push(this.sh,this.er);let t=this.bh.map((e=>e.lr()));return e.push(...t),Bt(this.yh,Vt,`normal`,e),e}Jh(){return this.Qh(Vt,`bottom`)}ta(e){return this.Qh(Ht,e)}ia(e){return this.Qh(Ut,e)}sa(e,t){return this.yh.map((n=>n.jn(e,t))).filter((e=>e!==null))}us(){return[this.rr,...this.bh.map((e=>e._r()))]}Ws(e,t){if(t!==this.es&&!this.Gh())return[];let n=[...this.vs];for(let e of this.bh)n.push(e.ur());return this.yh.forEach((e=>{n.push(...e.Ws())})),n}cs(){let e=[];return this.yh.forEach((t=>{e.push(...t.cs())})),e}Mh(e,t){if(this.Ps.autoscaleInfoProvider!==void 0){let n=this.Ps.autoscaleInfoProvider((()=>{let n=this.na(e,t);return n===null?null:n.Xe()}));return _t.Ze(n)}return this.na(e,t)}nh(){let e=this.Ps.priceFormat;return e.base??1/e.minMove}ea(){return this.ra}Ns(){this.sh.yt();for(let e of this.vs)e.yt();for(let e of this.bh)e.yt();this.er.yt(),this.Sh.yt(),this.xh?.yt(),this.yh.forEach((e=>e.Ns()))}Ft(){return T(super.Ft())}At(e){if(!((this.kh===`Line`||this.kh===`Area`||this.kh===`Baseline`)&&this.Ps.crosshairMarkerVisible))return null;let t=this.Yt.kr(e);return t===null?null:{gt:t.Wt[3],ft:this.ha(),Ht:this.aa(),Ot:this.la(),Lt:this.oa(e)}}Ee(){return this.Ps.title}Vt(){return this.Ps.visible}_a(e){this.yh.push(new zt(e,this))}ua(e){this.yh=this.yh.filter((t=>t.oh()!==e))}ca(){if(this.kh===`Custom`)return e=>this.sh.da(e)}fa(){if(this.kh===`Custom`)return e=>this.sh.pa(e)}va(){return this.Yt.qr()}Gh(){return!$e(this.Ft().ma())}na(e,t){if(!xe(e)||!xe(t)||this.Yt.Ki())return null;let n=this.kh===`Line`||this.kh===`Area`||this.kh===`Baseline`||this.kh===`Histogram`?[3]:[2,1],r=this.Yt.Ur(e,t,n),i=r===null?null:new F(r.Jr,r.Qr),a=null;if(this.Rr()===`Histogram`){let e=this.Ps.base,t=new F(e,e);i=i===null?t:i.vn(t)}return this.yh.forEach((n=>{let r=n.Mh(e,t);if(r?.priceRange){let e=new F(r.priceRange.minValue,r.priceRange.maxValue);i=i===null?e:i.vn(e)}r?.margins&&(a=r.margins)})),new _t(i,a)}ha(){switch(this.kh){case`Line`:case`Area`:case`Baseline`:return this.Ps.crosshairMarkerRadius}return 0}aa(){switch(this.kh){case`Line`:case`Area`:case`Baseline`:{let e=this.Ps.crosshairMarkerBorderColor;if(e.length!==0)return e}}return null}la(){switch(this.kh){case`Line`:case`Area`:case`Baseline`:return this.Ps.crosshairMarkerBorderWidth}return 0}oa(e){switch(this.kh){case`Line`:case`Area`:case`Baseline`:{let e=this.Ps.crosshairMarkerBackgroundColor;if(e.length!==0)return e}}return this.Rh().Dr(e).cr}Th(){switch(this.Ps.priceFormat.type){case`custom`:{let e=this.Ps.priceFormat.formatter;this.ra={format:e,formatTickmarks:this.Ps.priceFormat.tickmarksFormatter??(t=>t.map(e))};break}case`volume`:this.ra=new it(this.Ps.priceFormat.precision);break;case`percent`:this.ra=new rt(this.Ps.priceFormat.precision);break;default:{let e=10**this.Ps.priceFormat.precision;this.ra=new nt(e,this.Ps.priceFormat.minMove*e)}}this.es!==null&&this.es.wa()}Qh(e,t){let n=[];return Bt(this.yh,e,t,n),n}},Kt=[3],qt=[0,1,2,3],Jt=class{constructor(e){this.Ps=e}ga(e,t,n){let r=e;if(this.Ps.mode===0)return r;let i=n.ks(),a=i.zt();if(a===null)return r;let o=i.Nt(e,a),s=n.Ma().filter((e=>e instanceof Gt)).reduce(((e,r)=>{if(n.Un(r)||!r.Vt())return e;let i=r.Ft(),a=r.Xs();if(i.Ki()||!a.Te(t))return e;let o=a.kr(t);if(o===null)return e;let s=E(r.zt()),c=this.Ps.mode===3?qt:Kt;return e.concat(c.map((e=>i.Nt(o.Wt[e],s.Wt))))}),[]);if(s.length===0)return r;s.sort(((e,t)=>Math.abs(e-o)-Math.abs(t-o)));let c=s[0];return r=i.Ts(c,a),r}};function R(e,t,n){return Math.min(Math.max(e,t),n)}function Yt(e,t,n){return t-e<=n}function Xt(e){let t=Math.ceil(e);return t%2==0?t-1:t}var Zt=class extends j{constructor(){super(...arguments),this.Yt=null}ht(e){this.Yt=e}et({context:e,bitmapSize:t,horizontalPixelRatio:n,verticalPixelRatio:r}){if(this.Yt===null)return;let i=Math.max(1,Math.floor(n));e.lineWidth=i,function(e,t){e.save(),e.lineWidth%2&&e.translate(.5,.5),t(),e.restore(
2)}(e,(()=>{let a=T(this.Yt);if(a.ba){e.strokeStyle=a.Sa,S(e,a.xa),e.beginPath();for(let r of a.Ca){let a=Math.round(r.Pa*n);e.moveTo(a,-i),e.lineTo(a,t.height+i)}e.stroke()}if(a.ya){e.strokeStyle=a.ka,S(e,a.Ta),e.beginPath();for(let n of a.Ra){let a=Math.round(n.Pa*r);e.moveTo(-i,a),e.lineTo(t.width+i,a)}e.stroke()}}))}},Qt=class{constructor(e){this.Gt=new Zt,this.xt=!0,this.Pt=e}yt(){this.xt=!0}Tt(){if(this.xt){let e=this.Pt.Qt().N().grid,t={ya:e.horzLines.visible,ba:e.vertLines.visible,ka:e.horzLines.color,Sa:e.vertLines.color,Ta:e.horzLines.style,xa:e.vertLines.style,Ra:this.Pt.ks().Da(),Ca:(this.Pt.Qt().Et().Da()||[]).map((e=>({Pa:e.coord})))};this.Gt.ht(t),this.xt=!1}return this.Gt}},$t=class{constructor(e){this.sh=new Qt(e)}lr(){return this.sh}},en={Va:4,Ba:1e-4};function z(e,t){let n=100*(e-t)/t;return t<0?-n:n}function tn(e,t){return new F(z(e.$e(),t),z(e.qe(),t))}function B(e,t){let n=100*(e-t)/t+100;return t<0?-n:n}function nn(e,t){return new F(B(e.$e(),t),B(e.qe(),t))}function rn(e,t){let n=Math.abs(e);if(n<1e-15)return 0;let r=Math.log10(n+t.Ba)+t.Va;return e<0?-r:r}function V(e,t){let n=Math.abs(e);if(n<1e-15)return 0;let r=10**(n-t.Va)-t.Ba;return e<0?-r:r}function H(e,t){return e===null?null:new F(rn(e.$e(),t),rn(e.qe(),t))}
2function U(e,t){return e===null?null:new F(V(e.$e(),t),V(e.qe(),t))}function an(e){if(e===null)return en;let t=Math.abs(e.qe()-e.$e());if(t>=1||t<1e-15)return en;let n=Math.ceil(Math.abs(Math.log10(t))),r=en.Va+n;return{Va:r,Ba:1/10**r}}var on=class{constructor(e,t){if(this.Ia=e,this.Ea=t,function(e){if(e<0)return!1;if(e>0xde0b6b3a7640000)return!0;for(let t=e;t>1;t/=10)if(t%10!=0)return!1;return!0}(this.Ia))this.Aa=[2,2.5,2];else{this.Aa=[];for(let e=this.Ia;e!==1;){if(e%2==0)this.Aa.push(2),e/=2;else{if(e%5!=0)throw Error(`unexpected base`);this.Aa.push(2,2.5),e/=5}if(this.Aa.length>100)throw Error(`something wrong with base`)}}}za(e,t,n){let r=this.Ia===0?0:1/this.Ia,i=10**Math.max(0,Math.ceil(Math.log10(e-t))),a=0,o=this.Ea[0];for(;;){let e=Yt(i,r,1e-14)&&i>r+1e-14,t=Yt(i,n*o,1e-14),s=Yt(i,1,1e-14);if(!(e&&t&&s))break;i/=o,o=this.Ea[++a%this.Ea.length]}if(i<=r+1e-14&&(i=r),i=Math.max(1,i),this.Aa.length>0&&(s=i,c=1,l=1e-14,Math.abs(s-c)<l))for(a=0,o=this.Aa[0];Yt(i,n*o,1e-14)&&i>r+1e-14;)i/=o,o=this.Aa[++a%this.Aa.length];var s,c,l;return i}},sn=class{constructor(e,t,n,r){this.La=[],this.Yi=e,this.Ia=t,this.Oa=n,this.Na=r}za(e,t){if(e<t)throw Error(`high < low`);let n=this.Yi.$t(),r=(e-t)*this.Fa()/n,i=new on(this.Ia,[2,2.5,2]),a=new on(this.Ia,[2,2,2.5]),o=new on(this.Ia,[2.5,2,2]),s=[];return s.push(i.za(e,t,r),a.za(e,t,r),o.za(e,t,r)),function(e){if(e.length<1)throw Error(`array is empty`);let t=e[0];for(let n=1;n<e.length;++n)e[n]<t&&(t=e[n]);return t}(s)}Wa(){let e=this.Yi,t=e.zt();if(t===null)return void(this.La=[]);let n=e.$t(),r=this.Oa(n-1,t),i=this.Oa(0,t),a=this.Yi.N().entireTextOnly?this.Ha()/2:0,o=a,s=n-1-a,c=Math.max(r,i),l=Math.min(r,i);if(c===l)return void(this.La=[]);let u=this.za(c,l);if(this.Ua(t,u,c,l,o,s),e.$a()&&this.qa(u,l,c)){let e=this.Yi.Ya();this.ja(t,u,o,s,e,2*e)}let d=this.La.map((e=>e.Ka)),f=this.Yi.Xa(d);for(let e=0;e<this.La.length;e++)this.La[e].Za=f[e]}Da(){return this.La}Ha(){return this.Yi.P()}Fa(){return Math.ceil(2.5*this.Ha())}Ua(e,t,n,r,i,a){let o=this.La,s=this.Yi,c=n%t;c+=c<0?t:0;let l=n>=r?1:-1,u=null,d=0;for(let f=n-c;f>r;f-=t){let n=this.Na(f,e,!0);u!==null&&Math.abs(n-u)<this.Fa()||n<i||n>a||(d<o.length?(o[d].Pa=n,o[d].Za=s.Ga(f),o[d].Ka=f):o.push({Pa:n,Za:s.Ga(f),Ka:f}),d++,u=n,s.Ja()&&(t=this.za(f*l,r)))}o.length=d}ja(e,t,n,r,i,a){let o=this.La,s=this.Qa(e,n,i,a),c=this.Qa(e,r,-a,-i),l=this.Na(0,e,!0)-this.Na(t,e,!0);o.length>0&&o[0].Pa-s.Pa<l/2&&o.shift(),o.length>0&&c.Pa-o[o.length-1].Pa<l/2&&o.pop(),o.unshift(s),o.push(c)}Qa(e,t,n,r){let i=(n+r)/2,a=this.Oa(t+n,e),o=this.Oa(t+r,e),s=Math.min(a,o),c=Math.max(a,o),l=Math.max(.1,this.za(c,s)),u=this.Oa(t+i,e),d=u-u%l,f=this.Na(d,e,!0);return{Za:this.Yi.Ga(d),Pa:f,Ka:d}}qa(e,t,n){let r=E(this.Yi.Qe());return this.Yi.Ja()&&(r=U(r,this.Yi.tl())),r.$e()-t<e&&n-r.qe()<e}};function cn(e){return e.slice().sort(((e,t)=>T(e.hs())-T(t.hs())))}var ln;(function(e){e[e.Normal=0]=`Normal`,e[e.Logarithmic=1]=`Logarithmic`,e[e.Percentage=2]=`Percentage`,e[e.IndexedTo100=3]=`IndexedTo100`})(ln||={});var un=new rt,dn=new nt(100,1),fn=class{constructor(e,t,n,r,i){this.il=0,this.sl=null,this.Ge=null,this.nl=null,this.el={rl:!1,hl:null},this.al=!1,this.ll=0,this.ol=0,this._l=new D,this.ul=new D,this.cl=[],this.dl=null,this.fl=null,this.pl=null,this.vl=null,this.ml=null,this.ra=dn,this.wl=an(null),this.gl=e,this.Ps=t,this.Ml=n,this.bl=r,this.Sl=i,this.xl=new sn(this,100,this.Cl.bind(this),this.Pl.bind(this))}ma(){return this.gl}N(){return this.Ps}hr(e){if(O(this.Ps,e),this.wa(),e.mode!==void 0&&this.yl({ie:e.mode}),e.scaleMargins!==void 0){let t=w(e.scaleMargins.top),n=w(e.scaleMargins.bottom);if(t<0||t>1)throw Error(`Invalid top margin - expect value between 0 and 1, given=${t}`);if(n<0||n>1)throw Error(`Invalid bottom margin - expect value between 0 and 1, given=${n}`);if(t+n>1)throw Error(`Invalid margins - sum of margins must be less than 1, given=${t+n}`);this.kl(),this.pl=null}}Tl(){return this.Ps.autoScale}Rl(){return this.al}Ja(){return this.Ps.mode===1}Le(){return this.Ps.mode===2}Dl(){return this.Ps.mode===3}tl(){return this.wl}ie(){return{sn:this.Ps.autoScale,Vl:this.Ps.invertScale,ie:this.Ps.mode}}yl(e){let t=this.ie(),n=null;e.sn!==void 0&&(this.Ps.autoScale=e.sn),e.ie!==void 0&&(this.Ps.mode=e.ie,e.ie!==2&&e.ie!==3||(this.Ps.autoScale=!0),this.el.rl=!1),t.ie===1&&e.ie!==t.ie&&(function(e,t){if(e===null)return!1;let n=V(e.$e(),t),r=V(e.qe(),t);return isFinite(n)&&isFinite(r)}(this.Ge,this.wl)?(n=U(this.Ge,this.wl),n!==null&&this.Bl(n)):this.Ps.autoScale=!0),e.ie===1&&e.ie!==t.ie&&(n=H(this.Ge,this.wl),n!==null&&this.Bl(n));let r=t.ie!==this.Ps.mode;r&&(t.ie===2||this.Le())&&this.wa(),r&&(t.ie===3||this.Dl())&&this.wa(),e.Vl!==void 0&&t.Vl!==e.Vl&&(this.Ps.invertScale=e.Vl,this.Il()),this.ul.p(t,this.ie())}El(){return this.ul}P(){return this.Ml.fontSize}$t(){return this.il}Al(e){this.il!==e&&(this.il=e,this.kl(),this.pl=null)}zl(){if(this.sl)return this.sl;let e=this.$t()-this.Ll()-this.Ol();return this.sl=e,e}Qe(){return this.Nl(),this.Ge}Bl(e,t){let n=this.Ge;(t||n===null&&e!==null||n!==null&&!n.He(e))&&(this.pl=null,this.Ge=e)}Fl(e){this.Bl(e),this.Wl(e!==null)}Ki(){return this.Nl(),this.il===0||!this.Ge||this.Ge.Ki()}Hl(e){return this.Vl()?e:this.$t()-1-e}Nt(e,t){return this.Le()?e=z(e,t):this.Dl()&&(e=B(e,t)),this.Pl(e,t)}Ul(e,t,n){this.Nl();let r=this.Ol(),i=T(this.Qe()),a=i.$e(),o=i.qe(),s=this.zl()-1,c=this.Vl(),l=s/(o-a),u=n===void 0?0:n.from,d=n===void 0?e.length:n.to,f=this.$l();for(let n=u;n<d;n++){let i=e[n],o=i.gt;if(isNaN(o))continue;let s=o;f!==null&&(s=f(i.gt,t));let u=r+l*(s-a);i.ut=c?u:this.il-1-u}}ql(e,t,n){this.Nl();let r=this.Ol(),i=T(this.Qe()),a=i.$e(),o=i.qe(),s=this.zl()-1,c=this.Vl(),l=s/(o-a),u=n===void 0?0:n.from,d=n===void 0?e.length:n.to,f=this.$l();for(let n=u;n<d;n++){let i=e[n],o=i.qh,s=i.Yh,u=i.jh,d=i.Kh;f!==null&&(o=f(i.qh,t),s=f(i.Yh,t),u=f(i.jh,t),d=f(i.Kh,t));let p=r+l*(o-a),m=c?p:this.il-1-p;i.Yl=m,p=r+l*(s-a),m=c?p:this.il-1-p,i.jl=m,p=r+l*(u-a),m=c?p:this.il-1-p,i.Kl=m,p=r+l*(d-a),m=c?p:this.il-1-p,i.Xl=m}}Ts(e,t){let n=this.Cl(e,t);return this.Zl(n,t)}Zl(e,t){let n=e;return this.Le()?n=function(e,t){return t<0&&(e=-e),e/100*t+t}(n,t):this.Dl()&&(n=function(e,t){return e-=100,t<0&&(e=-e),e/100*t+t}(n,t)),n}Ma(){return this.cl}Dt(){return this.fl||=cn(this.cl),this.fl}Gl(e){this.cl.indexOf(e)===-1&&(this.cl.push(e),this.wa(),this.Jl())}Ql(e){let t=this.cl.indexOf(e);if(t===-1)throw Error(`source is not attached to scale`);this.cl.splice(t,1),this.cl.length===0&&(this.yl({sn:!0}),this.Bl(null)),this.wa(),this.Jl()}zt(){let e=null;for(let t of this.cl){let n=t.zt();n!==null&&(e===null||n.Hh<e.Hh)&&(e=n)}return e===null?null:e.Wt}Vl(){return this.Ps.invertScale}Da(){let e=this.zt()===null;if(this.pl!==null&&(e||this.pl.io===e))return this.pl.Da;this.xl.Wa();let t=this.xl.Da();return this.pl={Da:t,io:e},this._l.p(),t}so(){return this._l}no(e){this.Le()||this.Dl()||this.vl===null&&this.nl===null&&(this.Ki()||(this.vl=this.il-e,this.nl=T(this.Qe()).Ue()))}eo(e){if(this.Le()||this.Dl()||this.vl===null)return;this.yl({sn:!1}),(e=this.il-e)<0&&(e=0);let t=(this.vl+.2*(this.il-1))/(e+.2*(this.il-1)),n=T(this.nl).Ue();
2t=Math.max(t,.1),n.je(t),this.Bl(n)}ro(){this.Le()||this.Dl()||(this.vl=null,this.nl=null)}ho(e){this.Tl()||this.ml===null&&this.nl===null&&(this.Ki()||(this.ml=e,this.nl=T(this.Qe()).Ue()))}ao(e){if(this.Tl()||this.ml===null)return;let t=T(this.Qe()).Ye()/(this.zl()-1),n=e-this.ml;this.Vl()&&(n*=-1);let r=n*t,i=T(this.nl).Ue();i.Ke(r),this.Bl(i,!0),this.pl=null}lo(){this.Tl()||this.ml!==null&&(this.ml=null,this.nl=null)}ea(){return this.ra||this.wa(),this.ra}Zi(e,t){switch(this.Ps.mode){case 2:return this.oo(z(e,t));case 3:return this.ea().format(B(e,t));default:return this.nr(e)}}Ga(e){switch(this.Ps.mode){case 2:return this.oo(e);case 3:return this.ea().format(e);default:return this.nr(e)}}Xa(e){switch(this.Ps.mode){case 2:return this._o(e);case 3:return this.ea().formatTickmarks(e);default:return this.uo(e)}}Dh(e){return this.nr(e,T(this.dl).ea())}Vh(e,t){return e=z(e,t),this.oo(e,un)}co(){return this.cl}do(e){this.el={hl:e,rl:!1}}Ns(){this.cl.forEach((e=>e.Ns()))}$a(){return this.Ps.ensureEdgeTickMarksVisible&&this.Tl()}Ya(){return this.P()/2}wa(){this.pl=null;let e=1/0;this.dl=null;for(let t of this.cl)t.hs()<e&&(e=t.hs(),this.dl=t);let t=100;this.dl!==null&&(t=Math.round(this.dl.nh())),this.ra=dn,this.Le()?(this.ra=un,t=100):this.Dl()?(this.ra=new nt(100,1),t=100):this.dl!==null&&(this.ra=this.dl.ea()),this.xl=new sn(this,t,this.Cl.bind(this),this.Pl.bind(this)),this.xl.Wa()}Jl(){this.fl=null}fo(){return this.dl===null||this.Le()||this.Dl()?1:1/this.dl.nh()}Xi(){return this.Sl}Wl(e){this.al=e}Ll(){return this.Vl()?this.Ps.scaleMargins.bottom*this.$t()+this.ol:this.Ps.scaleMargins.top*this.$t()+this.ll}Ol(){return this.Vl()?this.Ps.scaleMargins.top*this.$t()+this.ll:this.Ps.scaleMargins.bottom*this.$t()+this.ol}Nl(){this.el.rl||(this.el.rl=!0,this.po())}kl(){this.sl=null}Pl(e,t){if(this.Nl(),this.Ki())return 0;e=this.Ja()&&e?rn(e,this.wl):e;let n=T(this.Qe()),r=this.Ol()+(this.zl()-1)*(e-n.$e())/n.Ye();return this.Hl(r)}Cl(e,t){if(this.Nl(),this.Ki())return 0;let n=this.Hl(e),r=T(this.Qe()),i=r.$e()+r.Ye()*((n-this.Ol())/(this.zl()-1));return this.Ja()?V(i,this.wl):i}Il(){this.pl=null,this.xl.Wa()}po(){if(this.Rl()&&!this.Tl())return;let e=this.el.hl;if(e===null)return;let t=null,n=this.co(),r=0,i=0;for(let a of n){if(!a.Vt())continue;let n=a.zt();if(n===null)continue;let o=a.Mh(e.Uh(),e.bi()),s=o&&o.Qe();if(s!==null){switch(this.Ps.mode){case 1:s=H(s,this.wl);break;case 2:s=tn(s,n.Wt);break;case 3:s=nn(s,n.Wt)}if(t=t===null?s:t.vn(T(s)),o!==null){let e=o.tr();e!==null&&(r=Math.max(r,e.above),i=Math.max(i,e.below))}}}if(this.$a()&&(r=Math.max(r,this.Ya()),i=Math.max(i,this.Ya())),r===this.ll&&i===this.ol||(this.ll=r,this.ol=i,this.pl=null,this.kl()),t!==null){if(t.$e()===t.qe()){let e=5*this.fo();this.Ja()&&(t=U(t,this.wl)),t=new F(t.$e()-e,t.qe()+e),this.Ja()&&(t=H(t,this.wl))}if(this.Ja()){let e=U(t,this.wl),n=an(e);if(a=n,o=this.wl,a.Va!==o.Va||a.Ba!==o.Ba){let r=this.nl===null?null:U(this.nl,this.wl);this.wl=n,t=H(e,n),r!==null&&(this.nl=H(r,n))}}this.Bl(t)}else this.Ge===null&&(this.Bl(new F(-.5,.5)),this.wl=an(null));var a,o}$l(){return this.Le()?z:this.Dl()?B:this.Ja()?e=>rn(e,this.wl):null}vo(e,t,n){return t===void 0?(n===void 0&&(n=this.ea()),n.format(e)):t(e)}mo(e,t,n){return t===void 0?(n===void 0&&(n=this.ea()),n.formatTickmarks(e)):t(e)}nr(e,t){return this.vo(e,this.bl.priceFormatter,t)}uo(e,t){let n=this.bl.priceFormatter;return this.mo(e,this.bl.tickmarksPriceFormatter??(n?e=>e.map(n):void 0),t)}oo(e,t){return this.vo(e,this.bl.percentageFormatter,t)}_o(e,t){let n=this.bl.percentageFormatter;return this.mo(e,this.bl.tickmarksPercentageFormatter??(n?e=>e.map(n):void 0),t)}};function pn(e){return e instanceof Gt}var mn=class{constructor(e,t){this.cl=[],this.wo=new Map,this.il=0,this.Mo=0,this.bo=1,this.fl=null,this.So=!1,this.xo=new D,this.yh=[],this.uh=e,this.ts=t,this.Co=new $t(this);let n=t.N();this.Po=this.yo(`left`,n.leftPriceScale),this.ko=this.yo(`right`,n.rightPriceScale),this.Po.El().i(this.To.bind(this,this.Po),this),this.ko.El().i(this.To.bind(this,this.ko),this),this.Ro(n)}Ro(e){if(e.leftPriceScale&&this.Po.hr(e.leftPriceScale),e.rightPriceScale&&this.ko.hr(e.rightPriceScale),e.localization&&(this.Po.wa(),this.ko.wa()),e.overlayPriceScales){let t=Array.from(this.wo.values());for(let n of t){let t=T(n[0].Ft());t.hr(e.overlayPriceScales),e.localization&&t.wa()}}}Do(e){switch(e){case`left`:return this.Po;case`right`:return this.ko}return this.wo.has(e)?w(this.wo.get(e))[0].Ft():null}m(){this.Qt().Vo().u(this),this.Po.El().u(this),this.ko.El().u(this),this.cl.forEach((e=>{e.m&&e.m()})),this.yh=this.yh.filter((e=>{let t=e.oh();return t.detached&&t.detached(),!1})),this.xo.p()}Bo(){return this.bo}Io(e){this.bo=e}Qt(){return this.ts}Qi(){return this.Mo}$t(){return this.il}Eo(e){this.Mo=e,this.Ao()}Al(e){this.il=e,this.Po.Al(e),this.ko.Al(e),this.cl.forEach((t=>{if(this.Un(t)){let n=t.Ft();n!==null&&n.Al(e)}})),this.Ao()}zo(e){this.So=e}Lo(){return this.So}Oo(){return this.cl.filter(pn)}Ma(){return this.cl}Un(e){let t=e.Ft();return t===null||this.Po!==t&&this.ko!==t}Gl(e,t,n){this.No(e,t,n?e.hs():this.cl.length)}Ql(e,t){let n=this.cl.indexOf(e);C(n!==-1,`removeDataSource: invalid data source`),this.cl.splice(n,1),t||this.cl.forEach(((e,t)=>e.ls(t)));let r=T(e.Ft()).ma();if(this.wo.has(r)){let t=w(this.wo.get(r)),n=t.indexOf(e);n!==-1&&(t.splice(n,1),t.length===0&&this.wo.delete(r))}let i=e.Ft();i&&i.Ma().indexOf(e)>=0&&(i.Ql(e),this.Fo(i)),this.fl=null}qn(e){return e===this.Po?`left`:e===this.ko?`right`:`overlay`}Wo(){return this.Po}Ho(){return this.ko}Uo(e,t){e.no(t)}$o(e,t){e.eo(t),this.Ao()}qo(e){e.ro()}Yo(e,t){e.ho(t)}jo(e,t){e.ao(t),this.Ao()}Ko(e){e.lo()}Ao(){this.cl.forEach((e=>{e.Ns()}))}ks(){let e=null;return this.ts.N().rightPriceScale.visible&&this.ko.Ma().length!==0?e=this.ko:this.ts.N().leftPriceScale.visible&&this.Po.Ma().length!==0?e=this.Po:this.cl.length!==0&&(e=this.cl[0].Ft()),e===null&&(e=this.ko),e}$n(){let e=null;return this.ts.N().rightPriceScale.visible?e=this.ko:this.ts.N().leftPriceScale.visible&&(e=this.Po),e}Fo(e){e!==null&&e.Tl()&&this.Xo(e)}Zo(e){let t=this.uh.Pe();e.yl({sn:!0}),t!==null&&e.do(t),this.Ao()}Go(){this.Xo(this.Po),this.Xo(this.ko)}Jo(){this.Fo(this.Po),this.Fo(this.ko),this.cl.forEach((e=>{this.Un(e)&&this.Fo(e.Ft())})),this.Ao(),this.ts.ar()}Dt(){return this.fl===null&&(this.fl=cn(this.cl)),this.fl}
2Qo(e,t){t=R(t,0,this.cl.length-1);let n=this.cl.indexOf(e);C(n!==-1,`setSeriesOrder: invalid data source`),this.cl.splice(n,1),this.cl.splice(t,0,e),this.cl.forEach(((e,t)=>e.ls(t))),this.fl=null;for(let e of[this.Po,this.ko])e.Jl(),e.wa();this.ts.ar()}Bt(){return this.Dt().filter(pn)}t_(){return this.xo}i_(){return this.Co}_a(e){this.yh.push(new Nt(e))}ua(e){this.yh=this.yh.filter((t=>t.oh()!==e)),e.detached&&e.detached(),this.ts.ar()}s_(){return this.yh}sa(e,t){return this.yh.map((n=>n.jn(e,t))).filter((e=>e!==null))}Xo(e){let t=e.co();if(t&&t.length>0&&!this.uh.Ki()){let t=this.uh.Pe();t!==null&&e.do(t)}e.Ns()}No(e,t,n){let r=this.Do(t);if(r===null&&(r=this.yo(t,this.ts.N().overlayPriceScales)),this.cl.splice(n,0,e),!$e(t)){let n=this.wo.get(t)||[];n.push(e),this.wo.set(t,n)}e.ls(n),r.Gl(e),e._s(r),this.Fo(r),this.fl=null}To(e,t,n){t.ie!==n.ie&&this.Xo(e)}yo(e,t){let n=new fn(e,{visible:!0,autoScale:!0,...A(t)},this.ts.N().layout,this.ts.N().localization,this.ts.Xi());return n.Al(this.$t()),n}};function hn(e){return{n_:e.n_,e_:{Kn:e.r_.externalId},h_:e.r_.cursorStyle}}function gn(e,t,n,r){for(let i of e){let e=i.Tt(r);if(e!==null&&e.jn){let r=e.jn(t,n);if(r!==null)return{a_:i,e_:r}}}return null}function _n(e){return e.Fs!==void 0}
2function vn(e,t,n){let r=[e,...e.Dt()],i=function(e,t,n){let r,i;for(let s of e){let e=s.sa?.(t,n)??[];for(let t of e)a=t.zOrder,o=r?.zOrder,(!o||a===`top`&&o!==`top`||a===`normal`&&o===`bottom`)&&(r=t,i=s)}var a,o;return r&&i?{r_:r,n_:i}:null}(r,t,n);if(i?.r_.zOrder===`top`)return hn(i);for(let a of r){if(i&&i.n_===a&&i.r_.zOrder!==`bottom`&&!i.r_.isBackground)return hn(i);if(_n(a)){let r=gn(a.Fs(e),t,n,e);if(r!==null)return{n_:a,a_:r.a_,e_:r.e_}}if(i&&i.n_===a&&i.r_.zOrder!==`bottom`&&i.r_.isBackground)return hn(i)}return i?.r_?hn(i):null}var yn=class{constructor(e,t,n=50){this.yn=0,this.kn=1,this.Tn=1,this.Dn=new Map,this.Rn=new Map,this.l_=e,this.o_=t,this.Vn=n}__(e){let t=e.time,n=this.o_.cacheKey(t),r=this.Dn.get(n);if(r!==void 0)return r.u_;if(this.yn===this.Vn){let e=this.Rn.get(this.Tn);this.Rn.delete(this.Tn),this.Dn.delete(w(e)),this.Tn++,this.yn--}let i=this.l_(e);return this.Dn.set(n,{u_:i,An:this.kn}),this.Rn.set(this.kn,n),this.yn++,this.kn++,i}},W=class{constructor(e,t){C(e<=t,`right should be >= left`),this.c_=e,this.d_=t}Uh(){return this.c_}bi(){return this.d_}f_(){return this.d_-this.c_+1}Te(e){return this.c_<=e&&e<=this.d_}He(e){return this.c_===e.Uh()&&this.d_===e.bi()}};function bn(e,t){return e===null||t===null?e===t:e.He(t)}var xn=class{constructor(){this.p_=new Map,this.Dn=null,this.v_=!1}m_(e){this.v_=e,this.Dn=null}w_(e,t){this.g_(t),this.Dn=null;for(let n=t;n<e.length;++n){let t=e[n],r=this.p_.get(t.timeWeight);r===void 0&&(r=[],this.p_.set(t.timeWeight,r)),r.push({index:n,time:t.time,weight:t.timeWeight,originalTime:t.originalTime})}}M_(e,t,n,r,i){let a=Math.ceil(t/e);return this.Dn!==null&&this.Dn.b_===a&&i===this.Dn.S_&&n===this.Dn.x_||(this.Dn={S_:i,x_:n,Da:this.C_(a,n,r),b_:a}),this.Dn.Da}g_(e){if(e===0)return void this.p_.clear();let t=[];this.p_.forEach(((n,r)=>{e<=n[0].index?t.push(r):n.splice(I(n,e,(t=>t.index<e)),1/0)}));for(let e of t)this.p_.delete(e)}C_(e,t,n){let r=[],i=e=>!t||n.has(e.index);for(let t of Array.from(this.p_.keys()).sort(((e,t)=>t-e))){if(!this.p_.get(t))continue;let n=r;r=[];let a=n.length,o=0,s=w(this.p_.get(t)),c=s.length,l=1/0,u=-1/0;for(let t=0;t<c;t++){let c=s[t],d=c.index;for(;o<a;){let e=n[o],t=e.index;if(!(t<d&&i(e))){l=t;break}o++,r.push(e),u=t,l=1/0}if(l-d>=e&&d-u>=e&&i(c))r.push(c),u=d;else if(this.v_)return n}for(;o<a;o++)i(n[o])&&r.push(n[o])}return r}},Sn=class e{constructor(e){this.P_=e}y_(){return this.P_===null?null:new W(Math.floor(this.P_.Uh()),Math.ceil(this.P_.bi()))}k_(){return this.P_}static T_(){return new e(null)}};function Cn(e,t){return e.weight>t.weight?e:t}var wn=class{constructor(e,t,n,r){this.Mo=0,this.R_=null,this.D_=[],this.ml=null,this.vl=null,this.V_=new xn,this.B_=new Map,this.I_=Sn.T_(),this.E_=!0,this.A_=new D,this.z_=new D,this.L_=new D,this.O_=null,this.N_=null,this.F_=new Map,this.W_=-1,this.H_=[],this.Ps=t,this.bl=n,this.U_=t.rightOffset,this.q_=t.barSpacing,this.ts=e,this.Y_(t),this.o_=r,this.j_(),this.V_.m_(t.uniformDistribution),this.K_()}N(){return this.Ps}X_(e){O(this.bl,e),this.Z_(),this.j_()}hr(e,t){O(this.Ps,e),this.Ps.fixLeftEdge&&this.G_(),this.Ps.fixRightEdge&&this.J_(),e.barSpacing!==void 0&&this.ts.dn(e.barSpacing),e.rightOffset!==void 0&&this.ts.fn(e.rightOffset),this.Y_(e),e.minBarSpacing===void 0&&e.maxBarSpacing===void 0||this.ts.dn(e.barSpacing??this.q_),e.ignoreWhitespaceIndices!==void 0&&e.ignoreWhitespaceIndices!==this.Ps.ignoreWhitespaceIndices&&this.K_(),this.Z_(),this.j_(),this.L_.p()}Rs(e){return this.D_[e]?.time??null}ss(e){return this.D_[e]??null}Q_(e,t){if(this.D_.length<1)return null;if(this.o_.key(e)>this.o_.key(this.D_[this.D_.length-1].time))return t?this.D_.length-1:null;let n=I(this.D_,this.o_.key(e),((e,t)=>this.o_.key(e.time)<t));return this.o_.key(e)<this.o_.key(this.D_[n].time)?t?n:null:n}Ki(){return this.Mo===0||this.D_.length===0||this.R_===null}tu(){return this.D_.length>0}Pe(){return this.iu(),this.I_.y_()}su(){return this.iu(),this.I_.k_()}nu(){let e=this.Pe();if(e===null)return null;let t={from:e.Uh(),to:e.bi()};return this.eu(t)}eu(e){let t=Math.round(e.from),n=Math.round(e.to),r=T(this.ru()),i=T(this.hu());return{from:T(this.ss(Math.max(r,t))),to:T(this.ss(Math.min(i,n)))}}au(e){return{from:T(this.Q_(e.from,!0)),to:T(this.Q_(e.to,!0))}}Qi(){return this.Mo}Eo(e){if(!isFinite(e)||e<=0||this.Mo===e)return;let t=this.su(),n=this.Mo;if(this.Mo=e,this.E_=!0,this.Ps.lockVisibleTimeRangeOnResize&&n!==0&&(this.q_=this.q_*e/n),this.Ps.fixLeftEdge&&t!==null&&t.Uh()<=0){let t=n-e;this.U_-=Math.round(t/this.q_)+1,this.E_=!0}this.lu(),this.ou()}qt(e){if(this.Ki()||!xe(e))return 0;let t=this._u()+this.U_-e;return this.Mo-(t+.5)*this.q_-1}uu(e,t){let n=this._u(),r=t===void 0?0:t.from,i=t===void 0?e.length:t.to;for(let t=r;t<i;t++){let r=e[t].wt,i=n+this.U_-r,a=this.Mo-(i+.5)*this.q_-1;e[t]._t=a}}cu(e,t){let n=Math.ceil(this.du(e));return t&&this.Ps.ignoreWhitespaceIndices&&!this.fu(n)?this.pu(n):n}fn(e){this.E_=!0,this.U_=e,this.ou(),this.ts.vu(),this.ts.ar()}mu(){return this.q_}dn(e){let t=this.q_;this.wu(e),this.Ps.rightOffsetPixels!==void 0&&t!==0&&(this.U_=this.U_*t/this.q_),this.ou(),this.ts.vu(),this.ts.ar()}gu(){return this.U_}Da(){if(this.Ki())return null;if(this.N_!==null)return this.N_;let e=this.q_,t=5*(this.ts.N().layout.fontSize+4)/8*(this.Ps.tickMarkMaxCharacterLength||8),n=Math.round(t/e),r=T(this.Pe()),i=Math.max(r.Uh(),r.Uh()-n),a=Math.max(r.bi(),r.bi()-n),o=this.V_.M_(e,t,this.Ps.ignoreWhitespaceIndices,this.F_,this.W_),s=this.ru()+n,c=this.hu()-n,l=this.Mu(),u=this.Ps.fixLeftEdge||l,d=this.Ps.fixRightEdge||l,f
2=0;for(let e of o){if(!(i<=e.index&&e.index<=a))continue;let n;f<this.H_.length?(n=this.H_[f],n.coord=this.qt(e.index),n.label=this.bu(e),n.weight=e.weight):(n={needAlignCoordinate:!1,coord:this.qt(e.index),label:this.bu(e),weight:e.weight},this.H_.push(n)),this.q_>t/2&&!l?n.needAlignCoordinate=!1:n.needAlignCoordinate=u&&e.index<=s||d&&e.index>=c,f++}return this.H_.length=f,this.N_=this.H_,this.H_}Su(){let e;this.E_=!0,this.dn(this.Ps.barSpacing),e=this.Ps.rightOffsetPixels===void 0?this.Ps.rightOffset:this.Ps.rightOffsetPixels/this.mu(),this.fn(e)}xu(e){this.E_=!0,this.R_=e,this.ou(),this.G_()}Cu(e,t){let n=this.du(e),r=this.mu(),i=r+r/10*t;this.dn(i),this.Ps.rightBarStaysOnScroll||this.fn(this.gu()+(n-this.du(e)))}no(e){this.ml&&this.lo(),this.vl===null&&this.O_===null&&(this.Ki()||(this.vl=e,this.Pu()))}eo(e){if(this.O_===null)return;let t=R(this.Mo-e,0,this.Mo),n=R(this.Mo-T(this.vl),0,this.Mo);t!==0&&n!==0&&this.dn(this.O_.mu*t/n)}ro(){this.vl!==null&&(this.vl=null,this.yu())}ho(e){this.ml===null&&this.O_===null&&(this.Ki()||(this.ml=e,this.Pu()))}ao(e){if(this.ml===null)return;let t=(this.ml-e)/this.mu();this.U_=T(this.O_).gu+t,this.E_=!0,this.ou()}lo(){this.ml!==null&&(this.ml=null,this.yu())}ku(){this.Tu(this.Ps.rightOffset)}Tu(e,t=400){if(!isFinite(e))throw RangeError(`offset is required and must be finite number`);if(!isFinite(t)||t<=0)throw RangeError(`animationDuration (optional) must be finite positive number`);let n=this.U_,r=performance.now();this.ts._n({Ru:e=>(e-r)/t>=1,Du:i=>{let a=(i-r)/t;return a>=1?e:n+(e-n)*a}})}yt(e,t){this.E_=!0,this.D_=e,this.V_.w_(e,t),this.ou()}Vu(){return this.A_}Bu(){return this.z_}Iu(){return this.L_}_u(){return this.R_||0}Eu(e,t){let n=e.f_(),r=t&&this.Ps.rightOffsetPixels||0;this.wu((this.Mo-r)/n),this.U_=e.bi()-this._u(),t&&(this.U_=r?r/this.mu():this.Ps.rightOffset),this.ou(),this.E_=!0,this.ts.vu(),this.ts.ar()}Au(){let e=this.ru(),t=this.hu();e!==null&&t!==null&&this.Eu(new W(e,t),!0)}zu(e){let t=new W(e.from,e.to);this.Eu(t)}ns(e){return this.bl.timeFormatter===void 0?this.o_.formatHorzItem(e.time):this.bl.timeFormatter(e.originalTime)}K_(){if(!this.Ps.ignoreWhitespaceIndices)return;this.F_.clear();let e=this.ts.js();for(let t of e)for(let e of t.va())this.F_.set(e,!0);this.W_++}Mu(){let e=this.ts.N().handleScroll,t=this.ts.N().handleScale;return!(e.horzTouchDrag||e.mouseWheel||e.pressedMouseMove||e.vertTouchDrag||t.axisDoubleClickReset.time||t.axisPressedMouseMove.time||t.mouseWheel||t.pinch)}ru(){return this.D_.length===0?null:0}hu(){return this.D_.length===0?null:this.D_.length-1}Lu(e){return(this.Mo-1-e)/this.q_}du(e){let t=this.Lu(e),n=this._u()+this.U_-t;return Math.round(1e6*n)/1e6}wu(e){let t=this.q_;this.q_=e,this.lu(),t!==this.q_&&(this.E_=!0,this.Ou())}iu(){if(!this.E_)return;if(this.E_=!1,this.Ki())return void this.Nu(Sn.T_());let e=this._u(),t=this.Mo/this.q_,n=this.U_+e,r=new W(n-t+1,n);this.Nu(new Sn(r))}lu(){let e=R(this.q_,this.Fu(),this.Wu());this.q_!==e&&(this.q_=e,this.E_=!0)}Wu(){return this.Ps.maxBarSpacing>0?this.Ps.maxBarSpacing:.5*this.Mo}Fu(){return this.Ps.fixLeftEdge&&this.Ps.fixRightEdge&&this.D_.length!==0?this.Mo/this.D_.length:this.Ps.minBarSpacing}ou(){let e=this.Hu();e!==null&&this.U_<e&&(this.U_=e,this.E_=!0);let t=this.Uu();this.U_>t&&(this.U_=t,this.E_=!0)}Hu(){let e=this.ru(),t=this.R_;return e===null||t===null?null:e-t-1+(this.Ps.fixLeftEdge?this.Mo/this.q_:Math.min(2,this.D_.length))}Uu(){return this.Ps.fixRightEdge?0:this.Mo/this.q_-Math.min(2,this.D_.length)}Pu(){this.O_={mu:this.mu(),gu:this.gu()}}yu(){this.O_=null}bu(e){let t=this.B_.get(e.weight);return t===void 0&&(t=new yn((e=>this.$u(e)),this.o_),this.B_.set(e.weight,t)),t.__(e)}$u(e){return this.o_.formatTickmark(e,this.bl)}Nu(e){let t=this.I_;this.I_=e,bn(t.y_(),this.I_.y_())||this.A_.p(),bn(t.k_(),this.I_.k_())||this.z_.p(),this.Ou()}Ou(){this.N_=null}Z_(){this.Ou(),this.B_.clear()}j_(){this.o_.updateFormatter(this.bl)}G_(){if(!this.Ps.fixLeftEdge)return;let e=this.ru();if(e===null)return;let t=this.Pe();if(t===null)return;let n=t.Uh()-e;if(n<0){let e=this.U_-n-1;this.fn(e)}this.lu()}J_(){this.ou(),this.lu()}fu(e){return!this.Ps.ignoreWhitespaceIndices||this.F_.get(e)||!1}pu(e){let t=function*(e){let t=Math.round(e),n=t<e,r=1;for(;;)n?(yield t+r,yield t-r):(yield t-r,yield t+r),r++}(e),n=this.hu();for(;n;){let e=t.next().value;if(this.F_.get(e))return e;if(e<0||e>n)break}return e}Y_(e){if(e.rightOffsetPixels!==void 0){let t=e.rightOffsetPixels/(e.barSpacing||this.q_);this.ts.fn(t)}}},Tn,En,Dn,On,kn;(function(e){e[e.OnTouchEnd=0]=`OnTouchEnd`,e[e.OnNextTap=1]=`OnNextTap`})(Tn||={});var An=class{constructor(e,t,n){this.qu=[],this.Yu=[],this.Mo=0,this.ju=null,this.Ku=new D,this.Xu=new D,this.Zu=null,this.Gu=e,this.Ps=t,this.o_=n,this.Sl=new je(this.Ps.layout.colorParsers),this.Ju=new Oe(this),this.uh=new wn(this,t.timeScale,this.Ps.localization,n),this.Ct=new Qe(this,t.crosshair),this.Qu=new Jt(t.crosshair),t.addDefaultPane&&(this.tc(0),this.qu[0].Io(2)),this.sc=this.nc(0),this.ec=this.nc(1)}Ih(){this.rc(M.gn())}ar(){this.rc(M.wn())}Zh(){this.rc(new M(1))}Eh(e){let t=this.hc(e);this.rc(t)}ac(){return this.ju}lc(e){if(this.ju?.n_===e?.n_&&this.ju?.e_?.Kn===e?.e_?.Kn)return;let t=this.ju;this.ju=e,t!==null&&this.Eh(t.n_),e!==null&&e.n_!==t?.n_&&this.Eh(e.n_)}N(){return this.Ps}hr(e){O(this.Ps,e),this.qu.forEach((t=>t.Ro(e))),e.timeScale!==void 0&&this.uh.hr(e.timeScale),e.localization!==void 0&&this.uh.X_(e.localization),(e.leftPriceScale||e.rightPriceScale)&&this.Ku.p(),this.sc=this.nc(0),this.ec=this.nc(1),this.Ih()}oc(e,t,n=0){let r=this.qu[n];if(r===void 0)return;if(e===`left`)return O(this.Ps,{leftPriceScale:t}),r.Ro({leftPriceScale:t}),this.Ku.p(),void this.Ih();if(e===`right`)return O(this.Ps,{rightPriceScale:t}),r.Ro({rightPriceScale:t}),this.Ku.p(),void this.Ih();let i=this._c(e,n);i!==null&&(i.Ft.hr(t),this.Ku.p())}_c(e,t){let n=this.qu[t];if(n===void 0)return null;let r=n.Do(e);return r===null?null:{Us:n,Ft:r}}Et(){return this.uh}$s(){return this.qu}uc(){return this.Ct}cc(){return this.Xu}dc(e,t){e.Al(t),this.vu()}Eo(e){this.Mo=e,this.uh.Eo(this.Mo),this.qu.forEach((t=>t.Eo(e))),this.vu()}fc(e){this.qu.length!==1&&(C(e>=0&&e<this.qu.length,`Invalid pane index`),this.qu.splice(e,1),this.Ih())}vc(e,t){if(this.qu.length<2)return;C(e>=0&&e<this.qu.length,`Invalid pane index`);let n=this.qu[e],r=this.qu.reduce(((e,t)=>e+t.Bo()),0),i=this.qu.reduce(((e,t)=>e+t.$t()),0),a=i-30*(this.qu.length-1);t=Math.min(a,Math.max(30,t));let o=r/i,s=n.$t();n.Io(t*o);let c=t-s,l=this.qu.length-1;for(let e of this.qu)if(e!==n){let t=Math.min(a,Math.max(30,e.$t()-c/l));c-=e.$t()-t,--l;let n=t*o;e.Io(n)}this.Ih()}mc(e,t){C(e>=0&&e<this.qu.length&&t>=0&&t<this.qu.length,`Invalid pane index`);let n=this.qu[e],r=this.qu[t];this.qu[e]=r,this.qu[t]=n,this.Ih()}wc(e,t){if(C(e>=0&&e<this.qu.length&&t>=0&&t<this.qu.length,`Invalid pane index`),e===t)return;let[n]=this.qu.splice(e,1);this.qu.splice(t,0,n),this.Ih()}
2Uo(e,t,n){e.Uo(t,n)}$o(e,t,n){e.$o(t,n),this.Ah(),this.rc(this.gc(e,2))}qo(e,t){e.qo(t),this.rc(this.gc(e,2))}Yo(e,t,n){t.Tl()||e.Yo(t,n)}jo(e,t,n){t.Tl()||(e.jo(t,n),this.Ah(),this.rc(this.gc(e,2)))}Ko(e,t){t.Tl()||(e.Ko(t),this.rc(this.gc(e,2)))}Zo(e,t){e.Zo(t),this.rc(this.gc(e,2))}Mc(e){this.uh.no(e)}bc(e,t){let n=this.Et();if(n.Ki()||t===0)return;let r=n.Qi();e=Math.max(1,Math.min(e,r)),n.Cu(e,t),this.vu()}Sc(e){this.xc(0),this.Cc(e),this.Pc()}yc(e){this.uh.eo(e),this.vu()}kc(){this.uh.ro(),this.ar()}xc(e){this.uh.ho(e)}Cc(e){this.uh.ao(e),this.vu()}Pc(){this.uh.lo(),this.ar()}js(){return this.Yu}Tc(e,t,n,r,i){this.Ct.Vs(e,t);let a=NaN,o=this.uh.cu(e,!0),s=this.uh.Pe();s!==null&&(o=Math.min(Math.max(s.Uh(),o),s.bi()));let c=r.ks(),l=c.zt();if(l!==null&&(a=c.Ts(t,l)),a=this.Qu.ga(a,o,r),this.Ct.As(o,a,r),this.Zh(),!i){let i=vn(r,e,t);this.lc(i&&{n_:i.n_,e_:i.e_,h_:i.h_||null}),this.Xu.p(this.Ct.It(),{x:e,y:t},n)}}Rc(e,t,n){let r=n.ks(),i=r.zt(),a=r.Nt(e,T(i)),o=this.uh.Q_(t,!0),s=this.uh.qt(T(o));this.Tc(s,a,null,n,!0)}Dc(e){this.uc().Ls(),this.Zh(),e||this.Xu.p(null,null,null)}Ah(){let e=this.Ct.Us();if(e!==null){let t=this.Ct.Is(),n=this.Ct.Es();this.Tc(t,n,null,e)}this.Ct.Ns()}Vc(e,t,n){let r=this.uh.Rs(0);t!==void 0&&n!==void 0&&this.uh.yt(t,n);let i=this.uh.Rs(0),a=this.uh._u(),o=this.uh.Pe();if(o!==null&&r!==null&&i!==null){let t=o.Te(a),s=this.o_.key(r)>this.o_.key(i),c=e!==null&&e>a&&!s,l=this.uh.N().allowShiftVisibleRangeOnWhitespaceReplacement,u=t&&(n!==void 0||l)&&this.uh.N().shiftVisibleRangeOnNewBar;if(c&&!u){let t=e-a;this.uh.fn(this.uh.gu()-t)}}this.uh.xu(e)}Lh(e){e!==null&&e.Jo()}Hn(e){if(function(e){return e instanceof mn}(e))return e;let t=this.qu.find((t=>t.Dt().includes(e)));return t===void 0?null:t}vu(){this.qu.forEach((e=>e.Jo())),this.Ah()}m(){this.qu.forEach((e=>e.m())),this.qu.length=0,this.Ps.localization.priceFormatter=void 0,this.Ps.localization.percentageFormatter=void 0,this.Ps.localization.timeFormatter=void 0}Bc(){return this.Ju}Yn(){return this.Ju.N()}Vo(){return this.Ku}Ic(e,t){let n=this.tc(t);this.Ec(e,n),this.Yu.push(e),this.Yu.length===1?this.Ih():this.ar()}Ac(e){let t=this.Hn(e),n=this.Yu.indexOf(e);C(n!==-1,`Series not found`);let r=T(t);this.Yu.splice(n,1),r.Ql(e),e.m&&e.m(),this.uh.K_(),this.zc(r)}Bh(e,t){let n=T(this.Hn(e));n.Ql(e,!0),n.Gl(e,t,!0)}Au(){let e=M.wn();e.rn(),this.rc(e)}Lc(e){let t=M.wn();t.ln(e),this.rc(t)}cn(){let e=M.wn();e.cn(),this.rc(e)}dn(e){let t=M.wn();t.dn(e),this.rc(t)}fn(e){let t=M.wn();t.fn(e),this.rc(t)}_n(e){let t=M.wn();t._n(e),this.rc(t)}hn(){let e=M.wn();e.hn(),this.rc(e)}Oc(){return this.Ps.rightPriceScale.visible?`right`:`left`}Nc(e,t){if(C(t>=0,`Index should be greater or equal to 0`),t===this.Fc(e))return;let n=T(this.Hn(e));n.Ql(e);let r=this.tc(t);this.Ec(e,r),n.Ma().length===0&&this.zc(n),this.Ih()}Wc(){return this.ec}$(){return this.sc}Ut(e){let t=this.ec,n=this.sc;if(t===n)return t;if(e=Math.max(0,Math.min(100,Math.round(100*e))),this.Zu===null||this.Zu.mr!==n||this.Zu.wr!==t)this.Zu={mr:n,wr:t,Hc:new Map};else{let t=this.Zu.Hc.get(e);if(t!==void 0)return t}let r=this.Sl.tt(n,t,e/100);return this.Zu.Hc.set(e,r),r}Uc(e){return this.qu.indexOf(e)}Xi(){return this.Sl}$c(){return this.qc()}qc(e){let t=new mn(this.uh,this);this.qu.push(t);let n=e??this.qu.length-1,r=M.gn();return r.Qs(n,{tn:0,sn:!0}),this.rc(r),t}tc(e){return C(e>=0,`Index should be greater or equal to 0`),(e=Math.min(this.qu.length,e))<this.qu.length?this.qu[e]:this.qc(e)}Fc(e){return this.qu.findIndex((t=>t.Oo().includes(e)))}gc(e,t){let n=new M(t);if(e!==null){let r=this.qu.indexOf(e);n.Qs(r,{tn:t})}return n}hc(e,t){return t===void 0&&(t=2),this.gc(this.Hn(e),t)}rc(e){this.Gu&&this.Gu(e),this.qu.forEach((e=>e.i_().lr().yt()))}Ec(e,t){let n=e.N().priceScaleId,r=n===void 0?this.Oc():n;t.Gl(e,r),$e(r)||e.hr(e.N())}nc(e){let t=this.Ps.layout;return t.background.type===`gradient`?e===0?t.background.topColor:t.background.bottomColor:t.background.color}zc(e){!e.Lo()&&e.Ma().length===0&&this.qu.length>1&&this.qu.splice(this.Uc(e),1)}};function jn(e){if(e>=1)return 0;let t=0;for(;t<8;t++){if(Math.abs(Math.round(e)-e)<1e-8)return t;e*=10}return t}function Mn(e){return!k(e)&&!Se(e)}function Nn(e){return k(e)}(function(e){e[e.Disabled=0]=`Disabled`,e[e.Continuous=1]=`Continuous`,e[e.OnDataU
2pdate=2]=`OnDataUpdate`})(En||={}),function(e){e[e.LastBar=0]=`LastBar`,e[e.LastVisible=1]=`LastVisible`}(Dn||={}),function(e){e.Solid=`solid`,e.VerticalGradient=`gradient`}(On||={}),function(e){e[e.Year=0]=`Year`,e[e.Month=1]=`Month`,e[e.DayOfMonth=2]=`DayOfMonth`,e[e.Time=3]=`Time`,e[e.TimeWithSeconds=4]=`TimeWithSeconds`}(kn||={});var Pn=e=>e.getUTCFullYear();function Fn(e,t,n){return t.replace(/yyyy/g,(e=>N(Pn(e),4))(e)).replace(/yy/g,(e=>N(Pn(e)%100,2))(e)).replace(/MMMM/g,((e,t)=>new Date(e.getUTCFullYear(),e.getUTCMonth(),1).toLocaleString(t,{month:`long`}))(e,n)).replace(/MMM/g,((e,t)=>new Date(e.getUTCFullYear(),e.getUTCMonth(),1).toLocaleString(t,{month:`short`}))(e,n)).replace(/MM/g,(e=>N((e=>e.getUTCMonth()+1)(e),2))(e)).replace(/dd/g,(e=>N((e=>e.getUTCDate())(e),2))(e))}var In=class{constructor(e=`yyyy-MM-dd`,t=`default`){this.Yc=e,this.jc=t}__(e){return Fn(e,this.Yc,this.jc)}},Ln=class{constructor(e){this.Kc=e||`%h:%m:%s`}__(e){return this.Kc.replace(`%h`,N(e.getUTCHours(),2)).replace(`%m`,N(e.getUTCMinutes(),2)).replace(`%s`,N(e.getUTCSeconds(),2))}},Rn={Xc:`yyyy-MM-dd`,Zc:`%h:%m:%s`,Gc:` `,Jc:`default`},zn=class{constructor(e={}){let t={...Rn,...e};this.Qc=new In(t.Xc,t.Jc),this.td=new Ln(t.Zc),this.sd=t.Gc}__(e){return`${this.Qc.__(e)}${this.sd}${this.td.__(e)}`}};function Bn(e){return 60*e*60*1e3}function Vn(e){return 60*e*1e3}var Hn=[{nd:(Un=1,1e3*Un),ed:10},{nd:Vn(1),ed:20},{nd:Vn(5),ed:21},{nd:Vn(30),ed:22},{nd:Bn(1),ed:30},{nd:Bn(3),ed:31},{nd:Bn(6),ed:32},{nd:Bn(12),ed:33}],Un;function Wn(e,t){if(e.getUTCFullYear()!==t.getUTCFullYear())return 70;if(e.getUTCMonth()!==t.getUTCMonth())return 60;if(e.getUTCDate()!==t.getUTCDate())return 50;for(let n=Hn.length-1;n>=0;--n)if(Math.floor(t.getTime()/Hn[n].nd)!==Math.floor(e.getTime()/Hn[n].nd))return Hn[n].ed;return 0}function Gn(e){let t=e;if(Se(e)&&(t=qn(e)),!Mn(t))throw Error(`time must be of type BusinessDay`);let n=new Date(Date.UTC(t.year,t.month-1,t.day,0,0,0,0));return{rd:Math.round(n.getTime()/1e3),hd:t}}function Kn(e){if(!Nn(e))throw Error(`time must be of type isUTCTimestamp`);return{rd:e}}function qn(e){let t=new Date(e);if(isNaN(t.getTime()))throw Error(`Invalid date string=${e}, expected format=yyyy-mm-dd`);return{day:t.getUTCDate(),month:t.getUTCMonth()+1,year:t.getUTCFullYear()}}function Jn(e){Se(e.time)&&(e.time=qn(e.time))}var Yn=class{options(){return this.Ps}setOptions(e){this.Ps=e,this.updateFormatter(e.localization)}preprocessData(e){Array.isArray(e)?function(e){e.forEach(Jn)}(e):Jn(e)}createConverterToInternalObj(e){return T(function(e){return e.length===0?null:Mn(e[0].time)||Se(e[0].time)?Gn:Kn}(e))}key(e){return typeof e==`object`&&`rd`in e?e.rd:this.key(this.convertHorzItemToInternal(e))}cacheKey(e){let t=e;return t.hd===void 0?new Date(1e3*t.rd).getTime():new Date(Date.UTC(t.hd.year,t.hd.month-1,t.hd.day)).getTime()}convertHorzItemToInternal(e){return Nn(t=e)?Kn(t):Mn(t)?Gn(t):Gn(qn(t));var t}updateFormatter(e){if(!this.Ps)return;let t=e.dateFormat;this.Ps.timeScale.timeVisible?this.ad=new zn({Xc:t,Zc:this.Ps.timeScale.secondsVisible?`%h:%m:%s`:`%h:%m`,Gc:` `,Jc:e.locale}):this.ad=new In(t,e.locale)}formatHorzItem(e){let t=e;return this.ad.__(new Date(1e3*t.rd))}formatTickmark(e,t){let n=function(e,t,n){switch(e){case 0:case 10:return t?n?4:3:2;case 20:case 21:case 22:case 30:case 31:case 32:case 33:return t?3:2;case 50:return 2;case 60:return 1;case 70:return 0}}(e.weight,this.Ps.timeScale.timeVisible,this.Ps.timeScale.secondsVisible),r=this.Ps.timeScale;if(r.tickMarkFormatter!==void 0){let i=r.tickMarkFormatter(e.originalTime,n,t.locale);if(i!==null)return i}return function(e,t,n){let r={};switch(t){case 0:r.year=`numeric`;break;case 1:r.month=`short`;break;case 2:r.day=`numeric`;break;case 3:r.hour12=!1,r.hour=`2-digit`,r.minute=`2-digit`;break;case 4:r.hour12=!1,r.hour=`2-digit`,r.minute=`2-digit`,r.second=`2-digit`}let i=e.hd===void 0?new Date(1e3*e.rd):new Date(Date.UTC(e.hd.year,e.hd.month-1,e.hd.day));return new Date(i.getUTCFullYear(),i.getUTCMonth(),i.getUTCDate(),i.getUTCHours(),i.getUTCMinutes(),i.getUTCSeconds(),i.getUTCMilliseconds()).toLocaleStr
2ing(n,r)}(e.time,n,t.locale)}maxTickMarkWeight(e){let t=e.reduce(Cn,e[0]).weight;return t>30&&t<50&&(t=30),t}fillWeightsForPoints(e,t){(function(e,t=0){if(e.length===0)return;let n=t===0?null:e[t-1].time.rd,r=n===null?null:new Date(1e3*n),i=0;for(let a=t;a<e.length;++a){let t=e[a],o=new Date(1e3*t.time.rd);r!==null&&(t.timeWeight=Wn(o,r)),i+=t.time.rd-(n||t.time.rd),n=t.time.rd,r=o}if(t===0&&e.length>1){let t=Math.ceil(i/(e.length-1)),n=new Date(1e3*(e[0].time.rd-t));e[0].timeWeight=Wn(new Date(1e3*e[0].time.rd),n)}})(e,t)}static ld(e){return O({localization:{dateFormat:`dd MMM 'yy`}},e??{})}},G=typeof window<`u`;function Xn(){return!!G&&window.navigator.userAgent.toLowerCase().indexOf(`firefox`)>-1}function Zn(){return!!G&&/iPhone|iPad|iPod/.test(window.navigator.platform)}function Qn(e){return e+e%2}function $n(e){G&&window.chrome!==void 0&&e.addEventListener(`mousedown`,(e=>{if(e.button===1)return e.preventDefault(),!1}))}var er=class{constructor(e,t,n){this.od=0,this._d=null,this.ud={_t:-1/0,ut:1/0},this.dd=0,this.fd=null,this.pd={_t:-1/0,ut:1/0},this.vd=null,this.md=!1,this.wd=null,this.gd=null,this.Md=!1,this.bd=!1,this.Sd=!1,this.xd=null,this.Cd=null,this.Pd=null,this.yd=null,this.kd=null,this.Td=null,this.Rd=null,this.Dd=0,this.Vd=!1,this.Bd=!1,this.Id=!1,this.Ed=0,this.Ad=null,this.zd=!Zn(),this.Ld=e=>{this.Od(e)},this.Nd=e=>{if(this.Fd(e)){let t=this.Wd(e);if(++this.dd,this.fd&&this.dd>1){let{Hd:n}=this.Ud(q(e),this.pd);n<30&&!this.Sd&&this.$d(t,this.Yd.qd),this.jd()}}else{let t=this.Wd(e);if(++this.od,this._d&&this.od>1){let{Hd:n}=this.Ud(q(e),this.ud);n<5&&!this.bd&&this.Kd(t,this.Yd.Xd),this.Zd()}}},this.Gd=e,this.Yd=t,this.Ps=n,this.Jd()}m(){this.xd!==null&&(this.xd(),this.xd=null),this.Cd!==null&&(this.Cd(),this.Cd=null),this.yd!==null&&(this.yd(),this.yd=null),this.kd!==null&&(this.kd(),this.kd=null),this.Td!==null&&(this.Td(),this.Td=null),this.Pd!==null&&(this.Pd(),this.Pd=null),this.Qd(),this.Zd()}tf(e){this.yd&&this.yd();let t=this.if.bind(this);if(this.yd=()=>{this.Gd.removeEventListener(`mousemove`,t)},this.Gd.addEventListener(`mousemove`,t),this.Fd(e))return;let n=this.Wd(e);this.Kd(n,this.Yd.sf),this.zd=!0}Zd(){this._d!==null&&clearTimeout(this._d),this.od=0,this._d=null,this.ud={_t:-1/0,ut:1/0}}jd(){this.fd!==null&&clearTimeout(this.fd),this.dd=0,this.fd=null,this.pd={_t:-1/0,ut:1/0}}if(e){if(this.Id||this.gd!==null||this.Fd(e))return;let t=this.Wd(e);this.Kd(t,this.Yd.nf),this.zd=!0}ef(e){let t=rr(e.changedTouches,T(this.Ad));if(t===null||(this.Ed=nr(e),this.Rd!==null)||this.Bd)return;this.Vd=!0;let{rf:n,hf:r,Hd:i}=this.Ud(q(t),T(this.gd));if(this.Md||!(i<5)){if(!this.Md){let e=.5*n,t=r>=e&&!this.Ps.af(),i=e>r&&!this.Ps.lf();t||i||(this.Bd=!0),this.Md=!0,this.Sd=!0,this.Qd(),this.jd()}if(!this.Bd){let n=this.Wd(e,t);this.$d(n,this.Yd._f),K(e)}}}uf(e){if(e.button!==0)return;let{Hd:t}=this.Ud(q(e),T(this.wd));if(t>=5&&(this.bd=!0,this.Zd()),this.bd){let t=this.Wd(e);this.Kd(t,this.Yd.cf)}}Ud(e,t){let n=Math.abs(t._t-e._t),r=Math.abs(t.ut-e.ut);return{rf:n,hf:r,Hd:n+r}}df(e){let t=rr(e.changedTouches,T(this.Ad));if(t===null&&e.touches.length===0&&(t=e.changedTouches[0]),t===null)return;this.Ad=null,this.Ed=nr(e),this.Qd(),this.gd=null,this.Td&&=(this.Td(),null);let n=this.Wd(e,t);if(this.$d(n,this.Yd.ff),++this.dd,this.fd&&this.dd>1){let{Hd:e}=this.Ud(q(t),this.pd);e<30&&!this.Sd&&this.$d(n,this.Yd.qd),this.jd()}else this.Sd||(this.$d(n,this.Yd.pf),this.Yd.pf&&K(e));this.dd===0&&K(e),e.touches.length===0&&this.md&&(this.md=!1,K(e))}Od(e){if(e.button!==0)return;let t=this.Wd(e);if(this.wd=null,this.Id=!1,this.kd&&=(this.kd(),null),Xn()&&this.Gd.ownerDocument.documentElement.removeEventListener(`mouseleave`,this.Ld),!this.Fd(e))if(this.Kd(t,this.Yd.vf),++this.od,this._d&&this.od>1){let{Hd:n}=this.Ud(q(e),this.ud);n<5&&!this.bd&&this.Kd(t,this.Yd.Xd),this.Zd()}else this.bd||this.Kd(t,this.Yd.mf)}Qd(){this.vd!==null&&(clearTimeout(this.vd),this.vd=null)}wf(e){if(this.Ad!==null)return;let t=e.changedTouches[0];this.Ad=t.identifier,this.Ed=nr(e);let n=this.Gd.ownerDocument.documentElement;this.Sd=!1,this.Md=!1,this.Bd=!1,this.gd=q(t),this.Td&&=(this.Td(),null);{let t=this.ef.bind(this),r=this.df.bind(this);this.Td=()=>{n.removeEventListener(`touchmove`,t),n.removeEventListener(`touchend`,r)},n.addEventListener(`touchmove`,t,{passive:!1}),n.addEventListener(`touchend`,r,{passive:!1}),this.Qd(),this.vd=setTimeout(this.gf.bind(this,e),240)}let r=this.Wd(e,t);this.$d(r,this.Yd.Mf),this.fd||(this.dd=0,this.fd=setTimeout(this.jd.bind(this),500),this.pd=q(t))}bf(e){if(e.button!==0)return;let t=this.Gd.ownerDocument.documentElement;Xn()&&t.addEventListener(`mouseleave`,this.Ld),this.bd=!1,this.wd=q(e),this.kd&&=(this.kd(),null);{let e=this.uf.bind(this),n=this.Od.bind(this);this.kd=()=>{t.removeEventListener(`mousemove`,e),t.removeEventListener(`mouseup`,n)},t.addEventListener(`mousemove`,e),t.addEventListener(`mouseup`,n)}if(this.Id=!0,this.Fd(e))return;let n=this.Wd(e);this.Kd(n,this.Yd.Sf),this._d||(this.od=0,this._d=setTimeout(this.Zd.bind(this),500),this.ud=q(e))}Jd(){this.Gd.addEventListener(`mouseenter`,this.tf.bind(this)),this.Gd.addEventListener(`touchcancel`,this.Qd.bind(this));{let e=this.Gd.ownerDocument,t=e=>{this.Yd.xf&&(e.composed&&this.Gd.contains(e.composedPath()[0])||e.target&&this.Gd.contains(e.target)||this.Yd.xf())};this.Cd=()=>{e.removeEventListener(`touchstart`,t)},this.xd=()=>{e.removeEventListener(`mousedown`,t)},e.addEventListener(`mousedown`,t),e.addEventListener(`touchstart`,t,{passive:!0})}Zn()&&(this.Pd=()=>{this.Gd.removeEventListener(`dblclick`,this.Nd)},this.Gd.addEventListener(`dblclick`,this.Nd)),this.Gd.addEventListener(`mouseleave`,this.Cf.bind(this)),this.Gd.addEventListener(`touchstart`,this.wf.bind(this),{passive:!0}),$n(this.Gd),this.Gd.addEventListener(`mousedown`,this.bf.bind(this)),this.Pf(),this.Gd.addEventListener(`touchmove`,(()=>{}),{passive:!1})}Pf(){this.Yd.yf===void 0&&this.Yd.kf===void 0&&this.Yd.Tf===void 0||(this.Gd.addEventListener(`touchstart`,(e=>this.Rf(e.touches)),{passive:!0}),this.Gd.addEventListener(`touchmove`,(e=>{if(e.touches.length===2&&this.Rd!==null&&this.Yd.kf!==void 0){let t=tr(e.touches[0],e.touches[1])/this.Dd;this.Yd.kf(this.Rd,t),K(e)}}),{passive:!1}),this.Gd.addEventListener(`touchend`,(e=>{this.Rf(e.touches)})))}Rf(e){e.length===1&&(this.Vd=!1),e.length!==2||this.Vd||this.md?this.Df():this.Vf(e)}Vf(e){let t=this.Gd.getBoundingClientRect()||{left:0,top:0};this.Rd={_t:(e[0].clientX-t.left+(e[1].clientX-t.left))/2,ut:(e[0].clientY-t.top+(e[1].clientY-t.top))/2},this.Dd=tr(e[0],e[1]),this.Yd.yf!==void 0&&this.Yd.yf(),this.Qd()}Df(){this.Rd!==null&&(this.Rd=null,this.Yd.Tf!==void 0&&this.Yd.Tf())}Cf(e){if(this.yd&&this.yd(),this.Fd(e)||!this.zd)return;let t=this.Wd(e);this.Kd(t,this.Yd.Bf),this.zd=!Zn()}gf(e){let t=rr(e.touches,T(this.Ad));if(t===null)return;let n=this.Wd(e,t);this.$d(n,this.Yd.If),this.Sd=!0,this.md=!0}Fd(e){return e.sourceCapabilities&&e.sourceCapabilities.firesTouchEvents!==void 0?e.sourceCapabilities.firesTouchEvents:nr(e)<this.Ed+500}$d(e,t){t&&t.call(this.Yd,e)}Kd(e,t){t&&t.call(this.Yd,e)}Wd(e,t){let n=t||e,r=this.Gd.getBoundingClientRect()||{left:0,top:0};return{clientX:n.clientX,clientY:n.clientY,pageX:n.pageX,pageY:n.pageY,screenX:n.screenX,screenY:n.screenY,localX:n.clientX-r.left,localY:n.clientY-r.top,ctrlKey:e.ctrlKey,altKey:e.altKey,shiftKey:e.shiftKey,metaKey:e.metaKey,Ef:!e.type.startsWith(`mouse`)&&e.type!==`contextmenu`&&e.type!==`click`,Af:e.type,zf:n.target,a_:e.view,Lf:()=>{e.type!==`touchstart`&&K(e)}}}};function tr(e,t){let n=e.clientX-t.clientX,r=e.clientY-t.clientY;return Math.sqrt(n*n+r*r)}function K(e){e.cancelable&&e.preventDefault()}function q(e){return{_t:e.pageX,ut:e.pageY}}function nr(e){return e.timeStamp||performance.now()}function rr(e,t){for(let n=0;n<e.length;++n)if(e[n].identifier===t)return e[n];return null}var ir=class{constructor(e,t,n){this.Of=null,this.Nf=null,this.Ff=!0,this.Wf=null,this.Hf=e,this.Uf=e.$f()[t],this.qf=e.$f()[n],this.Yf=document.createElement(`tr`),this.Yf.style.height=`1px`,this.jf=document.createElement(`td`),this.jf.style.position=`relative`,this.jf.style.padding=`0`,this.jf.style.margin=`0`,this.jf.setAttribute(`colspan`,`3`),this.Kf(),this.Yf.appendChild(this.jf),this.Ff=this.Hf.N().layout.panes.enableResize,this.Ff?this.Xf():(this.Of=null,this.Nf=null)}m(){this.Nf!==null&&this.Nf.m()}Zf(){return this.Yf}Gf(){return _({width:this.Uf.Gf().width,height:1})}Jf(){return _({width:this.Uf.Jf().width,height:1*window.devicePixelRatio})}Qf(e,t,n){let r=this.Jf();e.fillStyle=this.Hf.N().layout.panes.separatorColor,e.fillRect(t,n,r.width,r.height)}yt(){this.Kf(),this.Hf.N().layout.panes.enableResize!==this.Ff&&(this.Ff=this.Hf.N().layout.panes.enableResize,this.Ff?this.Xf():(this.Of!==null&&(this.jf.removeChild(this.Of.tp),this.jf.removeChild(this.Of.ip),this.Of=null),this.Nf!==null&&(this.Nf.m(),this.Nf=null)))}Xf(){let e=document.createElement(`div`),t=e.style;t.position=`fixed`,t.display=`none`,t.zIndex=`49`,t.top=`0`,t.left=`0`,t.width=`100%`,t.height=`100%`,t.curs
2or=`row-resize`,this.jf.appendChild(e);let n=document.createElement(`div`),r=n.style;r.position=`absolute`,r.zIndex=`50`,r.top=`-4px`,r.height=`9px`,r.width=`100%`,r.backgroundColor=``,r.cursor=`row-resize`,this.jf.appendChild(n),this.Nf=new er(n,{sf:this.sp.bind(this),Bf:this.np.bind(this),Sf:this.ep.bind(this),Mf:this.ep.bind(this),cf:this.rp.bind(this),_f:this.rp.bind(this),vf:this.hp.bind(this),ff:this.hp.bind(this)},{af:()=>!1,lf:()=>!0}),this.Of={ip:n,tp:e}}Kf(){this.jf.style.background=this.Hf.N().layout.panes.separatorColor}sp(e){this.Of!==null&&(this.Of.ip.style.backgroundColor=this.Hf.N().layout.panes.separatorHoverColor)}np(e){this.Of!==null&&this.Wf===null&&(this.Of.ip.style.backgroundColor=``)}ep(e){if(this.Of===null)return;let t=this.Uf.ap().Bo()+this.qf.ap().Bo(),n=t/(this.Uf.Gf().height+this.qf.Gf().height),r=30*n;t<=2*r||(this.Wf={lp:e.pageY,op:this.Uf.ap().Bo(),_p:t-r,up:t,cp:n,dp:r},this.Of.tp.style.display=`block`)}rp(e){let t=this.Wf;if(t===null)return;let n=(e.pageY-t.lp)*t.cp,r=R(t.op+n,t.dp,t._p);this.Uf.ap().Io(r),this.qf.ap().Io(t.up-r),this.Hf.Qt().Ih()}hp(e){this.Wf!==null&&this.Of!==null&&(this.Wf=null,this.Of.tp.style.display=`none`)}};function ar(e,t){return e.fp-t.fp}function or(e,t,n){let r=(e.fp-t.fp)/(e.wt-t.wt);return Math.sign(r)*Math.min(Math.abs(r),n)}var sr=class{constructor(e,t,n,r){this.pp=null,this.vp=null,this.mp=null,this.wp=null,this.gp=null,this.Mp=0,this.bp=0,this.Sp=e,this.xp=t,this.Cp=n,this.Mn=r}Pp(e,t){if(this.pp!==null){if(this.pp.wt===t)return void(this.pp.fp=e);if(Math.abs(this.pp.fp-e)<this.Mn)return}this.wp=this.mp,this.mp=this.vp,this.vp=this.pp,this.pp={wt:t,fp:e}}le(e,t){if(this.pp===null||this.vp===null||t-this.pp.wt>50)return;let n=0,r=or(this.pp,this.vp,this.xp),i=ar(this.pp,this.vp),a=[r],o=[i];if(n+=i,this.mp!==null){let e=or(this.vp,this.mp,this.xp);if(Math.sign(e)===Math.sign(r)){let t=ar(this.vp,this.mp);if(a.push(e),o.push(t),n+=t,this.wp!==null){let e=or(this.mp,this.wp,this.xp);if(Math.sign(e)===Math.sign(r)){let t=ar(this.mp,this.wp);a.push(e),o.push(t),n+=t}}}}let s=0;for(let e=0;e<a.length;++e)s+=o[e]/n*a[e];Math.abs(s)<this.Sp||(this.gp={fp:e,wt:t},this.bp=s,this.Mp=function(e,t){let n=Math.log(t);return Math.log(1*n/-e)/n}(Math.abs(s),this.Cp))}Du(e){let t=T(this.gp),n=e-t.wt;return t.fp+this.bp*(this.Cp**+n-1)/Math.log(this.Cp)}Ru(e){return this.gp===null||this.yp(e)===this.Mp}yp(e){let t=e-T(this.gp).wt;return Math.min(t,this.Mp)}},cr=class{constructor(e,t){this.kp=void 0,this.Tp=void 0,this.Rp=void 0,this.ps=!1,this.Dp=e,this.Vp=t,this.Bp()}yt(){this.Bp()}Ip(){this.kp&&this.Dp.removeChild(this.kp),this.Tp&&this.Dp.removeChild(this.Tp),this.kp=void 0,this.Tp=void 0}Ep(){return this.ps!==this.Ap()||this.Rp!==this.zp()}zp(){return this.Vp.Qt().Xi().J(this.Vp.N().layout.textColor)>160?`dark`:`light`}Ap(){return this.Vp.N().layout.attributionLogo}Lp(){let e=new URL(location.href);return e.hostname?`&utm_source=`+e.hostname+e.pathname:``}Bp(){this.Ep()&&(this.Ip(),this.ps=this.Ap(),this.ps&&(this.Rp=this.zp(),this.Tp=document.createElement(`style`),this.Tp.innerText=`a#tv-attr-logo{--fill:#131722;--stroke:#fff;position:absolute;left:10px;bottom:10px;height:19px;width:35px;margin:0;padding:0;border:0;z-index:3;}a#tv-attr-logo[data-dark]{--fill:#D1D4DC;--stroke:#131722;}`,this.kp=document.createElement(`a`),this.kp.href=`https://www.tradingview.com/?utm_medium=lwc-link&utm_campaign=lwc-chart${this.Lp()}`,this.kp.title=`Charting by TradingView`,this.kp.id=`tv-attr-logo`,this.kp.target=`_blank`,this.kp.innerHTML=`<svg xmlns="http://www.w3.org/2000/svg" width="35" height="19" fill="none"><g fill-rule="evenodd" clip-path="url(#a)" clip-rule="evenodd"><path fill="var(--stroke)" d="M2 0H0v10h6v9h21.4l.5-1.3 6-15 1-2.7H23.7l-.5 1.3-.2.6a5 5 0 0 0-7-.9V0H2Zm20 17h4l5.2-13 .8-2h-7l-1 2.5-.2.5-1.5 3.8-.3.7V17Zm-.8-10a3 3 0 0 0 .7-2.7A3 3 0 1 0 16.8 7h4.4ZM14 7V2H2v6h6v9h4V7h2Z"/><path fill="var(--fill)" d="M14 2H2v6h6v9h6V2Zm12 15h-7l6-15h7l-6 15Zm-7-9a3 3 0 1 0 0-6 3 3 0 0 0 0 6Z"/></g><defs><clipPath id="a"><path fill="var(--stroke)" d="M0 0h35v19H0z"/></clipPath></defs></svg>`,this.kp.toggleAttribute(`data-dark`,this.Rp===`dark`),this.Dp.appendChild(this.Tp),this.Dp.appendChild(this.kp)))}};function J(e,t){let n=T(e.ownerDocument).createElement(`canvas`);e.appendChild(n);let r=fe(n,{type:`device-pixel-content-box`,options:{allowResizeObserver:!0},transform:(e,t)=>
2({width:Math.max(e.width,t.width),height:Math.max(e.height,t.height)})});return r.resizeCanvasElement(t),r}function Y(e){e.width=1,e.height=1,e.getContext(`2d`)?.clearRect(0,0,1,1)}function lr(e,t,n,r){e.ih&&e.ih(t,n,r)}function ur(e,t,n,r){e.nt(t,n,r)}function dr(e,t,n,r){let i=e(n,r);for(let e of i){let n=e.Tt(r);n!==null&&t(n)}}function fr(e,t){return n=>function(e){return e.Ft!==void 0}(n)&&(n.Ft()?.ma()??``)===t?n.ta?.(e)??[]:[]}function pr(e,t,n,r){if(!e.length)return;let i=0,a=e[0].$t(r,!0),o=t===1?n/2-(e[0].Fi()-a/2):e[0].Fi()-a/2-n/2;o=Math.max(0,o);for(let a=1;a<e.length;a++){let s=e[a],c=e[a-1],l=c.$t(r,!1),u=s.Fi(),d=c.Fi();if(t===1?u>d-l:u<d+l){let r=d-l*t;s.Wi(r);let a=r-t*l/2;if((t===1?a<0:a>n)&&o>0){let r=t===1?-1-a:a-n,s=Math.min(r,o);for(let n=i;n<e.length;n++)e[n].Wi(e[n].Fi()+t*s);o-=s}}else i=a,o=t===1?d-l-u:u-(d+l)}}var mr=class{constructor(e,t,n,r){this.Yi=null,this.Op=null,this.Np=!1,this.Fp=new P(200),this.Wp=null,this.Hp=0,this.Up=!1,this.$p=()=>{this.Up||this.Pt.qp().Qt().ar()},this.Yp=()=>{this.Up||this.Pt.qp().Qt().ar()},this.Pt=e,this.Ps=t,this.Ml=t.layout,this.Ju=n,this.jp=r===`left`,this.Kp=fr(`normal`,r),this.Xp=fr(`top`,r),this.Zp=fr(`bottom`,r),this.jf=document.createElement(`div`),this.jf.style.height=`100%`,this.jf.style.overflow=`hidden`,this.jf.style.width=`25px`,this.jf.style.left=`0`,this.jf.style.position=`relative`,this.Gp=J(this.jf,_({width:16,height:16})),this.Gp.subscribeSuggestedBitmapSizeChanged(this.$p);let i=this.Gp.canvasElement;i.style.position=`absolute`,i.style.zIndex=`1`,i.style.left=`0`,i.style.top=`0`,this.Jp=J(this.jf,_({width:16,height:16})),this.Jp.subscribeSuggestedBitmapSizeChanged(this.Yp);let a=this.Jp.canvasElement;a.style.position=`absolute`,a.style.zIndex=`2`,a.style.left=`0`,a.style.top=`0`;let o={Sf:this.ep.bind(this),Mf:this.ep.bind(this),cf:this.rp.bind(this),_f:this.rp.bind(this),xf:this.Qp.bind(this),vf:this.hp.bind(this),ff:this.hp.bind(this),Xd:this.tv.bind(this),qd:this.tv.bind(this),sf:this.iv.bind(this),Bf:this.np.bind(this)};this.Nf=new er(this.Jp.canvasElement,o,{af:()=>!this.Ps.handleScroll.vertTouchDrag,lf:()=>!0})}m(){this.Nf.m(),this.Jp.unsubscribeSuggestedBitmapSizeChanged(this.Yp),Y(this.Jp.canvasElement),this.Jp.dispose(),this.Gp.unsubscribeSuggestedBitmapSizeChanged(this.$p),Y(this.Gp.canvasElement),this.Gp.dispose(),this.Yi!==null&&this.Yi.so().u(this),this.Yi=null}Zf(){return this.jf}P(){return this.Ml.fontSize}sv(){let e=this.Ju.N();return this.Wp!==e.k&&(this.Fp.Bn(),this.Wp=e.k),e}nv(){if(this.Yi===null)return 0;let e=0,t=this.sv(),n=T(this.Gp.canvasElement.getContext(`2d`,{colorSpace:this.Pt.qp().N().layout.colorSpace}));n.save();let r=this.Yi.Da();n.font=this.ev(),r.length>0&&(e=Math.max(this.Fp.Vi(n,r[0].Za),this.Fp.Vi(n,r[r.length-1].Za)));let i=this.rv();for(let t=i.length;t--;){let r=this.Fp.Vi(n,i[t].ri());r>e&&(e=r)}let a=this.Yi.zt();if(a!==null&&this.Op!==null&&(o=this.Ps.crosshair).mode!==2&&o.horzLine.visible&&o.horzLine.labelVisible){let t=this.Yi.Ts(1,a),r=this.Yi.Ts(this.Op.height-2,a);e=Math.max(e,this.Fp.Vi(n,this.Yi.Zi(Math.floor(Math.min(t,r))+.11111111111111,a)),this.Fp.Vi(n,this.Yi.Zi(Math.ceil(Math.max(t,r))-.11111111111111,a)))}var o;n.restore();let s=e||34;return Qn(Math.ceil(t.S+t.C+t.B+t.I+5+s))}hv(e){this.Op!==null&&v(this.Op,e)||(this.Op=e,this.Up=!0,this.Gp.resizeCanvasElement(e),this.Jp.resizeCanvasElement(e),this.Up=!1,this.jf.style.width=`${e.width}px`,this.jf.style.height=`${e.height}px`)}av(){return T(this.Op).width}_s(e){this.Yi!==e&&(this.Yi!==null&&this.Yi.so().u(this),this.Yi=e,e.so().i(this._l.bind(this),this))}Ft(){return this.Yi}Bn(){let e=this.Pt.ap();this.Pt.qp().Qt().Zo(e,T(this.Ft()))}lv(e){if(this.Op===null)return;let t={colorSpace:this.Pt.qp().N().layout.colorSpace};if(e!==1){this.ov(),this.Gp.applySuggestedBitmapSize();let e=x(this.Gp,t);e!==null&&(e.useBitmapCoordinateSpace((e=>{this._v(e),this.uv(e)})),this.Pt.cv(e,this.Zp),this.dv(e),this.Pt.cv(e,this.Kp),this.fv(e))}this.Jp.applySuggestedBitmapSize();let n=x(this.Jp,t);n!==null&&(n.useBitmapCoordinateSpace((({context:e,bitmapSize:t})=>{e.clearRect(0,0,t.width,t.height)})),this.pv(n),this.Pt.cv(n,this.Xp))}Jf(){return this.Gp.bitmapSize}Qf(e,t,n,r){let i=this.Jf();if(i.width>0&&i.height>0&&(e.drawImage(this.Gp.canvasElement,t,n),r)){let r=this.Jp.canvasElement;e.drawImage(r,t,n)}}yt(){this.Yi?.Da()}ep(e){if(this.Yi===null||this.Yi.Ki()||!this.Ps.handleScale.axisPressedMouseMove.price)return;let t=this.Pt.qp().Qt(),n=this.Pt.ap();this.Np=!0,t.Uo(n,this.Yi,e.localY)}rp(e){if(this.Yi===null||!this.Ps.handleScale.axisPressedMouseMove.price)return;let t=this.Pt.qp().Qt(),n=this.Pt.ap(),r=this.Yi;t.$o(n,r,e.localY)}Qp(){if(this.Yi===null||!this.Ps.handleScale.axisPressedMouseMove.price)return;let e=this.Pt.qp().Qt(),t=this.Pt.ap(),n=this.Yi;this.Np&&(this.Np=!1,e.qo(t,n))}hp(e){if(this.Yi===null||!this.Ps.handleScale.axisPressedMouseMove.price)return;let t=this.Pt.qp().Qt(),n=this.Pt.ap();this.Np=!1,t.qo(n,this.Yi)}tv(e){this.Ps.handleScale.axisDoubleClickReset.price&&this.Bn()}iv(e){this.Yi!==null&&(!this.Pt.qp().Qt().N().handleScale.axisPressedMouseMove.price||this.Yi.Le()||this.Yi.Dl()||this.vv(1))}np(e){this.vv(0)}rv(){let e=[],t=this.Yi===null?void 0:this.Yi;return(n=>{for(let r=0;r<n.length;++r){let i=n[r].Ws(this.Pt.ap(),t);for(let t=0;t<i.length;t++)e.push(i[t])}})(this.Pt.ap().Dt()),e}_v({context:e,bitmapSize:t}){let{width:n,height:r}=t,i=this.Pt.ap().Qt(),a=i.$(),o=i.Wc();a===o?Be(e,0,0,n,r,a):Ue(e,0,0,n,r,a,o)}uv({context:e,bitmapSize:t,horizontalPixelRatio:n}){if(this.Op===null||this.Yi===null||!this.Yi.N().borderVisible)return;e.fillStyle=this.Yi.N().borderColor;let r=Math.max(1,Math.floor(this.sv().S*n)),i;i=this.jp?t.width-r:0,e.fillRect(i,0,r,t.height)}dv(e){if(this.Op===null||this.Yi===null)return;let t=this.Yi.Da(),n=this.Yi.N(),r=this.sv(),i=this.jp?this.Op.width-r.C:0;n.borderVisible&&n.ticksVisible&&e.useBitmapCoordinateSpace((({context:e,horizontalPixelRatio:a,verticalPixelRatio:o})=>{e.fillStyle=n.borderColor;let s=Math.max(1,Math.floor(o)),c=Math.floor(.5*o),l=Math.round(r.C*a);e.beginPath();
2for(let n of t)e.rect(Math.floor(i*a),Math.round(n.Pa*o)-c,l,s);e.fill()})),e.useMediaCoordinateSpace((({context:e})=>{e.font=this.ev(),e.fillStyle=n.textColor??this.Ml.textColor,e.textAlign=this.jp?`right`:`left`,e.textBaseline=`middle`;let a=this.jp?Math.round(i-r.B):Math.round(i+r.C+r.B),o=t.map((t=>this.Fp.Di(e,t.Za)));for(let n=t.length;n--;){let r=t[n];e.fillText(r.Za,a,r.Pa+o[n])}}))}ov(){if(this.Op===null||this.Yi===null)return;let e=this.Op.height/2,t=[],n=this.Yi.Dt().slice(),r=this.Pt.ap(),i=this.sv();this.Yi===r.$n()&&this.Pt.ap().Dt().forEach((e=>{r.Un(e)&&n.push(e)}));let a=this.Yi.Ma()[0],o=this.Yi;n.forEach((n=>{let i=n.Ws(r,o);i.forEach((e=>{e.Wi(null),e.Hi()&&t.push(e)})),a===n&&i.length>0&&(e=i[0].Ii())})),t.forEach((e=>e.Wi(e.Ii()))),this.Yi.N().alignLabels&&this.mv(t,i,e)}mv(e,t,n){if(this.Op===null)return;let r=e.filter((e=>e.Ii()<=n)),i=e.filter((e=>e.Ii()>n));r.sort(((e,t)=>t.Ii()-e.Ii())),r.length&&i.length&&i.push(r[0]),i.sort(((e,t)=>e.Ii()-t.Ii()));for(let n of e){let e=Math.floor(n.$t(t)/2),r=n.Ii();r>-e&&r<e&&n.Wi(e),r>this.Op.height-e&&r<this.Op.height+e&&n.Wi(this.Op.height-e)}pr(r,1,this.Op.height,t),pr(i,-1,this.Op.height,t)}fv(e){if(this.Op===null)return;
2let t=this.rv(),n=this.sv(),r=this.jp?`right`:`left`;t.forEach((t=>{t.Ui()&&t.Tt(T(this.Yi)).nt(e,n,this.Fp,r)}))}pv(e){if(this.Op===null||this.Yi===null)return;let t=this.Pt.qp().Qt(),n=[],r=this.Pt.ap(),i=t.uc().Ws(r,this.Yi);i.length&&n.push(i);let a=this.sv(),o=this.jp?`right`:`left`;n.forEach((t=>{t.forEach((t=>{t.Tt(T(this.Yi)).nt(e,a,this.Fp,o)}))}))}vv(e){this.jf.style.cursor=e===1?`ns-resize`:`default`}_l(){let e=this.nv();this.Hp<e&&this.Pt.qp().Qt().Ih(),this.Hp=e}ev(){return De(this.Ml.fontSize,this.Ml.fontFamily)}};function hr(e,t){return e.Jh?.(t)??[]}function gr(e,t){return e.Fs?.(t)??[]}function _r(e,t){return e.us?.(t)??[]}function vr(e,t){return e.Xh?.(t)??[]}var yr=class e{constructor(e,t){this.Op=_({width:0,height:0}),this.wv=null,this.gv=null,this.Mv=null,this.bv=null,this.Sv=!1,this.xv=new D,this.Cv=new D,this.Pv=0,this.yv=!1,this.kv=null,this.Tv=!1,this.Rv=null,this.Dv=null,this.Up=!1,this.$p=()=>{this.Up||this.Vv===null||this.ts().ar()},this.Yp=()=>{this.Up||this.Vv===null||this.ts().ar()},this.Vp=e,this.Vv=t,this.Vv.t_().i(this.Bv.bind(this),this,!0),this.Iv=document.createElement(`td`),this.Iv.style.padding=`0`,this.Iv.style.position=`relative`;let n=document.createElement(`div`);n.style.width=`100%`,n.style.height=`100%`,n.style.position=`relative`,n.style.overflow=`hidden`,this.Ev=document.createElement(`td`),this.Ev.style.padding=`0`,this.Av=document.createElement(`td`),this.Av.style.padding=`0`,this.Iv.appendChild(n),this.Gp=J(n,_({width:16,height:16})),this.Gp.subscribeSuggestedBitmapSizeChanged(this.$p);let r=this.Gp.canvasElement;r.style.position=`absolute`,r.style.zIndex=`1`,r.style.left=`0`,r.style.top=`0`,this.Jp=J(n,_({width:16,height:16})),this.Jp.subscribeSuggestedBitmapSizeChanged(this.Yp);let i=this.Jp.canvasElement;i.style.position=`absolute`,i.style.zIndex=`2`,i.style.left=`0`,i.style.top=`0`,this.Yf=document.createElement(`tr`),this.Yf.appendChild(this.Ev),this.Yf.appendChild(this.Iv),this.Yf.appendChild(this.Av),this.zv(),this.Nf=new er(this.Jp.canvasElement,this,{af:()=>this.kv===null&&!this.Vp.N().handleScroll.vertTouchDrag,lf:()=>this.kv===null&&!this.Vp.N().handleScroll.horzTouchDrag})}m(){this.wv!==null&&this.wv.m(),this.gv!==null&&this.gv.m(),this.Mv=null,this.Jp.unsubscribeSuggestedBitmapSizeChanged(this.Yp),Y(this.Jp.canvasElement),this.Jp.dispose(),this.Gp.unsubscribeSuggestedBitmapSizeChanged(this.$p),Y(this.Gp.canvasElement),this.Gp.dispose(),this.Vv!==null&&(this.Vv.t_().u(this),this.Vv.m()),this.Nf.m()}ap(){return T(this.Vv)}Lv(t){this.Vv!==null&&this.Vv.t_().u(this),this.Vv=t,this.Vv!==null&&this.Vv.t_().i(e.prototype.Bv.bind(this),this,!0),this.zv(),this.Vp.$f().indexOf(this)===this.Vp.$f().length-1?(this.Mv=this.Mv??new cr(this.Iv,this.Vp),this.Mv.yt()):(this.Mv?.Ip(),this.Mv=null)}qp(){return this.Vp}Zf(){return this.Yf}zv(){if(this.Vv!==null&&(this.Ov(),this.ts().js().length!==0)){if(this.wv!==null){let e=this.Vv.Wo();this.wv._s(T(e))}if(this.gv!==null){let e=this.Vv.Ho();this.gv._s(T(e))}}}Nv(){this.wv!==null&&this.wv.yt(),this.gv!==null&&this.gv.yt()}Bo(){return this.Vv===null?0:this.Vv.Bo()}Io(e){this.Vv&&this.Vv.Io(e)}sf(e){if(!this.Vv)return;this.Fv();let t=e.localX,n=e.localY;this.Wv(t,n,e)}Sf(e){this.Fv(),this.Hv(),this.Wv(e.localX,e.localY,e)}nf(e){if(!this.Vv)return;this.Fv();let t=e.localX,n=e.localY;this.Wv(t,n,e)}mf(e){this.Vv!==null&&(this.Fv(),this.Uv(e))}Xd(e){this.Vv!==null&&this.$v(this.Cv,e)}qd(e){this.Xd(e)}cf(e){this.Fv(),this.qv(e),this.Wv(e.localX,e.localY,e)}vf(e){this.Vv!==null&&(this.Fv(),this.yv=!1,this.Yv(e))}pf(e){this.Vv!==null&&this.Uv(e)}If(e){if(this.yv=!0,this.kv===null){let t={x:e.localX,y:e.localY};this.jv(t,t,e)}}Bf(e){this.Vv!==null&&(this.Fv(),this.Vv.Qt().lc(null),this.Kv())}Xv(){return this.xv}Zv(){return this.Cv}yf(){this.Pv=1,this.ts().hn()}kf(e,t){if(!this.Vp.N().handleScale.pinch)return;let n=5*(t-this.Pv);this.Pv=t,this.ts().bc(e._t,n)}Mf(e){this.yv=!1,this.Tv=this.kv!==null,this.Hv();let t=this.ts().uc();this.kv!==null&&t.Vt()&&(this.Rv={x:t.si(),y:t.ni()},this.kv={x:e.localX,y:e.localY})}_f(e){if(this.Vv===null)return;let t=e.localX,n=e.localY;if(this.kv===null)this.qv(e);else{this.Tv=!1;let r=T(this.Rv),i=r.x+(t-this.kv.x),a=r.y+(n-this.kv.y);this.Wv(i,a,e)}}ff(e){this.qp().N().trackingMode.exitMode===0&&(this.Tv=!0),this.Gv(),this.Yv(e)}jn(e,t){let n=this.Vv;return n===null?null:vn(n,e,t)}Jv(e,t){T(t===`left`?this.wv:this.gv).hv(_({width:e,height:this.Op.height}))}Gf(){return this.Op}hv(e){v(this.Op,e)||(this.Op=e,this.Up=!0,this.Gp.resizeCanvasElement(e),this.Jp.resizeCanvasElement(e),this.Up=!1,this.Iv.style.width=e.width+`px`,this.Iv.style.height=e.height+`px`)}Qv(){let e=T(this.Vv);e.Fo(e.Wo()),e.Fo(e.Ho());for(let t of e.Ma())if(e.Un(t)){let n=t.Ft();n!==null&&e.Fo(n),t.Ns()}for(let t of e.s_())t.Ns()}Jf(){return this.Gp.bitmapSize}Qf(e,t,n,r){let i=this.Jf();if(i.width>0&&i.height>0&&(e.drawImage(this.Gp.canvasElement,t,n),r)){let r=this.Jp.canvasElement;e!==null&&e.drawImage(r,t,n)}}lv(e){if(e===0||this.Vv===null)return;e>1&&this.Qv(),this.wv!==null&&this.wv.lv(e),this.gv!==null&&this.gv.lv(e);let t={colorSpace:this.Vp.N().layout.colorSpace};if(e!==1){this.Gp.applySuggestedBitmapSize();let e=x(this.Gp,t);e!==null&&(e.useBitmapCoordinateSpace((e=>{this._v(e)}
2)),this.Vv&&(this.tm(e,hr),this.im(e),this.tm(e,gr),this.tm(e,_r)))}this.Jp.applySuggestedBitmapSize();let n=x(this.Jp,t);n!==null&&(n.useBitmapCoordinateSpace((({context:e,bitmapSize:t})=>{e.clearRect(0,0,t.width,t.height)})),this.sm(n),this.tm(n,vr),this.tm(n,_r))}nm(){return this.wv}rm(){return this.gv}cv(e,t){this.tm(e,t)}Bv(){this.Vv!==null&&this.Vv.t_().u(this),this.Vv=null}Uv(e){this.$v(this.xv,e)}$v(e,t){let n=t.localX,r=t.localY;e.v()&&e.p(this.ts().Et().cu(n),{x:n,y:r},t)}_v({context:e,bitmapSize:t}){let{width:n,height:r}=t,i=this.ts(),a=i.$(),o=i.Wc();a===o?Be(e,0,0,n,r,o):Ue(e,0,0,n,r,a,o)}im(e){let t=T(this.Vv),n=t.i_().lr().Tt(t);n!==null&&n.nt(e,!1)}sm(e){this.hm(e,gr,ur,this.ts().uc())}tm(e,t){let n=T(this.Vv),r=n.Dt(),i=n.s_();for(let n of i)this.hm(e,t,lr,n);for(let n of r)this.hm(e,t,lr,n);for(let n of i)this.hm(e,t,ur,n);for(let n of r)this.hm(e,t,ur,n)}hm(e,t,n,r){let i=T(this.Vv),a=i.Qt().ac(),o=a!==null&&a.n_===r,s=a!==null&&o&&a.e_!==void 0?a.e_.Xn:void 0;dr(t,(t=>n(t,e,o,s)),r,i)}Ov(){if(this.Vv===null)return;let e=this.Vp,t=this.Vv.Wo().N().visible,n=this.Vv.Ho().N().visible;t||this.wv===null||(this.Ev.removeChild(this.wv.Zf()),this.wv.m(),this.wv=null),n||this.gv===null||(this.Av.removeChild(this.gv.Zf()),this.gv.m(),this.gv=null);let r=e.Qt().Bc();t&&this.wv===null&&(this.wv=new mr(this,e.N(),r,`left`),this.Ev.appendChild(this.wv.Zf())),n&&this.gv===null&&(this.gv=new mr(this,e.N(),r,`right`),this.Av.appendChild(this.gv.Zf()))}am(e){return e.Ef&&this.yv||this.kv!==null}lm(e){return Math.max(0,Math.min(e,this.Op.width-1))}om(e){return Math.max(0,Math.min(e,this.Op.height-1))}Wv(e,t,n){this.ts().Tc(this.lm(e),this.om(t),n,T(this.Vv))}Kv(){this.ts().Dc()}Gv(){this.Tv&&(this.kv=null,this.Kv())}jv(e,t,n){this.kv=e,this.Tv=!1,this.Wv(t.x,t.y,n);let r=this.ts().uc();this.Rv={x:r.si(),y:r.ni()}}ts(){return this.Vp.Qt()}Yv(e){if(!this.Sv)return;let t=this.ts(),n=this.ap();if(t.Ko(n,n.ks()),this.bv=null,this.Sv=!1,t.Pc(),this.Dv!==null){let e=performance.now(),n=t.Et();this.Dv.le(n.gu(),e),this.Dv.Ru(e)||t._n(this.Dv)}}Fv(){this.kv=null}Hv(){if(this.Vv){if(this.ts().hn(),document.activeElement!==document.body&&document.activeElement!==document.documentElement)T(document.activeElement).blur();else{let e=document.getSelection();e!==null&&e.removeAllRanges()}!this.Vv.ks().Ki()&&this.ts().Et().Ki()}}qv(e){if(this.Vv===null)return;let t=this.ts(),n=t.Et();if(n.Ki())return;let r=this.Vp.N(),i=r.handleScroll,a=r.kineticScroll;if((!i.pressedMouseMove||e.Ef)&&(!i.horzTouchDrag&&!i.vertTouchDrag||!e.Ef))return;let o=this.Vv.ks(),s=performance.now();if(this.bv!==null||this.am(e)||(this.bv={x:e.clientX,y:e.clientY,rd:s,_m:e.localX,um:e.localY}),this.bv!==null&&!this.Sv&&(this.bv.x!==e.clientX||this.bv.y!==e.clientY)){if(e.Ef&&a.touch||!e.Ef&&a.mouse){let e=n.mu();this.Dv=new sr(.2/e,7/e,.997,15/e),this.Dv.Pp(n.gu(),this.bv.rd)}else this.Dv=null;o.Ki()||t.Yo(this.Vv,o,e.localY),t.xc(e.localX),this.Sv=!0}this.Sv&&(o.Ki()||t.jo(this.Vv,o,e.localY),t.Cc(e.localX),this.Dv!==null&&this.Dv.Pp(n.gu(),s))}},br=class{constructor(e,t,n,r,i){this.xt=!0,this.Op=_({width:0,height:0}),this.$p=()=>this.lv(3),this.jp=e===`left`,this.Ju=n.Bc,this.Ps=t,this.dm=r,this.fm=i,this.jf=document.createElement(`div`),this.jf.style.width=`25px`,this.jf.style.height=`100%`,this.jf.style.overflow=`hidden`,this.Gp=J(this.jf,_({width:16,height:16})),this.Gp.subscribeSuggestedBitmapSizeChanged(this.$p)}m(){this.Gp.unsubscribeSuggestedBitmapSizeChanged(this.$p),Y(this.Gp.canvasElement),this.Gp.dispose()}Zf(){return this.jf}Gf(){return this.Op}hv(e){v(this.Op,e)||(this.Op=e,this.Gp.resizeCanvasElement(e),this.jf.style.width=`${e.width}px`,this.jf.style.height=`${e.height}px`,this.xt=!0)}lv(e){if(e<3&&!this.xt||this.Op.width===0||this.Op.height===0)return;this.xt=!1,this.Gp.applySuggestedBitmapSize();let t=x(this.Gp,{colorSpace:this.Ps.layout.colorSpace});t!==null&&t.useBitmapCoordinateSpace((e=>{this._v(e),this.uv(e)}))}Jf(){return this.Gp.bitmapSize}Qf(e,t,n){let r=this.Jf();r.width>0&&r.height>0&&e.drawImage(this.Gp.canvasElement,t,n)}uv({context:e,bitmapSize:t,horizontalPixelRatio:n,verticalPixelRatio:r}){if(!this.dm())return;e.fillStyle=this.Ps.timeScale.borderColor;let i=Math.floor(this.Ju.N().S*n),a=Math.floor(this.Ju.N().S*r),o=this.jp?t.width-i:0;e.fillRect(o,0,i,a)}_v({context:e,bitmapSize:t}){Be(e,0,0,t.width,t.height,this.fm())}};function xr(e){return t=>t.ia?.(e)??[]}var Sr=xr(`normal`),Cr=xr(`top`),wr=xr(`bottom`),Tr=class{constructor(e,t){this.pm=null,this.vm=null,this.M=null,this.wm=!1,this.Op=_({width:0,height:0}),this.gm=new D,this.Fp=new P(5),this.Up=!1,this.$p=()=>{this.Up||this.Vp.Qt().ar()},this.Yp=()=>{this.Up||this.Vp.Qt().ar()},this.Vp=e,this.o_=t,this.Ps=e.N().layout,this.kp=document.createElement(`tr`),this.Mm=document.createElement(`td`),this.Mm.style.padding=`0`,this.bm=document.createElement(`td`),this.bm.style.padding=`0`,this.jf=document.createElement(`td`),this.jf.style.height=`25px`,this.jf.style.padding=`0`,this.Sm=document.createElement(`div`),this.Sm.style.width=`100%`,this.Sm.style.height=`100%`,this.Sm.style.position=`relative`,this.Sm.style.overflow=`hidden`,this.jf.appendChild(this.Sm),this.Gp=J(this.Sm,_({width:16,height:16})),this.Gp.subscribeSuggestedBitmapSizeChanged(this.$p);let n=this.Gp.canvasElement;n.style.position=`absolute`,n.style.zIndex=`1`,n.style.left=`0`,n.style.top=`0`,this.Jp=J(this.Sm,_({width:16,height:16})),this.Jp.subscribeSuggestedBitmapSizeChanged(this.Yp);let r=this.Jp.canvasElement;r.style.position=`absolute`,r.style.zIndex=`2`,r.style.left=`0`,r.style.top=`0`,this.kp.appendChild(this.Mm),this.kp.appendChild(this.jf),this.kp.appendChild(this.bm),this.xm(),this.Vp.Qt().Vo().i(this.xm.bind(this),this),this.Nf=new er(this.Jp.canvasElement,this,{af:()=>!0,lf:()=>!this.Vp.N().handleScroll.horzTouchDrag})}m(){this.Nf.m(),this.pm!==null&&this.pm.m(),this.vm!==null&&this.vm.m(),this.Jp.unsubscribeSuggestedBitmapSizeChanged(this.Yp),Y(this.Jp.canvasElement),this.Jp.dispose(),this.Gp.unsubscribeSuggestedBitmapSizeChanged(this.$p),Y(this.Gp.canvasElement),this.Gp.dispose()}Zf(){return this.kp}Cm(){return this.pm}Pm(){return this.vm}Sf(e){if(this.wm)return;this.wm=!0;let t=this.Vp.Qt();!t.Et().Ki()&&this.Vp.N().handleScale.axisPressedMouseMove.time&&t.Mc(e.localX)}Mf(e){this.Sf(e)}xf(){let e=this.Vp.Qt();!e.Et().Ki()&&this.wm&&(this.wm=!1,this.Vp.N().handleScale.axisPressedMouseMove.time&&e.kc())}cf(e){let t=this.Vp.Qt();!t.Et().Ki()&&this.Vp.N().handleScale.axisPressedMouseMove.time&&t.yc(e.localX)}_f(e){this.cf(e)}vf(){this.wm=!1;let e=this.Vp.Qt();e.Et().Ki()&&!this.Vp.N().handleScale.axisPressedMouseMove.time||e.kc()}ff(){this.vf()}Xd(){this.Vp.N().handleScale.axisDoubleClickReset.time&&this.Vp.Qt().cn()}qd(){this.Xd()}
2sf(){this.Vp.Qt().N().handleScale.axisPressedMouseMove.time&&this.vv(1)}Bf(){this.vv(0)}Gf(){return this.Op}ym(){return this.gm}km(e,t,n){v(this.Op,e)||(this.Op=e,this.Up=!0,this.Gp.resizeCanvasElement(e),this.Jp.resizeCanvasElement(e),this.Up=!1,this.jf.style.width=`${e.width}px`,this.jf.style.height=`${e.height}px`,this.gm.p(e)),this.pm!==null&&this.pm.hv(_({width:t,height:e.height})),this.vm!==null&&this.vm.hv(_({width:n,height:e.height}))}Tm(){let e=this.Rm();return Math.ceil(e.S+e.C+e.P+e.A+e.V+e.Dm)}yt(){this.Vp.Qt().Et().Da()}Jf(){return this.Gp.bitmapSize}Qf(e,t,n,r){let i=this.Jf();if(i.width>0&&i.height>0&&(e.drawImage(this.Gp.canvasElement,t,n),r)){let r=this.Jp.canvasElement;e.drawImage(r,t,n)}}lv(e){if(e===0)return;let t={colorSpace:this.Ps.colorSpace};if(e!==1){this.Gp.applySuggestedBitmapSize();let n=x(this.Gp,t);n!==null&&(n.useBitmapCoordinateSpace((e=>{this._v(e),this.uv(e),this.Vm(n,wr)})),this.dv(n),this.Vm(n,Sr)),this.pm!==null&&this.pm.lv(e),this.vm!==null&&this.vm.lv(e)}this.Jp.applySuggestedBitmapSize();let n=x(this.Jp,t);n!==null&&(n.useBitmapCoordinateSpace((({context:e,bitmapSize:t})=>{e.clearRect(0,0,t.width,t.height)})),this.Bm([...this.Vp.Qt().js(),this.Vp.Qt().uc()],n),this.Vm(n,Cr))}Vm(e,t){let n=this.Vp.Qt().js();for(let r of n)dr(t,(t=>lr(t,e,!1,void 0)),r,void 0);for(let r of n)dr(t,(t=>ur(t,e,!1,void 0)),r,void 0)}_v({context:e,bitmapSize:t}){Be(e,0,0,t.width,t.height,this.Vp.Qt().Wc())}uv({context:e,bitmapSize:t,verticalPixelRatio:n}){if(this.Vp.N().timeScale.borderVisible){e.fillStyle=this.Im();let r=Math.max(1,Math.floor(this.Rm().S*n));e.fillRect(0,0,t.width,r)}}dv(e){let t=this.Vp.Qt().Et(),n=t.Da();if(!n||n.length===0)return;let r=this.o_.maxTickMarkWeight(n),i=this.Rm(),a=t.N();a.borderVisible&&a.ticksVisible&&e.useBitmapCoordinateSpace((({context:e,horizontalPixelRatio:t,verticalPixelRatio:r})=>{e.strokeStyle=this.Im(),e.fillStyle=this.Im();let a=Math.max(1,Math.floor(t)),o=Math.floor(.5*t);e.beginPath();let s=Math.round(i.C*r);for(let r=n.length;r--;){let i=Math.round(n[r].coord*t);e.rect(i-o,0,a,s)}e.fill()})),e.useMediaCoordinateSpace((({context:e})=>{let t=i.S+i.C+i.A+i.P/2;e.textAlign=`center`,e.textBaseline=`middle`,e.fillStyle=this.H(),e.font=this.ev();for(let i of n)if(i.weight<r){let n=i.needAlignCoordinate?this.Em(e,i.coord,i.label):i.coord;e.fillText(i.label,n,t)}this.Vp.N().timeScale.allowBoldLabels&&(e.font=this.Am());for(let i of n)if(i.weight>=r){let n=i.needAlignCoordinate?this.Em(e,i.coord,i.label):i.coord;e.fillText(i.label,n,t)}}))}Em(e,t,n){let r=this.Fp.Vi(e,n),i=r/2,a=Math.floor(t-i)+.5;return a<0?t+=Math.abs(0-a):a+r>this.Op.width&&(t-=Math.abs(this.Op.width-(a+r))),t}Bm(e,t){let n=this.Rm();for(let r of e)for(let e of r.cs())e.Tt().nt(t,n)}Im(){return this.Vp.N().timeScale.borderColor}H(){return this.Ps.textColor}F(){return this.Ps.fontSize}ev(){return De(this.F(),this.Ps.fontFamily)}Am(){return De(this.F(),this.Ps.fontFamily,`bold`)}Rm(){this.M===null&&(this.M={S:1,L:NaN,A:NaN,V:NaN,Ji:NaN,C:5,P:NaN,k:``,Gi:new P,Dm:0});let e=this.M,t=this.ev();if(e.k!==t){let n=this.F();e.P=n,e.k=t,e.A=3*n/12,e.V=3*n/12,e.Ji=9*n/12,e.L=0,e.Dm=4*n/12,e.Gi.Bn()}return this.M}vv(e){this.jf.style.cursor=e===1?`ew-resize`:`default`}xm(){let e=this.Vp.Qt(),t=e.N();t.leftPriceScale.visible||this.pm===null||(this.Mm.removeChild(this.pm.Zf()),this.pm.m(),this.pm=null),t.rightPriceScale.visible||this.vm===null||(this.bm.removeChild(this.vm.Zf()),this.vm.m(),this.vm=null);let n={Bc:this.Vp.Qt().Bc()},r=()=>t.leftPriceScale.borderVisible&&e.Et().N().borderVisible,i=()=>e.Wc();t.leftPriceScale.visible&&this.pm===null&&(this.pm=new br(`left`,t,n,r,i),this.Mm.appendChild(this.pm.Zf())),t.rightPriceScale.visible&&this.vm===null&&(this.vm=new br(`right`,t,n,r,i),this.bm.appendChild(this.vm.Zf()))}},Er=!!G&&!!navigator.userAgentData&&navigator.userAgentData.brands.some((e=>e.brand.includes(`Chromium`)))&&!!G&&(navigator?.userAgentData?.platform?navigator.userAgentData.platform===`Windows`:navigator.userAgent.toLowerCase().indexOf(`win`)>=0),Dr=class{constructor(e,t,n){var r;this.zm=[],this.Lm=[],this.Om=0,this.il=0,this.Mo=0,this.Nm=0,this.Fm=0,this.Wm=null,this.Hm=!1,this.xv=new D,this.Cv=new D,this.Xu=new D,this.Um=null,this.$m=null,this.Dp=e,this.Ps=t,this.o_=n,this.kp=document.createElement(`div`),this.kp.classList.add(`tv-lightweight-charts`),this.kp.style.overflow=`hidden`,this.kp.style.direction=`ltr`,this.kp.style.width=`100%`,this.kp.style.height=`100%`,(r=this.kp).style.userSelect=`none`,r.style.webkitUserSelect=`none`,r.style.msUserSelect=`none`,r.style.MozUserSelect=`none`,r.style.webkitTapHighlightColor=`transparent`,this.qm=document.createElement(`table`),this.qm.setAttribute(`cellspacing`,`0`),this.kp.appendChild(this.qm),this.Ym=this.jm.bind(this),Or(this.Ps)&&this.Km(!0),this.ts=new An(this.Gu.bind(this),this.Ps,n),this.Qt().cc().i(this.Xm.bind(this),this),this.Zm=new Tr(this,this.o_),this.qm.appendChild(this.Zm.Zf());let i=t.autoSize&&this.Gm(),a=this.Ps.width,o=this.Ps.height;if(i||a===0||o===0){let t=e.getBoundingClientRect();a||=t.width,o||=t.height}this.Jm(a,o),this.Qm(),e.appendChild(this.kp),this.tw(),this.ts.Et().Iu().i(this.ts.Ih.bind(this.ts),this),this.ts.Vo().i(this.ts.Ih.bind(this.ts),this)}Qt(){return this.ts}N(){return this.Ps}$f(){return this.zm}iw(){return this.Zm}m(){this.Km(!1),this.Om!==0&&window.cancelAnimationFrame(this.Om),this.ts.cc().u(this),this.ts.Et().Iu().u(this),this.ts.Vo().u(this),this.ts.m();for(let e of this.zm)this.qm.removeChild(e.Zf()),e.Xv().u(this),e.Zv().u(this),e.m();this.zm=[];for(let e of this.Lm)this.sw(e);this.Lm=[],T(this.Zm).m(),this.kp.parentElement!==null&&this.kp.parentElement.removeChild(this.kp),this.Xu.m(),this.xv.m(),this.Cv.m(),this.nw()}Jm(e,t,n=!1){if(this.il===t&&this.Mo===e)return;let r=function(e){let t=Math.floor(e.width),n=Math.floor(e.height);return _({width:t-t%2,height:n-n%2})}(_({width:e,height:t}));this.il=r.height,this.Mo=r.width;let i=this.il+`px`,a=this.Mo+`px`;T(this.kp).style.height=i,T(this.kp).style.width=a,this.qm.style.height=i,this.qm.style.width=a,n?this.ew(M.gn(),performance.now()):this.ts.Ih()}lv(e){e===void 0&&(e=M.gn());for(let t=0;t<this.zm.length;t++)this.zm[t].lv(e.en(t).tn);this.Ps.timeScale.visible&&this.Zm.lv(e.nn())}hr(e){let t=Or(this.Ps);this.ts.hr(e);let n=Or(this.Ps);n!==t&&this.Km(n),e.layout?.panes&&this.rw(),this.tw(),this.hw(e)}Xv(){return this.xv}Zv(){return this.Cv}cc(){return this.Xu}aw(e=!1){this.Wm!==null&&(this.ew(this.Wm,performance.now()),this.Wm=null);let t=this.lw(null),n=document.createElement(`canvas`);n.width=t.width,n.height=t.height;let r=T(n.getContext(`2d`));return this.lw(r,e),n}ow(e){return e===`left`&&!this._w()||e===`right`&&!this.uw()||this.zm.length===0?0:T(e===`left`?this.zm[0].nm():this.zm[0].rm()).av()}cw(){return this.Ps.autoSize&&this.Um!==null}ip(){return this.kp}dw(e){this.$m=e,this.$m?this.ip().style.setProperty(`cursor`,e):this.ip().style.removeProperty(`cursor`)}fw(){return this.$m}pw(e){return w(this.zm[e]).Gf()}rw(){this.Lm.forEach((e=>{e.yt()}
2))}hw(e){(e.autoSize!==void 0||!this.Um||e.width===void 0&&e.height===void 0)&&(e.autoSize&&!this.Um&&this.Gm(),!1===e.autoSize&&this.Um!==null&&this.nw(),e.autoSize||e.width===void 0&&e.height===void 0||this.Jm(e.width||this.Mo,e.height||this.il))}lw(e,t){let n=0,r=0,i=this.zm[0],a=(n,r)=>{let i=0;for(let a=0;a<this.zm.length;a++){let o=this.zm[a],s=T(n===`left`?o.nm():o.rm()),c=s.Jf();if(e!==null&&s.Qf(e,r,i,t),i+=c.height,a<this.zm.length-1){let t=this.Lm[a],n=t.Jf();e!==null&&t.Qf(e,r,i),i+=n.height}}};this._w()&&(a(`left`,0),n+=T(i.nm()).Jf().width);for(let i=0;i<this.zm.length;i++){let a=this.zm[i],o=a.Jf();if(e!==null&&a.Qf(e,n,r,t),r+=o.height,i<this.zm.length-1){let t=this.Lm[i],a=t.Jf();e!==null&&t.Qf(e,n,r),r+=a.height}}n+=i.Jf().width,this.uw()&&(a(`right`,n),n+=T(i.rm()).Jf().width);let o=(t,n,r)=>{T(t===`left`?this.Zm.Cm():this.Zm.Pm()).Qf(T(e),n,r)};if(this.Ps.timeScale.visible){let n=this.Zm.Jf();if(e!==null){let a=0;this._w()&&(o(`left`,a,r),a=T(i.nm()).Jf().width),this.Zm.Qf(e,a,r,t),a+=n.width,this.uw()&&o(`right`,a,r)}r+=n.height}return _({width:n,height:r})}mw(){let e=0,t=0,n=0;for(let r of this.zm)this._w()&&(t=Math.max(t,T(r.nm()).nv(),this.Ps.leftPriceScale.minimumWidth)),this.uw()&&(n=Math.max(n,T(r.rm()).nv(),this.Ps.rightPriceScale.minimumWidth)),e+=r.Bo();t=Qn(t),n=Qn(n);let r=this.Mo,i=this.il,a=Math.max(r-t-n,0),o=1*this.Lm.length,s=this.Ps.timeScale.visible,c=s?Math.max(this.Zm.Tm(),this.Ps.timeScale.minimumHeight):0;var l;c=(l=c)+l%2;let u=o+c,d=i<u?0:i-u,f=d/e,p=0,m=window.devicePixelRatio||1;for(let e=0;e<this.zm.length;++e){let r=this.zm[e];r.Lv(this.ts.$s()[e]);let i=0,o=0;o=e===this.zm.length-1?Math.ceil((d-p)*m)/m:Math.round(r.Bo()*f*m)/m,i=Math.max(o,2),p+=i,r.hv(_({width:a,height:i})),this._w()&&r.Jv(t,`left`),this.uw()&&r.Jv(n,`right`),r.ap()&&this.ts.dc(r.ap(),i)}this.Zm.km(_({width:s?a:0,height:c}),s?t:0,s?n:0),this.ts.Eo(a),this.Nm!==t&&(this.Nm=t),this.Fm!==n&&(this.Fm=n)}Km(e){e?this.kp.addEventListener(`wheel`,this.Ym,{passive:!1}):this.kp.removeEventListener(`wheel`,this.Ym)}ww(e){switch(e.deltaMode){case e.DOM_DELTA_PAGE:return 120;case e.DOM_DELTA_LINE:return 32}return Er?1/window.devicePixelRatio:1}jm(e){if(!(e.deltaX!==0&&this.Ps.handleScroll.mouseWheel||e.deltaY!==0&&this.Ps.handleScale.mouseWheel))return;let t=this.ww(e),n=t*e.deltaX/100,r=-t*e.deltaY/100;if(e.cancelable&&e.preventDefault(),r!==0&&this.Ps.handleScale.mouseWheel){let t=Math.sign(r)*Math.min(1,Math.abs(r)),n=e.clientX-this.kp.getBoundingClientRect().left;this.Qt().bc(n,t)}n!==0&&this.Ps.handleScroll.mouseWheel&&this.Qt().Sc(-80*n)}ew(e,t){let n=e.nn();n===3&&this.gw(),n!==3&&n!==2||(this.Mw(e),this.bw(e,t),this.Zm.yt(),this.zm.forEach((e=>{e.Nv()})),this.Wm?.nn()===3&&(this.Wm.vn(e),this.gw(),this.Mw(this.Wm),this.bw(this.Wm,t),e=this.Wm,this.Wm=null)),this.lv(e)}bw(e,t){for(let n of e.pn())this.mn(n,t)}Mw(e){let t=this.ts.$s();for(let n=0;n<t.length;n++)e.en(n).sn&&t[n].Go()}mn(e,t){let n=this.ts.Et();switch(e.an){case 0:n.Au();break;case 1:n.zu(e.Wt);break;case 2:n.dn(e.Wt);break;case 3:n.fn(e.Wt);break;case 4:n.Su();break;case 5:e.Wt.Ru(t)||n.fn(e.Wt.Du(t))}}Gu(e){this.Wm===null?this.Wm=e:this.Wm.vn(e),this.Hm||(this.Hm=!0,this.Om=window.requestAnimationFrame((e=>{if(this.Hm=!1,this.Om=0,this.Wm!==null){let t=this.Wm;this.Wm=null,this.ew(t,e);for(let n of t.pn())if(n.an===5&&!n.Wt.Ru(e)){this.Qt()._n(n.Wt);break}}})))}gw(){this.Qm()}sw(e){this.qm.removeChild(e.Zf()),e.m()}Qm(){let e=this.ts.$s(),t=e.length,n=this.zm.length;for(let e=t;e<n;e++){let e=w(this.zm.pop());this.qm.removeChild(e.Zf()),e.Xv().u(this),e.Zv().u(this),e.m();let t=this.Lm.pop();t!==void 0&&this.sw(t)}for(let r=n;r<t;r++){let t=new yr(this,e[r]);if(t.Xv().i(this.Sw.bind(this,t),this),t.Zv().i(this.xw.bind(this,t),this),this.zm.push(t),r>0){let e=new ir(this,r-1,r);this.Lm.push(e),this.qm.insertBefore(e.Zf(),this.Zm.Zf())}this.qm.insertBefore(t.Zf(),this.Zm.Zf())}for(let n=0;n<t;n++){let t=e[n],r=this.zm[n];r.ap()===t?r.zv():r.Lv(t)}this.tw(),this.mw()}Cw(e,t,n,r){let i=new Map;e!==null&&this.ts.js().forEach((t=>{let n=t.Xs().Fr(e);n!==null&&i.set(t,n)}
2));let a;if(e!==null){let t=this.ts.Et().ss(e)?.originalTime;t!==void 0&&(a=t)}let o=this.Qt().ac(),s=o!==null&&o.n_ instanceof Gt?o.n_:void 0,c=o!==null&&o.e_!==void 0?o.e_.Kn:void 0,l=this.Pw(r);return{yw:a,Re:e??void 0,kw:t??void 0,Tw:l===-1?void 0:l,Rw:s,Dw:i,Vw:c,Bw:n??void 0}}Pw(e){let t=-1;if(e)t=this.zm.indexOf(e);else{let e=this.Qt().uc().Us();e!==null&&(t=this.Qt().$s().indexOf(e))}return t}Sw(e,t,n,r){this.xv.p((()=>this.Cw(t,n,r,e)))}xw(e,t,n,r){this.Cv.p((()=>this.Cw(t,n,r,e)))}Xm(e,t,n){this.dw(this.Qt().ac()?.h_??null),this.Xu.p((()=>this.Cw(e,t,n)))}tw(){let e=this.Ps.timeScale.visible?``:`none`;this.Zm.Zf().style.display=e}_w(){return this.zm[0].ap().Wo().N().visible}uw(){return this.zm[0].ap().Ho().N().visible}Gm(){return`ResizeObserver`in window&&(this.Um=new ResizeObserver((e=>{let t=e[e.length-1];t&&this.Jm(t.contentRect.width,t.contentRect.height)})),this.Um.observe(this.Dp,{box:`border-box`}),!0)}nw(){this.Um!==null&&this.Um.disconnect(),this.Um=null}};function Or(e){return!!(e.handleScroll.mouseWheel||e.handleScale.mouseWheel)}function kr(e){return e.open===void 0&&e.value===void 0}function Ar(e){return function(e){return e.open!==void 0}(e)||function(e){return e.value!==void 0}(e)}function jr(e,t,n,r){let i=n.value,a={Re:t,wt:e,Wt:[i,i,i,i],yw:r};return n.color!==void 0&&(a.R=n.color),a}function Mr(e,t,n,r){let i=n.value,a={Re:t,wt:e,Wt:[i,i,i,i],yw:r};return n.lineColor!==void 0&&(a.vt=n.lineColor),n.topColor!==void 0&&(a.mr=n.topColor),n.bottomColor!==void 0&&(a.wr=n.bottomColor),a}function Nr(e,t,n,r){let i=n.value,a={Re:t,wt:e,Wt:[i,i,i,i],yw:r};return n.topLineColor!==void 0&&(a.gr=n.topLineColor),n.bottomLineColor!==void 0&&(a.Mr=n.bottomLineColor),n.topFillColor1!==void 0&&(a.br=n.topFillColor1),n.topFillColor2!==void 0&&(a.Sr=n.topFillColor2),n.bottomFillColor1!==void 0&&(a.Cr=n.bottomFillColor1),n.bottomFillColor2!==void 0&&(a.Pr=n.bottomFillColor2),a}function Pr(e,t,n,r){let i={Re:t,wt:e,Wt:[n.open,n.high,n.low,n.close],yw:r};return n.color!==void 0&&(i.R=n.color),i}function Fr(e,t,n,r){let i={Re:t,wt:e,Wt:[n.open,n.high,n.low,n.close],yw:r};return n.color!==void 0&&(i.R=n.color),n.borderColor!==void 0&&(i.Ht=n.borderColor),n.wickColor!==void 0&&(i.vr=n.wickColor),i}function Ir(e,t,n,r,i){let a=w(i)(n),o=Math.max(...a),s=Math.min(...a),c=a[a.length-1],l=[c,o,s,c],{time:u,color:d,...f}=n;return{Re:t,wt:e,Wt:l,yw:r,se:f,R:d}}function X(e){return e.Wt!==void 0}function Lr(e,t){return t.customValues!==void 0&&(e.Iw=t.customValues),e}function Z(e){return(t,n,r,i,a,o)=>function(e,t){return t?t(e):kr(e)}(r,o)?Lr({wt:t,Re:n,yw:i},r):Lr(e(t,n,r,i,a),r)}function Rr(e){return{Candlestick:Z(Fr),Bar:Z(Pr),Area:Z(Mr),Baseline:Z(Nr),Histogram:Z(jr),Line:Z(jr),Custom:Z(Ir)}[e]}function zr(e){return{Re:0,Ew:new Map,Hh:e}}function Br(e,t){if(e!==void 0&&e.length!==0)return{Aw:t.key(e[0].wt),zw:t.key(e[e.length-1].wt)}}function Vr(e){let t;return e.forEach((e=>{t===void 0&&(t=e.yw)})),w(t)}var Hr=class{constructor(e){this.Lw=new Map,this.Ow=new Map,this.Nw=new Map,this.Fw=[],this.o_=e}m(){this.Lw.clear(),this.Ow.clear(),this.Nw.clear(),this.Fw=[]}Ww(e,t){let n=this.Lw.size!==0,r=!1,i=this.Ow.get(e);if(i!==void 0)if(this.Ow.size===1)n=!1,r=!0,this.Lw.clear();else for(let t of this.Fw)t.pointData.Ew.delete(e)&&(r=!0);let a=[];if(t.length!==0){let n=t.map((e=>e.time)),i=this.o_.createConverterToInternalObj(t),o=Rr(e.Rr()),s=e.ca(),c=e.fa();a=t.map(((t,a)=>{let l=i(t.time),u=this.o_.key(l),d=this.Lw.get(u);d===void 0&&(d=zr(l),this.Lw.set(u,d),r=!0);let f=o(l,d.Re,t,n[a],s,c);return d.Ew.set(e,f),f}))}n&&this.Hw(),this.Uw(e,a);let o=-1;if(r){let e=[];this.Lw.forEach((t=>{e.push({timeWeight:0,time:t.Hh,pointData:t,originalTime:Vr(t.Ew)})})),e.sort(((e,t)=>this.o_.key(e.time)-this.o_.key(t.time))),o=this.$w(e)}return this.qw(e,o,function(e,t,n){let r=Br(e,n),i=Br(t,n);if(r!==void 0&&i!==void 0)return{Yw:!1,zh:r.zw>=i.zw&&r.Aw>=i.Aw}}(this.Ow.get(e),i,this.o_))}Ac(e){return this.Ww(e,[])}jw(e,t,n){let r=t;(function(e){e.yw===void 0&&(e.yw=e.time)})(r),this.o_.preprocessData(t);let i=this.o_.createConverterToInternalObj([t])(t.time),a=this.Nw.get(e);if(!n&&a!==void 0&&this.o_.key(i)<this.o_.key(a))throw Error(`Cannot update oldest data, last time=${a}, new time=${i}`);let o=this.Lw.get(this.o_.key(i));if(n&&o===void 0)throw Error(`Cannot update non-existing data point when historicalUpdate is true`);let s=o===void 0;o===void 0&&(o=zr(i),this.Lw.set(this.o_.key(i),o));let c=Rr(e.Rr()),l=e.ca(),u=e.fa(),d=c(i,o.Re,t,r.yw,l,u);o.Ew.set(e,d),n?this.Kw(e,d,o.Re):this.Xw(e,d);let f={zh:X(d),Yw:n};if(!s)return this.qw(e,-1,f);let p={timeWeight:0,time:o.Hh,pointData:o,originalTime:Vr(o.Ew)},m=I(this.Fw,this.o_.key(p.time),((e,t)=>this.o_.key(e.time)<t));this.Fw.splice(m,0,p);for(let e=m;e<this.Fw.length;++e)Ur(this.Fw[e].pointData,e);return this.o_.fillWeightsForPoints(this.Fw,m),this.qw(e,m,f)}Zw(e,t){let n=this.Ow.get(e);if(n===void 0||t<=0)return[[],this.Gw()];
2t=Math.min(t,n.length);let r=n.splice(-t).reverse();n.length===0?this.Nw.delete(e):this.Nw.set(e,n[n.length-1].wt);for(let t of r){let n=this.Lw.get(this.o_.key(t.wt));if(n&&(n.Ew.delete(e),n.Ew.size===0)){this.Lw.delete(this.o_.key(n.Hh)),this.Fw.splice(n.Re,1);for(let e=n.Re;e<this.Fw.length;++e)Ur(this.Fw[e].pointData,e)}}return[r,this.qw(e,this.Fw.length-1,{Yw:!1,zh:!1})]}Xw(e,t){let n=this.Ow.get(e);n===void 0&&(n=[],this.Ow.set(e,n));let r=n.length===0?null:n[n.length-1];r===null||this.o_.key(t.wt)>this.o_.key(r.wt)?X(t)&&n.push(t):X(t)?n[n.length-1]=t:n.splice(-1,1),this.Nw.set(e,t.wt)}Kw(e,t,n){let r=this.Ow.get(e);if(r===void 0)return;let i=I(r,n,((e,t)=>e.Re<t));X(t)?r[i]=t:r.splice(i,1)}Uw(e,t){t.length===0?(this.Ow.delete(e),this.Nw.delete(e)):(this.Ow.set(e,t.filter(X)),this.Nw.set(e,t[t.length-1].wt))}Hw(){for(let e of this.Fw)e.pointData.Ew.size===0&&this.Lw.delete(this.o_.key(e.time))}$w(e){let t=-1;for(let n=0;n<this.Fw.length&&n<e.length;++n){let r=this.Fw[n],i=e[n];if(this.o_.key(r.time)!==this.o_.key(i.time)){t=n;break}i.timeWeight=r.timeWeight,Ur(i.pointData,n)}if(t===-1&&this.Fw.length!==e.length&&(t=Math.min(this.Fw.length,e.length)),t===-1)return-1;for(let n=t;n<e.length;++n)Ur(e[n].pointData,n);return this.o_.fillWeightsForPoints(e,t),this.Fw=e,t}Jw(){if(this.Ow.size===0)return null;let e=0;return this.Ow.forEach((t=>{t.length!==0&&(e=Math.max(e,t[t.length-1].Re))})),e}qw(e,t,n){let r=this.Gw();if(t!==-1)this.Ow.forEach(((t,i)=>{r.Oo.set(i,{se:t,Qw:i===e?n:void 0})})),this.Ow.has(e)||r.Oo.set(e,{se:[],Qw:n}),r.Et.tg=this.Fw,r.Et.ig=t;else{let t=this.Ow.get(e);r.Oo.set(e,{se:t||[],Qw:n})}return r}Gw(){return{Oo:new Map,Et:{_u:this.Jw()}}}};function Ur(e,t){e.Re=t,e.Ew.forEach((e=>{e.Re=t}))}function Wr(e,t){return e.wt<t}function Gr(e,t){return t<e.wt}function Kr(e,t,n){let r=t.Uh(),i=t.bi(),a=I(e,r,Wr),o=Tt(e,i,Gr);if(!n)return{from:a,to:o};let s=a,c=o;return a>0&&a<e.length&&e[a].wt>=r&&(s=a-1),o>0&&o<e.length&&e[o-1].wt<=i&&(c=o+1),{from:s,to:c}}var qr=class{constructor(e,t,n){this.sg=!0,this.ng=!0,this.eg=!0,this.rg=[],this.hg=null,this.Jn=e,this.Qn=t,this.ag=n}yt(e){this.sg=!0,e===`data`&&(this.ng=!0),e===`options`&&(this.eg=!0)}Tt(){return this.Jn.Vt()?(this.lg(),this.hg===null?null:this.og):null}_g(){this.rg=this.rg.map((e=>({...e,...this.Jn.Rh().Dr(e.wt)})))}ug(){this.hg=null}lg(){this.ng&&=(this.cg(),!1),this.eg&&=(this._g(),!1),this.sg&&=(this.dg(),!1)}dg(){let e=this.Jn.Ft(),t=this.Qn.Et();if(this.ug(),t.Ki()||e.Ki())return;let n=t.Pe();if(n===null||this.Jn.Xs().zr()===0)return;let r=this.Jn.zt();r!==null&&(this.hg=Kr(this.rg,n,this.ag),this.fg(e,t,r.Wt),this.pg())}},Jr=class{constructor(e,t){this.vg=e,this.Yi=t}nt(e,t,n){this.vg.draw(e,this.Yi,t,n)}},Yr=class extends qr{constructor(e,t,n){super(e,t,!1),this.sh=n,this.og=new Jr(this.sh.renderer(),(t=>{let n=e.zt();return n===null?null:e.Ft().Nt(t,n.Wt)}))}da(e){return this.sh.priceValueBuilder(e)}pa(e){return this.sh.isWhitespace(e)}cg(){let e=this.Jn.Rh();this.rg=this.Jn.Xs().Hr().map((t=>({wt:t.Re,_t:NaN,...e.Dr(t.Re),mg:t.se})))}fg(e,t){t.uu(this.rg,Te(this.hg))}pg(){this.sh.update({bars:this.rg.map(Xr),barSpacing:this.Qn.Et().mu(),visibleRange:this.hg},this.Jn.N())}};function Xr(e){return{x:e._t,time:e.wt,originalData:e.mg,barColor:e.cr}}var Zr={color:`#2196f3`},Qr=(e,t,n)=>new Yr(e,t,E(n));function $r(e){let t={value:e.Wt[3],time:e.yw};return e.Iw!==void 0&&(t.customValues=e.Iw),t}function ei(e){let t=$r(e);return e.R!==void 0&&(t.color=e.R),t}function ti(e){let t=$r(e);return e.vt!==void 0&&(t.lineColor=e.vt),e.mr!==void 0&&(t.topColor=e.mr),e.wr!==void 0&&(t.bottomColor=e.wr),t}function ni(e){let t=$r(e);return e.gr!==void 0&&(t.topLineColor=e.gr),e.Mr!==void 0&&(t.bottomLineColor=e.Mr),e.br!==void 0&&(t.topFillColor1=e.br),e.Sr!==void 0&&(t.topFillColor2=e.Sr),e.Cr!==void 0&&(t.bottomFillColor1=e.Cr),e.Pr!==void 0&&(t.bottomFillColor2=e.Pr),t}function ri(e){let t={open:e.Wt[0],high:e.Wt[1],low:e.Wt[2],close:e.Wt[3],time:e.yw};return e.Iw!==void 0&&(t.customValues=e.Iw),t}function ii(e){let t=ri(e);return e.R!==void 0&&(t.color=e.R),t}function ai(e){let t=ri(e),{R:n,Ht:r,vr:i}=e;return n!==void 0&&(t.color=n),r!==void 0&&(t.borderColor=r),i!==void 0&&(t.wickColor=i),t}function oi(e){return{Area:ti,Line:ei,Baseline:ni,Histogram:ei,Bar:ii,Candlestick:ai,Custom:si}[e]}function si(e){let t=e.yw;return{...e.se,time:t}}var ci={vertLine:{color:`#9598A1`,width:1,style:3,visible:!0,labelVisible:!0,labelBackgroun
2dColor:`#131722`},horzLine:{color:`#9598A1`,width:1,style:3,visible:!0,labelVisible:!0,labelBackgroundColor:`#131722`},mode:1},li={vertLines:{color:`#D6DCDE`,style:0,visible:!0},horzLines:{color:`#D6DCDE`,style:0,visible:!0}},ui={background:{type:`solid`,color:`#FFFFFF`},textColor:`#191919`,fontSize:12,fontFamily:Ee,panes:{enableResize:!0,separatorColor:`#E0E3EB`,separatorHoverColor:`rgba(178, 181, 189, 0.2)`},attributionLogo:!0,colorSpace:`srgb`,colorParsers:[]},di={autoScale:!0,mode:0,invertScale:!1,alignLabels:!0,borderVisible:!0,borderColor:`#2B2B43`,entireTextOnly:!1,visible:!1,ticksVisible:!1,scaleMargins:{bottom:.1,top:.2},minimumWidth:0,ensureEdgeTickMarksVisible:!1},fi={rightOffset:0,barSpacing:6,minBarSpacing:.5,maxBarSpacing:0,fixLeftEdge:!1,fixRightEdge:!1,lockVisibleTimeRangeOnResize:!1,rightBarStaysOnScroll:!1,borderVisible:!0,borderColor:`#2B2B43`,visible:!0,timeVisible:!1,secondsVisible:!0,shiftVisibleRangeOnNewBar:!0,allowShiftVisibleRangeOnWhitespaceReplacement:!1,ticksVisible:!1,uniformDistribution:!1,minimumHeight:0,allowBoldLabels:!0,ignoreWhitespaceIndices:!1};function pi(){return{addDefaultPane:!0,width:0,height:0,autoSize:!1,layout:ui,crosshair:ci,grid:li,overlayPriceScales:{...di},leftPriceScale:{...di,visible:!1},rightPriceScale:{...di,visible:!0},timeScale:fi,localization:{locale:G?navigator.language:``,dateFormat:`dd MMM 'yy`},handleScroll:{mouseWheel:!0,pressedMouseMove:!0,horzTouchDrag:!0,vertTouchDrag:!0},handleScale:{axisPressedMouseMove:{time:!0,price:!0},axisDoubleClickReset:{time:!0,price:!0},mouseWheel:!0,pinch:!0},kineticScroll:{mouse:!1,touch:!0},trackingMode:{exitMode:1}}}var mi=class{constructor(e,t,n){this.Hf=e,this.wg=t,this.gg=n??0}applyOptions(e){this.Hf.Qt().oc(this.wg,e,this.gg)}options(){return this.Yi().N()}width(){return $e(this.wg)?this.Hf.ow(this.wg):0}setVisibleRange(e){this.setAutoScale(!1),this.Yi().Fl(new F(e.from,e.to))}getVisibleRange(){let e,t,n=this.Yi().Qe();if(n===null)return null;if(this.Yi().Ja()){let r=this.Yi().fo(),i=jn(r);n=U(n,this.Yi().tl()),e=Number((Math.round(n.$e()/r)*r).toFixed(i)),t=Number((Math.round(n.qe()/r)*r).toFixed(i))}else e=n.$e(),t=n.qe();return{from:e,to:t}}setAutoScale(e){this.applyOptions({autoScale:e})}Yi(){return T(this.Hf.Qt()._c(this.wg,this.gg)).Ft}},hi=class{constructor(e,t,n,r){this.Hf=e,this.Pt=n,this.Mg=t,this.bg=r}getHeight(){return this.Pt.$t()}setHeight(e){let t=this.Hf.Qt(),n=t.Uc(this.Pt);t.vc(n,e)}getStretchFactor(){return this.Pt.Bo()}setStretchFactor(e){this.Pt.Io(e),this.Hf.Qt().Ih()}paneIndex(){return this.Hf.Qt().Uc(this.Pt)}moveTo(e){let t=this.paneIndex();t!==e&&(C(e>=0&&e<this.Hf.$f().length,`Invalid pane index`),this.Hf.Qt().wc(t,e))}getSeries(){return this.Pt.Oo().map((e=>this.Mg(e)))??[]}getHTMLElement(){let e=this.Hf.$f();return e&&e.length!==0&&e[this.paneIndex()]?e[this.paneIndex()].Zf():null}attachPrimitive(e){this.Pt._a(e),e.attached&&e.attached({chart:this.bg,requestUpdate:()=>this.Pt.Qt().Ih()})}detachPrimitive(e){this.Pt.ua(e)}priceScale(e){if(this.Pt.Do(e)===null)throw Error(`Cannot find price scale with id: ${e}`);return new mi(this.Hf,e,this.paneIndex())}setPreserveEmptyPane(e){this.Pt.zo(e)}preserveEmptyPane(){return this.Pt.Lo()}addCustomSeries(e,t={},n=0){return this.bg.addCustomSeries(e,t,n)}addSeries(e,t={}){return this.bg.addSeries(e,t,this.paneIndex())}},gi={color:`#FF0000`,price:0,lineStyle:2,lineWidth:1,lineVisible:!0,axisLabelVisible:!0,title:``,axisLabelColor:``,axisLabelTextColor:``},_i=class{constructor(e){this.ir=e}applyOptions(e){this.ir.hr(e)}options(){return this.ir.N()}Sg(){return this.ir}},vi=class{constructor(e,t,n,r,i,a){this.xg=new D,this.Jn=e,this.Cg=t,this.Pg=n,this.o_=i,this.bg=r,this.yg=a}m(){this.xg.m()}priceFormatter(){return this.Jn.ea()}priceToCoordinate(e){let t=this.Jn.zt();return t===null?null:this.Jn.Ft().Nt(e,t.Wt)}coordinateToPrice(e){let t=this.Jn.zt();return t===null?null:this.Jn.Ft().Ts(e,t.Wt)}barsInLogicalRange(e){if(e===null)return null;let t=new Sn(new W(e.from,e.to)).y_(),n=this.Jn.Xs();if(n.Ki())return null;let r=n.Fr(t.Uh(),1),i=n.Fr(t.bi(),-1),a=T(n.Lr()),o=T(n.Ks());if(r!==null&&i!==null&&r.Re>i.Re)return{barsBefore:e.from-a,barsAfter:o-e.to};let s={barsBefore:r===null||r.Re===a?e.from-a:r.Re-a,barsAfter:i===null||i.Re===o?o-e.to:o-i.Re};return r!==null&&i!==null&&(s.from=r.yw,s.to=i.yw),s}setData(e){this.o_,this.Jn.Rr(),this.Cg.kg(this.Jn,e),this.Tg(`full`)}update(e,t=!1){this.Jn.Rr(),this.Cg.Rg(this.Jn,e,t),this.Tg(`update`)}pop(e=1){let t=this.Cg.Dg(this.Jn,e);t.length!==0&&this.Tg(`update`);let n=oi(this.seriesType());return t.map((e=>n(e)))}dataByIndex(e,t){let n=this.Jn.Xs().Fr(e,t);return n===null?null:oi(this.seriesType())(n)}data(){let e=oi(this.seriesType());return this.Jn.Xs().Hr().map((t=>e(t)))}subscribeDataChanged(e){this.xg.i(e)}unsubscribeDataChanged(e){this.xg._(e)}
2applyOptions(e){this.Jn.hr(e)}options(){return A(this.Jn.N())}priceScale(){return this.Pg.priceScale(this.Jn.Ft().ma(),this.getPane().paneIndex())}createPriceLine(e){let t=O(A(gi),e);return new _i(this.Jn.Oh(t))}removePriceLine(e){this.Jn.Nh(e.Sg())}priceLines(){return this.Jn.Fh().map((e=>new _i(e)))}seriesType(){return this.Jn.Rr()}lastValueData(e){let t=this.Jn.ye(e);return t.ke?{noData:!0}:{noData:!1,price:t.gt,color:t.R}}attachPrimitive(e){this.Jn._a(e),e.attached&&e.attached({chart:this.bg,series:this,requestUpdate:()=>this.Jn.Qt().Ih(),horzScaleBehavior:this.o_})}detachPrimitive(e){this.Jn.ua(e),e.detached&&e.detached(),this.Jn.Qt().Ih()}getPane(){let e=this.Jn,t=T(this.Jn.Qt().Hn(e));return this.yg(t)}moveToPane(e){this.Jn.Qt().Nc(this.Jn,e)}seriesOrder(){let e=this.Jn.Qt().Hn(this.Jn);return e===null?-1:e.Oo().indexOf(this.Jn)}setSeriesOrder(e){let t=this.Jn.Qt().Hn(this.Jn);t!==null&&t.Qo(this.Jn,e)}Tg(e){this.xg.v()&&this.xg.p(e)}},yi=class{constructor(e,t,n){this.Vg=new D,this.z_=new D,this.gm=new D,this.ts=e,this.uh=e.Et(),this.Zm=t,this.uh.Vu().i(this.Bg.bind(this)),this.uh.Bu().i(this.Ig.bind(this)),this.Zm.ym().i(this.Eg.bind(this)),this.o_=n}m(){this.uh.Vu().u(this),this.uh.Bu().u(this),this.Zm.ym().u(this),this.Vg.m(),this.z_.m(),this.gm.m()}scrollPosition(){return this.uh.gu()}scrollToPosition(e,t){t?this.uh.Tu(e,1e3):this.ts.fn(e)}scrollToRealTime(){this.uh.ku()}getVisibleRange(){let e=this.uh.nu();return e===null?null:{from:e.from.originalTime,to:e.to.originalTime}}setVisibleRange(e){let t={from:this.o_.convertHorzItemToInternal(e.from),to:this.o_.convertHorzItemToInternal(e.to)},n=this.uh.au(t);this.ts.Lc(n)}getVisibleLogicalRange(){let e=this.uh.su();return e===null?null:{from:e.Uh(),to:e.bi()}}setVisibleLogicalRange(e){C(e.from<=e.to,`The from index cannot be after the to index.`),this.ts.Lc(e)}resetTimeScale(){this.ts.cn()}fitContent(){this.ts.Au()}logicalToCoordinate(e){let t=this.ts.Et();return t.Ki()?null:t.qt(e)}coordinateToLogical(e){return this.uh.Ki()?null:this.uh.cu(e)}timeToIndex(e,t){let n=this.o_.convertHorzItemToInternal(e);return this.uh.Q_(n,t)}timeToCoordinate(e){let t=this.timeToIndex(e,!1);return t===null?null:this.uh.qt(t)}coordinateToTime(e){let t=this.ts.Et(),n=t.cu(e),r=t.ss(n);return r===null?null:r.originalTime}width(){return this.Zm.Gf().width}height(){return this.Zm.Gf().height}subscribeVisibleTimeRangeChange(e){this.Vg.i(e)}unsubscribeVisibleTimeRangeChange(e){this.Vg._(e)}subscribeVisibleLogicalRangeChange(e){this.z_.i(e)}unsubscribeVisibleLogicalRangeChange(e){this.z_._(e)}subscribeSizeChange(e){this.gm.i(e)}unsubscribeSizeChange(e){this.gm._(e)}applyOptions(e){this.uh.hr(e)}options(){return{...A(this.uh.N()),barSpacing:this.uh.mu()}}Bg(){this.Vg.v()&&this.Vg.p(this.getVisibleRange())}Ig(){this.z_.v()&&this.z_.p(this.getVisibleLogicalRange())}Eg(e){this.gm.p(e.width,e.height)}};function bi(e){return function(e){if(Ce(e.handleScale)){let t=e.handleScale;e.handleScale={axisDoubleClickReset:{time:t,price:t},axisPressedMouseMove:{time:t,price:t},mouseWheel:t,pinch:t}}else if(e.handleScale!==void 0){let{axisPressedMouseMove:t,axisDoubleClickReset:n}=e.handleScale;Ce(t)&&(e.handleScale.axisPressedMouseMove={time:t,price:t}),Ce(n)&&(e.handleScale.axisDoubleClickReset={time:n,price:n})}let t=e.handleScroll;Ce(t)&&(e.handleScroll={horzTouchDrag:t,vertTouchDrag:t,mouseWheel:t,pressedMouseMove:t})}(e),e}var xi=class{constructor(e,t,n){this.Ag=new Map,this.zg=new Map,this.Lg=new D,this.Og=new D,this.Ng=new D,this.qu=new WeakMap,this.Fg=new Hr(t);let r=n===void 0?A(pi()):O(A(pi()),bi(n));this.Wg=t,this.Hf=new Dr(e,r,t),this.Hf.Xv().i((e=>{this.Lg.v()&&this.Lg.p(this.Hg(e()))}),this),this.Hf.Zv().i((e=>{this.Og.v()&&this.Og.p(this.Hg(e()))}),this),this.Hf.cc().i((e=>{this.Ng.v()&&this.Ng.p(this.Hg(e()))}),this),this.Ug=new yi(this.Hf.Qt(),this.Hf.iw(),this.Wg)}remove(){this.Hf.Xv().u(this),this.Hf.Zv().u(this),this.Hf.cc().u(this),this.Ug.m(),this.Hf.m(),this.Ag.clear(),this.zg.clear(),this.Lg.m(),this.Og.m(),this.Ng.m(),this.Fg.m()}resize(e,t,n){this.autoSizeActive()||this.Hf.Jm(e,t,n)}addCustomSeries(e,t={},n=0){let r=(e=>({type:`Custom`,isBuiltIn:!1,defaultOptions:{...Zr,...e.defaultOptions()},$g:Qr,qg:e}))(E(e));return this.Yg(r,t,n)}addSeries(e,t={},n=0){return this.Yg(e,t,n)}removeSeries(e){let t=w(this.Ag.get(e)),n=this.Fg.Ac(t);this.Hf.Qt().Ac(t),this.jg(n),this.Ag.delete(e),this.zg.delete(t)}kg(e,t){this.jg(this.Fg.Ww(e,t))}Rg(e,t,n){this.jg(this.Fg.jw(e,t,n))}Dg(e,t){let[n,r]=this.Fg.Zw(e,t);return n.length!==0&&this.jg(r),n}subscribeClick(e){this.Lg.i(e)}unsubscribeClick(e){this.Lg._(e)}subscribeCrosshairMove(e){this.Ng.i(e)}unsubscribeCrosshairMove(e){this.Ng._(e)}subscribeDblClick(e){this.Og.i(e)}unsubscribeDblClick(e){this.Og._(e)}priceScale(e,t=0){return new mi(this.Hf,e,t)}timeScale(){return this.Ug}applyOptions(e){this.Hf.hr(bi(e))}options(){return this.Hf.N()}takeScreenshot(e=!1,t=!1){let n,r;try{t||(n=this.Hf.Qt().N().crosshair.mode,this.Hf.hr({crosshair:{mode:2}})),r=this.Hf.aw(e)}finally{t||n===void 0||this.Hf.Qt().hr({crosshair:{mode:n}})}return r}addPane(e=!1){let t=this.Hf.Qt().$c();return t.zo(e),this.Kg(t)}removePane(e){this.Hf.Qt().fc(e)}swapPanes(e,t){this.Hf.Qt().mc(e,t)}autoSizeActive(){return this.Hf.cw()}chartElement(){return this.Hf.ip()}panes(){return this.Hf.Qt().$s().map((e=>this.Kg(e)))}paneSize(e=0){let t=this.Hf.pw(e);return{height:t.height,width:t.width}}setCrosshairPosition(e,t,n){let r=this.Ag.get(n);if(r===void 0)return;let i=this.Hf.Qt().Hn(r);i!==null&&this.Hf.Qt().Rc(e,t,i)}clearCrosshairPosition(){this.Hf.Qt().Dc(!0)}horzBehaviour(){return this.Wg}Yg(e,t={},n=0){C(e.$g!==void 0),function(e){if(e===void 0||e.type===`custom`)return;let t=e;t.minMove!==void 0&&t.precision===void 0&&(t.precision=jn(t.minMove))}(t.priceFormat),e.type===`Candlestick`&&function(e){e.borderColor!==void 0&&(e.borderUpColor=e.borderColor,e.borderDownColor=e.borderColor),e.wickColor!==void 0&&(e.wickUpColor=e.wickColor,e.wickDownColor=e.wickColor)}(t);let r=O(A(_e),A(e.defaultOptions),t),i=e.$g,a=new Gt(this.Hf.Qt(),e.type,r,i,e.qg);this.Hf.Qt().Ic(a,n);let o=new vi(a,this,this,this,this.Wg,(e=>this.Kg(e)));return this.Ag.set(o,a),this.zg.set(a,o),o}jg(e){let t=this.Hf.Qt();t.Vc(e.Et._u,e.Et.tg,e.Et.ig),e.Oo.forEach(((e,t)=>t.ht(e.se,e.Qw))),t.Et().K_(),t.vu()}Xg(e){return w(this.zg.get(e))}Hg(e){let t=new Map;e.Dw.forEach(((e,n)=>{let r=n.Rr(),i=oi(r)(e);if(r!==`Custom`)C(Ar(i));else{let e=n.fa();C(!e||!1===e(i))}t.set(this.Xg(n),i)}));let n=e.Rw!==void 0&&this.zg.has(e.Rw)?this.Xg(e.Rw):void 0;return{time:e.yw,logical:e.Re,point:e.kw,paneIndex:e.Tw,hoveredSeries:n,hoveredObjectId:e.Vw,seriesData:t,sourceEvent:e.Bw}}Kg(e){let t=this.qu.get(e);return t||(t=new hi(this.Hf,(e=>
2this.Xg(e)),e,this),this.qu.set(e,t)),t}};function Si(e){if(Se(e)){let t=document.getElementById(e);return C(t!==null,`Cannot find element in DOM with id=${e}`),t}return e}function Ci(e,t,n){let r=new xi(Si(e),t,n);return t.setOptions(r.options()),r}function wi(e,t){return Ci(e,new Yn,Yn.ld(t))}var Ti=class extends qr{constructor(e,t){super(e,t,!0)}fg(e,t,n){t.uu(this.rg,Te(this.hg)),e.Ul(this.rg,n,Te(this.hg))}Zg(e,t){return{wt:e,gt:t,_t:NaN,ut:NaN}}cg(){let e=this.Jn.Rh();this.rg=this.Jn.Xs().Hr().map((t=>{let n=t.Wt[3];return this.Gg(t.Re,n,e)}))}};function Ei(e,t,n,r,i,a,o){if(t.length===0||r.from>=t.length||r.to<=0)return;let{context:s,horizontalPixelRatio:c,verticalPixelRatio:l}=e,u=t[r.from],d=a(e,u),f=u;if(r.to-r.from<2){let t=i/2;s.beginPath();let n={_t:u._t-t,ut:u.ut},r={_t:u._t+t,ut:u.ut};s.moveTo(n._t*c,n.ut*l),s.lineTo(r._t*c,r.ut*l),o(e,d,n,r)}else{let i=(t,n)=>{o(e,d,f,n),s.beginPath(),d=t,f=n},p=f;s.beginPath(),s.moveTo(u._t*c,u.ut*l);for(let o=r.from+1;o<r.to;++o){p=t[o];let r=a(e,p);switch(n){case 0:s.lineTo(p._t*c,p.ut*l);break;case 1:s.lineTo(p._t*c,t[o-1].ut*l),r!==d&&(i(r,p),s.lineTo(p._t*c,t[o-1].ut*l)),s.lineTo(p._t*c,p.ut*l);break;case 2:{let[e,n]=Ai(t,o-1,o);s.bezierCurveTo(e._t*c,e.ut*l,n._t*c,n.ut*l,p._t*c,p.ut*l);break}}n!==1&&r!==d&&(i(r,p),s.moveTo(p._t*c,p.ut*l))}(f!==p||f===p&&n===1)&&o(e,d,f,p)}}var Di=6;function Oi(e,t){return{_t:e._t-t._t,ut:e.ut-t.ut}}function ki(e,t){return{_t:e._t/t,ut:e.ut/t}}function Ai(e,t,n){let r=Math.max(0,t-1),i=Math.min(e.length-1,n+1);var a,o;return[(a=e[t],o=ki(Oi(e[n],e[r]),Di),{_t:a._t+o._t,ut:a.ut+o.ut}),Oi(e[n],ki(Oi(e[i],e[t]),Di))]}function ji(e,t){let n=e.context;n.strokeStyle=t,n.stroke()}var Mi=class extends j{constructor(){super(...arguments),this.rt=null}ht(e){this.rt=e}et(e){if(this.rt===null)return;let{ot:t,lt:n,Jg:r,Qg:i,ct:a,Xt:o,tM:s}=this.rt;if(n===null)return;let c=e.context;c.lineCap=`butt`,c.lineWidth=a*e.verticalPixelRatio,S(c,o),c.lineJoin=`round`;let l=this.iM.bind(this);i!==void 0&&Ei(e,t,i,n,r,l,ji),s&&function(e,t,n,r,i){if(r.to-r.from<=0)return;let{horizontalPixelRatio:a,verticalPixelRatio:o,context:s}=e,c=null,l=Math.max(1,Math.floor(a))%2/2,u=n*o+l;for(let n=r.to-1;n>=r.from;--n){let r=t[n];if(r){let t=i(e,r);t!==c&&(s.beginPath(),c!==null&&s.fill(),s.fillStyle=t,c=t);let n=Math.round(r._t*a)+l,d=r.ut*o;s.moveTo(n,d),s.arc(n,d,u,0,2*Math.PI)}}s.fill()}(e,t,s,n,l)}},Ni=class extends Mi{iM(e,t){return t.vt}},Pi=class extends Ti{constructor(){super(...arguments),this.og=new Ni}Gg(e,t,n){return{...this.Zg(e,t),...n.Dr(e)}}pg(){let e=this.Jn.N(),t={ot:this.rg,Xt:e.lineStyle,Qg:e.lineVisible?e.lineType:void 0,ct:e.lineWidth,tM:e.pointMarkersVisible?e.pointMarkersRadius||e.lineWidth/2+2:void 0,lt:this.hg,Jg:this.Qn.Et().mu()};this.og.ht(t)}},Fi={type:`Line`,isBuiltIn:!0,defaultOptions:{color:`#2196f3`,lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:``,crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:``,lastPriceAnimation:0,pointMarkersVisible:!1},$g:(e,t)=>new Pi(e,t)};function Ii(e,t,n,r,i){let{context:a,horizontalPixelRatio:o,verticalPixelRatio:s}=t;a.lineTo(i._t*o,e*s),a.lineTo(r._t*o,e*s),a.closePath(),a.fillStyle=n,a.fill()}var Li=class extends j{constructor(){super(...arguments),this.rt=null}ht(e){this.rt=e}et(e){if(this.rt===null)return;let{ot:t,lt:n,Jg:r,ct:i,Xt:a,Qg:o}=this.rt,s=this.rt.lM??(this.rt.oM?0:e.mediaSize.height);if(n===null)return;let c=e.context;c.lineCap=`butt`,c.lineJoin=`round`,c.lineWidth=i,S(c,a),c.lineWidth=1,Ei(e,t,o,n,r,this._M.bind(this),Ii.bind(null,s))}},Ri=class{uM(e,t){let n=this.cM,{dM:r,fM:i,pM:a,vM:o,lM:s,mM:c,wM:l}=t;if(this.gM===void 0||n===void 0||n.dM!==r||n.fM!==i||n.pM!==a||n.vM!==o||n.lM!==s||n.mM!==c||n.wM!==l){let{verticalPixelRatio:n}=e,u=s||c>0?n:1,d=c*u,f=l===e.bitmapSize.height?l:l*u,p=(s??0)*u,m=e.context.createLinearGradient(0,d,0,f);if(m.addColorStop(0,r),s!=null){let e=R((p-d)/(f-d),0,1);m.addColorStop(e,i),m.addColorStop(e,a)}m.addColorStop(1,o),this.gM=m,this.cM=t}return this.gM}},zi=class extends Li{constructor(){super(...arguments),this.MM=new Ri}_M(e,t){let n=this.rt;return this.MM.uM(e,{dM:t.br,fM:t.Sr,pM:t.Cr,vM:t.Pr,lM:n.lM,mM:n.mM??0,wM:n.wM??e.bitmapSize.height})}},Bi=class extends Mi{constructor(){super(...arguments),this.bM=new Ri}iM(e,t){let n=this.rt;return this.bM.uM(e,{dM:t.gr,fM:t.gr,pM:t.Mr,vM:t.Mr,lM:n.lM,mM:n.mM??0,wM:n.wM??e.bitmapSize.height})}},Vi=class extends Ti{constructor(e,t){super(e,t),this.og=new Me,this.SM=new zi,this.xM=new Bi,this.og.st([this.SM,this.xM])}Gg(e,t,n){return{...this.Zg(e,t),...n.Dr(e)}}pg(){let e=this.Jn.zt();if(e===null)return;let t=this.Jn.N(),n=this.Jn.Ft().Nt(t.baseValue.price,e.Wt),r=this.Qn.Et().mu();if(this.hg===null||this.rg.length===0)return;let i,a;if(t.relativeGradient){i=this.rg[this.hg.from].ut,a=this.rg[this.hg.from].ut;for(let e=this.hg.from;e<this.hg.to;e++){let t=this.rg[e];t.ut<i&&(i=t.ut),t.ut>a&&(a=t.ut)}}this.SM.ht({ot:this.rg,ct:t.lineWidth,Xt:t.lineStyle,Qg:t.lineType,lM:n,mM:i,wM:a,oM:!1,lt:this.hg,Jg:r}),this.xM.ht({ot:this.rg,ct:t.lineWidth,Xt:t.lineStyle,Qg:t.lineVisible?t.lineType:void 0,tM:t.pointMarkersVisible?t.pointMarkersRadius||t.lineWidth/2+2:void 0,lM:n,mM:i,wM:a,lt:this.hg,Jg:r})}},Hi={type:`Baseline`,isBuiltIn:!0,defaultOptions:{baseValue:{type:`price`,price:0},relativeGradient:!1,topFillColor1:`rgba(38, 166, 154, 0.28)`,topFillColor2:`rgba(38, 166, 154, 0.05)`,topLineColor:`rgba(38, 166, 154, 1)`,bottomFillColor1:`rgba(239, 83, 80, 0.05)`,bottomFillColor2:`rgba(239, 83, 80, 0.28)`,bottomLineColor:`rgba(239, 83, 80, 1)`,lineWidth:3,lineStyle:0,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:``,crosshairMarkerBorderWidth:2,crosshairMarkerBackgroun
2dColor:``,lastPriceAnimation:0,pointMarkersVisible:!1},$g:(e,t)=>new Vi(e,t)},Ui=class extends Li{constructor(){super(...arguments),this.MM=new Ri}_M(e,t){return this.MM.uM(e,{dM:t.mr,fM:``,pM:``,vM:t.wr,mM:this.rt?.mM??0,wM:e.bitmapSize.height})}},Wi=class extends Ti{constructor(e,t){super(e,t),this.og=new Me,this.CM=new Ui,this.PM=new Ni,this.og.st([this.CM,this.PM])}Gg(e,t,n){return{...this.Zg(e,t),...n.Dr(e)}}pg(){let e=this.Jn.N();if(this.hg===null||this.rg.length===0)return;let t;if(e.relativeGradient){t=this.rg[this.hg.from].ut;for(let e=this.hg.from;e<this.hg.to;e++){let n=this.rg[e];n.ut<t&&(t=n.ut)}}this.CM.ht({Qg:e.lineType,ot:this.rg,Xt:e.lineStyle,ct:e.lineWidth,lM:null,mM:t,oM:e.invertFilledArea,lt:this.hg,Jg:this.Qn.Et().mu()}),this.PM.ht({Qg:e.lineVisible?e.lineType:void 0,ot:this.rg,Xt:e.lineStyle,ct:e.lineWidth,lt:this.hg,Jg:this.Qn.Et().mu(),tM:e.pointMarkersVisible?e.pointMarkersRadius||e.lineWidth/2+2:void 0})}},Gi={type:`Area`,isBuiltIn:!0,defaultOptions:{topColor:`rgba( 46, 220, 135, 0.4)`,bottomColor:`rgba( 40, 221, 100, 0)`,invertFilledArea:!1,relativeGradient:!1,lineColor:`#33D778`,lineStyle:0,lineWidth:3,lineType:0,lineVisible:!0,crosshairMarkerVisible:!0,crosshairMarkerRadius:4,crosshairMarkerBorderColor:``,crosshairMarkerBorderWidth:2,crosshairMarkerBackgroundColor:``,lastPriceAnimation:0,pointMarkersVisible:!1},$g:(e,t)=>new Wi(e,t)},Ki=class extends qr{constructor(e,t){super(e,t,!1)}fg(e,t,n){t.uu(this.rg,Te(this.hg)),e.ql(this.rg,n,Te(this.hg))}VM(e,t,n){return{wt:e,qh:t.Wt[0],Yh:t.Wt[1],jh:t.Wt[2],Kh:t.Wt[3],_t:NaN,Yl:NaN,jl:NaN,Kl:NaN,Xl:NaN}}cg(){let e=this.Jn.Rh();this.rg=this.Jn.Xs().Hr().map((t=>this.Gg(t.Re,t,e)))}},qi=class extends j{constructor(){super(...arguments),this.Yt=null,this.yM=0}ht(e){this.Yt=e}et(e){if(this.Yt===null||this.Yt.Xs.length===0||this.Yt.lt===null)return;let{horizontalPixelRatio:t}=e;this.yM=function(e,t){if(e>=2.5&&e<=4)return Math.floor(3*t);let n=1-.2*Math.atan(Math.max(4,e)-4)/(.5*Math.PI),r=Math.floor(e*n*t),i=Math.floor(e*t);return Math.max(Math.floor(t),Math.min(r,i))}(this.Yt.mu,t),this.yM>=2&&Math.floor(t)%2!=this.yM%2&&this.yM--;let n=this.Yt.Xs;this.Yt.BM&&this.IM(e,n,this.Yt.lt),this.Yt.Mi&&this.uv(e,n,this.Yt.lt);let r=this.EM(t);(!this.Yt.Mi||this.yM>2*r)&&this.AM(e,n,this.Yt.lt)}IM(e,t,n){if(this.Yt===null)return;let{context:r,horizontalPixelRatio:i,verticalPixelRatio:a}=e,o=``,s=Math.min(Math.floor(i),Math.floor(this.Yt.mu*i));s=Math.max(Math.floor(i),Math.min(s,this.yM));let c=Math.floor(.5*s),l=null;for(let e=n.from;e<n.to;e++){let n=t[e];n.pr!==o&&(r.fillStyle=n.pr,o=n.pr);let u=Math.round(Math.min(n.Yl,n.Xl)*a),d=Math.round(Math.max(n.Yl,n.Xl)*a),f=Math.round(n.jl*a),p=Math.round(n.Kl*a),m=Math.round(i*n._t)-c,h=m+s-1;l!==null&&(m=Math.max(l+1,m),m=Math.min(m,h));let ee=h-m+1;r.fillRect(m,f,ee,u-f),r.fillRect(m,d+1,ee,p-d),l=h}}EM(e){let t=Math.floor(1*e);this.yM<=2*t&&(t=Math.floor(.5*(this.yM-1)));let n=Math.max(Math.floor(e),t);return this.yM<=2*n?Math.max(Math.floor(e),Math.floor(1*e)):n}uv(e,t,n){if(this.Yt===null)return;let{context:r,horizontalPixelRatio:i,verticalPixelRatio:a}=e,o=``,s=this.EM(i),c=null;for(let e=n.from;e<n.to;e++){let n=t[e];n.dr!==o&&(r.fillStyle=n.dr,o=n.dr);let l=Math.round(n._t*i)-Math.floor(.5*this.yM),u=l+this.yM-1,d=Math.round(Math.min(n.Yl,n.Xl)*a),f=Math.round(Math.max(n.Yl,n.Xl)*a);if(c!==null&&(l=Math.max(c+1,l),l=Math.min(l,u)),this.Yt.mu*i>2*s)ze(r,l,d,u-l+1,f-d+1,s);else{let e=u-l+1;r.fillRect(l,d,e,f-d+1)}c=u}}AM(e,t,n){if(this.Yt===null)return;let{context:r,horizontalPixelRatio:i,verticalPixelRatio:a}=e,o=``,s=this.EM(i);for(let e=n.from;e<n.to;e++){let n=t[e],c=Math.round(Math.min(n.Yl,n.Xl)*a),l=Math.round(Math.max(n.Yl,n.Xl)*a),u=Math.round(n._t*i)-Math.floor(.5*this.yM),d=u+this.yM-1;if(n.cr!==o){let e=n.cr;r.fillStyle=e,o=e}this.Yt.Mi&&(u+=s,c+=s,d-=s,l-=s),c>l||r.fillRect(u,c,d-u+1,l-c+1)}}},Ji=class extends Ki{constructor(){super(...arguments),this.og=new qi}Gg(e,t,n){return{...this.VM(e,t,n),...n.Dr(e)}}pg(){let e=this.Jn.N();this.og.ht({Xs:this.rg,mu:this.Qn.Et().mu(),BM:e.wickVisible,Mi:e.borderVisible,lt:this.hg})}},Yi={type:`Candlestick`,isBuiltIn:!0,defaultOptions:{upColor:`#26a69a`,downColor:`#ef5350`,wickVisible:!0,borderVisible:!0,borderColor:`#378658`,borderUpColor:`#26a69a`,borderDownColor:`#ef5350`,wickColor:`#737375`,wickUpColor:`#26a69a`,wickDownColor:`#ef5350`},$g:(e,t)=>new Ji(e,t)},Xi=class extends j{constructor(){super(...arguments),this.Yt=null,this.zM=[]}ht(e){this.Yt=e,this.zM=[]}et({context:e,horizontalPixelRatio:t,verticalPixelRatio:n}){if(this.Yt===null||this.Yt.ot.length===0||this.Yt.lt===null)return;this.zM.length||this.LM(t);let r=Math.max(1,Math.floor(n)),i=Math.round(this.Yt.OM*n)-Math.floor(r/2),a=i+r;for(let t=this.Yt.lt.from;t<this.Yt.lt.to;t++){let o=this.Yt.ot[t],s=this.zM[t-this.Yt.lt.from],c=Math.round(o.ut*n),l,u;
2e.fillStyle=o.cr,c<=i?(l=c,u=a):(l=i,u=c-Math.floor(r/2)+r),e.fillRect(s.Uh,l,s.bi-s.Uh+1,u-l)}}LM(e){if(this.Yt===null||this.Yt.ot.length===0||this.Yt.lt===null)return void(this.zM=[]);let t=Math.ceil(this.Yt.mu*e)<=1?0:Math.max(1,Math.floor(e)),n=Math.round(this.Yt.mu*e)-t;this.zM=Array(this.Yt.lt.to-this.Yt.lt.from);for(let t=this.Yt.lt.from;t<this.Yt.lt.to;t++){let r=this.Yt.ot[t],i=Math.round(r._t*e),a,o;if(n%2){let e=(n-1)/2;a=i-e,o=i+e}else{let e=n/2;a=i-e,o=i+e-1}this.zM[t-this.Yt.lt.from]={Uh:a,bi:o,NM:i,ne:r._t*e,wt:r.wt}}for(let e=this.Yt.lt.from+1;e<this.Yt.lt.to;e++){let n=this.zM[e-this.Yt.lt.from],r=this.zM[e-this.Yt.lt.from-1];n.wt===r.wt+1&&n.Uh-r.bi!==t+1&&(r.NM>r.ne?r.bi=n.Uh-t-1:n.Uh=r.bi+t+1)}let r=Math.ceil(this.Yt.mu*e);for(let e=this.Yt.lt.from;e<this.Yt.lt.to;e++){let t=this.zM[e-this.Yt.lt.from];t.bi<t.Uh&&(t.bi=t.Uh);let n=t.bi-t.Uh+1;r=Math.min(n,r)}if(t>0&&r<4)for(let e=this.Yt.lt.from;e<this.Yt.lt.to;e++){let t=this.zM[e-this.Yt.lt.from];t.bi-t.Uh+1>r&&(t.NM>t.ne?--t.bi:t.Uh+=1)}}},Zi=class extends Ti{constructor(){super(...arguments),this.og=new Xi}Gg(e,t,n){return{...this.Zg(e,t),...n.Dr(e)}}pg(){let e={ot:this.rg,mu:this.Qn.Et().mu(),lt:this.hg,OM:this.Jn.Ft().Nt(this.Jn.N().base,T(this.Jn.zt()).Wt)};this.og.ht(e)}},Qi={type:`Histogram`,isBuiltIn:!0,defaultOptions:{color:`#26a69a`,base:0},$g:(e,t)=>new Zi(e,t)},$i=class{constructor(e,t){this.Jn=e,this.ah=t,this.WM()}detach(){this.Jn.detachPrimitive(this.ah)}getSeries(){return this.Jn}applyOptions(e){this.ah&&this.ah.hr&&this.ah.hr(e)}WM(){this.Jn.attachPrimitive(this.ah)}},ea={autoScale:!0,zOrder:`normal`};function Q(e,t){return Xt(Math.min(Math.max(e,12),30)*t)}function $(e,t){switch(e){case`arrowDown`:case`arrowUp`:return Q(t,1);case`circle`:return Q(t,.8);case`square`:return Q(t,.7)}}function ta(e){return function(e){let t=Math.ceil(e);return t%2==0?t:t-1}(Q(e,1))}function na(e){return Math.max(Q(e,.1),3)}function ra(e,t,n){return t?e:n?Math.ceil(e/2):0}function ia(e,t,n,r){let i=($(`arrowUp`,r)-1)/2*n._b,a=(Xt(r/2)-1)/2*n._b;t.beginPath(),e?(t.moveTo(n._t-i,n.ut),t.lineTo(n._t,n.ut-i),t.lineTo(n._t+i,n.ut),t.lineTo(n._t+a,n.ut),t.lineTo(n._t+a,n.ut+i),t.lineTo(n._t-a,n.ut+i),t.lineTo(n._t-a,n.ut)):(t.moveTo(n._t-i,n.ut),t.lineTo(n._t,n.ut+i),t.lineTo(n._t+i,n.ut),t.lineTo(n._t+a,n.ut),t.lineTo(n._t+a,n.ut-i),t.lineTo(n._t-a,n.ut-i),t.lineTo(n._t-a,n.ut)),t.fill()}function aa(e,t,n,r,i,a){let o=($(`arrowUp`,r)-1)/2,s=(Xt(r/2)-1)/2;return i>=t-s-2&&i<=t+s+2&&a>=(e?n:n-o)-2&&a<=(e?n+o:n)+2?!0:(()=>
2{if(i<t-o-3||i>t+o+3||a<(e?n-o-3:n)||a>(e?n:n+o+3))return!1;let r=Math.abs(i-t);return Math.abs(a-n)+3>=r/2})()}var oa=class{constructor(){this.Yt=null,this.On=new P,this.F=-1,this.W=``,this.Wp=``,this.ub=`normal`}ht(e){this.Yt=e}Nn(e,t,n){this.F===e&&this.W===t||(this.F=e,this.W=t,this.Wp=De(e,t),this.On.Bn()),this.ub=n}jn(e,t){if(this.Yt===null||this.Yt.lt===null)return null;for(let n=this.Yt.lt.from;n<this.Yt.lt.to;n++){let r=this.Yt.ot[n];if(r&&ca(r,e,t))return{zOrder:`normal`,externalId:r.Kn??``}}return null}draw(e){this.ub!==`aboveSeries`&&e.useBitmapCoordinateSpace((e=>{this.et(e)}))}drawBackground(e){this.ub===`aboveSeries`&&e.useBitmapCoordinateSpace((e=>{this.et(e)}))}et({context:e,horizontalPixelRatio:t,verticalPixelRatio:n}){if(this.Yt!==null&&this.Yt.lt!==null){e.textBaseline=`middle`,e.font=this.Wp;for(let r=this.Yt.lt.from;r<this.Yt.lt.to;r++){let i=this.Yt.ot[r];i.ri!==void 0&&(i.ri.Qi=this.On.Vi(e,i.ri.cb),i.ri.$t=this.F,i.ri._t=i._t-i.ri.Qi/2),sa(i,e,t,n)}}}};function sa(e,t,n,r){t.fillStyle=e.R,e.ri!==void 0&&function(e,t,n,r,i,a){e.save(),e.scale(i,a),e.fillText(t,n,r),e.restore()}(t,e.ri.cb,e.ri._t,e.ri.ut,n,r),function(e,t,n){if(e.zr!==0){switch(e.fb){case`arrowDown`:ia(!1,t,n,e.zr);return;case`arrowUp`:ia(!0,t,n,e.zr);return;
2case`circle`:(function(e,t,n){let r=($(`circle`,n)-1)/2;e.beginPath(),e.arc(t._t,t.ut,r*t._b,0,2*Math.PI,!1),e.fill()})(t,n,e.zr);return;case`square`:(function(e,t,n){let r=$(`square`,n),i=(r-1)*t._b/2,a=t._t-i,o=t.ut-i;e.fillRect(a,o,r*t._b,r*t._b)})(t,n,e.zr);return}e.fb}}(e,t,function(e,t,n){let r=Math.max(1,Math.floor(t))%2/2;return{_t:Math.round(e._t*t)+r,ut:e.ut*n,_b:t}}(e,n,r))}function ca(e,t,n){return!(e.ri===void 0||!function(e,t,n,r,i,a){let o=r/2;return i>=e&&i<=e+n&&a>=t-o&&a<=t+o}(e.ri._t,e.ri.ut,e.ri.Qi,e.ri.$t,t,n))||function(e,t,n){if(e.zr===0)return!1;switch(e.fb){case`arrowDown`:return aa(!0,e._t,e.ut,e.zr,t,n);case`arrowUp`:return aa(!1,e._t,e.ut,e.zr,t,n);case`circle`:return function(e,t,n,r,i){let a=2+$(`circle`,n)/2,o=e-r,s=t-i;return Math.sqrt(o*o+s*s)<=a}(e._t,e.ut,e.zr,t,n);case`square`:return function(e,t,n,r,i){let a=$(`square`,n),o=(a-1)/2,s=e-o,c=t-o;return r>=s&&r<=s+a&&i>=c&&i<=c+a}(e._t,e.ut,e.zr,t,n)}}(e,t,n)}function la(e){return e===`atPriceTop`||e===`atPriceBottom`||e===`atPriceMiddle`}function ua(e,t,n,r,i,a,o,s){let c=function(e,t,n){if(la(t.position)&&t.price!==void 0)return t.price;if(`value`in(r=e)&&typeof r.value==`number`)return e.value;var r;if(function(e){return`open`in e&&`high`in e&&`low`in e&&`close`in e}(e)){if(t.position===`inBar`)return e.close;if(t.position===`aboveBar`)return n?e.low:e.high;if(t.position===`belowBar`)return n?e.high:e.low}}(n,t,o.priceScale().options().invertScale);if(c===void 0)return;let l=la(t.position),u=s.timeScale(),d=k(t.size)?Math.max(t.size,0):1,f=ta(u.options().barSpacing)*d,p=f/2;switch(e.zr=f,t.position){case`inBar`:case`atPriceMiddle`:e.ut=T(o.priceToCoordinate(c)),e.ri!==void 0&&(e.ri.ut=e.ut+p+a+.6*i);return;case`aboveBar`:case`atPriceTop`:{let t=l?0:r.pb;e.ut=T(o.priceToCoordinate(c))-p-t,e.ri!==void 0&&(e.ri.ut=e.ut-p-.6*i,r.pb+=1.2*i),l||(r.pb+=f+a);return}case`belowBar`:case`atPriceBottom`:{let t=l?0:r.mb;e.ut=T(o.priceToCoordinate(c))+p+t,e.ri!==void 0&&(e.ri.ut=e.ut+p+a+.6*i,r.mb+=1.2*i),l||(r.mb+=f+a);return}}}var da=class{constructor(e,t,n){this.wb=[],this.xt=!0,this.gb=!0,this.Gt=new oa,this.ge=e,this.Vp=t,this.Yt={ot:[],lt:null},this.Ps=n}renderer(){if(!this.ge.options().visible)return null;this.xt&&this.Mb();let e=this.Vp.options().layout;return this.Gt.Nn(e.fontSize,e.fontFamily,this.Ps.zOrder),this.Gt.ht(this.Yt),this.Gt}bb(e){this.wb=e,this.yt(`data`)}yt(e){this.xt=!0,e===`data`&&(this.gb=!0)}Sb(e){this.xt=!0,this.Ps=e}zOrder(){return this.Ps.zOrder===`aboveSeries`?`top`:this.Ps.zOrder}Mb(){let e=this.Vp.timeScale(),t=this.wb;this.gb&&=(this.Yt.ot=t.map((e=>({wt:e.time,_t:0,ut:0,zr:0,fb:e.shape,R:e.color,Kn:e.id,xb:e.xb,ri:void 0}))),!1);let n=this.Vp.options().layout;this.Yt.lt=null;let r=e.getVisibleLogicalRange();if(r===null)return;let i=new W(Math.floor(r.from),Math.ceil(r.to));if(this.ge.data()[0]===null||this.Yt.ot.length===0)return;let a=NaN,o=na(e.options().barSpacing),s={pb:o,mb:o};this.Yt.lt=Kr(this.Yt.ot,i,!0);for(let r=this.Yt.lt.from;r<this.Yt.lt.to;r++){let i=t[r];i.time!==a&&(s.pb=o,s.mb=o,a=i.time);let c=this.Yt.ot[r];c._t=T(e.logicalToCoordinate(i.time)),i.text!==void 0&&i.text.length>0&&(c.ri={cb:i.text,_t:0,ut:0,Qi:0,$t:0});let l=this.ge.dataByIndex(i.time,0);l!==null&&ua(c,i,l,s,n.fontSize,o,this.ge,this.Vp)}this.xt=!1}};function fa(e){return{...ea,...e}}var pa=class{constructor(e){this.sh=null,this.wb=[],this.Cb=[],this.Pb=null,this.ge=null,this.Vp=null,this.yb=!0,this.kb=null,this.Tb=null,this.Rb=null,this.Db=!0,this.Ps=fa(e)}attached(e){this.Vb(),this.Vp=e.chart,this.ge=e.series,this.sh=new da(this.ge,T(this.Vp),this.Ps),this.lb=e.requestUpdate,this.ge.subscribeDataChanged((e=>this.Tg(e))),this.Db=!0,this.jM()}jM(){this.lb&&this.lb()}detached(){this.ge&&this.Pb&&this.ge.unsubscribeDataChanged(this.Pb),this.Vp=null,this.ge=null,this.sh=null,this.Pb=null}bb(e){this.Db=!0,this.wb=e,this.Vb(),this.yb=!0,this.Tb=null,this.jM()}Bb(){return this.wb}paneViews(){return this.sh?[this.sh]:[]}updateAllViews(){this.Ib()}hitTest(e,t){return this.sh?this.sh.renderer()?.jn(e,t)??null:null}autoscaleInfo(e,t){if(this.Ps.autoScale&&this.sh){let e=this.Eb();if(e)return{priceRange:null,margins:e}}return null}hr(e){this.Ps=fa({...this.Ps,...e}),this.jM&&this.jM()}Eb(){let e=T(this.Vp).timeScale().options().barSpacing;if(this.yb||e!==this.Rb){if(this.Rb=e,this.wb.length>0){let t=na(e),n=1.5*ta(e)+2*t,r=this.Ab();this.kb={above:ra(n,r.aboveBar,r.inBar),below:ra(n,r.belowBar,r.inBar)}}else this.kb=null;this.yb=!1}return this.kb}Ab(){return this.Tb===null&&(this.Tb=this.wb.reduce(((e,t)=>(e[t.position]||(e[t.position]=!0),e)),{inBar:!1,aboveBar:!1,belowBar:!1,atPriceTop:!1,atPriceBottom:!1,atPriceMiddle:!1})),this.Tb}Vb(){if(!this.Db||!this.Vp||!this.ge)return;let e=this.Vp.timeScale(),t=this.ge?.data();if(e.getVisibleLogicalRange()==null||!this.ge||t.length===0)return void(this.Cb=[]);let n=e.timeToIndex(T(t[0].time),!0);this.Cb=this.wb.map(((t,r)=>{let i=e.timeToIndex(t.time,!0),a=i<n?1:-1,o=T(this.ge).dataByIndex(i,a),s={time:e.timeToIndex(T(o).time,!1),position:t.position,shape:t.shape,color:t.color,id:t.
2id,xb:r,text:t.text,size:t.size,price:t.price,yw:t.time};if(t.position===`atPriceTop`||t.position===`atPriceBottom`||t.position===`atPriceMiddle`){if(t.price===void 0)throw Error(`Price is required for position ${t.position}`);return{...s,position:t.position,price:t.price}}return{...s,position:t.position,price:t.price}})),this.Db=!1}Ib(e){this.sh&&(this.Vb(),this.sh.bb(this.Cb),this.sh.Sb(this.Ps),this.sh.yt(e))}Tg(e){this.Db=!0,this.jM()}},ma=class extends $i{constructor(e,t,n){super(e,t),n&&this.setMarkers(n)}setMarkers(e){this.ah.bb(e)}markers(){return this.ah.Bb()}};function ha(e,t,n){let r=new ma(e,new pa(n??{}));return t&&r.setMarkers(t),r}var ga={..._e,color:`#2196f3`},_a=(e,t)=>{let{colors:n}=t;return{width:e.clientWidth,height:e.clientHeight||300,rightPriceScale:{borderVisible:!1,scaleMargins:{top:.1,bottom:.1}},leftPriceScale:{scaleMargins:{top:.1,bottom:.1}},layout:{background:{type:On.Solid,color:n.backgroundColor},textColor:n.level5,fontFamily:`ui-monospace, SFMono-Regular, SF Mono, Menlo, Monaco, Consolas, monospace`,attributionLogo:!1},grid:{vertLines:{visible:!1},horzLines:{color:n.level4,style:ye.SparseDotted}},timeScale:{borderVisible:!1,fixLeftEdge:!0,fixRightEdge:!0},handleScale:!1,handleScroll:!1}};function va(e){let t=re();return n=>f(()=>{let r=_a(n,t.value);return e?ie(r,o(e).value):r})}function ya({name:e,color:t,formatter:n,minMove:r,precision:i,autoscaleInfoProvider:a}){return{type:Gi,name:e,options:f(()=>({priceFormat:{type:typeof n==`function`?`custom`:n??`custom`,formatter:typeof n==`function`?n:void 0,minMove:r,precision:i},lineWidth:2,lineType:ve.WithSteps,lineColor:t.value,topColor:`${t.value}44`,bottomColor:`${t.value}00`,lastValueVisible:!1,priceLineVisible:!1,autoscaleInfoProvider:a}))}}var ba=new WeakMap;function xa(e,t){let n=e.data().map(e=>e.time).uniq(),r=ba.get(e);r&&(r.setMarkers([]),r.detach());let i=ha(e,t.filter(e=>!n.length||n[0]<=e.time&&e.time<=n.at(-1)));ba.set(e,i)}var Sa={...ga,colors:[{line:`rgb(41, 98, 255)`,area:`rgba(41, 98, 255, 0.2)`},{line:`rgb(225, 87, 90)`,area:`rgba(225, 87, 90, 0.2)`},{line:`rgb(242, 142, 44)`,area:`rgba(242, 142, 44, 0.2)`},{line:`rgb(164, 89, 209)`,area:`rgba(164, 89, 209, 0.2)`},{line:`rgb(27, 156, 133)`,area:`rgba(27, 156, 133, 0.2)`}],lineWidth:2};function Ca(e){let t=0;return e.map(e=>{let n=t+e;return t=n,n})}var wa=class{_data=null;_options=null;draw(e,t){e.useBitmapCoordinateSpace(e=>{this._drawImpl(e,t)})}update(e,t){this._data=e,this._options=t}_drawImpl(e,t){if(this._data===null||this._data.bars.length===0||this._data.visibleRange===null||this._options===null)return;let n=this._options,r=this._data.bars.map(e=>({x:e.x,ys:Ca(e.originalData.values).map(e=>t(e)??0)})),i=t(0)??0,a=this._createLinePaths(r,this._data.visibleRange,e,i*e.verticalPixelRatio),o=this._createAreas(a),s=n.colors.length;o.forEach((t,r)=>{e.context.fillStyle=n.colors[r%s].area,e.context.fill(t)}),e.context.lineWidth=n.lineWidth*e.verticalPixelRatio,e.context.lineJoin=`round`,a.forEach((t,r)=>{r!==0&&(e.context.beginPath(),e.context.strokeStyle=n.colors[(r-1)%s].line,e.context.stroke(t.path))})}_createLinePaths(e,t,n,r){let{horizontalPixelRatio:i,verticalPixelRatio:a}=n,o=[],s=[],c=!0;for(let n=t.from;n<t.to;n++){let t=e[n],r=0;t.ys.forEach((e,n)=>{if(n%2!=0)return;let s=t.x*i,l=e*a;c?(o[r]={path:new Path2D,first:{x:s,y:l},last:{x:s,y:l}},o[r].path.moveTo(s,l)):(o[r].path.lineTo(s,l),o[r].last.x=s,o[r].last.y=l),r+=1}),c=!1}c=!0;for(let n=t.to-1;n>=t.from;n--){let t=e[n],r=0;t.ys.forEach((e,n)=>{if(n%2==0)return;let o=t.x*i,l=e*a;c?(s[r]={path:new Path2D,first:{x:o,y:l},last:{x:o,y:l}},s[r].path.moveTo(o,l)):(s[r].path.lineTo(o,l),s[r].last.x=o,s[r].last.y=l),r+=1}),c=!1}let l={path:new Path2D,first:{x:o[0].last.x,y:r},last:{x:o[0].first.x,y:r}};l.path.moveTo(o[0].last.x,r),l.path.lineTo(o[0].first.x,r);let u=[l];for(let e=0;e<o.length;e++)u.push(o[e]),e<s.length&&u.push(s[e]);return u}_createAreas(e){let t=[];for(let n=1;n<e.length;n++){let r=new Path2D(e[n-1].path);r.lineTo(e[n].first.x,e[n].first.y),r.addPath(e[n].path),r.lineTo(e[n-1].first.x,e[n-1].first.y),r.closePath(),t.push(r)}return t}},Ta=class{_renderer;constructor(){this._renderer=new wa}priceValueBuilder(e){return[0,e.values.reduce((e,t)=>
2e+t,0)]}isWhitespace(e){return!e.values?.length}renderer(){return this._renderer}update(e,t){this._renderer.update(e,t)}defaultOptions(){return Sa}},Ea={...ga,colors:[`#2962FF`,`#E1575A`,`#F28E2C`,`rgb(164, 89, 209)`,`rgb(27, 156, 133)`]},Da=4,Oa=1;function ka(e,t){return Math.ceil(e*t)<=Oa?0:Math.max(1,Math.floor(t))}function Aa(e,t,n){return Math.round(e*t)-(n??ka(e,t))}function ja(e,t){let n=ka(e,t),r=Aa(e,t,n),i=r%2==0;return{spacing:n,shiftLeft:i,columnHalfWidthBitmap:(r-+!i)/2,horizontalPixelRatio:t}}function Ma(e,t,n){let r=e*t.horizontalPixelRatio,i=Math.round(r),a={left:i-t.columnHalfWidthBitmap,right:i+t.columnHalfWidthBitmap-+!!t.shiftLeft,shiftLeft:i>r},o=t.spacing+1;return n&&a.left-n.right!==o&&(n.shiftLeft?n.right=a.left-o:a.left=n.right+o),a}function Na(e,t,n,r,i){let a=ja(t,n),o;for(let t=r;t<Math.min(i,e.length);t++)e[t].column=Ma(e[t].x,a,o),o=e[t].column;let s=e.reduce((e,t,n)=>{if(!t.column||n<r||n>i)return e;t.column.right<t.column.left&&(t.column.right=t.column.left);let a=t.column.right-t.column.left+1;return Math.min(e,a)},Math.ceil(t*n));a.spacing>0&&s<Da&&e.forEach((e,t)=>{if(!(!e.column||t<r||t>i))return e.column.right-e.column.left+1<=s?e:(e.column.shiftLeft?--e.column.right:e.column.left+=1,e.column)})}function Pa(e,t,n){let r=Math.round(n*e),i=Math.round(n*t);return{position:Math.min(r,i),length:Math.abs(i-r)+1}}function Fa(e){let t=0;return e.map(e=>{let n=t+e;return t=n,n})}var Ia=class{_data=null;_options=null;draw(e,t){e.useBitmapCoordinateSpace(e=>{this._drawImpl(e,t)})}update(e,t){this._data=e,this._options=t}_drawImpl(e,t){if(this._data===null||this._data.bars.length===0||this._data.visibleRange===null||this._options===null)return;let n=this._options,r=this._data.bars.map(e=>({x:e.x,ys:Fa(e.originalData.values).map(e=>t(e)??0)}));Na(r,this._data.barSpacing,e.horizontalPixelRatio,this._data.visibleRange.from,this._data.visibleRange.to);let i=t(0)??0;for(let t=this._data.visibleRange.from;t<this._data.visibleRange.to;t++){let a=r[t],o=a.column;if(!o)return;let s=i,c=Math.min(Math.max(e.horizontalPixelRatio,o.right-o.left),this._data.barSpacing*e.horizontalPixelRatio);a.ys.forEach((t,r)=>{let i=n.colors[r%n.colors.length],a=Pa(s,t,e.verticalPixelRatio);e.context.fillStyle=i,e.context.fillRect(o.left,a.position,c,a.length),s=t})}}},La=class{_renderer;constructor(){this._renderer=new Ia}priceValueBuilder(e){return[0,e.values.reduce((e,t)=>e+t,0)]}isWhitespace(e){return!e.values?.length}renderer(){return this._renderer}update(e,t){this._renderer.update(e,t)}defaultOptions(){return Ea}};function Ra(t){let{createChartOptions:n,series:i,chartRef:a=e(`chartRef`)}=t,o={},s=Array.isArray(i)?i:[i],c=u(void 0);te(a,(e,t,i)=>{let a=n(e);c.value=wi(e,a.value);for(let e of s){let t=e.type===`StackedArea`||e.type===`StackedBars`?c.value.addCustomSeries(e.type===`StackedArea`?new Ta:new La,e.options.value):c.value.addSeries(e.type,e.options.value);o[e.name]=t}let l=r(a,e=>{c.value?.applyOptions(e)});i(()=>{l(),c.value=void 0})}),ee(f(()=>a.value?.parentElement),e=>{let t=e[0].target;c.value?.applyOptions({width:t.clientWidth,height:t.clientHeight}),c.value?.timeScale().fitContent()});for(let{name:e,options:t}of s)r(t,t=>{o[e]?.applyOptions(t)});return{chart:c,chartRef:a,series:o}}export{Yi as a,Hi as c,le as d,ce as f,xa as i,ve as l,ya as n,Fi as o,g as p,va as r,Qi as s,Ra as t,ue as u};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.