UNPKG

chrt

Version:

Chrt is a library for creating charts in the most spontaneous way possible.

3 lines 154 kB
// chrt.io v0.0.170 Copyright 2024 chrt
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).chrt=t.chrt||{})}(this,(function(t){"use strict";function e(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function r(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=l(t))||e){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var a,s=!0,o=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return s=t.done,t},e:function(t){o=!0,a=t},f:function(){try{s||null==r.return||r.return()}finally{if(o)throw a}}}}function n(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function i(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?i(Object(r),!0).forEach((function(e){n(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function s(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,a,s,o=[],l=!0,c=!1;try{if(a=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=a.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(t){c=!0,i=t}finally{try{if(!l&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(c)throw i}}return o}}(t,e)||l(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(t){return function(t){if(Array.isArray(t))return e(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||l(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(t,r){if(t){if("string"==typeof t)return e(t,r);var n={}.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?e(t,r):void 0}}var c=10;function u(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:c;return(t=isNaN(t)?c:t)===Math.E?Math.log:10===t&&h||2===t&&d||function(e){return function(t,e){return Math.log(e)/Math.log(t)}(t,e)}}var h=Math.log10=Math.log10||function(t){return Math.log(t)*Math.LOG10E},d=Math.log2||function(t){return Math.log(t)*Math.LOG2E},f=function(t){return isFinite(t)?+("1e"+t):t<0?0:t},p=function(t){return 10===t?f:t===Math.E?Math.exp:function(e){return Math.pow(t,e)}},y=600,g=300,v=10,b=["chrt","series"];function m(t){return null===t||null==t||void 0===t}function x(t){return Array.isArray(t)||(t=[t]),t.some((function(t){return m(t)}))}function _(t){return Array.isArray(t)||(t=[t]),t.some((function(t){return isNaN(t)}))}function N(t){return!m(t.type)&&b.indexOf(t.type)>-1}function A(t){return"string"!=typeof t&&!isFinite(t)}function k(t,e){return Array.isArray(t)&&Array.isArray(e)?0===t.length&&0===e.length||t.length==e.length&&t.every((function(t,r){return t===e[r]})):(console.warn("arraysEqual(array1, array2)","Both parameters should be arrays"),!1)}function w(t){var e={};return function(){var r=Array.prototype.slice.call(arguments),n=JSON.stringify({func:t.name,args:r});if(e[n])return e[n];var i=t.apply(null,arguments);return e[n]=i,i}}function O(t){return(t+"").replace(/[/][/].*$/gm,"").replace(/\s+/g,"").replace(/[/][*][^/*]*[*][/]/g,"").split("){",1)[0].replace(/^[^(]*[(]/,"").replace(/=[^,]+/g,"").split(",").filter(Boolean)}function M(t){var e=function(t){var e=new Set,r=t;do{Object.getOwnPropertyNames(r).map((function(t){return e.add(t)}))}while(r=Object.getPrototypeOf(r));return o(e.entries()).filter((function(e){return"function"==typeof t[e[0]]}))}(t);return e.map((function(e){return{name:e[0],parameters:O(t[e[0]])}}))}function j(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:12,r=Math.pow(10,e),n=e<0?t:.01/r+t;return Math.round(n*r)/r}function S(t){var e="c"+Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),r=t.hasData()?t.data():this.data();return t.id(e).parent(this).node(this.currentNode).data(r||this.data()).render(t._stacked||t._group),this.objects.push(t),N(t)||t.updater?this.update():this}function L(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];if(!e.length)return{width:this.width,height:this.height};var n,i,a,s,o=e[0],l=e[1],c=e[2],u=void 0===c||c,h=this.width,d=this.height;(this.width=("auto"!==o?o:null)||h||y,this.height=("auto"!==l?l:null)||d||g,this.autoWidth=null,"auto"===o)&&(this.autoWidth="auto",this.width=null!==(n=null===(i=this.root.parentElement)||void 0===i?void 0:i.clientWidth)&&void 0!==n?n:this.width);(this.autoHeight=null,"auto"===l)&&(this.autoHeight="auto",this.height=null!==(a=null===(s=this.root.parentElement)||void 0===s?void 0:s.clientHeight)&&void 0!==a?a:this.height);var f=this.root.querySelector("svg");return f||this.svg(!1),(f=this.root.querySelector("svg")).setAttribute("width",this.width),f.setAttribute("height",this.height),f.setAttribute("font-family","system-ui"),f.setAttribute("viewBox","0 0 ".concat(this.width," ").concat(this.height)),f.style.maxWidth="100%",f.parentNode.style.width="".concat(this.width,"px"),f.parentNode.style.height="".concat(this.height,"px"),u?this.update():void 0}function E(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function F(t){var e=this,n=s(t,2),i=n[0],a=n[1],o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:v,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[1,5,2,2.5,4,3],c=arguments.length>3&&void 0!==arguments[3]&&arguments[3],u=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[.25,.2,.5,.05],h=!(arguments.length>5&&void 0!==arguments[5])||arguments[5],d=100*Number.EPSILON;if(this._ticks=[],i>a){var f=i;i=a,a=f}var p={score:-2};return this.ticks=function(t){if(a-i<d)return W(i,a,(a-i)/t);p={score:-2};for(var n=1;n<1/0;){var s,o=r(l);try{for(o.s();!(s=o.n()).done;){var f=s.value,y=P.max(f,l,n);if(u[0]*y+u[1]+u[2]+u[3]<p.score){n=1/0;break}for(var g=2;g<1/0;){var v=I.max(g,t);if(u[0]*y+u[1]+u[2]*v+u[3]<p.score)break;for(var b=(a-i)/(g+1)/n/f,m=Math.ceil(Math.log10(b));m<1/0;){var x=n*f*Math.pow(10,m),_=C.max(i,a,x*(g-1));if(u[0]*y+u[1]*_+u[2]*v+u[3]<p.score)break;var N=Math.floor(a/x)*n-(g-1)*n,A=Math.ceil(i/x)*n;if(N>A)m+=1;else{for(var k=N;k<=A;k++){var w=k*(x/n),O=w+x*(g-1),M=x,j=P(f,l,n,w,O,M),S=C(i,a,w,O),L=I(g,t,i,a,w,O),E=T(w,O,M),F=u[0]*j+u[1]*S+u[2]*L+u[3]*E;F>p.score&&(!c||w<=i&&O>=a)&&(p.lmin=w,p.lmax=O,h&&(p.lmin=w<O?Math.floor(i/M)*M:Math.ceil(i/M)*M,p.lmax=O>w?Math.ceil(a/M)*M:Math.floor(a/M)*M),p.lstep=M,p.score=F)}m+=1}}g+=1}}}catch(t){o.e(t)}finally{o.f()}n+=1}return e._ticks=W(p.lmin,p.lmax+p.lstep,p.lstep),e._ticks},this.ticks(o),this.getMin=function(){return p.lmin},this.getMax=function(){return p.lmax},this.getStep=function(){return p.lstep},this}function P(t,e,r,n,i,a){var s=100*Number.EPSILON,o=e.length;return 1-(D(t,e)[0]-1)/(o-1)-r+((n%a<s||a-n%a<s)&&n<=0&&n>=0?1:0)}function C(t,e,r,n){var i=e-t;return 1-.5*(Math.pow(e-n,2)+Math.pow(t-r,2))/Math.pow(.1*i,2)}function I(t,e,r,n,i,a){var s=(t-1)/(a-i),o=(e-1)/(Math.max(a,n)-Math.min(r,i));return 2-Math.max(s/o,o/s)}P.max=function(t,e,r){var n=e.length;return 1-(D(t,e)[0]-1)/(n-1)-r+1},C.max=function(t,e,r){var n=e-t;if(r>n){var i=(r-n)/2;return 1-.5*(Math.pow(i,2)+Math.pow(i,2))/Math.pow(.1*n,2)}return 1},I.max=function(t,e){return t>=e?2-(t-1)/(e-1):1};var T=function(){return 1};function D(t,e){if(Array.isArray(t))return t.map((function(t){return e.indexOf(t)})).map((function(t){return t>-1?t:null}));var r=e.indexOf(t);return r>-1?[r+1]:[null]}function W(){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=[],n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;n<t;n+=e)r.push(n);return r}var z=[0,1];function q(t,e,r){var n=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[0,y],a=arguments.length>4?arguments[4]:void 0,s=arguments.length>5?arguments[5]:void 0,l=arguments.length>6?arguments[6]:void 0,c=this.scales[e][t],u=r||(c?c.fixedDomain:null),h=m(u)?null:o(u),d=l||this._padding;i[0]+="x"===e?d.left:-d.bottom,i[1]-="x"===e?d.right:-d.top;var f=h||r||[];!m(u)&&!x(u)&&f&&f.length||(this._data.forEach((function(e){[a,"".concat(a,"0")].forEach((function(r){f[0]=m(f[0])?e[r||t]:Math.min.apply(Math,o([m(e)?null:e[r||t],f[0],m(e)?null:e["stacked_".concat(r||t)]].filter((function(t){return!m(t)&&!isNaN(t)})))),f[1]=m(f[1])?e[r||t]:Math.max.apply(Math,o([m(e)?null:e[r||t],f[1],m(e)?null:e["stacked_".concat(r||t)]].filter((function(t){return!m(t)&&!isNaN(t)}))))}))})),this.objects.forEach((function(e){var r=!m(e._data)&&e._data.length?e._data:n._data;r&&r.forEach((function(r){[a,"".concat(a,"0")].forEach((function(n){f[0]=m(f[0])?r[n||e.fields[t]]:Math.min.apply(Math,o([m(r)?null:r[n||e.fields[t]],f[0],m(r)?null:r["stacked_".concat(n||e.fields[t])]].filter((function(t){return!m(t)&&!_(t)})))),f[1]=m(f[1])?r[n||e.fields[t]]:Math.max.apply(Math,o([m(r)?null:r[n||e.fields[t]],f[1],m(r)?null:r["stacked_".concat(n||e.fields[t])]].filter((function(t){return!m(t)&&!_(t)}))))}))}))}))),f[0]===f[1]&&(f[0]<0?f[1]=Math.abs(f[1]):0===f[0]?(f[0]=-1,f[1]=1):(f[0]=0,f[1]=2*f[1]));var p=new F(f=[m(f[0])||isNaN(f[0])?z[0]:f[0],m(f[1])||isNaN(f[1])?z[1]:f[1]]);m(u)&&(f[0]=m(f[0])?p.getMin():Math.min(f[0],p.getMin()),f[1]=m(f[1])?p.getMax():Math.max(f[1],p.getMax()));var g=function(t){var r=f[1]-f[0],a=i[1]>=i[0]?1:-1,o=s||n._margins,l=i[1]-i[0]-("x"===e?o.left+o.right:o.top+o.bottom)*a;return i[0]+("x"===e?o.left:o.bottom)*a+l*((t-f[0])/r)};return g.getName=function(){return t},g.getType=function(){return e},g.transformation="linear",g.getField=function(){return a},g.isLog=function(){return!1},g.fixedDomain=u,g.domain=f,g.field=a,g.range=i,g.step=p.getStep(),g.barwidth=Math.abs(g(f[0]+g.step)-g(f[0])),g.ticks=w((function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v,e=Array.isArray(t)&&t.length;return(e?t:p.ticks(t+1)).map((function(t,r){return{index:r,value:j(t),x:g(t),isMinor:e?0:r%2,isZero:0===t}}))})),g.clear=function(){console.log("CLEARING SCALE",n),n.fixedDomain=null,n.domain=null},this.scales[e][t]=g,this}var G=10,U=1,R=10;function V(t,e){var r=this,n=s(t,2),i=n[0],a=n[1],o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:G;this.ticksNumber=e||v,this._ticks=[];var l=u(o),c=p(o);return this.improveRange=function(t){var e=t[0],r=t[1];return e===r&&(e<=0?(e=U,r=R):(e=c(Math.floor(l(e))-1),r=c(Math.floor(l(r))+1))),e<=0&&(e=c(Math.floor(l(r))-1)),r<=0&&(r=c(Math.floor(l(e))+1)),[e,r]},this.ticks=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:r.ticksNumber;r.ticksNumber=t,r._ticks=[],r.range=r.improveRange([i,a]),r.lmin=Math.floor(l(r.range[0]))!==l(r.range[0])?c(Math.floor(l(r.range[0]))-1):r.range[0],r.lmax=Math.floor(l(r.range[1]))!==l(r.range[1])?c(Math.floor(l(r.range[1]))+1):r.range[1];var e=[l(r.lmin),l(r.lmax)],n=Math.abs(e[1]-e[0]),s=Math.max(1,Math.ceil(n/t));if(e[0]>0){for(var u=e[0];u<=e[1];++u)if(!(u%s))for(var h=1;h<o;++h){var d=c(u)*h;d>=r.lmin&&r._ticks.push(d)}}else for(var f=e[0];f<=e[1];++f)if(!(f%s))for(var p=o-1;p>=1;--p){var y=c(f)*p;y>=r.lmin&&r._ticks.push(y)}return r._ticks},this.ticks(this.ticksNumber),this.getMin=function(){return r.lmin},this.getMax=function(){return r.lmax},this}var $=[1,10];function H(t,e,r){var n=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[0,y],a=arguments.length>4?arguments[4]:void 0,s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"log10",l=arguments.length>6?arguments[6]:void 0,c=arguments.length>7?arguments[7]:void 0,h=this.scales[e][t],d=+("log"===s?"log10":s).replace(/log/,""),f=u(d),p=r||(h?h.fixedDomain:null),g=m(p)?null:o(p),b=[],x=c||this._padding;i[0]+="x"===e?x.left:-x.bottom,i[1]-="x"===e?x.right:-x.top;var N=g||r||[];if(1===arguments.length)return this.scales.x[arguments[0]]||this.scales.y[arguments[0]];!m(p)&&N&&N.length||(this._data.filter((function(t){return t[a]>0})).forEach((function(e){[a,"".concat(a,"0")].forEach((function(r){N[0]=m(N[0])?e[r||t]:Math.min.apply(Math,o([m(e)?null:e[r||t],N[0],m(e)?null:e["stacked_".concat(r||t)]].filter((function(t){return!m(t)})))),N[1]=m(N[1])?e[r||t]:Math.max.apply(Math,o([m(e)?null:e[r||t],N[1],m(e)?null:e["stacked_".concat(r||t)]].filter((function(t){return!m(t)}))))}))})),this.objects.forEach((function(e){var r=!m(e._data)&&e._data.length?e._data:n._data;r&&r.forEach((function(r){[a,"".concat(a,"0")].forEach((function(n){N[0]=m(N[0])?r[e.fields[n||t]]:Math.min.apply(Math,o([m(r)?null:r[n||e.fields[t]],N[0],m(r)?null:r["stacked_".concat(n||e.fields[t])]].filter((function(t){return!m(t)&&!_(t)&&0!==t})))),N[1]=m(N[1])?r[e.fields[n||t]]:Math.max.apply(Math,o([m(r)?null:r[n||e.fields[t]],N[1],m(r)?null:r["stacked_".concat(n||e.fields[t])]].filter((function(t){return!m(t)&&!_(t)&&0!==t}))))}))}))})));var k=new V(N=[m(N[0])||isNaN(N[0])?$[0]:N[0],m(N[1])||isNaN(N[1])?$[1]:N[1]],v,d);N[0]=k.getMin(),N[1]=k.getMax(),m(p)&&(N[0]=m(N[0])?k.getMin():Math.min(N[0],k.getMin()),N[1]=m(N[1])?k.getMax():Math.max(N[1],k.getMax()));var O=f(N[1])-f(N[0]),M=i[1]>=i[0]?1:-1,S=l||this._margins,L=i[1]-i[0]-("x"===e?S.left+S.right:S.top+S.bottom)*M,E=i[0]+("x"===e?S.left:S.bottom)*M,F=function(t){if(A(f(N[0]))||A(f(t)))return NaN;var e=(f(t)-f(N[0]))/O;return E+L*e};return F.getName=function(){return t},F.getType=function(){return e},F.getTransformation=function(){return s},F.transformation=s,F.getField=function(){return a},F.field=a,F.isLog=function(){return!0},F.fixedDomain=p,F.domain=N,F.range=i,F.ticks=w((function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v;return b=k.ticks(t).map((function(t,e){return{index:e,value:j(t),x:F(t),isMinor:f(t)%1}})),b})),this.scales[e][t]=F,this}function B(t,e,r){var n=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[0,y],a=arguments.length>4?arguments[4]:void 0,s=arguments.length>5?arguments[5]:void 0,l=arguments.length>6?arguments[6]:void 0,c=this.scales[e][t],u=r||(c&&"ordinal"===c.transformation?c.fixedDomain:null),h=m(u)?null:o(u),d=[],f=l||this._padding;i[0]+="x"===e?f.left:-f.bottom,i[1]-="x"===e?f.right:-f.top;var p=c&&"ordinal"===c.transformation?c.domain:[],g=h||r||p;if(1===arguments.length)return this.scales.x[arguments[0]]||this.scales.y[arguments[0]];!m(u)&&g&&g.length&&k(g,p)||(this._data.forEach((function(e){[a,"".concat(a,"0")].forEach((function(r){var n=e[r||t];void 0!==n&&-1===g.indexOf(n)&&g.push(n)}))})),this.objects.forEach((function(e){var r=!m(e._data)&&e._data.length?e._data:n._data;r&&r.forEach((function(r){[a,"".concat(a,"0")].forEach((function(n){var i=r[n||e.fields[t]];void 0!==i&&-1===g.indexOf(i)&&g.push(i)}))}))})));var v=g.length,b=i[1]>=i[0]?1:-1,x=s||this._margins,_=i[1]-i[0]-("x"===e?x.left+x.right:x.top+x.bottom)*b,N=i[0]+("x"===e?x.left:x.bottom)*b,A=_/g.length,w=function(t){var e=g.indexOf(t)/v;return N+A/2+_*e};return w.getName=function(){return t},w.getType=function(){return e},w.transformation="ordinal",w.getField=function(){return a},w.field=a,w.isLog=function(){return!1},w.fixedDomain=u,w.domain=g,w.range=i,w.step=1,w.barwidth=A,w.ticks=function(){return m(arguments.length>0&&void 0!==arguments[0]?arguments[0]:g.length)&&d.length>0?d:(d=g).map((function(t,e){return{index:e,value:t,x:w(t)}}))},this.scales[e][t]=w,this}var Y={second:1e3,minute:6e4};Y.hour=60*Y.minute,Y.day=24*Y.hour,Object.keys(Y).forEach((function(t){return Y["".concat(t,"s")]=Y[t]}));var Z={bidiurnal:2*Y.day,week:7*Y.day,fortnight:14*Y.day,month:30*Y.day,year:365*Y.day};function X(t,e,r){var n=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[0,y],a=arguments.length>4?arguments[4]:void 0,s=arguments.length>5?arguments[5]:void 0,l=arguments.length>6?arguments[6]:void 0,c=Y.day,u=this.scales[e][t],h=r||(u?u.fixedDomain:null),d=m(h)?null:o(h),f=[],p=l||this._padding;i[0]+="x"===e?p.left:-p.bottom,i[1]-="x"===e?p.right:-p.top;var g=u&&!u.isLog()?u.domain:[],b=d||r||g;if(1===arguments.length)return this.scales.x[arguments[0]]||this.scales.y[arguments[0]];!m(h)&&!_(g)&&b&&b.length&&b[0]===g[0]&&b[1]===g[1]||(this._data.forEach((function(e){[a,"".concat(a,"0")].forEach((function(r){b[0]=m(b[0])?e[r||t]:Math.min.apply(Math,o([m(e)?null:e[r||t],b[0],m(e)?null:e["stacked_".concat(r||t)]].filter((function(t){return!m(t)&&!isNaN(t)})))),b[1]=m(b[1])?e[r||t]:Math.max.apply(Math,o([m(e)?null:e[r||t],b[1],m(e)?null:e["stacked_".concat(r||t)]].filter((function(t){return!m(t)&&!isNaN(t)}))))}))})),this.objects.forEach((function(e){var r=!m(e._data)&&e._data.length?e._data:n._data;r&&r.forEach((function(r){[a,"".concat(a,"0")].forEach((function(n){b[0]=m(b[0])?+r[n||e.fields[t]]:Math.min.apply(Math,o([m(r)?null:+r[n||e.fields[t]],b[0],m(r)?null:+r["stacked_".concat(n||e.fields[t])]].filter((function(t){return!m(t)&&!_(t)})))),b[1]=m(b[1])?+r[n||e.fields[t]]:Math.max.apply(Math,o([m(r)?null:+r[n||e.fields[t]],b[1],m(r)?null:+r["stacked_".concat(n||e.fields[t])]].filter((function(t){return!m(t)&&!_(t)}))))}))}))}))),b.length>1&&b[0]===b[1]&&(b[0]<0?b[1]=Math.abs(b[1]):0===b[0]?(b[0]=-1,b[1]=1):(b[0]=b[0]-1,b[1]=b[1]+1)),!m(h)&&b&&b.length&&k(b,g)||(this._data.forEach((function(e){b[0]=m(b[0])?e[a||t]:Math.min.apply(Math,o([m(e)?null:e[a||t],b[0],m(e)?null:e["stacked_".concat(a||t)]].filter((function(t){return!m(t)})))),b[1]=m(b[1])?e[a||t]:Math.max.apply(Math,o([m(e)?null:e[a||t],b[1],m(e)?null:e["stacked_".concat(a||t)]].filter((function(t){return!m(t)}))))})),this.objects.forEach((function(e){var r=!m(e._data)&&e._data.length?e._data:n._data;r&&r.forEach((function(r){b[0]=m(b[0])?r[a||e.fields[t]]:Math.min.apply(Math,o([m(r)?null:r[a||e.fields[t]],b[0],m(r)?null:r["stacked_".concat(a||e.fields[t])]].filter((function(t){return!m(t)&&!_(t)})))),b[1]=m(b[1])?r[a||e.fields[t]]:Math.max.apply(Math,o([m(r)?null:r[a||e.fields[t]],b[1],m(r)?null:r["stacked_".concat(a||e.fields[t])]].filter((function(t){return!m(t)&&!_(t)}))))}))})));var x=function(t){if(b.length){var e=o(b);if(m(t)&&(t=Y.seconds,Object.keys(Y).forEach((function(r){Math.abs(e[1]-e[0])>=Y[r]&&(t=r)}))),(c=Y[t]||Z[t]||Y.day)>=Y.day){var r=new Date(e[0]),n=new Date(e[1]);switch(t){case"month":case"months":e[0]=new Date(r.getFullYear(),r.getMonth(),1),e[1]=new Date(n.getFullYear(),n.getMonth()+1,1);break;case"year":case"years":e[0]=new Date(r.getFullYear(),0,1),e[1]=new Date(n.getFullYear(),0,1);break;default:e[0]=new Date(r.getFullYear(),+r.getMonth(),r.getDate()),e[1]=new Date(n.getFullYear(),+n.getMonth(),n.getDate())}return e}return[Math.floor(e[0]/c)*c,Math.ceil(e[1]/c)*c]}return[]},N=b;N=x();var A=i[1]>=i[0]?1:-1,O=s||this._margins,M=i[1]-i[0]-("x"===e?O.left+O.right:O.top+O.bottom)*A,j=i[0]+("x"===e?O.left:O.bottom)*A,S=function(t){var e=(t-N[0])/(N[1]-N[0]);return j+M*e};return S.getName=function(){return t},S.getType=function(){return e},S.transformation="time",S.getField=function(){return a},S.isLog=function(){return!1},S.fixedDomain=h,S.interval=function(t){if(m(t))return t;"number"!=typeof t?Y[t]||Z[t]?N=x(t):console.error("The selected interval does not exists."):console.error("Please use a string for now")},S.domain=b,S.roundedDomainExtent=N,S.field=a,S.range=i,S.step=c,S.barwidth=S(N[0]+S.step)-S(N[0]),S.ticks=w((function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v,e=arguments.length>1?arguments[1]:void 0;if(!b.length)return[];var r=x(e),n=r[1]-r[0];if(m(t)&&m(e)&&f.length>0)return f;var i=Z[e]||Y[e]||Y.day,a=Array.isArray(t)&&t.length;if(i<=Z.fortnight)f=o(Array(a?t:Math.floor(n/i)+1).keys()).map((function(t){return+r[0]+t*i}));else if(i===Z.month)for(var s=(f=[new Date(r[0])])[0],l=f[0].getMonth(),c=new Date(r[0]).getFullYear();l<1e4&&+s<+r[1];)s=new Date(c,l,1),f.push(s),l++;else if(i===Z.year)for(var u=(f=[new Date(r[0])])[0],h=f[0].getFullYear(),d=f[0].getFullYear();+u<+r[1]&&d<h+1e4;)u=new Date(d,0,1),f.push(u),d++;return f.map((function(t,e){return{index:e,value:t,x:S(t)}}))})),this.scales[e][t]=S,this}Object.keys(Z).forEach((function(t){return Z["".concat(t,"s")]=Z[t]}));var J=[0,1];function K(t,e,r){var n=this,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[0,y],a=arguments.length>4?arguments[4]:void 0,s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:1,l=arguments.length>7?arguments[7]:void 0,c=arguments.length>8?arguments[8]:void 0,u=this.scales[e][t],h=r||(u?u.fixedDomain:null),d=m(h)?null:o(h),f=c||this._padding;i[0]+="x"===e?f.left:-f.bottom,i[1]-="x"===e?f.right:-f.top;var p=u&&!u.isLog()?u.domain:[],g=d||r||p;if(m(h)||x(h)||_(p)||!g||!g.length||g[0]!==p[0]||g[1]!==p[1]){if(this._data.length&&!this._data.some((function(t){return!m(t[a])})))throw new Error("Field ".concat(a," not found in the data"));this._data.forEach((function(e){[a,"".concat(a,"0")].forEach((function(r){g[0]=m(g[0])?e[r||t]:Math.min.apply(Math,o([m(e)?null:e[r||t],g[0],m(e)?null:e["stacked_".concat(r||t)]].filter((function(t){return!m(t)&&!isNaN(t)})))),g[1]=m(g[1])?e[r||t]:Math.max.apply(Math,o([m(e)?null:e[r||t],g[1],m(e)?null:e["stacked_".concat(r||t)]].filter((function(t){return!m(t)&&!isNaN(t)}))))}))})),this.objects.forEach((function(e){var r=!m(e._data)&&e._data.length?e._data:n._data;if(r){if(r.length&&!r.some((function(t){return!m(t[a])})))throw new Error("Field ".concat(a," not found in the data"));r.forEach((function(r){[a,"".concat(a,"0")].forEach((function(n){g[0]=m(g[0])?r[n||e.fields[t]]:Math.min.apply(Math,o([m(r)?null:r[n||e.fields[t]],g[0],m(r)?null:r["stacked_".concat(n||e.fields[t])]].filter((function(t){return!m(t)&&!_(t)})))),g[1]=m(g[1])?r[n||e.fields[t]]:Math.max.apply(Math,o([m(r)?null:r[n||e.fields[t]],g[1],m(r)?null:r["stacked_".concat(n||e.fields[t])]].filter((function(t){return!m(t)&&!_(t)}))))}))}))}}))}g[0]===g[1]&&(g[0]<0?g[1]=Math.abs(g[1]):0===g[0]?(g[0]=-1,g[1]=1):(g[0]=0,g[1]=2*g[1]));var b=new F(g=[m(g[0])||isNaN(g[0])?J[0]:g[0],m(g[1])||isNaN(g[1])?J[1]:g[1]]);m(h)&&(g[0]=m(p[0])?b.getMin():Math.min(p[0],b.getMin()),g[1]=m(p[1])?b.getMax():Math.max(p[1],b.getMax()));var N=function(t,e){return t<0?-Math.pow(-t,e):Math.pow(t,e)},A=function(t){g[1],g[0];var r=i[1]>=i[0]?1:-1,a=l||n._margins,o=i[1]-i[0]-("x"===e?a.left+a.right:a.top+a.bottom)*r;return i[0]+("x"===e?a.left:a.bottom)*r+o*((N(t,s)-N(g[0],s))/(N(g[1],s)-N(g[0],s)))};return A.getName=function(){return t},A.getType=function(){return e},A.transformation="pow",A.pow=s,A.getField=function(){return a},A.isLog=function(){return!1},A.fixedDomain=h,A.domain=g,A.field=a,A.range=i,A.step=b.getStep(),A.barwidth=Math.abs(A(g[0]+A.step)-A(g[0])),A.ticks=w((function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:v,e=Array.isArray(t)&&t.length;return(e?t:b.ticks(t+1)).map((function(t,r){return{index:r,value:j(t),x:A(t),isMinor:e?0:r%2,isZero:0===t}}))})),this.scales[e][t]=A,this}function Q(){var t,e=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(t="div",document.createElement(t));this.type="chrt",this._data=r,this._orginalData=this._data,this.root=n,this.currentNode=n,this._accessor=function(t,e){return{x:!m(t)&&Object.prototype.hasOwnProperty.call(t,"x")?t.x:e,y:m(t)?null:Object.prototype.hasOwnProperty.call(t,"y")?t.y:t}},this.width=null,this.height=null,this._margins={top:20,bottom:20,left:40,right:20},this._padding={top:0,bottom:0,left:0,right:0},this.scales={x:{},y:{}},this.objects=[];var i=function(t,r,n,i,a,s,l){var c=e.scales[r][t],u=c?o(c.domain):[],h=c?o(c.range):[];return q.apply(e,[t,r,n,i,a,s,l]),m(c)||k(u,e.scales[r][t].domain)&&k(h,e.scales[r][t].range)||e.objects.forEach((function(t){return t.update()})),e},l=function(t,r,n,i,a){var s,l=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"sqrt",c=arguments.length>6?arguments[6]:void 0,u=arguments.length>7?arguments[7]:void 0;e.scales[r]=null!==(s=e.scales[r])&&void 0!==s?s:{};var h=e.scales[r][t],d=h?o(h.domain):[],f=h?o(h.range):[];return K.apply(e,[t,r,n,i,a,l,.5,c,u]),m(h)||k(d,e.scales[r][t].domain)&&k(f,e.scales[r][t].range)||e.objects.forEach((function(t){return t.update()})),e},c=function(t,r,n,i,a){var s=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"log10",l=arguments.length>6?arguments[6]:void 0,c=arguments.length>7?arguments[7]:void 0,u=e.scales[r][t],h=u?o(u.domain):[],d=u?o(u.range):[];return H.apply(e,[t,r,n,i,a,s,l,c]),m(u)||k(h,e.scales[r][t].domain)&&k(d,e.scales[r][t].range)||e.objects.forEach((function(t){return t.update()})),e},u=function(t,r,n,i,a,s,l){var c=e.scales[r][t],u=c?o(c.domain):[],h=c?o(c.range):[];return B.apply(e,[t,r,e._data.length?n:[],i,a,s,l]),m(c)||k(u,e.scales[r][t].domain)&&k(h,e.scales[r][t].range)||e.objects.forEach((function(t){return t.update()})),e},h=function(t,r,n,i,a,s,l){var c=e.scales[r][t],u=c?o(c.domain):[],h=c?o(c.range):[];return X.apply(e,[t,r,n||[],i,a,s,l]),m(c)||k(u,e.scales[r][t].domain)&&k(h,e.scales[r][t].range)||e.objects.forEach((function(t){return t.update()})),e};function d(t){return"[object Object]"===Object.prototype.toString.call(t)}this.scale=function(){for(var t,r,n,a=arguments.length,o=new Array(a),f=0;f<a;f++)o[f]=arguments[f];1===o.length&&d(o[0])&&(o=[o[0].domain,o[0].range,o[0].options||o[0]]);var p=s(o||[],3),y=p[0],g=p[1],v=p[2],b=void 0===v?{}:v,m=null!==(t=null==b?void 0:b.scale)&&void 0!==t?t:"linear";switch(b.name=null!==(r=b.name)&&void 0!==r?r:b.field,b.field=null!==(n=b.field)&&void 0!==n?n:b.name,m){case"log":case"log10":case"log2":return c(b.name,b.type,y,g,b.field,m,b.margins,b.padding);case"pow":case"sqrt":return l(b.name,b.type,y,g,b.field,m,b.margins,b.padding);case"time":return h.apply(e,[b.name,b.type,y,g,b.field,b.margins,b.padding]);case"ordinal":return u.apply(e,[b.name,b.type,y,g,b.field,b.margins,b.padding]);default:return i.apply(e,[b.name,b.type,y,g,b.field,b.margins,b.padding])}},this.x=function(){for(var t,r,n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];1===i.length&&d(i[0])&&(i=[i[0].domain,i[0].range,i[0].options||i[0]]);var l=s(i||[],3),c=l[0],u=l[1],h=l[2],f=void 0===h?{}:h,p=null!==(t=f.name)&&void 0!==t?t:f.field,y=null!==(r=f.field)&&void 0!==r?r:p;return e.scale(c,u||[0,e.width],a(a({},f),{},{name:null!=p?p:"x",type:"x",field:null!=y?y:"x"}))},this.y=function(){for(var t,r,n=arguments.length,i=new Array(n),o=0;o<n;o++)i[o]=arguments[o];1===i.length&&d(i[0])&&(i=[i[0].domain,i[0].range,i[0].options||i[0]]);var l=s(i||[],3),c=l[0],u=l[1],h=l[2],f=void 0===h?{}:h,p=null!==(t=f.name)&&void 0!==t?t:f.field,y=null!==(r=f.field)&&void 0!==r?r:p;return e.scale(c,u||[e.height,0],a(a({},f),{},{name:null!=p?p:"y",type:"y",field:null!=y?y:"y"}))},this.update=function(){return(e.autoWidth||e.autoHeight)&&e.size(e.autoWidth||e.width,e.autoHeight||e.height,!1),Object.values(e.scales.x).length?Object.values(e.scales.x).forEach((function(t){e.x({domain:t.fixedDomain,range:[0,e.width],options:{name:t.getName(),type:t.getType(),field:t.field,scale:t.transformation}})})):e.x({range:[0,e.width]}),Object.values(e.scales.y).length?Object.values(e.scales.y).forEach((function(t){e.y({domain:t.fixedDomain,range:[e.height,0],options:{name:t.getName(),type:t.getType(),field:t.field,scale:t.transformation}})})):e.y({range:[e.height,0]}),Object.values(e.scales.other||{}).forEach((function(t){e.scale({domain:t.fixedDomain,range:t.range||[0,10],options:{name:t.getName(),type:t.getType(),field:t.field,scale:t.transformation,margins:t.margins||{top:0,left:0,right:0,bottom:0},padding:t.margins||{top:0,left:0,right:0,bottom:0}}})})),e.objects.forEach((function(t){t.update()})),e},this.getAxis=function(t,r){return e.objects.find((function(e){return"axis"===e.type&&e.name===t&&(!r||e.orientation===r)}))},this.help=function(t){return M(null!=t?t:e)},this.class=function(t){return m(t)||"string"==typeof t||(console.warn("CSS prefix should be a string. Setting main class name to 'chrt'."),t=null),e._css="".concat(t?t.replace(/-$/,""):"").concat(t?"-":"","chrt"),e.root.classList.add(e._css),e},this.setWidth=function(t){return L.call(e,t)},this.setHeight=function(t){return L.call(e,null,t)},this.css=this.class,L.apply(this,[this.width,this.height]).svg()}function tt(t,e){return new Q(t,e)}function et(t){return function(t){if(Array.isArray(t))return rt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return rt(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return rt(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function rt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}Q.prototype=tt.prototype={data:function(t,e){if(!t)return N(this)?this._data||null:this;if(!N(this))return this;if("function"==typeof arguments[0])return this._accessor=arguments[0],this;this._orginalData=t;var r=e||this._accessor;return this._accessor=r,this._data=r?t.map((function(t,e,n){return t instanceof Object?Object.assign({},t,r(t,e,n)):r(t,e,n)})):t,this},node:function(t){return t?(t.appendChild(this.root),this.root=t,this):this.g||this.root},append:function(t){if("string"==typeof t){var e=document.createElement(t);(this.currentNode||this.root).appendChild(e),this.currentNode=e}return this},add:S,snap:S,rollup:function(){return this.currentNode.parentNode&&(this.currentNode=this.currentNode.parentNode),this},svg:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=this.root.querySelector("svg");e||((e=E("svg")).setAttribute("preserveAspectRatio","none"),this.currentNode.appendChild(e));var r=e.querySelector("g:first-of-type");return r||(r=e.appendChild(E("g"))),this.currentNode=r,t&&this.update(),this},border:function(){return this.currentNode&&(this.root.querySelector("svg").style.border="1px solid #000"),this},size:L,margins:function(t){if(m(t))return this._margins;var e=t.top,r=t.bottom,n=t.left,i=t.right;return this._margins.top=m(e)?this._margins.top:e,this._margins.bottom=m(r)?this._margins.bottom:r,this._margins.left=m(n)?this._margins.left:n,this._margins.right=m(i)?this._margins.right:i,this.update()},padding:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(m(t))return this._padding;var r=t.top,n=t.bottom,i=t.left,a=t.right;return this._padding.top=m(r)?this._padding.top:r,this._padding.bottom=m(n)?this._padding.bottom:n,this._padding.left=m(i)?this._padding.left:i,this._padding.right=m(a)?this._padding.right:a,e&&(this.originalPadding=this._padding),this.update()}};var nt=["chrt","series"];function it(t){return null===t||null==t||void 0===t}function at(){return"c"+Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}function st(t){return!it(t.type)&&nt.indexOf(t.type)>-1}function ot(t){return!isFinite(t)}function lt(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function ct(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=t._id||at();return t.id(r).parent(this),e?this.objects=[t].concat(et(this.objects)):this.objects.push(t),this}var ut=Object.freeze({__proto__:null,add:ct,create:function(t){return document.createElement(t)},createSVG:lt,getCoords:function(t){var e=this;return null!=this&&this.fields?t.map((function(t){var r=it(t[e.fields.x])||ot(t[e.fields.x])?null:e.parentNode.scales.x[e.scales.x](t[e.fields.x]),n=it(t[e.fields.y])||ot(t[e.fields.y])?null:e.parentNode.scales.y[e.scales.y](t[e.fields.y]);return[ot(r)?0:r,ot(n)?0:n]})):[]},getStrokeStyle:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4,n=null;switch(t){case"dashed":n="".concat(e*r," ").concat(e*r);break;case"dotted":n="".concat(e," ").concat(e);break;default:n=null}return n},hasData:st,isInfinity:ot,isNull:it,oppositeSigns:function(t,e){return(t^e)<0},uuid:at});function ht(t,e){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(t){return t};return it(t)?(console.warn("name missing: attr method requires a name for the attribute"),this):it(t)||void 0!==e?(this.attrs[t]="function"==typeof e?e:function(){return n(e)},this):(null===(r=this.attrs)||void 0===r?void 0:r[t])||function(){}}function dt(t){return t?(this.root=t,this.currentNode=this.root,this):this.g||this.root}function ft(t){return ht.call(this,"display",t)}function pt(t){var e=dt.call(this);if(!e)return this;var r=e.style.display;return this._display=void 0!==this._display?this._display:e.style.display,t?"none"===r&&t&&(e.style.display=this._display):e.style.display="none",this}function yt(){var t=this;this._id=null,this.objects=[],this.type="chrt-object",this.fields={x:null,y:null},this.scales={x:"x",y:"y"},this._classNames=[],this._accessor=function(t,e){return{x:!it(t)&&Object.prototype.hasOwnProperty.call(t,"x")?t.x:e,y:it(t)?null:Object.prototype.hasOwnProperty.call(t,"y")?t.y:t}},this.interpolationFunction=null,this.attrs=[],ht.call(this,"display",!0),this.id=function(e){return it(e)?t._id:(t._id=e||t._id,t.g&&t.g.setAttribute("id",t._id),t)},this.aria=function(e){return ht.call(t,"aria",e),t},this.class=function(e){if(it(e))return t._classNames;var r,n,i=(Array.isArray(e)?e:e.split(" ")).map((function(t){return t.replace(/\s\s+/g," ").trim()})).filter((function(t){return""!==t}));(t.original_classNames=t.original_classNames||t._classNames,t._classNames=et(new Set([].concat(et(t.original_classNames),et(i)))),t.g)&&((r=t.g.classList).remove.apply(r,et(t.g.classList)),(n=t.g.classList).add.apply(n,et(t._classNames)));return t},this.hasData=function(){return st(t)};var e=function(e,r){it(r)||(t.scales[e]=r)};return this.x=function(r){return it(r)?t.scales.x:(e("x",r||"x"),t)},this.y=function(r){return it(r)?t.scales.y:(e("y",r||"y"),t)},this.getObjectTypeIndex=function(){var e,r;return(null!==(e=null===(r=t.parent())||void 0===r?void 0:r.objects)&&void 0!==e?e:[]).filter((function(e){return e.constructor.name===t.constructor.name})).indexOf(t)},this}function gt(){return new yt}yt.prototype=Object.create(gt.prototype),yt.prototype=Object.assign(gt.prototype,{node:dt,data:function(t,e){if(!t)return st(this)?this._data||null:this;if(!st(this))return this;if("function"==typeof arguments[0])return this._accessor=arguments[0],this;this._orginalData=this._orginalData||t;var r=e||this._accessor;return this._accessor=r,this._data=r&&!this._accessorApplied?t.map((function(t,e,n){return t instanceof Object?Object.assign({},t,r(t,e,n)):r(t,e,n)})):t,this._accessorApplied=!0,this},add:ct,snap:ct,parent:function(t){return t?(this.parentNode=t,this):this.parentNode},render:function(t){return this.g||(this.g=lt("g"),this._id&&this.g.setAttribute("id",this._id),st(this)&&t?"stack"===t.type||"group"===t.group?t.g.prepend(this.g):t.g.append(this.g):this.currentNode.append(this.g),this.update()),this},update:function(){return this.parentNode&&this.parentNode.scales.x[this.scales.x]&&this.parentNode.scales.y[this.scales.y]&&this.draw(),this},curve:function(t){return it(t)?this.interpolationFunction:(this.interpolationFunction=t,this)},attr:ht,show:function(){return ft.call(this,!0)},hide:function(){return ft.call(this,!1)}});var vt=ut.createSVG;function bt(t,e,r){var n=this;t.forEach((function(t,i,a){var s=encodeURIComponent("tick-".concat(e,"-").concat(t.value)),o=n.g.querySelector("[data-id='".concat(s,"']"));if(!o){var l;(o=vt("g")).setAttribute("data-id",s),null!=t&&t.isMinor&&o.classList.add("tick-minor"),n.g.appendChild(o);var c=vt("line"),u=null!==(l=n.ticksColor()(t,i,a))&&void 0!==l?l:n.stroke()();c.setAttribute("stroke",u),c.setAttribute("stroke-width",n.ticksWidth()(t,i,a)),o.appendChild(c)}r&&r(o,t,i,a)}))}function mt(t){return this.attr("stroke",t)}function xt(t){return this.attr("strokeWidth",t)}function _t(t){return this.attr("ticksLength",t)}function Nt(t){return this.attr("ticksPosition",t)}function At(t){return this.attr("labelsPosition",t)}function kt(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.attr("showAxisLine",t)}var wt=ut.isNull;function Ot(t){return wt(t)?(this.ticksFilter=function(){return!0},this):"function"==typeof t?(this.ticksFilter=function(e,r,n){return t(e,r,n)},this):"boolean"==typeof t?(this.ticksFilter=function(){return t},this):Number.isFinite(t)?(this.ticksFilter=function(e){return t===e},this):Array.isArray(t)?(this.ticksFilter=function(e){return t.indexOf(e)>-1},this):this}function Mt(t){Ot.call(this,t);var e=this.ticksFilter;return this.ticksFilter=function(t,r,n){return!e(t,r,n)},this}function jt(t){return this.attr("labelFormat",t)}var St=ut.isNull;var Lt=ut.isNull;function Et(t){return Lt(t)?(this.labelsFilter=function(){return!0},this):"function"==typeof t?(this.labelsFilter=function(e,r,n){return t(e,r,n)},this):"boolean"==typeof t?(this.labelsFilter=function(){return t},this):Number.isFinite(t)?(this.labelsFilter=function(e){return t===e},this):Array.isArray(t)?(this.labelsFilter=function(e){return t.indexOf(e)>-1},this):this}function Ft(t){Et.call(this,t);var e=this.labelsFilter;return this.labelsFilter=function(t,r,n){return!e(t,r,n)},this}function Pt(t){return this.attr("labelsColor",t)}function Ct(t){return Number.isFinite(t)&&(t=[t,t]),this.attr("labelsOffset",t)}function It(t){return this.attr("labelsPadding",t)}function Tt(t){return this.attr("labelClass",t)}var Dt=1,Wt="#000",zt=5,qt="outside",Gt="outside";function Ut(t){var e=this;yt.call(this),this.type="axis",this.updater=!0,this.name=t,this.attr("stroke",Wt),this.attr("strokeWidth",Dt),this.attr("labelsColor",null),this.attr("labelsOffset",[0,0]),this.attr("labelsPadding",0),this.attr("labelsClass",null),this.attr("ticksColor",null),this.attr("ticksWidth",Dt),this.attr("ticksLength",zt),this.attr("ticksPosition",qt),this.attr("labelsPosition",Gt),this.attr("interval",null),this.attr("labelFormat",(function(t){return t})),this.attr("showAxisLine",!0),this.attr("zero",null),this.ticksFilter=null,this.labelsFilter=null,this.attr("showMinorLabels",!1),this.attr("showMinorTicks",!1),this._ticks=[],this._fixedTicks=null,this._classNames=["chrt-axis"],this.draw=function(){return e}}function Rt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Vt(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function $t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function Ht(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?$t(Object(r),!0).forEach((function(e){Vt(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):$t(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function Bt(t){return function(t){if(Array.isArray(t))return Rt(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Rt(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Rt(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}Ut.prototype=Object.create(yt.prototype),Ut.prototype.constructor=Ut,Ut.parent=yt.prototype,Ut.prototype=Object.assign(Ut.prototype,{width:xt,strokeWidth:xt,lineWidth:xt,color:mt,stroke:mt,setTickLength:_t,ticksLength:_t,tickLength:_t,setTickPosition:Nt,setLabelPosition:At,tickPosition:Nt,labelPosition:At,ticksPosition:Nt,labelsPosition:At,showAxis:kt,hideAxis:function(){return kt.call(this,!1)},ticksColor:function(t){return this.attr("ticksColor",t)},ticksWidth:function(t){return this.attr("ticksWidth",t)},ticks:function(t){return wt(t)?this._ticks:(this._fixedTicks=t,this)},filterTicks:Ot,filter:Ot,showTicks:Ot,hideTicks:Mt,firstTick:function(){return!(arguments.length>0&&void 0!==arguments[0])||arguments[0]?Ot.call(this,(function(t,e){return 0===e})):Mt.call(this,(function(t,e){return 0===e})),this},lastTick:function(){return!(arguments.length>0&&void 0!==arguments[0])||arguments[0]?Ot.call(this,(function(t,e,r){return e===r.length-1})):Mt.call(this,(function(t,e,r){return e===r.length-1})),this},firstAndLastTicks:function(){return!(arguments.length>0&&void 0!==arguments[0])||arguments[0]?Ot.call(this,(function(t,e,r){return 0===e||e===r.length-1})):Mt.call(this,(function(t,e,r){return 0===e||e===r.length-1})),this},labels:function(t){return Lt(t)?this._labels:(this._fixedLabels=t,this)},filterLabels:Et,labelsColor:Pt,labelColor:Pt,showLabels:Et,hideLabels:Ft,firstLabel:function(){return!(arguments.length>0&&void 0!==arguments[0])||arguments[0]?Et.call(this,(function(t,e){return 0===e})):Ft.call(this,(function(t,e){return 0===e})),this},lastLabel:function(){return!(arguments.length>0&&void 0!==arguments[0])||arguments[0]?Et.call(this,(function(t,e,r){return e===r.length-1})):Ft.call(this,(function(t,e,r){return e===r.length-1})),this},firstAndLastLabels:function(){return!(arguments.length>0&&void 0!==arguments[0])||arguments[0]?Et.call(this,(function(t,e,r){return 0===e||e===r.length-1})):Ft.call(this,(function(t,e,r){return 0===e||e===r.length-1})),this},labelsOffset:Ct,labelsPadding:It,labelOffset:Ct,labelPadding:It,labelsClass:Tt,labelClass:Tt,orient:function(t){return this.attr("orientation",t)},format:jt,minor:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.attr("showMinorTicks",t),this.attr("showMinorLabels",t),this},minorTicks:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.attr("showMinorTicks",t)},minorLabels:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.attr("showMinorLabels",t)},zero:function(t){return this.attr("zero",t)},label:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=Object.assign({position:"last"},e);return jt.call(this,(function(e,n,i){return St(r.value)?"last"===r.position&&n!==i.length-1||"first"===r.position&&0!==n?e:"".concat(e).concat(t):e!==r.value?e:"".concat(e).concat(t)}))},interval:function(t){return this.attr("interval",t)},title:function(t){return this.attr("title",t)}});var Yt=ut.createSVG;function Zt(t,e){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;t.forEach((function(t,a,s){var o=encodeURIComponent("label-".concat(e,"-").concat(t.value)),l=r.g.querySelector("[data-id='".concat(o,"']"));if(!l){var c,u,h;(l=Yt("g")).setAttribute("data-id",o),t.isMinor&&l.classList.add("label-minor"),r.g.appendChild(l);var d=function(t,e,r){var n,i,a=document.createElementNS("http://www.w3.org/2000/svg","foreignObject");a.setAttribute("width","".concat(e,"px")),a.setAttribute("height","100%"),a.style.overflow="visible";var s=document.createElementNS("http://www.w3.org/1999/xhtml","div");return s.style.wordWrap="number"==typeof t?"no-wrap":"break-word",s.style.maxWidth="".concat(e,"px"),s.style.width="".concat(e,"px"),s.style.padding="0 0.5em",s.style.textAlign=null!==(n=r.align)&&void 0!==n?n:"center",s.style.color=null!==(i=r.color)&&void 0!==i?i:"inherit",s.textContent=t,s.innerText=t,r.class&&s.classList.add(r.class),a.appendChild(s),a}(null===(c=r.format())||void 0===c?void 0:c(t.value,a,s),n.getTickDistance?n.getTickDistance(t,a):100,Ht(Ht({},n),{},{color:null!==(u=null!==(h=r.labelsColor()(t,a,s))&&void 0!==h?h:r.ticksColor()(t,a,s))&&void 0!==u?u:r.stroke()(),class:r.labelsClass()(t,a,s)}));l.appendChild(d)}i&&i(l,t,a,s)}))}var Xt=10,Jt={x:"bottom",y:"left"},Kt={x:"x axis",y:"y axis"},Qt=ut.isNull,te=ut.createSVG;function ee(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Xt,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"x";"string"==typeof arguments[0]&&(r=arguments[0],e=Xt),Ut.call(this,r);var n="x",i="y";this.attr("orientation",Jt[n]),this._classNames=[].concat(Bt(this._classNames),["chrt-x-axis"]),this._name="x";this.draw=function(){var r,a,s;if(!t.parentNode.scales[n][t.name])return t.parentNode;pt.call(t,t.attr("display")());var o=t.parentNode,l=o._margins,c=o.width,u=o.height,h=o.scales,d=t.attr("orientation")(),f=d===Jt[n]?1:-1,p=h[n][t.name].ticks(t._fixedTicks||2*e,t.attr("interval")());t._label&&"last"===t._label.position&&p.reverse(),t._ticks=p.map((function(e,r,i){e.position=h[n][t.name](e.value);var a=e.position>=l.left&&e.position<=c-l.right;return a=a&&(t.attr("showMinorTicks")()||!e.isMinor),e.visible=a,t.ticksFilter&&(e.visible=e.visible&&t.ticksFilter(e.value,r,i)),e.visibleLabel=a&&(t.attr("showMinorLabels")()||!e.isMinor),t.labelsFilter&&(e.visibleLabel=e.visibleLabel&&t.labelsFilter(e.value,r,i)),e})).filter((function(t){return t.visible||t.visibleLabel})),t.g.setAttribute("id","".concat(t.name,"Axis-").concat(t.id())),(r=t.g.classList).remove.apply(r,Bt(t.g.classList)),(a=t.g.classList).add.apply(a,Bt(t._classNames)),t.g.setAttribute("aria-label",null!==(s=t.ariaLabel)&&void 0!==s?s:Kt[n]),t.g.setAttribute("data-orientation",d);var y=d===Jt[n]?u-l.bottom:l.top;t.g.setAttribute("transform","translate(0,".concat(y,")"));var g=encodeURIComponent("tick-".concat(t.name,"-axis-line")),v=t.g.querySelector("line[data-id='".concat(g,"']"));v||((v=te("line")).setAttribute("data-id",g),t.g.appendChild(v)),v.setAttribute("stroke",t.stroke()()),v.setAttribute("stroke-width",t.strokeWidth()()),v.setAttribute("x1",l.left),v.setAttribute("x2",c-l.right);var b=h[i][i]||Object.values(h[i])[0],m=t.attr("zero")(),x=Qt(m)?b.domain[0]:m,_=b.isLog()?b.range[1]:b(x)-(u-l.bottom);"ordinal"!==b.transformation||!Qt(m)&&~b.domain.indexOf(x)||(_=0),v.setAttribute("y1",isNaN(_)?0:_),v.setAttribute("y2",isNaN(_)?0:_),t.attr("showAxisLine")()||v.remove();var N=t.attr("title")?t.attr("title")():null;if(!Qt(N)){var A=t.g.querySelector("text.title");Qt(A)&&(A=te("text")).classList.add("title"),A.textContent=N;var k=d===Jt[n]?-1:1,w=(5+t.strokeWidth()())*k;A.setAttribute("x",c-l.right),A.setAttribute("y",w),A.setAttribute("dy","".concat(.9*~k,"em")),A.setAttribute("text-anchor","end"),t.ariaLabel||t.g.setAttribute("aria-describedby",A.textContent),t.g.appendChild(A)}t.g.querySelectorAll("g").forEach((function(e){var r=e.getAttribute("data-id");t._ticks.find((function(e){return r==="tick-".concat(t.name,"-").concat(e)}))||e.remove()})),bt.call(t,t._ticks,t.name,(function(e,r){e.setAttribute("transform","translate(".concat(r.position,", 0)")),function(e,r,n){e.style.display=r?"block":"none";var i=e.querySelector("line"),a=t.attr("ticksLength")();i&&(i.setAttribute("x1",0),i.setAttribute("x2",0),i.setAttribute("y1",0),i.setAttribute("y2",("outside"===t.attr("ticksPosition")()?a:-a)*n))}(e,r.visible,f)}));var O="below",M=t.attr("labelsPosition")();O=f>0?"outside"===M?"below":"above":"outside"===M?"above":"below";var j=t.attr("labelsPadding")();return Zt.call(t,t._ticks,t.name,{getTickDistance:function(e,r){var n,i,a=(null===(n=t._ticks)||void 0===n?void 0:n[r+1])||(null===(i=t._ticks)||void 0===i?void 0:i[r-1]);return a?Math.abs(a.position-e.position):0}},(function(e,r,n){e.querySelector("foreignObject").setAttribute("x",r.position+t.attr("labelsOffset")(r,n)[0]),e.querySelector("foreignObject").setAttribute("y",t.attr("labelsOffset")(r,n)[1]+j*("below"===O?1:-1)),function(e,r,n){var i=e.querySelector("foreignObject > div");if(i){var a=t.attr("ticksLength")();i.style.textAlign="center",t.attr("labelsPosition")();var s="".concat("below"===n?a+1:-(a+1));i.style.transform="translate(-50%,".concat("below"===n?"".concat(s,"px"):"calc(-100% + ".concat(s,"px)"),")")}}(e,r.visibleLabel,O)})),t.objects.forEach((function(t){return t.draw()})),t}}ee.prototype=Object.create(Ut.prototype),ee.prototype.constructor=ee,ee.parent=Ut.prototype;var re=ut.isNull,ne=ut.createSVG;function ie(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Xt,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"y";"string"==typeof arguments[0]&&(r=arguments[0],e=Xt),Ut.call(this,r);var n="x",i="y";this.attr("orientation",Jt[i]),this._classNames=[].concat(Bt(this._classNames),["chrt-y-axis"]),this._name="y";this.draw=function(){var r,a,s;if(!t.parentNode.scales[i][t.name])return t.parentNode;var o=t.parentNode,l=o._margins,c=o.scales,u=o.width,h=o.height;pt.call(t,t.attr("display")());var d=t.attr("orientation")(),f=d===Jt[i]?1:-1;t.g.setAttribute("id","".concat(t.name,"Axis-").concat(t.id())),(r=t.g.classList).remove.apply(r,Bt(t.g.classList)),(a=t.g.classList).add.apply(a,Bt(t._classNames)),t.g.setAttribute("aria-label",null!==(s=t.ariaLabel)&&void 0!==s?s:Kt[i]);var p=d===Jt[i]?l.left:u-l.right;t.g.setAttribute("transform","translate(".concat(p,",0)"));var y=t.attr("interval")(),g=c[i][t.name].ticks(t._fixedTicks||2*e,y);t._label&&"last"===t._label.position&&g.reverse(),t._ticks=g.map((function(e,r,n){e.position=c[i][t.name](e.value);var a=e.position>=l.top&&e.position<=h-l.bottom;return a=a&&(t.attr("showMinorTicks")()||!e.isMinor),e.visible=a,t.ticksFilter&&(e.visible=e.visible&&t.ticksFilter(e.value,r,n)),e.visibleLabel=a&&(t.attr("showMinorLabels")()||!e.isMinor),t.labelsFilter&&(e.visibleLabel=e.visibleLabel&&t.labelsFilter(e.value,r,n)),e})).filter((function(t){return t.visible||t.visibleLabel}));var v=encodeURIComponent("tick-".concat(t.name,"-axis-line")),b=t.g.querySelector("line[data-id='".concat(v,"']"));b||((b=ne("line")).setAttribute("data-id",v),t.g.appendChild(b));var m=t.attr("labelsPosition")();b.setAttribute("stroke",t.stroke()()),b.setAttribute("stroke-width",t.strokeWidth()());var x=c[n][n]||Object.values(c[n])[0],_=t.attr("zero")(),N=re(_)?x.domain[0]:_,A=re(_)?x.range[0]:x(N)-l.left;"ordinal"!==x.transformation||!re(_)&&~x.domain.indexOf(N)||(A=0),A-=t.parentNode._padding.left,b.setAttribute("x1",isNaN(A)?0:A),b.setAttribute("x2",isNaN(A)?0:A),b.setAttribute("y1",l.top),b.setAttribute("y2",h-l.bottom),t.attr("showAxisLine")()||b.remove();var k=t.attr("title")?t.attr("title")():null;if(!re(k)){var w=t.g.querySelector("text.title");re(w)&&(w=ne("text")).classList.add("title"),w.textContent=k;var O=("outside"===m?t.tickLength()():0)*f;w.setAttribute("x",O),w.setAttribute("y",l.top),w.setAttribute("dy","outside"===m?"0.9em":"-0.9em"),w.setAttribute("dx","".concat("outside"===m?5*f:-2*f,"px")),w.setAttribute("text-anchor",~f?"start":"end"),t.ariaLabel||t.g.setAttribute("aria-describedby",w.textContent),t.g.appendChild(w)}t.g.querySelectorAll("g").forEach((function(e){var r=e.getAttribute("data-id");t._ticks.find((function(t){return r==="tick-".concat(name,"-").concat(t)}))||e.remove()})),bt.call(t,t._ticks,t.name,(function(e,r){e.setAttribute("transform","translate(0, ".concat(r.position,")")),function(e,r,n){e.style.display=r?"block":"none";var i=t.attr("ticksLength")(),a=e.querySelector("line");a&&(a.setAttribute("x1",0),a.setAttribute("x2",("outside"===t.attr("ticksPosition")()?-i:i)*n))}(e,r.visible,f)}));var M=t.attr("labelsPadding")(),j="left",S=100;return S=(S=f>0?"left"===(j="outside"===m?"left":"right")?l.left:u/2:"right"===(j="outside"===m?"right":"left")?l.right:u/2)-M-t.attr("ticksLength")(),Zt.call(t,t._ticks,t.name,{align:"left",getTickDistance:function(t,e){return S}},(function(e,r){e.querySelector("foreignObject").setAttribute("x",t.attr("labelsOffset")()[0]+M*("left"===j?-1:1)),e.querySelector("foreignObject").setAttribute("y",r.position+t.attr("labelsOffset")()[1]),function(e,r,n){t.attr("labelsPosition")();var i=t.attr("ticksLength")(),a=e.querySelector("foreignObject > div");if(a){a.style.textAlign="left"===n?"right":"left";var s="".concat("left"===n?-(i+1):i+1);a.style.transform="translate(".concat("left"===n?"calc(-100% + ".concat(s,"px)"):"".concat(s,"px"),", -50%)")}}(e,r.visibleLabel,j)})),t.objects.forEach((function(t){return t.draw()})),t}}function ae(t){return this.attr("fill",t)}ie.prototype=Object.create(Ut.prototype),ie.prototype.constructor=ie,ie.parent=Ut.prototype;var se=ut.createSVG,oe="#000",le="right",ce="top";function ue(t){var e=this;yt.call(this),this.type="axis-title",this.g=null,this.attr("fill",oe),this.attr("align",le),this.attr("valign",ce),this.attr("offset",{x:0,y:0}),this._classNames=["chrt-axis-title"];this.draw=function(){var r,n,i;return e.parentNode.parentNode.scales?(e.g||(e.g=se("g"),e.g.setAttribute("data-name","axis-title")),e.parentNode.g.querySelector("".concat(name,"AxisTitle-").concat(e.id()))||e.parentNode.g.appendChild(e.g),pt.call(e,e.attr("display")()),e.g.setAttribute("id","".concat(name,"AxisTitle-").concat(e.id())),(r=e.g.classList).remove.apply(r,Bt(e.g.classList)),(n=e.g.classList).add.apply(n,Bt(e._classNames)),e.g.setAttribute("aria-label",null!==(i=e.ariaLabel)&&void 0!==i?i:t),e.text||(e.text=se("text"),e.g.appendChild(e.text)),"x"===e.parentNode._name?function(){var r=e.attr("fill")(),n=e.parentNode.parentNode,i=n.width,a=n._margins,s=0,o="start";switch(e.attr("align")()){case"left":s=a.left,o="start";break;case"center":s=i/2,o="middle";break;default:s=i-a.right,o="end"}var l="0.25em",c=0;switch(e.attr("valign")()){case"bottom":c=0,l="1em";break;case"middle":c=0,l="0.25em";break;default:c=0,l="-1em"}var u=e.attr("offset")();e.text.textContent=t,e.text.setAttribute("text-anchor",o),e.text.setAttribute("x",s+u.x),e.text.setAttribute("y",c+u.y),e.text.setAttribute("dy",l),e.text.setAttribute("fill",r)}():function(){var r=e.attr("fill")(),n=e.parentNode.parentNode,i=n.height,a=n._margins,s=0,o="start";switch(e.attr("align")()){case"left":s=-5,o="end";break;case"center":case"middle":s=0,o="middle";break;default:s=5,o="start"}var l="0.25em",c=0;switch(e.attr("valign")()){case"bottom":c=i-a.bottom,l="0";break;case"center":case"middle":c=0,l="0.25em";break;default:c=a.top-1,l="0"}var u=e.attr("offset")();e.text.textContent=t,e.text.setAttribute("text-anchor",o),e.text.setAttribute("x",s+u.x),e.text.setAttribute("y",c+u.y),e.text.setAttribute("dy",l),e.text.setAttribute("fill",r)}(),e.parentNode):e.parentNode.parentNode}}function he(t){return new ue(t)}function de(t){return new he(t)}function fe(t){return function(t){if(Array.isArray(t))return pe(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return pe(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return pe(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function pe(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}ue.prototype=Object.create(yt.prototype),ue.prototype.constructor=ue,ue.parent=yt.prototype,ue.prototype=Object.assign(ue.prototype,{color:ae,fill:ae,align:function(t){return this.attr("align",t)},valign:function(t){return this.attr("valign",t)},offset:function(t){var e=this.attr("offset")();return this.attr("offset",Object.assign({},e||{},t))}});var ye=["chrt","series"];function ge(t){return null===t||null==t||void 0===t}function ve(){return"c"+Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}function be(t){return!ge(t.type)&&ye.indexOf(t.type)>-1}function me(t){return!isFinite(t)}function xe(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function _e(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=t._id||ve();return t.id(r).parent(this),e?this.objects=[t].concat(fe(this.objects)):this.objects.push(t),this}var Ne=Object.freeze({__proto__:null,add:_e,create:function(t){return document.createElement(t)},createSVG:xe,getCoords:function(t){var e=this;return null!=this&&this.fields?t.map((function(t){var r=ge(t[e.fields.x])||me(t[e.fields.x])?null:e.parentNode.scales.x[e.scales.x](t[e.fields.x]),n=ge(t[e.fields.y])||me(t[e.fields.y])?null:e.parentNode.scales.y[e.scales.y](t[e.fields.y]);return[me(r)?0:r,me(n)?0:n]})):[]},getStrokeStyle:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4,n=null;switch(t){case"dashed":n="".concat(e*r," ").concat(e*r);break;case"dotted":n="".concat(e," ").concat(e);break;default:n=null}return n},hasData:be,isInfinity:me,isNull:ge,oppositeSigns:function(t,e){return(t^e)<0},uuid:ve});function Ae(t,e){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(t){return t};return ge(t)?(console.warn("name missing: attr method requires a name for the attribute"),this):ge(t)||void 0!==e?(this.attrs[t]="function"==typeof e?e:function(){return n(e)},this):(null===(r=this.attrs)||void 0===r?void 0:r[t])||function(){}}function ke(t){return t?(this.root=t,this.currentNode=this.root,this):this.g||this.root}function we(t){return Ae.call(this,"display",t)}function Oe(t){var e=ke.call(this);if(!e)return this;var r=e.style.display;return this._display=void 0!==this._display?this._display:e.style.display,t?"none"===r&&t&&(e.style.display=this._display):e.style.display="none",this}function Me(){var t=this;this._id=null,this.objects=[],this.type="chrt-object",this.fields={x:null,y:null},this.scales={x:"x",y:"y"},this._classNames=[],this._accessor=function(t,e){return{x:!ge(t)&&Object.prototype.hasOwnProperty.call(t,"x")?t.x:e,y:ge(t)?null:Object.prototype.hasOwnProperty.call(t,"y")?t.y:t}},this.interpolationFunction=null,this.attrs=[],Ae.call(this,"display",!0),this.id=function(e){return ge(e)?t._id:(t._id=e||t._id,t.g&&t.g.setAttribute("id",t._id),t)},this.aria=function(e){return Ae.call(t,"aria",e),t},this.class=function(e){if(ge(e))return t._classNames;var r,n,i=(Array.isArray(e)?e:e.split(" ")).map((function(t){return t.replace(/\s\s+/g," ").trim()})).filter((function(t){return""!==t}));(t.original_classNames=t.original_classNames||t._classNames,t._classNames=fe(new Set([].concat(fe(t.original_classNames),fe(i)))),t.g)&&((r=t.g.classList).remove.apply(r,fe(t.g.classList)),(n=t.g.classList).add.apply(n,fe(t._classNames)));return t},this.hasData=function(){return be(t)};var e=function(e,r){ge(r)||(t.scales[e]=r)};return this.x=function(r){return ge(r)?t.scales.x:(e("x",r||"x"),t)},this.y=function(r){return ge(r)?t.scales.y:(e("y",r||"y"),t)},this.getObjectTypeIndex=function(){var e,r;return(null!==(e=null===(r=t.parent())||void 0===r?void 0:r.objects)&&void 0!==e?e:[]).filter((function(e){return e.constructor.name===t.constructor.name})).indexOf(t)},this}function je(){return new Me}function Se(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Le(t){return function(t){if(Array.isArray(t))return Se(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Se(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Se(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}Me.prototype=Object.create(je.prototype),Me.prototype=Object.assign(je.prototype,{node:ke,data:function(t,e){if(!t)return be(this)?this._data||null:this;if(!be(this))return this;if("function"==typeof arguments[0])return this._accessor=arguments[0],this;this._orginalData=this._orginalData||t;var r=e||this._accessor;return this._accessor=r,this._data=r&&!this._accessorApplied?t.map((function(t,e,n){return t instanceof Object?Object.assign({},t,r(t,e,n)):r(t,e,n)})):t,this._accessorApplied=!0,this},add:_e,snap:_e,parent:function(t){return t?(this.parentNode=t,this):this.parentNode},render:function(t){return this.g||(this.g=xe("g"),this._id&&this.g.setAttribute("id",this._id),be(this)&&t?"stack"===t.type||"group"===t.group?t.g.prepend(this.g):t.g.append(this.g):this.currentNode.append(this.g),this.update()),this},update:function(){return this.parentNode&&this.parentNode.scales.x[this.scales.x]&&this.parentNode.scales.y[this.scales.y]&&this.draw(),this},curve:function(t){return ge(t)?this.interpolationFunction:(this.interpolationFunction=t,this)},attr:Ae,show:function(){return we.call(this,!0)},hide:function(){return we.call(this,!1)}});var Ee=10;function Fe(t){return this.attr("strokeStyle",t)}var Pe=Ne.isNull;function Ce(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._filter=t,"function"==typeof t?(this.ticksFilter=function(e,r,n){return t(e,r,n)},this):"boolean"==typeof t?(this.ticksFilter=function(){return t},this):Number.isFinite(t)?(this.ticksFilter=function(e){return t===e},this):Array.isArray(t)?(this.ticksFilter=function(e){return t.indexOf(e)>-1},this):this}function Ie(t){Ce.call(this,t);var e=this.ticksFilter;return this.ticksFilter=function(t,r,n){return!e(t,r,n)},this}var Te=Ne.isNull,De=Ne.getStrokeStyle,We=Ne.createSVG,ze=1,qe="#000";function Ge(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ee,n=arguments.length>2?arguments[2]:void 0;Me.call(this),this.type="grid",this.name=n||t,this.attr("stroke",qe),this.attr("strokeWidth",ze),this.attr("strokeStyle",null),this._classNames=["chrt-grid","x"===t?"vertical-grid":"horizontal-grid"],this.showMinorTicks=!1,this.ticksFilter=null,this._interval=null;this.draw=function(){var n,i;if(e.parentNode.scales[t][e.name]){Oe.call(e,e.attr("display")());var a=e.parentNode.scales[t][e.name],s=e.parentNode,o=s._margins,l=s.width,c=s.height,u=a.isLog(),h=e._interval,d=e.parentNode.getAxis(t);d&&(h=d.interval()());var f=a.ticks(e._fixedTicks||2*r,h).map((function(r,n,i){r.position=a(r.value);var s=r.position>=o.top&&r.position<=c-o.bottom;return"x"===t&&(s=r.position>=o.left&&r.position<=l-o.right),s=(s=s&&(e.showMinorTicks||r.isZero&&e.showZero||!r.isMinor))&&(!u||u&&!r.isMinor),e.ticksFilter&&(s=s&&e.ticksFilter(r.value,n,i)),r.visible=s,r}));return e.g.setAttribute("id","".concat(t,"Grid-").concat(e.id())),(n=e.g.classList).remove.apply(n,Le(e.g.classList)),(i=e.g.classList).add.apply(i,Le(e._classNames)),e.g.querySelectorAll("line").forEach((function(t){return t.setAttribute("toBeHidden",!0)})),f.forEach((function(r,n,i){var s=escape("gridLine-".concat(t,"-").concat(r.value)),u=e.g.querySelector("[data-id='".concat(s,"']"));u||((u=We("line")).setAttribute("data-id",s),r.isMinor&&u.classList.add("tick-minor"),e.g.appendChild(u)),u.setAttribute("stroke",e.attr("stroke")(r,n,i));var h=Math.max(e.attr("strokeWidth")(r,n,i),0);u.setAttribute("stroke-width",h),u.setAttribute("shape-rendering","crispEdges");var d=e.attr("strokeStyle")(r,n,i);Te(d)||u.setAttribute("stroke-dasharray",De(d,h)),u.removeAttribute("toBeHidden");var f=a(r.value);"x"===t&&function(t,e,r,n){var i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];t.style.display=i?"block":"none",t.setAttribute("x1",e),t.setAttribute("x2",e),t.setAttribute("y1",r),t.setAttribute("y2",n)}(u,f,c-o.bottom,o.top,r.visible),"y"===t&&function(t,e,r,n){var i=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];t.style.display=i?"block":"none",t.setAttribute("x1",r),t.setAttribute("x2",n),t.setAttribute("y1",e),t.setAttribute("y2",e)}(u,f,o.left,l-o.right,r.visible)})),e.g.querySelectorAll("line[toBeHidden=true]").forEach((function(t){return t.remove()})),e.parentNode}},this.solid=function(){return Fe.call(e,"solid")},this.dashed=function(){return Fe.call(e,"dashed")},this.dotted=function(){return Fe.call(e,"dotted")}}function Ue(t,e){return new Ge(t,e)}function Re(t){return function(t){if(Array.isArray(t))return Ve(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Ve(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ve(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ve(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}Ge.prototype=Object.create(Me.prototype),Ge.prototype.constructor=Ge,Ge.parent=Me.prototype,Ge.prototype=Object.assign(Ge.prototype,{width:function(t){return this.attr("strokeWidth",t)},color:function(t){return this.attr("stroke",t)},minor:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return"function"==typeof t||(this.showMinorTicks=t),this},ticks:function(t){return Pe(t)?this._ticks:(this._fixedTicks=t,this)},firstTick:function(){return!(arguments.length>0&&void 0!==arguments[0])||arguments[0]?Ce.call(this,(function(t,e){return 0===e})):Ie.call(this,(function(t,e){return 0===e})),this},lastTick:function(){return!(arguments.length>0&&void 0!==arguments[0])||arguments[0]?Ce.call(this,(function(t,e,r){return e===r.length-1})):Ie.call(this,(function(t,e,r){return e===r.length-1})),this},filter:Ce,showTicks:Ce,hideTicks:Ie,firstAndLastTicks:function(){return!(arguments.length>0&&void 0!==arguments[0])||arguments[0]?Ce.call(this,(function(t,e,r){return 0===e||e===r.length-1})):Ie.call(this,(function(t,e,r){return 0===e||e===r.length-1})),this}});var $e=["chrt","series"];function He(t){return null===t||null==t||void 0===t}function Be(){return"c"+Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}function Ye(t){return!He(t.type)&&$e.indexOf(t.type)>-1}function Ze(t){return!isFinite(t)}function Xe(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Je(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=t._id||Be();return t.id(r).parent(this),e?this.objects=[t].concat(Re(this.objects)):this.objects.push(t),this}var Ke=Object.freeze({__proto__:null,add:Je,isNull:He,uuid:Be,hasData:Ye,isInfinity:Ze,oppositeSigns:function(t,e){return(t^e)<0},getCoords:function(t){var e=this;return null!=this&&this.fields?t.map((function(t){var r=He(t[e.fields.x])||Ze(t[e.fields.x])?null:e.parentNode.scales.x[e.scales.x](t[e.fields.x]),n=He(t[e.fields.y])||Ze(t[e.fields.y])?null:e.parentNode.scales.y[e.scales.y](t[e.fields.y]);return[Ze(r)?0:r,Ze(n)?0:n]})):[]},create:function(t){return document.createElement(t)},createSVG:Xe,getStrokeStyle:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4,n=null;switch(t){case"dashed":n="".concat(e*r," ").concat(e*r);break;case"dotted":n="".concat(e," ").concat(e);break;default:n=null}return n}});function Qe(t,e){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(t){return t};return He(t)?(console.warn("name missing: attr method requires a name for the attribute"),this):He(t)||void 0!==e?(this.attrs[t]="function"==typeof e?e:function(){return n(e)},this):(null===(r=this.attrs)||void 0===r?void 0:r[t])||function(){}}function tr(t){return t?(this.root=t,this.currentNode=this.root,this):this.g||this.root}function er(t){return Qe.call(this,"display",t)}function rr(t){var e=tr.call(this);if(!e)return this;var r=e.style.display;return this._display=void 0!==this._display?this._display:e.style.display,t?"none"===r&&t&&(e.style.display=this._display):e.style.display="none",this}function nr(){var t=this;this._id=null,this.objects=[],this.type="chrt-object",this.fields={x:null,y:null},this.scales={x:"x",y:"y"},this._classNames=[],this._accessor=function(t,e){return{x:!He(t)&&Object.prototype.hasOwnProperty.call(t,"x")?t.x:e,y:He(t)?null:Object.prototype.hasOwnProperty.call(t,"y")?t.y:t}},this.interpolationFunction=null,this.attrs=[],Qe.call(this,"display",!0),this.id=function(e){return He(e)?t._id:(t._id=e||t._id,t.g&&t.g.setAttribute("id",t._id),t)},this.aria=function(e){return He(e)?t.ariaLabel:(t.ariaLabel=e||t.ariaLabel,t.g&&t.ariaLabel&&t.g.setAttribute("aria-label",t.ariaLabel),t)},this.class=function(e){if(He(e))return t._classNames;var r,n,i=(Array.isArray(e)?e:e.split(" ")).map((function(t){return t.replace(/\s\s+/g," ").trim()})).filter((function(t){return""!==t}));(t.original_classNames=t.original_classNames||t._classNames,t._classNames=Re(new Set([].concat(Re(t.original_classNames),Re(i)))),t.g)&&((r=t.g.classList).remove.apply(r,Re(t.g.classList)),(n=t.g.classList).add.apply(n,Re(t._classNames)));return t},this.hasData=function(){return Ye(t)};var e=function(e,r){He(r)||(t.scales[e]=r)};return this.x=function(r){return He(r)?t.scales.x:(e("x",r||"x"),t)},this.y=function(r){return He(r)?t.scales.y:(e("y",r||"y"),t)},this}function ir(){return new nr}function ar(t){return function(t){if(Array.isArray(t))return sr(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return sr(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return sr(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function sr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function or(t){return null===t||null==t||void 0===t}function lr(t){return"number"==typeof t&&!isFinite(t)}function cr(t){var e=this;return null!=this&&this.fields?t.map((function(t){var r=or(t[e.fields.x])||lr(t[e.fields.x])?null:e.parentNode.scales.x[e.scales.x](t[e.fields.x]),n=or(t[e.fields.y])||lr(t[e.fields.y])?null:e.parentNode.scales.y[e.scales.y](t[e.fields.y]);return[lr(r)?0:r,lr(n)?0:n]})):[]}nr.prototype=Object.create(ir.prototype),nr.prototype=Object.assign(ir.prototype,{node:tr,data:function(t,e){if(!t)return Ye(this)?this._data||null:this;if(!Ye(this))return this;if("function"==typeof arguments[0])return this._accessor=arguments[0],this;this._orginalData=this._orginalData||t;var r=e||this._accessor;return this._accessor=r,this._data=r&&!this._accessorApplied?t.map((function(t,e,n){return t instanceof Object?Object.assign({},t,r(t,e,n)):r(t,e,n)})):t,this._accessorApplied=!0,this},add:Je,snap:Je,parent:function(t){return t?(this.parentNode=t,this):this.parentNode},render:function(t){return this.g||(this.g=Xe("g"),this._id&&this.g.setAttribute("id",this._id),Ye(this)&&t?"stack"===t.type||"group"===t.group?t.g.prepend(this.g):t.g.append(this.g):this.currentNode.append(this.g),this.update()),this},update:function(){return this.parentNode&&this.parentNode.scales.x[this.scales.x]&&this.parentNode.scales.y[this.scales.y]&&this.draw(),this},curve:function(t){return He(t)?this.interpolationFunction:(this.interpolationFunction=t,this)},attr:Qe,show:function(){return er.call(this,!0)},hide:function(){return er.call(this,!1)}});var ur=function(t,e){var r,n=t.reduce((function(t,e){return or(e[1])?t.push([]):t[t.length-1].push(e),t}),[[]]).map((function(t){return t.reduce((function(t,r,n,i){return t.push(0===n?"M".concat(isNaN(r[0])?0:r[0],",").concat(isNaN(r[1])?0:r[1]):"".concat(e(r,n,i))),t}),[])}));return(r=[]).concat.apply(r,ar(n))};function hr(t){return ur(cr.call(this,t),dr)}var dr=function(t){return"L".concat(isNaN(t[0])?0:t[0],",").concat(isNaN(t[1])?0:t[1])};function fr(t,e,r){return(e=function(t){var e=function(t,e){if("object"!=typeof t||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function pr(t){return function(t){if(Array.isArray(t))return yr(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return yr(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return yr(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function yr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function gr(t){return this.attr("strokeWidth",t)}function vr(t){return this.attr("stroke",t)}function br(t){return this.attr("strokeOpacity",t)}var mr=Ke.isNull,xr=Ke.createSVG,_r=1,Nr="#000",Ar=1,kr="#000",wr=1;function Or(){var t=this;nr.call(this),this.type="series",this.attr("area",!1),this._stacked=null,this.attr("sortedData",!0);var e="x",r="y",n="x0",i="y0";this.interpolationFunction=hr,this.attr("strokeWidth",_r),this.attr("stroke",Nr),this.attr("strokeOpacity",Ar),this.attr("fill",kr),this.attr("fillOpacity",wr),this.paths=[],this.areaPaths=[],this._classNames=["chrt-line"],this.draw=function(){var a,s,o=t._data.length?t._data:t.parentNode._data,l=t.attr("area")();if(rr.call(t,t.attr("display")()),(a=t.g.classList).remove.apply(a,pr(t.g.classList)),(s=t.g.classList).add.apply(s,pr(t._classNames)),mr(t.fields[e])&&(t.fields[e]=t.parentNode.scales[e][t.scales[e]].field),mr(t.fields[r])&&(t.fields[r]=t.parentNode.scales[r][t.scales[r]].field),mr(t.fields[i])&&(t.fields[i]="".concat(t.parentNode.scales[r][t.scales[r]].field,"0")),!mr(o)){var c,u=t.parentNode.scales[r][t.scales[r]].domain,h=t.parentNode.scales[e][t.scales[e]].domain,d=0;switch(l){case"left":d=h[0]<0||h[1]<0?0:Math.min.apply(Math,pr(h));break;case"right":d=h[0]<0||h[1]<0?0:Math.max.apply(Math,pr(h));break;case"top":d=u[0]<0||u[1]<0?0:Math.max.apply(Math,pr(u));break;default:d=u[0]<0||u[1]<0?0:Math.min.apply(Math,pr(u))}d=null!==(c=t.attr("zero")())&&void 0!==c?c:d,t.hasCustomBaseline=l&&o.some((function(e){return!mr(e[t.fields[i]])}));var f=t.parentNode.scales[r][t.scales[r]],p=o.reduce((function(n,a){var s;if(mr(a)||mr(a[t.fields[r]])||isNaN(f(a[t.fields[r]])))return n.push([]),n;n.length||n.push([]);var o=t._stacked||t.hasCustomBaseline?(fr(s={},t.fields[e],a[t.fields[e]]),fr(s,t.fields[r],a[t.fields[r]]),fr(s,"x",a[t.fields[e]]),fr(s,"y",a["".concat(t._stacked?"stacked_":"").concat(t.fields[r])]),fr(s,"y0",mr(a["".concat(t._stacked?"stacked_":"").concat(t.fields[i])])?d:a["".concat(t._stacked?"stacked_":"").concat(t.fields[i])]),s):a;return n[n.length-1].push(o),n}),[]);if(t.attr("sortedData")()){var y=t.parentNode.scales[e][t.scales[e]];p.forEach((function(r){r.sort((function(r,n){return"ordinal"===y.transformation?1*(y.domain.indexOf(r[t.fields[e]])-y.domain.indexOf(n[t.fields[e]])):1*(r[t.fields[e]]-n[t.fields[e]])}))}))}var g=p.filter((function(t){return 1===t.length}));(p=p.filter((function(t){return t.length>1}))).forEach((function(e,r){t.paths[r]||(t.paths[r]=xr("path"),t.paths[r].setAttribute("data-id","path-".concat(r)),t.g.appendChild(t.paths[r])),l&&!t.areaPaths[r]&&(t.areaPaths[r]=xr("path"),t.areaPaths[r].setAttribute("data-id","area-path-".concat(r)),t.g.appendChild(t.areaPaths[r]))}));var v=[];if(l){var b=["left","right"].indexOf(l)>-1;p.forEach((function(a){var s,o,l,c,u=t._stacked||t.hasCustomBaseline?pr(a).reverse().map((function(a){var s,o;return b?(fr(s={x:a[t.fields[n]],y:a[t.fields[r]]},t.fields[n],a["".concat(t._stacked?"stacked_":"").concat(t.fields[n])]),fr(s,t.fields[r],a[t.fields[r]]),s):(fr(o={x:a[t.fields[e]],y:a[t.fields[i]]},t.fields[e],a[t.fields[e]]),fr(o,t.fields[i],a["".concat(t._stacked?"stacked_":"").concat(t.fields[i])]),o)})):[b?(s={x:d,y:a[a.length-1][t.fields[r]]},fr(s,t.fields[e],d),fr(s,t.fields[r],a[a.length-1][t.fields[r]]),s):(o={x:a[a.length-1][t.fields[e]],y:d},fr(o,t.fields[e],a[a.length-1][t.fields[e]]),fr(o,t.fields[r],d),o),b?(l={x:d,y:a[0][t.fields[r]]},fr(l,t.fields[e],d),fr(l,t.fields[r],a[0][t.fields[r]]),l):(c={x:a[0][t.fields[e]],y:d},fr(c,t.fields[e],a[0][t.fields[e]]),fr(c,t.fields[r],d),c)];v.push(u)}))}l&&t.areaPaths.length>0&&v.forEach((function(e,r){var n,i=t.areaPaths[r],a=[t.interpolationFunction([].concat(p[r])),t.interpolationFunction([].concat(e))];a[1][0]=(null==a||null===(n=a[1])||void 0===n?void 0:n[0].replace(/M/,"L"))||[],i.setAttribute("d",[].concat(pr(a[0]),pr(a[1])).join("")),i.setAttribute("fill",t.attr("fill")()),i.setAttribute("fill-opacity",t.attr("fillOpacity")()),i.setAttribute("stroke","none")})),p.forEach((function(e,r){var n=t.interpolationFunction([].concat(e)),i=t.paths[r];i.setAttribute("d",n.join("")),i.setAttribute("stroke",t.attr("stroke")()),i.setAttribute("stroke-width",t.attr("strokeWidth")()),i.setAttribute("stroke-opacity",t.attr("strokeOpacity")()),i.setAttribute("stroke-linejoin","round"),i.setAttribute("fill","none")})),g.forEach((function(n){var i=n.filter((function(e,n,i){return(mr(i[n-1])||mr(i[n-1][t.fields[r]]))&&!mr(e[t.fields[r]])&&(mr(i[n+1])||mr(i[n+1][t.fields[r]]))}));t.points||(t.points=[],t.g.querySelectorAll("circle").forEach((function(t){return t.remove()})),i.forEach((function(e){var r=xr("circle");t.points.push({circle:r,point:e}),t.g.appendChild(r)}))),t.points.forEach((function(n){var i=t.parentNode.scales[e][t.scales[e]](n.point[t.fields[e]]);isNaN(i)||n.circle.setAttribute("cx",i);var a=t.parentNode.scales[r][t.scales[r]](n.point[t.fields[r]]);isNaN(a)||n.circle.setAttribute("cy",a),n.circle.setAttribute("fill",t.attr("stroke")()),n.circle.setAttribute("r",t.attr("strokeWidth")())}))})),o.filter((function(t){return t})).forEach((function(n){var i=t.parentNode.scales[e][t.scales[e]](t._stacked?n["stacked_".concat(t.fields[e])]:null==n?void 0:n[t.fields[e]]),a=t.parentNode.scales[r][t.scales[r]](t._stacked?n["stacked_".concat(t.fields[r])]:null==n?void 0:n[t.fields[r]]);n.anchorPoints={x:i,width:0,y:a,height:0,relativePosition:[0,-1],directions:{x:1,y:1},alignment:{horizontal:"middle",vertical:"top"}}})),(t.paths.length||t.areaPaths.length)&&t.objects.forEach((function(t){return t.draw()}))}return t}}function Mr(){return new Or}function jr(t){return function(t){if(Array.isArray(t))return Sr(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Sr(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Sr(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Sr(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Lr(t){return this.attr("strokeWidth",t)}function Er(t){return this.attr("stroke",t)}function Fr(t){return this.attr("fill",t)}function Pr(t){return this.attr("fillOpacity",t)}function Cr(t){return this.attr("strokeOpacity",t)}function Ir(t){return this.attr("barRatioWidth",t,(function(t){return Math.max(0,Math.min(t,1))}))}function Tr(t){return this.attr("inset",t,(function(t){return Math.max(0,t)}))}function Dr(t){return this.attr("binwidth",t,(function(t){return Math.max(0,t)}))}Or.prototype=Object.create(nr.prototype),Or.prototype.constructor=Or,Or.parent=nr.prototype,Or.prototype=Object.assign(Or.prototype,{width:gr,strokeWidth:gr,color:vr,stroke:vr,opacity:br,strokeOpacity:br,area:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom";return this.attr("area",t)},fill:function(t){return this.attr("fill",t)},fillOpacity:function(t){return this.attr("fillOpacity",t)},zero:function(t){return this.attr("zero",t)},sort:function(t){return this.attr("sortedData",t)}});var Wr=0,zr="#000",qr="#ddd",Gr=1,Ur=1,Rr=3,Vr=1,$r=1,Hr=1,Br=Ke.isNull,Yr=Ke.isInfinity,Zr=Ke.createSVG;function Xr(){var t=this;nr.call(this),this.type="series",this._stacked=null,this._grouped=1,this._groupIndex=0;var e=Rr;this.attr("barRatioWidth",Vr),this.attr("inset",$r),this.attr("stroke",zr),this.attr("fill",qr),this.attr("fillOpacity",Ur),this.attr("strokeWidth",Wr),this.attr("strokeOpacity",Gr),this._classNames=["chrt-bars"],this.getXScale=function(){var e,r;Br(t.fields.x)&&(t.fields.x=null===(r=t.parentNode)||void 0===r?void 0:r.scales.x[t.scales.x].field);return null===(e=t.parentNode)||void 0===e?void 0:e.scales.x[t.scales.x]},this.barWidth=function(){return e},this.draw=function(){var r,n;if(!t.parentNode)return t;var i=t.parentNode,a=i._margins,s=i.scales;rr.call(t,t.attr("display")()),(r=t.g.classList).remove.apply(r,jr(t.g.classList)),(n=t.g.classList).add.apply(n,jr(t._classNames)),t.g.setAttribute("aria-label",t.attr("aria")()),Br(t.fields.y)&&(t.fields.y=s.y[t.scales.y].field),Br(t.fields.x)&&(t.fields.x=s.x[t.scales.x].field),Br(t.fields.x0)&&(t.fields.x0="".concat(s.x[t.scales.x].field,"0"));var o=s.x[t.scales.x],l=s.y[t.scales.y],c=t._data.length?t._data:t.parentNode._data;if(!Br(c)){var u=t.parentNode.padding(),h=Math.abs(l.range[1]-l.range[0])-(a.top+a.bottom);if("ordinal"===l.transformation)e=h/(c.length||1);else{var d=Math.max(l.ticks().length,c.length);e=h/(l.ticks(d).filter((function(t){return!l.isLog()||!t.isMinor})).length-1||1)}var f=(e*=function(){return c.reduce((function(r,n,i,a){if(n&&a[i+1]){var s=l(n[t.fields.y]),o=l(a[i+1][t.fields.y]);r=Math.abs(o-s)/e}return Math.min(1,r)}),1)}.call(t))||Hr;(isNaN(f)||Yr(f))&&(f=Hr),f*=t._group?t._group.width():1;var p=t._stacked?t._stacked._grouped:t._grouped||t._grouped,y=t._stacked?t._stacked._groupIndex:t._groupIndex||t._groupIndex;e=f/p;var g=f/p*y+f/p/2-f/2;t.g.setAttribute("transform","translate(0, ".concat(g,")"));var v=t.parentNode.getAxis("y"),b=v?v.width()():0;if(c.length&&l.barwidth>0){var m,x,_=Math.abs(l.range[1]-l.range[0])-(a.top+a.bottom),N="ordinal"===l.transformation?_/c.length:_/l.ticks().length,A=l.range[1]-e/2;if(!t.parentNode.originalPadding&&"ordinal"!==l.transformation&&(A<(null!==(m=null==u?void 0:u.bottom)&&void 0!==m?m:0)||A>(null!==(x=null==u?void 0:u.top)&&void 0!==x?x:0))){var k=t.parentNode.padding(),w=Object.assign({},k,{bottom:N/2+k.bottom,top:N/2+k.top});return t.parentNode.padding(w,!0)}}var O=t.g.childElementCount-t._data.length;O>0&&Array.from({length:O},(function(e,r){return r+t._data.length})).forEach((function(e){var r=escape("rect-".concat(name,"-").concat(e));t.g.querySelector("[data-id='".concat(r,"']")).remove()})),c.forEach((function(r,n,i){var s=escape("rect-".concat(name,"-").concat(n)),c=t.g.querySelector("[data-id='".concat(s,"']"));c||((c=Zr("rect")).setAttribute("data-id",s),c.setAttribute("shape-rendering","crispEdges"),c.setAttribute("role","graphics-symbol"),c.setAttribute("aria-roledescription","bar"),c.setAttribute("tabindex",0),t.g.appendChild(c));var u=t.attr("aria")(r,n,i);u&&c.setAttribute("aria-label",u);var h=l(r[t.fields.y]);if(!isNaN(h)){var d=o(r[t._stacked?"stacked_".concat(t.fields.x):t.fields.x]),f=Br(r[t._stacked?"stacked_".concat(t.fields.x,"0"):t.fields.x0])?null:o.isLog()?o.range[0]+a.left:o(r[t._stacked?"stacked_".concat(t.fields.x,"0"):t.fields.x0]);Br(f)&&(f=o.isLog()?o.range[0]+a.left:o(o.domain[0]||0),(o.domain[0]||0)*(o.domain[1]||0)<0&&(f=o.isLog()?o.range[0]+a.left:o(0)));var p=isNaN(d)?0:Math.max(Math.abs(d-f),Math.abs(d-f)-b/2),y=d>f?f:d;void 0!==t.binwidth()()&&(e=Math.abs(l(r[t.fields.y]+t.binwidth()(r,n,i))-l(r[t.fields.y])));var g=t.attr("strokeWidth")(r,n,i),v={};v.x=(isNaN(y)||Yr(y)?o.range[0]:y)+.5*g,v.directions={x:d>f?1:0,y:1},v.y=h-e/2+e/2*(1-t.attr("barRatioWidth")(r,n,i))+.5*g+.5*t.attr("inset")(r,n,i),v.width=Math.max(0,p-g),v.height=Math.max(0,e*t.attr("barRatioWidth")(r,n,i)-g-t.attr("inset")(r,n,i)),v.left=v.x,v.top=v.y,v.right=v.x+v.width,v.bottom=v.y+v.height,v.relativePosition=[1,.5],r.anchorPoints=v,c.setAttribute("x",v.x),c.setAttribute("y",v.y),c.setAttribute("width",v.width),c.setAttribute("height",v.height),c.setAttribute("fill",t.attr("fill")(r,n,i)),c.setAttribute("fill-opacity",t.attr("fillOpacity")(r,n,i)),c.setAttribute("stroke",t.attr("stroke")(r,n,i)),c.setAttribute("stroke-width",g),c.setAttribute("stroke-opacity",t.attr("strokeOpacity")(r,n,i))}}))}return t.objects.forEach((function(t){return t.draw()})),t}}function Jr(){return new Xr}Xr.prototype=Object.create(nr.prototype),Xr.prototype.constructor=Xr,Xr.parent=nr.prototype,Xr.prototype=Object.assign(Xr.prototype,{width:Ir,inset:Tr,strokeWidth:Lr,color:Er,stroke:Er,fill:Fr,fillOpacity:Pr,strokeOpacity:Cr,binwidth:Dr});var Kr=Ke.isNull,Qr=Ke.isInfinity,tn=Ke.createSVG;function en(){var t=this;nr.call(this),this.type="series",this._stacked=null,this._grouped=1,this._groupIndex=0;var e=Rr;this.attr("barRatioWidth",Vr),this.attr("inset",$r),this.attr("stroke",zr),this.attr("fill",qr),this.attr("fillOpacity",Ur),this.attr("strokeWidth",Wr),this.attr("strokeOpacity",Gr),this._classNames=["chrt-columns"],this.getXScale=function(){var e,r;Kr(t.fields.x)&&(t.fields.x=null===(r=t.parentNode)||void 0===r?void 0:r.scales.x[t.scales.x].field);return null===(e=t.parentNode)||void 0===e?void 0:e.scales.x[t.scales.x]},this.draw=function(){var r,n;if(!t.parentNode)return t;var i=t.parentNode,a=i._margins,s=i.scales;rr.call(t,t.attr("display")()),(r=t.g.classList).remove.apply(r,jr(t.g.classList)),(n=t.g.classList).add.apply(n,jr(t._classNames)),Kr(t.fields.x)&&(t.fields.x=s.x[t.scales.x].field),Kr(t.fields.y)&&(t.fields.y=s.y[t.scales.y].field),Kr(t.fields.y0)&&(t.fields.y0="".concat(s.y[t.scales.y].field,"0"));var o=s.x[t.scales.x],l=s.y[t.scales.y],c=t._data.length?t._data:t.parentNode._data;if(!Kr(c)){var u=t.parentNode.padding(),h=Math.abs(o.range[1]-o.range[0])-(a.left+a.right);if("ordinal"===o.transformation)e=h/(c.length||1);else{var d=Math.max(o.ticks().length,c.length);e=h/(o.ticks(d).filter((function(t){return!o.isLog()||!t.isMinor})).length-1||1)}var f=(e*=function(){return c.reduce((function(r,n,i,a){if(n&&a[i+1]){var s=o(n[t.fields.x]),l=o(a[i+1][t.fields.x]);r=Math.abs(l-s)/e}return Math.min(1,r)}),1)}.call(t))||Hr;(isNaN(f)||Qr(f))&&(f=Hr),f*=t._group?t._group.width():1;var p=t._stacked?t._stacked._grouped:t._grouped||t._grouped,y=t._stacked?t._stacked._groupIndex:t._groupIndex||t._groupIndex;e=f/p;var g=f/p*y+f/p/2-f/2;t.g.setAttribute("transform","translate(".concat(g,", 0)"));var v=t.parentNode.getAxis("x"),b=v?v.lineWidth()():0;if(c.length&&o.barwidth>0){var m,x,_=o.range[1]-o.range[0]-(a.left+a.right),N="ordinal"===o.transformation?_/c.length:_/o.ticks().length,A=o.range[0]-e/2;if(!t.parentNode.originalPadding&&"ordinal"!==o.transformation&&(A<(null!==(m=null==u?void 0:u.left)&&void 0!==m?m:0)||A>(null!==(x=null==u?void 0:u.right)&&void 0!==x?x:0))){var k=t.parentNode.padding(),w=Object.assign({},k,{left:N/2+k.left,right:N/2+k.right});return t.parentNode.padding(w,!0)}}var O=t.g.childElementCount-t._data.length;O>0&&Array.from({length:O},(function(e,r){return r+t._data.length})).forEach((function(e){var r=escape("rect-".concat(name,"-").concat(e));t.g.querySelector("[data-id='".concat(r,"']")).remove()})),c.forEach((function(r,n,i){var s=escape("rect-".concat(name,"-").concat(n)),c=t.g.querySelector("[data-id='".concat(s,"']"));c||((c=tn("rect")).setAttribute("data-id",s),c.setAttribute("shape-rendering","crispEdges"),t.g.appendChild(c));var u=o(r[t.fields.x]);if(!isNaN(u)){var h=l(r[t._stacked?"stacked_".concat(t.fields.y):t.fields.y]),d=Kr(r[t._stacked?"stacked_".concat(t.fields.y,"0"):t.fields.y0])?null:l(r[t._stacked?"stacked_".concat(t.fields.y,"0"):t.fields.y0]);Kr(d)&&(d=l.isLog()?l.range[0]-a.bottom:l(l.domain[0]||0),(l.domain[0]||0)*(l.domain[1]||0)<0&&(d=l.isLog()?l.range[0]-a.bottom:l(0)));var f=isNaN(h)?0:Math.max(Math.abs(h-d),Math.abs(h-d)-b/2),p=h>d?d:h;void 0!==t.binwidth()()&&(e=Math.abs(o(r[t.fields.x]+t.binwidth()(r,n,i))-o(r[t.fields.x])));var y=t.attr("strokeWidth")(r,n,i),g={};g.x=u-e/2+e/2*(1-t.attr("barRatioWidth")(r,n,i))+.5*y+t.attr("inset")(r,n,i)/2,g.y=(isNaN(p)||Qr(p)?l.range[0]:p)+.5*y,g.directions={x:1,y:h>d?0:1},g.width=Math.max(0,e*t.attr("barRatioWidth")(r,n,i)-y-t.attr("inset")(r,n,i)),g.height=Math.max(0,isNaN(f)?0:f-y),g.left=g.x,g.right=g.x+g.width,g.top=g.y,g.bottom=g.y-g.height,g.relativePosition=[.5,0],g.alignment={horizontal:"middle",vertical:"top"},r.anchorPoints=g,c.setAttribute("x",g.x),c.setAttribute("y",g.y),c.setAttribute("width",g.width),c.setAttribute("height",g.height),c.setAttribute("fill",t.attr("fill")(r,n,i)),c.setAttribute("fill-opacity",t.attr("fillOpacity")(r,n,i)),c.setAttribute("stroke",t.attr("stroke")(r,n,i)),c.setAttribute("stroke-width",y),c.setAttribute("stroke-opacity",t.attr("strokeOpacity")(r,n,i))}}))}return t.objects.forEach((function(t){return t.draw()})),t.parentNode}}function rn(){return new en}en.prototype=Object.create(nr.prototype),en.prototype.constructor=en,en.parent=nr.prototype,en.prototype=Object.assign(en.prototype,{width:Ir,inset:Tr,strokeWidth:Lr,color:Er,stroke:Er,fill:Fr,fillOpacity:Pr,strokeOpacity:Cr,binwidth:Dr});var nn=Ke.isNull,an=Ke.isInfinity,sn=Ke.createSVG;function on(){var t=this;nr.call(this),this.type="series",this._stacked=null,this._grouped=1,this._groupIndex=0;var e=Rr;this.attr("barRatioWidth",Vr),this.attr("inset",$r),this.attr("stroke",zr),this.attr("fill",qr),this.attr("fillOpacity",Ur),this.attr("strokeWidth",Wr),this.attr("strokeOpacity",Gr),this._classNames=["chrt-columns"],this.getXScale=function(){var e,r;nn(t.fields.x)&&(t.fields.x=null===(r=t.parentNode)||void 0===r?void 0:r.scales.x[t.scales.x].field);return null===(e=t.parentNode)||void 0===e?void 0:e.scales.x[t.scales.x]},this.draw=function(){var r,n;if(!t.parentNode)return t;var i=t.parentNode,a=i._margins,s=i.scales;rr.call(t,t.attr("display")()),(r=t.g.classList).remove.apply(r,jr(t.g.classList)),(n=t.g.classList).add.apply(n,jr(t._classNames)),nn(t.fields.x)&&(t.fields.x=s.x[t.scales.x].field),nn(t.fields.y)&&(t.fields.y=s.y[t.scales.y].field),nn(t.fields.y0)&&(t.fields.y0="".concat(s.y[t.scales.y].field,"0"));var o=s.x[t.scales.x],l=s.y[t.scales.y],c=t._data.length?t._data:t.parentNode._data;if(!nn(c)){if(!c.some((function(t){return!nn(t.x0)||!nn(t.x)})))return console.warn("chrtHistograms expects data points to contain x0 and x1 fields"),t;if(!c.some((function(t){return!nn(t.x1)})))return console.warn("chrtHistograms expects data points to contain x0 and x1 fields"),t;var u=[].concat(jr(c.map((function(t){return t.x0}))),jr(c.map((function(t){return t.x1})))),h=[Math.min.apply(Math,jr(u)),Math.max.apply(Math,jr(u))];(isNaN(o.domain[0])||isNaN(o.domain[1])||o.domain[0]>h[0]||o.domain[1]<h[1])&&t.parentNode.x({domain:h}),l.domain[0]>0&&t.parentNode.y({domain:[0,l.domain[1]]});var d=t.parentNode.getAxis("x"),f=d?d.lineWidth()():0;c.forEach((function(r,n,i){var s=t.g.querySelector("[data-id='rect-".concat(name,"-").concat(n,"']"));s||((s=sn("rect")).setAttribute("data-id","rect-".concat(name,"-").concat(n)),s.setAttribute("shape-rendering","crispEdges"),t.g.appendChild(s));var c=o(nn(r["".concat(t.fields.x,"0")])?r[t.fields.x]:r["".concat(t.fields.x,"0")]);if(!isNaN(c)){var u=o(r["".concat(t.fields.x,"1")]);if(!isNaN(u)){e=Math.abs(u-c);var h=l(r[t._stacked?"stacked_".concat(t.fields.y):t.fields.y]),d=nn(r[t._stacked?"stacked_".concat(t.fields.y,"0"):t.fields.y0])?null:l(r[t._stacked?"stacked_".concat(t.fields.y,"0"):t.fields.y0]);nn(d)&&(d=l.isLog()?l.range[0]-a.bottom:l(l.domain[0]||0),(l.domain[0]||0)*(l.domain[1]||0)<0&&(d=l.isLog()?l.range[0]-a.bottom:l(0)));var p=isNaN(h)?0:Math.max(Math.abs(h-d),Math.abs(h-d)-f/2),y=h>d?d:h,g=t.attr("strokeWidth")(r,n,i),v={};v.x=c,v.y=(isNaN(y)||an(y)?l.range[0]:y)+.5*g,v.directions={x:1,y:h>d?0:1};var b=t.attr("barRatioWidth")(r,n,i),m=g+t.attr("inset")(r,n,i);v.width=Math.max(0,e*b-m),v.height=Math.max(0,isNaN(p)?0:p-g),v.x=v.x+(e-v.width)/2,v.left=v.x,v.right=v.x+v.width,v.top=v.y,v.bottom=v.y-v.height,v.relativePosition=[.5,0],v.alignment={horizontal:"middle",vertical:"top"},r.anchorPoints=v,s.setAttribute("x",v.x),s.setAttribute("y",v.y),s.setAttribute("width",v.width),s.setAttribute("height",v.height),s.setAttribute("fill",t.attr("fill")(r,n,i)),s.setAttribute("fill-opacity",t.attr("fillOpacity")(r,n,i)),s.setAttribute("stroke",t.attr("stroke")(r,n,i)),s.setAttribute("stroke-width",g),s.setAttribute("stroke-opacity",t.attr("strokeOpacity")(r,n,i))}}}))}return t.objects.forEach((function(t){return t.draw()})),t.parentNode}}function ln(){return new on}function cn(t){return function(t){if(Array.isArray(t))return un(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return un(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return un(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function un(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function hn(t){return this.attr("size",t)}function dn(t){return this.attr("fill",t)}function fn(t){return this.attr("fillOpacity",t)}on.prototype=Object.create(nr.prototype),on.prototype.constructor=on,on.parent=nr.prototype,on.prototype=Object.assign(on.prototype,{width:Ir,inset:Tr,strokeWidth:Lr,color:Er,stroke:Er,fill:Fr,fillOpacity:Pr,strokeOpacity:Cr,binwidth:Dr});var pn=function(t,e){t.setAttribute("d",e)},yn=function(t,e,r){t.setAttribute("x",0),t.setAttribute("y",0),t.setAttribute("text-anchor","middle"),t.setAttribute("dominant-baseline","middle"),t.setAttribute("font-size",r),t.textContent=e},gn=Object.freeze({__proto__:null,circle:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:3;t.setAttribute("cx",e),t.setAttribute("cy",r),t.setAttribute("r",Math.max(0,isNaN(n)?0:n))},square:function(t){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:3,n="M".concat((arguments.length>1&&void 0!==arguments[1]?arguments[1]:0)-r,",").concat(e-r,"h").concat(2*r,"v").concat(2*r,"h").concat(2*-r,"Z");t.setAttribute("d",n)},plus:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:3,i="M".concat(e,",").concat(r-n,"v").concat(2*n,"M").concat(e-n,",").concat(r,"h").concat(2*n,"Z");t.setAttribute("d",i)},times:function(t){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:3,n="M".concat((arguments.length>1&&void 0!==arguments[1]?arguments[1]:0)-r,",").concat(e-r,"l").concat(2*r,",").concat(2*r,"m",0,",").concat(2*-r,"l").concat(2*-r,",").concat(2*r);t.setAttribute("d",n)},custom:pn,text:yn}),vn=Ke.isNull,bn=Ke.isInfinity,mn=3,xn="#000",_n=0,Nn=["circle","square"];function An(){var t=this;nr.call(this),this.type="series",this.attr("radius",mn),this.attr("stroke",xn),this.attr("fill",xn),this.attr("strokeWidth",0),this.attr("strokeOpacity",1),this.attr("fillOpacity",1),this.attr("size",null),this.attr("rotate",_n),this.attr("symbol",{symbol:Nn[0]}),this._classNames=["chrt-points"],this.getXScale=function(){return vn(t.fields.x)&&(t.fields.x=t.parentNode.scales.x[t.scales.x].field),t.parentNode.scales.x[t.scales.x]},this.draw=function(){var e,r;if(rr.call(t,t.attr("display")()),(e=t.g.classList).remove.apply(e,cn(t.g.classList)),(r=t.g.classList).add.apply(r,cn(t._classNames)),!vn(t._data)){vn(t.fields.x)&&(t.fields.x=t.parentNode.scales.x[t.scales.x].field),vn(t.fields.y)&&(t.fields.y=t.parentNode.scales.y[t.scales.y].field);var n=function(t){return Math.sqrt(t/Math.PI)},i=t.attr("size")({});null!=i&&i.scale&&(n=function(e){var r=t.parentNode.scales.other[i.scale];return r(e[r.field])}),null!=i&&i.range&&(t.parentNode.scale({domain:i.domain,range:i.range||[0,10],scale:"sqrt",field:i.field||"r",type:"other",name:i.field||"r",margins:{top:0,bottom:0,left:0,right:0},padding:{top:0,bottom:0,left:0,right:0}}),n=function(e){var r=i.field||"r";return(0,t.parentNode.scales.other[r])(e[r])});var a=t.g.childElementCount-t._data.length;a>0&&Array.from({length:a},(function(e,r){return r+t._data.length})).forEach((function(e){t.g.querySelector("[data-id='".concat(escape("point-".concat(name,"-").concat(e)),"']")).remove()})),t._data.forEach((function(e,r,i){if(!vn(t.parentNode.scales.x[t.scales.x])&&!vn(t.parentNode.scales.y[t.scales.y])){var a=t.parentNode.scales.x[t.scales.x](e[t.fields.x]),s=t.parentNode.scales.y[t.scales.y](e[t.fields.y]),o=isNaN(a)||bn(a)?0:a,l=isNaN(s)||bn(s)?0:s,c=t.attr("radius")(e,r,i),u=t.attr("size")(e,r,i);vn(u)||(c=n(null!=u&&u.scale||null!=u&&u.range?e:u)),e.anchorPoints={x:o,width:c,y:l,height:c,relativePosition:[0,-1],directions:{x:1,y:1},alignment:{horizontal:"middle",vertical:"top"}};var h=t.attr("symbol")(),d=h.symbol,f=h.option,p=escape("point-".concat(name,"-").concat(r)),y=t.g.querySelector("[data-id='".concat(p,"']"));y||((y=Ke.createSVG.call(t,"circle"!==d&&"text"!==d?"path":d)).setAttribute("data-id",p),t.g.appendChild(y)),e.anchorPoints.node=y,"custom"===d?pn(y,f):"text"===d?yn(y,f,10*c):gn[d](y,0,0,c),y.setAttribute("fill",t.attr("fill")(e,r,i)),y.setAttribute("fill-opacity",t.attr("fillOpacity")(e,r,i)||1),y.setAttribute("stroke",t.attr("stroke")(e,r,i)),y.setAttribute("stroke-width",t.attr("strokeWidth")(e,r,i)),y.setAttribute("stroke-opacity",t.attr("strokeOpacity")(e,r,i)),y.setAttribute("transform-origin","0 0"),y.setAttribute("transform","translate(".concat(o,", ").concat(l,") rotate(").concat(t.attr("rotate")(e,r,i),")"))}}))}return t.objects.forEach((function(t){return t.draw()})),t}}function kn(){return new An}function wn(t){return function(t){if(Array.isArray(t))return On(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return On(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return On(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function On(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}An.prototype=Object.create(nr.prototype),An.prototype.constructor=An,An.parent=nr.prototype,An.prototype=Object.assign(An.prototype,{pointSize:hn,size:hn,radius:function(t){return this.attr("radius",t)},color:dn,fill:dn,stroke:function(t){return this.attr("stroke",t)},strokeWidth:function(t){return this.attr("strokeWidth",t)},opacity:fn,fillOpacity:fn,rotate:function(t){return this.attr("rotate",t)},symbol:function(t,e){return this.attr("symbol",{symbol:t,option:e})},strokeOpacity:function(t){return this.attr("strokeOpacity",t)}});var Mn=["chrt","series"];function jn(t){return null===t||null==t||void 0===t}function Sn(){return"c"+Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}function Ln(t){return!jn(t.type)&&Mn.indexOf(t.type)>-1}function En(t){return!isFinite(t)}function Fn(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Pn(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=t._id||Sn();return t.id(r).parent(this),e?this.objects=[t].concat(wn(this.objects)):this.objects.push(t),this}var Cn=Object.freeze({__proto__:null,add:Pn,create:function(t){return document.createElement(t)},createSVG:Fn,getCoords:function(t){var e=this;return null!=this&&this.fields?t.map((function(t){var r=jn(t[e.fields.x])||En(t[e.fields.x])?null:e.parentNode.scales.x[e.scales.x](t[e.fields.x]),n=jn(t[e.fields.y])||En(t[e.fields.y])?null:e.parentNode.scales.y[e.scales.y](t[e.fields.y]);return[En(r)?0:r,En(n)?0:n]})):[]},getStrokeStyle:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4,n=null;switch(t){case"dashed":n="".concat(e*r," ").concat(e*r);break;case"dotted":n="".concat(e," ").concat(e);break;default:n=null}return n},hasData:Ln,isInfinity:En,isNull:jn,oppositeSigns:function(t,e){return(t^e)<0},uuid:Sn});function In(t,e){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(t){return t};return jn(t)?(console.warn("name missing: attr method requires a name for the attribute"),this):jn(t)||void 0!==e?(this.attrs[t]="function"==typeof e?e:function(){return n(e)},this):(null===(r=this.attrs)||void 0===r?void 0:r[t])||function(){}}function Tn(t){return t?(this.root=t,this.currentNode=this.root,this):this.g||this.root}function Dn(t){return In.call(this,"display",t)}function Wn(t){var e=Tn.call(this);if(!e)return this;var r=e.style.display;return this._display=void 0!==this._display?this._display:e.style.display,t?"none"===r&&t&&(e.style.display=this._display):e.style.display="none",this}function zn(){var t=this;this._id=null,this.objects=[],this.type="chrt-object",this.fields={x:null,y:null},this.scales={x:"x",y:"y"},this._classNames=[],this._accessor=function(t,e){return{x:!jn(t)&&Object.prototype.hasOwnProperty.call(t,"x")?t.x:e,y:jn(t)?null:Object.prototype.hasOwnProperty.call(t,"y")?t.y:t}},this.interpolationFunction=null,this.attrs=[],In.call(this,"display",!0),this.id=function(e){return jn(e)?t._id:(t._id=e||t._id,t.g&&t.g.setAttribute("id",t._id),t)},this.aria=function(e){return In.call(t,"aria",e),t},this.class=function(e){if(jn(e))return t._classNames;var r,n,i=(Array.isArray(e)?e:e.split(" ")).map((function(t){return t.replace(/\s\s+/g," ").trim()})).filter((function(t){return""!==t}));(t.original_classNames=t.original_classNames||t._classNames,t._classNames=wn(new Set([].concat(wn(t.original_classNames),wn(i)))),t.g)&&((r=t.g.classList).remove.apply(r,wn(t.g.classList)),(n=t.g.classList).add.apply(n,wn(t._classNames)));return t},this.hasData=function(){return Ln(t)};var e=function(e,r){jn(r)||(t.scales[e]=r)};return this.x=function(r){return jn(r)?t.scales.x:(e("x",r||"x"),t)},this.y=function(r){return jn(r)?t.scales.y:(e("y",r||"y"),t)},this.getObjectTypeIndex=function(){var e,r;return(null!==(e=null===(r=t.parent())||void 0===r?void 0:r.objects)&&void 0!==e?e:[]).filter((function(e){return e.constructor.name===t.constructor.name})).indexOf(t)},this}function qn(){return new zn}function Gn(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Un(t){return function(t){if(Array.isArray(t))return Gn(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return Gn(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Gn(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Rn(t){return this.attr("fill",t)}function Vn(t){var e=this.attr("position")();return this.attr("position",Object.assign({},e,t))}zn.prototype=Object.create(qn.prototype),zn.prototype=Object.assign(qn.prototype,{node:Tn,data:function(t,e){if(!t)return Ln(this)?this._data||null:this;if(!Ln(this))return this;if("function"==typeof arguments[0])return this._accessor=arguments[0],this;this._orginalData=this._orginalData||t;var r=e||this._accessor;return this._accessor=r,this._data=r&&!this._accessorApplied?t.map((function(t,e,n){return t instanceof Object?Object.assign({},t,r(t,e,n)):r(t,e,n)})):t,this._accessorApplied=!0,this},add:Pn,snap:Pn,parent:function(t){return t?(this.parentNode=t,this):this.parentNode},render:function(t){return this.g||(this.g=Fn("g"),this._id&&this.g.setAttribute("id",this._id),Ln(this)&&t?"stack"===t.type||"group"===t.group?t.g.prepend(this.g):t.g.append(this.g):this.currentNode.append(this.g),this.update()),this},update:function(){return this.parentNode&&this.parentNode.scales.x[this.scales.x]&&this.parentNode.scales.y[this.scales.y]&&this.draw(),this},curve:function(t){return jn(t)?this.interpolationFunction:(this.interpolationFunction=t,this)},attr:In,show:function(){return Dn.call(this,!0)},hide:function(){return Dn.call(this,!1)}});var $n=Cn.isNull;function Hn(t){if("function"==typeof t)return t;var e="start";switch(t){case"end":e="end";break;case"center":case"middle":e="middle";break;default:e="start"}return function(){return e}}function Bn(t){if("function"==typeof t)return t;var e="top";switch(t){case"bottom":e="bottom";break;case"middle":case"center":e="middle";break;default:e="top"}return function(){return e}}function Yn(t){return this._alignment=Object.assign({},this._alignment,t),this}function Zn(t){var e;return $n(t)?(null===(e=this._alignment)||void 0===e?void 0:e.horizontal)||this.defaultAlignment.horizontal:Yn.call(this,{horizontal:Hn(t)})}function Xn(t){var e;return $n(t)?(null===(e=this._alignment)||void 0===e?void 0:e.vertical)||this.defaultAlignment.vertical:Yn.call(this,{vertical:Bn(t)})}var Jn=Cn.isNull;var Kn=Cn.isNull;function Qn(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];if(null==e||!e.length)return this._offsets;var n=e[0],i=e[1],a=this._offsets[0];Kn(i)||(a="function"==typeof i?i:function(){return i});var s=this._offsets[1];return Kn(n)||(s="function"==typeof n?n:function(){return n}),this._offsets=[a,s],this}var ti=Cn.isNull;function ei(t){return void 0===t?(this.labelsFilter=function(){return!0},this):"function"==typeof t?(this.labelsFilter=function(e,r,n){return t(e,r,n)},this):"boolean"==typeof t?(this.labelsFilter=function(){return t},this):Number.isFinite(t)?(this.labelsFilter=function(e){return t===e},this):Array.isArray(t)?(this.labelsFilter=function(e){return t.indexOf(e)>-1},this):(this.labelsFilter=function(e){return t===e},this)}function ri(t){ei.call(this,t);var e=this.labelsFilter;return this.labelsFilter=function(t,r,n){return!e(t,r,n)},this}var ni="#000",ii=Cn.isNull,ai=Cn.isInfinity,si=Cn.createSVG;function oi(t){var e=this;zn.call(this),this.type="label",this.g=null,this.attr("datum",null),this.attr("fill",null),this.attr("text",null),this.attr("position",{}),this.attr("anchor",null),this.defaultAlignment={horizontal:function(){return"start"},vertical:function(){return"text-after-edge"}},this._margins={top:0,right:0,bottom:0,left:0},this._offsets=[function(){return 0},function(){return 0}],this._classNames=["chrt-label"],this.value=function(t){return e.attr("text",t)},this.text=this.value,this.value(t),this.anchor=function(t){return e.attr("anchor",t)},this.datum=function(t){return e.attr("datum",t)},this.draw=function(){var t,r,n,i,a,s,o,l,c,u,h="chrt"===(null==e||null===(t=e.parentNode)||void 0===t?void 0:t.type)?e.parentNode:null==e||null===(r=e.parentNode)||void 0===r?void 0:r.parentNode;e.g||(e.g=si("g"),null==h||null===(u=h.currentNode)||void 0===u||u.appendChild(e.g));e.g.setAttribute("id",e.id()),Wn.call(e,e.attr("display")()),(n=e.g.classList).remove.apply(n,Un(e.g.classList)),(i=e.g.classList).add.apply(i,Un(e._classNames));var d=function(t){return function(r){return ii(t[r])?!ii(e.parentNode._data)&&e.parentNode._data.length?e.parentNode._data[e.parentNode._data.length-1][r]:0:t[r]}},f=e.attr("anchor")(),p=(null!==(a=null===(s=e.parentNode)||void 0===s?void 0:s.parentNode)&&void 0!==a?a:e.parentNode).scales,y=null!==(o=e.parentNode.fields)&&void 0!==o?o:{x:"x",y:"y"};if(!f&&p&&p.x[y.x]){var g=p.x[y.x](d(e.attr("position")())(y.x))+e._margins.left-e._margins.right+e._offsets[1](),v=p.y[y.y](d(e.attr("position")())(y.y))+e._margins.top-e._margins.bottom+e._offsets[0]();e.g.setAttribute("transform","translate(".concat(isNaN(g)||ai(g)?0:g,",").concat(isNaN(v)||ai(v)?0:v,")"))}var b=e.g.querySelector("text");if(!b){b=si("text");var m=e.attr("text")();b.setAttribute("data-id",escape("label-".concat(m))),e.g.appendChild(b)}b.setAttribute("fill",e.color()()||(null===(l=e.parentNode)||void 0===l||null===(c=l.stroke)||void 0===c?void 0:c.call(l)())||ni),b.textContent=e.attr("text")();var x=e._alignment||(null==f?void 0:f.alignment)||e.defaultAlignment,_=x.horizontal(e.datum()()),N="";switch(x.vertical(e.datum()())){case"bottom":N="text-before-edge";break;case"top":N="text-after-edge";break;default:N="middle"}if(f){var A=f.relativePosition,k=f.x+f.width*(1-f.directions.x)+f.width*A[0]*(f.directions.x||-1),w=f.y+f.height*(1-f.directions.y)+f.height*A[1]*(f.directions.y||-1),O={x:(isNaN(k)||ai(k)?0:k)+e._offsets[1](e.datum()()),y:(isNaN(w)||ai(w)?0:w)+e._offsets[0](e.datum()())};f.directions.x||("start"===_?_="end":"end"===_&&(_="start")),f.directions.y||("text-after-edge"===N?N="text-before-edge":"text-before-edge"===N&&(N="text-after-edge")),e.g.setAttribute("transform","translate(".concat(O.x,", ").concat(O.y,")"))}return b.setAttribute("text-anchor",_),b.setAttribute("dominant-baseline",N),e}}function li(t){return new oi(t)}oi.prototype=Object.create(zn.prototype),oi.prototype.constructor=oi,oi.prototype=Object.assign(oi.prototype,{color:Rn,fill:Rn,position:Vn,top:function(t){return Vn.call(this,{y:t})},left:function(t){return Vn.call(this,{x:t})},align:Zn,valign:Xn,margins:function(t){if(Jn(t))return this._margins;var e=t.top,r=t.bottom,n=t.left,i=t.right;return this._margins.top=Jn(e)?this._margins.top:e,this._margins.bottom=Jn(r)?this._margins.bottom:r,this._margins.left=Jn(n)?this._margins.left:n,this._margins.right=Jn(i)?this._margins.right:i,this},offset:Qn,offsets:Qn});var ci=Cn.isNull;function ui(){var t=this;zn.call(this),this.type="labels",this.labels=[],this.labelsFilter=function(){return!0},this._alignment=null,this.attr("fill",ni),this._offsets=[function(){return 0},function(){return 0}],this.value=function(e){return t.attr("textField",e)},this.draw=function(){var e,r,n,i=t.parentNode.data(),a=i.length?i:t.parentNode.parentNode._data||[];if(null===(e=t.parentNode)||void 0===e||e.class().indexOf("chrt-bars"),null===(r=t.parentNode)||void 0===r||r.class().indexOf("chrt-columns"),null!==(n=t.labels)&&void 0!==n&&n.length){var s=t.labels.length-a.length;s>0&&(Array.from({length:s},(function(t,e){return e+a.length})).forEach((function(e){var r;null===(r=t.labels[e])||void 0===r||r.node().remove(),t.labels[e]=null})),t.labels=t.labels.filter((function(t){return t})))}return a.forEach((function(e,r){var n,i,s;if(!t.labelsFilter||t.labelsFilter(e,r,a)){t.labels[r]||(t.labels[r]=li(),t.parentNode.add(t.labels[r]));var o,l,c=t.attr("textField")(e,r,t.labels),u=ci(c)?e[t.parentNode.fields.y]:c,h=t.class();if(h.length&&t.labels[r].class(h.join(" ")),t.labels[r].value(u).datum(e),t.labels[r].anchor(e.anchorPoints?Object.assign({},e.anchorPoints,{alignment:null!==(n=e.anchorPoints)&&void 0!==n&&n.alignment?{horizontal:function(){var t,r;return null!==(t=null===(r=e.anchorPoints)||void 0===r||null===(r=r.alignment)||void 0===r?void 0:r.horizontal)&&void 0!==t?t:"middle"},vertical:function(){var t,r;return null!==(t=null===(r=e.anchorPoints)||void 0===r||null===(r=r.alignment)||void 0===r?void 0:r.vertical)&&void 0!==t?t:"top"}}:null,relativePosition:t._rposition||e.anchorPoints.relativePosition}):null).offset(null!==(i=t._offsets[1](e,r,t.labels))&&void 0!==i?i:0,null!==(s=t._offsets[0](e,r,t.labels))&&void 0!==s?s:0).color(t.color()(e,r,t.labels)),t._alignment)t.labels[r].align((null===(o=t._alignment)||void 0===o?void 0:o.horizontal)||"middle").valign((null===(l=t._alignment)||void 0===l?void 0:l.vertical)||"top");t.labels[r].attr(t.attr("display")(e,r,a)),t.labels[r].draw()}})),t}}function hi(){return new ui}function di(t){return function(t){if(Array.isArray(t))return fi(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return fi(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return fi(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function fi(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}ui.prototype=Object.create(zn.prototype),ui.prototype.constructor=ui,ui.parent=zn.prototype,ui.prototype=Object.assign(ui.prototype,{align:Zn,valign:Xn,relativePosition:function(t){return ti(t)?this._rposition:(this._rposition=t,this)},filter:ei,show:ei,hide:ri,filterLabels:ei,hideLabels:ri,firstLabel:function(){return!(arguments.length>0&&void 0!==arguments[0])||arguments[0]?ei.call(this,(function(t,e){return 0===e})):ri.call(this,(function(t,e){return 0===e})),this},lastLabel:function(){return!(arguments.length>0&&void 0!==arguments[0])||arguments[0]?ei.call(this,(function(t,e,r){return e===r.length-1})):ri.call(this,(function(t,e,r){return e===r.length-1})),this},firstAndLastLabels:function(){return!(arguments.length>0&&void 0!==arguments[0])||arguments[0]?ei.call(this,(function(t,e,r){return 0===e||e===r.length-1})):ri.call(this,(function(t,e,r){return 0===e||e===r.length-1})),this},offset:Qn,offsets:Qn,color:Rn,fill:Rn});var pi=["chrt","series"];function yi(t){return null===t||null==t||void 0===t}function gi(){return"c"+Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}function vi(t){return!yi(t.type)&&pi.indexOf(t.type)>-1}function bi(t){return!isFinite(t)}function mi(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function xi(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=t._id||gi();return t.id(r).parent(this),e?this.objects=[t].concat(di(this.objects)):this.objects.push(t),this}var _i=Object.freeze({__proto__:null,add:xi,create:function(t){return document.createElement(t)},createSVG:mi,getCoords:function(t){var e=this;return null!=this&&this.fields?t.map((function(t){var r=yi(t[e.fields.x])||bi(t[e.fields.x])?null:e.parentNode.scales.x[e.scales.x](t[e.fields.x]),n=yi(t[e.fields.y])||bi(t[e.fields.y])?null:e.parentNode.scales.y[e.scales.y](t[e.fields.y]);return[bi(r)?0:r,bi(n)?0:n]})):[]},getStrokeStyle:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4,n=null;switch(t){case"dashed":n="".concat(e*r," ").concat(e*r);break;case"dotted":n="".concat(e," ").concat(e);break;default:n=null}return n},hasData:vi,isInfinity:bi,isNull:yi,oppositeSigns:function(t,e){return(t^e)<0},uuid:gi});function Ni(t,e){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(t){return t};return yi(t)?(console.warn("name missing: attr method requires a name for the attribute"),this):yi(t)||void 0!==e?(this.attrs[t]="function"==typeof e?e:function(){return n(e)},this):(null===(r=this.attrs)||void 0===r?void 0:r[t])||function(){}}function Ai(t){return t?(this.root=t,this.currentNode=this.root,this):this.g||this.root}function ki(t){return Ni.call(this,"display",t)}function wi(t){var e=Ai.call(this);if(!e)return this;var r=e.style.display;return this._display=void 0!==this._display?this._display:e.style.display,t?"none"===r&&t&&(e.style.display=this._display):e.style.display="none",this}function Oi(){var t=this;this._id=null,this.objects=[],this.type="chrt-object",this.fields={x:null,y:null},this.scales={x:"x",y:"y"},this._classNames=[],this._accessor=function(t,e){return{x:!yi(t)&&Object.prototype.hasOwnProperty.call(t,"x")?t.x:e,y:yi(t)?null:Object.prototype.hasOwnProperty.call(t,"y")?t.y:t}},this.interpolationFunction=null,this.attrs=[],Ni.call(this,"display",!0),this.id=function(e){return yi(e)?t._id:(t._id=e||t._id,t.g&&t.g.setAttribute("id",t._id),t)},this.aria=function(e){return Ni.call(t,"aria",e),t},this.class=function(e){if(yi(e))return t._classNames;var r,n,i=(Array.isArray(e)?e:e.split(" ")).map((function(t){return t.replace(/\s\s+/g," ").trim()})).filter((function(t){return""!==t}));(t.original_classNames=t.original_classNames||t._classNames,t._classNames=di(new Set([].concat(di(t.original_classNames),di(i)))),t.g)&&((r=t.g.classList).remove.apply(r,di(t.g.classList)),(n=t.g.classList).add.apply(n,di(t._classNames)));return t},this.hasData=function(){return vi(t)};var e=function(e,r){yi(r)||(t.scales[e]=r)};return this.x=function(r){return yi(r)?t.scales.x:(e("x",r||"x"),t)},this.y=function(r){return yi(r)?t.scales.y:(e("y",r||"y"),t)},this.getObjectTypeIndex=function(){var e,r;return(null!==(e=null===(r=t.parent())||void 0===r?void 0:r.objects)&&void 0!==e?e:[]).filter((function(e){return e.constructor.name===t.constructor.name})).indexOf(t)},this}function Mi(){return new Oi}function ji(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Si(t){return function(t){if(Array.isArray(t))return ji(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(t){if("string"==typeof t)return ji(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ji(t,e):void 0}}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Li(t){return this.attr("radius",t)}function Ei(t){return void 0===t?(this.markersFilter=function(){return!0},this):"function"==typeof t?(this.markersFilter=function(e,r,n){return t(e,r,n)},this):"boolean"==typeof t?(this.markersFilter=function(){return t},this):Number.isFinite(t)?(this.markersFilter=function(e){return t===e},this):Array.isArray(t)?(this.markersFilter=function(e){return t.indexOf(e)>-1},this):(this.markersFilter=function(e){return t===e},this)}function Fi(t){Ei.call(this,t);var e=this.markersFilter;return this.markersFilter=function(t,r,n){return!e(t,r,n)},this}Oi.prototype=Object.create(Mi.prototype),Oi.prototype=Object.assign(Mi.prototype,{node:Ai,data:function(t,e){if(!t)return vi(this)?this._data||null:this;if(!vi(this))return this;if("function"==typeof arguments[0])return this._accessor=arguments[0],this;this._orginalData=this._orginalData||t;var r=e||this._accessor;return this._accessor=r,this._data=r&&!this._accessorApplied?t.map((function(t,e,n){return t instanceof Object?Object.assign({},t,r(t,e,n)):r(t,e,n)})):t,this._accessorApplied=!0,this},add:xi,snap:xi,parent:function(t){return t?(this.parentNode=t,this):this.parentNode},render:function(t){return this.g||(this.g=mi("g"),this._id&&this.g.setAttribute("id",this._id),vi(this)&&t?"stack"===t.type||"group"===t.group?t.g.prepend(this.g):t.g.append(this.g):this.currentNode.append(this.g),this.update()),this},update:function(){return this.parentNode&&this.parentNode.scales.x[this.scales.x]&&this.parentNode.scales.y[this.scales.y]&&this.draw(),this},curve:function(t){return yi(t)?this.interpolationFunction:(this.interpolationFunction=t,this)},attr:Ni,show:function(){return ki.call(this,!0)},hide:function(){return ki.call(this,!1)}});var Pi=_i.createSVG,Ci=2,Ii="#000",Ti="#000",Di=1,Wi=1,zi=1;function qi(){var t=this;Oi.call(this),this.type="markers",this.markers=[],this.g=null,this.markersFilter=function(){return!0},this.attr("strokeWidth",null),this.attr("stroke",null),this.attr("strokeOpacity",null),this.attr("fill",null),this.attr("fillOpacity",null),this.attr("radius",Ci),this._classNames=["chrt-markers"],this.draw=function(){var e,r,n=t.parentNode.data(),i=n.length?n:t.parentNode.parentNode._data||[],a=t.size()(),s=t.fill()()||t.parentNode.stroke()()||Ii,o=t.fillOpacity()()||t.parentNode.strokeOpacity()()||zi,l=t.stroke()()||t.parentNode.stroke()()||Ti,c=t.strokeOpacity()()||t.parentNode.strokeOpacity()()||Di,u=t.strokeWidth()()||t.parentNode.strokeWidth()()||Wi;return t.g||(t.g=Pi("g"),t.parentNode.g.appendChild(t.g)),wi.call(t,t.attr("display")()),(e=t.g.classList).remove.apply(e,Si(t.g.classList)),(r=t.g.classList).add.apply(r,Si(t._classNames)),i.forEach((function(e,r){if(t.markers[r])t.markers[r].marker=e;else{var n=Pi("circle");t.markers.push({circle:n,marker:e}),t.g.appendChild(n)}})),t.markers.filter((function(e,r,n){return t.markersFilter(e.marker,r,n)})).forEach((function(e){var r=t.parentNode.parentNode.scales.x[t.parentNode.scales.x](e.marker[t.parentNode.fields.x]);e.circle.setAttribute("cx",isNaN(r)?0:r);var n=t.parentNode.parentNode.scales.y[t.parentNode.scales.y](e.marker[t.parentNode.fields.y]);e.circle.setAttribute("cy",isNaN(n)?0:n),e.circle.setAttribute("fill",s),e.circle.setAttribute("fill-opacity",o),e.circle.setAttribute("r",a),e.circle.setAttribute("stroke",l),e.circle.setAttribute("stroke-width",u),e.circle.setAttribute("stroke-opacity",c)})),t}}function Gi(){return new qi}function Ui(t){return function(t){if(Array.isArray(t))return Ri(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Ri(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ri(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ri(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}qi.prototype=Object.create(Oi.prototype),qi.prototype.constructor=qi,qi.parent=Oi.prototype,qi.prototype=Object.assign(qi.prototype,{fill:function(t){return this.attr("fill",t)},size:Li,radius:Li,stroke:function(t){return this.attr("stroke",t)},strokeWidth:function(t){return this.attr("strokeWidth",t)},strokeOpacity:function(t){return this.attr("strokeOpacity",t)},fillOpacity:function(t){return this.attr("fillOpacity",t)},showMarkers:Ei,filter:Ei,hideMarkers:Fi,firstMarker:function(){return!(arguments.length>0&&void 0!==arguments[0])||arguments[0]?Ei.call(this,(function(t,e){return 0===e})):Fi.call(this,(function(t,e){return 0===e})),this},lastMarker:function(){return!(arguments.length>0&&void 0!==arguments[0])||arguments[0]?Ei.call(this,(function(t,e,r){return e===r.length-1})):Fi.call(this,(function(t,e,r){return e===r.length-1})),this},firstAndLastMarkers:function(){return!(arguments.length>0&&void 0!==arguments[0])||arguments[0]?Ei.call(this,(function(t,e,r){return 0===e||e===r.length-1})):Fi.call(this,(function(t,e,r){return 0===e||e===r.length-1})),this}});var Vi=["chrt","series"];function $i(t){return null===t||null==t||void 0===t}function Hi(){return"c"+Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}function Bi(t){return!$i(t.type)&&Vi.indexOf(t.type)>-1}function Yi(t){return!isFinite(t)}function Zi(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function Xi(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=t._id||Hi();return t.id(r).parent(this),e?this.objects=[t].concat(Ui(this.objects)):this.objects.push(t),this}var Ji=Object.freeze({__proto__:null,add:Xi,isNull:$i,uuid:Hi,hasData:Bi,isInfinity:Yi,oppositeSigns:function(t,e){return(t^e)<0},getCoords:function(t){var e=this;return null!=this&&this.fields?t.map((function(t){var r=$i(t[e.fields.x])||Yi(t[e.fields.x])?null:e.parentNode.scales.x[e.scales.x](t[e.fields.x]),n=$i(t[e.fields.y])||Yi(t[e.fields.y])?null:e.parentNode.scales.y[e.scales.y](t[e.fields.y]);return[Yi(r)?0:r,Yi(n)?0:n]})):[]},create:function(t){return document.createElement(t)},createSVG:Zi,getStrokeStyle:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:4,n=null;switch(t){case"dashed":n="".concat(e*r," ").concat(e*r);break;case"dotted":n="".concat(e," ").concat(e);break;default:n=null}return n}});function Ki(t,e){var r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:function(t){return t};return $i(t)?(console.warn("name missing: attr method requires a name for the attribute"),this):$i(t)||void 0!==e?(this.attrs[t]="function"==typeof e?e:function(){return n(e)},this):(null===(r=this.attrs)||void 0===r?void 0:r[t])||function(){}}function Qi(t){return t?(this.root=t,this.currentNode=this.root,this):this.g||this.root}function ta(t){return Ki.call(this,"display",t)}function ea(t){var e=Qi.call(this);if(!e)return this;var r=e.style.display;return this._display=void 0!==this._display?this._display:e.style.display,t?"none"===r&&t&&(e.style.display=this._display):e.style.display="none",this}function ra(){var t=this;this._id=null,this.objects=[],this.type="chrt-object",this.fields={x:null,y:null},this.scales={x:"x",y:"y"},this._classNames=[],this._accessor=function(t,e){return{x:!$i(t)&&Object.prototype.hasOwnProperty.call(t,"x")?t.x:e,y:$i(t)?null:Object.prototype.hasOwnProperty.call(t,"y")?t.y:t}},this.interpolationFunction=null,this.attrs=[],Ki.call(this,"display",!0),this.id=function(e){return $i(e)?t._id:(t._id=e||t._id,t.g&&t.g.setAttribute("id",t._id),t)},this.class=function(e){if($i(e))return t._classNames;var r,n,i=(Array.isArray(e)?e:e.split(" ")).map((function(t){return t.replace(/\s\s+/g," ").trim()})).filter((function(t){return""!==t}));(t.original_classNames=t.original_classNames||t._classNames,t._classNames=Ui(new Set([].concat(Ui(t.original_classNames),Ui(i)))),t.g)&&((r=t.g.classList).remove.apply(r,Ui(t.g.classList)),(n=t.g.classList).add.apply(n,Ui(t._classNames)));return t},this.hasData=function(){return Bi(t)};var e=function(e,r){$i(r)||(t.scales[e]=r)};return this.x=function(r){return $i(r)?t.scales.x:(e("x",r||"x"),t)},this.y=function(r){return $i(r)?t.scales.y:(e("y",r||"y"),t)},this}function na(){return new ra}function ia(t){return function(t){if(Array.isArray(t))return aa(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return aa(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return aa(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function aa(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}ra.prototype=Object.create(na.prototype),ra.prototype=Object.assign(na.prototype,{node:Qi,data:function(t,e){if(!t)return Bi(this)?this._data||null:this;if(!Bi(this))return this;if("function"==typeof arguments[0])return this._accessor=arguments[0],this;this._orginalData=this._orginalData||t;var r=e||this._accessor;return this._accessor=r,this._data=r&&!this._accessorApplied?t.map((function(t,e,n){return t instanceof Object?Object.assign({},t,r(t,e,n)):r(t,e,n)})):t,this._accessorApplied=!0,this},add:Xi,snap:Xi,parent:function(t){return t?(this.parentNode=t,this):this.parentNode},render:function(t){return this.g||(this.g=Zi("g"),this._id&&this.g.setAttribute("id",this._id),Bi(this)&&t?"stack"===t.type||"group"===t.group?t.g.prepend(this.g):t.g.append(this.g):this.currentNode.append(this.g),this.update()),this},update:function(){return this.parentNode&&this.parentNode.scales.x[this.scales.x]&&this.parentNode.scales.y[this.scales.y]&&this.draw(),this},curve:function(t){return $i(t)?this.interpolationFunction:(this.interpolationFunction=t,this)},attr:Ki,show:function(){return ta.call(this,!0)},hide:function(){return ta.call(this,!1)}});var sa=Ji.isNull,oa=Ji.add;function la(){var t=this;ra.call(this),this.type="stack",this._grouped=1,this._groupIndex=0,this._orientation="bottom",this._dataMap={x:{},y:{}},this._classNames=["chrt-stack"],this.orientation=function(e){if(sa(e))return t._orientation;return t._orientation=["bottom","left"].indexOf(e)>-1?e:t._orientation,t},this.add=function(e){e._stacked=t,oa.call(t,e);var r=e.data;return e.data=function(n,i){return sa(n)||(n=n.map((function(e){var r,n,i=null!==(r=e.x)&&void 0!==r?r:e.x0,a=null!==(n=e.y)&&void 0!==n?n:e.y0;t._dataMap.x[i]||(t._dataMap.x[i]={x:i,values:[]}),t._dataMap.x[i].values.push(e);var s=sa(t._dataMap.x[i].y0)?null:t._dataMap.x[i].y0,o=sa(t._dataMap.x[i].y0_neg)?null:t._dataMap.x[i].y0_neg;e.y>=0?t._dataMap.x[i].y0="bottom"!==t._orientation?null:(s||0)+a:t._dataMap.x[i].y0_neg="bottom"!==t._orientation?null:(o||0)+a,t._dataMap.y[a]||(t._dataMap.y[a]={y:a,values:[]}),t._dataMap.y[a].values.push(e);var l=sa(t._dataMap.y[a].x0)?null:t._dataMap.y[a].x0,c=sa(t._dataMap.y[a].x0_neg)?null:t._dataMap.y[a].x0_neg;return e.x>=0?t._dataMap.y[a].x0="left"!==t._orientation?null:(l||0)+i:t._dataMap.y[a].x0_neg="left"!==t._orientation?null:(c||0)+i,Object.assign({},e,{stacked_y:isNaN(a)?a:(a>=0?s:o||0)+a,stacked_y0:a>=0?s:o,stacked_x:isNaN(i)?i:((i>=0?l:c)||0)+i,stacked_x0:i>=0?l:c})}))),r.call(e,n,i)},t},this.snap=this.add,this.draw=function(){var e,r,n="group"===t.parentNode.type?t.parentNode.parentNode:t.parentNode;return t.objects.forEach((function(t){-1===n.objects.map((function(t){return t._id})).indexOf(t._id)&&n.add(t)})),ea.call(t,t.attr("display")()),(e=t.g.classList).remove.apply(e,ia(t.g.classList)),(r=t.g.classList).add.apply(r,ia(t._classNames)),t.objects.forEach((function(t){return t.draw()})),t}}function ca(){return new la}la.prototype=Object.create(ra.prototype),la.prototype.constructor=la,la.parent=ra.prototype,la.prototype=Object.assign(la.prototype,{});var ua=Ji.isNull,ha=Ji.add;function da(){var t=this;ra.call(this),this.type="group",this.attr("width",1),this._classNames=["chrt-group"],this.width=function(e){return ua(e)?t.attr("width")():(t.attr("width",Math.min(Math.max(e,0),1)),t)},this.add=function(e){return ha.call(t,e),e._groupIndex=t.objects.length-1,t.objects.forEach((function(e){e._group=t,e._grouped=t.objects.length})),t},this.snap=this.add,this.draw=function(){var e,r;return t.objects.forEach((function(e){-1===t.parentNode.objects.map((function(t){return t._id})).indexOf(e._id)&&t.parentNode.add(e)})),t.objects.forEach((function(t){return t.draw()})),ea.call(t,t.attr("display")()),(e=t.g.classList).remove.apply(e,ia(t.g.classList)),(r=t.g.classList).add.apply(r,ia(t._classNames)),t}}function fa(){return new da}function pa(t){return function(t){if(Array.isArray(t))return ya(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return ya(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ya(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ya(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function ga(t){var e=this.attr("position")();return void 0===t?e:this.attr("position",Object.assign({},e,t))}function va(t){var e=this.attr("alignment")();return void 0===t?e:this.attr("alignment",Object.assign({},e,t))}da.prototype=Object.create(ra.prototype),da.prototype.constructor=da,da.parent=ra.prototype,da.prototype=Object.assign(da.prototype,{snap:ha});var ba=Ke.isNull,ma=Ke.create;function xa(t){var e=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{x:"x",y:"y"};nr.call(this),this.type="annnotation",this.div=null,this.attr("text",null!=t?t:""),this.attr("color",null),this.attr("position",{}),this.attr("alignment",{horizontal:"middle",vertical:"middle"}),this.attr("offset",[0,0]),this._classNames=["chrt-annotation"],this.text=function(t){return e.attr("text",t)},this.draw=function(){var t,n;if("chrt"!==e.parentNode.type)return e;var i,a,s={x:e.parentNode.scales.x[r.x]||Object.values(e.parentNode.scales.x)[0],y:e.parentNode.scales.y[r.y]||Object.values(e.parentNode.scales.y)[0]};e.div||(e.div=ma("div"),e.parentNode.root.appendChild(e.div),""===(null===(i=e.parentNode.root)||void 0===i||null===(a=i.style)||void 0===a?void 0:a.position)&&(e.parentNode.root.style.position="relative"),e.div.style.position="absolute",e.g=e.div);if(console.log("display",e.attr("display")()),rr.call(e,e.attr("display")()),e.div.setAttribute("id",e.id()),(t=e.div.classList).remove.apply(t,pa(e.div.classList)),(n=e.div.classList).add.apply(n,pa(e._classNames)),s&&s.x){var o=e.attr("position")(),l=ba(o.x)?0:s.x(o.x),c=ba(o.y)?0:s.y(o.y),u=e.attr("offset")();e.div.style.left="".concat(l+u[0],"px"),e.div.style.top="".concat(c+u[1],"px")}var h={x:0,y:0},d=e.attr("alignment")();switch(d.horizontal){case"left":h.x="0";break;case"right":h.x="-100%";break;default:h.x="-50%"}switch(d.vertical){case"bottom":h.y="0";break;case"top":h.y="-100%";break;default:h.y="-50%"}e.div.style.transform="translate(".concat(h.x,",").concat(h.y,")");var f,p=e.div.querySelector("span");p||((p=ma("span")).style.color=null!==(f=e.color()())&&void 0!==f?f:"inherit",e.div.appendChild(p));return p.innerHTML=e.attr("text")(),e}}function _a(t,e){return new xa(t,e)}function Na(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function Aa(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,a,s,o=[],l=!0,c=!1;try{if(a=(r=r.call(t)).next,0===e);else for(;!(l=(n=a.call(r)).done)&&(o.push(n.value),o.length!==e);l=!0);}catch(t){c=!0,i=t}finally{try{if(!l&&null!=r.return&&(s=r.return(),Object(s)!==s))return}finally{if(c)throw i}}return o}}(t,e)||wa(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ka(t){return function(t){if(Array.isArray(t))return Na(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||wa(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function wa(t,e){if(t){if("string"==typeof t)return Na(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Na(t,e):void 0}}function Oa(t){return null===t||null==t||void 0===t}function Ma(t){return"number"==typeof t&&!isFinite(t)}function ja(t){var e=this;return null!=this&&this.fields?t.map((function(t){var r=Oa(t[e.fields.x])||Ma(t[e.fields.x])?null:e.parentNode.scales.x[e.scales.x](t[e.fields.x]),n=Oa(t[e.fields.y])||Ma(t[e.fields.y])?null:e.parentNode.scales.y[e.scales.y](t[e.fields.y]);return[Ma(r)?0:r,Ma(n)?0:n]})):[]}xa.prototype=Object.create(nr.prototype),xa.prototype.constructor=xa,xa.parent=nr.prototype,xa.prototype=Object.assign(xa.prototype,{color:function(t){return this.attr("color",t)},position:ga,top:function(t){return ga.call(this,{y:t})},left:function(t){return ga.call(this,{x:t})},align:function(t){return void 0===t?va.call(this).horizontal:va.call(this,{horizontal:t})},valign:function(t){return void 0===t?va.call(this).vertical:va.call(this,{vertical:t})},offset:function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];if(!e.length)return this.attr("offset")();var n=this.attr("offset")(),i=e[0],a=e[1];return this.attr("offset",[null!=i?i:n[0],null!=a?a:n[1]])}});var Sa=function(t,e){var r,n=t.reduce((function(t,e){return Oa(e[1])?t.push([]):t[t.length-1].push(e),t}),[[]]).map((function(t){return t.reduce((function(t,r,n,i){return t.push(0===n?"M".concat(isNaN(r[0])?0:r[0],",").concat(isNaN(r[1])?0:r[1]):"".concat(e(r,n,i))),t}),[])}));return(r=[]).concat.apply(r,ka(n))};var La=function(t){return"L".concat(isNaN(t[0])?0:t[0],",").concat(isNaN(t[1])?0:t[1])};var Ea=function(t,e,r,n){var i,a,s,o,l=(i=e||t,s=(a=r||t)[0]-i[0],o=a[1]-i[1],{length:Math.sqrt(Math.pow(s,2)+Math.pow(o,2)),angle:Math.atan2(o,s)}),c=l.angle+(n?Math.PI:0),u=.1*l.length;return[t[0]+Math.cos(c)*u,t[1]+Math.sin(c)*u]},Fa=function(t,e,r){if(isNaN(t[0])||isNaN(t[1]))return"";var n=Aa(Ea(r[e-1],r[e-2],t),2),i=n[0],a=n[1],s=Aa(Ea(t,r[e-1],r[e+1],!0),2),o=s[0],l=s[1];return"C ".concat(i,",").concat(a," ").concat(o,",").concat(l," ").concat(t[0],",").concat(t[1])};function Pa(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ca;return Sa(ja.call(this,t),e)}var Ca=function(t,e,r){var n=((isNaN(t[0])?0:t[0])+(isNaN(r[e-1][0])?0:r[e-1][0]))/2;return"L".concat(isNaN(n)?0:n,",").concat(isNaN(r[e-1][1])?0:r[e-1][1],"\n    L").concat(isNaN(n)?0:n,",").concat(isNaN(t[1])?0:t[1],"\n      L").concat(isNaN(t[0])?0:t[0],",").concat(isNaN(t[1])?0:t[1])},Ia=function(t,e,r){return"L".concat(isNaN(t[0])?0:t[0],",").concat(isNaN(r[e-1][1])?0:r[e-1][1],"\n                                    L").concat(isNaN(t[0])?0:t[0],",").concat(isNaN(t[1])?0:t[1])},Ta=function(t,e,r){return"L".concat(isNaN(r[e-1][0])?0:r[e-1][0],",").concat(isNaN(t[1])?0:t[1],"\n                                    L").concat(isNaN(t[0])?0:t[0],",").concat(isNaN(t[1])?0:t[1])},Da=Object.freeze({__proto__:null,linear:function(t){return Sa(ja.call(this,t),La)},spline:function(t){return Sa(ja.call(this,t),Fa)},step:Pa,stepAfter:function(t){return Pa.call(this,t,Ia)},stepBefore:function(t){return Pa.call(this,t,Ta)}});function Wa(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function za(t){return function(t){if(Array.isArray(t))return qa(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return qa(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return qa(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function qa(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Ga(t){return this.attr("radius",t)}function Ua(t){return this.attr("strokeWidth",t)}function Ra(t){return this.attr("orient",t)}function Va(){return Ra.call(this,"horizontal")}var $a=Ke.isNull,Ha=Ke.createSVG,Ba=3,Ya="#000";function Za(){var t=this;nr.call(this),this.type="series",this.attr("radius",Ba),this.attr("stroke",Ya),this.attr("fill",Ya),this.attr("strokeWidth",0),this.attr("strokeOpacity",1),this.attr("fillOpacity",1),this.attr("range",!1),this.attr("rangeWidth",Ba),this.attr("rangeColor",Ya),Va.call(this),this._classNames=["chrt-dotplot"],this.getXScale=function(){return $a(t.fields.x)&&(t.fields.x=t.parentNode.scales.x[t.scales.x].field),t.parentNode.scales.x[t.scales.x]},this.draw=function(){var e,r;if(rr.call(t,t.attr("display")()),(e=t.g.classList).remove.apply(e,za(t.g.classList)),(r=t.g.classList).add.apply(r,za(t._classNames)),!$a(t._data)){if($a(t.fields.x)&&(t.fields.x=t.parentNode.scales.x[t.scales.x].field),$a(t.fields.y)&&(t.fields.y=t.parentNode.scales.y[t.scales.y].field),t.attr("range")()){var n=t.attr("rangeWidth")(),i=t.attr("rangeColor")(),a="vertical"===t.attr("orient")()?"x":"y",s=t._data.reduce((function(e,r){var n,i="x"===a?t.fields.y:t.fields.x;e[r[t.fields[a]]]=e[r[t.fields[a]]]||(Wa(n={},a,r[t.fields[a]]),Wa(n,"data",[]),Wa(n,"field",a),Wa(n,"otherField",i),n),e[r[t.fields[a]]].data.push(r);var s=e[r[t.fields[a]]].data.map((function(t){return t[i]}));return e[r[t.fields[a]]].max=Math.max.apply(Math,za(s)),e[r[t.fields[a]]].min=Math.min.apply(Math,za(s)),e}),{});Object.values(s).forEach((function(e,r){var s=escape("range-".concat(e[a],"-").concat(r)),o=t.g.querySelector("[data-id='".concat(s,"']"));if(o||((o=Ha("line")).setAttribute("data-id",s),t.g.appendChild(o)),!$a(t.parentNode.scales.x[t.scales.x])&&!$a(t.parentNode.scales.y[t.scales.y])){var l,c=(Wa(l={},e.field,t.parentNode.scales[e.field][t.scales[e.field]](e[e.field])),Wa(l,"".concat(e.otherField,"Min"),t.parentNode.scales[e.otherField][t.scales[e.otherField]](e.min)),Wa(l,"".concat(e.otherField,"Max"),t.parentNode.scales[e.otherField][t.scales[e.otherField]](e.max)),l);"y"===a?(o.setAttribute("x1",isNaN(c["".concat(e.otherField,"Min")])?0:c["".concat(e.otherField,"Min")]),o.setAttribute("x2",isNaN(c["".concat(e.otherField,"Max")])?0:c["".concat(e.otherField,"Max")]),o.setAttribute("y1",isNaN(c[e.field])?0:c[e.field]),o.setAttribute("y2",isNaN(c[e.field])?0:c[e.field])):(o.setAttribute("y1",isNaN(c["".concat(e.otherField,"Min")])?0:c["".concat(e.otherField,"Min")]),o.setAttribute("y2",isNaN(c["".concat(e.otherField,"Max")])?0:c["".concat(e.otherField,"Max")]),o.setAttribute("x1",isNaN(c[e.field])?0:c[e.field]),o.setAttribute("x2",isNaN(c[e.field])?0:c[e.field])),o.setAttribute("stroke-width",n),o.setAttribute("stroke",i)}}))}t._data.forEach((function(e,r,n){var i=escape("circle-".concat(name,"-").concat(r)),a=t.g.querySelector("[data-id='".concat(i,"']"));if(a||((a=Ha("circle")).setAttribute("data-id",i),t.g.appendChild(a)),!$a(t.parentNode.scales.x[t.scales.x])&&!$a(t.parentNode.scales.y[t.scales.y])){var s=t.parentNode.scales.x[t.scales.x](e[t.fields.x]),o=t.parentNode.scales.y[t.scales.y](e[t.fields.y]),l=isNaN(s)?0:s,c=isNaN(o)?0:o,u=t.attr("radius")(e,r,n);e.anchorPoints={x:l,width:u,y:c,height:u,relativePosition:[0,0],directions:{x:1,y:1},alignment:{horizontal:"middle",vertical:"top"}},a.setAttribute("cx",l),a.setAttribute("cy",c),a.setAttribute("r",u),a.setAttribute("fill",t.attr("fill")(e,r,n)),a.setAttribute("fill-opacity",t.attr("fillOpacity")(e,r,n)||1),a.setAttribute("stroke",t.attr("stroke")(e,r,n)),a.setAttribute("stroke-width",t.attr("strokeWidth")(e,r,n)),a.setAttribute("stroke-opacity",t.attr("strokeOpacity")(e,r,n))}}))}return t.objects.forEach((function(t){return t.draw()})),t.parentNode}}function Xa(){return new Za}function Ja(t){return function(t){if(Array.isArray(t))return Ka(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||function(t,e){if(!t)return;if("string"==typeof t)return Ka(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ka(t,e)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Ka(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Qa(t){return this.attr("fill",t)}Za.prototype=Object.create(nr.prototype),Za.prototype.constructor=Za,Za.parent=nr.prototype,Za.prototype=Object.assign(Za.prototype,{pointSize:Ga,size:Ga,radius:Ga,color:function(t){return this.attr("fill",t)},stroke:function(t){return this.attr("stroke",t)},width:Ua,strokeWidth:Ua,opacity:function(t){return this.attr("fillOpacity",t)},strokeOpacity:function(t){return this.attr("strokeOpacity",t)},range:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.attr("range",t)},rangeColor:function(t){return this.attr("rangeColor",t)},rangeWidth:function(t){return this.attr("rangeWidth",t)},orient:Ra,horizontal:Va,vertical:function(){return Ra.call(this,"vertical")}});var ts=Ke.isNull;function es(t){return ts(t)||"function"==typeof t||(this._range=Object.assign({},this._range,t)),this}function rs(t){return this.attr("lineStyle",t)}var ns="#ddd",is="#000",as=1,ss=1,os=1;function ls(){var t=this;return nr.call(this),this.type="range",this.g=null,this.attr("fill",ns),this.attr("stroke",is),this.attr("fillOpacity",os),this.attr("strokeOpacity",as),this.attr("strokeWidth",ss),this.attr("lineStyle","solid"),this._range={},this._classNames=["chrt-range"],this.solid=function(){return rs.call(t,"solid")},this.dashed=function(){return rs.call(t,"dashed")},this.dotted=function(){return rs.call(t,"dotted")},this.strokeOpacity=function(e){return t.attr("strokeOpacity",e)},this.parentNode}ls.prototype=Object.create(nr.prototype),ls.prototype.constructor=ls,ls.parent=nr.prototype,ls.prototype=Object.assign(ls.prototype,{color:Qa,fill:Qa,stroke:function(t){return this.attr("stroke",t)},strokeWidth:function(t){return this.attr("strokeWidth",t)},fillOpacity:function(t){return this.attr("fillOpacity",t)},lineStyle:rs,from:function(t){return es.call(this,{from:t})},to:function(t){return es.call(this,{to:t})}});var cs=Ke.isNull,us=Ke.createSVG;function hs(){var t=this;ls.call(this),this.class(["chrt-range","chrt-horizontal-range"]),this.draw=function(){var e,r,n,i;if(!["chrt"].includes(t.parentNode.type))return t.parentNode;t.parentNode.type,t.g||(t.g=us("g"),t.g.setAttribute("data-name","".concat(t.parentNode.type,"-range"))),rr.call(t,t.attr("display")()),t.g.setAttribute("id","".concat(t.parentNode.type,"Range-").concat(t.id())),(e=t.g.classList).remove.apply(e,Ja(t.g.classList)),(r=t.g.classList).add.apply(r,Ja(t._classNames));var a=t.attr("fill")(),s=t.attr("fillOpacity")(),o=t.attr("stroke")(),l=t.attr("strokeOpacity")(),c=t.attr("strokeWidth")(),u=t.parentNode,h=u.scales,d=u.width,f=u._margins,p=null,y=null;if(h&&h.y[null!==(n=null==t||null===(i=t.parentNode)||void 0===i?void 0:i.name)&&void 0!==n?n:"y"]){var g,v,b=h.y[null!==(g=null==t||null===(v=t.parentNode)||void 0===v?void 0:v.name)&&void 0!==g?g:"y"];p=cs(t._range.from)?p:b(t._range.from),y=cs(t._range.to)?y:b(t._range.to)}if(!(isNaN(p)||isNaN(y)||(t.path||(t.path=us("path"),t.g.appendChild(t.path)),cs(p)&&cs(y)||isNaN(p)&&isNaN(y)))){if(t.g.setAttribute("transform","translate(".concat(f.left,",0)")),(p=cs(p)?y:p)===(y=cs(y)?p:y))t.path.remove(),t.path=null;else{var m=[[0,p],[0,y],[d-(f.right+f.left),y],[d-(f.right+f.left),p]];t.path.setAttribute("d","M".concat(m.join("L"),"z")),t.path.setAttribute("fill",a),t.path.setAttribute("fill-opacity",s)}var x=t.attr("lineStyle")();if(!cs(x))switch(x){case"dashed":t._strokeStyle="".concat(4*c," ").concat(4*c);break;case"dotted":t._strokeStyle="".concat(c," ").concat(c);break;default:t._strokeStyle=null}var _=Ja(new Set([p,y]));return cs(t.lines)&&(t.lines=[]),_.forEach((function(e,r){t.lines[r]||(t.lines[r]=us("line"),t.g.appendChild(t.lines[r]));var n=t.lines[r];n.setAttribute("x1",0),n.setAttribute("x2",d-(f.left+f.right)),n.setAttribute("y1",e),n.setAttribute("y2",e),n.setAttribute("stroke",o),n.setAttribute("stroke-width",c),n.setAttribute("stroke-opacity",l),cs(t._strokeStyle)||n.setAttribute("stroke-dasharray",t._strokeStyle)})),t.parentNode}}}function ds(){return new hs}hs.prototype=Object.create(ls.prototype),hs.prototype.constructor=hs,hs.parent=ls.prototype;var fs=Ke.isNull,ps=Ke.createSVG;function ys(){var t=this;ls.call(this),this.class(["chrt-range","chrt-vertical-range"]),this.draw=function(){var e,r,n,i;if(!["chrt"].includes(t.parentNode.type))return t.parentNode;t.g||(t.g=ps("g"),t.g.setAttribute("data-name","".concat(t.parentNode.type,"-range"))),rr.call(t,t.attr("display")()),t.g.setAttribute("id","".concat(t.parentNode.type,"Range-").concat(t.id())),(e=t.g.classList).remove.apply(e,Ja(t.g.classList)),(r=t.g.classList).add.apply(r,Ja(t._classNames));var a=t.attr("fill")(),s=t.attr("fillOpacity")(),o=t.attr("stroke")(),l=t.attr("strokeOpacity")(),c=t.attr("strokeWidth")(),u=t.parentNode,h=u.scales,d=u.height,f=u._margins,p=null,y=null;if(h&&h.x[null!==(n=null==t||null===(i=t.parentNode)||void 0===i?void 0:i.name)&&void 0!==n?n:"x"]){var g,v,b=h.x[null!==(g=null==t||null===(v=t.parentNode)||void 0===v?void 0:v.name)&&void 0!==g?g:"x"];p=fs(t._range.from)?p:b(t._range.from),y=fs(t._range.to)?y:b(t._range.to)}if(!(isNaN(p)||isNaN(y)||(t.path||(t.path=ps("path"),t.g.appendChild(t.path)),fs(p)&&fs(y)))){if(t.g.setAttribute("transform","translate(0, ".concat(d-f.bottom-1,")")),(p=fs(p)?y:p)===(y=fs(y)?p:y))t.path.remove(),t.path=null;else{var m=[[p,0],[y,0],[y,-(d-(f.top+f.bottom))],[p,-(d-(f.top+f.bottom))]];t.path.setAttribute("d","M".concat(m.join("L"),"z")),t.path.setAttribute("fill",a),t.path.setAttribute("fill-opacity",s)}var x=t.attr("lineStyle")();if(!fs(x))switch(x){case"dashed":t._strokeStyle="".concat(4*c," ").concat(4*c);break;case"dotted":t._strokeStyle="".concat(c," ").concat(c);break;default:t._strokeStyle=null}var _=Ja(new Set([p,y]));return fs(t.lines)&&(t.lines=[]),_.forEach((function(e,r){t.lines[r]||(t.lines[r]=ps("line"),t.g.appendChild(t.lines[r]));var n=t.lines[r];n.setAttribute("x1",e),n.setAttribute("x2",e),n.setAttribute("y1",0),n.setAttribute("y2",-(d-(f.top+f.bottom))),n.setAttribute("stroke",o),n.setAttribute("stroke-width",c),n.setAttribute("stroke-opacity",l),fs(t._strokeStyle)||n.setAttribute("stroke-dasharray",t._strokeStyle)})),t.parentNode}}}function gs(){return new ys}ys.prototype=Object.create(ls.prototype),ys.prototype.constructor=ys,ys.parent=ls.prototype,t.Chrt=tt,t.annotation=_a,t.axisTitle=de,t.bars=Jr,t.chrtAnnotation=_a,t.chrtAxisTitle=de,t.chrtBars=Jr,t.chrtColumns=rn,t.chrtDotPlot=Xa,t.chrtGroup=fa,t.chrtHistograms=ln,t.chrtHorizontalRange=ds,t.chrtLabel=li,t.chrtLabels=hi,t.chrtLine=Mr,t.chrtMarkers=Gi,t.chrtPoints=kn,t.chrtStack=ca,t.chrtVerticalRange=gs,t.columns=rn,t.dotPlot=Xa,t.group=fa,t.histograms=ln,t.horizontalGrid=function(t,e){return Ue.call(this,"y",t,e)},t.horizontalRange=ds,t.interpolations=Da,t.label=li,t.labels=hi,t.line=Mr,t.markers=Gi,t.points=kn,t.stack=ca,t.version="0.0.170",t.verticalGrid=function(t,e){return Ue.call(this,"x",t,e)},t.verticalRange=gs,t.xAxis=function(t,e){return new ee(t,e)},t.yAxis=function(t,e){return new ie(t,e)}}));