﻿const $enCharts={version:"1.3.1",options:{ptChart:5,pbChart:5,plChart:3,prChart:3,mbChartTitle:10,mAxisTitle:5},s:function(t){let e=Math.pow(10,Math.floor(Math.log(t)/Math.log(10))),i=100*e,s=0,h=100;return[1,2,5].forEach((r=>{let l=Math.abs(t-r*e);l<i&&(i=l,s=r*e),r<h&&(h=r)})),Math.abs(t-10*h*e)<Math.abs(t-s)&&(s=10*h*e),s},m:function(t){for(var e="",i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",s=0;s<t;s++)e+=i.charAt(Math.floor(62*Math.random()));return e},Point:class{x;y;constructor(t,e){this.x=t,this.y=e}},TextStyle:class{color="black";fontSize=10;fontWeight="normal";fontFamily='system-ui,"Segoe UI",Roboto,"Helvetica Neue",sans-serif'},LineStyle:class{stroke="black";strokeWidth=1;strokeDashArray="none"},RectStyle:class{cornerRadius=0;stroke="black";strokeWidth=1;strokeDashArray="none";fill="none"},Tick:class{text=t=>t;nbTicks=5;placement="auto";#t=new $enCharts.TextStyle;get style(){return this.#t}set style(t){t.color&&(this.#t.color=t.color),(t.fontSize||0===t.fontSize)&&(this.#t.fontSize=t.fontSize),t.fontWeight&&(this.#t.fontWeight=t.fontWeight),t.fontFamily&&(this.#t.fontFamily=t.fontFamily)}},Title:class{#t=new $enCharts.TextStyle;text="";constructor(){this.#t.fontSize=12}get style(){return this.#t}set style(t){t.color&&(this.#t.color=t.color),t.fontSize&&(this.#t.fontSize=t.fontSize),t.fontWeight&&(this.#t.fontWeight=t.fontWeight),t.fontFamily&&(this.#t.fontFamily=t.fontFamily)}},Legend:class{#e=new $enCharts.TextStyle;#i=new $enCharts.RectStyle;position="";constructor(){this.#e.fontSize=12,this.#i.stroke="transparent"}get textStyle(){return this.#e}set textStyle(t){t.color&&(this.#e.color=t.color),t.fontSize&&(this.#e.fontSize=t.fontSize),t.fontWeight&&(this.#e.fontWeight=t.fontWeight),t.fontFamily&&(this.#e.fontFamily=t.fontFamily)}get rectStyle(){return this.#i}set rectStyle(t){(t.cornerRadius||0===t.cornerRadius)&&(this.#i.cornerRadius=t.cornerRadius),t.fill&&(this.#i.fill=t.fill),t.stroke&&(this.#i.stroke=t.stroke),t.strokeWidth&&(this.#i.strokeWidth=t.strokeWidth),t.strokeDashArray&&(this.#i.strokeDashArray=t.strokeDashArray)}},Tooltip:class{#e=new $enCharts.TextStyle;#i=new $enCharts.RectStyle;visible=!0;constructor(){this.#e.fontSize=12,this.#i.fill="white"}get textStyle(){return this.#e}set textStyle(t){t.color&&(this.#e.color=t.color),t.fontSize&&(this.#e.fontSize=t.fontSize),t.fontWeight&&(this.#e.fontWeight=t.fontWeight),t.fontFamily&&(this.#e.fontFamily=t.fontFamily)}get rectStyle(){return this.#i}set rectStyle(t){(t.cornerRadius||0===t.cornerRadius)&&(this.#i.cornerRadius=t.cornerRadius),t.fill&&(this.#i.fill=t.fill),t.stroke&&(this.#i.stroke=t.stroke),t.strokeWidth&&(this.#i.strokeWidth=t.strokeWidth),t.strokeDashArray&&(this.#i.strokeDashArray=t.strokeDashArray)}},Grid:class{#t=new $enCharts.LineStyle;visible=!0;constructor(){this.#t.strokeDashArray="1 3"}get style(){return this.#t}set style(t){t.stroke&&(this.#t.stroke=t.stroke),t.strokeWidth&&(this.#t.strokeWidth=t.strokeWidth),t.strokeDashArray&&(this.#t.strokeDashArray=t.strokeDashArray)}},Spy:class{#s=new $enCharts.LineStyle;#e=new $enCharts.TextStyle;#i=new $enCharts.RectStyle;visible=!0;constructor(){this.#i.fill="black",this.#e.color="white"}get lineStyle(){return this.#s}set lineStyle(t){t.stroke&&(this.#s.stroke=t.stroke),t.strokeWidth&&(this.#s.strokeWidth=t.strokeWidth),t.strokeDashArray&&(this.#s.strokeDashArray=t.strokeDashArray)}get textStyle(){return this.#e}set textStyle(t){t.color&&(this.#e.color=t.color),t.fontSize&&(this.#e.fontSize=t.fontSize),t.fontWeight&&(this.#e.fontWeight=t.fontWeight),t.fontFamily&&(this.#e.fontFamily=t.fontFamily)}get rectStyle(){return this.#i}set rectStyle(t){(t.cornerRadius||0===t.cornerRadius)&&(this.#i.cornerRadius=t.cornerRadius),t.fill&&(this.#i.fill=t.fill),t.stroke&&(this.#i.stroke=t.stroke),t.strokeWidth&&(this.#i.strokeWidth=t.strokeWidth),t.strokeDashArray&&(this.#i.strokeDashArray=t.strokeDashArray)}},Axis:class{#h=new $enCharts.Tick;#r=new $enCharts.Grid;#l=new $enCharts.Title;#o=new $enCharts.Spy;visible=!0;#t=new $enCharts.LineStyle;get tick(){return this.#h}set tick(t){(t.nbTicks||0===t.nbTicks)&&(this.#h.nbTicks=t.nbTicks),t.placement&&(this.#h.placement=t.placement),t.style&&(this.#h.style=t.style),t.text&&(this.#h.text=t.text)}get grid(){return this.#r}set grid(t){1==t.visible&&(this.#r.visible=!0),0==t.visible&&(this.#r.visible=!1),t.style&&(this.#r.style=t.style)}get title(){return this.#l}set title(t){t.text&&(this.#l.text=t.text),t.style&&(this.#l.style=t.style)}get spy(){return this.#o}set spy(t){t.lineStyle&&(this.#o.lineStyle=t.lineStyle),t.rectStyle&&(this.#o.rectStyle=t.rectStyle),t.textStyle&&(this.#o.textStyle=t.textStyle),1==t.visible&&(this.#o.visible=!0),0==t.visible&&(this.#o.visible=!1)}get style(){return this.#t}set style(t){t.stroke&&(this.#t.stroke=t.stroke),t.strokeWidth&&(this.#t.strokeWidth=t.strokeWidth),t.strokeDashArray&&(this.#t.strokeDashArray=t.strokeDashArray)}},Interactivity:class{#a=new $enCharts.RectStyle;panningSpeed=2;constructor(){this.#a.strokeDashArray="2 2"}get zoomRect(){return this.#a}set zoomRect(t){t.cornerRadius&&(this.#a.cornerRadius=t.cornerRadius),t.fill&&(this.#a.fill=t.fill),t.stroke&&(this.#a.stroke=t.stroke),t.strokeWidth&&(this.#a.strokeWidth=t.strokeWidth),t.strokeDashArray&&(this.#a.strokeDashArray=t.strokeDashArray)}},Layout:class{#n=new $enCharts.Axis;#y=new $enCharts.Axis;#l=new $enCharts.Title;#u=new $enCharts.Legend;#x=new $enCharts.Tooltip;constructor(){this.#y.tick.text=t=>t.toFixed(2)}get xAxis(){return this.#n}set xAxis(t){t.grid&&(this.#n.grid=t.grid),t.spy&&(this.#n.spy=t.spy),t.style&&(this.#n.style=t.style),t.tick&&(this.#n.tick=t.tick),t.title&&(this.#n.title=t.title),1==t.visible&&(this.#n.visible=!0),0==t.visible&&(this.#n.visible=!1)}get yAxis(){return this.#y}set yAxis(t){t.grid&&(this.#y.grid=t.grid),t.spy&&(this.#y.spy=t.spy),t.style&&(this.#y.style=t.style),t.tick&&(this.#y.tick=t.tick),t.title&&(this.#y.title=t.title),1==t.visible&&(this.#y.visible=!0),0==t.visible&&(this.#y.visible=!1)}get title(){return this.#l}set title(t){t.text&&(this.#l.text=t.text),t.style&&(this.#l.style=t.style)}get legend(){return this.#u}set legend(t){t.position&&(this.#u.position=t.position),t.textStyle&&(this.#u.textStyle=t.textStyle),t.rectStyle&&(this.#u.rectStyle=t.rectStyle)}get tooltip(){return this.#x}set tooltip(t){1!=t.visible&&0!=t.visible||(this.#x.visible=t.visible),t.textStyle&&(this.#x.textStyle=t.textStyle),t.rectStyle&&(this.#x.rectStyle=t.rectStyle)}},DataSeries:class{name="";#t=new $enCharts.LineStyle;data=[];constructor(t){this.name=t,this.#t.strokeWidth=2}get style(){return this.#t}set style(t){t.stroke&&(this.#t.stroke=t.stroke),t.strokeWidth&&(this.#t.strokeWidth=t.strokeWidth),t.strokeDashArray&&(this.#t.strokeDashArray=t.strokeDashArray)}},BarDataSeries:class{name="";#t=new $enCharts.RectStyle;data=[];constructor(t){this.name=t}get style(){return this.#t}set style(t){t.stroke&&(this.#t.stroke=t.stroke),t.strokeWidth&&(this.#t.strokeWidth=t.strokeWidth),t.strokeDashArray&&(this.#t.strokeDashArray=t.strokeDashArray),t.fill&&(this.#t.fill=t.fill),(t.cornerRadius||0===t.cornerRadius)&&(this.#t.cornerRadius=t.cornerRadius)}}};class LineChart{#d=class{x=[];#c=[];get y(){return this.#c}set y(t){t&&t.length&&(this.#c.length=0,t.forEach((t=>{let e=new $enCharts.DataSeries(t.name);e.data=t.data,t.style&&(e.style=t.style),this.#c.push(e)})))}};#A=new this.#d;set data(t){t.x&&(this.#A.x=t.x),t.y&&(this.#A.y=t.y)}#g=new $enCharts.Layout;get layout(){return this.#g}set layout(t){t.legend&&(this.#g.legend=t.legend),t.title&&(this.#g.title=t.title),t.xAxis&&(this.#g.xAxis=t.xAxis),t.yAxis&&(this.#g.yAxis=t.yAxis)}#p=new $enCharts.Interactivity;get interactivity(){return this.#p}set interactivity(t){if(t.panningSpeed){let e=parseInt(t.panningSpeed);isNaN(e)||(e>5&&(e=5),e<1&&(e=1),this.#p.panningSpeed=e)}t.zoomRect&&(this.#p.zoomRect=t.zoomRect)}#b="transparent";get backgroundColor(){return this.#b}set backgroundColor(t){this.#b=t,this.#f.style.backgroundColor=t}#S=[];#f=document.createElementNS("http://www.w3.org/2000/svg","svg");#w;#m=$enCharts.m(6);#k;#v;#C;#z;#M;#L;#a;#O;#R;#W=100;#E=100;#N;#H;#T;#$=15;#X=.025;#Y=10;#P=5;#D=20;#B=5;#F=2;#V;#I;#G;#j;#U;#q;#J=!1;#K;#Q;#Z;#_;#tt=!1;#et=!1;#it=0;#st=0;constructor(t){this.#f.setAttribute("height","100%"),this.#f.setAttribute("width","100%"),this.#f.style["user-select"]="none",t.appendChild(this.#f),window.addEventListener("resize",(t=>{let e=this.#f.getBoundingClientRect();!this.#w||e.width===this.#w.width&&e.height===this.#w.height||this.plot(this.#G,this.#j,this.#U,this.#q)})),this.#f.onmouseleave=t=>{this.layout.xAxis.spy.visible&&(this.#k.removeAttribute("x1"),this.#k.removeAttribute("y1"),this.#k.removeAttribute("x2"),this.#k.removeAttribute("y2"),this.#C.removeAttribute("x"),this.#C.textContent="",this.#M.removeAttribute("x"),this.#M.removeAttribute("y"),this.#M.removeAttribute("width"),this.#M.removeAttribute("height")),this.layout.yAxis.spy.visible&&(this.#v.removeAttribute("x1"),this.#v.removeAttribute("y1"),this.#v.removeAttribute("x2"),this.#v.removeAttribute("y2"),this.#z.removeAttribute("y"),this.#z.textContent="",this.#L.removeAttribute("x"),this.#L.removeAttribute("y"),this.#L.removeAttribute("width"),this.#L.removeAttribute("height"))},this.#f.onmousedown=t=>{if(0==t.button){let e=this.#f.getBoundingClientRect(),i=t.pageX-e.left-window.pageXOffset,s=t.pageY-e.top-window.pageYOffset;i!=this.#it||s!=this.#st?(this.#tt=!0,this.#et=!1):(this.#et=!0,this.#tt=!1),i<this.#T?this.#it=this.#T:i>this.#T+this.#O?this.#it=this.#T+this.#O:this.#it=i,s<this.#N?this.#st=this.#N:s>this.#N+this.#R?this.#st=this.#N+this.#R:this.#st=s}},this.#f.onmouseup=t=>{let e=this.#f.getBoundingClientRect(),i=t.pageX-e.left-window.pageXOffset,s=t.pageY-e.top-window.pageYOffset;if(this.#tt){if(this.#tt=!1,this.#S.findIndex((t=>t.nx>=i))!=this.#S.findIndex((t=>t.nx>=this.#it))){let t=(i-this.#T)*(this.#j-this.#G)/this.#O+this.#G,e=(this.#it-this.#T)*(this.#j-this.#G)/this.#O+this.#G,h=(this.#R-(s-this.#N))*(this.#q-this.#U)/this.#R+this.#U,r=(this.#R-(this.#st-this.#N))*(this.#q-this.#U)/this.#R+this.#U;t>e?h>r?this.plot(e,t,r,h):h<r&&this.plot(e,t,h,r):t<e&&(h>r?this.plot(t,e,r,h):h<r&&this.plot(t,e,h,r))}this.#a.removeAttribute("x"),this.#a.removeAttribute("y"),this.#a.removeAttribute("width"),this.#a.removeAttribute("height")}this.#et&&(this.#et=!1)},this.#f.onmousemove=t=>{let e=this.#f.getBoundingClientRect(),i=t.pageX-e.left-window.pageXOffset,s=t.pageY-e.top-window.pageYOffset;if(i>=this.#T&&i<=this.#O+this.#T&&s>=this.#N&&s<=this.#R+this.#N){if(this.layout.xAxis.spy.visible&&this.#S.length>0){let t=this.#S.findIndex((t=>t.nx>i));-1==t&&(t=this.#S.length-1),0==t&&(t=1);let s=1==this.#S.length?this.#S[0]:i>(this.#S[t].nx+this.#S[t-1].nx)/2?this.#S[t]:this.#S[t-1];this.#k.setAttribute("y1",this.#R+this.#N),this.#k.setAttribute("y2",this.#N),this.#k.setAttribute("x1",s.nx),this.#k.setAttribute("x2",s.nx),this.#C.setAttribute("x",s.nx),this.#C.textContent=this.layout.xAxis.tick.text(s.x);let h=this.#C.getBoundingClientRect();this.#M.setAttribute("x",h.left-e.left),this.#M.setAttribute("y",h.top-e.top),this.#M.setAttribute("width",h.width),this.#M.setAttribute("height",h.height)}if(this.layout.yAxis.spy.visible){this.#v.setAttribute("x1",this.#T),this.#v.setAttribute("y1",s),this.#v.setAttribute("x2",this.#T+this.#O),this.#v.setAttribute("y2",s);let t=(this.#R-(s-this.#N))*(this.#q-this.#U)/this.#R+this.#U;this.#z.setAttribute("y",s+this.layout.yAxis.tick.style.fontSize/2),this.#z.textContent=this.layout.yAxis.tick.text(t);let i=this.#z.getBoundingClientRect();this.#L.setAttribute("x",i.left-e.left),this.#L.setAttribute("y",i.top-e.top),this.#L.setAttribute("width",i.width),this.#L.setAttribute("height",i.height)}if(this.#tt&&(i>this.#it?(this.#a.setAttribute("x",this.#it),this.#a.setAttribute("width",i-this.#it)):(this.#a.setAttribute("x",i),this.#a.setAttribute("width",this.#it-i)),s>this.#st?(this.#a.setAttribute("y",this.#st),this.#a.setAttribute("height",s-this.#st)):(this.#a.setAttribute("y",s),this.#a.setAttribute("height",this.#st-s))),this.#et){let t=Math.abs(i-this.#it)*(this.#j-this.#G)/this.#O*this.interactivity.panningSpeed/10,e=Math.abs(s-this.#st)*(this.#q-this.#U)/this.#R*this.interactivity.panningSpeed/10;if(i>this.#it){let i=this.#G-t,h=this.#j-t;if(s>this.#st){let t=this.#U+e,s=this.#q+e;this.plot(i,h,t,s)}else{let t=this.#U-e,s=this.#q-e;this.plot(i,h,t,s)}}else{let i=this.#G+t,h=this.#j+t;if(s>this.#st){let t=this.#U+e,s=this.#q+e;this.plot(i,h,t,s)}else{let t=this.#U-e,s=this.#q-e;this.plot(i,h,t,s)}}}}else this.layout.xAxis.spy.visible&&(this.#k.removeAttribute("x1"),this.#k.removeAttribute("y1"),this.#k.removeAttribute("x2"),this.#k.removeAttribute("y2"),this.#C.removeAttribute("x"),this.#C.textContent="",this.#M.removeAttribute("x"),this.#M.removeAttribute("y"),this.#M.removeAttribute("width"),this.#M.removeAttribute("height")),this.layout.yAxis.spy.visible&&(this.#v.removeAttribute("x1"),this.#v.removeAttribute("y1"),this.#v.removeAttribute("x2"),this.#v.removeAttribute("y2"),this.#z.removeAttribute("y"),this.#z.textContent="",this.#L.removeAttribute("x"),this.#L.removeAttribute("y"),this.#L.removeAttribute("width"),this.#L.removeAttribute("height"))},this.#f.ondblclick=t=>{this.plot(this.#K,this.#Q,this.#Z,this.#_)}}plot(t,e,i,s){if(e<=t||0==this.#A.x.length||t<this.#A.x[0]||e>this.#A.x[this.#A.x.length-1])return;this.#G=this.#A.x[0],this.#j=this.#A.x[this.#A.x.length-1],arguments.length>=1&&(this.#G=t),arguments.length>=2&&(this.#j=e),this.#S=[];let h=this.#A.x.findIndex((t=>t>=this.#G));if(this.#j==this.#A.x[this.#A.x.length-1])this.#A.x.slice(h).forEach((t=>{this.#S.push({x:t})}));else{let t=this.#A.x.findIndex((t=>t>this.#j));this.#A.x.slice(h,t).forEach((t=>{this.#S.push({x:t})}))}if(arguments.length<4){let t=this.#A.y[0].data.slice(h,h+this.#S.length).reduce(((t,e)=>t>e?t:e));this.#q=t>0?t*(1+this.#X):t*(1-this.#X),this.#A.y.slice(1).forEach((t=>{let e=t.data.slice(h,h+this.#S.length).reduce(((t,e)=>t>e?t:e)),i=e>0?e*(1+this.#X):e*(1-this.#X);i>this.#q&&(this.#q=i)}))}if(arguments.length<3){let t=this.#A.y[0].data.slice(h,h+this.#S.length).reduce(((t,e)=>t<e?t:e));this.#U=t>0?t*(1-this.#X):t*(1+this.#X),this.#A.y.slice(1).forEach((t=>{let e=t.data.slice(h,h+this.#S.length).reduce(((t,e)=>t<e?t:e)),i=e>0?e*(1-this.#X):e*(1+this.#X);i<this.#U&&(this.#U=i)}))}arguments.length>=3&&(this.#U=i),arguments.length>=4&&(this.#q=s);let r=document.createElementNS("http://www.w3.org/2000/svg","text");r.setAttribute("font-size",this.layout.yAxis.tick.style.fontSize),r.setAttribute("font-family",this.layout.yAxis.tick.style.fontFamily),r.textContent=this.layout.yAxis.tick.text(this.#q),this.#f.appendChild(r);let l=r.getBBox(),o=document.createElementNS("http://www.w3.org/2000/svg","text");o.setAttribute("font-size",this.layout.yAxis.tick.style.fontSize),o.setAttribute("font-family",this.layout.yAxis.tick.style.fontFamily),o.textContent=this.layout.yAxis.tick.text(this.#U),this.#f.appendChild(o);let a=o.getBBox();this.#V=l.width>a.width?l.width:a.width;let n=document.createElementNS("http://www.w3.org/2000/svg","text");n.setAttribute("font-size",this.layout.xAxis.tick.style.fontSize),n.setAttribute("font-family",this.layout.xAxis.tick.style.fontFamily),n.textContent=this.layout.xAxis.tick.text(this.#A.x[this.#A.x.length-1]),this.#f.appendChild(n),this.#I=n.getBBox().width,this.#J||(this.#J=!0,this.#K=this.#G,this.#Q=this.#j,this.#Z=this.#U,this.#_=this.#q),this.#f.innerHTML="";let y=document.createElementNS("http://www.w3.org/2000/svg","desc");y.textContent=`Created with SenCharts v${$enCharts.version}`,this.#f.appendChild(y),this.#N=$enCharts.options.ptChart,this.layout.title.text&&(this.#N+=this.layout.title.style.fontSize+$enCharts.options.mbChartTitle),this.#T=this.#B+this.#F+this.#V+$enCharts.options.plChart,this.layout.yAxis.title.text&&(this.#T+=this.layout.yAxis.title.style.fontSize+$enCharts.options.mAxisTitle),this.#H=this.#B+this.#F+this.layout.xAxis.tick.style.fontSize+$enCharts.options.pbChart,this.layout.xAxis.title.text&&(this.#H+=this.layout.xAxis.title.style.fontSize+$enCharts.options.mAxisTitle),this.#$=$enCharts.options.prChart+this.#I/2;let u=this.#f.getBoundingClientRect();this.#w={height:u.height,width:u.width},this.#O=u.width-this.#T-this.#$,this.#R=u.height-this.#N-this.#H;let x=document.createElementNS("http://www.w3.org/2000/svg","clipPath");x.setAttribute("id",this.#m),this.#f.appendChild(x);let d,c,A=document.createElementNS("http://www.w3.org/2000/svg","rect");if(A.setAttribute("x",this.#T),A.setAttribute("y",this.#N),A.setAttribute("width",this.#O),A.setAttribute("height",this.#R),A.setAttribute("stroke","transparent"),A.setAttribute("fill","none"),x.appendChild(A),this.#a=document.createElementNS("http://www.w3.org/2000/svg","rect"),this.#a.setAttribute("stroke",this.interactivity.zoomRect.stroke),this.#a.setAttribute("fill",this.interactivity.zoomRect.fill),this.#a.setAttribute("stroke-width",this.interactivity.zoomRect.strokeWidth),this.#a.setAttribute("stroke-dasharray",this.interactivity.zoomRect.strokeDashArray),this.#a.setAttribute("width",0),this.#a.setAttribute("height",0),this.#a.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(this.#a),this.layout.xAxis.visible){let t=document.createElementNS("http://www.w3.org/2000/svg","line");t.setAttribute("stroke",this.layout.xAxis.style.stroke),t.setAttribute("stroke-width",this.layout.xAxis.style.strokeWidth),t.setAttribute("shape-rendering","crispEdges"),t.setAttribute("x1",this.#T),t.setAttribute("y1",this.#N+this.#R),t.setAttribute("x2",this.#T+this.#O),t.setAttribute("y2",this.#N+this.#R),this.#f.appendChild(t)}if(this.layout.yAxis.visible){let t=document.createElementNS("http://www.w3.org/2000/svg","line");t.setAttribute("stroke",this.layout.yAxis.style.stroke),t.setAttribute("stroke-width",this.layout.yAxis.style.strokeWidth),t.setAttribute("shape-rendering","crispEdges"),t.setAttribute("x1",this.#T),t.setAttribute("y1",this.#N),t.setAttribute("x2",this.#T),t.setAttribute("y2",this.#N+this.#R),this.#f.appendChild(t)}if("auto"==this.layout.xAxis.tick.placement.toLowerCase()||this.layout.xAxis.tick.nbTicks<=1){let t=this.#O/(this.#j-this.#G),e=this.#W/t;d=$enCharts.s(e);let i=Math.ceil(this.#G/d),s=Math.floor(this.#j/d);for(let t=i;t<=s;t++)this.#ht(t*d)}else{d=(this.#j-this.#G)/(this.layout.xAxis.tick.nbTicks-1);for(let t=0;t<this.layout.xAxis.tick.nbTicks;t++)this.#ht(this.#G+t*d)}if(this.#k=document.createElementNS("http://www.w3.org/2000/svg","line"),this.#k.setAttribute("stroke",this.layout.xAxis.spy.lineStyle.stroke),this.#k.setAttribute("stroke-width",1),this.#k.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(this.#k),this.#M=document.createElementNS("http://www.w3.org/2000/svg","rect"),this.#M.setAttribute("stroke",this.layout.xAxis.spy.rectStyle.stroke),this.#M.setAttribute("fill",this.layout.xAxis.spy.rectStyle.fill),this.#M.setAttribute("rx",this.layout.xAxis.spy.rectStyle.cornerRadius),this.#M.setAttribute("shape-rendering","geometricPrecision"),this.#M.setAttribute("width",0),this.#M.setAttribute("height",0),this.#f.appendChild(this.#M),this.#C=document.createElementNS("http://www.w3.org/2000/svg","text"),this.#C.setAttribute("fill",this.layout.xAxis.spy.textStyle.color),this.#C.setAttribute("font-size",this.layout.xAxis.tick.style.fontSize),this.#C.setAttribute("font-weight",this.layout.xAxis.tick.style.fontWeight),this.#C.setAttribute("font-family",this.layout.xAxis.tick.style.fontFamily),this.#C.setAttribute("text-anchor","middle"),this.#C.setAttribute("y",this.#N+this.#R+this.#B+this.#F+this.layout.xAxis.tick.style.fontSize),this.#f.appendChild(this.#C),"auto"==this.layout.yAxis.tick.placement.toLowerCase()||this.layout.yAxis.tick.nbTicks<=1){let t=this.#R/(this.#q-this.#U),e=this.#E/t;c=$enCharts.s(e);let i=Math.ceil(this.#U/c),s=Math.floor(this.#q/c);for(let t=i;t<=s;t++)this.#rt(t*c)}else{c=(this.#q-this.#U)/(this.layout.yAxis.tick.nbTicks-1);for(let t=0;t<this.layout.yAxis.tick.nbTicks;t++)this.#rt(this.#U+t*c)}if(this.#v=document.createElementNS("http://www.w3.org/2000/svg","line"),this.#v.setAttribute("stroke",this.layout.yAxis.spy.lineStyle.stroke),this.#v.setAttribute("stroke-width",1),this.#v.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(this.#v),this.#L=document.createElementNS("http://www.w3.org/2000/svg","rect"),this.#L.setAttribute("stroke",this.layout.yAxis.spy.rectStyle.stroke),this.#L.setAttribute("fill",this.layout.yAxis.spy.rectStyle.fill),this.#L.setAttribute("rx",this.layout.yAxis.spy.rectStyle.cornerRadius),this.#L.setAttribute("shape-rendering","geometricPrecision"),this.#L.setAttribute("width",0),this.#L.setAttribute("height",0),this.#f.appendChild(this.#L),this.#z=document.createElementNS("http://www.w3.org/2000/svg","text"),this.#z.setAttribute("fill",this.layout.yAxis.spy.textStyle.color),this.#z.setAttribute("font-size",this.layout.yAxis.tick.style.fontSize),this.#z.setAttribute("font-weight",this.layout.yAxis.tick.style.fontWeight),this.#z.setAttribute("font-family",this.layout.yAxis.tick.style.fontFamily),this.#z.setAttribute("text-anchor","end"),this.#z.setAttribute("x",this.#T-this.#B-this.#F),this.#f.appendChild(this.#z),this.#A.y.forEach((t=>{let e="";for(let i=0;i<this.#S.length;i++){let s=this.#lt(this.#S[i].x),r=this.#ot(t.data[i+h]);this.#S[i].nx=s,e+=s+","+r+" "}let i=document.createElementNS("http://www.w3.org/2000/svg","polyline");i.setAttribute("points",e.trim()),i.setAttribute("fill","none"),i.setAttribute("stroke",t.style.stroke),i.setAttribute("stroke-dasharray",t.style.strokeDashArray),i.setAttribute("stroke-width",t.style.strokeWidth),i.setAttribute("stroke-linejoin","round"),i.setAttribute("shape-rendering","geometricPrecision"),i.setAttribute("clip-path","url(#"+this.#m+")"),this.#f.appendChild(i)})),this.#A.y.length>0&&this.layout.legend.position){let t=document.createElementNS("http://www.w3.org/2000/svg","svg"),e=document.createElementNS("http://www.w3.org/2000/svg","rect");e.setAttribute("stroke",this.layout.legend.rectStyle.stroke),e.setAttribute("stroke-width",this.layout.legend.rectStyle.strokeWidth),e.setAttribute("stroke-dasharray",this.layout.legend.rectStyle.strokeDashArray),e.setAttribute("fill",this.layout.legend.rectStyle.fill),e.setAttribute("rx",this.layout.legend.rectStyle.cornerRadius),t.appendChild(e);let i=0;this.#A.y.forEach(((e,s)=>{e.name||(e.name="Series "+(s+1));let h=document.createElementNS("http://www.w3.org/2000/svg","line"),r=this.#P+this.layout.legend.textStyle.fontSize/2+i*(this.layout.legend.textStyle.fontSize+this.#P);h.setAttribute("x1",this.layout.legend.rectStyle.strokeWidth+this.#P),h.setAttribute("x2",this.layout.legend.rectStyle.strokeWidth+this.#P+this.#D),h.setAttribute("y1",r),h.setAttribute("y2",r),h.setAttribute("stroke",e.style.stroke),h.setAttribute("stroke-dasharray",e.style.strokeDashArray),h.setAttribute("stroke-width",e.style.strokeWidth),t.appendChild(h);let l=document.createElementNS("http://www.w3.org/2000/svg","text");l.setAttribute("font-size",this.layout.legend.textStyle.fontSize),l.setAttribute("font-family",this.layout.legend.textStyle.fontFamily),l.setAttribute("font-weight",this.layout.legend.textStyle.fontWeight),l.setAttribute("fill",this.layout.legend.textStyle.color),l.setAttribute("x",this.layout.legend.rectStyle.strokeWidth+2*this.#P+this.#D),l.setAttribute("y",r+this.layout.legend.textStyle.fontSize/2),l.setAttribute("text-anchor","start"),l.textContent=e.name,t.appendChild(l),i++})),this.#f.appendChild(t);let s=t.getBBox();t.setAttribute("width",s.width+this.layout.legend.rectStyle.strokeWidth+3*this.#P+"px"),t.setAttribute("height",s.height+this.layout.legend.rectStyle.strokeWidth+this.#P+"px"),e.setAttribute("x",this.layout.legend.rectStyle.strokeWidth/2),e.setAttribute("y",this.layout.legend.rectStyle.strokeWidth/2),e.setAttribute("height",s.height+this.#P),e.setAttribute("width",s.width+3*this.#P);let h=t.getBoundingClientRect();switch(this.layout.legend.position.toLowerCase()){case"east":t.setAttribute("x",this.#T+this.#O-this.#Y-h.width),t.setAttribute("y",this.#N+(this.#R-h.height)/2);break;case"west":t.setAttribute("x",this.#T+this.#Y),t.setAttribute("y",this.#N+(this.#R-h.height)/2);break;case"north":t.setAttribute("x",this.#T+(this.#O-h.width)/2),t.setAttribute("y",this.#N+this.#Y);break;case"northeast":t.setAttribute("x",this.#T+this.#O-this.#Y-h.width),t.setAttribute("y",this.#N+this.#Y);break;case"northwest":t.setAttribute("x",this.#T+this.#Y),t.setAttribute("y",this.#N+this.#Y);break;case"southeast":t.setAttribute("x",this.#T+this.#O-this.#Y-h.width),t.setAttribute("y",this.#N+this.#R-this.#Y-h.height);break;case"southwest":t.setAttribute("x",this.#T+this.#Y),t.setAttribute("y",this.#N+this.#R-this.#Y-h.height);break;default:t.setAttribute("x",this.#T+(this.#O-h.width)/2),t.setAttribute("y",this.#N+this.#R-this.#Y-h.height)}}if(this.layout.title.text){let t=document.createElementNS("http://www.w3.org/2000/svg","text");t.setAttribute("font-size",this.layout.title.style.fontSize),t.setAttribute("font-family",this.layout.title.style.fontFamily),t.setAttribute("font-weight",this.layout.title.style.fontWeight),t.setAttribute("fill",this.layout.title.style.color),t.setAttribute("x",this.#T+this.#O/2),t.setAttribute("y",this.layout.title.style.fontSize+$enCharts.options.ptChart),t.setAttribute("text-anchor","middle"),t.textContent=this.layout.title.text,this.#f.appendChild(t)}if(this.layout.xAxis.title.text){let t=document.createElementNS("http://www.w3.org/2000/svg","text");t.setAttribute("font-size",this.layout.xAxis.title.style.fontSize),t.setAttribute("font-family",this.layout.xAxis.title.style.fontFamily),t.setAttribute("font-weight",this.layout.xAxis.title.style.fontWeight),t.setAttribute("fill",this.layout.xAxis.title.style.color),t.setAttribute("x",this.#T+this.#O/2),t.setAttribute("y",this.#N+this.#R+this.#B+this.#F+this.layout.xAxis.tick.style.fontSize+$enCharts.options.mAxisTitle+this.layout.xAxis.title.style.fontSize),t.setAttribute("text-anchor","middle"),t.textContent=this.layout.xAxis.title.text,this.#f.appendChild(t)}if(this.layout.yAxis.title.text){let t=document.createElementNS("http://www.w3.org/2000/svg","text");t.setAttribute("font-size",this.layout.yAxis.title.style.fontSize),t.setAttribute("font-family",this.layout.yAxis.title.style.fontFamily),t.setAttribute("font-weight",this.layout.yAxis.title.style.fontWeight),t.setAttribute("fill",this.layout.yAxis.title.style.color),t.setAttribute("text-anchor","start"),t.textContent=this.layout.yAxis.title.text,this.#f.appendChild(t);let e=t.getBoundingClientRect(),i=this.#T-this.#B-this.#F-this.#V-$enCharts.options.mAxisTitle,s=this.#N+this.#R/2+e.width/2;t.setAttribute("x",i),t.setAttribute("y",s),t.setAttribute("transform","rotate(-90,"+i+","+s+")")}}#at(t,e){return new $enCharts.Point((t-this.#G)*this.#O/(this.#j-this.#G)+this.#T,this.#R-(e-this.#U)*this.#R/(this.#q-this.#U)+this.#N)}#lt(t){return(t-this.#G)*this.#O/(this.#j-this.#G)+this.#T}#ot(t){return this.#R-(t-this.#U)*this.#R/(this.#q-this.#U)+this.#N}#ht(t){let e=this.#at(t,this.#U),i=this.#at(t,this.#q);if(this.layout.xAxis.visible){let t=document.createElementNS("http://www.w3.org/2000/svg","line");t.setAttribute("stroke",this.layout.xAxis.style.stroke),t.setAttribute("stroke-width",this.layout.xAxis.style.strokeWidth),t.setAttribute("x1",e.x),t.setAttribute("y1",e.y),t.setAttribute("x2",e.x),t.setAttribute("y2",e.y+this.#B),t.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(t)}let s=document.createElementNS("http://www.w3.org/2000/svg","text");if(s.setAttribute("fill",this.layout.xAxis.tick.style.color),s.setAttribute("x",e.x),s.setAttribute("y",e.y+this.#B+this.#F+this.layout.xAxis.tick.style.fontSize),s.setAttribute("text-anchor","middle"),s.setAttribute("font-size",this.layout.xAxis.tick.style.fontSize),s.setAttribute("font-weight",this.layout.xAxis.tick.style.fontWeight),s.setAttribute("font-family",this.layout.xAxis.tick.style.fontFamily),s.textContent=this.layout.xAxis.tick.text(t),this.#f.appendChild(s),this.layout.xAxis.grid.visible&&t!=this.#G&&t!=this.#j){let t=document.createElementNS("http://www.w3.org/2000/svg","line");t.setAttribute("stroke",this.layout.xAxis.grid.style.stroke),t.setAttribute("stroke-width",this.layout.xAxis.grid.style.strokeWidth),t.setAttribute("stroke-dasharray",this.layout.xAxis.grid.style.strokeDashArray),t.setAttribute("x1",e.x),t.setAttribute("y1",e.y),t.setAttribute("x2",i.x),t.setAttribute("y2",i.y),t.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(t)}}#rt(t){let e=this.#at(this.#G,t),i=this.#at(this.#j,t);if(this.layout.yAxis.visible){let t=document.createElementNS("http://www.w3.org/2000/svg","line");t.setAttribute("stroke",this.layout.yAxis.style.stroke),t.setAttribute("stroke-width",this.layout.yAxis.style.strokeWidth),t.setAttribute("x1",e.x),t.setAttribute("y1",e.y),t.setAttribute("x2",e.x-this.#B),t.setAttribute("y2",e.y),t.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(t)}let s=document.createElementNS("http://www.w3.org/2000/svg","text");if(s.setAttribute("fill",this.layout.yAxis.tick.style.color),s.setAttribute("x",e.x-this.#B-this.#F),s.setAttribute("y",e.y+this.layout.yAxis.tick.style.fontSize/2),s.setAttribute("text-anchor","end"),s.setAttribute("font-size",this.layout.yAxis.tick.style.fontSize),s.setAttribute("font-weight",this.layout.yAxis.tick.style.fontWeight),s.setAttribute("font-family",this.layout.yAxis.tick.style.fontFamily),s.textContent=this.layout.yAxis.tick.text(t),this.#f.appendChild(s),this.layout.yAxis.grid.visible&&t!=this.#U&&t!=this.#q){let t=document.createElementNS("http://www.w3.org/2000/svg","line");t.setAttribute("stroke",this.layout.yAxis.grid.style.stroke),t.setAttribute("stroke-width",this.layout.yAxis.grid.style.strokeWidth),t.setAttribute("stroke-dasharray",this.layout.yAxis.grid.style.strokeDashArray),t.setAttribute("x1",e.x),t.setAttribute("y1",e.y),t.setAttribute("x2",i.x),t.setAttribute("y2",i.y),t.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(t)}}}class StockChart{data=[];#g=new $enCharts.Layout;get layout(){return this.#g}set layout(t){t.title&&(this.#g.title=t.title),t.xAxis&&(this.#g.xAxis=t.xAxis),t.yAxis&&(this.#g.yAxis=t.yAxis)}#p=new $enCharts.Interactivity;get interactivity(){return this.#p}set interactivity(t){if(t.panningSpeed){let e=parseInt(t.panningSpeed);isNaN(e)||(e>5&&(e=5),e<1&&(e=1),this.#p.panningSpeed=e)}t.zoomRect&&(this.#p.zoomRect=t.zoomRect)}#b="transparent";get backgroundColor(){return this.#b}set backgroundColor(t){this.#b=t,this.#f.style.backgroundColor=t}chartType="line";#S=[];#f=document.createElementNS("http://www.w3.org/2000/svg","svg");#w;#k;#v;#C;#z;#M;#L;#a;#O;#R;#W=100;#E=100;#N;#H;#T;#$;#X=.025;#B=5;#F=2;#V;#I;#G;#j;#U;#q;#J=!1;#K;#Q;#tt=!1;#et=!1;#it=0;#st=0;constructor(t){this.#f.setAttribute("height","100%"),this.#f.setAttribute("width","100%"),this.#f.style["user-select"]="none",t.appendChild(this.#f),window.addEventListener("resize",(t=>{let e=this.#f.getBoundingClientRect();!this.#w||e.width===this.#w.width&&e.height===this.#w.height||this.plot(this.#G,this.#j)})),this.#f.onmouseleave=t=>{this.layout.xAxis.spy.visible&&(this.#k.removeAttribute("x1"),this.#k.removeAttribute("y1"),this.#k.removeAttribute("x2"),this.#k.removeAttribute("y2"),this.#C.removeAttribute("x"),this.#C.textContent="",this.#M.removeAttribute("x"),this.#M.removeAttribute("y"),this.#M.removeAttribute("width"),this.#M.removeAttribute("height")),this.layout.yAxis.spy.visible&&(this.#v.removeAttribute("x1"),this.#v.removeAttribute("y1"),this.#v.removeAttribute("x2"),this.#v.removeAttribute("y2"),this.#z.removeAttribute("y"),this.#z.textContent="",this.#L.removeAttribute("x"),this.#L.removeAttribute("y"),this.#L.removeAttribute("width"),this.#L.removeAttribute("height"))},this.#f.onmousedown=t=>{if(0==t.button){let e=this.#f.getBoundingClientRect(),i=t.pageX-e.left-window.pageXOffset,s=t.pageY-e.top-window.pageYOffset;i!=this.#it||s!=this.#st?(this.#tt=!0,this.#et=!1):(this.#et=!0,this.#tt=!1),i<this.#T?this.#it=this.#T:i>this.#T+this.#O?this.#it=this.#T+this.#O:this.#it=i,s<this.#N?this.#st=this.#N:s>this.#N+this.#R?this.#st=this.#N+this.#R:this.#st=s}},this.#f.onmouseup=t=>{let e=this.#f.getBoundingClientRect(),i=t.pageX-e.left-window.pageXOffset;if(this.#tt){this.#tt=!1;let t=this.#S.findIndex((t=>t.nx>=i)),e=this.#S.findIndex((t=>t.nx>=this.#it));t<e?this.plot(this.#G+t,this.#G+e-1):this.plot(this.#G+e,this.#G+t-1),this.#a.removeAttribute("x"),this.#a.removeAttribute("y"),this.#a.removeAttribute("width"),this.#a.removeAttribute("height")}this.#et&&(this.#et=!1)},this.#f.onmousemove=t=>{let e=this.#f.getBoundingClientRect(),i=t.pageX-e.left-window.pageXOffset,s=t.pageY-e.top-window.pageYOffset;if(i>=this.#T&&i<=this.#O+this.#T&&s>=this.#N&&s<=this.#R+this.#N){if(this.layout.xAxis.spy.visible&&this.#S.length>0){let t=this.#S.findIndex((t=>t.nx>i));-1==t&&(t=this.#S.length-1),0==t&&(t=1);let s=1==this.#S.length?this.#S[0]:i>(this.#S[t].nx+this.#S[t-1].nx)/2?this.#S[t]:this.#S[t-1];this.#k.setAttribute("y1",this.#R+this.#N),this.#k.setAttribute("y2",this.#N),this.#k.setAttribute("x1",s.nx),this.#k.setAttribute("x2",s.nx),this.#C.setAttribute("x",s.nx),this.#C.textContent=this.layout.xAxis.tick.text(s.Date);let h=this.#C.getBoundingClientRect();this.#M.setAttribute("x",h.left-e.left),this.#M.setAttribute("y",h.top-e.top),this.#M.setAttribute("width",h.width),this.#M.setAttribute("height",h.height)}if(this.layout.yAxis.spy.visible){this.#v.setAttribute("x1",this.#T),this.#v.setAttribute("y1",s),this.#v.setAttribute("x2",this.#T+this.#O),this.#v.setAttribute("y2",s);let t=(this.#R-(s-this.#N))*(this.#q-this.#U)/this.#R+this.#U;this.#z.setAttribute("y",s+this.layout.yAxis.tick.style.fontSize/2),this.#z.textContent=this.layout.yAxis.tick.text(t);let i=this.#z.getBoundingClientRect();this.#L.setAttribute("x",i.left-e.left),this.#L.setAttribute("y",i.top-e.top),this.#L.setAttribute("width",i.width),this.#L.setAttribute("height",i.height)}if(this.#tt&&(i>this.#it?(this.#a.setAttribute("x",this.#it),this.#a.setAttribute("width",i-this.#it)):(this.#a.setAttribute("x",i),this.#a.setAttribute("width",this.#it-i)),this.#a.setAttribute("y",this.#N),this.#a.setAttribute("height",this.#R)),this.#et){let t=this.#S.findIndex((t=>t.nx>=Math.abs(i-this.#it)*this.interactivity.panningSpeed/10+this.#T));t>0&&(i>this.#it?this.plot(this.#G-t,this.#j-t):this.plot(this.#G+t,this.#j+t))}}else this.layout.xAxis.spy.visible&&(this.#k.removeAttribute("x1"),this.#k.removeAttribute("y1"),this.#k.removeAttribute("x2"),this.#k.removeAttribute("y2"),this.#C.removeAttribute("x"),this.#C.textContent="",this.#M.removeAttribute("x"),this.#M.removeAttribute("y"),this.#M.removeAttribute("width"),this.#M.removeAttribute("height")),this.layout.yAxis.spy.visible&&(this.#v.removeAttribute("x1"),this.#v.removeAttribute("y1"),this.#v.removeAttribute("x2"),this.#v.removeAttribute("y2"),this.#z.removeAttribute("y"),this.#z.textContent="",this.#L.removeAttribute("x"),this.#L.removeAttribute("y"),this.#L.removeAttribute("width"),this.#L.removeAttribute("height"))},this.#f.ondblclick=t=>{this.plot(this.#K,this.#Q)}}plot(t,e){if(e<=t||0==this.data.length||t<0||e>this.data.length-1)return;this.#G=0,this.#j=this.data.length-1,arguments.length>=1&&(this.#G=t),0==this.#G&&"candlestickctc"==this.chartType.toLowerCase()&&(this.#G=1),arguments.length>=2&&(this.#j=e),this.#j==this.data.length-1?this.#S=this.data.slice(this.#G):this.#S=this.data.slice(this.#G,this.#j+1),"line"==this.chartType.toLowerCase()?(this.#U=Math.floor(this.#S.reduce(((t,e)=>t.Close<e.Close?t:e)).Close*(1-this.#X)),this.#q=Math.ceil(this.#S.reduce(((t,e)=>t.Close>e.Close?t:e)).Close*(1+this.#X))):(this.#U=Math.floor(this.#S.reduce(((t,e)=>t.Low<e.Low?t:e)).Low*(1-this.#X)),this.#q=Math.ceil(this.#S.reduce(((t,e)=>t.High>e.High?t:e)).High*(1+this.#X)));let i=document.createElementNS("http://www.w3.org/2000/svg","text");i.setAttribute("font-size",this.layout.yAxis.tick.style.fontSize),i.setAttribute("font-family",this.layout.yAxis.tick.style.fontFamily),i.textContent=this.layout.yAxis.tick.text(this.#q),this.#f.appendChild(i);let s=i.getBBox(),h=document.createElementNS("http://www.w3.org/2000/svg","text");h.setAttribute("font-size",this.layout.yAxis.tick.style.fontSize),h.setAttribute("font-family",this.layout.yAxis.tick.style.fontFamily),h.textContent=this.layout.yAxis.tick.text(this.#U),this.#f.appendChild(h);let r=h.getBBox();this.#V=s.width>r.width?s.width:r.width;let l=document.createElementNS("http://www.w3.org/2000/svg","text");l.setAttribute("font-size",this.layout.xAxis.tick.style.fontSize),l.setAttribute("font-family",this.layout.xAxis.tick.style.fontFamily),l.textContent=this.layout.xAxis.tick.text(this.data[this.data.length-1].Date),this.#f.appendChild(l),this.#I=l.getBBox().width,this.#J||(this.#J=!0,this.#K=this.#G,this.#Q=this.#j),this.#f.innerHTML="";let o=document.createElementNS("http://www.w3.org/2000/svg","desc");o.textContent=`Created with SenCharts v${$enCharts.version}`,this.#f.appendChild(o),this.#N=$enCharts.options.ptChart,this.layout.title.text&&(this.#N+=this.layout.title.style.fontSize+$enCharts.options.mbChartTitle),this.#T=this.#B+this.#F+this.#V+$enCharts.options.plChart,this.layout.yAxis.title.text&&(this.#T+=this.layout.yAxis.title.style.fontSize+$enCharts.options.mAxisTitle),this.#H=this.#B+this.#F+this.layout.xAxis.tick.style.fontSize+$enCharts.options.pbChart,this.layout.xAxis.title.text&&(this.#H+=this.layout.xAxis.title.style.fontSize+$enCharts.options.mAxisTitle),this.#$=$enCharts.options.prChart+this.#I/2;let a,n,y=this.#f.getBoundingClientRect();if(this.#w={height:y.height,width:y.width},this.#O=y.width-this.#T-this.#$,this.#R=y.height-this.#N-this.#H,this.#a=document.createElementNS("http://www.w3.org/2000/svg","rect"),this.#a.setAttribute("stroke",this.interactivity.zoomRect.stroke),this.#a.setAttribute("fill",this.interactivity.zoomRect.fill),this.#a.setAttribute("stroke-width",this.interactivity.zoomRect.strokeWidth),this.#a.setAttribute("stroke-dasharray",this.interactivity.zoomRect.strokeDashArray),this.#a.setAttribute("width",0),this.#a.setAttribute("height",0),this.#a.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(this.#a),this.layout.xAxis.visible){let t=document.createElementNS("http://www.w3.org/2000/svg","line");t.setAttribute("stroke",this.layout.xAxis.style.stroke),t.setAttribute("stroke-width",this.layout.xAxis.style.strokeWidth),t.setAttribute("shape-rendering","crispEdges"),t.setAttribute("x1",this.#T),t.setAttribute("y1",this.#N+this.#R),t.setAttribute("x2",this.#T+this.#O),t.setAttribute("y2",this.#N+this.#R),this.#f.appendChild(t)}if(this.layout.yAxis.visible){let t=document.createElementNS("http://www.w3.org/2000/svg","line");t.setAttribute("stroke",this.layout.yAxis.style.stroke),t.setAttribute("stroke-width",this.layout.yAxis.style.strokeWidth),t.setAttribute("shape-rendering","crispEdges"),t.setAttribute("x1",this.#T),t.setAttribute("y1",this.#N),t.setAttribute("x2",this.#T),t.setAttribute("y2",this.#N+this.#R),this.#f.appendChild(t)}if("auto"==this.layout.xAxis.tick.placement.toLowerCase()||this.layout.xAxis.tick.nbTicks<=1){let t=this.#O/(this.#j-this.#G),e=this.#W/t;a=$enCharts.s(e);let i=Math.ceil(this.#G/a),s=Math.floor(this.#j/a);for(let t=i;t<=s;t++)this.#ht(Math.floor(t*a))}else{a=(this.#j-this.#G)/(this.layout.xAxis.tick.nbTicks-1);for(let t=0;t<this.layout.xAxis.tick.nbTicks;t++)this.#ht(this.#G+Math.floor(t*a))}if(this.#k=document.createElementNS("http://www.w3.org/2000/svg","line"),this.#k.setAttribute("stroke",this.layout.xAxis.spy.lineStyle.stroke),this.#k.setAttribute("stroke-width",1),this.#k.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(this.#k),this.#M=document.createElementNS("http://www.w3.org/2000/svg","rect"),this.#M.setAttribute("stroke",this.layout.xAxis.spy.rectStyle.stroke),this.#M.setAttribute("fill",this.layout.xAxis.spy.rectStyle.fill),this.#M.setAttribute("rx",this.layout.xAxis.spy.rectStyle.cornerRadius),this.#M.setAttribute("shape-rendering","geometricPrecision"),this.#M.setAttribute("width",0),this.#M.setAttribute("height",0),this.#f.appendChild(this.#M),this.#C=document.createElementNS("http://www.w3.org/2000/svg","text"),this.#C.setAttribute("fill",this.layout.xAxis.spy.textStyle.color),this.#C.setAttribute("font-size",this.layout.xAxis.tick.style.fontSize),this.#C.setAttribute("font-weight",this.layout.xAxis.tick.style.fontWeight),this.#C.setAttribute("font-family",this.layout.xAxis.tick.style.fontFamily),this.#C.setAttribute("text-anchor","middle"),this.#C.setAttribute("y",this.#N+this.#R+this.#B+this.#F+this.layout.xAxis.tick.style.fontSize),this.#f.appendChild(this.#C),"auto"==this.layout.yAxis.tick.placement.toLowerCase()||this.layout.yAxis.tick.nbTicks<=1){let t=this.#R/(this.#q-this.#U),e=this.#E/t;n=$enCharts.s(e);let i=Math.ceil(this.#U/n),s=Math.floor(this.#q/n);for(let t=i;t<=s;t++)this.#rt(Math.floor(t*n))}else{n=(this.#q-this.#U)/(this.layout.yAxis.tick.nbTicks-1);for(let t=0;t<this.layout.yAxis.tick.nbTicks;t++)this.#rt(this.#U+Math.floor(t*n))}if(this.#v=document.createElementNS("http://www.w3.org/2000/svg","line"),this.#v.setAttribute("stroke",this.layout.yAxis.spy.lineStyle.stroke),this.#v.setAttribute("stroke-width",1),this.#v.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(this.#v),this.#L=document.createElementNS("http://www.w3.org/2000/svg","rect"),this.#L.setAttribute("stroke",this.layout.yAxis.spy.rectStyle.stroke),this.#L.setAttribute("fill",this.layout.yAxis.spy.rectStyle.fill),this.#L.setAttribute("rx",this.layout.yAxis.spy.rectStyle.cornerRadius),this.#L.setAttribute("shape-rendering","geometricPrecision"),this.#L.setAttribute("width",0),this.#L.setAttribute("height",0),this.#f.appendChild(this.#L),this.#z=document.createElementNS("http://www.w3.org/2000/svg","text"),this.#z.setAttribute("fill",this.layout.yAxis.spy.textStyle.color),this.#z.setAttribute("font-size",this.layout.yAxis.tick.style.fontSize),this.#z.setAttribute("font-weight",this.layout.yAxis.tick.style.fontWeight),this.#z.setAttribute("font-family",this.layout.yAxis.tick.style.fontFamily),this.#z.setAttribute("text-anchor","end"),this.#z.setAttribute("x",this.#T-this.#B-this.#F),this.#f.appendChild(this.#z),"line"==this.chartType.toLowerCase()){let t="";for(let e=this.#G;e<=this.#j;e++){let i=this.#at(e,this.data[e].Close);this.#S[e-this.#G].nx=i.x,t+=i.x+","+i.y+" "}let e=document.createElementNS("http://www.w3.org/2000/svg","polyline");e.setAttribute("points",t.trim()),e.setAttribute("fill","none"),e.setAttribute("stroke","black"),e.setAttribute("stroke-width",2),e.setAttribute("stroke-linejoin","round"),e.setAttribute("shape-rendering","geometricPrecision"),this.#f.appendChild(e)}else if("hilo"==this.chartType.toLowerCase())for(let t=this.#G;t<=this.#j;t++){let e=this.#at(t,this.data[t].Low),i=this.#at(t,this.data[t].High),s=document.createElementNS("http://www.w3.org/2000/svg","line");s.setAttribute("x1",e.x),s.setAttribute("y1",e.y),s.setAttribute("x2",i.x),s.setAttribute("y2",i.y),s.setAttribute("stroke","black"),s.setAttribute("stroke-width",2),s.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(s),this.#S[t-this.#G].nx=e.x}else if("ohlc"==this.chartType.toLowerCase()){let t=3;for(let e=this.#G;e<=this.#j;e++){let i="black";this.data[e].Open>this.data[e].Close&&(i="red"),this.data[e].Open<this.data[e].Close&&(i="green");let s=this.#at(e,this.data[e].Low),h=this.#at(e,this.data[e].High),r=document.createElementNS("http://www.w3.org/2000/svg","line");r.setAttribute("x1",s.x),r.setAttribute("y1",s.y),r.setAttribute("x2",h.x),r.setAttribute("y2",h.y),r.setAttribute("stroke",i),r.setAttribute("stroke-width",2),r.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(r);let l=this.#at(e,this.data[e].Open),o=document.createElementNS("http://www.w3.org/2000/svg","line");o.setAttribute("x1",l.x),o.setAttribute("y1",l.y),o.setAttribute("x2",l.x-t),o.setAttribute("y2",l.y),o.setAttribute("stroke",i),o.setAttribute("stroke-width",2),o.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(o);let a=this.#at(e,this.data[e].Close),n=document.createElementNS("http://www.w3.org/2000/svg","line");n.setAttribute("x1",a.x),n.setAttribute("y1",a.y),n.setAttribute("x2",a.x+t),n.setAttribute("y2",a.y),n.setAttribute("stroke",i),n.setAttribute("stroke-width",2),n.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(n),this.#S[e-this.#G].nx=a.x}}else if("candlestickotc"==this.chartType.toLowerCase()){let t=2;for(let e=this.#G;e<=this.#j;e++){let i=this.#at(e,this.data[e].Low),s=this.#at(e,this.data[e].High),h=this.#at(e,this.data[e].Open),r=this.#at(e,this.data[e].Close);if(this.data[e].Open>this.data[e].Close){let e=document.createElementNS("http://www.w3.org/2000/svg","rect");e.setAttribute("x",h.x-t),e.setAttribute("y",h.y),e.setAttribute("width",2*t),e.setAttribute("height",r.y-h.y),e.setAttribute("stroke","red"),e.setAttribute("fill","red"),e.setAttribute("stroke-width",1),e.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(e);let l=document.createElementNS("http://www.w3.org/2000/svg","line");l.setAttribute("x1",s.x),l.setAttribute("y1",s.y),l.setAttribute("x2",h.x),l.setAttribute("y2",h.y),l.setAttribute("stroke","red"),l.setAttribute("stroke-width",1),l.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(l);let o=document.createElementNS("http://www.w3.org/2000/svg","line");o.setAttribute("x1",i.x),o.setAttribute("y1",i.y),o.setAttribute("x2",r.x),o.setAttribute("y2",r.y),o.setAttribute("stroke","red"),o.setAttribute("stroke-width",1),o.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(o)}else if(this.data[e].Open<this.data[e].Close){let e=document.createElementNS("http://www.w3.org/2000/svg","rect");e.setAttribute("x",r.x-t),e.setAttribute("y",r.y),e.setAttribute("width",2*t),e.setAttribute("height",h.y-r.y),e.setAttribute("fill","green"),e.setAttribute("stroke","green"),e.setAttribute("stroke-width",1),e.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(e);let l=document.createElementNS("http://www.w3.org/2000/svg","line");l.setAttribute("x1",s.x),l.setAttribute("y1",s.y),l.setAttribute("x2",r.x),l.setAttribute("y2",r.y),l.setAttribute("stroke","green"),l.setAttribute("stroke-width",1),l.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(l);let o=document.createElementNS("http://www.w3.org/2000/svg","line");o.setAttribute("x1",i.x),o.setAttribute("y1",i.y),o.setAttribute("x2",h.x),o.setAttribute("y2",h.y),o.setAttribute("stroke","green"),o.setAttribute("stroke-width",1),o.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(o)}else{let e=document.createElementNS("http://www.w3.org/2000/svg","line");e.setAttribute("x1",i.x),e.setAttribute("y1",i.y),e.setAttribute("x2",s.x),e.setAttribute("y2",s.y),e.setAttribute("stroke","black"),e.setAttribute("stroke-width",1),e.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(e);let l=document.createElementNS("http://www.w3.org/2000/svg","line");l.setAttribute("x1",h.x-t),l.setAttribute("y1",h.y),l.setAttribute("x2",r.x+t),l.setAttribute("y2",r.y),l.setAttribute("stroke","black"),l.setAttribute("stroke-width",1),l.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(l)}this.#S[e-this.#G].nx=r.x}}else{if("candlestickctc"!=this.chartType.toLowerCase())return;if(this.data.length>=2){let t=2;for(let e=this.#G;e<=this.#j;e++){let i=this.#at(e,this.data[e].Low),s=this.#at(e,this.data[e].High),h=this.#at(e,this.data[e-1].Close),r=this.#at(e,this.data[e].Close);if(this.data[e-1].Close>this.data[e].Close){let e=document.createElementNS("http://www.w3.org/2000/svg","rect");e.setAttribute("x",h.x-t),e.setAttribute("y",h.y),e.setAttribute("width",2*t),e.setAttribute("height",r.y-h.y),e.setAttribute("stroke","red"),e.setAttribute("fill","red"),e.setAttribute("stroke-width",1),e.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(e);let l=document.createElementNS("http://www.w3.org/2000/svg","line");l.setAttribute("x1",s.x),l.setAttribute("y1",s.y),l.setAttribute("x2",h.x),l.setAttribute("y2",h.y),l.setAttribute("stroke","red"),l.setAttribute("stroke-width",1),l.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(l);let o=document.createElementNS("http://www.w3.org/2000/svg","line");o.setAttribute("x1",i.x),o.setAttribute("y1",i.y),o.setAttribute("x2",r.x),o.setAttribute("y2",r.y),o.setAttribute("stroke","red"),o.setAttribute("stroke-width",1),o.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(o)}else if(this.data[e-1].Close<this.data[e].Close){let e=document.createElementNS("http://www.w3.org/2000/svg","rect");e.setAttribute("x",r.x-t),e.setAttribute("y",r.y),e.setAttribute("width",2*t),e.setAttribute("height",h.y-r.y),e.setAttribute("fill","green"),e.setAttribute("stroke","green"),e.setAttribute("stroke-width",1),e.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(e);let l=document.createElementNS("http://www.w3.org/2000/svg","line");l.setAttribute("x1",s.x),l.setAttribute("y1",s.y),l.setAttribute("x2",r.x),l.setAttribute("y2",r.y),l.setAttribute("stroke","green"),l.setAttribute("stroke-width",1),l.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(l);let o=document.createElementNS("http://www.w3.org/2000/svg","line");o.setAttribute("x1",i.x),o.setAttribute("y1",i.y),o.setAttribute("x2",h.x),o.setAttribute("y2",h.y),o.setAttribute("stroke","green"),o.setAttribute("stroke-width",1),o.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(o)}else{let e=document.createElementNS("http://www.w3.org/2000/svg","line");e.setAttribute("x1",i.x),e.setAttribute("y1",i.y),e.setAttribute("x2",s.x),e.setAttribute("y2",s.y),e.setAttribute("stroke","black"),e.setAttribute("stroke-width",1),e.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(e);let l=document.createElementNS("http://www.w3.org/2000/svg","line");l.setAttribute("x1",h.x-t),l.setAttribute("y1",h.y),l.setAttribute("x2",r.x+t),l.setAttribute("y2",r.y),l.setAttribute("stroke","black"),l.setAttribute("stroke-width",1),l.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(l)}this.#S[e-this.#G].nx=r.x}}}if(this.layout.title.text){let t=document.createElementNS("http://www.w3.org/2000/svg","text");t.setAttribute("font-size",this.layout.title.style.fontSize),t.setAttribute("font-family",this.layout.title.style.fontFamily),t.setAttribute("font-weight",this.layout.title.style.fontWeight),t.setAttribute("fill",this.layout.title.style.color),t.setAttribute("x",this.#T+this.#O/2),t.setAttribute("y",this.layout.title.style.fontSize+$enCharts.options.ptChart),t.setAttribute("text-anchor","middle"),t.textContent=this.layout.title.text,this.#f.appendChild(t)}if(this.layout.xAxis.title.text){let t=document.createElementNS("http://www.w3.org/2000/svg","text");t.setAttribute("font-size",this.layout.xAxis.title.style.fontSize),t.setAttribute("font-family",this.layout.xAxis.title.style.fontFamily),t.setAttribute("font-weight",this.layout.xAxis.title.style.fontWeight),t.setAttribute("fill",this.layout.xAxis.title.style.color),t.setAttribute("x",this.#T+this.#O/2),t.setAttribute("y",this.#N+this.#R+this.#B+this.#F+this.layout.xAxis.tick.style.fontSize+$enCharts.options.mAxisTitle+this.layout.xAxis.title.style.fontSize),t.setAttribute("text-anchor","middle"),t.textContent=this.layout.xAxis.title.text,this.#f.appendChild(t)}if(this.layout.yAxis.title.text){let t=document.createElementNS("http://www.w3.org/2000/svg","text");t.setAttribute("font-size",this.layout.yAxis.title.style.fontSize),t.setAttribute("font-family",this.layout.yAxis.title.style.fontFamily),t.setAttribute("font-weight",this.layout.yAxis.title.style.fontWeight),t.setAttribute("fill",this.layout.yAxis.title.style.color),t.setAttribute("text-anchor","start"),t.textContent=this.layout.yAxis.title.text,this.#f.appendChild(t);let e=t.getBoundingClientRect(),i=this.#T-this.#B-this.#F-this.#V-$enCharts.options.mAxisTitle,s=this.#N+this.#R/2+e.width/2;t.setAttribute("x",i),t.setAttribute("y",s),t.setAttribute("transform","rotate(-90,"+i+","+s+")")}}#at(t,e){return new $enCharts.Point((t-this.#G)*this.#O/(this.#j-this.#G)+this.#T,this.#R-(e-this.#U)*this.#R/(this.#q-this.#U)+this.#N)}#ht(t){let e=this.#at(t,this.#U),i=this.#at(t,this.#q);if(this.layout.xAxis.visible){let t=document.createElementNS("http://www.w3.org/2000/svg","line");t.setAttribute("stroke",this.layout.xAxis.style.stroke),t.setAttribute("stroke-width",this.layout.xAxis.style.strokeWidth),t.setAttribute("x1",e.x),t.setAttribute("y1",e.y),t.setAttribute("x2",e.x),t.setAttribute("y2",e.y+this.#B),t.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(t)}let s=document.createElementNS("http://www.w3.org/2000/svg","text");if(s.setAttribute("fill",this.layout.xAxis.tick.style.color),s.setAttribute("x",e.x),s.setAttribute("y",e.y+this.#B+this.#F+this.layout.xAxis.tick.style.fontSize),s.setAttribute("text-anchor","middle"),s.setAttribute("font-size",this.layout.xAxis.tick.style.fontSize),s.setAttribute("font-weight",this.layout.xAxis.tick.style.fontWeight),s.setAttribute("font-family",this.layout.xAxis.tick.style.fontFamily),s.textContent=this.layout.xAxis.tick.text(this.#S[t-this.#G].Date),this.#f.appendChild(s),this.layout.xAxis.grid.visible&&t!=this.#G&&t!=this.#j){let t=document.createElementNS("http://www.w3.org/2000/svg","line");t.setAttribute("stroke",this.layout.xAxis.grid.style.stroke),t.setAttribute("stroke-width",this.layout.xAxis.grid.style.strokeWidth),t.setAttribute("stroke-dasharray",this.layout.xAxis.grid.style.strokeDashArray),t.setAttribute("x1",e.x),t.setAttribute("y1",e.y),t.setAttribute("x2",i.x),t.setAttribute("y2",i.y),t.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(t)}}#rt(t){let e=this.#at(this.#G,t),i=this.#at(this.#j,t);if(this.layout.yAxis.visible){let t=document.createElementNS("http://www.w3.org/2000/svg","line");t.setAttribute("stroke",this.layout.yAxis.style.stroke),t.setAttribute("stroke-width",this.layout.yAxis.style.strokeWidth),t.setAttribute("x1",e.x),t.setAttribute("y1",e.y),t.setAttribute("x2",e.x-this.#B),t.setAttribute("y2",e.y),t.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(t)}let s=document.createElementNS("http://www.w3.org/2000/svg","text");if(s.setAttribute("fill",this.layout.yAxis.tick.style.color),s.setAttribute("x",e.x-this.#B-this.#F),s.setAttribute("y",e.y+this.layout.yAxis.tick.style.fontSize/2),s.setAttribute("text-anchor","end"),s.setAttribute("font-size",this.layout.yAxis.tick.style.fontSize),s.setAttribute("font-weight",this.layout.yAxis.tick.style.fontWeight),s.setAttribute("font-family",this.layout.yAxis.tick.style.fontFamily),s.textContent=this.layout.yAxis.tick.text(t),this.#f.appendChild(s),this.layout.yAxis.grid.visible&&t!=this.#U&&t!=this.#q){let t=document.createElementNS("http://www.w3.org/2000/svg","line");t.setAttribute("stroke",this.layout.yAxis.grid.style.stroke),t.setAttribute("stroke-width",this.layout.yAxis.grid.style.strokeWidth),t.setAttribute("stroke-dasharray",this.layout.yAxis.grid.style.strokeDashArray),t.setAttribute("x1",e.x),t.setAttribute("y1",e.y),t.setAttribute("x2",i.x),t.setAttribute("y2",i.y),t.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(t)}}}class BarChart{#f=document.createElementNS("http://www.w3.org/2000/svg","svg");#w;#O;#R;#nt;#W=100;#E=100;#A=[];set data(t){t&&t.length&&(this.#A.length=0,t.forEach((t=>{let e=new $enCharts.BarDataSeries(t.name);e.data=t.data,t.style&&(e.style=t.style),this.#A.push(e)})))}#g=new $enCharts.Layout;get layout(){return this.#g}set layout(t){t.legend&&(this.#g.legend=t.legend),t.title&&(this.#g.title=t.title),t.xAxis&&(this.#g.xAxis=t.xAxis),t.yAxis&&(this.#g.yAxis=t.yAxis)}#b="transparent";get backgroundColor(){return this.#b}set backgroundColor(t){this.#b=t,this.#f.style.backgroundColor=t}highlightColor="transparent";#N;#H;#T;#$;#X=.1;#yt=5;#ut=5;#xt=5;#dt=5;#ct=20;#At=10;#gt=5;#pt=20;#bt=5;#ft=5;#B=5;#F=2;#V;#I;#G;#j;#U;#q;constructor(t){this.#f.setAttribute("height","100%"),this.#f.setAttribute("width","100%"),this.#f.style["user-select"]="none",t.appendChild(this.#f),window.addEventListener("resize",(t=>{let e=this.#f.getBoundingClientRect();!this.#w||e.width===this.#w.width&&e.height===this.#w.height||this.plot()}))}plot(){this.#G=0,this.#j=this.#A[0].data.length;let t=this.#A[0].data.reduce(((t,e)=>t>e?t:e));this.#q=t>0?t*(1+this.#X):t*(1-this.#X),this.#A.slice(1).forEach((t=>{let e=t.data.reduce(((t,e)=>t>e?t:e)),i=e>0?e*(1+this.#X):e*(1-this.#X);i>this.#q&&(this.#q=i)}));let e=this.#A[0].data.reduce(((t,e)=>t<e?t:e));this.#U=e>0?e*(1-this.#X):e*(1+this.#X),this.#A.slice(1).forEach((t=>{let e=t.data.reduce(((t,e)=>t<e?t:e)),i=e>0?e*(1-this.#X):e*(1+this.#X);i<this.#U&&(this.#U=i)}));let i=document.createElementNS("http://www.w3.org/2000/svg","text");i.setAttribute("font-size",this.layout.yAxis.tick.style.fontSize),i.setAttribute("font-family",this.layout.yAxis.tick.style.fontFamily),i.textContent=this.layout.yAxis.tick.text(this.#q),this.#f.appendChild(i);let s=i.getBBox(),h=document.createElementNS("http://www.w3.org/2000/svg","text");h.setAttribute("font-size",this.layout.yAxis.tick.style.fontSize),h.setAttribute("font-family",this.layout.yAxis.tick.style.fontFamily),h.textContent=this.layout.yAxis.tick.text(this.#U),this.#f.appendChild(h);let r=h.getBBox();this.#V=s.width>r.width?s.width:r.width;let l=document.createElementNS("http://www.w3.org/2000/svg","text");l.setAttribute("font-size",this.layout.xAxis.tick.style.fontSize),l.setAttribute("font-family",this.layout.xAxis.tick.style.fontFamily),l.textContent=this.layout.xAxis.tick.text(this.#A[0].data.length-1),this.#f.appendChild(l),this.#I=l.getBBox().width,this.#f.innerHTML="";let o=document.createElementNS("http://www.w3.org/2000/svg","desc");o.textContent=`Created with SenCharts v${$enCharts.version}`,this.#f.appendChild(o),this.#N=$enCharts.options.ptChart,this.layout.title.text&&(this.#N+=this.layout.title.style.fontSize+$enCharts.options.mbChartTitle),this.#T=this.#B+this.#F+this.#V+$enCharts.options.plChart,this.layout.yAxis.title.text&&(this.#T+=this.layout.yAxis.title.style.fontSize+$enCharts.options.mAxisTitle),this.#H=this.#B+this.#F+this.layout.xAxis.tick.style.fontSize+$enCharts.options.pbChart,this.layout.xAxis.title.text&&(this.#H+=this.layout.xAxis.title.style.fontSize+$enCharts.options.mAxisTitle),this.#$=$enCharts.options.prChart;let a,n,y=this.#f.getBoundingClientRect();if(this.#w={height:y.height,width:y.width},this.#A.length>0&&this.layout.legend.position){let t=document.createElementNS("http://www.w3.org/2000/svg","svg");this.#f.appendChild(t);let e=document.createElementNS("http://www.w3.org/2000/svg","rect");e.setAttribute("stroke",this.layout.legend.rectStyle.stroke),e.setAttribute("stroke-width",this.layout.legend.rectStyle.strokeWidth),e.setAttribute("stroke-dasharray",this.layout.legend.rectStyle.strokeDashArray),e.setAttribute("fill",this.layout.legend.rectStyle.fill),e.setAttribute("rx",this.layout.legend.rectStyle.cornerRadius),t.appendChild(e),this.#At>this.layout.legend.textStyle.fontSize&&(this.#At=this.layout.legend.textStyle.fontSize);let i=this.#yt+this.layout.legend.rectStyle.strokeWidth/2,s=this.#ut,h=(this.layout.legend.textStyle.fontSize-this.#At)/2;this.#A.forEach(((e,r)=>{e.name||(e.name="Series "+(r+1));let l=document.createElementNS("http://www.w3.org/2000/svg","rect");l.setAttribute("x",i),l.setAttribute("y",s+h),l.setAttribute("width",this.#ct),l.setAttribute("height",this.#At),l.setAttribute("stroke",e.style.stroke),l.setAttribute("stroke-dasharray",e.style.strokeDashArray),l.setAttribute("stroke-width",e.style.strokeWidth),l.setAttribute("fill",e.style.fill),l.setAttribute("rx",e.style.cornerRadius),t.appendChild(l);let o=document.createElementNS("http://www.w3.org/2000/svg","text");if(o.setAttribute("font-size",this.layout.legend.textStyle.fontSize),o.setAttribute("font-family",this.layout.legend.textStyle.fontFamily),o.setAttribute("font-weight",this.layout.legend.textStyle.fontWeight),o.setAttribute("fill",this.layout.legend.textStyle.color),o.setAttribute("x",i+this.#ct+this.#gt),o.setAttribute("y",s+this.layout.legend.textStyle.fontSize),o.setAttribute("text-anchor","start"),o.textContent=e.name,t.appendChild(o),"north"===this.layout.legend.position.toLocaleLowerCase()||"south"===this.layout.legend.position.toLocaleLowerCase()){let t=o.getBBox();i+=this.#ct+this.#gt+t.width+this.#pt}else s+=this.layout.legend.textStyle.fontSize+this.#pt}));let r=t.getBBox(),l=r.width+this.layout.legend.rectStyle.strokeWidth+2*this.#yt,o=r.height+this.layout.legend.rectStyle.strokeWidth+this.#ut;switch(t.setAttribute("width",l+"px"),t.setAttribute("height",o+"px"),e.setAttribute("x",this.layout.legend.rectStyle.strokeWidth/2),e.setAttribute("y",this.layout.legend.rectStyle.strokeWidth/2),e.setAttribute("height",o-this.layout.legend.rectStyle.strokeWidth),e.setAttribute("width",l-this.layout.legend.rectStyle.strokeWidth),this.layout.legend.position.toLowerCase()){case"east":t.setAttribute("x",y.width-l-2*this.#dt),t.setAttribute("y",this.#N+(y.height-this.#N-this.#H-o)/2),this.#$+=l+2*this.#dt;break;case"west":t.setAttribute("x",this.#dt),t.setAttribute("y",this.#N+(y.height-this.#N-this.#H-o)/2),this.#T+=l+2*this.#dt;break;case"north":t.setAttribute("x",this.#T+(y.width-this.#T-this.#$-l)/2),t.setAttribute("y",this.#N),this.#N+=o+this.#xt;break;case"northeast":t.setAttribute("x",y.width-l-2*this.#dt),t.setAttribute("y",this.#N),this.#$+=l+2*this.#dt;break;case"northwest":t.setAttribute("x",this.#dt),t.setAttribute("y",this.#N),this.#T+=l+2*this.#dt;break;case"southeast":t.setAttribute("x",y.width-l-2*this.#dt),t.setAttribute("y",y.height-this.#xt-o-this.#H),this.#$+=l+2*this.#dt;break;case"southwest":t.setAttribute("x",this.#dt),t.setAttribute("y",y.height-this.#xt-o-this.#H),this.#T+=l+2*this.#dt;break;default:t.setAttribute("x",this.#T+(y.width-this.#T-this.#$-l)/2),t.setAttribute("y",y.height-this.#xt-o),this.#H+=o+this.#xt}}if(this.#O=y.width-this.#T-this.#$,this.#R=y.height-this.#N-this.#H,this.#nt=this.#O/(this.#j-this.#G),this.layout.xAxis.visible){let t=document.createElementNS("http://www.w3.org/2000/svg","line");t.setAttribute("stroke",this.layout.xAxis.style.stroke),t.setAttribute("stroke-width",this.layout.xAxis.style.strokeWidth),t.setAttribute("shape-rendering","crispEdges"),t.setAttribute("x1",this.#T),t.setAttribute("y1",this.#N+this.#R),t.setAttribute("x2",this.#T+this.#O),t.setAttribute("y2",this.#N+this.#R),this.#f.appendChild(t)}if(this.layout.yAxis.visible){let t=document.createElementNS("http://www.w3.org/2000/svg","line");t.setAttribute("stroke",this.layout.yAxis.style.stroke),t.setAttribute("stroke-width",this.layout.yAxis.style.strokeWidth),t.setAttribute("shape-rendering","crispEdges"),t.setAttribute("x1",this.#T),t.setAttribute("y1",this.#N),t.setAttribute("x2",this.#T),t.setAttribute("y2",this.#N+this.#R),this.#f.appendChild(t)}if("auto"==this.layout.xAxis.tick.placement.toLowerCase()||this.layout.xAxis.tick.nbTicks<=1){let t=this.#O/(this.#j-this.#G),e=this.#W/t;a=$enCharts.s(e),a<1&&(a=1);let i=Math.ceil(this.#G/a),s=Math.floor(this.#j/a);for(let t=i;t<s;t++){let e=t*a;this.#ht(e)}}else{a=(this.#j-this.#G)/this.layout.xAxis.tick.nbTicks;for(let t=0;t<this.layout.xAxis.tick.nbTicks;t++){let e=this.#G+t*a;this.#ht(Math.floor(e))}}if("auto"==this.layout.yAxis.tick.placement.toLowerCase()||this.layout.yAxis.tick.nbTicks<=1){let t=this.#R/(this.#q-this.#U),e=this.#E/t;n=$enCharts.s(e);let i=Math.ceil(this.#U/n),s=Math.floor(this.#q/n);for(let t=i;t<=s;t++)this.#rt(t*n)}else{n=(this.#q-this.#U)/(this.layout.yAxis.tick.nbTicks-1);for(let t=0;t<this.layout.yAxis.tick.nbTicks;t++)this.#rt(this.#U+t*n)}let u=.075*this.#nt,x=this.#A.length<=1?u:.85*this.#nt*.1/(this.#A.length-1),d=0===this.#A.length?0:1===this.#A.length?.85*this.#nt:.85*this.#nt*.9/this.#A.length,c=document.createElementNS("http://www.w3.org/2000/svg","svg"),A=document.createElementNS("http://www.w3.org/2000/svg","rect");A.setAttribute("x",this.#g.tooltip.rectStyle.strokeWidth/2),A.setAttribute("y",this.#g.tooltip.rectStyle.strokeWidth/2),A.setAttribute("stroke",this.#g.tooltip.rectStyle.stroke),A.setAttribute("stroke-width",this.#g.tooltip.rectStyle.strokeWidth),A.setAttribute("stroke-dasharray",this.#g.tooltip.rectStyle.strokeDashArray),A.setAttribute("fill",this.#g.tooltip.rectStyle.fill),A.setAttribute("rx",this.#g.tooltip.rectStyle.cornerRadius),c.appendChild(A);let g=document.createElementNS("http://www.w3.org/2000/svg","text");g.setAttribute("fill",this.#g.tooltip.textStyle.color),g.setAttribute("font-size",this.#g.tooltip.textStyle.fontSize),g.setAttribute("font-family",this.#g.tooltip.textStyle.fontFamily),g.setAttribute("font-weight",this.#g.tooltip.textStyle.fontWeight),c.appendChild(g);let p=document.createElementNS("http://www.w3.org/2000/svg","text");p.setAttribute("fill",this.#g.tooltip.textStyle.color),p.setAttribute("font-size",this.#g.tooltip.textStyle.fontSize),p.setAttribute("font-family",this.#g.tooltip.textStyle.fontFamily),p.setAttribute("font-weight",this.#g.tooltip.textStyle.fontWeight),c.appendChild(p);let b=document.createElementNS("http://www.w3.org/2000/svg","rect");if(b.setAttribute("height",this.#At),b.setAttribute("width",this.#ct),c.appendChild(b),this.#A.forEach(((t,e)=>{for(let i=0;i<t.data.length;i++){let s=this.#T+i*this.#nt+u+e*(d+x),h=this.#ot(t.data[i]),r=this.#N+this.#R-h,l=document.createElementNS("http://www.w3.org/2000/svg","rect");l.setAttribute("stroke",t.style.stroke),l.setAttribute("stroke-width",t.style.strokeWidth),l.setAttribute("stroke-dasharray",t.style.strokeDashArray),l.setAttribute("fill",t.style.fill),l.setAttribute("rx",t.style.cornerRadius),l.setAttribute("x",s),l.setAttribute("y",h),l.setAttribute("height",r),l.setAttribute("width",d),this.#f.appendChild(l);let o=document.createElementNS("http://www.w3.org/2000/svg","rect");o.setAttribute("stroke","transparent"),o.setAttribute("fill","transparent"),o.setAttribute("x",this.#T+i*this.#nt+u+e*(d+x)),o.setAttribute("y",this.#N),o.setAttribute("height",this.#R),o.setAttribute("width",d),this.#f.appendChild(o),o.addEventListener("mouseenter",(()=>{l.setAttribute("fill",this.highlightColor),g.textContent=this.#g.xAxis.tick.text(i),g.setAttribute("text-anchor","start"),g.setAttribute("x",this.#g.tooltip.rectStyle.strokeWidth+this.#bt+t.style.strokeWidth/2),g.setAttribute("y",this.#g.tooltip.rectStyle.strokeWidth+this.#ft+this.#g.tooltip.textStyle.fontSize),b.setAttribute("fill",t.style.fill),b.setAttribute("rx",t.style.cornerRadius),b.setAttribute("stroke",t.style.stroke),b.setAttribute("stroke-width",t.style.strokeWidth),b.setAttribute("stroke-dasharray",t.style.strokeDashArray),b.setAttribute("x",this.#g.tooltip.rectStyle.strokeWidth+this.#bt+t.style.strokeWidth/2),b.setAttribute("y",this.#g.tooltip.rectStyle.strokeWidth+this.#ft+this.#g.tooltip.textStyle.fontSize+this.#gt+t.style.strokeWidth/2),p.textContent=t.data[i],p.setAttribute("x",this.#g.tooltip.rectStyle.strokeWidth+this.#bt+t.style.strokeWidth+this.#ct+this.#gt),p.setAttribute("y",this.#g.tooltip.rectStyle.strokeWidth+this.#ft+this.#g.tooltip.textStyle.fontSize+this.#gt+t.style.strokeWidth/2+this.#At);let e=c.getBBox();g.setAttribute("x",e.width/2),g.setAttribute("text-anchor","middle"),A.setAttribute("height",e.height-this.#g.tooltip.rectStyle.strokeWidth+2*this.#ft),A.setAttribute("width",e.width-this.#g.tooltip.rectStyle.strokeWidth+2*this.#bt),s+d+e.width+2*this.#bt>this.#T+this.#O?c.setAttribute("x",s-x-e.width-2*this.#bt):c.setAttribute("x",s+d+x),e.height+2*this.#ft>r?c.setAttribute("y",h-e.height-2*this.#ft):c.setAttribute("y",h),c.style.visibility="visible"})),o.addEventListener("mouseleave",(()=>{l.setAttribute("fill",t.style.fill),A.setAttribute("height",0),A.setAttribute("width",0),c.style.visibility="hidden"}))}})),this.#f.appendChild(c),c.style.visibility="hidden",this.layout.title.text){let t=document.createElementNS("http://www.w3.org/2000/svg","text");t.setAttribute("font-size",this.layout.title.style.fontSize),t.setAttribute("font-family",this.layout.title.style.fontFamily),t.setAttribute("font-weight",this.layout.title.style.fontWeight),t.setAttribute("fill",this.layout.title.style.color),t.setAttribute("x",this.#T+this.#O/2),t.setAttribute("y",this.layout.title.style.fontSize+$enCharts.options.ptChart),t.setAttribute("text-anchor","middle"),t.textContent=this.layout.title.text,this.#f.appendChild(t)}if(this.layout.xAxis.title.text){let t=document.createElementNS("http://www.w3.org/2000/svg","text");t.setAttribute("font-size",this.layout.xAxis.title.style.fontSize),t.setAttribute("font-family",this.layout.xAxis.title.style.fontFamily),t.setAttribute("font-weight",this.layout.xAxis.title.style.fontWeight),t.setAttribute("fill",this.layout.xAxis.title.style.color),t.setAttribute("x",this.#T+this.#O/2),t.setAttribute("y",this.#N+this.#R+this.#B+this.#F+this.layout.xAxis.tick.style.fontSize+$enCharts.options.mAxisTitle+this.layout.xAxis.title.style.fontSize),t.setAttribute("text-anchor","middle"),t.textContent=this.layout.xAxis.title.text,this.#f.appendChild(t)}if(this.layout.yAxis.title.text){let t=document.createElementNS("http://www.w3.org/2000/svg","text");t.setAttribute("font-size",this.layout.yAxis.title.style.fontSize),t.setAttribute("font-family",this.layout.yAxis.title.style.fontFamily),t.setAttribute("font-weight",this.layout.yAxis.title.style.fontWeight),t.setAttribute("fill",this.layout.yAxis.title.style.color),t.setAttribute("text-anchor","start"),t.textContent=this.layout.yAxis.title.text,this.#f.appendChild(t);let e=t.getBoundingClientRect(),i=this.#T-this.#B-this.#F-this.#V-$enCharts.options.mAxisTitle,s=this.#N+this.#R/2+e.width/2;t.setAttribute("x",i),t.setAttribute("y",s),t.setAttribute("transform","rotate(-90,"+i+","+s+")")}}#at(t,e){return new $enCharts.Point((t-this.#G)*this.#O/(this.#j-this.#G)+this.#T,this.#R-(e-this.#U)*this.#R/(this.#q-this.#U)+this.#N)}#lt(t){return(t-this.#G)*this.#O/(this.#j-this.#G)+this.#T}#ot(t){return this.#R-(t-this.#U)*this.#R/(this.#q-this.#U)+this.#N}#ht(t){let e=this.#at(t,this.#U),i=this.#at(t,this.#q);if(this.layout.xAxis.visible){let t=document.createElementNS("http://www.w3.org/2000/svg","line");t.setAttribute("stroke",this.layout.xAxis.style.stroke),t.setAttribute("stroke-width",this.layout.xAxis.style.strokeWidth),t.setAttribute("x1",e.x),t.setAttribute("y1",e.y),t.setAttribute("x2",e.x),t.setAttribute("y2",e.y+this.#B),t.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(t)}let s=document.createElementNS("http://www.w3.org/2000/svg","text");if(s.setAttribute("fill",this.layout.xAxis.tick.style.color),s.setAttribute("x",e.x+this.#nt/2),s.setAttribute("y",e.y+this.#B+this.#F+this.layout.xAxis.tick.style.fontSize),s.setAttribute("text-anchor","middle"),s.setAttribute("font-size",this.layout.xAxis.tick.style.fontSize),s.setAttribute("font-weight",this.layout.xAxis.tick.style.fontWeight),s.setAttribute("font-family",this.layout.xAxis.tick.style.fontFamily),s.textContent=this.layout.xAxis.tick.text(t),this.#f.appendChild(s),this.layout.xAxis.grid.visible&&t!=this.#G&&t!=this.#j){let t=document.createElementNS("http://www.w3.org/2000/svg","line");t.setAttribute("stroke",this.layout.xAxis.grid.style.stroke),t.setAttribute("stroke-width",this.layout.xAxis.grid.style.strokeWidth),t.setAttribute("stroke-dasharray",this.layout.xAxis.grid.style.strokeDashArray),t.setAttribute("x1",e.x),t.setAttribute("y1",e.y),t.setAttribute("x2",i.x),t.setAttribute("y2",i.y),t.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(t)}}#rt(t){let e=this.#at(this.#G,t),i=this.#at(this.#j,t);if(this.layout.yAxis.visible){let t=document.createElementNS("http://www.w3.org/2000/svg","line");t.setAttribute("stroke",this.layout.yAxis.style.stroke),t.setAttribute("stroke-width",this.layout.yAxis.style.strokeWidth),t.setAttribute("x1",e.x),t.setAttribute("y1",e.y),t.setAttribute("x2",e.x-this.#B),t.setAttribute("y2",e.y),t.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(t)}let s=document.createElementNS("http://www.w3.org/2000/svg","text");if(s.setAttribute("fill",this.layout.yAxis.tick.style.color),s.setAttribute("x",e.x-this.#B-this.#F),s.setAttribute("y",e.y+this.layout.yAxis.tick.style.fontSize/2),s.setAttribute("text-anchor","end"),s.setAttribute("font-size",this.layout.yAxis.tick.style.fontSize),s.setAttribute("font-weight",this.layout.yAxis.tick.style.fontWeight),s.setAttribute("font-family",this.layout.yAxis.tick.style.fontFamily),s.textContent=this.layout.yAxis.tick.text(t),this.#f.appendChild(s),this.layout.yAxis.grid.visible&&t!=this.#U&&t!=this.#q){let t=document.createElementNS("http://www.w3.org/2000/svg","line");t.setAttribute("stroke",this.layout.yAxis.grid.style.stroke),t.setAttribute("stroke-width",this.layout.yAxis.grid.style.strokeWidth),t.setAttribute("stroke-dasharray",this.layout.yAxis.grid.style.strokeDashArray),t.setAttribute("x1",e.x),t.setAttribute("y1",e.y),t.setAttribute("x2",i.x),t.setAttribute("y2",i.y),t.setAttribute("shape-rendering","crispEdges"),this.#f.appendChild(t)}}}